Per-tournament time zone for all clock times (Central by default)
Release 0.6.1. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MB7nCCAscYsb3zzkT6LHZi
This commit is contained in:
1 parent
103c221a12
commit
110077314d
10 files changed
+40
-11
No files matched your search
+9
-2
@@ -1,6 +1,6 @@
|
||||
import QRCode from 'qrcode';
|
||||
import { Router, HttpError, readBody, send, esc, sign, verify } from './http.js';
|
||||
import { publicState } from './public-state.js';
|
||||
import { publicState, validTz } from './public-state.js';
|
||||
import { VERSION } from './version.js';
|
||||
import * as pub from './views/public.js';
|
||||
import * as adm from './views/admin.js';
|
||||
@@ -113,7 +113,7 @@ export function buildRouter({ registry, auth, store }) {
|
||||
const who = requireAdmin(req, res); if (!who) return;
|
||||
const b = await readBody(req);
|
||||
const rules = { teamSize: +b.teamSize || 2, pointsTo: +b.pointsTo || 21, winBy: +b.winBy || 2, cap: +b.cap || 0, bestOf: +b.bestOf || 1 };
|
||||
const it = registry.create({ name: b.name, date: b.date, courtCount: +b.courtCount || 2, rules, stages: String(b.stages ?? 'pool,bracket').split(','), notes: b.notes ?? '' });
|
||||
const it = registry.create({ name: b.name, date: b.date, courtCount: +b.courtCount || 2, rules, stages: String(b.stages ?? 'pool,bracket').split(','), notes: b.notes ?? '', timezone: validTz(b.timezone) });
|
||||
send.redirect(res, `/admin/t/${it.t.slug}?msg=${encodeURIComponent('Created. Print the QR code and open registration when ready.')}`);
|
||||
});
|
||||
|
||||
@@ -166,6 +166,13 @@ export function buildRouter({ registry, auth, store }) {
|
||||
if (p === 'final') { t.phase = 'final'; t.emit({ type: 'phase', phase: 'final', champion: t.champion() }); return 'Marked final'; }
|
||||
throw new Error('Unknown phase');
|
||||
});
|
||||
action('/settings', ({ t, body }) => {
|
||||
if (body.timezone !== undefined) { if (body.timezone && !validTz(body.timezone)) throw new Error('Unknown time zone'); t.timezone = body.timezone || null; }
|
||||
if (body.date !== undefined) t.date = String(body.date).trim() || null;
|
||||
if (body.notes !== undefined) t.notes = String(body.notes).slice(0, 500);
|
||||
t.emit({ type: 'settings', timezone: t.timezone, date: t.date });
|
||||
return 'Settings saved';
|
||||
});
|
||||
action('/banner', ({ t, body }) => { t.banner = String(body.banner ?? '').trim().slice(0, 200) || null; t.emit({ type: 'banner', banner: t.banner }); return t.banner ? 'Banner set' : 'Banner cleared'; });
|
||||
action('/broadcast', ({ t, engine, body }) => { const text = String(body.text ?? '').trim().slice(0, 300); if (!text) throw new Error('Nothing to send'); engine.broadcast(text); return 'Broadcast sent'; });
|
||||
action('/generate', ({ t, body }) => {
|
||||
|
||||
Reference in new issue
Block a user