Cross-promo strip: /api/public/games (live list, Spooky Doors while in season), /g/<slug> counted hop (signed-in straight into the game), shared /assets/game-strip.js; Drip Runner card says 0.10 POL

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-03 10:19:39 -05:00
parent 30c95026f9
commit 0112422c72
3 changed files with 110 additions and 1 deletions
+27 -1
View File
@@ -1373,13 +1373,29 @@ function GAMES() {
{ slug: 'spookydoors', name: 'Spooky Doors', tag: 'Halloween \u00b7 Oct 4 to 31', blurb: 'Trick or treat! Walk the street, knock on doors and fill your candy bucket. Every door is a short visit to a member\u2019s page or ad, and candy climbs a ladder with POL at set levels. Gone after Halloween night.',
art: SD_URL() + '/og-spookydoors.jpg', play: '/api/my/spookydoors', pays: 'POL at set candy levels', season: { start: SD_SEASON.start, end: SD_SEASON.end }, progress: sdProgress },
{ slug: 'driprunner', name: 'Drip Runner', tag: 'Arcade runner', blurb: 'Hop the network, dodge the bots, clear chapters. Each first clear drips POL into your game balance, and a refuel on a member\u2019s page keeps your run alive.',
art: DR_URL() + '/og-driprunner.jpg?v=20261002', artPos: 'left', play: '/api/my/driprunner', pays: 'POL to your wallet at 0.25', progress: drProgress },
art: DR_URL() + '/og-driprunner.jpg?v=20261002', artPos: 'left', play: '/api/my/driprunner', pays: 'POL to your wallet at 0.10', progress: drProgress },
{ slug: 'gemkingdom', name: 'Gem Kingdom', tag: 'Fantasy match-3', blurb: 'Match gems to battle monsters with three heroes, earn stars and rebuild your village. Crowns for instant upgrades come from your ad credits.',
art: GK_URL() + '/fantasy/og-gemkingdom.jpg?v=20261002', play: '/api/my/gemkingdom', cta: 'Play', pays: 'POL for first clears; Crowns from ad credits' },
{ slug: 'polhunter', name: 'PolHunter', tag: 'Scavenger hunt', blurb: 'Hunt hidden codes on sites across the network. Every find drips POL straight to your wallet.',
art: 'https://polhunter.com/img/hero-800.webp', play: '/api/my/polhunter', pays: 'POL per find' },
];
}
// -- cross-promo strip (2026-10-03): one short line per game and where a signed-out player lands (the game's own page)
const STRIP = () => ({
spookydoors: { line: 'Halloween only. Run the graveyard, knock on doors, climb the candy ladder to POL.', open: SD_URL() + '/play', host: SD_URL().replace(/^https?:\/\//, '') },
driprunner: { line: 'Hop, dodge the bots, clear chapters. Every first clear drips POL.', open: DR_URL() + '/play', host: DR_URL().replace(/^https?:\/\//, '') },
gemkingdom: { line: 'Match gems, beat the bosses, rebuild your kingdom. First clears pay POL.', open: GK_URL() + '/play', host: GK_URL().replace(/^https?:\/\//, '') },
polhunter: { line: 'Find hidden codes on sites across the network. Every find drips POL.', open: 'https://polhunter.com/', host: 'polhunter.com' },
});
// live for the strip: in gamesLive, and a seasonal game until its season ends (Marty 2026-10-03: Spooky Doors may show before
// its formal announcement; "if someone manages to see it and play it, that's fine")
function stripGames() {
const sc = siteConfig(); const live = new Set(String(sc.gamesLive == null ? 'polhunter' : sc.gamesLive).split(',').map(x => x.trim().toLowerCase()).filter(Boolean));
const day = todayCT(), S = STRIP(); const lbl = d => { const t = new Date(d + 'T12:00:00Z'); t.setUTCDate(t.getUTCDate() - 1); return t.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' }); };
return GAMES().filter(g => live.has(g.slug) && S[g.slug] && !(g.season && day >= g.season.end))
.map(g => ({ slug: g.slug, name: g.name, tag: g.season ? 'Limited time \u00b7 ends ' + lbl(g.season.end) : g.tag, line: S[g.slug].line, art: g.art, artPos: g.artPos || 'center', seasonal: !!g.season }));
}
// -- PassiveDrip hand-off (2026-10-01): same token shape as Drip Runner, its own secret (PD_SSO_SECRET, also stored in
// PassiveDrip's site_config iap_sso_secret). PassiveDrip signs the member in or creates the account, carries the sponsor
// over by email, and OFFERS the wallet with one confirm tap; it never writes or overwrites a payout address silently.
@@ -3042,6 +3058,16 @@ const server = http.createServer(async (req, res) => {
doorTokens.set(nonce, t);
return json(res, 200, Object.assign({ ok: true, posted, host, credits, ret: t.doneRet }, house, gold));
}
// -- cross-promo strip (2026-10-03): the list every game reads, and the counted hop between games
if (p === '/api/public/games' && req.method === 'GET') return json(res, 200, { games: stripGames() }, { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=300' });
{ const mg = /^\/g\/([a-z]{3,20})$/.exec(p); if (mg && req.method === 'GET') {
const g = GAMES().find(x => x.slug === mg[1]); const S = STRIP()[mg[1]];
if (!g || !S) { res.writeHead(302, { Location: '/my#games', 'Cache-Control': 'no-store' }); return res.end(); }
const from = String(u.searchParams.get('from') || '').toLowerCase().replace(/[^a-z]/g, '').slice(0, 20); const src = STRIP()[from];
traffic.hit('/g/' + g.slug, req.headers.referer || (src ? 'https://' + src.host + '/' : ''), req.headers['user-agent']); // Traffic tab: host = sending game, path g/<slug>
const s = await auth.fromRequest(req);
res.writeHead(302, { Location: (s && s.email) ? g.play : S.open, 'Cache-Control': 'no-store' }); return res.end(); // signed in here: straight into the game, signed in
} }
// -- Games hub (2026-10-01): the registry is here, the live list is site config (gamesLive)
if (p === '/api/my/games' && req.method === 'GET') {
const s = await auth.fromRequest(req);