Fix constant reload loop caused by 401 redirect in nova.js

The redirect on 401 sent the browser back to /?redirect=... on the same
panel port, which re-served the panel page itself — causing an infinite
reload. The panel pages (admin/reseller/user) already have inline login
forms that activate when auth/me fails, so no redirect is needed.
Return a failure object on 401 so the existing login form shows instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 10:59:27 +00:00
parent a4bf01d78f
commit 18c5989c17
+1 -1
View File
@@ -56,7 +56,7 @@ window.Nova = (() => {
return { success: false, message: 'Network error — check your connection' }; return { success: false, message: 'Network error — check your connection' };
} }
_barDone(); _barDone();
if (res.status === 401) { location.href = '/?redirect=' + encodeURIComponent(location.pathname); return null; } if (res.status === 401) { return { success: false, message: 'Session expired — please log in again' }; }
if (res.status === 429) { if (res.status === 429) {
const reset = res.headers.get('X-RateLimit-Reset'); const reset = res.headers.get('X-RateLimit-Reset');
const wait = reset ? Math.max(0, Math.ceil(Number(reset) - Date.now() / 1000)) : 60; const wait = reset ? Math.max(0, Math.ceil(Number(reset) - Date.now() / 1000)) : 60;