refactor(frontend): one account per browser, its local state under plain keys
The per-tab account pin, the X-Siftlode-Account header and ?account= go: the session cookie alone says who is asking. localStorage keys lose their account suffix; the browser records whose state it holds (siftlode.owner), BootGate hands it to the account the server answered as, and a different account starts from a clean slate (the public /watch keys stay). The first boot moves the account's old per-account copies onto the plain keys and drops other accounts' copies. Until the claim, and after another tab claimed the browser for someone else, the account helpers read and write nothing. The account panel lists no other accounts: "Add another account" becomes "Sign in as someone else" (Google's account chooser; the pick replaces this account, a cancel keeps it), shown where Google sign-in is configured.
This commit is contained in:
@@ -49,13 +49,14 @@ async function signIn(page: Page, email: string, path: string): Promise<void> {
|
||||
// would intercept every click — the test accounts have no YouTube connection, so it auto-opens),
|
||||
// and opt the account out of starting on Home. A bare URL lands on Home, and the feed, channel
|
||||
// and player flows this net locks all open "/" expecting the feed; the opt-out is the one
|
||||
// Settings → Appearance → Startup writes. Both flags are per-account:
|
||||
// `siftlode.onboarding.dismissed.<id>`, `siftlode.startOnHome.<id>`.
|
||||
// Settings → Appearance → Startup writes. Both flags are the account's local state, held for the
|
||||
// account the browser records as their owner (`siftlode.owner`, see storage.ts claimLocalData).
|
||||
await page.goto("/");
|
||||
await page.evaluate((id: number) => {
|
||||
localStorage.setItem("siftlode.owner", String(id));
|
||||
localStorage.setItem("siftlode.lang", "en");
|
||||
localStorage.setItem(`siftlode.onboarding.dismissed.${id}`, "1");
|
||||
localStorage.setItem(`siftlode.startOnHome.${id}`, "0");
|
||||
localStorage.setItem("siftlode.onboarding.dismissed", "1");
|
||||
localStorage.setItem("siftlode.startOnHome", "0");
|
||||
}, me.id);
|
||||
mkdirSync(dirname(path), { recursive: true });
|
||||
await page.context().storageState({ path });
|
||||
|
||||
Reference in New Issue
Block a user