From 490cd6dd68c3aff73ee5ced47842853e65c86f90 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 3 Oct 2026 15:17:18 +0000 Subject: [PATCH] Send the dashboard to the first-run key setup (section 23.2) --- static/app.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/static/app.js b/static/app.js index 75cbb71..952ecbf 100644 --- a/static/app.js +++ b/static/app.js @@ -125,6 +125,23 @@ function createAlertItem(alert) { return item; } +async function redirectWhenSetupIsMissing() { + try { + const response = await fetch("/api/setup", { headers: { Accept: "application/json" } }); + if (!response.ok) { + return; + } + const setup = await response.json(); + if (!setup.configured) { + // A new database has no key setup yet, so the dashboard has nothing to + // show and the first-run setup step comes first (section 23.2). + window.location.assign("/setup"); + } + } catch { + // A failed request is reported by the sections below, each in its own way. + } +} + async function loadKeyStatus() { try { const response = await fetch("/api/key-status", { headers: { Accept: "application/json" } }); @@ -177,5 +194,6 @@ async function loadAlerts() { } } +redirectWhenSetupIsMissing(); loadKeyStatus(); loadAlerts();