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:
@@ -16,11 +16,6 @@ const { reportError, notify, remove, getActiveToasts } = vi.hoisted(() => ({
|
||||
vi.mock("../errorDialog", () => ({ reportError }));
|
||||
vi.mock("../notifications", () => ({ notify, remove, getActiveToasts }));
|
||||
vi.mock("../../i18n", () => ({ default: { t: (k: string) => k, language: "en" } }));
|
||||
vi.mock("../activeAccount", () => ({
|
||||
activeAccountId: () => null,
|
||||
ACTIVE_ACCOUNT_KEY: "k",
|
||||
pinActiveAccount: () => {},
|
||||
}));
|
||||
|
||||
import { setDebugSession } from "../log";
|
||||
import { downloadsApi } from "./downloads";
|
||||
@@ -155,9 +150,9 @@ describe("uploadReq", () => {
|
||||
});
|
||||
|
||||
it("lets its own identity headers win over a caller's", () => {
|
||||
// Who a request is from is this layer's to state, not its caller's. Merged the other way round,
|
||||
// a caller's header of the same name would silently re-attribute the upload — to another
|
||||
// account, or (here) into someone else's debug session recording.
|
||||
// What a request is part of is this layer's to state, not its caller's. Merged the other way
|
||||
// round, a caller's header of the same name would silently re-attribute the upload into someone
|
||||
// else's debug session recording.
|
||||
setDebugSession("0123456789abcdef");
|
||||
try {
|
||||
void uploadReq("/u", body(), {
|
||||
|
||||
Reference in New Issue
Block a user