fix: authenticate event-stream WebSocket before connecting

The global event-stream WebSocket opened before a valid oc_url_token was
minted, so the upgrade failed auth ("no valid credentials available") in
packaged builds with a UI password. The resulting reconnect storm churned
the sync store and made session status flicker busy<->idle. Await the URL
auth token before connecting (a WS upgrade can't send a bearer header like
SSE does) and drop a rejected token on pre-ready close so the next attempt
re-mints a fresh one.

Also harden /session/status reconciliation: the watchdog poll is now
monotonic (only confirms/raises active status, never blindly lowers a
busy/retry session to idle on a transient or misscoped snapshot). Idle is
applied only by the authoritative reconnect/escalation resync, which trusts
the live server snapshot as the source of truth. Add a Help -> Toggle
Developer Tools menu item so production builds can open the console.
This commit is contained in:
Bohdan Triapitsyn
2026-06-14 19:48:07 +03:00
parent 94ca3fda04
commit 9f06224151
5 changed files with 224 additions and 46 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ const buildAuthUrl = (apiBaseUrl: string | null | undefined, path: string): stri
}
};
const clearRuntimeUrlAuthToken = (): void => {
export const clearRuntimeUrlAuthToken = (): void => {
runtimeUrlAuthToken = '';
runtimeUrlAuthTokenExpiresAt = 0;
};