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:
@@ -2,7 +2,7 @@
|
||||
// beacon. The streaming itself — what is sent, when, and when it stops — is `lib/diagnostics.ts`.
|
||||
import type { LogEvent } from "../log";
|
||||
import type { ServerLogRow } from "./admin";
|
||||
import { beacon, getActiveAccount, identityHeaders, req } from "./core";
|
||||
import { beacon, identityHeaders, req } from "./core";
|
||||
|
||||
/** Alap / Részletes / Teljes. The server decides how long a raised level lasts. */
|
||||
export type DiagnosticsLevel = "INFO" | "DEBUG" | "TRACE";
|
||||
@@ -123,12 +123,7 @@ export const debugSessionsApi = {
|
||||
req(`${SESSIONS}/${id}/preview`, { method: "POST", body: JSON.stringify({ text }) }),
|
||||
removeDebugScreenshot: (id: string, shotId: number): Promise<{ ok: true; deleted: number }> =>
|
||||
req(`${SESSIONS}/${id}/screenshots/${shotId}`, { method: "DELETE" }),
|
||||
/** Where an `<img>` loads a screenshot from. An `<img>` cannot send the account header, so the
|
||||
* tab's account rides as `?account=` (the wallet-gated selection downloads use); without it a
|
||||
* per-tab account's screenshot resolves to the session default and 404s. */
|
||||
debugScreenshotUrl: (id: string, shotId: number): string => {
|
||||
const a = getActiveAccount();
|
||||
const url = `${SESSIONS}/${id}/screenshots/${shotId}`;
|
||||
return a != null ? `${url}?account=${a}` : url;
|
||||
},
|
||||
/** Where an `<img>` loads a screenshot from. */
|
||||
debugScreenshotUrl: (id: string, shotId: number): string =>
|
||||
`${SESSIONS}/${id}/screenshots/${shotId}`,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user