diff --git a/dashboard/public/jarvis.html b/dashboard/public/jarvis.html index d12e2ed..59e2500 100644 --- a/dashboard/public/jarvis.html +++ b/dashboard/public/jarvis.html @@ -1058,14 +1058,8 @@ document.addEventListener('DOMContentLoaded', () => { .then(r => r.json()) .then(data => { D = data; init(); connectSSE(); }) .catch(() => { - // API not ready yet — use inline data as fallback if available - if (D && D.meta) { init(); } - else { document.getElementById('bootLines').innerHTML = '
Waiting for first sweep...
'; } - // Retry after a delay - setTimeout(() => { - fetch('/api/data').then(r => r.json()).then(data => { D = data; init(); connectSSE(); }).catch(() => {}); - }, 10000); - connectSSE(); + // Should not reach here — server routes to loading.html when no data + if (D && D.meta) { init(); connectSSE(); } }); } else if (D && D.meta) { // File mode: use inline data diff --git a/dashboard/public/loading.html b/dashboard/public/loading.html new file mode 100644 index 0000000..ebb0084 --- /dev/null +++ b/dashboard/public/loading.html @@ -0,0 +1,103 @@ + + + + + +CRUCIX — Initializing + + + + + +
+
+ CX +
+ +
+ +
COLLECTING DATA...
+
+ + + + diff --git a/package.json b/package.json index 1197dc9..5d9085e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "inject": "node dashboard/inject.mjs", "brief": "node apis/briefing.mjs", "brief:save": "node apis/save-briefing.mjs", - "diag": "node diag.mjs" + "diag": "node diag.mjs", + "clean": "node scripts/clean.mjs", + "fresh-start": "npm run clean && npm start" }, "keywords": ["osint", "intelligence", "dashboard", "geopolitical"], "author": "Crucix", diff --git a/server.mjs b/server.mjs index f6173f2..96643da 100644 --- a/server.mjs +++ b/server.mjs @@ -230,9 +230,13 @@ if (discordAlerter.isConfigured) { const app = express(); app.use(express.static(join(ROOT, 'dashboard/public'))); -// Serve jarvis.html as the root page +// Serve loading page until first sweep completes, then the dashboard app.get('/', (req, res) => { - res.sendFile(join(ROOT, 'dashboard/public/jarvis.html')); + if (!currentData) { + res.sendFile(join(ROOT, 'dashboard/public/loading.html')); + } else { + res.sendFile(join(ROOT, 'dashboard/public/jarvis.html')); + } }); // API: current data