diff --git a/public/play.html b/public/play.html index ccfd60c..0d9d8f7 100644 --- a/public/play.html +++ b/public/play.html @@ -1,172 +1,172 @@ - - - - - - -Drip Runner - - - - - - - - -
- -
-
Drips0
-
Chapter1
-
Best0
-
-
Chapter goal0 / 20 drips
-
-
- - -
- - - -
Drip Runner

Connecting…

Checking your InstantAdPay sign-in.

- - - - - - - - -
- - - - - - + + + + + + +Drip Runner + + + + + + + + +
+ +
+
Drips0
+
Chapter1
+
Best0
+
+
Chapter goal0 / 20 drips
+
+
+ + +
+ + + +
Drip Runner

Connecting…

Checking your InstantAdPay sign-in.

+ + + + + + + + +
+ + + + + + diff --git a/server.js b/server.js index 0389d8b..46461f1 100644 --- a/server.js +++ b/server.js @@ -207,6 +207,24 @@ const server = http.createServer(async (req, res) => { if (first) notify('signin', { memberId: r.claims.memberId, username: r.claims.username, wallet: r.claims.wallet, via: guest ? 'a share link' : null }).catch(() => {}); res.writeHead(302, { Location: '/play' + (pendingClears.length ? '?collected=' + pendingClears.length : ''), 'Set-Cookie': [sso.cookie(sid)].concat(guest ? [sso.clearGuestCookie()] : []), 'Cache-Control': 'no-store' }); return res.end(); } + // a member's share card (2026-10-04, Neville/cryptoassets: his link previewed as the blank First Chapter badge): the badge with + // the sharer's name on the plate, rendered once and cached by lib/badge.js + { const mc = /^\/r\/([A-Za-z0-9_.-]{1,40})\/card\.jpg$/.exec(p); if (mc) { + const sharer = game.byUsername(mc[1]); if (!sharer) return sendFile(res, path.join(PUBLIC_DIR, 'og-driprunner.jpg')); + const f = await badge.render('ch1', '@' + sharer.username, 'invites you to play Drip Runner', 'PLAY FREE \u00b7 EARN POL'); + if (!f) return sendFile(res, path.join(PUBLIC_DIR, 'og-driprunner.jpg')); + res.writeHead(200, Object.assign({ 'Content-Type': 'image/jpeg', 'Cache-Control': 'public, max-age=86400' }, SEC)); return fs.createReadStream(f).pipe(res); + } } + { const mr = /^\/r\/([A-Za-z0-9_.-]{1,40})$/.exec(p); + // link-preview robots (Telegram, Facebook, X, WhatsApp...) get the sharer's own card; people get the game, as before + if (mr && /TelegramBot|facebookexternalhit|Facebot|Twitterbot|WhatsApp|Slackbot|Discordbot|LinkedInBot|SkypeUriPreview|redditbot|Iframely|Embedly|vkShare|Pinterest|Googlebot|bingbot/i.test(String(req.headers['user-agent'] || ''))) { + const sh = game.byUsername(mr[1]); const nm = sh ? sh.username : null; const card = SITE + '/r/' + encodeURIComponent(mr[1]) + '/card.jpg'; + const t = nm ? '@' + nm + ' invited you to Drip Runner' : 'Drip Runner: hop the network, get paid in POL'; + const d = 'A fast little runner game in the InstantAdPay network. Play free, clear chapters and collect POL rewards.'; + res.writeHead(200, Object.assign({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' }, SEC)); + return res.end('' + esc(t) + 'Play Drip Runner'); + } + } { const mr = /^\/r\/([A-Za-z0-9_.-]{1,40})$/.exec(p); if (mr) { const sharer = game.byUsername(mr[1]); if (!sharer) { res.writeHead(302, { Location: '/', 'Cache-Control': 'no-store' }); return res.end(); }