# ClutterHunt (2026-10-03, seasonal hidden-object game at clutterhunt.com): SEEK_SSO_SECRET tokens, in-game sign-in # (GAME_AUTH 'seek'), one-tap hand-off /api/my/clutterhunt, hint visits through the refuel flow (seek-hint receipt + # callback), Games-tab card + More-games strip entry, refuel page copy for hints. ROOT = 'D:/Projects/HighRisk/onchain-ad-membership/site/' def edit(path, pairs): b = open(ROOT + path, 'rb').read(); crlf = b.count(b'\r\n') > b.count(b'\n') // 2 s = b.decode('utf-8').replace('\r\n', '\n') for a, r in pairs: if s.count(a) != 1: raise SystemExit('%s anchor %d: %s' % (path, s.count(a), a[:70])) s = s.replace(a, r) if crlf: s = s.replace('\n', '\r\n') open(ROOT + path, 'wb').write(s.encode('utf-8')); print('patched', path) HELP = r""" // -- ClutterHunt (2026-10-03): seasonal hidden-object rooms at clutterhunt.com; its own secret SEEK_SSO_SECRET (also on the game) const SEEK_SECRET = () => String(process.env.SEEK_SSO_SECRET || '').trim(); const SEEK_URL = () => String(process.env.SEEK_URL || 'https://clutterhunt.com').replace(/\/+$/, ''); const SEEK_ALT = () => String(process.env.SEEK_ALT_URLS || 'https://www.clutterhunt.com,https://clutterhunt.saasy.top').split(',').map(x => x.trim().replace(/\/+$/, '')).filter(Boolean); const seekSign = p => drB64u(crypto.createHmac('sha256', SEEK_SECRET()).update(p).digest()); function seekMint(claims, ttlMs) { const payload = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + (ttlMs || 300000), nonce: crypto.randomBytes(12).toString('hex') }, claims)); return drB64u(payload) + '.' + seekSign(payload); } function seekOpen(token) { if (SEEK_SECRET().length < 32) return { error: 'ClutterHunt 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 = seekSign(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 hint link has expired. Go back to ClutterHunt and tap Hint again.' }; return { ok: true, claims: c }; } const seekIsGameUrl = u => [SEEK_URL()].concat(SEEK_ALT()).some(o => String(u || '').startsWith(o + '/')); async function seekCallback(cbUrl, receipt) { if (!seekIsGameUrl(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('clutterhunt callback', e.message); return false; } } """ edit('server.js', [ ("async function gkCallback(cbUrl, receipt) {", HELP.lstrip('\n') + "async function gkCallback(cbUrl, receipt) {"), # games registry + strip (" art: 'https://polhunter.com/img/hero-800.webp', play: '/api/my/polhunter', pays: 'POL per find' },\n ];", " art: 'https://polhunter.com/img/hero-800.webp', play: '/api/my/polhunter', pays: 'POL per find' },\n" " { slug: 'clutterhunt', name: 'ClutterHunt', tag: 'Hidden objects', blurb: 'Search cozy, cluttered rooms for hidden objects. New rooms every season, starting with the Haunted Manor.',\n" " art: SEEK_URL() + '/og-clutterhunt.jpg', play: '/api/my/clutterhunt', pays: 'Stars now, rewards coming' },\n ];"), (" polhunter: { line: 'Find hidden codes on sites across the network. Every find drips POL.', open: 'https://polhunter.com/', host: 'polhunter.com' },", " polhunter: { line: 'Find hidden codes on sites across the network. Every find drips POL.', open: 'https://polhunter.com/', host: 'polhunter.com' },\n" " clutterhunt: { line: 'Search cozy, cluttered rooms for hidden objects. New rooms every season.', open: SEEK_URL() + '/', host: SEEK_URL().replace(/^https?:\\/\\//, '') },"), # in-game sign-in (" gemkingdom: { name: 'Gem Kingdom', origins: () => [GK_URL(), 'https://gemkingdom.saasy.top'],", " seek: { name: 'ClutterHunt', origins: () => [SEEK_URL()].concat(SEEK_ALT()), host: () => SEEK_URL().replace(/^https?:\\/\\//, ''),\n" " mint: (a, memberId) => seekMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null }) },\n" " gemkingdom: { name: 'Gem Kingdom', origins: () => [GK_URL(), 'https://gemkingdom.saasy.top'],"), # refuel flow: third game (" if (r.error) { const g = gkOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'gemkingdom') { r = g; game = 'gemkingdom'; } }\n", " if (r.error) { const g = gkOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'gemkingdom') { r = g; game = 'gemkingdom'; } }\n" " if (r.error) { const g = seekOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'seek') { r = g; game = 'seek'; } }\n"), (" const G = game === 'gemkingdom' ? { game: 'Gem Kingdom', label: 'continue' } : { game: 'Drip Runner', label: 'refuel' };", " if (game === 'seek' && !seekIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a ClutterHunt link.' });\n" " const G = game === 'gemkingdom' ? { game: 'Gem Kingdom', label: 'continue' } : game === 'seek' ? { game: 'ClutterHunt', label: 'hint' } : { game: 'Drip Runner', label: 'refuel' };"), (" const r = await ads.completeVisit(t.email, t.id, { reward: false, note: t.game === 'gemkingdom' ? 'Gem Kingdom continue' : 'Drip Runner refuel' });", " const r = await ads.completeVisit(t.email, t.id, { reward: false, note: t.game === 'gemkingdom' ? 'Gem Kingdom continue' : t.game === 'seek' ? 'ClutterHunt hint' : 'Drip Runner refuel' });"), (" if (t.game === 'gemkingdom') { // signed receipt to the game's callback (server copy) and on the ret page (fast path)", " if (t.game === 'seek') { // ClutterHunt hint: signed receipt to the game's callback and on the ret page\n" " const receipt = seekMint({ kind: 'seek-hint', nonce, email: t.email, campaignId: t.id, credits }, 15 * 60000);\n" " const posted = await seekCallback(t.cb, receipt);\n" " t.doneRet = t.ret + (t.ret.includes('?') ? '&' : '?') + 'ok=1&r=' + encodeURIComponent(receipt);\n" " return json(res, 200, { ok: true, posted, ret: t.doneRet, game: 'ClutterHunt', label: 'hint' });\n" " }\n" " if (t.game === 'gemkingdom') { // signed receipt to the game's callback (server copy) and on the ret page (fast path)"), # one-tap hand-off from the Games tab (" // -- Gem Kingdom hand-off (2026-10-01): sign the member across; the game verifies with GK_SSO_SECRET\n", " // -- ClutterHunt hand-off (2026-10-03): sign the member across; the game verifies with SEEK_SSO_SECRET\n" " if (p === '/api/my/clutterhunt' && req.method === 'GET') {\n" " const s = await auth.fromRequest(req);\n" " if (!s || !s.email) { res.writeHead(302, { Location: '/my', 'Set-Cookie': gkCookie('iap.return', 'clutterhunt', 1800), 'Cache-Control': 'no-store' }); return res.end(); }\n" " if (SEEK_SECRET().length < 32) return json(res, 503, { error: 'ClutterHunt is not connected yet.' });\n" " const acct = await accounts.byEmail(s.email);\n" " const tok = seekMint({ memberId: Number((acct && acct.memberId) || s.memberId || 0), email: String(s.email).toLowerCase(), username: (acct && acct.username) || null, wallet: (acct && acct.address) || null });\n" " res.writeHead(302, { Location: SEEK_URL() + '/auth?t=' + tok, 'Cache-Control': 'no-store', 'Set-Cookie': gkCookie('iap.return', '', 0) }); return res.end();\n" " }\n" " // -- Gem Kingdom hand-off (2026-10-01): sign the member across; the game verifies with GK_SSO_SECRET\n"), ("next: ({ driprunner: '/api/my/driprunner',", "next: ({ clutterhunt: '/api/my/clutterhunt', driprunner: '/api/my/driprunner',"), ]) edit('public/assets/refuel.js', [ (" done = true; $('rfCheck').hidden = true; var gk = GAME === 'Gem Kingdom';\n $('rfHint').textContent = gk ? 'Visit counted. Your heroes are back on their feet.' : 'Visit counted. Your tank is full.';", " done = true; $('rfCheck').hidden = true; var gk = GAME === 'Gem Kingdom', ch = GAME === 'ClutterHunt';\n $('rfHint').textContent = gk ? 'Visit counted. Your heroes are back on their feet.' : ch ? 'Visit counted. Your hint is ready.' : 'Visit counted. Your tank is full.';"), ("b.textContent = gk ? 'Back to the battle' : 'Back to the run';", "b.textContent = gk ? 'Back to the battle' : ch ? 'Back to the room' : 'Back to the run';"), ]) edit('public/refuel.html', [('/assets/refuel.js?v=20261003g', '/assets/refuel.js?v=20261003h')]) print('ok')