Revert "v1.8.8: fix admin auth — hide main until token verified, block unauthenticated access"

This reverts commit 825765c2c88df7b7e021596665338e2b4cbd602d.
This commit is contained in:
2026-05-28 20:35:31 +00:00
parent 82879656c0
commit 43a30c50f1
13 changed files with 4 additions and 351 deletions
+3 -10
View File
@@ -388,7 +388,7 @@ a[role=button]:active {
</aside>
<!-- Main -->
<div id="main" class="lg:ml-64 min-h-screen" style="display:none">
<div id="main" class="lg:ml-64 min-h-screen">
<!-- Top bar (mobile) -->
<header class="lg:hidden sticky top-0 z-20 glass border-b border-primary/20 px-4 py-3 flex items-center gap-3">
<button onclick="openSidebar()" class="text-on-surface-variant hover:text-primary">
@@ -1657,24 +1657,17 @@ async function saveClaudeKey() {
// ── Auto-login on page load ───────────────────────────────────────────────────
if (JWT_TOKEN) {
// Verify token before showing admin
document.getElementById('login').style.display = 'none';
fetch('/auth/me', {headers:{'Authorization':'Bearer '+JWT_TOKEN}})
.then(r => r.ok ? r.json() : null)
.then(u => {
if (!u || u.role !== 'admin') {
JWT_TOKEN = ''; localStorage.removeItem('admin_jwt');
document.getElementById('login').style.display = 'flex';
document.getElementById('main').style.display = 'none';
} else {
document.getElementById('login').style.display = 'none';
document.getElementById('main').style.display = '';
loadOverview();
}
}).catch(() => {
// Network error — show login to be safe
document.getElementById('login').style.display = 'flex';
document.getElementById('main').style.display = 'none';
});
}).catch(() => { loadOverview(); }); // network error — stay logged in
}
// ── Nav init ──────────────────────────────────────────────────────────────────