From 8285e31fbd74ad20421ade5886d4c869c15a10fc Mon Sep 17 00:00:00 2001 From: martbost Date: Wed, 7 Oct 2026 17:17:33 -0500 Subject: [PATCH] Game testers (env GAMES_TESTERS) see the Play button on a coming-soon game from the Games tab before it opens (Road Agent testers, Marty 2026-10-07) Co-Authored-By: Claude Fable 5.1 --- server.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 7fdaf71..e8ed487 100644 --- a/server.js +++ b/server.js @@ -1509,6 +1509,9 @@ function seasonState(season, day, admin) { if (day < season.start) return admin ? 'preview' : 'hidden'; return 'live'; } +// game testers: GAMES_TESTERS env = comma list of usernames or emails who may play coming-soon / not-yet-live games from the Games tab +const GAME_TESTERS = () => new Set(String(process.env.GAMES_TESTERS || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean)); +const isGameTester = (acct, email) => { const T = GAME_TESTERS(); if (!T.size) return false; return T.has(String((acct && acct.username) || '').toLowerCase()) || T.has(String(email || '').toLowerCase()); }; // -- the games registry (2026-10-01). Add a game here; launch it by adding its slug to site config gamesLive. function GAMES() { return withPerks([ @@ -3404,10 +3407,13 @@ const server = http.createServer(async (req, res) => { const dayLabel = (d, back) => { const t = new Date(d + 'T12:00:00Z'); if (back) t.setUTCDate(t.getUTCDate() - 1); return t.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' }); }; for (const g of GAMES()) { // a seasonal game (2026-10-02) shows only while today (Central) is in [start, end); before start the admin sees a preview, after end nobody - if (g.soon && day < g.soon.opens) { out.push(Object.assign({}, g, { live: false, preview: false, soon: g.soon.label, play: null })); continue; } // coming soon: shown to all, not playable + // testers (env GAMES_TESTERS, usernames or emails; Marty 2026-10-07) get the Play button on a coming-soon game before it opens + const tester = isGameTester(acct, s.email); + if (g.soon && day < g.soon.opens && !tester) { out.push(Object.assign({}, g, { live: false, preview: false, soon: g.soon.label, play: null })); continue; } // coming soon: shown to all, not playable + if (g.soon && day < g.soon.opens && tester) { out.push(Object.assign({}, g, { live: false, preview: true, previewNote: 'testing ยท ' + g.soon.label.toLowerCase() })); continue; } const ss = seasonState(g.season, day, admin); if (ss === 'hidden') continue; const seasonPreview = ss === 'preview'; - const isLive = live.has(g.slug); if (!isLive && !admin) continue; + const isLive = live.has(g.slug); if (!isLive && !admin && !tester) continue; const card = Object.assign({}, g, { live: isLive, preview: !isLive || seasonPreview }); if (g.season) { card.season = Object.assign({}, g.season, { opens: dayLabel(g.season.start), ends: dayLabel(g.season.end, true) }); if (seasonPreview) card.previewNote = 'preview, opens ' + card.season.opens; } if (g.progress && (memberId || g.slug === 'passivedrip')) { try { card.progress = await g.progress(memberId, s.email); } catch (e) {} }