Turkey Drop integration, gated (2026-10-28): the Thanksgiving season game at turkeydropgame.com, same protocol as POL Miner. TD_SSO_SECRET / TD_URL (default https://turkeydropgame.com) / TD_ALT_URLS (default www + turkeydrop.saasy.top) with tdMint/tdOpen/tdIsGameUrl/tdCallback (code defaults only, no env set); GAME_AUTH turkeydrop (in-game sign-in kit, three origins); /api/my/turkeydrop hand-off + iap.return + my.js redirect; refuel game 'turkeydrop' (label "back on the air", receipt kind td-life, note "Turkey Drop back on the air", gameplay only, never POL; refuel.js done text "WFWL is back on the air"); GAMES() card with season TD_SEASON 2026-11-02..2026-12-01 (Limited time ribbon, gone after Nov 30, CDN art game-banners/turkeydrop/og-turkeydrop-clean.jpg, per-action copy: first score milestones + weekly top 3) and STRIP line, both hidden until 'turkeydrop' is in gamesLive (admin preview kept); /api/public/games/all now shows a seasonal game's "Opens" date only once it is in gamesLive (it used to list any pre-season game); growth snapshot "opened today" counts a season start only when live; walletnudge entry (idle until the secret is set); gamestats name; Game Pass: gamepass GAMES/NAMES += turkeydrop, GP_SECRETS, GP_PERKS row "one free back on the air extra life every day" shown only while the game is in the public games list (Spooky Doors row the same, so it drops after Oct 31), pass copy made count-free ("every game" / "all the games": my.js card, perks table, cap nudge, chatbot pass/Friday/tiers answers + fact, friday.html, Friday pass email); promo tools Games entry (turkeydropgame.com/?ref=, og + 11 CDN banners, 2 posts) shown only while listed and from Nov 2; chatbot CANNED turkeydrop + fact follow gamesLive and the season (coming-soon answer without a date before launch, like POL Miner's; season-over answer from Dec 1; KB answer kept out of the prompt unless live), Game Pass answer names the Turkey Drop perk only while live. my.js?v=20261028td, promo.js?v=20261028td, refuel.js?v=20261028td. qa member 0 bugs (2 old admin warnings), qa public 0 bugs (1 old /shorts warning), refuel-fallback + kb all passed; local e2e (23 checks) and chatbot gating (7 checks) passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -766,7 +766,7 @@ async function boot() {
|
||||
|
||||
// Game Pass partner helpers (2026-10-16): which secret signs for which game, signature compare, member resolution, dev clock
|
||||
const GP_SECRETS = () => ({ polhunter: String(process.env.HUNT_SSO_SECRET || '').trim(), gemkingdom: GK_SECRET(), spellwheel: SW_SECRET(), spookydoors: SD_SECRET(), polywarriors: PW_SECRET(),
|
||||
clutterhunt: SEEK_SECRET(), polybreak: PB_SECRET(), polminer: PM_SECRET(), warpwares: WW_SECRET(), driprunner: DR_SECRET(), roadagent: RA_SECRET(), shardsofvalor: SOV_SECRET() });
|
||||
clutterhunt: SEEK_SECRET(), polybreak: PB_SECRET(), polminer: PM_SECRET(), warpwares: WW_SECRET(), turkeydrop: TD_SECRET(), driprunner: DR_SECRET(), roadagent: RA_SECRET(), shardsofvalor: SOV_SECRET() });
|
||||
function gpPartnerCheck(game) { if (!gamepass.GAMES.includes(game)) return { error: 'unknown game', code: 400 }; const secret = GP_SECRETS()[game] || ''; if (secret.length < 32) return { error: game + ' is not connected', code: 503 }; return { secret }; }
|
||||
const gpSigOk = (want, got) => typeof got === 'string' && want.length === got.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(got));
|
||||
async function gpResolve(memberId, email) { // the account behind a game's player: main member id, a linked position's id, or (no wallet yet) the email
|
||||
@@ -1000,6 +1000,17 @@ async function resolveSponsorDetailed(tok) {
|
||||
try { const id = await chain.memberIdByAccount(acct.address); return { id, reason: id ? 'ok' : 'notActivated', name: acct.username ? '@' + acct.username : t }; }
|
||||
catch (e) { return { id: 0, reason: 'rpc', name: acct.username ? '@' + acct.username : t }; }
|
||||
}
|
||||
// The chain-bound sponsor of an activated member, as a resolveSponsorDetailed-shaped answer with a display name; null when the
|
||||
// member is not on chain or the read fails (callers then fall back to the account's sponsor field).
|
||||
async function sponsorByChain(memberId) {
|
||||
const id = Number(memberId) || 0; if (id <= 0) return null;
|
||||
try {
|
||||
const me = await chain.member(id); const sid = Number(me && me.sponsorId) || 0; if (!sid) return null;
|
||||
let name = 'member #' + sid;
|
||||
try { const sp = await chain.member(sid); const a = sp && sp.account ? await accounts.byAddress(String(sp.account).toLowerCase()) : null; if (a && a.username) name = '@' + a.username; } catch (e) { /* name stays member #N */ }
|
||||
return { id: sid, reason: 'ok', name, chain: true };
|
||||
} catch (e) { return null; }
|
||||
}
|
||||
async function resolveSponsorToken(tok) { return (await resolveSponsorDetailed(tok)).id; }
|
||||
// 2026-09-16 (Marty): a buyer is never held up because their sponsor has not activated. Walk the
|
||||
// site's sponsor line upward to the first upline who can be paid on-chain (activated, payouts on,
|
||||
@@ -1623,7 +1634,7 @@ async function fridayPassPerk(ev, bonus, gp) {
|
||||
console.log('friday pass perk', a.email, day, 'until', new Date(r.until).toISOString());
|
||||
try {
|
||||
const until = new Date(r.until).toLocaleString('en-US', { timeZone: 'America/Chicago', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
|
||||
await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], 'Five Dollar Friday: a free Game Pass week', '<p>Your Friday package came with a free 7-day Game Pass, on top of the Friday bonus credits. It runs until ' + until + ' Central, across all ten games.</p>', 'notice');
|
||||
await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], 'Five Dollar Friday: a free Game Pass week', '<p>Your Friday package came with a free 7-day Game Pass, on top of the Friday bonus credits. It runs until ' + until + ' Central, across all the games.</p>', 'notice');
|
||||
} catch (e) { console.error('friday pass notice', e.message); }
|
||||
try { await postBadgeOnce(a.email, 'gamepass', 'Five Dollar Friday'); } catch (e) { console.error('friday pass badge', e.message); }
|
||||
return r;
|
||||
@@ -1804,6 +1815,29 @@ async function wwCallback(cbUrl, receipt) {
|
||||
if (!wwIsGameUrl(cbUrl)) return false;
|
||||
try { const r = await fetch(cbUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ t: receipt }), signal: AbortSignal.timeout(8000) }); return r.ok; } catch (e) { console.warn('warpwares callback', e.message); return false; }
|
||||
}
|
||||
// -- Turkey Drop (2026-10-28): the Thanksgiving season game (catch the turkeys from the WFWL 98.7 helicopter); its own secret
|
||||
// TD_SSO_SECRET (also on the game), the same protocol as POL Miner. Members see nothing until 'turkeydrop' is in site config
|
||||
// gamesLive (Games card, strip, games page, promo tools, Game Pass perk, chatbot), and its season window is TD_SEASON.
|
||||
const TD_SECRET = () => String(process.env.TD_SSO_SECRET || '').trim();
|
||||
const TD_URL = () => String(process.env.TD_URL || 'https://turkeydropgame.com').replace(/\/+$/, '');
|
||||
const TD_ALT = () => String(process.env.TD_ALT_URLS || 'https://www.turkeydropgame.com,https://turkeydrop.saasy.top').split(',').map(x => x.trim().replace(/\/+$/, '')).filter(Boolean);
|
||||
const TD_SEASON = { start: '2026-11-02', end: '2026-12-01' }; // Central days, end exclusive (through Nov 30)
|
||||
const tdSign = p => drB64u(crypto.createHmac('sha256', TD_SECRET()).update(p).digest());
|
||||
function tdMint(claims, ttlMs) { const payload = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + (ttlMs || 300000), nonce: crypto.randomBytes(12).toString('hex') }, claims, gpClaim(claims))); return drB64u(payload) + '.' + tdSign(payload); }
|
||||
function tdOpen(token) {
|
||||
if (TD_SECRET().length < 32) return { error: 'Turkey Drop is not connected yet.' };
|
||||
const [p, sig] = String(token || '').split('.'); if (!p || !sig) return { error: 'That link is not valid.' };
|
||||
let payload; try { payload = Buffer.from(String(p).replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf8'); } catch (e) { return { error: 'That link is not valid.' }; }
|
||||
const want = tdSign(payload); if (want.length !== sig.length || !crypto.timingSafeEqual(Buffer.from(want), Buffer.from(sig))) return { error: 'That link is not valid.' };
|
||||
let c; try { c = JSON.parse(payload); } catch (e) { return { error: 'That link is not valid.' }; }
|
||||
if (!c.exp || Date.now() > c.exp) return { error: 'That link has expired. Go back to Turkey Drop and tap Back on the air again.' };
|
||||
return { ok: true, claims: c };
|
||||
}
|
||||
const tdIsGameUrl = u => [TD_URL()].concat(TD_ALT()).some(o => String(u || '').startsWith(o + '/'));
|
||||
async function tdCallback(cbUrl, receipt) {
|
||||
if (!tdIsGameUrl(cbUrl)) return false;
|
||||
try { const r = await fetch(cbUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ t: receipt }), signal: AbortSignal.timeout(8000) }); return r.ok; } catch (e) { console.warn('turkeydrop callback', e.message); return false; }
|
||||
}
|
||||
// -- PolyWarriors (2026-10-05): the cyberpunk fighting game at polywarriors.com; its own secret PW_SSO_SECRET (also on the game)
|
||||
const PW_SECRET = () => String(process.env.PW_SSO_SECRET || '').trim();
|
||||
const PW_URL = () => String(process.env.PW_URL || 'https://polywarriors.com').replace(/\/+$/, '');
|
||||
@@ -2005,6 +2039,9 @@ function GAMES() {
|
||||
// Warp & Wares (2026-10-29): the 30-day trading season (hidden until gamesLive has 'warpwares'; gone after the season)
|
||||
{ slug: 'warpwares', name: 'Warp & Wares', tag: 'Season game, 30 days', blurb: 'A shared galaxy of 1,200 sectors for one season. 200 turns a day for everyone: trade three goods between markets, haggle, hold sectors with fighters, build a base, run a team of five. Weekly territory and trader prizes and the season leaderboard pay POL.',
|
||||
art: WW_URL() + '/og-warpwares.jpg', play: '/api/my/warpwares', pays: 'POL for weekly territory and top traders, milestones and the season leaderboard', season: { start: WW_SEASON.start, end: WW_SEASON.end } },
|
||||
// Turkey Drop (2026-10-28): the Thanksgiving season game, Nov 2 to 30 (hidden until gamesLive has 'turkeydrop'; gone after the season)
|
||||
{ slug: 'turkeydrop', name: 'Turkey Drop', tag: 'Thanksgiving · Nov 2 to 30', blurb: 'The WFWL 98.7 helicopter is dropping turkeys over the mall. Swing the net, catch them before they splat, and keep the station on the air. Score milestones pay POL the first time you reach them, and the weekly top 3 win a POL prize.',
|
||||
art: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/turkeydrop/og-turkeydrop-clean.jpg', play: '/api/my/turkeydrop', pays: 'POL for first score milestones and weekly top 3 prizes', season: { start: TD_SEASON.start, end: TD_SEASON.end } },
|
||||
]);
|
||||
}
|
||||
// each game's member perk (the $5 welcome offer, 2026-10-05) shown on its card
|
||||
@@ -2020,6 +2057,7 @@ const STRIP = () => ({
|
||||
polybreak: { line: 'Break the glass jewel wall, catch the capsules and the purple Polygon gem. First clears pay POL.', open: PB_URL() + '/', host: PB_URL().replace(/^https?:\/\//, '') },
|
||||
polminer: { line: 'Dig deep, beat the drill bosses, find the rare pink Polygon crystals. Crystals pay POL.', open: PM_URL() + '/', host: PM_URL().replace(/^https?:\/\//, '') },
|
||||
warpwares: { line: 'One galaxy, 30 days, 200 turns a day. Trade, hold sectors, build a base. Weekly prizes pay POL.', open: WW_URL() + '/', host: WW_URL().replace(/^https?:\/\//, '') },
|
||||
turkeydrop: { line: 'Thanksgiving only. Catch the turkeys from the station helicopter before they splat. Score milestones pay POL.', open: TD_URL() + '/', host: TD_URL().replace(/^https?:\/\//, '') },
|
||||
spellwheel: { line: 'Swipe the letter wheel, fill the grid, solve the daily puzzle. Levels and dailies pay POL.', open: SW_URL() + '/', host: SW_URL().replace(/^https?:\/\//, '') },
|
||||
polywarriors: { line: 'Recruit one-of-a-kind warriors, fight the arena, challenge members. First wins pay POL.', open: PW_URL() + '/', host: PW_URL().replace(/^https?:\/\//, '') },
|
||||
});
|
||||
@@ -2091,6 +2129,8 @@ const GAME_AUTH = {
|
||||
mint: (a, memberId) => pmMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null, sponsorRef: a.sponsorRef || null }) },
|
||||
warpwares: { name: 'Warp & Wares', frames: false, origins: () => [WW_URL()].concat(WW_ALT()), host: () => WW_URL().replace(/^https?:\/\//, ''),
|
||||
mint: (a, memberId) => wwMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null, sponsorRef: a.sponsorRef || null }) },
|
||||
turkeydrop: { name: 'Turkey Drop', frames: false, origins: () => [TD_URL()].concat(TD_ALT()), host: () => TD_URL().replace(/^https?:\/\//, ''),
|
||||
mint: (a, memberId) => tdMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null, sponsorRef: a.sponsorRef || null }) },
|
||||
spellwheel: { name: 'SpellWheel', origins: () => [SW_URL()].concat(SW_ALT()), host: () => SW_URL().replace(/^https?:\/\//, ''),
|
||||
mint: (a, memberId) => swMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null }) },
|
||||
polywarriors: { name: 'PolyWarriors', origins: () => [PW_URL()].concat(PW_ALT()), host: () => PW_URL().replace(/^https?:\/\//, ''),
|
||||
@@ -2643,7 +2683,7 @@ const server = http.createServer(async (req, res) => {
|
||||
let memberId = 0;
|
||||
if (r.account.address) { try { memberId = await chain.memberIdByAccount(r.account.address); } catch (err) {} }
|
||||
const token = await auth.mintSession({ email: r.account.email, address: r.account.address, memberId });
|
||||
return json(res, 200, { ok: true, account: r.account, created: !!r.created, next: ({ clutterhunt: '/api/my/clutterhunt', spellwheel: '/api/my/spellwheel', polybreak: '/api/my/polybreak', polminer: '/api/my/polminer', warpwares: '/api/my/warpwares', polywarriors: '/api/my/polywarriors', driprunner: '/api/my/driprunner', passivedrip: '/api/my/passivedrip', gemkingdom: '/api/my/gemkingdom', gkshop: '/gk/shop/resume', spookydoors: '/api/my/spookydoors', sdshop: '/sd/shop/resume' })[parseCookies(req)['iap.return']] || null }, { 'Set-Cookie': auth.sessionCookie(token) }); // next: Drip Runner sent them here to sign in (2026-09-30)
|
||||
return json(res, 200, { ok: true, account: r.account, created: !!r.created, next: ({ clutterhunt: '/api/my/clutterhunt', spellwheel: '/api/my/spellwheel', polybreak: '/api/my/polybreak', polminer: '/api/my/polminer', turkeydrop: '/api/my/turkeydrop', warpwares: '/api/my/warpwares', polywarriors: '/api/my/polywarriors', driprunner: '/api/my/driprunner', passivedrip: '/api/my/passivedrip', gemkingdom: '/api/my/gemkingdom', gkshop: '/gk/shop/resume', spookydoors: '/api/my/spookydoors', sdshop: '/sd/shop/resume' })[parseCookies(req)['iap.return']] || null }, { 'Set-Cookie': auth.sessionCookie(token) }); // next: Drip Runner sent them here to sign in (2026-09-30)
|
||||
}
|
||||
|
||||
// -- in-game sign-in (2026-10-03): see GAME_AUTH. Mirrors /api/auth/email/start + verify, minus cookies.
|
||||
@@ -2826,7 +2866,9 @@ const server = http.createServer(async (req, res) => {
|
||||
let acct = (s.email && await accounts.byEmail(s.email)) || (s.address && await accounts.byAddress(s.address)) || null;
|
||||
// holding tank (2026-10-27): someone the network already knows is placed under that sponsor first (tank.js alignToNetwork)
|
||||
if (acct && !acct.sponsorRef && !acct.memberId && !memberId) { try { if (await tank.alignToNetwork(acct)) acct = (await accounts.byEmail(acct.email)) || acct; } catch (e) {} }
|
||||
const spdMe = await resolveSponsorDetailed((acct && acct.sponsorRef) || parseCookies(req)['iap.sponsor']); let sponsorId = spdMe.id;
|
||||
// Who the member sees as their sponsor (2026-11-02, Orlando saw a stranger on LinkSpin): a member who is on the chain shows the
|
||||
// sponsor the contract bound, never the referral cookie from the last link they clicked; the cookie only speaks for accounts not on chain yet.
|
||||
let spdMe = await sponsorByChain(acct && acct.memberId); if (!spdMe) spdMe = await resolveSponsorDetailed((acct && acct.sponsorRef) || (!(acct && Number(acct.memberId) > 0) ? parseCookies(req)['iap.sponsor'] : '')); let sponsorId = spdMe.id;
|
||||
let sponsorBlocked = (acct && acct.sponsorRef && !sponsorId && spdMe.reason !== 'none') ? spdMe.reason : null;
|
||||
let sponsorRouted = null;
|
||||
if (sponsorBlocked === 'notActivated') { // never hold a buyer for an unactivated sponsor: walk up the line
|
||||
@@ -2842,7 +2884,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (tankHold) sponsorBlocked = 'tankHold';
|
||||
else if (!sponsorId && memberId !== _defSpon) { sponsorId = _defSpon; sponsorFallback = true; } // orphan fallback → #1 (never self-sponsor)
|
||||
if (memberId && acct && acct.memberId !== memberId) accounts.setMemberId(acct.email, memberId).catch(() => {});
|
||||
const out = { signedIn: true, gkShop: !!parseCookies(req)['iap.gkshop'], sdShop: !!parseCookies(req)['iap.sdshop'], pwMint: !!parseCookies(req)['iap.pwmint'], returnTo: ['polhunter', 'driprunner', 'passivedrip', 'gemkingdom', 'gkshop', 'spookydoors', 'sdshop', 'pwmint', 'polybreak', 'polminer', 'warpwares', 'shardsofvalor'].includes(parseCookies(req)['iap.return']) ? parseCookies(req)['iap.return'] : null, sponsorBlocked, sponsorRouted, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
const out = { signedIn: true, gkShop: !!parseCookies(req)['iap.gkshop'], sdShop: !!parseCookies(req)['iap.sdshop'], pwMint: !!parseCookies(req)['iap.pwmint'], returnTo: ['turkeydrop', 'polhunter', 'driprunner', 'passivedrip', 'gemkingdom', 'gkshop', 'spookydoors', 'sdshop', 'pwmint', 'polybreak', 'polminer', 'warpwares', 'shardsofvalor'].includes(parseCookies(req)['iap.return']) ? parseCookies(req)['iap.return'] : null, sponsorBlocked, sponsorRouted, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
address: s.address || (acct && acct.address) || null, memberId,
|
||||
username: (acct && acct.username) || null,
|
||||
refCode: (acct && acct.code) || null, sponsorId, tankHold, sponsorFallback,
|
||||
@@ -3772,6 +3814,15 @@ const server = http.createServer(async (req, res) => {
|
||||
const tok = pmMint({ memberId: Number((acct && acct.memberId) || s.memberId || 0), email: String(s.email).toLowerCase(), username: (acct && acct.username) || null, wallet: (acct && acct.address) || null, sponsorRef: (acct && acct.sponsorRef) || null });
|
||||
res.writeHead(302, { Location: PM_URL() + '/auth?t=' + tok, 'Cache-Control': 'no-store', 'Set-Cookie': gkCookie('iap.return', '', 0) }); return res.end();
|
||||
}
|
||||
// -- Turkey Drop hand-off (2026-10-28): sign the member across; the game verifies with TD_SSO_SECRET
|
||||
if (p === '/api/my/turkeydrop' && req.method === 'GET') { gamestats.handoff('turkeydrop');
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) { res.writeHead(302, { Location: '/my' + refQ(u), 'Set-Cookie': gkCookie('iap.return', 'turkeydrop', 1800), 'Cache-Control': 'no-store' }); return res.end(); }
|
||||
if (TD_SECRET().length < 32) return json(res, 503, { error: 'Turkey Drop is not connected yet.' });
|
||||
const acct = await accounts.byEmail(s.email);
|
||||
const tok = tdMint({ memberId: Number((acct && acct.memberId) || s.memberId || 0), email: String(s.email).toLowerCase(), username: (acct && acct.username) || null, wallet: (acct && acct.address) || null, sponsorRef: (acct && acct.sponsorRef) || null });
|
||||
res.writeHead(302, { Location: TD_URL() + '/auth?t=' + tok, 'Cache-Control': 'no-store', 'Set-Cookie': gkCookie('iap.return', '', 0) }); return res.end();
|
||||
}
|
||||
if (p === '/api/my/spellwheel' && req.method === 'GET') { gamestats.handoff('spellwheel');
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) { res.writeHead(302, { Location: '/my' + refQ(u), 'Set-Cookie': gkCookie('iap.return', 'spellwheel', 1800), 'Cache-Control': 'no-store' }); return res.end(); }
|
||||
@@ -4045,6 +4096,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (r.error) { const g = pbOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'polybreak') { r = g; game = 'polybreak'; } }
|
||||
if (r.error) { const g = pmOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'polminer') { r = g; game = 'polminer'; } }
|
||||
if (r.error) { const g = wwOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'warpwares') { r = g; game = 'warpwares'; } }
|
||||
if (r.error) { const g = tdOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'turkeydrop') { r = g; game = 'turkeydrop'; } }
|
||||
if (r.error) return json(res, 400, { error: r.error });
|
||||
const c = r.claims; if (c.kind !== 'refuel' || !c.nonce || !c.email || !c.ret) return json(res, 400, { error: 'That is not a refuel link.' });
|
||||
if (game === 'gemkingdom' && !String(c.ret).startsWith(GK_URL() + '/')) return json(res, 400, { error: 'That is not a Gem Kingdom link.' });
|
||||
@@ -4053,8 +4105,9 @@ const server = http.createServer(async (req, res) => {
|
||||
if (game === 'polybreak' && !pbIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a PolyBreak link.' });
|
||||
if (game === 'polminer' && !pmIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a POL Miner link.' });
|
||||
if (game === 'warpwares' && !wwIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a Warp & Wares link.' });
|
||||
if (game === 'turkeydrop' && !tdIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a Turkey Drop link.' });
|
||||
const vkind = game === 'warpwares' ? 'dock' : 'refuel'; // a Warp & Wares sponsor dock has its own visit kind and daily cap (ads.js VISIT_KINDS)
|
||||
const G = game === 'warpwares' ? { game: 'Warp & Wares', label: 'sponsor dock' } : game === 'polminer' ? { game: 'POL Miner', label: 'supply crate' } : game === 'polybreak' ? { game: 'PolyBreak', label: 'one more paddle' } : game === 'gemkingdom' ? { game: 'Gem Kingdom', label: 'continue' } : game === 'seek' ? { game: 'ClutterHunt', label: 'hint' } : game === 'spellwheel' ? { game: 'SpellWheel', label: 'hint' } : { game: 'Drip Runner', label: 'refuel' };
|
||||
const G = game === 'warpwares' ? { game: 'Warp & Wares', label: 'sponsor dock' } : game === 'turkeydrop' ? { game: 'Turkey Drop', label: 'back on the air' } : game === 'polminer' ? { game: 'POL Miner', label: 'supply crate' } : game === 'polybreak' ? { game: 'PolyBreak', label: 'one more paddle' } : game === 'gemkingdom' ? { game: 'Gem Kingdom', label: 'continue' } : game === 'seek' ? { game: 'ClutterHunt', label: 'hint' } : game === 'spellwheel' ? { game: 'SpellWheel', label: 'hint' } : { game: 'Drip Runner', label: 'refuel' };
|
||||
for (const [n, v] of refuelTokens) if (v.ts + 30 * 60000 < Date.now()) refuelTokens.delete(n);
|
||||
let t = refuelTokens.get(c.nonce);
|
||||
if (t && t.done) return json(res, 200, Object.assign({ done: true, ret: t.doneRet || t.ret }, G));
|
||||
@@ -4107,7 +4160,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (r.error) return json(res, 400, { error: r.error });
|
||||
credits = 0;
|
||||
} else {
|
||||
const r = await ads.completeVisit(t.email, t.id, { reward: false, kind: t.game === 'warpwares' ? 'dock' : undefined, note: t.game === 'warpwares' ? 'Warp & Wares sponsor dock' : t.game === 'polminer' ? 'POL Miner supply crate' : t.game === 'polybreak' ? 'PolyBreak paddle' : t.game === 'gemkingdom' ? 'Gem Kingdom continue' : t.game === 'seek' ? 'ClutterHunt hint' : t.game === 'spellwheel' ? 'SpellWheel hint' : 'Drip Runner refuel' });
|
||||
const r = await ads.completeVisit(t.email, t.id, { reward: false, kind: t.game === 'warpwares' ? 'dock' : undefined, note: t.game === 'warpwares' ? 'Warp & Wares sponsor dock' : t.game === 'turkeydrop' ? 'Turkey Drop back on the air' : t.game === 'polminer' ? 'POL Miner supply crate' : t.game === 'polybreak' ? 'PolyBreak paddle' : t.game === 'gemkingdom' ? 'Gem Kingdom continue' : t.game === 'seek' ? 'ClutterHunt hint' : t.game === 'spellwheel' ? 'SpellWheel hint' : 'Drip Runner refuel' });
|
||||
if (r.error) return json(res, 400, r);
|
||||
credits = ads.rates().visitCostPerVisit || 3;
|
||||
{ const camp = await ads.campaignById(t.id).catch(() => null); if (camp && camp.house) credits = 0; } // a house ad costs nobody anything: no POL pool income (2026-10-03)
|
||||
@@ -4119,6 +4172,12 @@ const server = http.createServer(async (req, res) => {
|
||||
t.doneRet = t.ret + (t.ret.includes('?') ? '&' : '?') + 'ok=1&r=' + encodeURIComponent(receipt);
|
||||
return json(res, 200, { ok: true, posted, ret: t.doneRet, game: 'Warp & Wares', label: 'sponsor dock' });
|
||||
}
|
||||
if (t.game === 'turkeydrop') { // Turkey Drop "back on the air" (an extra life after the station pulls you off the air): signed receipt to the game's callback and on the ret page; gameplay only, never POL
|
||||
const receipt = tdMint({ kind: 'td-life', nonce, email: t.email, campaignId: t.id, credits }, 15 * 60000);
|
||||
const posted = await tdCallback(t.cb, receipt);
|
||||
t.doneRet = t.ret + (t.ret.includes('?') ? '&' : '?') + 'ok=1&r=' + encodeURIComponent(receipt);
|
||||
return json(res, 200, { ok: true, posted, ret: t.doneRet, game: 'Turkey Drop', label: 'back on the air' });
|
||||
}
|
||||
if (t.game === 'polminer') { // POL Miner supply crate: signed receipt to the game's callback and on the ret page (the crate is a gameplay boost, never POL)
|
||||
const receipt = pmMint({ kind: 'pm-crate', nonce, email: t.email, campaignId: t.id, credits }, 15 * 60000);
|
||||
const posted = await pmCallback(t.cb, receipt);
|
||||
|
||||
Reference in New Issue
Block a user