diff --git a/public/play.js b/public/play.js index 59eecec..673588e 100644 --- a/public/play.js +++ b/public/play.js @@ -59,6 +59,7 @@ function lobby() { $('lChap').textContent = P.chapter; $('lDrips').textContent = P.bank.toLocaleString(); $('lPol').textContent = f3(BAL.unpaid); $('lPool').innerHTML = 'POL pool ' + f3(POOL.available) + ' · today’s cap left ' + f3(POOL.capLeft) + ' · a chapter drip is ' + f3(POOL.dripPol) + ''; $('lIap').href = IAP + '/my'; $('bLevel').href = IAP + '/my#buy'; tip('lTip'); + try { if (BAL && BAL.unpaid > 0 && ME && !ME.wallet && !ME.guest && !sessionStorage.getItem('dr.walletnudge')) { sessionStorage.setItem('dr.walletnudge', '1'); toast(f3(BAL.unpaid) + ' POL is waiting. Link a wallet on InstantAdPay to get paid.'); } } catch (e) {} $('lPerk').hidden = !ME_EXTRA.perk; $('lPerk').textContent = ME_EXTRA.perk || ''; // member perk (2026-10-05) $('bHangar').textContent = P.freeUpgrades > 0 ? 'Hangar · ' + P.freeUpgrades + ' free' : 'Hangar'; // signed in through the game: these open InstantAdPay already signed in (in-game sign-in pass, 2026-10-03) @@ -236,6 +237,7 @@ function balance() { show('ovBal'); api('/api/balance').then(function (b) { BAL = b; $('bPol').textContent = f3(b.unpaid); var pct = Math.min(100, b.unpaid / b.threshold * 100); $('bProg').style.width = pct + '%'; $('bNote').textContent = 'Pays to your wallet at ' + b.threshold + ' POL. ' + pct.toFixed(0) + '% of the way. Paid so far: ' + f3(b.paidTotal) + ' POL.'; + if (b.unpaid > 0 && !(ME && ME.wallet)) { $('bWallet').innerHTML = '' + f3(b.unpaid) + ' POL is waiting. No wallet is linked to your InstantAdPay account yet, so it cannot be paid out. Link a wallet (one free signature) and it pays out on the next sweep.'; } var h = ''; if (!b.history.length) h = '
No drips yet. Clear a chapter.0.000
'; b.history.forEach(function (l) { var cls = l.kind === 'payout' ? (l.status === 'paid' ? 'm ok' : l.status === 'failed' ? 'm neg' : 'm') : (l.pol < 0 ? 'm neg' : 'm'); h += '
' + esc(l.label) + (l.tx ? ' · tx' : '') + '' + (l.kind === 'payout' ? '' : (l.pol < 0 ? '' : '+')) + f3(l.pol) + '
'; }); $('ledger').innerHTML = h; diff --git a/server.js b/server.js index b544451..9a77336 100644 --- a/server.js +++ b/server.js @@ -164,6 +164,17 @@ async function creditRefuel(intent, nonce, info) { // ---- server ------------------------------------------------------------------------------------ const server = http.createServer(async (req, res) => { const u = new URL(req.url, 'http://x'); const p = u.pathname; + // InstantAdPay asks every hour which players have POL waiting and no wallet linked (wallet-link nudges, + // 2026-10-07). GET /api/iap/unpaid?ts=&sig=, 10-minute window. + if (p === '/api/iap/unpaid' && req.method === 'GET') { + const ts = String(u.searchParams.get('ts') || ''), sig = String(u.searchParams.get('sig') || ''); + const sec = SECRET; + if (!sec || sec.length < 32 || !ts || Math.abs(Date.now() - Number(ts)) > 10 * 60000) return json(res, 401, { error: 'bad signature' }); + const want = crypto.createHmac('sha256', sec).update('unpaid\n' + ts).digest('hex'); + if (want.length !== sig.length || !crypto.timingSafeEqual(Buffer.from(want), Buffer.from(sig))) return json(res, 401, { error: 'bad signature' }); + const accts = store.read('accounts', {}), players = store.read('players', {}); const rows = Object.entries(accts).filter(([k, a]) => Number(a.unpaid) > 0 && !a.wallet).map(([k, a]) => ({ memberId: Number(k), username: a.username || (players[k] || {}).username || null, email: (players[k] || {}).email || null, unpaid: Number(Number(a.unpaid).toFixed(4)) })); + return json(res, 200, { ok: true, game: 'driprunner', rows }); + } // frames (2026-10-03): public pages show inside traffic exchanges; admin and the sign-in hand-offs never do. A framed // visit to the game itself lands on the landing page, whose buttons open the game in a new tab (cookies die in frames) if (/^\/(admin|auth|signin|logout)(\/|$)/.test(p) || p.startsWith('/api/admin')) res.setHeader('X-Frame-Options', 'DENY');