diff --git a/static/opax.html b/static/opax.html index 41ffb8d..7fa32b4 100644 --- a/static/opax.html +++ b/static/opax.html @@ -794,9 +794,22 @@ async function pollBuild(){ return null } } -document.addEventListener('DOMContentLoaded', () => { +document.addEventListener('DOMContentLoaded', async () => { + // Sjekk auth-status + try { + const r = await fetch('/auth/me') + if(r.ok){ + const u = await r.json() + document.getElementById('sb-session').textContent = u.email || 'innlogget' + document.getElementById('send-btn').disabled = false + } else { + window.location.href = '/auth/login' + } + } catch(e) { + document.getElementById('sb-session').textContent = 'session: feil' + } pollBuild() - setInterval(pollBuild,30000) + setInterval(pollBuild, 30000) }) // ─── Fix 3: CostGuard — fetchWithTimeout helper (AbortController, 10s) ───