fix: single WS boot path, probe sends stored token, un-halt on auth success

This commit is contained in:
root
2026-08-03 14:27:12 +00:00
parent 0dcbbffbaa
commit e2f1f04d35

View File

@@ -35,6 +35,9 @@ async function submitAuthToken() {
localStorage.setItem('nexus_token', val); localStorage.setItem('nexus_token', val);
hideAuthGate(); hideAuthGate();
toast('Authenticated', 'success'); toast('Authenticated', 'success');
_wsHalted = false;
_wsBackoff = 1000;
_wsAttempts = 0;
bootApp(); bootApp();
} else { } else {
document.getElementById('authError').style.display = 'block'; document.getElementById('authError').style.display = 'block';
@@ -47,7 +50,8 @@ async function submitAuthToken() {
async function probeAuth() { async function probeAuth() {
try { try {
const r = await _origFetch('/api/status'); const opts = nexusToken ? { headers: { 'Authorization': 'Bearer ' + nexusToken } } : {};
const r = await _origFetch('/api/status', opts);
if (r.status === 401) { showAuthGate(); return false; } if (r.status === 401) { showAuthGate(); return false; }
return true; return true;
} catch(e) { return true; } } catch(e) { return true; }
@@ -79,7 +83,6 @@ let publicUrl = null;
let telemetryChart = null; let telemetryChart = null;
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
initWebSocket();
initChart(); initChart();
updateServerEndpoint(); updateServerEndpoint();
}); });