Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Let remember-me sessions survive a tab close

rcourtman1e58c7600430
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 9eb6e81f40..71a06a7a67 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -422,6 +422,12 @@ describe('App architecture', () => {
);
expect(appRuntimeStateSource).toContain('!hasLocalAuthBootstrapHint() &&');
expect(appRuntimeStateSource).toContain('!hasSSOCallbackSuccessHint()');
+ // Remember-me sessions ride an HttpOnly cookie with no per-tab artifacts,
+ // so the remembered-username hint must keep the /api/state probe reachable
+ // after a tab close (issue #1531).
+ expect(appRuntimeStateSource).toContain(
+ 'window.localStorage.getItem(STORAGE_KEYS.REMEMBERED_LOGIN_USERNAME)',
+ );
expect(appRuntimeStateSource).toContain('aiChatStore.setEnabled(');
expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPatrolFindings()');
expect(appRuntimeStateSource).toContain('aiIntelligenceStore.loadPendingApprovals()');
diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.ts
index 1ac7cdac9f..e096b73617 100644
--- a/frontend-modern/src/useAppRuntimeState.ts
+++ b/frontend-modern/src/useAppRuntimeState.ts
@@ -98,7 +98,20 @@ export const useAppRuntimeState = () => {
}
try {
- return Boolean(window.sessionStorage.getItem(STORAGE_KEYS.AUTH_USER));
+ if (window.sessionStorage.getItem(STORAGE_KEYS.AUTH_USER)) {
+ return true;
+ }
+ } catch {
+ // Fall through to the remember-me hint below.
+ }
+
+ // A remembered login username means this browser signed in with
+ // "remember me", so an HttpOnly session cookie may still be valid even
+ // though every per-tab artifact died with the tab. Without this hint the
+ // pre-auth short-circuit pins the user back to the login page and the
+ // 30-day session never gets a chance to authenticate (issue #1531).
+ try {
+ return Boolean(window.localStorage.getItem(STORAGE_KEYS.REMEMBERED_LOGIN_USERNAME));
} catch {
return false;
}