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
+1 -5
View File
@@ -139,11 +139,7 @@ class ClaudeKeyUpdate(BaseModel):
def root(): return FileResponse("/opt/rag/static/index.html") def root(): return FileResponse("/opt/rag/static/index.html")
@app.get("/admin") @app.get("/admin")
def admin_ui(request: Request): def admin_ui(): return FileResponse("/opt/rag/static/admin.html")
from fastapi.responses import RedirectResponse
# Check for JWT in cookie or let the frontend handle auth redirect
token = request.cookies.get("admin_token") or request.headers.get("Authorization","").replace("Bearer ","")
return FileResponse("/opt/rag/static/admin.html")
@app.get("/library") @app.get("/library")
def library_ui(): return FileResponse("/opt/rag/static/library.html") def library_ui(): return FileResponse("/opt/rag/static/library.html")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -52341,339 +52341,3 @@ $3
del del
$13 $13
unacked_mutex unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
d61b49c05acf11f199e682dacbd0314b
$4
PXAT
$13
1779998712204
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
11b803425ad011f199e682dacbd0314b
$4
PXAT
$13
1779998812216
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
4d5521f05ad011f199e682dacbd0314b
$4
PXAT
$13
1779998912232
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
88f1e3245ad011f199e682dacbd0314b
$4
PXAT
$13
1779999012244
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
c48f3cd85ad011f199e682dacbd0314b
$4
PXAT
$13
1779999112261
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
002bfd585ad111f199e682dacbd0314b
$4
PXAT
$13
1779999212274
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
3bc9bd785ad111f199e682dacbd0314b
$4
PXAT
$13
1779999312294
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
776677f45ad111f199e682dacbd0314b
$4
PXAT
$13
1779999412306
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
b303b34e5ad111f199e682dacbd0314b
$4
PXAT
$13
1779999512322
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
eea070225ad111f199e682dacbd0314b
$4
PXAT
$13
1779999612335
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
2a3dd3ea5ad211f199e682dacbd0314b
$4
PXAT
$13
1779999712352
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
65da99105ad211f199e682dacbd0314b
$4
PXAT
$13
1779999812365
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
a177f62a5ad211f199e682dacbd0314b
$4
PXAT
$13
1779999912382
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
dd14b89e5ad211f199e682dacbd0314b
$4
PXAT
$13
1780000012395
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
18b1ee445ad311f199e682dacbd0314b
$4
PXAT
$13
1780000112411
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
544ed9445ad311f199e682dacbd0314b
$4
PXAT
$13
1780000212425
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
8feb767e5ad311f199e682dacbd0314b
$4
PXAT
$13
1780000312437
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
cb882ea25ad311f199e682dacbd0314b
$4
PXAT
$13
1780000412449
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
0724da465ad411f199e682dacbd0314b
$4
PXAT
$13
1780000512462
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
42c17b405ad411f199e682dacbd0314b
$4
PXAT
$13
1780000612474
*2
$3
del
$13
unacked_mutex
*5
$3
SET
$13
unacked_mutex
$32
7e5e1dd45ad411f199e682dacbd0314b
$4
PXAT
$13
1780000712486
*2
$3
del
$13
unacked_mutex
+3 -10
View File
@@ -388,7 +388,7 @@ a[role=button]:active {
</aside> </aside>
<!-- Main --> <!-- 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) --> <!-- 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"> <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"> <button onclick="openSidebar()" class="text-on-surface-variant hover:text-primary">
@@ -1657,24 +1657,17 @@ async function saveClaudeKey() {
// ── Auto-login on page load ─────────────────────────────────────────────────── // ── Auto-login on page load ───────────────────────────────────────────────────
if (JWT_TOKEN) { if (JWT_TOKEN) {
// Verify token before showing admin document.getElementById('login').style.display = 'none';
fetch('/auth/me', {headers:{'Authorization':'Bearer '+JWT_TOKEN}}) fetch('/auth/me', {headers:{'Authorization':'Bearer '+JWT_TOKEN}})
.then(r => r.ok ? r.json() : null) .then(r => r.ok ? r.json() : null)
.then(u => { .then(u => {
if (!u || u.role !== 'admin') { if (!u || u.role !== 'admin') {
JWT_TOKEN = ''; localStorage.removeItem('admin_jwt'); JWT_TOKEN = ''; localStorage.removeItem('admin_jwt');
document.getElementById('login').style.display = 'flex'; document.getElementById('login').style.display = 'flex';
document.getElementById('main').style.display = 'none';
} else { } else {
document.getElementById('login').style.display = 'none';
document.getElementById('main').style.display = '';
loadOverview(); loadOverview();
} }
}).catch(() => { }).catch(() => { loadOverview(); }); // network error — stay logged in
// Network error — show login to be safe
document.getElementById('login').style.display = 'flex';
document.getElementById('main').style.display = 'none';
});
} }
// ── Nav init ────────────────────────────────────────────────────────────────── // ── Nav init ──────────────────────────────────────────────────────────────────