// Station Master's server default (src/server/index.ts's `PORT` fallback) — kept identical here // so the env var below is documentation, not a real override. export const uiPort = 8081 // Where the volume is mounted inside the subcontainer, and so also `DATA_DIR`'s value. The // server's own per-game persistence (`games//`, `index.json`) and this package's // store.json (the join secret) share this one directory — see README's Volume and Data Layout. export const dataDir = '/data' /** * "3 Aug 2026, 14:32" — a timestamp a person reads, not an epoch they decode. * * Shared by the two actions that list games, so the administrator sees one date format wherever * a game is named. It lived in `gamesInProgress.ts` until v0.8.1.0, when the Manage Game dropdown * needed it too and copying it would have been the second copy to drift. */ export function when(ms: number): string { return new Date(ms).toLocaleString('en-GB', { dateStyle: 'medium', timeStyle: 'short' }) } /** * How long ago, in the coarsest unit that is still true: "12m", "3h", "2d". * * The Manage Game dropdown is a one-line select whose job is to tell four games apart, and the * question asked of it is "how old are these" (Jesse, 2026-09-22: "I've got four games out there, * but I have no idea which one's which or how old they are"). An absolute date answers WHEN and * makes the reader do the subtraction; this answers the question directly and costs four * characters, so the label carries both. */ export function ago(ms: number, now: number = Date.now()): string { const mins = Math.max(0, Math.round((now - ms) / 60_000)) if (mins < 60) return `${mins}m` const hours = Math.round(mins / 60) if (hours < 48) return `${hours}h` return `${Math.round(hours / 24)}d` }