fix: single WS boot path, probe sends stored token, un-halt on auth success
This commit is contained in:
@@ -35,6 +35,9 @@ async function submitAuthToken() {
|
||||
localStorage.setItem('nexus_token', val);
|
||||
hideAuthGate();
|
||||
toast('Authenticated', 'success');
|
||||
_wsHalted = false;
|
||||
_wsBackoff = 1000;
|
||||
_wsAttempts = 0;
|
||||
bootApp();
|
||||
} else {
|
||||
document.getElementById('authError').style.display = 'block';
|
||||
@@ -47,7 +50,8 @@ async function submitAuthToken() {
|
||||
|
||||
async function probeAuth() {
|
||||
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; }
|
||||
return true;
|
||||
} catch(e) { return true; }
|
||||
@@ -79,7 +83,6 @@ let publicUrl = null;
|
||||
let telemetryChart = null;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
initWebSocket();
|
||||
initChart();
|
||||
updateServerEndpoint();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user