fix: preserve theme preference on logout (addresses #318)

- Theme now persists when user logs out and logs back in
- Added documentation for BACKEND_HOST environment variable (addresses #321)
- Users can now bind to localhost only for reverse proxy setups
- Improved documentation for network configuration options
This commit is contained in:
Pulse Monitor
2025-08-17 06:46:38 +00:00
parent 3edef396d8
commit 89a9d02e01
2 changed files with 13 additions and 3 deletions
+7 -2
View File
@@ -116,11 +116,16 @@ For backwards compatibility, some settings can be overridden via environment var
1. **Authentication variables (from .env)** - Always highest priority
- `PULSE_AUTH_USER`, `PULSE_AUTH_PASS`, `API_TOKEN`
2. **System settings (from system.json)** - Normal priority
2. **Network binding variables** - For reverse proxy setups
- `BACKEND_HOST` - IP address to bind to (default: `0.0.0.0`)
- Set to `127.0.0.1` or `localhost` to only listen on localhost (for reverse proxy)
- `FRONTEND_PORT` - Port to listen on (default: `7655`)
3. **System settings (from system.json)** - Normal priority
- If system.json exists, it takes precedence
- If missing, environment variables are checked
3. **Legacy environment variables** - Lowest priority (deprecated)
4. **Legacy environment variables** - Lowest priority (deprecated)
- `POLLING_INTERVAL` - Only used if system.json doesn't exist
- `CONNECTION_TIMEOUT` - Can override system.json value
- `ALLOWED_ORIGINS` - Can override system.json value
+6 -1
View File
@@ -182,10 +182,15 @@ function App() {
console.error('Logout error:', error);
}
// Clear all local storage EXCEPT a flag indicating this is a logout
// Clear all local storage EXCEPT theme preference and logout flag
const currentTheme = localStorage.getItem('theme');
localStorage.clear();
sessionStorage.clear();
localStorage.setItem('just_logged_out', 'true');
// Preserve theme preference across logout
if (currentTheme) {
localStorage.setItem('theme', currentTheme);
}
// Clear WebSocket connection
if (wsStore()) {