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
+8 -1
View File
@@ -1789,6 +1789,12 @@ const reloadMenuTargetWindow = () => {
target.webContents.reload();
};
const openDevToolsForMenuTarget = () => {
const target = getMenuTargetWindow();
if (!target || target.isDestroyed()) return;
target.webContents.toggleDevTools();
};
const relaunchFromMenu = () => {
prepareForQuit();
app.relaunch();
@@ -3813,6 +3819,7 @@ const buildMacMenu = () => {
submenu: [
{ label: 'Keyboard Shortcuts', accelerator: 'Cmd+.', click: () => dispatchAction('help-dialog') },
{ label: 'Show Diagnostics', accelerator: 'Cmd+Shift+L', click: () => dispatchAction('download-logs') },
{ label: 'Toggle Developer Tools', accelerator: 'Cmd+Alt+I', click: () => openDevToolsForMenuTarget() },
{ type: 'separator' },
{ label: 'Clear Cache', click: () => void handleInvoke(null, 'desktop_clear_cache') },
{ type: 'separator' },
@@ -3880,7 +3887,7 @@ const buildAutoHiddenMenu = () => {
submenu: [
{ role: 'reload' },
{ role: 'forceReload' },
...(isDev ? [{ role: 'toggleDevTools' }] : []),
{ label: 'Toggle Developer Tools', accelerator: 'Ctrl+Alt+I', click: () => openDevToolsForMenuTarget() },
{ type: 'separator' },
{ label: 'Toggle Right Sidebar', accelerator: 'Ctrl+B', click: () => dispatchAction('toggle-right-sidebar') },
{ label: 'Open Git Sidebar', accelerator: 'Ctrl+Shift+G', click: () => dispatchAction('open-right-sidebar-git') },