Admin: Refresh button + auto-refresh every minute, key kept in the browser so /admin reloads without it

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-30 14:09:35 -05:00
parent c35d118ace
commit 5a7dfb0828
3 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ const server = http.createServer(async (req, res) => {
// ---- static + pages ----
if (p === '/' || p === '/index.html') { if (curtained(req, res, u)) return; return sendFile(res, path.join(PUBLIC_DIR, 'index.html')); }
if (p === '/play') return sendFile(res, path.join(PUBLIC_DIR, 'play.html'));
if (p === '/admin') { if (!admin(req, u)) return page(res, 403, 'Admin', '<p>Key required.</p>'); return sendFile(res, path.join(PUBLIC_DIR, 'admin.html')); }
if (p === '/admin') return sendFile(res, path.join(PUBLIC_DIR, 'admin.html')); // the page asks for the key; every /api/admin call checks it
if (p === '/spawn.js') return sendFile(res, path.join(__dirname, 'lib', 'spawn.js'));
if (/^\/[a-z0-9._-]+\.(css|js|png|jpg|svg|ico|webp|mp4)$/i.test(p) && !p.includes('..')) return sendFile(res, path.join(PUBLIC_DIR, p.slice(1)));