From 44d6fe32d634eeca532fb57e02ecfa62b7ebcb63 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Wed, 20 Aug 2025 10:00:05 +0000 Subject: [PATCH] fix: frontend now properly handles DISABLE_AUTH and skips login screen - Frontend checks for disabled: true in security status - When auth is disabled, goes straight to dashboard - Fixes issue where login screen showed even with DISABLE_AUTH=true --- frontend-modern/src/App.tsx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx index 3c61da123..8611dcbdc 100644 --- a/frontend-modern/src/App.tsx +++ b/frontend-modern/src/App.tsx @@ -111,6 +111,31 @@ function App() { const securityRes = await apiFetch('/api/security/status'); const securityData = await securityRes.json(); console.log('[App] Security status:', securityData); + + // Check if auth is disabled via DISABLE_AUTH + if (securityData.disabled === true) { + console.log('[App] Auth is disabled via DISABLE_AUTH, skipping authentication'); + setHasAuth(false); + setNeedsAuth(false); + // Initialize WebSocket immediately since no auth needed + setWsStore(getGlobalWebSocketStore()); + + // Apply theme preference + const savedDarkMode = localStorage.getItem(STORAGE_KEYS.DARK_MODE); + const prefersDark = savedDarkMode !== null + ? savedDarkMode === 'true' + : window.matchMedia('(prefers-color-scheme: dark)').matches; + setDarkMode(prefersDark); + if (prefersDark) { + document.documentElement.classList.add('dark'); + } else { + document.documentElement.classList.remove('dark'); + } + + setIsLoading(false); + return; + } + const authConfigured = securityData.hasAuthentication || false; setHasAuth(authConfigured);