The harness browser
The harness controls a local Chromium with Playwright and CDP on port 9222. The window is visible. This is correct and necessary.
┌─────────────────────┐ CDP 9222 ┌──────────────────────────────┐│ ungoogled-chromium │ ◄──────────► │ playwright connectOverCDP ││ chromium-profile/ │ │ scripts/inspect-api.ts ││ (outside the repo) │ │ → .api-dumps/*.json ││ + the extension │ └──────────────────────────────┘└─────────────────────┘-
Run
npm run build. Then runnpm run browser:launch. The script does not start a second browser on port 9222. To keep the browser after the shell closes, runnohup npm run browser:launch > /tmp/gopher-launch.log 2>&1 &. Then wait untilcurl http://localhost:9222/json/versiongives an answer. -
A person must sign in one time in the visible window. Go to
patreon.com, sign in, do the Cloudflare challenge, and go to the home page. The profile is in the directorychromium-profile/below${XDG_STATE_HOME:-$HOME/.local/state}/gopher/. It keeps the cookies after a restart. If the session becomes invalid, do this step again. The harness cannot do the Cloudflare challenge and cannot type the password. -
npm run api:inspectrecords each answer to/api/current_userand/api/posts. Read Patreon in the window while the script operates. The files go to.api-dumps/. -
npm run api:checkcalls/api/current_userin the page. Exit code 0 means that the session is correct and that a minimum of one campaign is available. Exit code 1 means that the account is not signed in, that a challenge is open, or that there are no campaigns. The scripts connect withnoDefaults: true, because Chromium 152 and later refuse theBrowser.setDownloadBehaviorcall that Playwright usually sends. -
To find the cause of exit code 1, look at the page. Each condition has a different mark:
Condition Mark in the page Not signed in h1is “Where Creator Communities Thrive”. No form and no challengeCloudflare challenge An iframefor the challenge, or the text “Verify you are human”Sign-in form An input[type="password"]elementCompare a host pattern with
url.hostname, or put a/at the end of the origin. A regular expression with$at the end never matches a full URL. -
To install a new build without a restart of the browser: run
npm run build, then openchrome://extensionsand click the reload button. You can also do this with Playwright and thedeveloperPrivateAPI. Then open apatreon.comtab again. If the manifest changed, you must do a full reload. Look atchrome://extensions→ Gopher → “Errors” if the extension does not operate.
The examination sequence
npm run compilenpm run buildnpm testnpm run api:check- Manual examination of the panel in the harness browser
The “Verified, and not verified” section of memory.md, at the root of the repository, tells
you what each step proves.
To do the examination with a session: run npm run build, run npm run browser:launch, sign in
in the window, and run npm run api:check. Then open the panel.