From 1933e063ae39c9423e9236db8d971f2f44e10b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Virg=C3=ADlio=20Santos?= Date: Sat, 14 Mar 2026 15:47:09 -0300 Subject: [PATCH] =?UTF-8?q?Added=20loading=20page=20=E2=80=94=20SSE-driven?= =?UTF-8?q?=20splash=20screen=20for=20first-run=20UX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/public/jarvis.html | 10 +--- dashboard/public/loading.html | 103 ++++++++++++++++++++++++++++++++++ package.json | 4 +- server.mjs | 8 ++- 4 files changed, 114 insertions(+), 11 deletions(-) create mode 100644 dashboard/public/loading.html 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