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:
@@ -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'), {
|
||||
|
||||
Reference in New Issue
Block a user