refactor!: remove firebase leftovers, admin page on the server (P1-8)

BREAKING CHANGE: admin/cleanup.js, admin/setcoins.js and docs/firebase are gone; the admin page now runs at /admin/.
This commit is contained in:
Benjamin Oezcan
2026-11-19 02:11:13 +01:00
parent 0202a08b8d
commit b587d12f37
14 changed files with 135 additions and 450 deletions

View File

@@ -64,6 +64,22 @@ app.put('/api/campaign', run(req => { const u = need(req); if (u.guest) return {
app.get('/api/ranks', run(req => economy.ranks(+req.query.n || 20)));
app.get('/api/live', run(() => KV.get('live')));
app.put('/api/admin/live', run(req => { need(req, true); KV.put('live', body(req)); return { ok: true }; }));
// event presets for the admin page
app.get('/api/admin/events', run(req => { need(req, true); return KV.get('admin.events') || {}; }));
app.post('/api/admin/events', run(req => {
need(req, true);
const all = KV.get('admin.events') || {}, key = Date.now().toString(36);
all[key] = body(req); KV.put('admin.events', all);
return { name: key };
}));
app.delete('/api/admin/events/:key', run(req => {
need(req, true);
const all = KV.get('admin.events') || {}; delete all[req.params.key]; KV.put('admin.events', all);
return { ok: true };
}));
// --- admin page (writes need an admin account, checked above) -----------------------------------------
app.use('/admin', express.static(path.join(__dirname, '..', 'admin'), { index: 'index.html' }));
// --- static game (same origin: no CORS, no mixed content) --------------------------------------------
app.use(express.static(path.join(__dirname, '..', 'game'), {