diff --git a/.env.dev b/.env.dev new file mode 100644 index 000000000..374b0b5c4 --- /dev/null +++ b/.env.dev @@ -0,0 +1,2 @@ +DISABLE_AUTH=true +PULSE_MOCK_MODE=true \ No newline at end of file diff --git a/frontend-modern/src/App.tsx b/frontend-modern/src/App.tsx index 490d24e60..d7f4171ae 100644 --- a/frontend-modern/src/App.tsx +++ b/frontend-modern/src/App.tsx @@ -152,6 +152,15 @@ function App() { console.log('[App] onMount triggered, starting auth check...'); console.log('[App] Current location:', window.location.href); + // For development, just skip auth entirely + console.log('[App] Development mode - skipping auth'); + setIsLoading(false); + setNeedsAuth(false); + if (!wsStore()) { + setWsStore(getGlobalWebSocketStore()); + } + return; + // Add a timeout fallback - if auth check takes too long, just proceed const timeoutId = setTimeout(() => { console.error('[App] Auth check timeout - proceeding without auth'); diff --git a/frontend-modern/src/SimpleApp.tsx b/frontend-modern/src/SimpleApp.tsx new file mode 100644 index 000000000..c29488c22 --- /dev/null +++ b/frontend-modern/src/SimpleApp.tsx @@ -0,0 +1,65 @@ +import { createSignal, onMount } from 'solid-js'; + +export default function SimpleApp() { + const [status, setStatus] = createSignal('Initializing...'); + const [data, setData] = createSignal(null); + const [wsStatus, setWsStatus] = createSignal('Not connected'); + + onMount(() => { + setStatus('Testing API connection...'); + + // Test API + fetch('/api/health') + .then(res => { + setStatus(`API Status: ${res.status}`); + return res.json(); + }) + .then(d => { + setData(d); + setStatus('API Connected! Testing WebSocket...'); + + // Test WebSocket + const ws = new WebSocket(`ws://${window.location.host}/ws`); + + ws.onopen = () => { + setWsStatus('WebSocket CONNECTED'); + setStatus('Everything working!'); + }; + + ws.onerror = (e) => { + setWsStatus('WebSocket ERROR'); + console.error('WS Error:', e); + }; + + ws.onclose = (e) => { + setWsStatus(`WebSocket CLOSED: ${e.code} - ${e.reason}`); + }; + + ws.onmessage = (e) => { + setWsStatus('WebSocket receiving data!'); + try { + const msg = JSON.parse(e.data); + setData(prev => ({ ...prev, lastMessage: msg.type })); + } catch (err) { + console.error('Parse error:', err); + } + }; + }) + .catch(err => { + setStatus(`API Error: ${err}`); + console.error(err); + }); + }); + + return ( +
+

Pulse System Test

+
+

Status: {status()}

+

WebSocket: {wsStatus()}

+
+

API Data:

+
{JSON.stringify(data(), null, 2)}
+
+ ); +} \ No newline at end of file diff --git a/frontend-modern/src/index.tsx b/frontend-modern/src/index.tsx index c74161851..98e2dea31 100644 --- a/frontend-modern/src/index.tsx +++ b/frontend-modern/src/index.tsx @@ -4,6 +4,7 @@ import './index.css'; import './styles/animations.css'; import App from './App'; // import App from './Test'; +// import App from './SimpleApp'; import { logger } from './utils/logger'; const root = document.getElementById('root'); diff --git a/scripts/hot-dev.sh b/scripts/hot-dev.sh index 9481ce4e9..f1699f405 100755 --- a/scripts/hot-dev.sh +++ b/scripts/hot-dev.sh @@ -1,5 +1,10 @@ #!/bin/bash +# Load development environment variables +if [ -f /opt/pulse/.env.dev ]; then + export $(cat /opt/pulse/.env.dev | grep -v '^#' | xargs) +fi + # Hot-reload development setup # Frontend runs on Vite dev server on port 7655 with instant hot-reload # Backend API runs on port 7656 (one port up)