# The Cookies screen — `/cookies`, one row per service, one button each Operator, 2026-11-16: "Make a dedicated screen for cookie refreshes like Rumble and X, because sometimes the settings screen takes too long to load when most of the time I'm going for this one operation over and over." The nav's third recorded exception (editor/app/lib/nav.ts): one operation pressed over and over, from a phone. ## Why /settings is slow, and what /cookies reads instead Measured on the live editor (read-only GETs, load average 19): /settings rendered on the server in 0.2–0.6 s, the dashboard in 4.7 s and /jobs in 5.5 s. The server work is not the cost. The cost is what /settings ships and redraws: - the whole parsed settings object (122 KB, 110 KB of it `autoQueue`) as SettingsForm's `initial`: 153 KB of RSC and 238 KB of HTML, for a 480-line form to hydrate on a phone; - `getSettings()` three times per render (layout metadata, layout, page), each a synchronous parse; - a tree re-render whenever the pulse moves (any job change). /cookies (`editor/app/lib/cookieStatus.ts`) reads only what its rows show: `.service-cookies.json` (through `loadCookieAlerts`, which carries X's jar age), settings parsed once for `cookiesFromBrowser` and `social.x` (nothing of it sent to the browser), a stat of X's jar, archive.today's and each forum host's `session.json`, one channel config per yt-dlp service (its last clean request's channel), and one name-only read of the browser's cookie store, cached 5 min. It is exempt from AutoRefresh and polls its own `cookieStatus` view. ## The rows (`common/lib/cookieStatus.ts`) | Service | Age from | The one button | |---|---|---| | X, connected profile | the exported jar's mtime | Refresh cookies (`refreshXCookiesAction`); X's alert is rechecked from disk after it | | X, no profile | — | Connect X account (headed) | | X, browser login | Firefox's x.com `auth_token` last sent | Check again (recheck "x": no request) | | Rumble, Odysee | Firefox's `cf_clearance` issued / expiry | Check again (`recheckServiceCookiesAction`) | | YouTube | Firefox's sign-in cookies last sent | Check again | | archive.today | the last Connect | Connect archive session (headed) | | each forum host | the last Connect | Connect forum session at the last thread met (headed) | The browser read (`common/lib/browserCookieAge.ts`) follows X's precedent: a private copy of the store and its WAL, `SELECT host, name, creationTime, lastAccessed, expiry, originAttributes` and never the value (a test fails if it does), no cookie name logged, cached 5 min, a failure shown as "unknown". A headed Connect's row says the window opens on the editor's machine. ## One press at a time (`editor/app/lib/cookieRefreshGuard.ts`) Every refresh, connect and recheck — /cookies, /settings, the dashboard, a forum channel's Connect, ops `recheck-service` — goes through `withCookieAction`: a second press for the service while one is in flight, or while a `recheck-service-cookies` job is queued or running on its queue, is refused with a sentence; the outcome is the service's last press (`actions` in `.service-cookies.json`). ## Round 2 (2026-11-16): full parity with /settings Operator: "The cookies page doesn't let me log into X, it and the others should be just as capable as the old settings menu version." Under each row's status and its one button, the service's whole session block, drawn by the components /settings (and a forum channel's page) draw, fed only its own slice (`lib/cookieControls.ts`): | Settings / channel control | On /cookies | |---|---| | X: login source, Check, max cookie age + Save, Connect X account, Refresh cookies, Forget session, X posts visibility | X row → "X account session" (open) — XSessionSection | | archive.today: Connect archive session, host, gap, cooldown, read past a check, Save | archive.today row → "Archive sources" — ArchiveSourcesSection | | cookiesFromBrowser, cookieMode (SettingsForm) | "Browser cookies for Rumble, YouTube and Odysee" — YtdlpCookieFields, saved alone (saveYtdlpCookieSourceAction) | | A forum thread's session state + Connect forum session | forum host row → "Forum session, per thread" — ForumSessionConnect, one per thread channel | | A forum thread's retry after a block, saved-page import | the thread's page, linked from its forum row (per thread, not per host) | The forum rows come from the forum-thread channels too (`lib/forumChannels.ts`: one config read per channel, ~40 ms over 231, never data/; remembered a minute while channels/'s mtime holds). With an X profile that holds no login, the row's one press is Connect, not Refresh. The e2e suite's fake browser covers Connect X account too. ## Ops `pnpm ops get cookies [fresh]` — the rows, read-only. Check again is `recheck-service`; Refresh cookies and the Connects stay clicks (a refresh loads x.com; a Connect opens a window). ## Tests Unit: `common/lib/browserCookieAge.test.ts`, `common/lib/cookieStatus.test.ts`, `common/social/fakeXProfileBrowser.test.ts`, `common/lib/serviceCookies-server.test.ts` (the last press), `editor/app/lib/cookieRefreshGuard.test.ts`, `editor/app/api/ops/_read.test.ts`, the view route test, nav.test, `scripts/archilyzer-ops.test.mjs`. e2e: `editor/e2e/cookies-screen.spec.ts` — a fixture Firefox store, Refresh cookies through the test server's fake browser (`E2E_FAKE_X_PROFILE_COOKIES_FILE`, inert unless `E2E_TEST_ROUTES=1` and the file is inside the slot's transcriptsDir), Check again through the fake yt-dlp, a phone's width.