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);
|
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();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user