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,4 +49,26 @@ describe("removed features stay removed", () => {
|
||||
);
|
||||
expect(hits).toEqual([]);
|
||||
});
|
||||
|
||||
// One account per browser session (2026-10-20): the per-tab account pin, the header and `?account=`
|
||||
// that carried it, and the account list and switch went. A request naming an account would now
|
||||
// be ignored by the server, so a pin left behind reads as working while it does nothing. Only the
|
||||
// claim that clears the old pin keys (storage.ts) and its test may name them.
|
||||
it("leaves no per-tab account pin, header or switch", { timeout: 30_000 }, () => {
|
||||
const PIN =
|
||||
/X-Siftlode-Account|activeAccount|nextAccount|[?&]account=|switchAccount|\/api\/me\/(accounts|switch)/i;
|
||||
const allowed = new Set([
|
||||
"frontend/src/lib/storage.ts",
|
||||
"frontend/src/lib/localData.dom.test.ts",
|
||||
]);
|
||||
const hits = ["frontend/src", "frontend/e2e"]
|
||||
.flatMap(files)
|
||||
.filter((f) => !allowed.has(f) && f !== "frontend/src/lib/removedFeatures.contract.test.ts")
|
||||
.flatMap((f) =>
|
||||
readFileSync(new URL(f, REPO), "utf-8")
|
||||
.split("\n")
|
||||
.flatMap((line, i) => (PIN.test(line) ? [`${f}:${i + 1}: ${line.trim()}`] : [])),
|
||||
);
|
||||
expect(hits).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user