12 Commits

Author SHA1 Message Date
martbost fda27ad43f Merge warpwares-integration: Warp & Wares hand-off, sponsor dock visit kind (dockCapPerDay 10), Games tab card, promo entry, chatbot, walletnudge, qa (gated by gamesLive); conflicts resolved: KNOWLEDGE_DATE 2026-10-30 kept, my.js tag 20261030ww, ads.js dock changes re-applied onto the prohibited-content version (git saw the file as binary)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 11:23:31 -05:00
martbost 012250360e Wall profile rendering: a purchase alone decides (a quarantined account that buys a package gets its bio and links back, as the quarantine notice promises)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 07:33:19 -05:00
martbost 337d4f9e8f Link-farm hardening (2026-10-30 incident: 106 free accounts used casino bios and website links as backlinks; Google indexed the text through /wall pages)
Public walls: profile fields (bio, avatar, socials, intro video) render only for a paying member (memberId > 0 or a registered position), on /api/wall and in the OG image; a free account's wall shows the name, the line's ads and the join call. The meta/og description is a fixed site sentence with the handle, never the bio. Outbound profile links are rel="sponsored ugc noopener" target="_blank". A deleted or unknown name is a real 404 with X-Robots-Tag noindex (was a bare "Banner wall" page at 200, a soft 404 that stayed indexed).

Policy (prohibited.js, byte-for-byte copy on LinkSpin): bios may not carry a URL or a domain token ("Links go in the social fields, not the bio"); gambling, adult, pharma, weapons and link-selling terms (Unicode aware, Vietnamese and Portuguese terms included) are refused in bios, social URLs, line banner targets, wall offers and every campaign field, with the refusal logged. lssync applies it on the way out and lsinbound on ingest.

Quarantine rule: a brand-new free account (no wallet, no sponsor, under 24 h) whose first profile save plants a link is saved with profileQuarantined (JSON + MySQL column), never rendered publicly, and told "Your profile links will appear after your first ad package"; the admin member card shows the flag.

Daily link-farm scan (spamscan.js, same copy on LinkSpin): in-app job at 06:30 Central, claimOnce per day, lists memberId-0 walletless accounts with a link plus a farm signal (prohibited term, sign-in over within 15 min, no sponsor), skips the spamScanAllow setting (seeded), writes DATA_DIR/wall-spam-scan.json and sends one Telegram to the private admin chat only when there are candidates. Admin > Members > Link-farm list: rows with "also on LinkSpin", Delete selected (existing DELETE /api/admin/member, on-chain refused, no cascade) and Allow.

Terms section 8 "Prohibited content", bio hint in the profile editor, chatbot canned answer "What content is not allowed?", KNOWLEDGE_DATE 2026-10-30. Test: qa/profile-policy.test.cjs (unit + local copy; runs in qa/run.sh member and policy).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 07:29:11 -05:00
martbost ec4ada08d7 Five Dollar Friday notice, email and kickoff mention the Game Pass perk correctly: a $5+ Friday pack earns +20% credits (600 from the $5 pack) AND includes the free 7-day Game Pass automatically (fridayPassPerk, since 2026-10-23); Marty 2026-10-30 asked for the tie-in
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 05:16:12 -05:00
martbost a058fd515d Warp & Wares integration, gated (2026-10-29): the 30-day Trade Wars-style season game, same protocol as POL Miner and Turkey Drop. WW_SSO_SECRET / WW_URL (default https://warpwares.saasy.top, staging for now) / WW_ALT_URLS / WW_SEASON_START + WW_SEASON_END (default 2026-11-30..2026-12-30, Central, end exclusive) with wwMint/wwOpen/wwIsGameUrl/wwCallback (code defaults only, no env set); GAME_AUTH warpwares (in-game sign-in kit); /api/my/warpwares hand-off + iap.return + my.js redirect; a new visit kind 'dock' in ads.js VISIT_KINDS with its own daily cap (dockCapPerDay, default 10; repeats after the cooldown like refuels; house visits count toward it) and the refuel rail serving game 'warpwares' with that kind (label 'sponsor dock', receipt kind ww-dock, note 'Warp & Wares sponsor dock', refuel.js done text 'Your bonus turns are waiting on the bridge'); GAMES() card with the season window (hidden until 'warpwares' is in gamesLive, its 'Opens' date shown only once live, gone after the season) and STRIP line; growth snapshot counts a season start only when live; walletnudge entry (idle until the secret is set); gamestats + gamepass GAMES/NAMES + GP_SECRETS; Game Pass perks row 'the Season Pass' shown only while the game is in the public games list (gpShown, the Turkey Drop pattern); cap-nudge names; promo tools Games entry (warpwares.saasy.top/?ref=, 3 posts) shown only while live; chatbot CANNED warpwares + fact follow gamesLive and the season window (coming-soon and season-over answers, KB answer kept out of the prompt unless live), KNOWLEDGE_DATE 2026-10-29b; my.js?v=20261029ww, promo.js?v=20261029ww, refuel.js?v=20261029ww. qa/warpwares.mjs (bash qa/run.sh warpwares): 21 checks on a local copy with a mock game (card gating, the hand-off token, a sponsor dock open/challenge/done with receipt + callback, the dock cap separate from refuels, chatbot gating), all passing. Not merged, not deployed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-29 16:43:49 -05:00
martbost c621fecb54 BixPay sign-up warning (Marty 2026-10-29: bizventures registered through our correct partner link but BIX recorded referrer N/A): the invite token lives only in BIX's URL and their security check often fails inside app webviews, so members who reopen BIX elsewhere lose their sponsor. Guide, Wallet card and Overview card now say: sign up on the page the button opens, no app first, no portal Sign Up menu; in-app browsers (Gmail/Telegram/Facebook webviews, iOS web views) get a notice with the link to copy into Chrome or Safari (no native dialogs); chatbot card answer carries the same; my.js + bixpay-guide.js ?v=20261029bz
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-29 11:46:46 -05:00
martbost 13e0644355 QA: syntax gate in every run.sh mode (node --check on every server and public script) after LinkSpin's /traffic-guide shipped with a parse error
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-29 10:49:06 -05:00
martbost ed6febe0b8 BixPay card integration, phase 1 (Marty approved the copy 2026-10-29; docs/BIXPAY-INTEGRATION.md): gated by site config bixpayLive (off by default). Profile > BixPay card field (partner link validated: bix.ibportal.io/auth/register, e= token, a=1; the appId=3 card-customer link is refused with a message), bixpay.js resolver own > sponsor chain (10 levels) > company link (bixCompanyLink, seeded with Marty's partner link), every surface says whose link it is. Wallet tab card, one-week Overview announcement (24 h snooze), one sentence in TierPaid payout emails and the games' wallet nudges, Promo tools > BixPay tab (3 posts, email swipe, 4 text-only banners on the Spaces CDN, tracked link + per-member clicks), public guide /bixpay with masked app screenshots, chatbot canned answers + facts gated to 'coming soon' while off (KNOWLEDGE_DATE 2026-10-29). Clicks per surface via /go/bixpay in the admin Traffic tab; admin Overview counts members with a link; member card shows it; signed /api/partner/bixpay and the lssync profile row carry it for LinkSpin/CTB. accounts.bix_partner_link column (db.js alterSafe). Tests: qa/bixpay.test.cjs (17) + walk.mjs BixPay block; my.js/promo.js/admin.js ?v=20261029bx.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-29 07:56:49 -05:00
martbost 6e1ab102f1 Holding-tank Telegram notice: a wallet that predates the tank visit says 'already linked (last seen <date>)' instead of 'linked a wallet' (Marty 2026-10-29: @teamearning, dormant since Sep 18, was returned by a sponsor and the notice read as a live member); digest wording to match; readyTick carries lastSeen + linkedNow
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-29 07:16:47 -05:00
martbost 01154c0856 Member update emails: claim the send slot before building the recipient list (the Sendy opt-in checks take minutes). On 2026-10-28 a retried POL Miner launch email raced the first one: both passed the 'already running' check, 475 members got it twice; stopped by a restart, the rest went out once. A second send now gets 'A send is already running' immediately.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 14:34:31 -05:00
martbost 7d134e55a2 Game refuel visits never come up empty (Marty 2026-10-28): after every sponsor has been seen, a member video, then a house sponsor (one of Marty's programs, never the game the player is in; 0 credits, no pool income) and, after the doorRepeatDays cooldown, a sponsor seen before again (a real, paid repeat visit, visit_repeat kind refuel). Repeats and house visits count toward the 20-a-day refuel cap. Applies to every game using /refuel (supply crates, paddles, continues, refuels, hints). Earn stays once-ever. Chatbot fact updated. qa/refuel-fallback.mjs (10 checks); member + earn qa clean; qa/door.mjs prints the callbacks on its pre-existing credits failure (admin-seeded packs are house ads, 0 credits, fails on main too)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:23:46 -05:00
martbost 8b28d028a6 All-games promo posts no longer name a game count (said 'Eight games'); list adds the brick breaker and the mining game; promo.js?v=20261028q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:28:33 -05:00
47 changed files with 3602 additions and 1750 deletions
+11 -4
View File
@@ -36,6 +36,8 @@ const pub = a => a ? { email: a.email, sponsorRef: a.sponsorRef || '', code: a.c
username: a.username || null, memberId: a.memberId || 0, joinedVia: a.joinedVia || null, joinedRef: a.joinedRef || null,
lineBannerUrl: a.lineBannerUrl || null, lineTargetUrl: a.lineTargetUrl || null, wallOffers: a.wallOffers || null,
avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials: a.socials || null,
bixPartnerLink: a.bixPartnerLink || null, // BixPay partner link (bixpay.js, 2026-10-29): one identity, follows the member to LinkSpin/CTB
profileQuarantined: !!a.profileQuarantined, // 2026-10-30: first profile save of a brand-new free account planted a link; stored, never rendered publicly (spamscan.js)
chatAvailable: a.chatAvailable === false ? false : true, lastSeen: a.lastSeen || 0,
address: a.address || null, created: a.created } : null;
const USER_RE = /^[a-zA-Z0-9_]{3,20}$/;
@@ -116,15 +118,17 @@ const J = {
acct.wallOffers = json || null; this.save();
return { ok: true, account: pub(acct) };
},
async setProfile(e, avatarUrl, bio, socials) {
async setProfile(e, avatarUrl, bio, socials, quarantined) {
const acct = this.db.byEmail[e];
if (!acct) return { error: 'No such account.' };
if (avatarUrl !== undefined) acct.avatarUrl = avatarUrl || null;
if (bio !== undefined) acct.bio = bio || null;
if (socials !== undefined) acct.socials = socials || null;
if (quarantined !== undefined) acct.profileQuarantined = !!quarantined;
this.save();
return { ok: true, account: pub(acct) };
},
async setBixLink(e, link) { const acct = this.db.byEmail[e]; if (!acct) return { error: 'No such account.' }; acct.bixPartnerLink = link || null; this.save(); return { ok: true, account: pub(acct) }; },
async touchSeen(e) { const a = this.db.byEmail[e]; if (a) { a.lastSeen = Date.now(); this.save(); } },
async setChatAvailable(e, v) { const a = this.db.byEmail[e]; if (!a) return { error: 'No such account.' }; a.chatAvailable = !!v; this.save(); return { ok: true, available: !!v }; },
async getMutes(e) { const a = this.db.byEmail[e]; return (a && Array.isArray(a.chatMutes)) ? a.chatMutes : []; },
@@ -228,7 +232,7 @@ const J = {
const rowPub = r => r ? pub({ email: r.email, sponsorRef: r.sponsor_ref, code: r.code,
username: r.username, memberId: r.member_id || 0, joinedVia: r.joined_via || null, joinedRef: r.joined_ref || null,
lineBannerUrl: r.line_banner_url, lineTargetUrl: r.line_target_url, wallOffers: r.wall_offers || null,
avatarUrl: r.avatar_url, bio: r.bio, socials: r.socials,
avatarUrl: r.avatar_url, bio: r.bio, socials: r.socials, bixPartnerLink: r.bix_partner_link || null, profileQuarantined: !!r.profile_quarantined,
chatAvailable: r.chat_available === 0 ? false : true, lastSeen: Number(r.last_seen || 0),
address: r.address, created: Number(r.created) }) : null;
const D = {
@@ -283,12 +287,14 @@ const D = {
await db.q('UPDATE accounts SET wall_offers=? WHERE email=?', [json || null, e]);
return { ok: true, account: await this.byEmail(e) };
},
async setProfile(e, avatarUrl, bio, socials) {
async setProfile(e, avatarUrl, bio, socials, quarantined) {
if (avatarUrl !== undefined) await db.q('UPDATE accounts SET avatar_url=? WHERE email=?', [avatarUrl || null, e]);
if (bio !== undefined) await db.q('UPDATE accounts SET bio=? WHERE email=?', [bio || null, e]);
if (socials !== undefined) await db.q('UPDATE accounts SET socials=? WHERE email=?', [socials || null, e]);
if (quarantined !== undefined) await db.q('UPDATE accounts SET profile_quarantined=? WHERE email=?', [quarantined ? 1 : 0, e]);
return { ok: true, account: await this.byEmail(e) };
},
async setBixLink(e, link) { const r = await db.q('UPDATE accounts SET bix_partner_link=? WHERE email=?', [link || null, e]); if (!r || !r.affectedRows) return { error: 'No such account.' }; return { ok: true, account: await this.byEmail(e) }; },
async touchSeen(e) { await db.q('UPDATE accounts SET last_seen=? WHERE email=?', [Date.now(), e]); },
async setChatAvailable(e, v) { await db.q('UPDATE accounts SET chat_available=? WHERE email=?', [v ? 1 : 0, e]); return { ok: true, available: !!v }; },
async getMutes(e) {
@@ -503,7 +509,8 @@ module.exports = { init, signup, login, ensure, onChange, isUnclaimedShell, byEm
setUsername, reservedUsername, setMemberId, namesForMembers, listByReferrer, downline, linkWallet, count,
setLineBanner: (e, b, t) => impl().setLineBanner(String(e || '').toLowerCase(), b, t),
setWallOffers: (e, j) => impl().setWallOffers(String(e || '').toLowerCase(), j),
setProfile: async (e, a, bio, socials) => { const r = await impl().setProfile(String(e || '').toLowerCase(), a, bio, socials); if (!(r && r.error)) changed(String(e || '').toLowerCase()); return r; }, // profile edits reach LinkSpin too
setProfile: async (e, a, bio, socials, quarantined) => { const r = await impl().setProfile(String(e || '').toLowerCase(), a, bio, socials, quarantined); if (!(r && r.error)) changed(String(e || '').toLowerCase()); return r; }, // profile edits reach LinkSpin too
setBixLink: async (e, link) => { const r = await impl().setBixLink(normEmail(e), link ? String(link).slice(0, 300) : null); if (!(r && r.error)) changed(normEmail(e)); return r; }, // the BixPay partner link rides to LinkSpin in the profile row (lssync.js)
touchSeen: e => impl().touchSeen(String(e || '').toLowerCase()),
adminSetAddress: (e, a) => impl().adminSetAddress(String(e || '').toLowerCase(), a ? normAddr(a) : null),
positionByAddress: a => impl().positionByAddress(normAddr(a)),
BIN
View File
Binary file not shown.
+120
View File
@@ -0,0 +1,120 @@
// BixPay card integration, phase 1 (Marty approved 2026-10-29; spec docs/BIXPAY-INTEGRATION.md).
// BIX is a separate company: a self-custody wallet with a Visa card spent from USDT/USDC. We only carry each member's
// PARTNER link (bix.ibportal.io/auth/register?e=<token>&a=1) so anyone who gets a card through their pages is credited to
// them in the BIX portal. Nothing is settled on our side: the portal tracks directs and levels itself.
//
// One identity, sponsor follows (feedback-one-identity-sponsor-follows): the link a visitor gets is the member's own,
// else the first sponsor up the chain (10 levels) with one, else the company link (site config bixCompanyLink). Every
// surface says WHOSE link is in play ("you" / "@sponsor" / "network") so members add their own and sponsors get their
// teams signed up.
//
// Everything is gated by site config bixpayLive ('0' = nothing shows; the admin flips it in Admin > Settings).
// Clicks: every surface links through /go/bixpay?s=<surface>[&m=<member>] which counts here (DATA_DIR/bixpay-clicks.json)
// and 302s to the resolved partner link. Counts per surface land in the admin Traffic tab, per member on the Promo tab.
const fs = require('fs');
const path = require('path');
let R = {}; // { dataDir, accounts, siteConfig, refAccount }
const HOST = 'bix.ibportal.io';
const PATH = '/auth/register';
const MAX_LEN = 300;
const MAX_LEVELS = 10;
// Marty's own PARTNER link (IB12143793): the company fallback until Admin > Settings bixCompanyLink says otherwise
const DEFAULT_COMPANY_LINK = 'https://bix.ibportal.io/auth/register?e=XqwU9T1aJ5N0UJ0yr9x0TGUiSQTsVCkTM01MIovVNnc&a=1';
const SURFACES = ['wallet', 'overview', 'email', 'nudge', 'promo', 'guide', 'chat'];
const CUSTOMER_LINK_MSG = "That's the card-customer link. Paste the Partner link from your BIX portal profile instead.";
const ANNOUNCE_MS = 7 * 86400000; // the Overview announcement card shows for the first week after the switch is flipped
function init(opts) { R = opts || {}; }
const cfg = () => { try { return (R.siteConfig && R.siteConfig()) || {}; } catch (e) { return {}; } };
function live() { return String(cfg().bixpayLive == null ? '0' : cfg().bixpayLive) === '1'; }
function companyLink() { const v = validate(cfg().bixCompanyLink); return v.ok ? v.link : DEFAULT_COMPANY_LINK; }
// the Overview announcement runs a week from bixpayLiveSince (stamped by the admin settings route when the switch is flipped on)
function announcing() { if (!live()) return false; const t = Date.parse(String(cfg().bixpayLiveSince || '')); return !(t > 0) || Date.now() - t < ANNOUNCE_MS; }
// A pasted partner link -> { ok: true, link } (normalised to e= and a=1 only) or { error }.
// The card-customer link carries appId=3 (it makes a card customer, not a partner): refused with the message members see.
function validate(input) {
const s = String(input == null ? '' : input).trim();
if (!s) return { error: 'Paste your BixPay partner link first.' };
if (s.length > MAX_LEN) return { error: 'That link is too long. Copy the Partner link from your BIX portal profile.' };
let u; try { u = new URL(s); } catch (e) { return { error: 'That is not a full link. It starts with https://bix.ibportal.io/auth/register?e=' }; }
if (u.protocol !== 'https:' || u.hostname.toLowerCase() !== HOST) return { error: 'A BixPay partner link lives on https://bix.ibportal.io. Copy it from your BIX portal profile (Profile > Partner).' };
if (u.pathname.replace(/\/+$/, '') !== PATH) return { error: 'That is not the register link. It looks like https://bix.ibportal.io/auth/register?e=...&a=1' };
if (u.searchParams.has('appId') || u.searchParams.has('appid')) return { error: CUSTOMER_LINK_MSG };
const e = String(u.searchParams.get('e') || '').trim();
if (!/^[A-Za-z0-9_-]{16,128}$/.test(e)) return { error: 'The link is missing its e= token. Copy the whole Partner link from your BIX portal profile.' };
if (String(u.searchParams.get('a') || '').trim() !== '1') return { error: 'The link needs a=1 on the end. Copy the whole Partner link from your BIX portal profile.' };
return { ok: true, link: 'https://' + HOST + PATH + '?e=' + e + '&a=1' };
}
const nameOf = a => a ? (a.username ? '@' + a.username : a.memberId ? 'member #' + a.memberId : 'your sponsor') : null;
// bixLinkFor(member): own link, else the first sponsor up the chain with one (10 levels), else the company link.
// -> { link, whose: 'you' | 'sponsor' | 'network', name, email } (name/email = the sponsor whose link it is)
async function resolve(acct) {
if (acct && validate(acct.bixPartnerLink).ok) return { link: validate(acct.bixPartnerLink).link, whose: 'you', name: nameOf(acct), email: acct.email };
if (acct && R.accounts && R.accounts.sponsorOf) {
const seen = new Set([String(acct.email || '').toLowerCase()]);
let cur = acct;
for (let i = 0; i < MAX_LEVELS && cur; i++) {
let s = null; try { s = await R.accounts.sponsorOf(cur.email); } catch (e) { s = null; }
if (!s || seen.has(String(s.email).toLowerCase())) break;
seen.add(String(s.email).toLowerCase());
const v = validate(s.bixPartnerLink);
if (v.ok) return { link: v.link, whose: 'sponsor', name: nameOf(s), email: s.email };
cur = s;
}
}
return { link: companyLink(), whose: 'network', name: null, email: null };
}
// the same for a public page: the referrer token (?ref / the sponsor cookie) resolves like the member it names
async function resolveRef(tok) {
let a = null; try { a = tok && R.refAccount ? await R.refAccount(tok) : null; } catch (e) { a = null; }
return resolve(a);
}
// the line every surface shows under the button
function usingLine(r) { return r.whose === 'you' ? 'Using: your link.' : r.whose === 'sponsor' ? 'Using: ' + r.name + "'s link. Add yours in Profile." : 'Using: the network link. Add yours in Profile.'; }
// tracked link for a surface (+ the member it belongs to: the sharer on promo/guide/email, the viewer on the dashboard cards)
const SITE = () => String(process.env.PUBLIC_URL || 'https://instantadpay.com').replace(/\/+$/, '');
function goLink(surface, token) { return SITE() + '/go/bixpay?s=' + encodeURIComponent(surface) + (token ? '&m=' + encodeURIComponent(String(token)) : ''); }
// one sentence for payout emails and the games' wallet nudges (text), only while live
function emailLine(token) { return live() ? 'Want to spend it? A BixPay Visa card turns POL into everyday purchases: ' + goLink('email', token) : ''; }
function nudgeLine(token) { return live() ? 'Want to spend it? A BixPay Visa card turns POL into everyday purchases: ' + goLink('nudge', token) : ''; }
// ---- clicks ----
const FILE = () => path.join(R.dataDir || '.', 'bixpay-clicks.json');
const blank = () => ({ v: 1, total: {}, days: {}, members: {} });
let S = null;
function load() { if (S) return S; try { S = Object.assign(blank(), JSON.parse(fs.readFileSync(FILE(), 'utf8'))); } catch (e) { S = blank(); } return S; }
function save() { try { fs.writeFileSync(FILE(), JSON.stringify(S)); } catch (e) {} }
const day = ts => new Date(ts).toISOString().slice(0, 10);
function click(surface, email) {
const s = SURFACES.includes(surface) ? surface : 'other';
const st = load();
st.total[s] = (st.total[s] || 0) + 1;
const d = day(Date.now()); st.days[d] = st.days[d] || {}; st.days[d][s] = (st.days[d][s] || 0) + 1;
const e = String(email || '').trim().toLowerCase();
if (e) { const m = st.members[e] = st.members[e] || { total: 0 }; m.total++; m[s] = (m[s] || 0) + 1; m.last = Date.now(); }
// bounded: 400 days
const cutoff = day(Date.now() - 400 * 86400000); for (const k of Object.keys(st.days)) if (k < cutoff) delete st.days[k];
save();
return { surface: s, email: e || null };
}
function memberClicks(email) {
const m = load().members[String(email || '').trim().toLowerCase()];
if (!m) return { total: 0 };
return Object.assign({}, m);
}
function adminView(days) {
const st = load(); const n = Math.min(365, Math.max(1, Number(days) || 30));
const since = day(Date.now() - n * 86400000);
const bySurface = {}; let total = 0;
for (const [d, row] of Object.entries(st.days)) if (d >= since) for (const [s, c] of Object.entries(row)) { bySurface[s] = (bySurface[s] || 0) + c; total += c; }
const daily = Object.entries(st.days).filter(([d]) => d >= since).sort((a, b) => a[0] < b[0] ? 1 : -1).map(([d, row]) => ({ day: d, clicks: Object.values(row).reduce((x, y) => x + y, 0) }));
const members = Object.entries(st.members).map(([email, m]) => ({ email, total: m.total || 0, last: m.last || 0, promo: m.promo || 0 })).sort((a, b) => b.total - a.total).slice(0, 50);
return { days: n, total, allTime: Object.values(st.total).reduce((x, y) => x + y, 0), bySurface, daily, members, surfaces: SURFACES };
}
function _reset() { S = null; }
module.exports = { init, live, announcing, validate, resolve, resolveRef, usingLine, companyLink, goLink, emailLine, nudgeLine, click, memberClicks, adminView, SURFACES, CUSTOMER_LINK_MSG, DEFAULT_COMPANY_LINK, MAX_LEVELS, _reset };
+3 -2
View File
@@ -69,7 +69,8 @@ const D = {
const row = r => ({ slug: r.slug, title: r.title, excerpt: r.excerpt || '', body: r.body || '', cover: r.cover || '', tags: r.tags ? String(r.tags).split(',').filter(Boolean) : [], status: r.status, author: r.author || AUTHOR, created: Number(r.created), updated: Number(r.updated), publishedAt: r.published_at ? Number(r.published_at) : null, views: Number(r.views) || 0 });
const impl = () => db.enabled() ? D : J;
function init(opts) { DATA_DIR = opts.dataDir; if (!db.enabled()) J.load(); }
let EXTRA_PAGES = () => []; // sitemap entries that follow a switch (the /bixpay guide while bixpayLive, 2026-10-29)
function init(opts) { DATA_DIR = opts.dataDir; if (typeof opts.extraPages === 'function') EXTRA_PAGES = opts.extraPages; if (!db.enabled()) J.load(); }
async function listAll() { return (await impl().all()).sort((a, b) => (b.publishedAt || b.created) - (a.publishedAt || a.created)); }
async function listPublished() { return (await listAll()).filter(p => p.status === 'published' && (p.publishedAt || 0) <= Date.now()); }
async function get(slug) { return impl().get(slugify(slug)); }
@@ -152,7 +153,7 @@ function rss(posts) {
return '<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>InstantAdPay blog</title><link>' + SITE + '/blog</link><description>Coaching and teaching articles from Marty Bostick.</description>' + items + '</channel></rss>';
}
function sitemap(posts) {
const pages = ['/', '/facts', '/blog', '/whats-new', '/leaderboard', '/ledger', '/contract', '/plays', '/wallets', '/earning', '/partners', '/friday', '/wednesday', '/refuel', '/conversion-tracking', '/presentation'];
const pages = ['/', '/facts', '/blog', '/whats-new', '/leaderboard', '/ledger', '/contract', '/plays', '/wallets', '/earning', '/partners', '/friday', '/wednesday', '/refuel', '/conversion-tracking', '/presentation'].concat(EXTRA_PAGES() || []);
const u = pages.map(p => '<url><loc>' + SITE + p + '</loc><changefreq>weekly</changefreq></url>').join('')
+ posts.map(p => '<url><loc>' + SITE + '/blog/' + p.slug + '</loc><lastmod>' + new Date(p.updated).toISOString().slice(0, 10) + '</lastmod><changefreq>monthly</changefreq></url>').join('');
return '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' + u + '</urlset>';
+51 -6
View File
@@ -24,7 +24,8 @@ const MODEL = process.env.OPENROUTER_MODEL || 'deepseek/deepseek-v4-flash:nitro'
function init(opts) {
if (opts && typeof opts.gameLive === 'function') GAME_LIVE = opts.gameLive;
if (opts && typeof opts.refuelOn === 'function') REFUEL_ON = opts.refuelOn; DATA_DIR = opts.dataDir; chain = opts.chain; PASS_TIERS = typeof opts.passTiers === 'function' ? opts.passTiers : null; return kb.init({ dataDir: DATA_DIR, seeds: seeds() }); }
if (opts && typeof opts.refuelOn === 'function') REFUEL_ON = opts.refuelOn;
if (opts && typeof opts.bixLive === 'function') BIX_LIVE = opts.bixLive; DATA_DIR = opts.dataDir; chain = opts.chain; PASS_TIERS = typeof opts.passTiers === 'function' ? opts.passTiers : null; return kb.init({ dataDir: DATA_DIR, seeds: seeds() }); }
function key() {
if (process.env.OPENROUTER_API_KEY) return process.env.OPENROUTER_API_KEY.trim();
try { return fs.readFileSync(path.join(DATA_DIR, 'openrouter.key'), 'utf8').trim(); } catch (e) { return ''; }
@@ -32,12 +33,30 @@ function key() {
function enabled() { return !!key(); }
// ---- canned answers: instant, free, always in voice ----
const KNOWLEDGE_DATE = '2026-10-28'; // bump whenever the canned answers / prompt are brought up to date
const KNOWLEDGE_DATE = '2026-10-30'; // bump whenever the canned answers / prompt are brought up to date
const SUPPORT_RE = /(contact|reach|email|e-mail|message|talk to|speak (to|with)|get hold of) (the )?(support|admin|administrator|owner|marty|staff|team at instantadpay|someone|a (human|person|real person))|support (email|address|ticket|team|desk)|help ?desk|(open|send|file|submit|raise) (a )?(support )?ticket|\b(human|real person|live (agent|person|chat|support))\b|customer (service|support)|support@|how (do|can) i get (help|support)/i;
const CANNED = [
{ id: 'support', title: 'Contact support or open a ticket', q: ['How do I contact support?', 'How do I talk to a real person?', 'How do I open a support ticket?'], tags: ['support', 'help', 'ticket', 'contact', 'help desk'],
re: SUPPORT_RE, handoff: true,
a: 'Open Help in your member dashboard (https://instantadpay.com/my#help) to send Marty a ticket, and his replies land right there and in your email. Not signed in or locked out? Use https://instantadpay.com/support, or email support@instantadpay.com. You can also tap "Send this to support" below and I will pass this chat along.' },
// BixPay Visa card (2026-10-29, docs/BIXPAY-INTEGRATION.md). Sits ahead of the Level 4 entry because that one also matches "3%".
// While site config bixpayLive is off, answer() swaps every bixpay-* hit for BIX_SOON_ANSWER. Never BIX's marketing claims (user
// counts, spend per day, valuations) as facts; the only fee we state is 3% per purchase, no load fee, see BIX's terms for the rest.
{ id: 'bixpay-link', title: 'Where to put my BixPay partner link', q: ['Where do I put my BixPay partner link?', 'How do I add my BIX link?', 'Which BixPay link do I paste, referral or partner?'], tags: ['bixpay', 'bix', 'partner link', 'profile', 'ib portal'],
re: /(bix|bixpay).*(partner link|my link|referral link|ib ?portal|paste|where do i (put|add|enter)|profile)|(partner link|ib ?portal).*(bix|bixpay)/i,
a: 'Members > Profile > BixPay card. Paste your PARTNER link there: in your BIX portal (bix.ibportal.io) open Profile and copy the link in the second box, the one labelled Partner. It looks like https://bix.ibportal.io/auth/register?e=...&a=1. The first box, the Bix referral link (it ends in appId=3), only makes a card customer, so the field refuses it and asks for the Partner one. Once saved, your Wallet card, your promo kit, the /bixpay guide opened from your links and the line in your payout emails all carry your link, and LinkSpin will read the same one.' },
{ id: 'bixpay-credit', title: 'Who gets the BixPay credit', q: ['Who gets credit when someone signs up for BixPay through my page?', 'Whose BixPay link is on my pages?', 'What does "Using: the network link" mean?'], tags: ['bixpay', 'bix', 'credit', 'sponsor', 'network link'],
re: /(bix|bixpay).*(credit|whose|who gets|sponsor.s link|network link|using:|my sponsor|upline)|(whose|who gets).*(bix|bixpay)/i,
a: 'The BixPay link on your pages is yours when you have saved your partner link in Profile. If you have not, it is the first sponsor up your line (up to ten levels) who has one, and if nobody has, it is the network link. Every BixPay card says which one is in play: "Using: your link", "Using: @name’s link" or "Using: the network link". Sign-ups are credited inside the BIX portal to whoever owns that link, directs and levels included; InstantAdPay does not count or pay BixPay sign-ups itself. Add your own link in Members > Profile > BixPay card so the credit is yours.' },
{ id: 'bixpay-load', title: 'Loading the BixPay card from POL', q: ['How do I load my BixPay card from POL?', 'Can I send POL to BixPay?', 'How do I fund the BixPay card?'], tags: ['bixpay', 'bix', 'fund', 'load', 'usdt', 'usdc', 'polygon', 'cash app'],
re: /(bix|bixpay).*(load|fund|top ?up|deposit|send pol|from pol|usdt|usdc|swap|cash ?app)|(load|fund|top ?up).*(bix|bixpay)/i,
a: 'The BixPay card spends USDT or USDC, so the step is POL to USDT or USDC first. Three ways: (1) swap your POL for USDT or USDC on any exchange or on-ramp you already use, then send it to your BixPay wallet on the Polygon network (open the BIX app, Wallet > Receive, pick USDT or USDC, and use the Polygon address); (2) in the US, Cash App can send crypto straight to the BixPay wallet; (3) BIX has said an in-app swap is coming, and we will add it here when it ships. Once the USDT or USDC is in the wallet, tap TOPUP on the card. No load fee; 3% per purchase; see BIX’s terms for other charges. The full walk-through with screenshots is at https://instantadpay.com/bixpay.' },
{ id: 'bixpay-card', title: 'How to get the BixPay card', q: ['How do I get the BixPay card?', 'How do I sign up for BixPay?', 'Is BixPay available in my state?'], tags: ['bixpay', 'bix', 'visa card', 'virtual card', 'sign up', 'states'],
re: /(bix|bixpay).*(get|sign ?up|join|order|apply|virtual|plastic|metal|state|country|available|how much|cost|price|\$9)|(get|sign ?up for|order).*(bix|bixpay)/i,
a: 'Open the BixPay card in your Wallet tab (Members > Wallet) and tap Get your BixPay card. That opens a partner sign-up link, so you join as a partner and the card and the referral plan come with it: 1) register in the BIX portal ON THE PAGE THE LINK OPENS (if you are reading this inside Gmail or Telegram, open the page in Chrome or Safari first; do not install the app first and do not use the portal’s own Sign Up menu, or your sponsor is lost and BIX shows the referrer as N/A), 2) download the BIX app and create your wallet, 3) in the app open Settings > Scan QR and scan the code in your portal profile to link the two, 4) Cards > Create Card for the $9.99 virtual Visa (plastic, metal and gold cards cost more). KYC is required for the card. In the US it is open in 31 states so far; not in your state yet? You can still get the wallet and build. Elsewhere availability varies by country. Guide: https://instantadpay.com/bixpay.' },
{ id: 'bixpay', title: 'What BixPay is', q: ['What is BixPay?', 'What is the BIX card?', 'Can I spend my POL with a Visa card?'], tags: ['bixpay', 'bix', 'visa', 'card', 'spend pol', 'wallet'],
re: /(bix|bixpay|bix card|visa card|debit card|spend (my )?(pol|crypto|earnings)|crypto card)/i,
a: 'BixPay is a self-custody wallet with a Visa card, made by BIX, a separate company. You send USDT or USDC to it on Polygon, load the card, and spend wherever Visa is accepted, including Apple Pay and Google Pay. Virtual cards from $9.99. 3% per purchase, no load fee; see BIX’s terms for other charges. InstantAdPay is not the card issuer; members who join BixPay as partners get their own partner link, and anyone who gets a card through their pages is credited to them in the BIX portal, up to ten levels deep. Where to find it: Members > Wallet (the card), Members > Profile (your partner link), Promo tools > BixPay (posts and banners), and the guide at https://instantadpay.com/bixpay. Crypto assets can lose value.' },
{ id: 'level4-override', title: 'The Level 4 override (3%)', q: ['What is the Level 4 override?', 'Do I earn from my fourth level?', 'How does the 3% override work?'], tags: ['override', 'level 4', 'fourth level', 'commission', 'payouts'],
re: /(level ?(4|four)|4th level|fourth level|override|3 ?%|three percent)/i,
a: 'The Level 4 override is 3% of every package bought four levels below you, paid by the company on top of the three levels the contract pays. It goes to the buyer’s 4th sponsor up if that member has 5 or more qualifying buyers (direct referrals who bought $20 or more, the same bar as level 3). If they do not have 5 yet, it moves up the line to the next member who does, up to 25 steps, and each purchase pays one override to one person. It is paid weekly in POL from a company wallet, every Monday after 9 AM Central for the Monday to Sunday week before, through the contract’s award function, so every payment has a Polygon link, and it shows in your Earnings as "Level 4 override". Weekly totals under 0.01 POL carry over to the next week. It counts purchases from the start date on, not earlier ones. It comes from the platform’s 20% share, so the 50/20/10 split does not change. What you earn depends on real purchases in your line; nothing is guaranteed.' },
@@ -60,6 +79,9 @@ const CANNED = [
{ id: 'spellwheel', title: 'SpellWheel word game', q: ['What is SpellWheel?', 'Is there a daily word puzzle?'], tags: ['games', 'spellwheel', 'word game', 'daily puzzle'],
re: /(spell ?wheel|letter wheel|word (game|puzzle)|crossword|daily puzzle)/i,
a: 'SpellWheel (https://spellwheel.com, also in Members > Games) is a free word game: swipe the letters on the wheel to fill the crossword grid, travel through six cozy places, and solve a new daily puzzle that everyone gets at the same time. Sign in with your InstantAdPay account right in the game to save progress: clearing levels, finishing a place and solving the daily puzzle each pay POL, collected in your SpellWheel balance and sent to the wallet on your InstantAdPay account automatically. Nothing here is a promise of income.' },
{ id: 'warpwares', title: 'Warp & Wares season game', q: ['What is Warp & Wares?', 'How does Warp & Wares pay?', 'What is a sponsor dock?'], tags: ['games', 'warp and wares', 'trade wars', 'season', 'sponsor dock', 'turns'],
re: /(warp ?(and|&) ?wares|warpwares|trade ?wars|sponsor docks?|bonus turns|trading season)/i,
a: 'Warp & Wares (also in Members > Games) is the network\u2019s 30-day season game in the Trade Wars style. One shared galaxy of 1,200 sectors; every captain gets the same 200 turns a day (reset at midnight Central, never banked) to warp between sectors, buy ore, grain and parts where they are cheap and sell where they are not, haggle, leave fighters and mines to hold sectors, found a base and run a team of up to five with a shared vault. One tap signs you in with your InstantAdPay account. Credits stay in the game; POL is paid for fixed outcomes from a published season budget: the holders of the six landmark sectors and the top traders at each weekly tick (Sundays 9 AM Central), one-time milestones (first base, first garrison, first 100,000 credits traded), and the season-close leaderboard and titles. POL collects in your Warp & Wares balance and is sent automatically to the wallet linked to your InstantAdPay account (one free signature on the Wallet tab). Sponsor markets: docking at one opens a short verified sponsor visit on InstantAdPay and pays bonus turns, the only turns past the daily 200; that is gameplay only, never POL. When the season ends the galaxy resets and the next one starts. Nothing here is a promise of income.' },
{ id: 'polminer', title: 'POL Miner mining game', q: ['What is POL Miner?', 'How do Polygon crystals work in POL Miner?', 'What is a supply crate?'], tags: ['games', 'polminer', 'mining', 'polygon crystal', 'supply crate'],
re: /(pol ?miner|mining game|digging game|polygon crystals?|pink crystals?|drill boss(es)?|supply crates?)/i,
a: 'POL Miner (https://polminer.com, also in Members > Games) is a free dig-down mining game. Dig through the layers of dirt and rock, haul ore up to sell for coins, upgrade your pick, lamp, cart and thruster, and beat a drill boss every 30 m to open the way deeper. The rare glowing pink Polygon crystals pay a random amount of POL the first time you dig each one out, each drill boss pays POL the first time you beat it, and so do your first trips to 50, 100, 150 and 200 m. Coins are for upgrades only and never turn into POL. You can play as a guest right away; sign in with your InstantAdPay account in the game and what you earned as a guest is collected. POL collects in your POL Miner balance and is sent automatically to the wallet linked to your InstantAdPay account (one free signature on the Wallet tab) once it reaches the payout amount. Low on lamp power or coins? Park on the SUPPLY pad: a short sponsor visit opens a supply crate with a full lamp and coins.' },
@@ -172,6 +194,9 @@ const CANNED = [
{ id: 'trust-drain', title: 'Trust Wallet "drain your wallet" warning', q: ['Trust Wallet says this transaction will drain my wallet', 'My wallet blocked the purchase'], tags: ['trust wallet', 'drain', 'wallet warning', 'walletconnect'],
re: /(drain (my|your) wallet|stop and go back|trust wallet.*(warn|block|red)|wallet (warning|blocked))/i,
a: 'That red "this transaction will drain your wallet" screen is the wallet\'s own safety rule, not a problem with the purchase: Trust Wallet blocks any transaction that spends most of the POL in the wallet. Ways through: buy a smaller package first, add some POL so the purchase is well under half the balance, or connect a different wallet (MetaMask, Phantom, SafePal have no such block). Extra POL always stays yours. If the next try says WalletConnect disconnected, open Wallet, tap Disconnect, then Connect again. Phantom, SafePal and MetaMask do not have the hard block.' },
{ id: 'prohibited-content', title: 'What content is not allowed?', q: ['What content is not allowed?', 'Can I put a link in my bio?', 'Can I advertise a casino or CBD?'], tags: ['prohibited content', 'rules', 'bio links', 'gambling', 'adult', 'link farm'],
re: /(not allowed|prohibited|forbidden|banned (content|words|niches?)|content (rules|policy)|what (content|ads|niches?) (is|are) (not )?(allowed|ok|accepted)|can i (post|promote|advertise|run) .*(casino|gambling|betting|adult|porn|cbd|weed|pharma|guns?)|link ?farm|backlinks?|links? in (the |my |your )?bio|bio (link|url)|why was my (bio|profile|link) (refused|rejected|blocked))/i,
a: 'Not allowed anywhere on InstantAdPay (ads, campaigns, line banners, wall offers, bios and social links): gambling, casinos, betting, lotteries and sweepstakes; adult or sexual content; drugs and prescription pharmaceuticals; weapons; hate or harassment; malware, phishing and counterfeit goods; misleading financial promises. The bio is text only: no links and no domain names, links go in the social fields in Profile. Your bio, avatar and social links show on your public wall once you have bought a package; free accounts show only their name and the line’s ads there. Accounts created just to place links in profile fields (link farming) are removed without notice, with their profile text. The full list is in the Terms, section 8: https://instantadpay.com/terms#prohibited' },
{ id: 'wall', title: 'Your banner wall and its three positions', q: ['How does my wall work?', 'How do I own wall positions 2 and 3?'], tags: ['wall', 'banner wall', 'positions'],
re: /(wall (page|slots?|positions?)|banner wall|my wall|three (ads|slots) on (my|the) wall)/i,
a: 'Your wall (instantadpay.com/wall/yourname) shows three ads. Position 1 is always your line banner. Positions 2 and 3 show your upline (or InstantAdPay) until you earn them: 2 qualifying buyers ($20 or more) make position 2 yours, 5 make position 3 yours, so a fully qualified member owns the whole page with their own links and offers. Set them in Profile > Your wall; an unlocked slot you leave empty keeps showing your upline until you fill it.' },
@@ -241,6 +266,23 @@ function synFact() { const n = SYN_N(); return '- NETWORK RATE (live, Marty 2026
let REFUEL_ON = () => false;
// POL Miner (2026-10-28) follows site config gamesLive: until 'polminer' is in it the assistant only says it is coming soon
let GAME_LIVE = () => false;
// BixPay (2026-10-29) follows site config bixpayLive: until it is on the assistant only says the card is coming soon
let BIX_LIVE = () => false;
const bixLive = () => { try { return !!BIX_LIVE(); } catch (e) { return false; } };
const isBixId = id => /^(c-)?bixpay(-[a-z]+)?$/.test(String(id || ''));
const BIX_SOON_ANSWER = 'A BixPay Visa card for spending POL is coming to InstantAdPay soon: a self-custody wallet with a Visa card, made by BIX, a separate company. It is not switched on here yet. When it is, it shows up on your Wallet tab, with a partner-link field in your Profile and a guide at instantadpay.com/bixpay, and the release notes will say so.';
function bixFact() { return bixLive()
? '- BIXPAY VISA CARD (LIVE, 2026-10-29): BixPay = a self-custody wallet + Visa card made by BIX, a SEPARATE company (not InstantAdPay). The member sends USDT or USDC to the BixPay wallet on Polygon, loads the card, spends wherever Visa is accepted incl. Apple Pay and Google Pay. Virtual card $9.99 (plastic, metal and gold cost more). The ONLY fee we state: 3% per purchase, no load fee; for anything else say "see BIX’s terms". US: open in 31 states so far; not in your state yet = you can still get the wallet and build; elsewhere availability varies by country; KYC required for the card. Funding POL -> card: (1) swap POL to USDT/USDC on any exchange or on-ramp, send on Polygon (app: Wallet > Receive > USDT or USDC > Polygon address); (2) US: Cash App can send crypto straight to the BixPay wallet; (3) an in-app swap is announced by BIX but NOT live: never say members can swap POL inside the app today. Sign-up steps: partner link -> register in the BIX portal (bix.ibportal.io) -> download the BIX app -> Settings > Scan QR to link app and portal -> Cards > Create Card ($9.99 virtual). Partner plan, plain words: BIX puts half of the 3% fee and of card sales into its partner plan, paid over ten levels (15% level 1, 10% level 2, 2.5% each on levels 3 to 10) plus a 5% pool; sign-ups and commissions are tracked and paid by BIX in the BIX portal, never by InstantAdPay; any worked example is hypothetical, not typical, and never a promise. Disputes: BIX accepts a dispute up to 120 days after a transaction posts; they can take 30 to 60 business days. WHERE: Members > Wallet (the card with Get your BixPay card + How it works), Members > Profile > BixPay card (the member pastes their PARTNER link from BIX portal > Profile > Partner, the second box; the referral link with appId=3 is refused), Promo tools > BixPay tab (3 posts, an email swipe, 4 text-only banners, all carrying the member’s link, plus the tab’s click count), the public guide https://instantadpay.com/bixpay (add ?ref=<username> and the page carries that member’s link), one sentence in payout emails. WHOSE LINK: the member’s own partner link, else the first sponsor up the chain (10 levels) with one, else the network link; every card says which ("Using: your link / @name’s link / the network link"). Compliance: InstantAdPay is not the card issuer and earns a referral commission when someone signs up through a partner link; crypto assets can lose value. NEVER repeat BIX marketing claims (user counts, cards issued, spend per day, valuations, "bigger than X") as facts; if asked, say those are BIX’s own claims and we have not verified them.\n'
: '- BIXPAY VISA CARD: COMING SOON, not switched on yet. If asked about BixPay, BIX, a crypto Visa card or spending POL with a card, say it is coming to the Wallet tab soon and nothing is live yet; never quote its fees, steps, links or the partner plan until it is on.\n'; }
// Warp & Wares (2026-10-29, the 30-day season game) follows gamesLive the same way; its season window is WW_SEASON_START / WW_SEASON_END (Central, end exclusive)
const WW_END = /^\d{4}-\d{2}-\d{2}$/.test(String(process.env.WW_SEASON_END || '')) ? process.env.WW_SEASON_END : '2026-12-30';
const wwDay = () => new Date().toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
const wwOver = () => wwDay() >= WW_END;
const wwLive = () => { try { return !!GAME_LIVE('warpwares') && !wwOver(); } catch (e) { return false; } };
const WARPWARES_SOON_ANSWER = 'Warp & Wares, a 30-day space trading season game in the Trade Wars style, is coming soon to the InstantAdPay games. It is not open yet; it will show up on your Games tab (Members > Games) and in the release notes when it opens.';
const WARPWARES_OVER_ANSWER = 'The Warp & Wares season is over; the next one is announced on the Games tab and in the release notes. The other games are on your Games tab (Members > Games).';
const wwAnswer = () => wwOver() ? WARPWARES_OVER_ANSWER : WARPWARES_SOON_ANSWER;
function warpwaresFact() { return wwLive() ? '- WARP & WARES (30-day season game, Members > Games): a Trade Wars-style trading and territory game in one shared galaxy of 1,200 sectors. Every captain gets 200 turns a day (reset midnight Central, never banked): warp, trade ore/grain/parts between markets, haggle, hold sectors with fighters and mines, found a base (six levels on build clocks), teams of five with a shared vault and elected leader. One-tap sign-in with the InstantAdPay account. PAYS POL from a published season budget: landmark holders and top traders at each weekly tick (Sundays 9 AM Central), one-time milestones (first base, first garrison, first 100,000 credits traded), the season-close leaderboard and titles. POL collects in the game balance and is paid automatically to the wallet linked on InstantAdPay. SPONSOR DOCK: docking at a sponsor market opens a short verified sponsor visit (charged to the advertiser like any game refuel visit, visit kind dock) and pays BONUS TURNS, the only turns past 200; gameplay only, never POL. Credits never turn into POL. Season Pass through the Game Pass: a hull step up, a second base slot, a named ship, a team banner, gold badges; never turns, fighters or prizes. Never state amounts, caps, totals or a season budget.\n' : wwOver() ? '- WARP & WARES: the season has ENDED; say the season is over and point to the Games tab for the next one.\n' : '- WARP & WARES: COMING SOON, not open yet. Never send members to the game address; say it is coming soon to the Games tab, and do not bring it up unless asked.\n'; }
const POLMINER_SOON_ANSWER ='POL Miner, a dig-down mining game where rare Polygon crystals pay POL, is coming soon to the InstantAdPay games. It is not open yet; it will show up on your Games tab (Members > Games) and in the release notes when it launches.';
const pmLive = () => { try { return !!GAME_LIVE('polminer'); } catch (e) { return false; } };
function polminerFact() { return pmLive() ? '- POL MINER (https://polminer.com, Members > Games): a free dig-down mining game. Dig, sell ore for coins, upgrade pick/lamp/cart/thruster, beat a drill boss every 30 m. Pink Polygon crystals pay a random POL amount the first time each one is dug out; each boss pays POL on its first win per account; first trips to 50/100/150/200 m pay POL. Coins never turn into POL. Guests can play and collect at sign-in. POL is paid automatically to the wallet linked on InstantAdPay. The SUPPLY pad opens a sponsored supply crate (full lamp + coins, never POL) after a short sponsor visit.\n' : '- POL MINER: COMING SOON, not open yet. Never send members to polminer.com; say it is coming soon to the Games tab.\n'; }
@@ -251,7 +293,7 @@ function systemPrompt(kbBlock) {
FACTS:
- LEVEL 4 OVERRIDE (LIVE 2026-10-26, first payout Monday 2026-11-02): company-paid, off-chain decision, on-chain payment. 3% of every package purchase (the POL actually paid) goes to the buyer's 4th upline on the contract sponsor chain if that member's contract buyerCount is 5 or more (qualifying buyer = direct referral with a $20+ purchase, same bar as level 3); otherwise it hunts up to the next qualified upline, max 25 hops; the company account (#1) or no qualified upline = company keeps it; exactly one recipient per purchase. Paid weekly in POL every Monday after 9 AM Central for the previous Monday to Sunday Central week, from a company payer wallet via the contract's award(memberId), shown in Earnings as 'Level 4 override' with a Polygon link and announced by email and an on-site notice. Under 0.01 POL carries to the next week. Purchases from the start date only, no back pay. Funded from the platform's 20%; the contract split 50/20/10 is unchanged. Never promise amounts.
${passTiersFact()}${refuelFact()}${synFact()}${polminerFact()}- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref=<username> link.
${passTiersFact()}${refuelFact()}${synFact()}${polminerFact()}${warpwaresFact()}${bixFact()}- ROAD AGENT (LIVE 2026-10-15, https://roadagent.app): a night-highway shooter open to every member. Open the Games tab and tap Play on the Road Agent card, or go to roadagent.app and sign in with the InstantAdPay email. Drive the four-lane highway, shoot the hostiles (thug sedans, switchblades, gunner vans), spare the civilians, pull into the weapons truck for oil slicks, smoke and missiles. Clearing a sector for the first time pays POL to the wallet on the member's InstantAdPay account, plus a daily patrol reward; scrap buys garage upgrades. Fuel = a sponsor visit: before a run the player visits an advertiser's page (a FUEL STOP), which is a normal verified visit with the dwell timer and human check, charged to the advertiser like any visit; advertisers' existing visits campaigns are already in the rotation, nothing to set up; to get more traffic from the game, top up the visits campaign. Clickable Pause, Sound and Music buttons sit under the game (P / M / N keys also work), and the Run tab has an Invite a friend card with the member's roadagent.app/?ref=<username> link.
- HELP DESK (LIVE 2026-10-16): members open Help in the dashboard (/my#help) to send Marty a support ticket (pick a category, a subject, the message, up to 2 screenshots), see each ticket's status (Open, Waiting on you, Closed) and read and answer his replies; a badge shows when he has replied, and replies also arrive by email. Anyone signed out or locked out uses the public form at https://instantadpay.com/support (name, email, category, subject, message) and gets an email with the ticket number (like IAP-1042) and a private link to view and reply, no sign-in needed. support@instantadpay.com also reaches Marty. Replying to a closed ticket opens it again. In this chat, "Send this to support" turns the conversation into a ticket. Only Marty answers, so replies are not instant; never promise a response time.
- PRESENTATION (2026-10-15): instantadpay.com/presentation is a public page (no sign-in) with the narrated InstantAdPay presentation, about six minutes, Marty's voice, captions in 6 languages (English, Italiano, Français, Español, Deutsch, Português) chosen with pills under the player. Sixteen parts: the platform, ad reach, the nine games that pay POL, the $20 split ($10 / $4 / $2 / $4 platform, same transaction), three rules, packages, the 2-then-5 unlock, pass-up, wide versus narrow ($800 vs $36, an illustration), Qualified Start, the Pipeline, LinkSpin (pre-launch Nov 1), one wallet across the network, the first week, and 'the target is five'. Share link: Members > Promo tools > 'Share the presentation' copies instantadpay.com/presentation?ref=<username>; ?ref sets the same 30-day sponsor cookie as the invite link, the page shows 'Shared with you by @name' with avatar and a Join button to /join/<username>. It is in the site menu as 'Presentation'. BUILD WIDE VIDEO: first card in Promo tools > Videos ('Build wide: watch the payments flow'), matched link ?v=wide.
- WIRED WEDNESDAY: every Wednesday, Central time (midnight to midnight), any ad package of $20 or more (Activation and up; no $10 pack exists) earns +25% bonus credits wired into the buyer's balance the moment the purchase settles, purchased-grade (usable on every format incl. login ads), credit log label "Wired Wednesday". First one: Wednesday 2026-09-30. Page: instantadpay.com/wednesday. Credits buy ad delivery, never money.
@@ -269,6 +311,7 @@ ${passTiersFact()}${refuelFact()}${synFact()}${polminerFact()}- ROAD AGENT (LIVE
- Ad packages: Micro $5/500 credits, Starter $10/1,000, Activation $20/2,000, Builder $50/5,500, Growth $100/12,000, Leader $250/32,500, Elite $500/70,000. Dollar-priced, settled in POL (Polygon) at the live Chainlink rate. 1 credit = 1 cent of ad delivery.
- Live formats: display banners (per impression), text ads (per impression), full-screen LOGIN ADS (per day: right after a member signs in they land on a sponsor interstitial — they click "Open Ad", the advertiser's page opens in a NEW tab, a countdown runs on the interstitial, and at zero a "Go to dashboard" button appears. Just a CTA link is enough; an optional banner image can be the clickable creative. No framing requirement since it opens in its own tab), WATCH-TO-EARN VIDEO ADS (advertiser uploads an MP4/WebM or gives a direct https .mp4/.webm link and picks a required watch length — 10s/30s/60s — which sets the per-view price; viewers watch in an escape-proof player under Earn credits > Watch videos, the watch time is enforced on the server clock, and they earn credits per completed watch; you never see your own videos), and solo ads. Banner ads also require a size (standard IAB sizes like 728x90, 300x250). Video watching is capped at 8 a day per member and pays 1, 2 or 4 credits for a 10, 30 or 60 second watch. FEATURED LINKS (live): a headline + link in the Featured strip at the top of every member's Overview, booked for 1, 2 or 7 days at 40 credits a day, up to 7 days ahead, at most 10 links sharing any day; flat buy paid when booked; the row shows days left and 'runs through <date>', counts views (one per viewer per hour) and clicks, and offers Extend run. VERIFIED-VISIT PACKS (live): 3 credits per visit, minimum 20 visits, paid up front; each visit is a distinct member who opens the site in a new tab, stays 8 seconds and passes a check, at most 20 visits per member per day; the row shows 'N of M visits delivered' and Buy more visits adds to the pack; the visitor earns 1 credit.
- WALLETS + BUYING POL (Training > Wallets and buying POL, /wallets, members only): preferred MetaMask (recommended; extra accounts for Qualified Start), Phantom (PHANTOM GOTCHA: Polygon is OFF by default; Settings > Active Networks > turn on Polygon, otherwise connect/buy fails or shows the wrong network; seen with Jim Watts' EB team 2026-09-13), SafePal, Coinbase Wallet; Trust works but blocks buys spending most of its POL (keep ~2x). MoonPay flow: connect wallet, Buy packages > "Buy POL with a card" opens MoonPay with POL on Polygon + the member's address prefilled; card/Apple Pay/Google Pay; first-time ID check; minimum order ~$30; buy package cost + 2-3 POL for fees; POL arrives in minutes; then buy. Exchanges: withdraw POL on the Polygon network. Never MATIC on Ethereum, never share the recovery phrase.
- PROHIBITED CONTENT (2026-10-30, Terms section 8, /terms#prohibited): gambling, casinos, betting, lotteries, sweepstakes; adult or sexual content; drugs and prescription pharmaceuticals; weapons; hate or harassment; malware, phishing, counterfeit goods; misleading financial promises. Refused at save time in bios, social links, line banners, wall offers and every campaign field. A bio may not contain a URL or a domain (links go in the social fields). Profile text, avatar and social links appear on the public wall ONLY for members who have bought a package; a free account's wall shows the name, the line's ads and the join button. Link-farm accounts (created to plant links in profile fields) are removed without notice with their profile text.
- INTRO VIDEO ON THE WALL: Profile > social links has an "Intro video" field (YouTube, Vimeo or direct .mp4 link). It embeds on the member's public wall page (/wall/<username>) right under their bio, above the three-level line and the join button.
- HOLDING TANK (Members > My line > Holding tank card): free members who joined with no sponsor wait there; a member who has switched on payouts AND bought their own $20+ package can Adopt one (first come, max 2 open adoptions, 7-day window; if the person never links a wallet or buys, they fall back into the tank; a person can be adopted twice at most). Adopting sets the sponsor, opens a chat and emails the member; their first purchase then binds to the adopter on-chain. Members can also "Release to tank" one of their own free referrals (pay it forward), but NOT someone they adopted less than 3 days ago: an adoption is a commitment, and a dropped adoption still counts toward that person's two-adoption lifetime limit. Releases are posted to the feed and Telegram like pickups. Admin sees the tank under Members.
- TANK ACTIVATION HOLD (2026-10-27, Marty: never default a tank member to the company): a tank member (no sponsor, not activated) can NOT switch on payouts on its own yet (a PURCHASE is NEVER held, Marty 2026-10-27: with no sponsor anywhere a buy goes ahead under the catch position #1); the Wallet tab and Getting started card say "You're being matched with a sponsor. Payouts switch on as soon as someone picks you up (within 24 hours)." with the time left, and the activate button is hidden. The 24-hour clock starts when they link a wallet; they then show at the top of every holding tank with a green "Ready to activate" badge and hours left, and a post goes to the team's Telegram payments topic. If nobody adopts them in 24 hours, the site auto-assigns them to the next eligible adopter in rotation (own $20+ package, fewer than 2 open adoptions, signed in within 7 days, not suspended; least recently auto-assigned first); the adopter gets a chat + email and Telegram shows the pickup marked (auto-assigned). If nobody is eligible they stay on hold and the admin is alerted; never the company. Someone whose same email or wallet already has a sponsor on LinkSpin is placed under that sponsor instead (not one they were released or rescued from). A member who arrived through a sponsor link is never held. Once they have a sponsor the hold lifts by itself. ONE-TAP SWITCH ON PAYOUTS (2026-10-27): every tank assignment (manual adoption or the 24-hour auto-assign) sends the member a chat and an email with a Switch on payouts link, https://instantadpay.com/my?activate=1#wallet; it opens the Wallet tab and starts the normal Activate payouts flow with the new sponsor prefilled (after sign-in, and after linking a wallet if none is linked yet). It never starts while the hold applies or when no sponsor resolves. The site cannot activate for anyone: activation is one free transaction from the member's own wallet. Not activated 24 hours after the assignment: one reminder email to the member with the same link and one notice to the sponsor ("@x hasn't switched on payouts yet; a nudge from you helps"); at 72 hours one last email to the member only; both stop once the member switches on payouts or buys.
@@ -326,7 +369,7 @@ ${passTiersFact()}${refuelFact()}${synFact()}${polminerFact()}- ROAD AGENT (LIVE
- SPOOKY DOORS (Halloween season game, 2026-10-02): https://spookydoors.com, open 2026-10-04 through Halloween night (closes at midnight Central at the end of Oct 31); its Games tab card shows only during the season, with a "Limited time, ends Oct 31" ribbon. Members sign in with one tap from Members > Games. Walk the street, collect candy, avoid black cats and bats, knock on doors. Each door is a verified visit to a member's page or ad (a member video once every page has been visited), the advertiser is charged as for any visit, the player gets candy not credits; 15 doors per Central day, separate from the 20 Earn-tab visits and the 20 Drip Runner refuels. A treat is 10 candy; about 1 door in 5 is a trick (a ghost or skeleton you tap 5 times quickly; beat it for a 3 candy bonus, miss it for half the treat). If no paid ad is left for that player, the door shows a house ad for one of our own programs: a smaller treat (5 candy), and it still counts toward the 15 doors. CANDY LADDER pays POL once per rung: 100 candy 0.1 POL, 250 0.25, 500 0.5, 1,000 1, 2,000 2 (Halloween 2026 badge at 500), paid from a season pool funded by a share of door ad spend and costume sales, only while the pool covers it; the game balance is sent to the member's InstantAdPay wallet on Polygon at 0.25 POL. COSTUMES bought with ad credits like Gem Kingdom Crowns: witch free, vampire 300 credits (longer trick timer), bedsheet ghost 300 (black cats ignore you), Lucky caramel apple 500 (+2 candy per treat); no cash value. Top 20 by candy on the season leaderboard. DOOR PACKS: creating a verified-visits campaign, the advertiser picks Everywhere (3 credits per visit, as before), Behind Spooky Doors (4 credits per door) or Golden Spooky Door (6 credits per door; the player gets +2 bonus candy). Paid up front like any visit pack. Door packs are served first on doors (Golden Doors before door packs), each player sees a pack at most once per Central day, they never run on the Earn tab or refuels during the season, and from Nov 1 any doors left run as normal visits; the campaign shows doors opened and unique players. Never promise earnings or call it income.
- GEM KINGDOM (LIVE in the Games tab since 2026-10-02): Gem Kingdom (https://gemkingdom.app) is a free fantasy match-3: match gems so three heroes battle monsters across six chapters (Goblin Woods, the Frozen Pass, the Haunted Swamp, Dragon's Peak, the Sunken Reef, the Shadow Citadel), earn stars, and rebuild your Stronghold and forge weapons. It pays POL for FIRST clears only (stages 0.02 to 0.15 POL rising by chapter; bosses 0.25, 0.5, 2, 5, 7.5 and 10 POL for the Goblin King, Ice Queen, Bog Witch, Ember Dragon, Kraken and Shadow King); replays pay nothing. The game balance is sent to the member's InstantAdPay wallet on Polygon at 0.25 POL. Rewards come from a pool funded by a share of Crown purchases and pay only while the pool has funds; never promise earnings or call it income. No referral bonus on game clears. Crowns, its upgrade currency, are bought with your InstantAdPay ad credits: tap Buy in the game's Crown Shop, confirm on InstantAdPay (top up with a pack if you are short), and you land back in the game with the Crowns added. Crowns buy buildings, weapons, battle boosts and a revive after a defeat. Sign in with your InstantAdPay account to save progress, earn badges and appear in the Game Achievements posts in the Crypto Team Build group. Never promise an amount beyond the posted rewards. (2026-10-03) FREE REVIVE: after a defeat, a short verified visit to a member's page (InstantAdPay verified-visit flow inside the game, shares the 20-a-day refuel allowance with Drip Runner) revives the party once per battle; a revived win earns at most 2 stars. SPECIALS in the Crown shop: Hero Bundle (one time, $5 = 500 credits: a tier-1 forge weapon, one building level, 60 Crowns), Kingdom Pass ($10 = 1,000 credits for 30 days: 10 Crowns a day credited on the first visit each Central day, a 25-Crown chest every 7 days, the three Royal hero looks; no auto-renew, buying again adds 30 days), Hero looks (cosmetic only: Halloween looks Pumpkin Knight, Moon Witch, Scarecrow Ranger for 40 Crowns each, sold through Oct 31 and kept forever; Royal looks with the Pass). Only the purchased-credit part of a purchase funds the POL reward pool.
- GAME POL TO ANY LINKED WALLET (2026-10-27, Marty): game POL (Drip Runner, Gem Kingdom, ClutterHunt, Spooky Doors, Road Agent, PolyBreak, SpellWheel, PolyWarriors) is paid to the wallet LINKED to the member's InstantAdPay account (one free signature on the Wallet tab, https://instantadpay.com/my#wallet). Activation is NOT needed: a linked wallet that has not switched on payouts (for example a holding-tank member waiting for a sponsor) is paid too. InstantAdPay hands the linked wallet to every game where the member has a balance (hourly, and on every sign-in to a game), and the game sends the POL on its own sweep once the balance reaches that game's payout line, including everything earned before the link. A game that already holds a different wallet keeps paying that one (it is never replaced automatically). Players with no linked wallet get at most three reminders ("X POL is waiting for your wallet": link your wallet, one free signature, and it's sent automatically, including everything you've earned so far), and in the games the reward screen says "Link your wallet to receive this POL" with the same link. Never tell a member to switch on payouts to get game POL.
- GAMES TAB (2026-10-01): Members > Games (/my#games) shows one card per network game (as of 2026-10-15: PolHunter, Drip Runner, Gem Kingdom, ClutterHunt, SpellWheel, PolyWarriors, PolyBreak, Road Agent, Spooky Doors during Halloween; all pay POL to the member's InstantAdPay wallet), with their own progress and a Play button that signs them in with one tap; new games appear there as they launch (PolHunter is one card). DRIP RUNNER (https://driprunner.app, LIVE for every member since 2026-10-01): tap-to-hop runner; gold drips, magenta bots, orange firewalls from chapter 2; each chapter has a drip goal for one run; the FIRST clear of a chapter pays a small POL drip (amount set by the admin, shown in the game) into the game balance, replays pay nothing; the balance is sent on Polygon to the member's InstantAdPay wallet once it reaches the payout line shown in the game. REFUELS: a run that ends can be refuelled with a verified visit to a member's page (a member video once every page has been visited), up to 20 a day, separate from the 20 Earn-tab visits; the advertiser is charged as for any visit, the player gets fuel not credits. The POL pool is funded ONLY by a share of refuel ad spend plus POL spent in the hangar, so drips depend on refuels and can be zero when the pool is empty; say so honestly. HANGAR: Drip Magnet and Courier Mk II cost drips (game currency); Shield Core and Slow Field cost POL from the game balance, which returns to the pool. GUESTS can try a run without signing in; their clears pay once they sign in. REFERRALS: each player's share link /r/<username>; when members whose InstantAdPay sponsor is that player refuel, a share (10 percent by default) of each refuel's pool income goes to the sponsor's game balance. Telegram posts achievement badges (chapters, unlocks, refuel milestones, payouts). Never promise amounts or income. The public list of every game, open now and opening next, is https://instantadpay.com/games (shareable; add ?ref=<username> to keep the referral).
- GAMES TAB (2026-10-01): Members > Games (/my#games) shows one card per network game (as of 2026-10-15: PolHunter, Drip Runner, Gem Kingdom, ClutterHunt, SpellWheel, PolyWarriors, PolyBreak, Road Agent, Spooky Doors during Halloween; all pay POL to the member's InstantAdPay wallet), with their own progress and a Play button that signs them in with one tap; new games appear there as they launch (PolHunter is one card). DRIP RUNNER (https://driprunner.app, LIVE for every member since 2026-10-01): tap-to-hop runner; gold drips, magenta bots, orange firewalls from chapter 2; each chapter has a drip goal for one run; the FIRST clear of a chapter pays a small POL drip (amount set by the admin, shown in the game) into the game balance, replays pay nothing; the balance is sent on Polygon to the member's InstantAdPay wallet once it reaches the payout line shown in the game. REFUELS: a run that ends can be refuelled with a verified visit to a member's page (once every page has been visited: a member video, a page seen more than 7 days ago again, or one of the network's own programs, so a game visit is never empty; since 2026-10-28 for every game's refuel, paddle, continue, hint and supply crate), up to 20 a day, separate from the 20 Earn-tab visits; the advertiser is charged as for any visit, the player gets fuel not credits. The POL pool is funded ONLY by a share of refuel ad spend plus POL spent in the hangar, so drips depend on refuels and can be zero when the pool is empty; say so honestly. HANGAR: Drip Magnet and Courier Mk II cost drips (game currency); Shield Core and Slow Field cost POL from the game balance, which returns to the pool. GUESTS can try a run without signing in; their clears pay once they sign in. REFERRALS: each player's share link /r/<username>; when members whose InstantAdPay sponsor is that player refuel, a share (10 percent by default) of each refuel's pool income goes to the sponsor's game balance. Telegram posts achievement badges (chapters, unlocks, refuel milestones, payouts). Never promise amounts or income. The public list of every game, open now and opening next, is https://instantadpay.com/games (shareable; add ?ref=<username> to keep the referral).
- Every purchase is split by an immutable smart contract in the same transaction: 50% direct sponsor, 20% level 2, 10% level 3, 20% platform. No withdrawals exist; money lands in members' own wallets instantly.
- Qualification: level 1 open to all; 2 buyers of $20+ unlock level 2; 5 unlock level 3. Unqualified shares pass up the sponsor line, checking up to 25 positions, else the platform receives them. Qualification cannot be bought and never expires.
- Every member gets a share link immediately (site code, /join/<code>); the contract locks a buyer to their sponsor at the buyer's FIRST purchase, so members should switch on payouts before their referrals buy.
@@ -398,15 +441,17 @@ async function answerRaw(message, historyText) {
try { hit = await kb.fastPath(msg); } catch (e) { kbOk = false; console.error('kb fast path', e.message); }
if (hit && hit.id === 'refuel' && !REFUEL_ON()) return { reply: REFUEL_OFF_ANSWER, canned: true, kb: hit.id };
if (hit && (hit.id === 'polminer' || hit.id === 'c-polminer') && !pmLive()) return { reply: POLMINER_SOON_ANSWER, canned: true, kb: hit.id };
if (hit && (hit.id === 'warpwares' || hit.id === 'c-warpwares') && !wwLive()) return { reply: wwAnswer(), canned: true, kb: hit.id };
if (hit && isBixId(hit.id) && !bixLive()) return { reply: BIX_SOON_ANSWER, canned: true, kb: hit.id };
if (hit && (hit.id === 'network-rate' || hit.id === 'c-network-rate') && SYN_N() !== 4) return { reply: netRateAnswer(SYN_N()), canned: true, kb: hit.id };
if (hit) return Object.assign({ reply: hit.answer, canned: true, kb: hit.id }, hit.handoff ? { handoff: true } : {});
if (!kbOk) for (const c of CANNED) if (c.re.test(msg)) return c.id === 'refuel' && !REFUEL_ON() ? { reply: REFUEL_OFF_ANSWER, canned: true } : c.id === 'polminer' && !pmLive() ? { reply: POLMINER_SOON_ANSWER, canned: true } : c.id === 'network-rate' && SYN_N() !== 4 ? { reply: netRateAnswer(SYN_N()), canned: true } : Object.assign({ reply: c.a, canned: true }, c.handoff ? { handoff: true } : {});
if (!kbOk) for (const c of CANNED) if (c.re.test(msg)) return c.id === 'refuel' && !REFUEL_ON() ? { reply: REFUEL_OFF_ANSWER, canned: true } : c.id === 'polminer' && !pmLive() ? { reply: POLMINER_SOON_ANSWER, canned: true } : c.id === 'warpwares' && !wwLive() ? { reply: wwAnswer(), canned: true } : isBixId(c.id) && !bixLive() ? { reply: BIX_SOON_ANSWER, canned: true } : c.id === 'network-rate' && SYN_N() !== 4 ? { reply: netRateAnswer(SYN_N()), canned: true } : Object.assign({ reply: c.a, canned: true }, c.handoff ? { handoff: true } : {});
// retrieval: the closest entries ride along in the system prompt (a short follow-up borrows words from the chat so far)
let kbBlock = '', kbIds = [];
try {
const query = msg.split(/\s+/).length < 4 && historyText ? msg + ' ' + String(historyText).slice(-200) : msg;
const hits = await kb.context(query, 5);
const hitsOk = pmLive() ? hits : hits.filter(h => !/^(c-)?polminer$/.test(String(h.entry && h.entry.id))); // not live yet: keep its answer out of the prompt
const hitsOk = hits.filter(h => (pmLive() || !/^(c-)?polminer$/.test(String(h.entry && h.entry.id))) && (wwLive() || !/^(c-)?warpwares$/.test(String(h.entry && h.entry.id))) && (bixLive() || !isBixId(h.entry && h.entry.id))); // not live yet: keep its answer out of the prompt
kbBlock = kb.promptBlock(hitsOk); kbIds = hitsOk.map(h => h.entry.id);
} catch (e) { console.error('kb search', e.message); }
if (!enabled()) return { reply: 'Good question. The quick answers I have cover packages, payouts, qualification, and joining; for anything deeper, the plain-language contract review at https://instantadpay.com/contract covers most of it, or tap "Send this to support" and Marty will answer.', handoff: true };
+2
View File
@@ -344,6 +344,8 @@ async function bootstrap() {
await alterSafe('ALTER TABLE accounts ADD COLUMN joined_via VARCHAR(20) NULL'); // ?v= angle the lead came in on
await alterSafe('ALTER TABLE accounts ADD COLUMN joined_ref VARCHAR(80) NULL'); // referring domain of the first join-page visit
await alterSafe('ALTER TABLE accounts ADD COLUMN wall_offers VARCHAR(2000) NULL'); // JSON [{title,bannerUrl,targetUrl}] for wall positions 2-3 (unlock at 2 / 5 qualifying buyers)
await alterSafe('ALTER TABLE accounts ADD COLUMN profile_quarantined TINYINT NOT NULL DEFAULT 0'); // 2026-10-30 link-farm rule: first profile save of a new free account carried a link (spamscan.js)
await alterSafe('ALTER TABLE accounts ADD COLUMN bix_partner_link VARCHAR(300) NULL'); // BixPay partner link (bixpay.js, 2026-10-29); column name checked against MySQL 8 reserved words
// help desk (2026-10-16, tickets.js): one shared desk for IAP and, later, LinkSpin; email_message_id threads inbound mail
await q(`CREATE TABLE IF NOT EXISTS tickets (
id INT AUTO_INCREMENT PRIMARY KEY,
+99
View File
@@ -0,0 +1,99 @@
# BixPay card integration (DRAFT for Marty, 2026-10-29)
Scope: InstantAdPay first, LinkSpin second, CTB when it launches. Nothing here is built yet.
## What we know about BIX (verified 2026-10-29)
- BIX = self-custody wallet + Visa card spent from USDT/USDC. Funding networks include Polygon, so a member can swap POL
to USDT in the BIX app and load the card with no bridge. No load fee; up to 3% per purchase, 1% FX.
- Cards: virtual $9.99, plastic $100, metal $250, gold $25,000. US = Visa Signature (29 states); elsewhere Visa Platinum.
- Partner plan: 50% of net fees and card sales -> 45% over 10 levels (15 / 10 / 2.5 x 8) + 5% pool.
- Partner link format: `https://bix.ibportal.io/auth/register?e=<43-char token>&a=1` (opaque token, not derivable from the
IB ID). The referral link (`&appId=3`) makes a card customer only; the PARTNER link makes a partner. We use the partner link.
- Company fallback link: Marty's partner link (IB12143793).
## 1. The profile field (one identity, follows the member)
- InstantAdPay Profile tab, new section **"BixPay card"**: one input, `bixPartnerLink`.
- Accepts a full partner link. Validation: host `bix.ibportal.io`, path `/auth/register`, `e=` present, `a=1`; strip `appId`
if pasted (the customer link) and tell the member "That's the card-customer link. Paste the Partner link from your BIX
portal profile instead." Max 300 chars. Saved on the IAP account; LinkSpin and CTB read it through the existing partner
API (the same way wallet and sponsor already flow), and LinkSpin's own Profile shows it read-only with "Edit on InstantAdPay".
- Member sees under the field: "Where to find it: BIX portal > Profile > Partner (the second box). Copy the link."
- Admin: the field shows on the member card; a count of members with a link set on the admin Overview.
## 2. The link each visitor gets (sponsor follows)
`bixLinkFor(member)` =
1. the member's own `bixPartnerLink`, else
2. walk the sponsor chain up to 10 levels, first sponsor with a link, else
3. the company link (site config `bixCompanyLink`, default Marty's partner link).
The card promo always shows WHOSE link is in play: "Your link" / "Your sponsor @name's link" / "Network link". That nudges
members to add their own, and sponsors to get their teams signed up.
For public pages (games' landing pages, /join/<user>), the referrer whose `?ref` is on the page resolves the same way.
## 3. Where members see it
### Wallet tab (primary)
Card: **"Spend your POL anywhere with a BixPay Visa card"**
"BixPay is a self-custody wallet with a Visa card. Send USDT or USDC to it on Polygon, load the card, and spend it wherever
Visa is accepted, including Apple Pay and Google Pay. Virtual cards from $9.99."
(No in-app swap: Marty confirmed 2026-10-29 he swaps POL to USDT/USDC on an exchange, then sends it to BixPay. The guide
gets a "turn your POL into USDT" step: any exchange or on-ramp, then send on Polygon. Add the swap line only once BIX
ships it; the founder said "in the next three months" on 10-17.)
Buttons: **Get your BixPay card** (partner link) · **How it works** (opens the guide).
Small line: "Using: your link / @sponsor's link / the network link. Add yours in Profile."
### Overview
A one-line announcement card the first week ("New: a Visa card for your POL"), dismissable like the other cards.
### Payout emails + game "link your wallet" nudges
One sentence after the amount: "Want to spend it? A BixPay Visa card turns POL into everyday purchases: <link>."
(Payout emails already carry the member's identity, so the link resolves per member.)
### Promo tools > new tab "BixPay"
- The member's link with Copy/Share.
- 3 posts (short, friendly, the "spend your crypto" angle), an email swipe, and 4 banners we make (no BIX logo until
Marty confirms brand rules; text-only "crypto Visa card" creative is safe).
- Every asset carries the member's resolved link.
### Guide page /bixpay (public, SEO)
What it is, the fee table, the funding path (POL -> USDT on Polygon -> card), the sign-up steps with screenshots, the
partner plan in plain words, and the compliance box. CTA carries the viewer's resolved link.
### Chatbot
Canned answers: what BixPay is, how to get the card, how to load it from POL, where to put my partner link, who gets the
credit. Facts in the system prompt with KNOWLEDGE_DATE.
## 4. Copy (Marty's voice, no em dashes)
- Wallet card title: "Spend your POL anywhere with a BixPay Visa card"
- Body: see above.
- Profile field label: "Your BixPay partner link"
- Profile help: "Join BixPay as a partner, then paste your Partner link here. Members and visitors who get a card through
your pages are credited to you in your BIX portal, up to ten levels deep."
- Email line: "Want to spend it? A BixPay Visa card turns POL into everyday purchases."
- Post 1 (short): "I spend my crypto with a Visa card now. BixPay keeps the keys with you, loads from USDT or USDC with no
load fee, and works with Apple Pay. Virtual card from $9.99: {L}"
- Fees line everywhere: "3% per purchase, no load fee. See BIX's terms for other charges."
- US line on the Wallet card and guide: "Available in 31 US states so far. Not in your state yet? You can still get the
wallet and build."
- Guide: a "Funding your card" section with three paths: (1) swap POL to USDT or USDC on any exchange, send on Polygon;
(2) Cash App (US): send crypto straight to the BixPay wallet; (3) the BIX in-app swap, once it ships.
- Post 2 (friendly): "Earning crypto is one thing. Spending it without jumping through hoops is another. BixPay fixed that
for me: a self-custody wallet and a Visa card in one app. Here's where I got mine: {L}"
- Post 3 (partner angle): "BixPay pays partners on every card and on card spending, ten levels deep. If you're building a
team anyway, this fits right in: {L}"
## 5. Compliance box (shown on the Wallet card's "How it works" and the guide)
"BixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees,
limits, eligibility and terms. InstantAdPay is not the card issuer and earns a referral commission when you sign up
through a partner link. Card availability varies by country. Crypto assets can lose value."
## 6. Tracking
- Click counts per surface (wallet card, email, promo tools, guide) in the admin Traffic tab; per-member click counts on
the Promo tools BixPay tab. No sign-up credit on our side: the BIX portal shows each partner their directs and levels.
- If BIX ever offers a postback, add a "BixPay sign-ups" stat next to the click counts.
## 7. Rollout
1. IAP: field + resolver + Wallet card + guide + chatbot + promo tab (gated by site config `bixpayLive`).
2. LinkSpin: read-only field + Wallet/Credits card + promo entry, same resolver through the partner API.
3. CTB: same card and field in ctb-next, same identity.
4. Announcement (release note + member email + Telegram) after Marty's copy approval.
## Open questions for Marty / BIX upline
- Does a partner sign-up also get the card, or does the member need the app invitation too? (If both: show "Join as a
partner" and "Just want the card?" buttons, each with the member's own link type.)
- BIX name/logo use in our promo material.
- The pool's "50/50 rule".
- Any updated BIX materials.
+38
View File
@@ -0,0 +1,38 @@
# BixPay opportunity call, 2026-10-17 (Zoom replay notes, made 2026-10-29)
"$iNVU - Live Opportunity Call", 47 min. Host "Bass"; main speaker David Emenite (22-year network marketer; his own company
is a trading opportunity, "tap to trade"); BIX founder "Nick" (28, Germany, says he owns "one of the largest Forex brokers
on the planet"; BIX started "a couple of months ago"); leaders Tracy Fischer, Lisa, Alan Jones, Gary. The $iNVU / trading
company parts are NOT BIX. Transcript: D:/tmp/bix-zoom/transcript.txt; slides D:/tmp/bix-zoom/frames.
## Plan mechanics (as presented; matches the BIX commission PDF)
- The only fee claimed: 3% per transaction. "No top-up fees, no hidden fees." (A third-party review lists 1% FX, $0.75
under $50, ATM $1 + 0.6%, so present 3% as THE fee and point to BIX's terms for the rest.)
- 50% of the 3% goes into the plan; paid over 10 levels: L1 15%, L2 10%, L3-L10 2.5% each; the other 5% = BIX pool,
1 share per 10,000 cards in your network. Worked example: $1,000 spent -> $30 fee -> $15 into the plan.
- Card sales pay too: slide "EARN A 50% REFERRAL BONUS ON EVERY CARD PURCHASE" (virtual $9.99, plastic $100, metal $250,
24K gold $25,000; shipping to 179 countries). The optional $9.99/month rewards membership is also commissionable.
- Upcoming banking (SEPA IBAN, ACH, SWIFT, fiat on/off-ramp): instant 0%, SEPA/ACH 1%, "up to 50% included in the
compensation plan". Nick: IBANs and the in-app SWAP "in the next three months", i.e. NOT live on 10-17.
- Shareholder: 500,000 cards in your network "on a 50/50 rule" = shareholder of BIX (Nick). Network contest: first to
10,000 cards gets a $100,000 bonus. The 50/50 rule is still not defined on the call.
- US: "open in 31 states" (review on 10-24: 29), rest "first part of 2027". Wallet works everywhere; you can build from a
closed state. KYC required for the card; problems go to BIX support.
- Funding tip (Tracy/Bass): Cash App can send crypto straight to the BixPay wallet (about 20 transactions a month, up to
$5,000 a week); they used Coinbase before. Card works in Apple Wallet.
- Usage data quoted: average customer spends $1,400-1,500 a month (industry figure); Bass's back office shows $20-80 a
week per user so far.
## Claims to treat as marketing, not facts
300,000 downloads / 300,000 cards active, $3M spent per day, live since August with global launch ~6 weeks before the
call, "5 million users in one year, 80 million in three, bigger than Revolut", "worth a couple hundred million, $100B in
three years", "$1 to $1 million per day" spend limit, $2.6T daily payments, founder "a billionaire".
## What it changes in our integration draft (BIXPAY-INTEGRATION.md)
1. Don't promise an in-app swap yet. Copy becomes "load it with USDT or USDC on Polygon" until Marty confirms Swap works
in his app; add a short "how to turn POL into USDT" step (any exchange or the BIX swap once live).
2. Fees line: "3% per purchase, no load fee; see BIX's terms for other charges."
3. Lead with the $9.99 virtual card: it pays the referrer on the sale and on every swipe after.
4. US members: add "available in 31 states; not in your state yet? You can still build and get the wallet."
5. Add the Cash App funding path to the guide for non-crypto members (US).
6. Events in the call (Houston 10-20, Tampa 10-21, Bangkok 11-28) are the leaders' own, not ours.
+2 -2
View File
@@ -112,12 +112,12 @@ async function tick() {
if (wd === 'Thu' && h >= 18 && next && !S.sent['thu:' + next] && await claimOnce('fri:thu:' + next)) {
S.sent['thu:' + next] = now; save();
const subject = 'Tomorrow is Five Dollar Friday';
const text = 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
const text = 'Tomorrow is Five Dollar Friday on InstantAdPay.\n\nAny ad package of $5 or more bought on Friday (Central time) earns +' + c.pct + '% bonus credits, added the moment the purchase settles. Your $5 pays your sponsor line the second it clears, and your line’s $5s pay you. Friday is when we all push at once.\n\nGame Pass too: the same Friday purchase gives you a free 7-day Game Pass for every game in the network (once per Friday, added automatically), and the $5 pack lands as 600 credits that you keep for your ads.\n\nLine up your pack: https://instantadpay.com/my#buy\nWatch the wave on the live ledger: https://instantadpay.com/ledger';
await broadcast(subject, text);
}
if (wd === 'Fri' && h >= c.kickHour && day >= c.start && !S.sent['kick:' + day] && await claimOnce('fri:kick:' + day)) {
S.sent['kick:' + day] = now; save();
X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
X.telegram('\u{1F4B5} <b>It’s Five Dollar Friday.</b> Any ad package from $5 up earns <b>+' + c.pct + '% credits</b> today, and every pack pays its sponsor line in the same transaction. Game Pass day too: the same purchase gives you a free 7-day Game Pass for every game (once per Friday, automatic), and the $5 pack lands as 600 credits you keep for ads. Buy yours, then watch the ledger fill up: https://instantadpay.com/my#buy').catch(() => {});
}
if (wd === 'Sat' && h < 3) {
const fri = dayOf(now - 86400000);
+2 -2
View File
@@ -36,8 +36,8 @@ const fs = require('fs');
const path = require('path');
const TZ = 'America/Chicago';
const GAMES = ['polhunter', 'gemkingdom', 'spellwheel', 'spookydoors', 'polywarriors', 'clutterhunt', 'polybreak', 'driprunner', 'roadagent', 'shardsofvalor', 'polminer'];
const NAMES = { polhunter: 'PolHunter', gemkingdom: 'Gem Kingdom', spellwheel: 'SpellWheel', spookydoors: 'Spooky Doors', polywarriors: 'PolyWarriors', clutterhunt: 'ClutterHunt', polybreak: 'PolyBreak', driprunner: 'Drip Runner', roadagent: 'Road Agent', shardsofvalor: 'Shards of Valor', polminer: 'POL Miner' };
const GAMES = ['polhunter', 'gemkingdom', 'spellwheel', 'spookydoors', 'polywarriors', 'clutterhunt', 'polybreak', 'driprunner', 'roadagent', 'shardsofvalor', 'polminer', 'warpwares'];
const NAMES = { polhunter: 'PolHunter', gemkingdom: 'Gem Kingdom', spellwheel: 'SpellWheel', spookydoors: 'Spooky Doors', polywarriors: 'PolyWarriors', clutterhunt: 'ClutterHunt', polybreak: 'PolyBreak', driprunner: 'Drip Runner', roadagent: 'Road Agent', shardsofvalor: 'Shards of Valor', polminer: 'POL Miner', warpwares: 'Warp & Wares' };
const SHARES = [0.5, 0.3, 0.2]; // tournament prize split, places 1-3
const KEEP_DAYS = 90; // answered refs and day rows are kept this long (idempotency window)
// THE pass table (2026-10-22, Dallas's structure, Marty approved): lowest to highest, a higher tier includes everything below.
+1 -1
View File
@@ -10,7 +10,7 @@ const fs = require('fs');
const path = require('path');
let R = null;
const NAMES = { spookydoors: 'Spooky Doors', gemkingdom: 'Gem Kingdom', clutterhunt: 'ClutterHunt', driprunner: 'Drip Runner', polywarriors: 'PolyWarriors', spellwheel: 'SpellWheel', roadagent: 'Road Agent', polhunter: 'PolHunter', passivedrip: 'PassiveDrip', polybreak: 'PolyBreak', polminer: 'POL Miner', shardsofvalor: 'Shards of Valor' };
const NAMES = { spookydoors: 'Spooky Doors', gemkingdom: 'Gem Kingdom', clutterhunt: 'ClutterHunt', driprunner: 'Drip Runner', polywarriors: 'PolyWarriors', spellwheel: 'SpellWheel', roadagent: 'Road Agent', polhunter: 'PolHunter', passivedrip: 'PassiveDrip', polybreak: 'PolyBreak', polminer: 'POL Miner', warpwares: 'Warp & Wares', shardsofvalor: 'Shards of Valor' };
const wallets = () => Object.fromEntries(String(process.env.GAME_WALLETS || '').split(',').map(x => x.trim()).filter(Boolean).map(x => { const [k, a] = x.split(':'); return [String(k).toLowerCase(), String(a || '').toLowerCase()]; }).filter(([k, a]) => k && /^0x[0-9a-f]{40}$/.test(a)));
const KEY = () => String(process.env.ETHERSCAN_KEY || '').trim();
// money never flows to these from a game wallet as a payout: Marty's fee wallets, the other game wallets
+5 -2
View File
@@ -25,6 +25,7 @@
// hides someone adopted on LinkSpin and the two-adoptions limit counts both sites.
'use strict';
const SF = require('./sponsorfollow');
const prohibited = require('./prohibited'); // 2026-10-30: policy applied on ingest
const fs = require('fs');
const path = require('path');
@@ -98,8 +99,10 @@ async function fill(a, r, sum) {
}
if (r.profile && A.setProfile) { // same rules as LinkSpin's side: https only, known socials, fills only what is empty
const pf = r.profile, ok = v => /^https:[/][/][^ ]+$/i.test(v) && v.length <= 300;
const av = String(pf.avatarUrl || '').trim(); const bio = String(pf.bio || '').trim().slice(0, 600); let soc = null;
if (pf.socials && typeof pf.socials === 'object') { const c = {}; for (const k of ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video']) { const v = String(pf.socials[k] || '').trim(); if (ok(v)) c[k] = v; } if (Object.keys(c).length) soc = JSON.stringify(c); }
// prohibited-content policy on ingest (2026-10-30): a bio with a link or a prohibited term, or a social carrying one, is dropped, not stored
const cp = prohibited.cleanProfile(pf, 'InstantAdPay'); if (cp.dropped.length) console.log('lsinbound profile dropped', String(a.email).replace(/^(.).*(@.*)$/, '$1***$2'), cp.dropped.join(','));
const av = String(pf.avatarUrl || '').trim(); const bio = cp.bio || ''; let soc = null;
if (cp.socials) { const c = {}; for (const k of ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video']) { const v = String(cp.socials[k] || '').trim(); if (ok(v)) c[k] = v; } if (Object.keys(c).length) soc = JSON.stringify(c); }
const upd = [!a.avatarUrl && ok(av) ? av : undefined, !a.bio && bio ? bio : undefined, !a.socials && soc ? soc : undefined];
if (upd.some(v => v !== undefined)) { const x = await A.setProfile(a.email, upd[0], upd[1], upd[2]); if (!(x && x.error)) { sum.filled++; wrote = true; } }
}
+15 -5
View File
@@ -14,6 +14,7 @@
'use strict';
const crypto = require('crypto');
const SF = require('./sponsorfollow');
const prohibited = require('./prohibited'); // 2026-10-30: a profile that fails the policy never leaves this site
const fs = require('fs');
const path = require('path');
@@ -41,12 +42,19 @@ const carriesNew = r => !!(r.sponsorSetBy || r.tank);
// absolute https URL so the other property can show it; socials as the parsed {platform: url} object.
const PUBLIC = () => String(process.env.PUBLIC_URL || 'https://instantadpay.com').replace(/\/+$/, '');
function profileOf(a) {
let socials = null; try { socials = a.socials ? (typeof a.socials === 'string' ? JSON.parse(a.socials) : a.socials) : null; } catch (e) { socials = null; }
if (a.profileQuarantined) return null; // quarantined (link planted on a brand-new free account): stays here, unseen, until Marty decides
const cp = prohibited.cleanProfile({ avatarUrl: a.avatarUrl, bio: a.bio, socials: a.socials }, 'InstantAdPay'); // policy applied on the way out too
const socials = cp.socials;
const av = String(a.avatarUrl || '').trim();
const avatarUrl = !av ? null : /^https:\/\//i.test(av) ? av : av.startsWith('/') ? PUBLIC() + av : null;
const bio = String(a.bio || '').trim().slice(0, 600) || null;
if (!avatarUrl && !bio && !(socials && Object.keys(socials).length)) return null;
return { avatarUrl, bio, socials: socials && Object.keys(socials).length ? socials : null };
const bio = cp.bio;
// the BixPay partner link travels too (2026-10-29): LinkSpin shows it read-only ("Edit on InstantAdPay") and resolves the
// same way; only set when there is one, so rows without it keep the hash they had
const bixPartnerLink = String(a.bixPartnerLink || '').trim() || null;
if (!avatarUrl && !bio && !bixPartnerLink && !(socials && Object.keys(socials).length)) return null;
const out = { avatarUrl, bio, socials: socials && Object.keys(socials).length ? socials : null };
if (bixPartnerLink) out.bixPartnerLink = bixPartnerLink;
return out;
}
const hashOf = r => crypto.createHash('sha1').update([r.username || '', r.wallet || '', r.sponsorEmail || '', r.joinedAt || '', r.memberId || '', r.profile ? JSON.stringify(r.profile) : ''].join('|') + SF.hashExtra(r)).digest('hex').slice(0, 16);
@@ -104,5 +112,7 @@ async function release(email, sent) {
if (pending.has(e) && !timer) { pending.delete(e); touch(e); } // a touch that queued while muted goes now (the hash check drops it when same)
return same;
}
// does LinkSpin know this email? (its row was pushed and recorded) - used by the link-farm admin list, never for a cascade
function knows(email) { const st = load(); return Object.prototype.hasOwnProperty.call(st.hashes || {}, String(email || '').toLowerCase()); }
function adminView() { const st = load(); return { on: on(), url: URL_(), tracked: Object.keys(st.hashes).length, pushed: st.pushed, last: st.last, errors: st.errors, pendingTouches: pending.size }; }
module.exports = { init, touch, tick, adminView, on, mute, release };
module.exports = { init, touch, tick, adminView, on, mute, release, knows };
+108
View File
@@ -0,0 +1,108 @@
// Prohibited-content policy, one module shared by InstantAdPay and LinkSpin (keep the two copies identical).
// 2026-10-30: an SEO backlink farm opened 106 free accounts, each with a casino or local-business bio and a
// website link, and Google indexed that text under our domains through the public walls. Rules (Marty):
// - profile fields are not a free backlink: a bio may not carry a URL or a domain-looking token;
// - gambling, adult, pharma, weapons and link-selling terms are refused in every member-set text field
// (bio, social links, line banner, wall offers, campaign names, headlines, copy and target URLs);
// - case-insensitive and Unicode aware (NFC, lower-cased, letter/number boundaries, so "Essex" never hits "sex").
// Pure functions, no state, no dependencies.
'use strict';
// One entry per term or phrase; spaces match any run of whitespace. Grouped for the Terms page and the admin.
const LIST = {
gambling: ['casino', 'casinos', 'cassino', 'cassinos', 'slots', 'slot gacor', 'betting', 'sportsbook', 'sportsbooks', 'bookmaker', 'bookmakers', 'bookie',
'lottery', 'lotteries', 'lotto', 'poker', 'baccarat', 'roulette', 'blackjack', 'jackpot', 'togel', 'judi', 'judi online', 'apostas', 'apuestas',
'nổ hũ', 'cá cược', 'đổi thưởng', 'xổ số', 'kèo', 'nhà cái', 'soi kèo', 'game bài', 'tài xỉu', 'bắn cá'],
adult: ['porn', 'porno', 'pornography', 'sex', 'sexy', 'escort', 'escorts', 'erotic', 'erotica', 'xxx', 'onlyfans', 'nude', 'nudes', 'hentai', 'cam girl', 'cam girls', 'sex cam', 'hookup', 'hookups'],
pharma: ['viagra', 'cialis', 'levitra', 'pharmacy', 'pharmacies', 'prescription', 'prescriptions', 'steroids', 'anabolic', 'cannabis', 'marijuana', 'weed', 'cbd', 'kratom', 'opioid', 'opioids',
'xanax', 'adderall', 'tramadol', 'oxycodone', 'ketamine', 'cocaine', 'mdma', 'psilocybin', 'vape', 'vaping'],
weapons: ['firearm', 'firearms', 'guns', 'gun shop', 'gun store', 'ammunition', 'ammo', 'rifle', 'rifles', 'pistol', 'pistols', 'handgun', 'handguns', 'silencer', 'suppressor', 'explosives'],
linkfarm: ['backlink', 'backlinks', 'seo service', 'seo services', 'seo agency', 'link building', 'link-building', 'guest post', 'guest posts', 'guest posting', 'pbn', 'buy links', 'sell links', 'dofollow']
};
const ALL = Object.values(LIST).reduce((a, b) => a.concat(b), []);
const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const ZW = /[​-‏⁠]/g; // zero-width joiners hide nothing
const strip = s => String(s == null ? '' : s).normalize('NFC').replace(ZW, '');
const norm = s => strip(s).toLowerCase();
// Boundary = anything that is not a letter or a number (works for every script, unlike \b).
const TERM_RE = new RegExp('(?<![\\p{L}\\p{N}])(?:' + ALL.map(t => esc(norm(t)).replace(/\s+/g, '\\s+')).join('|') + ')(?![\\p{L}\\p{N}])', 'u');
// Common gTLDs plus the ccTLDs link farms actually use. A short two-letter list keeps "Mr.Li" style text out of it.
const TLDS = 'com|net|org|info|biz|io|co|app|xyz|me|tv|us|uk|vn|de|fr|ru|in|id|br|es|it|nl|ca|au|eu|ch|at|be|pt|pl|cz|se|no|fi|dk|ie|nz|za|ng|ke|eg|tr|ua|il|ae|sa|pk|bd|lk|np|kh|la|mm|my|sg|ph|th|jp|kr|cn|tw|hk|mx|ar|cl|pe|to|ly|cc|gg|ai|pw|ws|tk|ml|ga|cf|gq|su|'
+ 'site|online|store|shop|club|top|pro|live|link|page|dev|fun|vip|one|tech|space|website|cloud|digital|agency|company|email|news|blog|life|world|today|zone|guru|ninja|game|games|team|network|money|cash|gold|bid|trade|win|bet|casino|poker|mobi|name|tel|travel|jobs|pics|photo|video|press|media|art|design|studio|capital|finance|exchange|solutions|services|systems|tools|works|center|group|global|international|institute|academy|school|education|university|church|community|social|chat|dating|love|wiki|review|reviews|directory|guide|help|support|rocks|ventures|holdings|partners|limited|ltd|llc|inc|asia|africa|london|nyc|tokyo|berlin|paris|best|buzz|click|host|hosting|lol|monster|wtf|ooo|icu|sbs|cfd|cyou|rest|bar|cam|surf|run|fit|health|care|dog|cat|pet|pets|wine|beer|vodka|bio|eco|green|energy|solar|car|cars|auto|bike|tires|taxi|limo|rent|rentals|house|homes|realty|estate|land|city|town|place|map|earth|fund|loans|credit|insure|legal|law|lawyer|attorney|tax|accountant|consulting|marketing|promo|sale|deals|discount|coupons|gift|gifts|toys|baby|kids|mom|family|wedding|party|events|tickets|show|theater|film|movie|music|band|dance|yoga|golf|football|soccer|hockey|tennis|racing';
// Schemes and www. are matched in any case; a bare domain token (or an email address) only with its TLD in lower case, so a
// missed space after a period ("ads.One day") is not mistaken for a link while real spam domains (typed lower case) are caught.
const SCHEME_RE = /(?:https?:\/\/|ftp:\/\/|(?<![\p{L}\p{N}])www\.)/iu;
const DOMAIN_RE = new RegExp('(?<![\\p{L}\\p{N}])[\\p{L}\\p{N}-]{1,63}(?:\\.[\\p{L}\\p{N}-]{1,63})*\\.(?:' + TLDS + ')(?![\\p{L}\\p{N}])', 'u');
// The matching prohibited term, or null.
function match(text) { const m = TERM_RE.exec(norm(text)); return m ? m[0].replace(/\s+/g, ' ') : null; }
// True when the text carries a URL or a domain-looking token (http(s)://, www., word.tld).
function hasUrl(text) { const t = strip(text); return SCHEME_RE.test(t) || DOMAIN_RE.test(t); }
const BIO_LINK_MSG = 'Links go in the social fields, not the bio.';
const blockedMsg = site => 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' profiles (see Terms).';
const blockedAdMsg = site => 'That content is not allowed on ' + (site || 'InstantAdPay/LinkSpin') + ' (see Terms, Prohibited content).';
// Bio rule: no links, no prohibited terms. Returns { ok: true } or { error, reason }.
function checkBio(bio, site) {
const t = String(bio || '');
if (!t.trim()) return { ok: true };
if (hasUrl(t)) return { error: BIO_LINK_MSG, reason: 'url' };
const term = match(t);
if (term) return { error: blockedMsg(site), reason: 'term:' + term };
return { ok: true };
}
// Any other member-set text (social URL, banner target, campaign name, headline, copy): prohibited terms only.
// Pass profile: true for profile fields (the message names profiles), else the ad message is used.
function checkText(text, site, opts) {
const term = match(text);
if (!term) return { ok: true };
return { error: (opts && opts.profile) ? blockedMsg(site) : blockedAdMsg(site), reason: 'term:' + term };
}
// Several fields at once: { name: value, ... } -> first failure, with the field named in `field`.
function checkFields(fields, site, opts) {
for (const k of Object.keys(fields || {})) {
const v = fields[k]; if (v == null || v === '') continue;
const r = checkText(Array.isArray(v) ? v.join(' ') : String(v), site, opts);
if (r.error) return Object.assign({ field: k }, r);
}
return { ok: true };
}
// Profile ingest (registry sync from the other property, or a saved profile replayed): the parts of a profile that may be
// stored. A bio with a link or a prohibited term is dropped (null); a social URL carrying a prohibited term is dropped.
function cleanProfile(pf, site) {
const out = { avatarUrl: null, bio: null, socials: null, dropped: [] };
if (!pf || typeof pf !== 'object') return out;
const av = String(pf.avatarUrl || '').trim(); if (/^https:\/\/[^\s]+$/i.test(av) && av.length <= 300) out.avatarUrl = av;
const bio = String(pf.bio || '').trim().slice(0, 600);
if (bio) { const r = checkBio(bio, site); if (r.ok) out.bio = bio; else out.dropped.push('bio:' + r.reason); }
const src = pf.socials && typeof pf.socials === 'object' ? pf.socials : (typeof pf.socials === 'string' ? safeJson(pf.socials) : null);
if (src) {
const c = {};
for (const k of Object.keys(src)) {
const v = String(src[k] || '').trim(); if (!v) continue;
const r = checkText(v, site, { profile: true }); if (r.ok) c[k] = v; else out.dropped.push('socials.' + k + ':' + r.reason);
}
if (Object.keys(c).length) out.socials = c;
}
return out;
}
function safeJson(s) { try { const o = JSON.parse(s); return o && typeof o === 'object' ? o : null; } catch (e) { return null; } }
// Terms-page wording, one line per group (kept here so both sites say the same thing).
const POLICY = [
'gambling, casinos, betting, lotteries and sweepstakes',
'adult or sexual content',
'drugs and prescription pharmaceuticals',
'weapons',
'hate or harassment',
'malware, phishing and counterfeit goods',
'misleading financial promises',
'accounts created to place links in profile fields (link farming), which are removed without notice together with their profile text'
];
// One log line per refusal, with the email masked (never the text itself at full length).
function logRefusal(where, email, r) {
try { console.log('prohibited-content refused', where, String(email || '-').replace(/^(.).*(@.*)$/, '$1***$2'), r && r.field ? 'field=' + r.field : '', r && r.reason ? r.reason : ''); } catch (e) {}
}
module.exports = { LIST, ALL, POLICY, match, hasUrl, checkBio, checkText, checkFields, cleanProfile, logRefusal, BIO_LINK_MSG, blockedMsg, blockedAdMsg };
+11 -1
View File
@@ -141,6 +141,7 @@
<div class="statx c-violet"><div><div class="nv" id="ovActive">0</div><div class="lb">Active campaigns</div><span class="chip flat" id="ovCampSub"></span></div></div>
<div class="statx c-amber"><div><div class="nv" id="ovReports">0</div><div class="lb">Open reports</div><span class="chip flat" id="ovBurnSub"></span></div></div>
<div class="statx"><div><div class="nv" id="ovDrips">0</div><div class="lb">Follow-ups in flight</div><span class="chip flat" id="ovDripSub"></span></div></div>
<div class="statx c-cyan"><div><div class="nv" id="ovBix">0</div><div class="lb">BixPay partner links</div><span class="chip flat" id="ovBixSub"></span></div></div>
</div>
<div class="grid c2" style="margin-top:16px">
<div class="card">
@@ -292,6 +293,12 @@
<p class="small muted">Sponsor = the token the account joined under (username, share code, or member #). Editing it re-points free referrals and future purchases. On-chain sponsorship is permanent once activated.</p>
<div class="tablewrap"><table class="adm-table" id="memTable"></table></div>
</div>
<div class="card" id="spamCard">
<div class="card-head"><h3>Link-farm list</h3><span class="sub" id="spamSub">daily scan at 06:30 Central</span></div>
<p class="small muted">Free accounts (no package, no wallet) that carry a link plus a farm signal: a prohibited term in the profile, a sign-in that ended within 15 minutes of the sign-up, or no sponsor. Nothing is deleted on its own. Delete uses the normal member delete (on-chain members are refused) and never touches LinkSpin; the "also on LinkSpin" column is there so you can decide. Allow keeps an email off this list for good.</p>
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:0 0 10px"><button class="btn small" id="spamRun" type="button">Scan now</button><button class="btn small sec" id="spamDelete" type="button">Delete selected</button><span class="small muted" id="spamAllow"></span></p>
<div class="tablewrap"><table class="adm-table" id="spamTable"></table></div>
</div>
</div>
<div class="pane" id="pane-support" hidden>
@@ -357,6 +364,9 @@
<div class="pane" id="pane-traffic" hidden>
<div class="card"><div class="card-head"><h3>Games to members</h3><span class="sub" id="stSub">the $5 welcome offer after a game win</span></div><div class="tablewrap"><table class="adm-table" id="trfStarter"></table></div></div>
<div class="card"><div class="card-head"><h3>Login-ad showings</h3><span class="sub" id="lsSub">sign-in interstitials per day, dashboard vs games</span></div><div class="tablewrap"><table class="adm-table" id="trfLogin"></table></div></div>
<div class="card" id="trfBixCard"><div class="card-head"><h3>BixPay clicks</h3><span class="sub" id="bixSub">taps on "Get your BixPay card" by surface (the range picked below)</span></div>
<p class="muted small" style="margin:0 0 10px">Every BixPay button and banner goes through /go/bixpay, which counts the tap and opens the member's resolved partner link (own, else a sponsor's, else the network link). Sign-ups are not counted here: the BIX portal shows each partner their directs and levels.</p>
<div class="grid c2"><div class="tablewrap"><table class="adm-table" id="trfBix"></table></div><div class="tablewrap"><table class="adm-table" id="trfBixMembers"></table></div></div></div>
<div class="card">
<div class="card-head"><h3>Where visitors come from</h3><span class="sub" id="trfSub"></span></div>
<div class="chips" id="trfRange" style="margin:0 0 10px"><button type="button" class="chip-t" data-days="7">7 days</button><button type="button" class="chip-t on" data-days="30">30 days</button><button type="button" class="chip-t" data-days="90">90 days</button><button type="button" class="chip-t" data-days="365">Year</button></div>
@@ -641,6 +651,6 @@
<script src="/assets/common.js?v=20261023ov"></script><script src="/assets/welcome.js?v=20260923b"></script>
<script src="/assets/admin-kb.js?v=20261020kb"></script>
<script src="/assets/admin.js?v=20261027nr"></script><script src="/assets/admin-sponsorcheck.js?v=20261022sc"></script><script src="/assets/admin-kits.js?v=20261024kit"></script>
<script src="/assets/admin.js?v=20261030pp"></script><script src="/assets/admin-sponsorcheck.js?v=20261022sc"></script><script src="/assets/admin-kits.js?v=20261024kit"></script>
</body>
</html>
+35 -1
View File
@@ -91,6 +91,7 @@
const f = o.followups || {};
$('ovDrips').textContent = f.active || 0;
$('ovDripSub').textContent = (f.done || 0) + ' finished · ' + (f.unsubscribed || 0) + ' unsubscribed';
if ($('ovBix')) { $('ovBix').textContent = Number(o.bixLinks || 0).toLocaleString(); $('ovBixSub').textContent = o.bixpayLive ? 'members with their own link · live' : 'members with their own link · bixpayLive is off'; } // BixPay (2026-10-29)
const bt = Object.entries(o.byType || {}).sort((a, b) => b[1] - a[1]);
$('ovByType').innerHTML = bt.length ? bt.map(([t, n]) => '<div style="display:flex;justify-content:space-between;padding:4px 0;border-bottom:1px solid var(--line)"><span>' + esc(t) + '</span><b>' + n + '</b></div>').join('') : 'No campaigns yet.';
const ch = o.chain || {};
@@ -305,6 +306,7 @@
} catch (e) {}
}
async function loadMembers() {
loadSpamScan().catch(() => {});
loadTank(); loadFraud();
const r = await api('/api/admin/members');
allMembers = r.members || [];
@@ -323,6 +325,31 @@
+ '<td class="act"><button class="btn small sec" data-mcopen="' + esc(a.email) + '">Open</button> <button class="btn small sec" data-susp="' + esc(a.email) + '" data-on="' + (a.suspended ? '1' : '0') + '">' + (a.suspended ? 'Unsuspend' : 'Suspend') + '</button> <button class="btn small sec" data-spon="' + esc(a.email) + '" data-cur="' + esc(a.sponsorRef || '') + '">Sponsor</button></td></tr>').join('');
}
$('memFilter').addEventListener('input', drawMembers);
// Link-farm list (2026-10-30): the daily scan's candidates; Delete selected = one DELETE /api/admin/member per email (on-chain refused); Allow = spamScanAllow
async function loadSpamScan() {
let v; try { v = await api('/api/admin/spamscan'); } catch (e) { return; }
const last = v.last || {}; const rows = last.candidates || [];
$('spamSub').textContent = last.at ? (rows.length + ' candidate' + (rows.length === 1 ? '' : 's') + ' \u00B7 scanned ' + when(last.at) + (last.manual ? ' (manual)' : '') + ' \u00B7 ' + (last.scanned || 0) + ' accounts, ' + (last.skipped || 0) + ' allowlisted') : 'no scan yet (daily at 06:30 Central)';
$('spamAllow').textContent = 'Allowlist: ' + ((v.allow || []).join(', ') || 'empty');
$('spamTable').innerHTML = '<tr><th></th><th>Account</th><th>Joined</th><th>Sponsor</th><th>First link</th><th>Why</th><th>Also on ' + esc(v.otherSite || 'the other site') + '</th><th></th></tr>'
+ (rows.length ? rows.map(c => '<tr><td><input type="checkbox" data-spamsel="' + esc(c.email) + '"></td><td>' + (c.username ? '<b>@' + esc(c.username) + '</b><br>' : '') + '<span class="small">' + esc(c.email) + '</span>' + (c.quarantined ? ' <span class="badge amber">quarantined</span>' : '') + '</td>'
+ '<td class="small muted when">' + when(c.created) + '</td><td class="small">' + esc(c.sponsorName || 'none') + '</td><td class="small mono" style="max-width:260px;overflow:hidden;text-overflow:ellipsis" title="' + esc((c.links || []).join(' ')) + '">' + esc(c.firstLink || '') + '</td>'
+ '<td class="small">' + esc((c.reasons || []).join(', ')) + '</td><td class="small">' + (c.alsoOn === true ? 'yes' : c.alsoOn === false ? 'no' : 'unknown') + '</td>'
+ '<td class="act"><button class="btn small sec" data-mcopen="' + esc(c.email) + '">Open</button> <button class="btn small sec" data-spamallow="' + esc(c.email) + '">Allow</button></td></tr>').join('') : '<tr><td colspan="8" class="muted small">Nothing to review.</td></tr>');
}
$('spamRun').addEventListener('click', busy($('spamRun'), async () => { await api('/api/admin/spamscan/run', {}); await loadSpamScan(); IAP.status('Scan done.', 'ok'); }));
$('spamDelete').addEventListener('click', busy($('spamDelete'), async () => {
const sel = [...document.querySelectorAll('[data-spamsel]:checked')].map(x => x.dataset.spamsel);
if (!sel.length) { IAP.status('Tick the accounts to delete first.', 'bad'); return; }
if (!await IAP.confirmBox('Delete ' + sel.length + ' account' + (sel.length === 1 ? '' : 's') + ' with their profile text? On-chain members are refused. LinkSpin is not touched.', { title: 'Delete selected', ok: 'Delete', cancel: 'Cancel' })) return;
let ok = 0, bad = 0; for (const e of sel) { try { await api('/api/admin/member?email=' + encodeURIComponent(e), undefined, 'DELETE'); ok++; } catch (err) { bad++; } }
IAP.status(ok + ' deleted' + (bad ? ', ' + bad + ' refused' : '') + '.', bad ? 'bad' : 'ok');
await api('/api/admin/spamscan/run', {}).catch(() => {}); await loadSpamScan(); loadMembers().catch(() => {});
}));
document.addEventListener('click', async e => {
const b = e.target.closest('[data-spamallow]'); if (!b) return;
try { await api('/api/admin/spamscan/allow', { email: b.dataset.spamallow }); IAP.status('Allowed ' + b.dataset.spamallow + '.', 'ok'); await api('/api/admin/spamscan/run', {}).catch(() => {}); loadSpamScan(); } catch (err) { IAP.status(err.message, 'bad'); }
});
document.addEventListener('click', async e => {
const b = e.target.closest('[data-susp]'); if (!b) return;
const on = b.dataset.on === '1';
@@ -403,7 +430,7 @@
mcCur = d; const a = d.account; $('memHits').hidden = true;
$('memCard').hidden = false; document.querySelectorAll('#pane-members > .card').forEach(c => { if (c.id !== 'memCard' && c.id !== 'memSearchCard') c.hidden = true; });
$('mcName').textContent = (a.username ? '@' + a.username : a.email) + (a.memberId ? ' · member #' + a.memberId : ' · free member');
$('mcSub').textContent = 'joined ' + when(a.created) + ' · last seen ' + ago(a.lastSeen);
$('mcSub').textContent = 'joined ' + when(a.created) + ' · last seen ' + ago(a.lastSeen) + (a.profileQuarantined ? ' · PROFILE QUARANTINED (link planted on a brand-new free account; not shown publicly)' : '');
$('mcWall').hidden = !a.username; if (a.username) $('mcWall').href = '/wall/' + a.username;
const ch = d.chain, cr = d.credits, t = d.totals;
const level = ch && !ch.readError ? (ch.buyerCount >= 5 ? 'level 3 (5+ buyers)' : ch.buyerCount >= 2 ? 'level 2 (2 buyers)' : 'level 1') : '';
@@ -425,6 +452,7 @@
['Upline chain', d.upline.length > 1 ? d.upline.map(u => memLink(u.email, u.name)).join(' &rarr; ') : '<span class="muted">-</span>'],
['Joined via', esc(a.joinedVia || 'join page') + (a.joinedRef ? ' from ' + esc(a.joinedRef) : '')],
['Line banner', a.lineTargetUrl ? '<a href="' + esc(a.lineTargetUrl) + '" target="_blank" rel="noopener">' + esc(a.lineTargetUrl.slice(0, 50)) + '</a>' : '<span class="muted">not set</span>'],
['BixPay partner link', a.bixPartnerLink ? '<span class="mono small" style="overflow-wrap:anywhere">' + esc(a.bixPartnerLink) + '</span>' : '<span class="muted">not set (pages use a sponsor’s link or the network link)</span>'],
['Chat', a.chatAvailable ? 'available' : 'switched off']]) + '</div>';
h += '<div><h4 style="margin:0 0 6px">On-chain and money</h4>' + kv([
// Say WHICH of the two "not registered" states this is, and what it costs them, so the row
@@ -643,6 +671,12 @@
$('stSub').textContent = (st.settings.on ? 'on' : 'off') + ' · welcome bonus ' + st.settings.bonus + ' credits · ' + st.granted + ' granted';
$('trfStarter').innerHTML = '<tr><th>Game</th><th>Offer taps</th><th>First packages</th><th>Package $</th><th>Tap &rarr; buy</th></tr>' + rows.map(g => '<tr><td>' + esc(g.name) + '</td><td>' + n(g.visits) + '</td><td>' + n(g.buyers) + '</td><td>$' + g.usd.toFixed(2) + '</td><td>' + pct(g.buyers, g.visits) + '</td></tr>').join(''); }
$('trfPaths').innerHTML = '<tr><th>Page</th><th>Views</th></tr>' + (d.paths.length ? d.paths.map(p => '<tr><td>' + esc(p.path) + '</td><td>' + n(p.hits) + '</td></tr>').join('') : '<tr><td colspan="2" class="muted">No page views yet.</td></tr>');
// BixPay clicks by surface + per member (2026-10-29)
if (d.bixpay && $('trfBix')) { const bx = d.bixpay, LBL = { wallet: 'Wallet tab card', overview: 'Overview card', email: 'Payout emails', nudge: 'Game wallet nudges', promo: 'Promo tools (members’ posts and banners)', guide: '/bixpay guide', chat: 'Chatbot', other: 'Other' };
$('bixSub').textContent = 'last ' + bx.days + ' days: ' + n(bx.total) + ' clicks · all time ' + n(bx.allTime) + (bx.live ? '' : ' · bixpayLive is OFF');
const rows = Object.entries(bx.bySurface).sort((a, b) => b[1] - a[1]);
$('trfBix').innerHTML = '<tr><th>Surface</th><th>Clicks</th></tr>' + (rows.length ? rows.map(([s, c]) => '<tr><td>' + esc(LBL[s] || s) + '</td><td>' + n(c) + '</td></tr>').join('') : '<tr><td colspan="2" class="muted">No BixPay clicks in this range yet.</td></tr>');
$('trfBixMembers').innerHTML = '<tr><th>Member</th><th>All clicks</th><th>Via promo kit</th><th>Last</th></tr>' + (bx.members.length ? bx.members.map(m => '<tr><td>' + esc(m.name || m.email) + '</td><td>' + n(m.total) + '</td><td>' + n(m.promo) + '</td><td class="small muted">' + (m.last ? ago(m.last) : '') + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">No member clicks yet.</td></tr>'); }
$('trfAngles').innerHTML = '<tr><th>Angle</th><th>Join-page<br>views</th><th>Signups</th><th>View &rarr;<br>signup</th></tr>' + (d.angles.length ? d.angles.map(a => '<tr><td>' + esc(a.angle) + '</td><td>' + n(a.views) + '</td><td>' + n(a.signups) + '</td><td>' + pct(a.signups, a.views) + '</td></tr>').join('') : '<tr><td colspan="4" class="muted">No angle data yet.</td></tr>');
$('trfDaily').innerHTML = '<tr><th>Day</th><th>Page views</th><th>Signups</th></tr>' + (d.daily.length ? d.daily.slice().reverse().map(x => '<tr><td>' + esc(x.day) + '</td><td>' + n(x.hits) + '</td><td>' + n(x.signups) + '</td></tr>').join('') : '<tr><td colspan="3" class="muted">Nothing yet.</td></tr>');
}
+33
View File
@@ -0,0 +1,33 @@
// BixPay guide (/bixpay, 2026-10-29): the CTA carries the viewer's resolved partner link (their own when signed in, else the
// member whose ?ref brought them here or whose sponsor cookie they carry, else the network link), always through the counted
// /go/bixpay link. The server already folded ?ref into the sponsor cookie; the ref is passed along too so the first view resolves.
// In-app browsers (Gmail, Telegram, Facebook webviews): BIX's register page runs a Cloudflare check that often fails there, and
// the invite token lives only in the URL, so a member who then reopens BIX elsewhere registers with no sponsor (bizventures,
// 2026-10-29: referrer N/A). Those viewers get a notice with the link to copy into a real browser.
(function () {
var cta = document.getElementById('bixCta'), using = document.getElementById('bixUsing'), soon = document.getElementById('bixSoon');
var box = document.getElementById('bixInApp'), boxLink = document.getElementById('bixInAppLink'), boxCopy = document.getElementById('bixInAppCopy');
if (!cta) return;
function inApp() {
var u = navigator.userAgent || '';
if (/FBAN|FBAV|FB_IAB|Instagram|Line\/|Twitter|Snapchat|GSA\/|Telegram|\bwv\b|WebView/i.test(u)) return true;
return /iPhone|iPad|iPod/.test(u) && !/Safari\//.test(u); // an iOS web view: no Safari token
}
var ref = '';
try { ref = new URLSearchParams(location.search).get('ref') || ''; } catch (e) { ref = ''; }
fetch('/api/public/bixpay' + (ref ? '?ref=' + encodeURIComponent(ref) : ''), { credentials: 'same-origin' }).then(function (r) { return r.json(); }).then(function (d) {
if (!d || !d.live) { if (soon) soon.hidden = false; cta.href = '/my#wallet'; if (using) using.textContent = 'Sign in to your dashboard and open the Wallet tab.'; return; }
cta.href = d.go;
if (using) using.textContent = d.whose === 'you' ? 'The button opens your own BixPay partner link.' : d.whose === 'sponsor' ? 'The button opens ' + d.name + "'s BixPay partner link." + (d.signedIn ? ' Add yours in Members > Profile.' : '') : 'The button opens the network’s BixPay partner link.' + (d.signedIn ? ' Add yours in Members > Profile.' : '');
if (box && inApp()) {
box.hidden = false;
if (boxLink) boxLink.textContent = d.go;
if (boxCopy) boxCopy.addEventListener('click', function () {
var done = function () { boxCopy.textContent = 'Copied'; setTimeout(function () { boxCopy.textContent = 'Copy link'; }, 2000); };
var select = function () { try { var r = document.createRange(); r.selectNodeContents(boxLink); var s = window.getSelection(); s.removeAllRanges(); s.addRange(r); boxCopy.textContent = 'Selected: copy it'; } catch (e) {} }; // no native dialogs
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(d.go).then(done, select);
else select();
});
}
}).catch(function () {});
})();
Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+72 -4
View File
@@ -933,6 +933,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
if (me.returnTo === 'spookydoors' && !render.toGame) { render.toGame = true; location.href = '/api/my/spookydoors'; return; } // Spooky Doors sent them here to sign in (2026-10-02)
if (me.returnTo === 'polybreak' && !render.toGame) { render.toGame = true; location.href = '/api/my/polybreak'; return; } // PolyBreak sent them here to sign in (2026-10-13)
if (me.returnTo === 'polminer' && !render.toGame) { render.toGame = true; location.href = '/api/my/polminer'; return; } // POL Miner sent them here to sign in (2026-10-28)
if (me.returnTo === 'warpwares' && !render.toGame) { render.toGame = true; location.href = '/api/my/warpwares'; return; } // Warp & Wares sent them here to sign in (2026-10-29)
if (me.returnTo === 'shardsofvalor' && !render.toGame) { render.toGame = true; location.href = '/api/my/shardsofvalor'; return; } // Shards of Valor sent them here to sign in (2026-10-18)
if (me.returnTo === 'pwmint' && !render.toGame) { render.toGame = true; location.href = '/pw/mint/resume'; return; } // PolyWarriors paid mint (2026-10-05)
if (me.pwMint && !me.gkShop && !me.sdShop && !document.getElementById('pwBack')) { const d = document.createElement('a'); d.id = 'pwBack'; document.body.classList.add('hasback'); d.href = '/pw/mint/resume'; d.textContent = 'PolyWarriors mint: buy a package and you go straight back to the game when it settles. Or go back now →'; d.setAttribute('style', 'position:fixed;left:12px;right:12px;bottom:14px;z-index:9999;display:block;padding:14px 44px 14px 16px;border-radius:14px;background:linear-gradient(180deg,#22E5FF,#7A2CFF);color:#fff;font-weight:800;text-align:center;text-decoration:none;box-shadow:0 10px 30px rgba(0,0,0,.45)'); document.body.appendChild(d);
@@ -974,6 +975,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
loadPositions(me);
$('linkCard').hidden = !!me.address;
$('activateCard').hidden = !(me.address && !me.memberId);
renderBix(me); // BixPay Visa card: Wallet card, Overview announcement, Profile field, promo pill (2026-10-29; nothing while bixpayLive is off)
{ let hn = $('tankHoldNote'); // held for an adopter: say so, and no activate button
if (!hn) { hn = document.createElement('p'); hn.id = 'tankHoldNote'; hn.className = 'small'; hn.style.cssText = 'margin:8px 0 0;color:#22c55e'; $('activateBtn').insertAdjacentElement('beforebegin', hn); }
hn.hidden = !TANK_HOLD; hn.textContent = TANK_HOLD ? tankHoldText(TANK_HOLD) : ''; $('activateBtn').hidden = !!TANK_HOLD; }
@@ -1962,6 +1964,68 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
} catch (e) {}
}
loadWednesdayCard(); setInterval(loadWednesdayCard, 120000);
// ── BixPay Visa card (2026-10-29, docs/BIXPAY-INTEGRATION.md). me.bix comes from /api/me: { live, own, link, whose, name, using, go, announce, clicks }.
// Copy is Marty's approved wording; no in-app swap claim, "3% per purchase, no load fee", the 31-states line. No em dashes.
// sign-up warning (2026-10-29, bizventures registered with referrer N/A): the BIX invite token lives only in the URL and their
// security check often fails inside app webviews, so members who reopen BIX elsewhere lose their sponsor
const BIX_SIGNUP_NOTE = 'Sign up on the page the button opens. Don’t install the BIX app first and don’t use the portal’s own Sign Up menu: your sponsor is lost and BIX shows the referrer as N/A.';
const bixInApp = () => { const u = navigator.userAgent || ''; return /FBAN|FBAV|FB_IAB|Instagram|Line\/|Twitter|Snapchat|GSA\/|Telegram|\bwv\b|WebView/i.test(u) || (/iPhone|iPad|iPod/.test(u) && !/Safari\//.test(u)); };
const BIX_INAPP_NOTE = 'You’re in an app’s built-in browser. BIX’s security check often fails here and your sponsor gets dropped: open instantadpay.com in Chrome or Safari first, then tap the button there.';
const BIX_BODY = 'BixPay is a self-custody wallet with a Visa card. Send USDT or USDC to it on Polygon, load the card, and spend it wherever Visa is accepted, including Apple Pay and Google Pay. Virtual cards from $9.99.';
const BIX_COMPLIANCE = 'BixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees, limits, eligibility and terms. InstantAdPay is not the card issuer and earns a referral commission when you sign up through a partner link. Card availability varies by country. Crypto assets can lose value.';
function renderBix(me) {
const b = (me && me.bix) || { live: false };
const pill = document.querySelector('.promo-pills [data-promo="bixpay"]');
if (pill) pill.hidden = !b.live;
if ($('pfBixCard')) $('pfBixCard').hidden = !b.live;
const wc = $('bixWalletCard'), oc = $('bixCard');
if (!b.live || b.error) { if (wc) wc.hidden = true; if (oc) oc.hidden = true; if (!b.live && pill && pill.classList.contains('on')) setPromoSub('posts'); return; }
// Wallet tab (primary)
if (wc) {
wc.hidden = false;
wc.innerHTML = '<div class="card-head"><h3>Spend your POL anywhere with a BixPay Visa card</h3><span class="sub">a separate company; your partner link rides along</span></div>'
+ '<p>' + esc(BIX_BODY) + '</p>'
+ '<p class="small">3% per purchase, no load fee. See BIX\'s terms for other charges. Available in 31 US states so far. Not in your state yet? You can still get the wallet and build.</p>'
+ '<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><a class="btn" id="bixWalletGo" href="' + esc(b.go.wallet) + '" target="_blank" rel="noopener">Get your BixPay card</a> <a class="btn sec" href="/bixpay" target="_blank" rel="noopener">How it works</a></p>'
+ '<p class="small muted" id="bixWalletUsing" style="margin:6px 0 0">' + esc(b.whose === 'you' ? b.using : b.using.replace(/\s*Add yours in Profile\.$/, '')) + (b.whose !== 'you' ? ' <a href="#profile" data-goto="profile" style="color:var(--mint)">Add yours in Profile</a>' : '') + '</p>'
+ '<p class="small" id="bixWalletNote" style="margin:6px 0 0"><b>' + esc(BIX_SIGNUP_NOTE.split('. ')[0]) + '.</b> ' + esc(BIX_SIGNUP_NOTE.slice(BIX_SIGNUP_NOTE.indexOf('. ') + 2)) + '</p>'
+ (bixInApp() ? '<p class="small" id="bixWalletInApp" style="margin:6px 0 0;border:1px solid #f2b84b;background:rgba(242,184,75,.12);border-radius:8px;padding:8px 10px">' + esc(BIX_INAPP_NOTE) + '</p>' : '')
+ '<details class="small muted" style="margin-top:8px"><summary style="cursor:pointer">The fine print</summary><p style="margin:6px 0 0">' + esc(BIX_COMPLIANCE) + '</p></details>';
wc.querySelectorAll('[data-goto="profile"]').forEach(a => a.addEventListener('click', e => { e.preventDefault(); const m = document.querySelector('.bo-menu [data-pane="profile"]'); if (m) m.click(); setTimeout(() => { const i = $('pfBixLink'); if (i) { i.scrollIntoView({ behavior: 'smooth', block: 'center' }); i.focus(); } }, 300); }));
}
// Overview: a one-line announcement the first week, dismissable for 24 h like the other cards
if (oc) {
if (!b.announce || cardHidden('bix')) oc.hidden = true;
else {
oc.hidden = false;
oc.innerHTML = '<div class="card-head"><h3>\u{1F4B3} New: a Visa card for your POL</h3><span class="sub">BixPay, a separate company</span></div>'
+ '<p>' + esc(BIX_BODY) + ' 3% per purchase, no load fee.</p>'
+ '<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:0"><a class="btn small" href="' + esc(b.go.overview) + '" target="_blank" rel="noopener">Get your BixPay card</a> <a class="btn small sec" href="/bixpay" target="_blank" rel="noopener">How it works</a> <span class="small muted">' + esc(b.using) + '</span></p>'
+ '<p class="small muted" style="margin:6px 0 0">' + esc(BIX_SIGNUP_NOTE) + '</p>';
cardDismiss(oc, 'bix');
}
}
// Profile field
fillBixProfile(b);
// Promo tools tab (promo.js)
if (window.IAPPromo && IAPPromo.fillBix) IAPPromo.fillBix(me);
}
function fillBixProfile(b) {
const i = $('pfBixLink'), st = $('pfBixStatus'); if (!i || !st) return;
if (document.activeElement !== i) i.value = b.own || '';
st.innerHTML = b.own
? '<span style="color:var(--mint)">Saved.</span> Your pages, posts and banners carry your own partner link.'
: (b.whose === 'sponsor' ? 'Not set yet. Until you add yours, your pages carry ' + esc(b.name) + '\'s link.' : 'Not set yet. Until you add yours, your pages carry the network link.');
}
if ($('pfBixSave')) $('pfBixSave').addEventListener('click', busy2($('pfBixSave'), async () => {
const link = $('pfBixLink').value.trim();
if (!link && !(await IAP.confirmBox('Remove your BixPay partner link? Your pages go back to your sponsor\'s link (or the network link).', { title: 'Remove the link', ok: 'Remove it', cancel: 'Keep it' }))) return;
try {
const r = await api('/api/my/bixpay', { link });
IAP.status(link ? 'BixPay partner link saved.' : 'BixPay partner link removed.', 'ok');
const me = await (await fetch('/api/me')).json(); renderBix(me);
} catch (e) { $('pfBixStatus').innerHTML = '<span style="color:var(--bad)">' + esc(e.message) + '</span>'; IAP.status(e.message, 'bad'); }
}));
// ---- Game Pass (2026-10-16, docs/GAME-PASS.md): $5 for 7 days across all ten games. More game, never "earn more". ----
const gpDate = ms => new Date(Number(ms)).toLocaleDateString([], { weekday: 'short', month: 'short', day: 'numeric' });
@@ -2028,23 +2092,27 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
['SpellWheel', 'daily streak pays 0.30 POL instead of 0.15, plus 1 free hint a day'],
['PolyBreak', 'daily gem limit 1.5 POL instead of 0.5, plus an extra paddle every round'],
['POL Miner', 'daily crystal limit 1.5 POL instead of 0.5, plus one free supply crate every day'],
['Warp & Wares', 'the Season Pass: a hull step up, a second base slot, a named ship, a team banner and gold badges (never turns or prizes)', 'warpwares'],
['PolyWarriors', 'a 4th daily mission, and defense pays 25 Circuits instead of 15'],
['Drip Runner', 'a free shield at the start of every run'],
['Road Agent', '2 patrols a day and 25% more scrap']
];
let gpShown = null; // slugs in the public games list (gamesLive, seasons applied): a perk row with a slug shows only while its game does (2026-10-29)
async function gpShownLoad() { if (gpShown) return gpShown; try { const d = await (await fetch('/api/public/games')).json(); gpShown = new Set((d.games || []).map(g => g.slug)); } catch (e) { gpShown = new Set(); } return gpShown; }
function gpPerksHtml() {
return '<div class="gp-perks"><p style="margin:10px 0 6px"><b>What you get</b></p>'
+ '<table class="gp-tbl"><tr><td>Every game</td><td>Daily POL caps of 1.50 a day on repeatable rewards (free play 0.30) and 5 a day in all (free play 2), counted across all ten games</td></tr>'
+ '<tr><td>Weekly</td><td>A seat in the Pass Tournament, POL prizes from 5% of pass sales, paid Mondays</td></tr>'
+ '<tr><td>Badge</td><td>The gold Game Pass badge with your name, to share or post</td></tr></table>'
+ '<p style="margin:10px 0 6px"><b>In each game</b></p><table class="gp-tbl">'
+ GP_PERKS.map(p => '<tr><td>' + p[0] + '</td><td>' + p[1] + '</td></tr>').join('') + '</table>'
+ GP_PERKS.filter(p => !p[2] || (gpShown && gpShown.has(p[2]))).map(p => '<tr><td>' + p[0] + '</td><td>' + p[1] + '</td></tr>').join('') + '</table>'
+ '<p class="small muted" style="margin:6px 0 0">The Pass never changes how much a reward pays: it lets you play and collect more each day.</p></div>';
}
async function loadGamePassCard(highlight) {
const card = $('gpCard'); if (!card) return;
let gp = null; try { gp = await (await fetch('/api/my/gamepass')).json(); } catch (e) {}
if (!gp || !(gp.enabled || gp.show)) { card.hidden = true; return; }
await gpShownLoad();
if ((gp.passes || []).some(r => r.tier !== 'weekly')) return renderPassTiers(card, gp, highlight);
// Five Dollar Friday + the pass (Marty 2026-10-23): the package that starts the pass also gets the Friday bonus, so say so on Fridays
let fdf = ''; try { const f = await (await fetch('/api/friday')).json(); if (f && f.on && f.live) { const base = gp.price || 500, got = Math.round(base * (1 + (Number(f.pct) || 20) / 100));
@@ -2088,7 +2156,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
if (cardHidden('gpnudge')) { card.hidden = true; return; }
let gp = null; try { gp = await (await fetch('/api/my/gamepass')).json(); } catch (e) {}
if (!gp || !gp.enabled || gp.active || !gp.lastCapHit || gp.lastCapHit.pass) { card.hidden = true; return; }
const NAMES = { polhunter: 'PolHunter', gemkingdom: 'Gem Kingdom', spellwheel: 'SpellWheel', spookydoors: 'Spooky Doors', polywarriors: 'PolyWarriors', clutterhunt: 'ClutterHunt', polybreak: 'PolyBreak', driprunner: 'Drip Runner', roadagent: 'Road Agent' };
const NAMES = { polhunter: 'PolHunter', gemkingdom: 'Gem Kingdom', spellwheel: 'SpellWheel', spookydoors: 'Spooky Doors', polywarriors: 'PolyWarriors', clutterhunt: 'ClutterHunt', polybreak: 'PolyBreak', polminer: 'POL Miner', warpwares: 'Warp & Wares', driprunner: 'Drip Runner', roadagent: 'Road Agent' };
card.hidden = false;
card.innerHTML = '<div class="card-head"><h3>\u{1F39F}\uFE0F You reached today\u2019s free cap in ' + esc(NAMES[gp.lastCapHit.game] || 'the games') + '</h3><span class="sub">free play keeps paying; the Pass plays more</span></div>'
+ '<p>Every member earns real POL in the games up to the daily cap. The <b>Game Pass</b> raises the caps across all ten games for ' + (gp.days || 7) + ' days ($' + (gp.usd || 5) + ', paid with a new package), adds the weekly Pass Tournament and a perk in every game.</p>'
@@ -2622,7 +2690,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
if ($('tkGo')) { $('tkGo').addEventListener('click', tkGenerate); $('tkAgain').addEventListener('click', tkGenerate); $('tkCopy').addEventListener('click', async () => { try { await navigator.clipboard.writeText($('tkText').value); IAP.status('Copied.', 'ok'); } catch (e) { $('tkText').select(); } }); $('tkSendBc').addEventListener('click', tkSendBroadcast); }
// promo tools: pill menu switches between posts / swipes / banners / wall / videos
function setPromoSub(name) {
const ids = ['toolkit', 'posts', 'text', 'swipe', 'banners', 'wall', 'objections', 'videos', 'viral', 'games'];
const ids = ['toolkit', 'posts', 'text', 'swipe', 'banners', 'wall', 'objections', 'videos', 'viral', 'games', 'bixpay']; // bixpay: the BixPay partner kit, pill hidden while bixpayLive is off (2026-10-29)
if (['polhunter', 'spookydoors', 'gamebanners'].includes(name)) name = 'games'; // those tabs live inside Games now (2026-10-06)
if (name === 'toolkit') loadToolkit();
const pill = document.querySelector('.promo-pills [data-promo="' + name + '"]');
@@ -3401,7 +3469,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
for (const p of SOCIALS) body.socials[p] = ($('soc-' + p) && $('soc-' + p).value.trim()) || '';
if (pfAvatar) body.avatarUrl = pfAvatar;
const r = await api('/api/my/profile-details', body);
IAP.status('Profile saved.', 'ok');
IAP.status(r.notice ? 'Profile saved. ' + r.notice : 'Profile saved.', 'ok');
if (r.account) fillProfileDetails(r.account);
}));
$('lbUploadBtn').addEventListener('click', () => $('lbFile').click());
+59 -5
View File
@@ -292,9 +292,15 @@ window.IAPPromo = (function () {
// the public games page (2026-10-10, Marty: "make sure that's in the promo tools for everyone"): every game on one page, with the member's referral on the Join button
{ slug: 'allgames', name: 'All games (one page)', link: 'https://instantadpay.com/games?ref=', img: 'https://instantadpay.com/banners/iap-games-1200x630.jpg', sub: 'every game in the network on one public page, open now and opening next',
posts: [
{ name: 'Short post', text: 'Every game in the InstantAdPay network on one page: a word puzzle, a hidden-object hunt, a match-3, a runner, a scavenger hunt, a cyberpunk battler. Free to play, and they pay POL to the wallet on your account. {L}' },
{ name: 'Friendly post', text: 'If you like small games that actually pay something, this is the page I send people. Eight games, all free, all paying POL on Polygon for first clears, levels and daily puzzles. Pick one: {L}' },
{ name: 'Short post', text: 'Every game in the InstantAdPay network on one page: a word puzzle, a hidden-object hunt, a match-3, a runner, a scavenger hunt, a cyberpunk battler, a brick breaker, a mining game. Free to play, and they pay POL to the wallet on your account. {L}' },
{ name: 'Friendly post', text: 'If you like small games that actually pay something, this is the page I send people. Every one is free, and they all pay POL on Polygon for first clears, levels, bosses and daily puzzles. Pick one: {L}' },
{ name: 'Telegram or WhatsApp line', text: 'All the games that pay POL, one page, free to play: {L}' }] },
// Warp & Wares (2026-10-29, the 30-day season game): shows once 'warpwares' is in the public games list (gamesLive, in season)
{ slug: 'warpwares', name: 'Warp & Wares', link: 'https://warpwares.saasy.top/?ref=', img: 'https://warpwares.saasy.top/og-warpwares.jpg', sub: 'space trading season that pays Polygon',
posts: [
{ name: 'Short post', text: 'Warp & Wares is a free 30-day space trading season. One shared galaxy, 200 turns a day for everyone: buy low, sell high, hold your sectors, build a base, run a team. The weekly territory and trader prizes pay Polygon, and the season leaderboard pays at the close. {L}' },
{ name: 'Friendly post', text: 'If you ever played Trade Wars on a BBS, this is that feeling again, on your phone. Warp & Wares: 30 days, 1,200 sectors, three goods, a team of five, and prizes in Polygon at published positions. Free to play: {L}' },
{ name: 'Telegram or WhatsApp line', text: 'New season game in the network: Warp & Wares. 200 turns a day, trade and hold territory, weekly Polygon prizes. Free: {L}' }] },
// POL Miner (2026-10-28): shows once 'polminer' is in gamesLive (the public games list), like PolyBreak
{ slug: 'polminer', name: 'POL Miner', link: 'https://polminer.com/?ref=', img: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/polminer/og-polminer.jpg', sub: 'mining game that pays Polygon',
posts: [
@@ -340,7 +346,7 @@ window.IAPPromo = (function () {
{ slug: 'spookydoors', name: 'Spooky Doors', link: 'https://spookydoors.com/?ref=', kit: 'promo-spookydoors', seasonal: true },
{ slug: 'polhunter', name: 'PolHunter', link: 'https://polhunter.com/?r=', kit: 'promo-polhunter' }];
const SIZES = [['728x90', 'Leaderboard'], ['468x60', 'Banner'], ['320x50', 'Mobile banner'], ['300x250', 'Medium rectangle'], ['336x280', 'Large rectangle'], ['250x250', 'Square'], ['125x125', 'Button'], ['160x600', 'Wide skyscraper'], ['120x600', 'Skyscraper'], ['300x600', 'Half page'], ['600x300', 'Traffic exchange / splash page']];
const avail = { spookydoors: false, roadagent: !preLaunch(2026, 10, 15), polybreak: false, polminer: false }; // PolyBreak joins once it is in gamesLive (public games list) // seasonal: the Spooky Doors kit says whether its season is showing; Road Agent joins the list on its launch day
const avail = { spookydoors: false, roadagent: !preLaunch(2026, 10, 15), polybreak: false, polminer: false, warpwares: false }; // Warp & Wares: in the public games list (its season window applies there) // PolyBreak joins once it is in gamesLive (public games list) // seasonal: the Spooky Doors kit says whether its season is showing; Road Agent joins the list on its launch day
const list = () => GAMES.filter(g => avail[g.slug] !== false);
let cur = null; try { cur = localStorage.getItem('iap.gmGame'); } catch (e) {}
const draw = () => {
@@ -376,7 +382,7 @@ window.IAPPromo = (function () {
const row = document.createElement('div'); row.className = 'pb-actions'; row.appendChild(copyBtn(code, 'Copy embed code')); row.appendChild(copyBtn(src, 'Copy image URL')); row.appendChild(linkBtn(src, 'Open image')); d.appendChild(row); grid.appendChild(d); }
};
window.__gmAvail = (slug, on) => { avail[slug] = !!on; draw(); };
fetch('/api/public/games').then(r => r.json()).then(d => { for (const sl of ['polybreak', 'polminer']) if ((d.games || []).some(g => g.slug === sl)) window.__gmAvail(sl, true); }).catch(() => {});
fetch('/api/public/games').then(r => r.json()).then(d => { for (const sl of ['polybreak', 'polminer', 'warpwares']) if ((d.games || []).some(g => g.slug === sl && g.live)) window.__gmAvail(sl, true); }).catch(() => {});
$('gmPick').addEventListener('click', e => { const b = e.target.closest('[data-gm]'); if (!b) return; cur = b.dataset.gm; draw(); });
draw();
}
@@ -423,5 +429,53 @@ window.IAPPromo = (function () {
}
}
return { fill, POSTS, TEXTS, SWIPES, OBJECTIONS, VIDEOS };
// ── BixPay partner kit (2026-10-29, docs/BIXPAY-INTEGRATION.md). me.bix from /api/me. The three posts are Marty's approved
// copy. {L} = the member's TRACKED link (/go/bixpay?s=promo&m=<member>: counted here, then the resolved partner link), so every
// asset carries the member's link and the Promo tab can show its clicks. Banners: text only, no BIX logo (brand rules unconfirmed).
const BIX_POSTS = [
{ name: 'Short post', net: 'X', text: 'I spend my crypto with a Visa card now. BixPay keeps the keys with you, loads from USDT or USDC with no load fee, and works with Apple Pay. Virtual card from $9.99: {L}' },
{ name: 'Friendly post', net: 'Facebook', text: 'Earning crypto is one thing. Spending it without jumping through hoops is another. BixPay fixed that for me: a self-custody wallet and a Visa card in one app. Here\'s where I got mine: {L}' },
{ name: 'Partner angle', net: 'LinkedIn', text: 'BixPay pays partners on every card and on card spending, ten levels deep. If you\'re building a team anyway, this fits right in: {L}' }
];
const BIX_SWIPE = { subject: 'A Visa card for the crypto you already earn', body: 'Hey,\n\nQuick one, because this solved something for me.\n\nI earn crypto in a few places, and for a long time the awkward part was spending it. Exchange, bank, waiting, fees. BixPay took that out of the loop: it is a self-custody wallet with a Visa card in one app. You send USDT or USDC to it on Polygon, load the card, and pay wherever Visa is accepted, Apple Pay and Google Pay included.\n\nThe parts I liked:\n- The keys stay with you. It is your wallet, not an account someone else holds.\n- No load fee. 3% per purchase, and BIX\'s terms cover the rest.\n- A virtual card is $9.99 and you can be using it the same day.\n- If you build a team, BixPay pays partners on every card and on card spending, ten levels deep.\n\nUS note: it is open in 31 states so far. If yours is not on the list yet, you can still get the wallet and build.\n\nHere is my link: {L}\n\nBixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees, limits, eligibility and terms. Crypto assets can lose value.\n\nTalk soon,' };
const BIX_CDN = 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/bixpay/';
const BIX_SIZES = [['728x90', 'Leaderboard'], ['300x250', 'Medium rectangle'], ['468x60', 'Banner'], ['600x300', 'Traffic exchange / splash page']];
function fillBix(me) {
const b = (me && me.bix) || {}; const sec = $('promo-bixpay'); if (!sec) return;
if (!b.live || b.error || !b.go) { sec.hidden = true; return; }
const enc = encodeURIComponent, link = b.link, go = b.go.promo;
if (sec.dataset.filled === link + '|' + go + '|' + (b.clicks ? b.clicks.total : 0)) return;
sec.dataset.filled = link + '|' + go + '|' + (b.clicks ? b.clicks.total : 0);
$('bixPromoLink').textContent = link;
$('bixPromoUsing').textContent = b.using || '';
$('bixPromoSub').textContent = b.whose === 'you' ? 'every link and banner here carries your partner link' : 'add your own partner link in Profile and these switch to yours';
$('bixPromoCopy').onclick = async () => { try { await navigator.clipboard.writeText(link); status('Partner link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } };
const sh = $('bixPromoShare'); if (sh) { sh.hidden = !navigator.share; sh.onclick = async () => { try { await navigator.share({ title: 'BixPay', text: 'A Visa card for your crypto: ' + go }); } catch (e) { if (!(e && e.name === 'AbortError')) status('Could not open the share sheet.', 'bad'); } }; }
$('bixPromoGo').textContent = go;
$('bixPromoGoCopy').onclick = async () => { try { await navigator.clipboard.writeText(go); status('Tracked link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } };
const n = (b.clicks && b.clicks.promo) || 0; $('bixPromoClicks').textContent = n ? 'Clicks so far: ' + n.toLocaleString() + '.' : 'No clicks counted yet.';
const pp = $('bixPromoPosts'); pp.innerHTML = '';
for (const p of BIX_POSTS) {
const text = p.text.replace('{L}', go), lead = text.replace(go, '').trim();
const extras = [];
if (p.net === 'X') extras.push(linkBtn('https://twitter.com/intent/tweet?text=' + enc(text), 'Post on X'));
if (p.net === 'Facebook') extras.push(linkBtn('https://www.facebook.com/sharer/sharer.php?u=' + enc(go), 'Share on Facebook'));
if (p.net === 'LinkedIn') extras.push(linkBtn('https://www.linkedin.com/sharing/share-offsite/?url=' + enc(go), 'Share on LinkedIn'));
extras.push(linkBtn('https://t.me/share/url?url=' + enc(go) + '&text=' + enc(lead), 'Telegram'));
extras.push(linkBtn('https://wa.me/?text=' + enc(text), 'WhatsApp'));
pp.appendChild(block(text, '<span class="pb-net">' + esc(p.name) + '</span>', extras));
}
const sw = $('bixPromoSwipe'); sw.innerHTML = '';
sw.appendChild(block('Subject: ' + BIX_SWIPE.subject + '\n\n' + BIX_SWIPE.body.replace('{L}', go), '<span class="pb-net">Email</span> <b>' + esc(BIX_SWIPE.subject) + '</b>'));
const bg = $('bixPromoBanners'); bg.innerHTML = '';
for (const [s, nme] of BIX_SIZES) {
const w = s.split('x')[0], h = s.split('x')[1], src = BIX_CDN + 'bixpay-' + s + '.png';
const code = '<a href="' + go + '" target="_blank" rel="noopener"><img src="' + src + '" width="' + w + '" height="' + h + '" alt="A Visa card for your crypto"></a>';
const d = document.createElement('div'); d.className = 'promo-block';
d.innerHTML = '<div class="pb-head"><span class="lab">' + s + '</span> <span class="muted small">' + esc(nme) + '</span></div><div style="overflow:auto;margin:8px 0"><img loading="lazy" src="' + src + '" alt="BixPay banner ' + s + '" style="max-width:100%;height:auto;border-radius:6px"></div><div class="pb-text mono small" style="overflow-wrap:anywhere">' + esc(code) + '</div>';
const row = document.createElement('div'); row.className = 'pb-actions'; row.appendChild(copyBtn(code, 'Copy embed code')); row.appendChild(copyBtn(src, 'Copy image URL')); row.appendChild(linkBtn(src, 'Open image')); d.appendChild(row); bg.appendChild(d);
}
}
return { fill, fillBix, POSTS, TEXTS, SWIPES, OBJECTIONS, VIDEOS, BIX_POSTS, BIX_SWIPE };
})();
+3 -3
View File
@@ -32,10 +32,10 @@
function answer(i) {
api('/api/refuel/done', { n: nonce, answer: i }).then(function (r) {
if (r.error) { if (r.retry) return challenge(); $('rfHint').textContent = r.error; $('rfCheck').hidden = true; return; }
done = true; $('rfCheck').hidden = true; var gk = GAME === 'Gem Kingdom', ch = GAME === 'ClutterHunt', sw = GAME === 'SpellWheel';
$('rfHint').textContent = gk ? 'Visit counted. Your heroes are back on their feet.' : (ch || sw) ? 'Visit counted. Your hint is ready.' : 'Visit counted. Your tank is full.';
done = true; $('rfCheck').hidden = true; var gk = GAME === 'Gem Kingdom', ch = GAME === 'ClutterHunt', sw = GAME === 'SpellWheel', ww = GAME === 'Warp & Wares';
$('rfHint').textContent = gk ? 'Visit counted. Your heroes are back on their feet.' : (ch || sw) ? 'Visit counted. Your hint is ready.' : ww ? 'Visit counted. Your bonus turns are waiting on the bridge.' : 'Visit counted. Your tank is full.';
if (gk && inGame) { try { window.parent.postMessage({ gkContinue: nonce, ok: true }, '*'); } catch (e) {} }
var b = $('rfDone'); b.disabled = false; b.textContent = gk ? 'Back to the battle' : ch ? 'Back to the room' : sw ? 'Back to the puzzle' : 'Back to the run'; b.onclick = function () { location.href = r.ret; };
var b = $('rfDone'); b.disabled = false; b.textContent = gk ? 'Back to the battle' : ch ? 'Back to the room' : sw ? 'Back to the puzzle' : ww ? 'Back to the bridge' : 'Back to the run'; b.onclick = function () { location.href = r.ret; };
setTimeout(function () { location.href = r.ret; }, 1200);
});
}
+8 -5
View File
@@ -17,9 +17,11 @@
title.innerHTML = safeName;
if (hostEl) hostEl.innerHTML = safeName;
IAP.$('bioHead').hidden = false;
if (w.avatarUrl) { const av = IAP.$('bioAvatar'); av.src = w.avatarUrl; av.hidden = false; }
// profile fields (avatar, bio, socials, intro video) are rendered only when the server says the member has bought (w.bought);
// a free member's wall shows the name, the line's ads and the join call, nothing from the profile (2026-10-30)
if (w.bought && w.avatarUrl) { const av = IAP.$('bioAvatar'); av.src = w.avatarUrl; av.hidden = false; }
if (w.badge) { const bb = IAP.$('bioBadge'); if (bb) { bb.src = w.badge.img; bb.title = w.badge.label + ' badge'; bb.hidden = false; } }
IAP.$('bioText').textContent = w.bio || 'Building a team on InstantAdPay — join through this page and you\'re in my line.';
IAP.$('bioText').textContent = (w.bought && w.bio) || 'Building a team on InstantAdPay. Join through this page and you are in my line.';
if (w.qrUrl) IAP.$('bioQr').src = w.qrUrl;
// social links
const SOC = { facebook: 'Facebook', twitter: 'X', youtube: 'YouTube', instagram: 'Instagram', tiktok: 'TikTok', telegram: 'Telegram', linkedin: 'LinkedIn', website: 'Website' };
@@ -36,14 +38,15 @@
website: svg('<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/>')
};
const sc = IAP.$('bioSocials');
if (sc && w.socials && typeof w.socials === 'object') {
if (sc && w.bought && w.socials && typeof w.socials === 'object') {
// paid placement: Google wants these marked sponsored (plus ugc), never a plain dofollow (2026-10-30)
const links = Object.keys(SOC).filter(k => w.socials[k]).map(k =>
'<a href="' + String(w.socials[k]).replace(/"/g, '%22') + '" target="_blank" rel="noopener nofollow me">' + (ICON[k] || '') + '<span>' + SOC[k] + '</span></a>');
'<a href="' + String(w.socials[k]).replace(/"/g, '%22') + '" target="_blank" rel="sponsored ugc noopener">' + (ICON[k] || '') + '<span>' + SOC[k] + '</span></a>');
sc.innerHTML = links.join('');
}
// intro video under the bio: YouTube / Vimeo embed, or a direct file
const bv = IAP.$('bioVideo');
const vurl = w.socials && typeof w.socials === 'object' ? String(w.socials.video || '') : '';
const vurl = w.bought && w.socials && typeof w.socials === 'object' ? String(w.socials.video || '') : '';
if (bv && vurl) {
let yt = /(?:youtube\.com\/(?:watch\?(?:.*&)?v=|shorts\/|embed\/)|youtu\.be\/)([A-Za-z0-9_-]{6,})/.exec(vurl);
let vm = /vimeo\.com\/(?:video\/)?(\d+)/.exec(vurl);
+170
View File
@@ -0,0 +1,170 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>BixPay: a Visa card for your POL | InstantAdPay</title>
<meta name="description" content="How InstantAdPay members spend their POL with a BixPay Visa card: what BixPay is, the 3% fee, how to turn POL into USDT or USDC and load the card on Polygon, the sign-up steps with screenshots, how the BixPay partner plan pays ten levels deep, and what to know before you start.">
<meta name="theme-color" content="#043b2f">
<link rel="canonical" href="https://instantadpay.com/bixpay">
<meta property="og:type" content="website"><meta property="og:site_name" content="InstantAdPay">
<meta property="og:title" content="BixPay: a Visa card for your POL">
<meta property="og:description" content="A self-custody wallet with a Visa card. Send USDT or USDC to it on Polygon, load the card, and spend it wherever Visa is accepted, including Apple Pay and Google Pay. Virtual cards from $9.99. 3% per purchase, no load fee.">
<meta property="og:url" content="https://instantadpay.com/bixpay">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
<link rel="icon" type="image/png" href="/logo-icon.png">
<link rel="stylesheet" href="/assets/site.css?v=20260912b">
<style>
.rg{max-width:900px}
.rg .hero{padding:44px 0 10px}
.rg h2{font-size:26px;margin:38px 0 6px}
.rg h3{font-size:17px;margin:0 0 6px}
.rg-eye{font-family:var(--mono);font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--amber);font-weight:700;margin:38px 0 0}
.rg-eye + h2{margin-top:6px}
.rg-cta{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:6px 0 10px}
.rg-cta .btn.big{font-size:17px;padding:14px 22px}
.rg-two{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:14px;margin:14px 0 0}
.rg-box{border:1px solid var(--line);border-radius:14px;padding:16px 18px;background:rgba(255,255,255,.02);min-width:0}
.rg-box p{margin:0;font-size:14.5px;color:var(--muted)}
.rg-box p + p{margin-top:8px}
.rg-note{font-size:14.5px;color:var(--muted);margin:8px 0 0}
.rg-route{list-style:none;counter-reset:s;margin:12px 0 0;padding:0;display:grid;gap:14px}
.rg-route > li{counter-increment:s;display:grid;grid-template-columns:42px minmax(0,1fr);gap:14px;align-items:start;border:1px solid var(--line);border-radius:14px;padding:14px 16px;background:rgba(255,255,255,.02);min-width:0}
.rg-route > li::before{content:counter(s);font-family:var(--disp);font-weight:800;font-size:20px;width:42px;height:42px;border-radius:50%;display:grid;place-items:center;background:var(--amber);color:#1b1203}
.rg-route > li > div{min-width:0}
.rg-route p{margin:0 0 8px;font-size:14.5px;color:var(--muted)}
.rg-tbl{border:1px solid var(--line);border-radius:14px;overflow:hidden;margin:10px 0 8px}
.rg-tbl table{width:100%;border-collapse:collapse;font-size:14.5px;table-layout:fixed}
.rg-tbl th,.rg-tbl td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}
.rg-tbl th{font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:600}
.rg-tbl td:first-child{width:38%;font-weight:700}
.rg-tbl tr:last-child td{border-bottom:0}
.rg-faq{display:grid;gap:14px;margin:12px 0 0}
.rg-faq dt{font-family:var(--disp);font-weight:700}
.rg-faq dd{margin:4px 0 0;color:var(--muted);font-size:14.5px}
.rg-rule{border-left:4px solid var(--mint);background:rgba(67,232,195,.07);padding:14px 18px;border-radius:0 12px 12px 0;margin:30px 0 22px;font-size:14.5px}
.rg-warn{border-left:4px solid var(--amber);background:rgba(255,178,56,.07);padding:12px 16px;border-radius:0 12px 12px 0;margin:12px 0 0;font-size:14.5px}
.rg code.i{font-family:var(--mono);font-size:13px;color:var(--mint);background:rgba(67,232,195,.08);padding:1px 5px;border-radius:4px;overflow-wrap:anywhere}
/* phone screenshots: a row of app screens, each captioned; stacked on a phone */
.bx-shots{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:14px;margin:14px 0 0}
.bx-shot{min-width:0;text-align:center}
.bx-shot img{width:100%;max-width:240px;height:auto;border-radius:18px;border:1px solid var(--line-strong);background:#000;display:block;margin:0 auto}
.bx-shot figcaption{font-size:13px;color:var(--muted);margin:8px 0 0;line-height:1.45}
.bx-using{font-size:13.5px;color:var(--muted);margin:0}
.bx-flow{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));gap:12px;margin:12px 0 0}
.bx-flow div{border:1px solid var(--line-strong);border-radius:12px;padding:12px 13px;background:rgba(255,255,255,.02);font-size:13.5px;color:var(--muted);line-height:1.45}
.bx-flow b{display:block;font-family:var(--disp);color:var(--ink);margin-bottom:4px}
@media (max-width:640px){.rg .hero h1{font-size:30px}.rg-box{padding:14px}.rg-route > li{grid-template-columns:34px minmax(0,1fr);gap:10px;padding:12px}.rg-route > li::before{width:34px;height:34px;font-size:17px}}
</style>
</head>
<body>
<div class="wrap rg">
<section class="hero">
<p class="eyebrow">For InstantAdPay members · BixPay is a separate company</p>
<h1>Spend your POL anywhere with a <em>BixPay Visa card</em>.</h1>
<p class="lead">BixPay is a self-custody wallet with a Visa card. Send USDT or USDC to it on Polygon, load the card, and spend it wherever Visa is accepted, including Apple Pay and Google Pay. Virtual cards from $9.99. 3% per purchase, no load fee. See BIX's terms for other charges.</p>
</section>
<div class="rg-cta">
<a class="btn big" id="bixCta" href="/my#wallet" target="_blank" rel="noopener">Get your BixPay card</a>
<a class="btn sec" href="/join">Not a member yet? Join free by email</a>
</div>
<p class="bx-using" id="bixUsing">The button opens a BixPay partner sign-up link.</p>
<p class="rg-note" id="bixSignupNote"><b>Sign up on the page the button opens.</b> Don’t install the BIX app first and don’t use the portal’s own Sign Up menu: your sponsor is lost and BIX shows the referrer as N/A.</p>
<div class="rg-note" id="bixInApp" hidden style="border:1px solid #f2b84b;background:rgba(242,184,75,.12);border-radius:10px;padding:10px 12px"><b>You’re in an app’s built-in browser.</b> BIX’s security check often fails here and your sponsor gets dropped. Open this page in Chrome or Safari first (menu > Open in browser), or copy the sign-up link and paste it there: <span id="bixInAppLink" style="word-break:break-all;font-family:ui-monospace,monospace;font-size:12px"></span> <button type="button" class="btn small sec" id="bixInAppCopy" style="margin-left:6px">Copy link</button></div>
<p class="rg-note" id="bixSoon" hidden>The BixPay card is not switched on for InstantAdPay members yet. Check back soon.</p>
<p class="rg-note">Available in 31 US states so far. Not in your state yet? You can still get the wallet and build. Elsewhere, availability varies by country.</p>
<p class="rg-eye">What it is</p>
<h2>A wallet you hold, a card you can actually use</h2>
<div class="rg-two">
<div class="rg-box"><h3>Self-custody</h3><p>The BIX app is a wallet where the keys stay with you. It is not an exchange account. You hold the USDT or USDC that backs your card.</p></div>
<div class="rg-box"><h3>A Visa card on top</h3><p>Create a virtual card in the app for $9.99 and it works wherever Visa is accepted, online and in stores through Apple Pay and Google Pay. Plastic, metal and gold cards cost more.</p></div>
<div class="rg-box"><h3>Loads on Polygon</h3><p>Your InstantAdPay payouts land as POL on Polygon. Turn them into USDT or USDC, send that to your BixPay wallet on Polygon, and top up the card. No bridge, no bank wait.</p></div>
<div class="rg-box"><h3>What it costs</h3><p>3% per purchase, no load fee. Other charges, limits and eligibility are set by BIX; read BIX's terms before you start. We quote only the fee we can stand behind.</p></div>
</div>
<p class="rg-eye">Why we added it</p>
<h2>How BixPay pays you, in plain words</h2>
<p class="rg-note">BixPay runs a partner plan on top of the card, and InstantAdPay members plug into it with one link. Nothing here is paid by InstantAdPay: BIX tracks and pays its partners in the BIX portal, and InstantAdPay earns a referral commission when someone signs up through a partner link. Here is the plan as BIX describes it.</p>
<div class="rg-tbl">
<table>
<thead><tr><th>Piece</th><th>What BIX says it does</th></tr></thead>
<tbody>
<tr><td>The fee</td><td>3% of each card purchase. That is the only fee we quote; BIX's terms cover the rest.</td></tr>
<tr><td>What goes into the plan</td><td>Half of the purchase fees and half of card sales (the $9.99 virtual card and the others) go to partners.</td></tr>
<tr><td>Ten levels</td><td>Level 1 gets 15% of the fee, level 2 gets 10%, and levels 3 to 10 get 2.5% each.</td></tr>
<tr><td>The pool</td><td>The remaining 5% goes into a pool shared by partners with large networks, on BIX's own rules.</td></tr>
<tr><td>Card sales count too</td><td>A card bought by someone in your BixPay network pays the same way as spending does.</td></tr>
</tbody>
</table>
</div>
<div class="rg-box" style="margin-top:12px"><h3>A hypothetical, not a typical result</h3><p>If someone in your BixPay network spends $1,000 on their card in a month, the fee on that is $30. BIX says it pays the level-1 partner 15% of that fee ($4.50), the level-2 partner 10% ($3.00) and each of levels 3 to 10 a quarter of one percent of the spend ($0.75 each). That is arithmetic on BIX's published percentages, not a prediction. What anyone earns depends on how many people in their network get and use a card, and on BIX paying as described. Nobody at InstantAdPay promises any amount.</p></div>
<p class="rg-eye">Who gets the credit</p>
<h2>One link, and your sponsor follows</h2>
<div class="bx-flow">
<div><b>Your own link</b>Save your BixPay partner link in Members &gt; Profile &gt; BixPay card. Every BixPay button on your pages, your promo kit and the line in your payout emails then carry it.</div>
<div><b>Else, your sponsor's</b>Until you add yours, your pages carry the link of the first sponsor up your line (up to ten levels) who has one. Every card says so: "Using: @name's link".</div>
<div><b>Else, the network's</b>If nobody up the line has one yet, the network link is used. Add yours and the credit is yours from then on.</div>
</div>
<p class="rg-note">Sign-ups and commissions are counted inside the BIX portal, where each partner sees their directs and levels. InstantAdPay only counts the clicks on its own buttons, so you can see which page or post is working.</p>
<p class="rg-eye">Get the card</p>
<h2>Sign up as a partner, then create the card</h2>
<ol class="rg-route">
<li><div><h3>Open a partner link</h3><p>Tap <b>Get your BixPay card</b> above (or on your Wallet tab). It opens a BixPay <b>partner</b> sign-up, not the plain card-customer one, so the referral plan comes with the card. <b>Register on that page.</b> If you opened this from Gmail or Telegram, open it in Chrome or Safari first; don’t install the app first and don’t use the portal’s own Sign Up menu, or your sponsor is lost (BIX then shows the referrer as N/A, and only BIX support can fix it).</p></div></li>
<li><div><h3>Create your BIX portal account</h3><p>Register on the page that opens (bix.ibportal.io). This is your partner back office: it shows your directs and levels and, under Profile, your own two links. The second one, labelled <b>Partner</b>, is the one you will paste into InstantAdPay later.</p></div></li>
<li><div><h3>Download the BIX app and create your wallet</h3><p>Install BixPay from your phone's app store and create the wallet in the app. Write the recovery phrase down and keep it offline: self-custody means nobody can reset it for you.</p></div></li>
<li><div><h3>Link the app to your portal</h3><p>In the app open <b>Settings &gt; Scan QR</b> and scan the QR code shown in your portal profile. That ties the wallet and card to your partner account so your activity counts.</p></div></li>
<li><div><h3>Create your card</h3><p>In the app, <b>Cards &gt; Create Card</b>. The virtual Visa is $9.99 and is ready as soon as you have passed BIX's identity check (KYC). Add it to Apple Pay or Google Pay from the card screen.</p></div></li>
</ol>
<div class="bx-shots">
<figure class="bx-shot"><img src="/assets/bixpay/bix-cards.webp" width="540" height="1115" alt="The BIX app Cards screen: a virtual Visa card with TOPUP, CARD INFO and MANAGE buttons and recent purchases at Walmart, Raceway and Pizza Hut" loading="lazy"><figcaption>The Cards screen after a few purchases. Balances and card numbers are hidden in this screenshot.</figcaption></figure>
</div>
<p class="rg-eye">Funding your card</p>
<h2>From POL to a card you can swipe</h2>
<p class="rg-note">The card spends USDT or USDC, so the one extra step is turning POL into one of those. Three ways:</p>
<ol class="rg-route">
<li><div><h3>Swap on an exchange, then send on Polygon</h3><p>Swap your POL for USDT or USDC on any exchange or on-ramp you already use. Then in the BIX app open <b>Wallet &gt; Receive</b>, pick USDT or USDC, choose the <b>Polygon</b> network and send to that address. A minute later it shows in the wallet's Cash tab; tap <b>TOPUP</b> on your card to load it.</p><p class="rg-warn" style="margin:0">Pick Polygon on both ends. Sending on another network to a Polygon address can lose the funds, and nobody can reverse it.</p></div></li>
<li><div><h3>Cash App (US)</h3><p>If you use Cash App, it can send crypto straight to your BixPay wallet. Handy for topping up from dollars without an exchange account. Cash App sets its own limits.</p></div></li>
<li><div><h3>The in-app swap, once BIX ships it</h3><p>BIX has said a swap inside the app is coming. The wallet already receives POL ("MATIC (migrated to POL)" in the Receive list), so once the swap is live you will be able to send POL straight in and swap there. We will update this page when it ships; until then use one of the two paths above.</p></div></li>
</ol>
<div class="bx-shots">
<figure class="bx-shot"><img src="/assets/bixpay/bix-receive.webp" width="540" height="1115" alt="The BIX app Receive screen listing USDT, USDC, Ethereum, SOL, BNB, MATIC (migrated to POL), TRON, Avalanche and Optimism" loading="lazy"><figcaption>Wallet &gt; Receive: pick USDT or USDC, then the Polygon network.</figcaption></figure>
<figure class="bx-shot"><img src="/assets/bixpay/bix-wallet.webp" width="540" height="1115" alt="The BIX app Wallet screen, Cash tab, showing USDT and a list of Received and Sent transactions" loading="lazy"><figcaption>Cash tab: each Received is a deposit to the wallet, each Sent right after it is the top-up to the card. Amounts hidden.</figcaption></figure>
</div>
<p class="rg-eye">If something goes wrong</p>
<h2>Disputes and protection</h2>
<div class="rg-two">
<div class="rg-box"><h3>Disputing a charge</h3><p>Every transaction in the app shows the merchant, the date, the category code and a <b>Dispute support</b> box. BIX accepts a dispute for 120 days after a transaction posts, and says a dispute can take 30 to 60 business days.</p></div>
<div class="rg-box"><h3>What InstantAdPay can and cannot do</h3><p>We can help you find your partner link, explain the steps and point you to the right screen. We cannot see your BixPay wallet, your card or your balance, and we cannot file a dispute for you. Card problems go to BIX support inside the app.</p></div>
</div>
<div class="bx-shots">
<figure class="bx-shot"><img src="/assets/bixpay/bix-dispute.webp" width="540" height="1115" alt="The BIX app Transaction Details screen for a Walmart purchase with the Dispute support note at the bottom" loading="lazy"><figcaption>Transaction details with the dispute window. Amount, location and card number hidden.</figcaption></figure>
</div>
<p class="rg-eye">Quick answers</p>
<h2>Questions members ask</h2>
<dl class="rg-faq">
<div><dt>Do I have to be a partner to get the card?</dt><dd>Our buttons open a partner link, so you register as a partner and get the card through the same app. There is no extra cost to being a partner; it just means card sign-ups through your own link are credited to you.</dd></div>
<div><dt>Where do I put my partner link on InstantAdPay?</dt><dd>Members &gt; Profile &gt; BixPay card. Copy the <b>Partner</b> link from your BIX portal profile (the second box). The field refuses the first box's referral link (it ends in appId=3) because that one only makes a card customer.</dd></div>
<div><dt>Can I send POL straight to the card?</dt><dd>Not yet. Turn it into USDT or USDC first (any exchange, or Cash App in the US), then send on Polygon. When BIX ships its in-app swap we will add that path here.</dd></div>
<div><dt>Is my money safe there?</dt><dd>It is a self-custody wallet, so it is as safe as your recovery phrase. Keep the phrase offline and never type it into a website. And remember that USDT, USDC and POL are crypto assets: they can lose value.</dd></div>
<div><dt>What does InstantAdPay get out of it?</dt><dd>A referral commission from BIX when someone signs up through a partner link, the same plan every partner is on. We are not the card issuer and we do not hold any of your funds.</dd></div>
<div><dt>Can I share this page with my own link?</dt><dd>Yes. Members &gt; Promo tools &gt; BixPay has your link, three posts, an email swipe and four banners, plus a click count. Promo tools &gt; Viral links turns this page into <code class="i">instantadpay.com/bixpay?ref=yourname</code>, and the button on it then carries your link.</dd></div>
</dl>
<div class="rg-rule"><b>Compliance.</b> BixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees, limits, eligibility and terms. InstantAdPay is not the card issuer and earns a referral commission when you sign up through a partner link. Card availability varies by country. Crypto assets can lose value.</div>
<p class="muted small" style="margin-top:10px">The partner plan figures on this page are BIX's published percentages as of October 2026 and can change at BIX's discretion. Any example is arithmetic, not a prediction; no income is guaranteed or implied, and any commission depends on real card sign-ups and spending in your network. InstantAdPay sells advertising; it is not an investment product and does not hold customer funds.</p>
<footer>
<div>InstantAdPay · <a href="/">Home</a> · <a href="/wallets">Wallet guide</a> · <a href="/earning">How earning works</a> · <a href="/my#wallet">Your Wallet tab</a></div>
<div class="small">InstantAdPay is the Polygon hub of the <a href="https://cryptoteambuild.com" target="_blank" rel="noopener">Crypto Team Build Network</a>.</div>
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
</footer>
</div>
<script src="/assets/common.js?v=20261023ov"></script>
<script src="/assets/bixpay-guide.js?v=20261029bz"></script>
</body>
</html>
+34 -2
View File
@@ -110,6 +110,7 @@
<p><input id="obUsername" placeholder="Username (3-20 letters, numbers, _)" autocomplete="off" style="width:100%"></p>
<p class="muted small" style="margin:12px 0 4px">Optional — a short bio for your public page (you can skip this).</p>
<p><textarea id="obBio" rows="2" maxlength="600" placeholder="A short bio (optional)" style="width:100%"></textarea></p>
<p class="muted small" style="margin:-6px 0 8px">No links in the bio, and nothing from the prohibited list in the <a href="/terms#prohibited" target="_blank" rel="noopener">Terms</a>.</p>
<p id="obErr" class="small" style="color:var(--bad)" hidden></p>
<p style="margin-top:14px;display:flex;gap:10px;justify-content:flex-end">
<button class="btn sec small" id="obSkip" type="button" hidden>Skip for now</button>
@@ -185,6 +186,7 @@
<div class="card" id="fdfCard" hidden></div>
<div class="card" id="wwCard" hidden></div>
<div class="card" id="rfCard" hidden aria-live="polite"></div>
<div class="card" id="bixCard" hidden></div>
<div class="card" id="gpNudge" hidden></div>
<div class="card gs" id="gsCard" hidden>
<div class="card-head"><h3>Getting started</h3><span class="sub" id="gsSub"></span></div>
@@ -832,6 +834,21 @@
<button class="chip-t" data-promo="videos" type="button" role="tab">Videos</button>
<button class="chip-t" data-promo="viral" type="button" role="tab">Viral links</button>
<button class="chip-t" data-promo="games" type="button" role="tab">🎮 Games</button>
<button class="chip-t" data-promo="bixpay" type="button" role="tab" hidden>💳 BixPay</button>
</div>
<!-- BixPay partner kit (2026-10-29): the member's resolved partner link, posts, an email swipe and four text-only banners; promo.js fillBix -->
<div class="card promo-sec" id="promo-bixpay" hidden>
<div class="card-head"><h3>💳 BixPay: a Visa card for your POL</h3><span class="sub" id="bixPromoSub">every link and banner here carries your partner link</span></div>
<p class="muted small" style="margin:0 0 10px">BixPay is a self-custody wallet with a Visa card, spent from USDT or USDC. Anyone who signs up through your link is credited to you in your BIX portal, up to ten levels deep. 3% per purchase, no load fee. See BIX's terms for other charges. <a href="/bixpay" target="_blank" rel="noopener">Read the guide</a>.</p>
<div class="promo-strip" style="padding:0 0 12px"><div><span class="eyebrow" style="margin:0 0 4px">Your BixPay partner link</span><div class="mono small" id="bixPromoLink" style="overflow-wrap:anywhere">…</div><div class="small muted" id="bixPromoUsing" style="margin-top:4px"></div></div><span><button class="btn small" id="bixPromoCopy" type="button">Copy link</button> <button class="btn small sec" id="bixPromoShare" type="button" hidden>Share</button></span></div>
<div class="promo-strip" style="padding:0 0 12px"><div><span class="eyebrow" style="margin:0 0 4px">Your tracked link</span><div class="mono small" id="bixPromoGo" style="overflow-wrap:anywhere">…</div><div class="small muted" style="margin-top:4px">The posts and banners below use this one. It counts the click here, then opens your partner link. <span id="bixPromoClicks"></span></div></div><span><button class="btn small sec" id="bixPromoGoCopy" type="button">Copy tracked link</button></span></div>
<div class="card-head"><h3>Posts</h3><span class="sub">your link is already in them</span></div>
<div id="bixPromoPosts"></div>
<div class="card-head" style="margin-top:14px"><h3>Email swipe</h3><span class="sub">plain text, paste it into any mailer</span></div>
<div id="bixPromoSwipe"></div>
<div class="card-head" style="margin-top:14px"><h3>Banners</h3><span class="sub">text only, no BIX logo; each embed carries your tracked link</span></div>
<div id="bixPromoBanners"></div>
<p class="small muted" style="margin:12px 0 0">BixPay is a separate company. BIX issues the wallet and the card through its banking partners and sets its own fees, limits, eligibility and terms. InstantAdPay is not the card issuer and earns a referral commission when you sign up through a partner link. Card availability varies by country. Crypto assets can lose value.</p>
</div>
<div class="card promo-sec" id="promo-games" hidden>
<div class="card-head"><h3>🎮 Our games</h3><span class="sub">free to play, every link carries your username</span></div>
@@ -1021,6 +1038,7 @@
<button class="btn small sec" id="pfAvatarBtn" type="button">Upload avatar</button>
<span class="small muted" id="pfAvatarInfo"></span></p>
<p><textarea id="pfBio" rows="3" maxlength="600" placeholder="A short bio for your profile page…" style="width:100%"></textarea></p>
<p class="small muted" style="margin:-6px 0 10px">No links in the bio, and nothing from the prohibited list in the <a href="/terms#prohibited" target="_blank" rel="noopener">Terms</a>.</p>
<p class="small muted" style="margin-bottom:4px">Social links (https URLs — shown on your public page):</p>
<div class="grid c2" style="gap:8px">
<input id="soc-facebook" placeholder="Facebook URL" style="width:100%">
@@ -1082,6 +1100,18 @@
</div>
<p><button class="btn" id="woSaveBtn">Save wall positions</button></p>
</div>
<!-- BixPay partner link (2026-10-29): one field, validated server-side (/api/my/bixpay); shown while bixpayLive is on -->
<div class="card" id="pfBixCard" hidden>
<h3>BixPay card</h3>
<p class="muted small">Join BixPay as a partner, then paste your Partner link here. Members and visitors who get a card through
your pages are credited to you in your BIX portal, up to ten levels deep.</p>
<p><label class="small muted" for="pfBixLink" style="display:block;margin-bottom:4px">Your BixPay partner link</label>
<input id="pfBixLink" maxlength="300" placeholder="https://bix.ibportal.io/auth/register?e=...&a=1" style="width:100%" autocomplete="off" spellcheck="false"></p>
<p class="small muted" style="margin:0 0 10px">Where to find it: BIX portal &gt; Profile &gt; Partner (the second box). Copy the link.</p>
<p style="display:flex;gap:8px;flex-wrap:wrap;align-items:center"><button class="btn" id="pfBixSave" type="button">Save partner link</button>
<a class="btn small sec" href="/bixpay" target="_blank" rel="noopener">Not a BixPay partner yet? How it works</a></p>
<p class="small" id="pfBixStatus" style="margin:10px 0 0"></p>
</div>
<div class="card">
<h3>Sponsor chat</h3>
<p class="muted small">Your line can message you one-to-one for help, and you can message anyone
@@ -1186,6 +1216,8 @@
and it unlocks the full flow. Buying any package does this automatically.</p>
<button class="btn sec" id="activateBtn">Activate payouts</button>
</div>
<!-- BixPay Visa card (2026-10-29, docs/BIXPAY-INTEGRATION.md): shown while site config bixpayLive is on; copy in my.js renderBixWallet -->
<div class="card" id="bixWalletCard" hidden></div>
<div class="card ad-foot" id="adSlotPane-wallet" hidden></div>
</div>
@@ -1221,9 +1253,9 @@
</div>
<script src="/assets/common.js?v=20261023ov"></script><script src="/assets/welcome.js?v=20260923b"></script>
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20261028p"></script>
<script src="/assets/promo.js?v=20261029ww"></script>
<script src="/assets/support.js?v=20261016a"></script>
<script src="/assets/my.js?v=20261028pp"></script>
<script src="/assets/my.js?v=20261030ww"></script>
<script src="/assets/fuel.js?v=20261025ff"></script>
<script src="/assets/engine-room.js?v=20261025ff"></script>
<script src="/assets/chat.js?v=20261016n"></script>
+1 -1
View File
@@ -37,6 +37,6 @@ a.rf-open{color:#8FF0FF;font-size:12px}
<button class="rf-btn" id="rfDone" type="button" disabled>Waiting…</button>
<button class="rf-btn ghost" id="rfBack" type="button" hidden>Back to the game</button>
</div>
<script src="/assets/refuel.js?v=20261004sw"></script>
<script src="/assets/refuel.js?v=20261029ww"></script>
</body>
</html>
+7 -4
View File
@@ -10,7 +10,7 @@
<body>
<div id="nav"></div>
<section><div class="wrap" style="max-width:820px">
<div class="sectionhead" style="text-align:left"><h2>Terms of Service</h2><p class="muted small">Last updated: September 2026</p></div>
<div class="sectionhead" style="text-align:left"><h2>Terms of Service</h2><p class="muted small">Last updated: October 2026</p></div>
<div class="card">
<p class="muted small">Please read these Terms carefully. By creating an account or using InstantAdPay ("the Platform"), you agree to them. If you do not agree, do not use the Platform.</p>
<h3>1. What InstantAdPay is</h3>
@@ -29,11 +29,14 @@
<p class="muted small">Ads you submit must be lawful and must not be deceptive, adult, hateful, malicious, or infringing. Ads are auto-approved for speed; we may remove or pause any ad or campaign at any time, and members can report ads for review. You are solely responsible for the ads you run and the sites they point to.</p>
<h3>7. Acceptable use</h3>
<p class="muted small">No fraud, bots, fake traffic, self-dealing to farm rewards, multiple or duplicate accounts, self-referral through another account, attempts to manipulate the contract, or abuse of other members. We may suspend or terminate accounts that break these rules.</p>
<h3>8. No warranty</h3>
<h3>8. Prohibited content</h3>
<div id="prohibited"></div>
<p class="muted small">The following may not appear anywhere on the Platform, in an ad, a campaign, a line banner, a wall offer, a bio or a social link: gambling, casinos, betting, lotteries and sweepstakes; adult or sexual content; drugs and prescription pharmaceuticals; weapons; hate or harassment; malware, phishing and counterfeit goods; misleading financial promises. Profile fields are not a place for links: a bio may not contain a URL or a domain, links belong in the social fields, and profile text, avatar and links are shown publicly only for members who have bought a package. Accounts created to place links in profile fields (link farming) are removed without notice, with their profile text. Content that matches these rules is refused when it is saved; what slips through is removed when found.</p>
<h3>9. No warranty</h3>
<p class="muted small">The Platform is provided "as is," without warranties of any kind. Blockchains, wallets, oracles, and third-party sites can fail or behave unexpectedly. We do not guarantee uptime, delivery volumes, or results.</p>
<h3>9. Limitation of liability</h3>
<h3>10. Limitation of liability</h3>
<p class="muted small">To the fullest extent permitted by law, InstantAdPay and its operators are not liable for indirect, incidental, or consequential damages, or for losses arising from crypto volatility, irreversible transactions, third-party sites, or your own decisions.</p>
<h3>10. Changes and termination</h3>
<h3>11. Changes and termination</h3>
<p class="muted small">We may update these Terms and the Platform, and continued use means you accept the changes. We may discontinue features. The immutable contract's rules cannot be changed by anyone, including us.</p>
<p class="muted small" style="margin-top:18px">See also the <a href="/disclaimer">Disclaimer</a> and <a href="/privacy">Privacy Policy</a>. Questions: the <a href="/support">support page</a> or <a href="mailto:support@instantadpay.com">support@instantadpay.com</a>.</p>
</div>
+1 -1
View File
@@ -48,6 +48,6 @@
</div>
</section>
<script src="/assets/common.js?v=20261023ov"></script><script src="/assets/welcome.js?v=20260923b"></script>
<script src="/assets/wall.js?v=20260911v"></script>
<script src="/assets/wall.js?v=20261030pp"></script>
</body>
</html>
+94
View File
@@ -0,0 +1,94 @@
// BixPay (bixpay.js, 2026-10-29): the partner-link validator, the sponsor-follows resolver (own / sponsor at level 3 / none ->
// company), the gate, the email + nudge lines and the click store. Fake accounts, throwaway data dir. Run: node qa/bixpay.test.cjs
'use strict';
const fs = require('fs');
const os = require('os');
const path = require('path');
const assert = require('assert');
const ROOT = path.join(__dirname, '..');
let fails = 0, n = 0;
async function t(name, fn) { n++; try { await fn(); console.log('ok', name); } catch (e) { fails++; console.log('FAIL', name, '::', e.message); } }
const bixpay = require(path.join(ROOT, 'bixpay.js'));
const walletnudge = require(path.join(ROOT, 'walletnudge.js'));
const PARTNER = 'https://bix.ibportal.io/auth/register?e=XqwU9T1aJ5N0UJ0yr9x0TGUiSQTsVCkTM01MIovVNnc&a=1';
const CUSTOMER = 'https://bix.ibportal.io/auth/register?e=boUGQ_dC9B472D9LGfzxPKvgfBw1iyqx-xffnx1kqPM&a=1&appId=3';
const L3 = 'https://bix.ibportal.io/auth/register?e=' + 'L3token_'.repeat(5) + '&a=1';
// a five-deep line: leaf -> s1 -> s2 -> s3 (has a link) -> s4 -> s5; plus a loop pair and an orphan
const A = {};
const mk = (email, sponsor, link, username) => { A[email] = { email, sponsorRef: sponsor || '', bixPartnerLink: link || null, username: username || null, code: email.split('@')[0] }; };
mk('leaf@x.test', 's1', null, 'leaf'); mk('s1@x.test', 's2', null, 's1'); mk('s2@x.test', 's3', null, 's2'); mk('s3@x.test', 's4', L3, 's3'); mk('s4@x.test', 's5', null, 's4'); mk('s5@x.test', '', null, 's5');
mk('own@x.test', 's1', PARTNER, 'own'); mk('orphan@x.test', '', null, 'orphan');
mk('loopa@x.test', 'loopb', null, 'loopa'); mk('loopb@x.test', 'loopa', null, 'loopb');
// twelve deep with the only link at level 11: must fall to the company (10-level walk)
let prev = ''; for (let i = 12; i >= 1; i--) { mk('d' + i + '@x.test', prev, i === 12 ? L3 : null, 'd' + i); prev = 'd' + i; }
mk('deep@x.test', 'd1', null, 'deep');
const accounts = { byEmail: async e => A[e] || null, sponsorOf: async e => { const a = A[e]; if (!a || !a.sponsorRef) return null; return Object.values(A).find(x => x.username === a.sponsorRef || x.code === a.sponsorRef) || null; } };
let site = { bixpayLive: '1', bixCompanyLink: '' };
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bixpay-test-'));
bixpay.init({ dataDir: dir, accounts, siteConfig: () => site, refAccount: async tok => Object.values(A).find(x => x.username === tok || x.code === tok) || null });
(async () => {
await t('validator: the partner link passes and normalises', () => { const v = bixpay.validate(' ' + PARTNER + ' '); assert.ok(v.ok); assert.strictEqual(v.link, PARTNER); });
await t('validator: extra params are dropped, e= and a=1 kept', () => { const v = bixpay.validate(PARTNER + '&utm=x'); assert.ok(v.ok); assert.strictEqual(v.link, PARTNER); });
await t('validator: the appId=3 customer link is refused with the message', () => { const v = bixpay.validate(CUSTOMER); assert.ok(!v.ok); assert.strictEqual(v.error, bixpay.CUSTOMER_LINK_MSG); });
await t('validator: wrong host, wrong path, no e=, no a=1, too long, empty, http', () => {
assert.ok(bixpay.validate('https://bix.fi/r?code=ABCDEFGH').error);
assert.ok(bixpay.validate('https://bix.ibportal.io/auth/login?e=' + 'x'.repeat(40) + '&a=1').error);
assert.ok(bixpay.validate('https://bix.ibportal.io/auth/register?a=1').error);
assert.ok(bixpay.validate('https://bix.ibportal.io/auth/register?e=' + 'x'.repeat(40)).error);
assert.ok(bixpay.validate('https://bix.ibportal.io/auth/register?e=' + 'x'.repeat(40) + '&a=2').error);
assert.ok(bixpay.validate('https://bix.ibportal.io/auth/register?e=' + 'x'.repeat(300) + '&a=1').error);
assert.ok(bixpay.validate('').error); assert.ok(bixpay.validate(null).error);
assert.ok(bixpay.validate('http://bix.ibportal.io/auth/register?e=' + 'x'.repeat(40) + '&a=1').error);
assert.ok(bixpay.validate('javascript:alert(1)').error);
});
await t('resolver: own link wins', async () => { const r = await bixpay.resolve(A['own@x.test']); assert.strictEqual(r.whose, 'you'); assert.strictEqual(r.link, PARTNER); });
await t('resolver: no own link -> first sponsor up the chain with one (level 3)', async () => { const r = await bixpay.resolve(A['leaf@x.test']); assert.strictEqual(r.whose, 'sponsor'); assert.strictEqual(r.name, '@s3'); assert.strictEqual(r.email, 's3@x.test'); assert.ok(r.link.includes('L3token_')); });
await t('resolver: nobody up the chain -> company (default = Marty’s partner link)', async () => { const r = await bixpay.resolve(A['orphan@x.test']); assert.strictEqual(r.whose, 'network'); assert.strictEqual(r.link, bixpay.DEFAULT_COMPANY_LINK); assert.strictEqual(r.name, null); });
await t('resolver: null member -> company', async () => { const r = await bixpay.resolve(null); assert.strictEqual(r.whose, 'network'); });
await t('resolver: the walk stops at 10 levels (link at level 12 is not reached)', async () => { const r = await bixpay.resolve(A['deep@x.test']); assert.strictEqual(r.whose, 'network'); });
await t('resolver: a sponsor loop ends in the company link, no hang', async () => { const r = await bixpay.resolve(A['loopa@x.test']); assert.strictEqual(r.whose, 'network'); });
await t('resolver: site config bixCompanyLink overrides the default; a bad one falls back', async () => {
site.bixCompanyLink = L3; assert.strictEqual((await bixpay.resolve(null)).link, L3.replace(/&a=1$/, '&a=1'));
site.bixCompanyLink = 'https://evil.example/x'; assert.strictEqual((await bixpay.resolve(null)).link, bixpay.DEFAULT_COMPANY_LINK);
site.bixCompanyLink = '';
});
await t('resolveRef: a public page ?ref resolves like that member', async () => { const r = await bixpay.resolveRef('leaf'); assert.strictEqual(r.whose, 'sponsor'); const o = await bixpay.resolveRef('own'); assert.strictEqual(o.whose, 'you'); const u = await bixpay.resolveRef('nobody_zz'); assert.strictEqual(u.whose, 'network'); });
await t('usingLine: the three wordings', async () => {
assert.strictEqual(bixpay.usingLine(await bixpay.resolve(A['own@x.test'])), 'Using: your link.');
assert.strictEqual(bixpay.usingLine(await bixpay.resolve(A['leaf@x.test'])), "Using: @s3's link. Add yours in Profile.");
assert.strictEqual(bixpay.usingLine(await bixpay.resolve(null)), 'Using: the network link. Add yours in Profile.');
});
await t('gate: live/announcing follow site config; email and nudge lines are empty while off', () => {
assert.ok(bixpay.live()); assert.ok(bixpay.announcing());
site.bixpayLiveSince = new Date(Date.now() - 8 * 86400000).toISOString(); assert.ok(!bixpay.announcing()); site.bixpayLiveSince = '';
assert.ok(bixpay.emailLine('own').includes('/go/bixpay?s=email&m=own')); assert.ok(bixpay.nudgeLine('own').includes('s=nudge'));
assert.ok(!/—/.test(bixpay.emailLine('own')));
site.bixpayLive = '0'; assert.ok(!bixpay.live()); assert.strictEqual(bixpay.emailLine('own'), ''); assert.strictEqual(bixpay.nudgeLine('own'), ''); site.bixpayLive = '1';
});
await t('walletnudge copy carries the BixPay sentence only when given one', () => {
const c0 = walletnudge.copy([{ key: 'g', name: 'Gem Kingdom', unpaid: 1.5 }], 0, 'https://instantadpay.com/my#wallet', '');
assert.ok(!/BixPay/.test(c0.text) && !/BixPay/.test(c0.html));
const c1 = walletnudge.copy([{ key: 'g', name: 'Gem Kingdom', unpaid: 1.5 }], 0, 'https://instantadpay.com/my#wallet', bixpay.nudgeLine('own'));
assert.ok(/BixPay Visa card/.test(c1.text) && /go\/bixpay\?s=nudge/.test(c1.html));
assert.ok(c1.text.indexOf('Link your wallet:') < c1.text.indexOf('BixPay'), 'the wallet ask stays first');
});
await t('clicks: per surface, per member, per day; unknown surface -> other; bot-free store', () => {
bixpay.click('wallet', 'own@x.test'); bixpay.click('promo', 'own@x.test'); bixpay.click('promo', 'own@x.test'); bixpay.click('guide', null); bixpay.click('weird', 'leaf@x.test');
const m = bixpay.memberClicks('own@x.test'); assert.strictEqual(m.total, 3); assert.strictEqual(m.promo, 2); assert.strictEqual(m.wallet, 1);
const v = bixpay.adminView(30); assert.strictEqual(v.total, 5); assert.strictEqual(v.bySurface.promo, 2); assert.strictEqual(v.bySurface.other, 1); assert.strictEqual(v.members[0].email, 'own@x.test'); assert.strictEqual(v.daily.length, 1);
bixpay._reset(); assert.strictEqual(bixpay.memberClicks('own@x.test').total, 3, 'persisted to disk');
});
await t('copy rules: no em dashes in any BixPay copy shipped to members', () => {
const files = ['bixpay.js', 'public/assets/promo.js', 'public/assets/my.js', 'public/bixpay.html', 'public/assets/bixpay-guide.js', 'chatbot.js'];
for (const f of files) { const s = fs.readFileSync(path.join(ROOT, f), 'utf8'); const lines = s.split('\n').filter(l => /bix/i.test(l) && /—/.test(l)); assert.strictEqual(lines.length, 0, f + ' has an em dash on a BixPay line'); }
const pj = fs.readFileSync(path.join(ROOT, 'public/assets/promo.js'), 'utf8');
assert.ok(/no load fee/.test(pj) && !/in-app swap/i.test(pj.split('BIX_POSTS')[1].split('BIX_CDN')[0]), 'posts never promise the in-app swap');
});
fs.rmSync(dir, { recursive: true, force: true });
console.log('\nbixpay: ' + (n - fails) + '/' + n + ' passed');
process.exit(fails ? 1 : 0);
})();
+1 -1
View File
@@ -151,7 +151,7 @@ try {
await sleep(2200);
const rch = (await api('/api/refuel/challenge?n=' + nr2)).j;
const rd = (await api('/api/refuel/done', { n: nr2, answer: rch.options.indexOf(CAP[rch.prompt]) })).j;
ok(rd && rd.ok && rd.posted === true && refuelCalls.length === 1 && JSON.parse(refuelCalls[0]).credits === 3, 'refuel completes with its own callback', JSON.stringify(rd && { ok: rd.ok, posted: rd.posted }));
ok(rd && rd.ok && rd.posted === true && refuelCalls.length === 1 && JSON.parse(refuelCalls[0]).credits === 3, 'refuel completes with its own callback', JSON.stringify(rd && { ok: rd.ok, posted: rd.posted, calls: refuelCalls }));
const nr3 = crypto.randomBytes(12).toString('hex');
const rcap = (await api('/api/refuel/open?t=' + encodeURIComponent(mint({ kind: 'refuel', memberId: 77, email: player, nonce: nr3, ret: SD + '/play?refuel=' + nr3 }, DRSECRET)))).j;
ok(rcap && rcap.none && rcap.why === 'cap', 'refuel cap (1) reached after one refuel, not before', JSON.stringify(rcap));
+231
View File
@@ -0,0 +1,231 @@
// Profile policy + link-farm scan (2026-10-30 incident: 106 free accounts used bios and socials as casino backlinks).
// Same file in both repos (InstantAdPay site/qa and LinkSpin site/qa); it works out which site it is in.
// node qa/profile-policy.test.cjs (also part of `bash qa/run.sh member`)
// Part A, no server: prohibited.js (URL bio refused, casino bio refused, clean bio accepted, Unicode terms, no false hit on
// "Essex"), spamscan.classify on a six-account fixture (3 farm patterns, a sponsored member with a link, a buyer with a
// link, an allowlisted farm), the quarantine rule, the 06:30 once-a-day claim, the Telegram text, and the byte-for-byte
// check of prohibited.js + spamscan.js against the sibling checkout when it is there.
// Part B, a LOCAL copy (throwaway DATA_DIR, JSON store, devCode sign-in, the other site pointed at a dead port):
// a fresh sponsorless account's first save with a link is quarantined (200 + notice) and never rendered; a clean bio saves;
// then a URL bio and a casino bio are refused; a free member's wall and JSON carry nothing from the profile and the fixed
// description; a buyer's JSON carries bio + socials and the wall still has the fixed description; a deleted or unknown name
// is a real 404 with X-Robots-Tag noindex; the line banner refuses a casino target; the admin scan lists the quarantined
// account, Allow removes it; the admin member card shows the flag. Exit code 1 on any failure.
'use strict';
const fs = require('fs');
const os = require('os');
const path = require('path');
const http = require('http');
const crypto = require('crypto');
const { spawn } = require('child_process');
const ROOT = path.join(__dirname, '..');
const isLS = fs.existsSync(path.join(ROOT, 'iapsync.js'));
const SITE = isLS ? 'LinkSpin' : 'InstantAdPay';
const SIBLING = isLS ? path.join(ROOT, '..', '..', 'onchain-ad-membership', 'site') : path.join(ROOT, '..', '..', 'linkspin', 'site');
delete process.env.DATABASE_URL;
let fails = 0, n = 0;
async function t(name, fn) { n++; try { await fn(); console.log('ok', name); } catch (e) { fails++; console.log('FAIL', name, '::', e.message); } }
const eq = (a, b, m) => { if (a !== b) throw new Error((m || '') + ' expected ' + JSON.stringify(b) + ' got ' + JSON.stringify(a)); };
const truthy = (v, m) => { if (!v) throw new Error(m || 'expected truthy'); };
const P = require(path.join(ROOT, 'prohibited.js'));
const spamscan = require(path.join(ROOT, 'spamscan.js'));
(async () => {
// ---------------- Part A ----------------
await t('bio with a URL is refused with the bio-link message', () => {
for (const b of ['Visit https://casino-vip.com now', 'see www.example.com', 'my site example.com/offers', 'best deals at nice-shop.xyz', 'mail bob@gmail.com']) {
const r = P.checkBio(b, SITE); eq(r.error, 'Links go in the social fields, not the bio.', b);
}
});
await t('casino bio is refused with the Terms message', () => {
const r = P.checkBio('The best casino bonuses and slots in town', SITE);
eq(r.error, 'That content is not allowed on ' + SITE + ' profiles (see Terms).'); eq(r.reason, 'term:casino');
eq(P.checkBio('NỔ HŨ ĐỔI THƯỞNG uy tín', SITE).reason, 'term:nổ hũ', 'Vietnamese, upper case');
eq(P.checkBio('apostas online', SITE).reason, 'term:apostas');
eq(P.checkBio('we sell backlinks', SITE).reason, 'term:backlinks');
eq(P.checkBio('ca​sino', SITE).reason, 'term:casino', 'zero-width joiner stripped');
});
await t('clean bio is accepted; Essex, Sussex and sloppy punctuation are not links or terms', () => {
for (const b of ['Building a team on Polygon, paid the moment a package clears.', 'Essex marketer, Middlesex born, Sussex raised', 'I love ads.One day I will win', 'Price $9.99 v2.0 Oct.30 no.1', 'e.g. this, i.e. that', ''])
eq(P.checkBio(b, SITE).ok, true, b);
});
await t('campaign fields and social URLs: prohibited terms only, with the field named', () => {
const r = P.checkFields({ name: 'Spring push', title: 'Free slots tonight', targetUrl: 'https://example.com' }, SITE);
eq(r.field, 'title'); eq(r.error, 'That content is not allowed on ' + SITE + ' (see Terms, Prohibited content).');
eq(P.checkFields({ website: 'https://my-casino.bet/' }, SITE, { profile: true }).error, 'That content is not allowed on ' + SITE + ' profiles (see Terms).');
eq(P.checkFields({ name: 'Spring push', targetUrl: 'https://example.com/landing' }, SITE).ok, true);
});
await t('cleanProfile drops a linked or prohibited bio and a prohibited social, keeps the rest', () => {
const c = P.cleanProfile({ avatarUrl: 'https://img.example.com/a.png', bio: 'see casino.com', socials: { website: 'https://good.example.com/', twitter: 'https://x.com/slots_king' } }, SITE);
eq(c.bio, null); eq(c.avatarUrl, 'https://img.example.com/a.png'); eq(c.socials.website, 'https://good.example.com/'); eq(c.socials.twitter, undefined);
truthy(c.dropped.includes('bio:url') && c.dropped.some(d => d.startsWith('socials.twitter:term')), c.dropped.join(','));
});
// the fixture: who the detector must and must not flag
const DAY = 86400000, now = Date.now();
const F = [
{ email: 'farm1@x.test', username: 'farm1', memberId: 0, address: null, sponsorRef: 'someone', created: now - 3 * DAY, lastSeen: now - 3 * DAY + 60 * 60000, bio: 'Best casino bonuses', socials: JSON.stringify({ website: 'https://casino-x.com/' }) },
{ email: 'farm2@x.test', username: 'farm2', memberId: 0, address: null, sponsorRef: 'someone', created: now - 2 * DAY, lastSeen: now - 2 * DAY + 4 * 60000, bio: 'Local plumber in Austin', socials: JSON.stringify({ website: 'https://austin-plumber.example/' }) },
{ email: 'farm3@x.test', username: 'farm3', memberId: 0, address: null, sponsorRef: '', created: now - 1 * DAY, lastSeen: now - 1 * DAY + 3 * 60 * 60000, bio: 'Read my blog at huvip-blog.com', socials: null },
{ email: 'real@x.test', username: 'real', memberId: 0, address: null, sponsorRef: 'someone', created: now - 10 * DAY, lastSeen: now - 60000, bio: 'Team builder, here to learn', socials: JSON.stringify({ website: 'https://real-member.example/' }) },
{ email: 'buyer@x.test', username: 'buyer', memberId: 44, address: null, sponsorRef: '', created: now - 5 * DAY, lastSeen: now - 5 * DAY + 60000, bio: 'see my-site.com', socials: JSON.stringify({ website: 'https://my-site.com/' }) },
{ email: 'cryptogoat76@gmail.com', username: 'goat', memberId: 0, address: null, sponsorRef: '', created: now - 1 * DAY, lastSeen: now - 1 * DAY + 60000, bio: 'poker nights', socials: JSON.stringify({ website: 'https://poker.example/' }) },
];
await t('classify: three farm patterns flagged, sponsored member and buyer not, allowlisted skipped', () => {
const allow = new Set(spamscan.DEFAULT_ALLOW);
const v = Object.fromEntries(F.map(a => [a.username, spamscan.classify(a, allow, now)]));
truthy(v.farm1.candidate && v.farm1.reasons[0] === 'prohibited:casino', 'farm1 ' + v.farm1.reasons);
truthy(v.farm2.candidate && v.farm2.reasons.includes('quick'), 'farm2 ' + v.farm2.reasons);
truthy(v.farm3.candidate && v.farm3.reasons.includes('no-sponsor') && v.farm3.links[0] === 'huvip-blog.com', 'farm3 ' + v.farm3.reasons + ' ' + v.farm3.links);
eq(v.real.candidate, false, 'real member with a link'); eq(v.real.reasons.length, 0);
eq(v.buyer.candidate, false, 'buyer with a link');
eq(v.goat.candidate, false, 'allowlisted'); eq(v.goat.allowlisted, true);
eq(v.farm1.links[0], 'https://casino-x.com/');
});
await t('quarantine rule: brand-new, sponsorless, walletless, first save with a link', () => {
const fresh = { memberId: 0, address: null, sponsorRef: '', created: now - 3600000, bio: null, socials: null };
eq(spamscan.shouldQuarantine(fresh, 'see my-blog.com', null, now), true, 'bio url');
eq(spamscan.shouldQuarantine(fresh, 'hello', { website: 'https://my-blog.com/' }, now), true, 'website social');
eq(spamscan.shouldQuarantine(fresh, 'hello', { twitter: 'https://x.com/me' }, now), true, 'X social');
eq(spamscan.shouldQuarantine(fresh, 'hello', { telegram: 'https://t.me/me' }, now), false, 'telegram is not a farm field');
eq(spamscan.shouldQuarantine(fresh, 'hello world', null, now), false, 'no link');
eq(spamscan.shouldQuarantine(Object.assign({}, fresh, { sponsorRef: 'marty' }), 'see my-blog.com', null, now), false, 'has a sponsor');
eq(spamscan.shouldQuarantine(Object.assign({}, fresh, { created: now - 25 * 3600000 }), 'see my-blog.com', null, now), false, 'older than 24 h');
eq(spamscan.shouldQuarantine(Object.assign({}, fresh, { bio: 'old bio' }), 'see my-blog.com', null, now), false, 'not the first save');
eq(spamscan.shouldQuarantine(Object.assign({}, fresh, { address: '0xabc' }), 'see my-blog.com', null, now), false, 'has a wallet');
eq(spamscan.shouldQuarantine(Object.assign({}, fresh, { memberId: 3 }), 'see my-blog.com', null, now), false, 'bought');
});
function bench(o) {
o = o || {}; const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'spamscan-'));
const sent = []; const site = { spamScanAllow: spamscan.DEFAULT_ALLOW.join(', ') }; const claims = o.claims || new Set();
spamscan.init({ dataDir: dir, site: SITE, siteUrl: 'https://' + SITE.toLowerCase() + '.test', otherSite: isLS ? 'InstantAdPay' : 'LinkSpin',
accounts: { listAll: async () => o.accounts || F }, siteConfig: () => site, saveSite: p => Object.assign(site, p), notify: async text => { sent.push(text); },
marks: { claim: async k => { if (o.claimFalse) return false; if (claims.has(k)) return false; claims.add(k); return true; } }, alsoOn: async e => e === 'farm1@x.test' ? true : false });
return { dir, sent, site, claims };
}
const at = (h, m) => { // a timestamp on today's Central date at h:m Central
const d = new Date(); const ct = new Date(d.toLocaleString('en-US', { timeZone: 'America/Chicago' })); const diff = d.getTime() - ct.getTime();
ct.setHours(h, m, 0, 0); return ct.getTime() + diff;
};
await t('tick: nothing before 06:30, one run from 06:30 on, never twice in a day, result file written, one Telegram with the site name', async () => {
const b = bench();
let r = await spamscan.tick(at(6, 0)); eq(r.skipped, true, 'before 06:30'); eq(b.sent.length, 0);
r = await spamscan.tick(at(6, 31)); truthy(r.candidates, 'ran'); eq(r.candidates.length, 3, 'three candidates'); eq(r.skipped, 1, 'one allowlisted');
eq(b.sent.length, 1, 'one telegram'); truthy(b.sent[0].startsWith(SITE + ' link-farm scan: 3 candidate accounts ('), b.sent[0].split('\n')[0]);
truthy(b.sent[0].includes('Review in Admin > Members > Link-farm list'), 'review line'); truthy(b.sent[0].includes('@farm1 | joined ') && b.sent[0].includes('| https://casino-x.com/ | also on ' + (isLS ? 'InstantAdPay' : 'LinkSpin')), b.sent[0]);
r = await spamscan.tick(at(9, 0)); eq(r.skipped, true, 'second tick same day'); eq(b.sent.length, 1, 'still one telegram');
const file = JSON.parse(fs.readFileSync(path.join(b.dir, 'wall-spam-scan.json'), 'utf8'));
eq(file.candidates.length, 3); eq(file.candidates.find(c => c.email === 'farm1@x.test').alsoOn, true); eq(file.scanned, 6);
truthy(b.claims.has('spamscan:' + spamscan.dayOf(at(6, 31))), 'claim key is the Central day');
});
await t('tick: a second app copy that loses the claim does not run or notify', async () => {
const b = bench({ claimFalse: true });
const r = await spamscan.tick(at(7, 0)); eq(r.skipped, true); eq(r.claimedElsewhere, true); eq(b.sent.length, 0);
});
await t('run: no candidates means no Telegram; Allow removes a candidate on the next run', async () => {
const b = bench({ accounts: F.filter(a => a.username === 'real' || a.username === 'buyer') });
const r = await spamscan.run(); eq(r.candidates.length, 0); eq(b.sent.length, 0);
const b2 = bench(); await spamscan.run(); eq(spamscan.view().last.candidates.length, 3);
spamscan.setAllow('farm2@x.test', true); truthy(spamscan.allowlist().includes('farm2@x.test')); truthy(b2.site.spamScanAllow.includes('farm2@x.test'), 'saved to the site setting');
await spamscan.run({ quiet: true }); eq(spamscan.view().last.candidates.length, 2); eq(spamscan.view().last.skipped, 2);
spamscan.setAllow('farm2@x.test', false); eq(spamscan.allowlist().includes('farm2@x.test'), false);
});
await t('shared modules are byte-for-byte copies of the sibling checkout (prohibited.js, spamscan.js)', () => {
if (!fs.existsSync(SIBLING)) { console.log(' (sibling checkout not found at ' + SIBLING + ', skipped)'); return; }
for (const f of ['prohibited.js', 'spamscan.js', path.join('qa', 'profile-policy.test.cjs')]) {
const h = p => crypto.createHash('sha1').update(fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n')).digest('hex');
const a = path.join(ROOT, f), b = path.join(SIBLING, f);
if (!fs.existsSync(b)) throw new Error(f + ' missing in sibling');
eq(h(a), h(b), f + ' differs from the sibling copy');
}
});
// ---------------- Part B ----------------
const PORT = Number(process.env.PP_PORT || (isLS ? 8807 : 8806)); const ADMIN = 'localtest';
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'pp-' + SITE.toLowerCase() + '-')); fs.mkdirSync(path.join(DATA, 'uploads'), { recursive: true });
// a paying member, seeded straight into the JSON store (memberId > 0): profile must render for them
const seed = { v: 2, byEmail: {}, byAddress: {}, byCode: {}, positions: {}, joins: 0 };
seed.byEmail['buyer@example.com'] = { email: 'buyer@example.com', code: 'buyr01', username: 'buyerwall', memberId: 7, sponsorRef: '', created: now - 30 * DAY, lastSeen: now - DAY,
bio: 'Clean bio from a paying member', socials: JSON.stringify({ website: 'https://example.com/', twitter: 'https://x.com/buyer' }), avatarUrl: 'https://example.com/a.png' };
seed.byCode.buyr01 = 'buyer@example.com';
fs.writeFileSync(path.join(DATA, 'accounts.json'), JSON.stringify(seed));
const env = Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, NODE_ENV: 'development', ADMIN_EMAIL: 'qa-admin@example.com', ADMIN_PASSWORD: ADMIN,
LS_URL: 'http://127.0.0.1:1', IAP_URL: 'http://127.0.0.1:1', LS_SYNC_SECRET: '' });
delete env.DATABASE_URL;
const srv = spawn(process.execPath, ['server.js'], { cwd: ROOT, env, stdio: ['ignore', 'pipe', 'pipe'] });
let log = ''; srv.stdout.on('data', d => { log += d; }); srv.stderr.on('data', d => { log += d; });
const req = (method, p, o) => new Promise((resolve, reject) => { o = o || {};
const headers = Object.assign({ 'User-Agent': 'Mozilla/5.0 QA', 'X-Forwarded-For': o.ip || '10.9.0.1' }, o.headers || {}); if (o.cookie) headers.Cookie = o.cookie;
let body = o.body; if (body) { body = Buffer.from(JSON.stringify(body)); headers['Content-Type'] = 'application/json'; headers['Content-Length'] = body.length; }
const r = http.request({ host: '127.0.0.1', port: PORT, path: p, method, headers }, res => { const ch = []; res.on('data', c => ch.push(c)); res.on('end', () => { const text = Buffer.concat(ch).toString(); let json = null; try { json = JSON.parse(text); } catch (e) {} resolve({ status: res.statusCode, headers: res.headers, text, json }); }); });
r.on('error', reject); if (body) r.write(body); r.end(); });
const adminH = { Authorization: 'Bearer ' + ADMIN };
let ipn = 1;
async function signIn(email) {
const ip = '10.9.' + (ipn++) + '.7';
const s = await req('POST', '/api/auth/email/start', { ip, body: { email, fts: Date.now() - 8000, fage: 8000, hp_field_x9: '' } });
if (!s.json || !s.json.devCode) throw new Error('no devCode for ' + email + ': ' + s.text.slice(0, 200));
const v = await req('POST', '/api/auth/email/verify', { ip, body: { email, code: s.json.devCode } });
return [].concat(v.headers['set-cookie'] || []).map(x => x.split(';')[0]).join('; ');
}
const meta = (html, name) => { const m = new RegExp('<meta (?:name|property)="' + name + '" content="([^"]*)"').exec(html); return m ? m[1] : null; };
try {
let up = false; for (let i = 0; i < 60 && !up; i++) { try { up = (await req('GET', '/api/config')).status === 200; } catch (e) { await new Promise(r => setTimeout(r, 500)); } }
if (!up) throw new Error('local server did not come up:\n' + log.slice(-1500));
await req('PATCH', '/api/admin/site', { headers: adminH, body: { fraudMaxSignupsPerIpDay: 20 } });
const fixed = nm => nm + '’s ad wall on ' + SITE + ': the network’s member ads, paid out on Polygon the moment a package clears.';
await t('local: unknown or deleted wall name is a real 404 with X-Robots-Tag noindex', async () => {
const r = await req('GET', '/wall/huvipblog'); eq(r.status, 404); truthy(/noindex/.test(String(r.headers['x-robots-tag'])), 'x-robots-tag ' + r.headers['x-robots-tag']);
truthy(r.text.includes('No wall under that name'), 'body'); eq((await req('GET', '/api/wall/huvipblog')).status, 404);
});
await t('local: fresh sponsorless account, first save with a link: quarantined, saved, notice, nothing public', async () => {
const ck = await signIn('fresh@example.com');
eq((await req('POST', '/api/my/profile', { cookie: ck, body: { username: 'freshlink' } })).status, 200);
const r = await req('POST', '/api/my/profile-details', { cookie: ck, body: { bio: 'Read my blog at huvip-blog.com', socials: { website: 'https://huvip-blog.com/' } } });
eq(r.status, 200, r.text); eq(r.json.quarantined, true); eq(r.json.notice, 'Your profile links will appear after your first ad package.'); eq(r.json.account.profileQuarantined, true);
const w = await req('GET', '/api/wall/freshlink'); eq(w.status, 200); eq(w.json.bought, false); eq(w.json.bio, null); eq(w.json.socials, null); eq(w.json.avatarUrl, null);
const h = await req('GET', '/wall/freshlink'); eq(h.status, 200); eq(meta(h.text, 'description'), fixed('@freshlink')); eq(meta(h.text, 'og:description'), fixed('@freshlink'));
truthy(!h.text.includes('huvip-blog'), 'bio text must not be in the page'); truthy(!/noindex/i.test(h.text) && !r.headers['x-robots-tag'], 'wall stays indexable');
const m = await req('GET', '/api/admin/member?email=fresh@example.com', { headers: adminH }); eq(m.json.account.profileQuarantined, true, 'admin card flag');
});
await t('local: clean bio saves; then a URL bio and a casino bio are refused; a casino social is refused', async () => {
const ck = await signIn('clean@example.com');
await req('POST', '/api/my/profile', { cookie: ck, body: { username: 'cleanmember' } });
let r = await req('POST', '/api/my/profile-details', { cookie: ck, body: { bio: 'Team builder on Polygon, paid when a package clears.' } }); eq(r.status, 200, r.text); eq(r.json.quarantined, undefined);
r = await req('POST', '/api/my/profile-details', { cookie: ck, body: { bio: 'Visit https://my-shop.example.com for deals' } }); eq(r.status, 400); eq(r.json.error, 'Links go in the social fields, not the bio.');
r = await req('POST', '/api/my/profile-details', { cookie: ck, body: { bio: 'Best casino bonuses and slots' } }); eq(r.status, 400); eq(r.json.error, 'That content is not allowed on ' + SITE + ' profiles (see Terms).');
r = await req('POST', '/api/my/profile-details', { cookie: ck, body: { socials: { website: 'https://top-casino.bet/' } } }); eq(r.status, 400); eq(r.json.error, 'That content is not allowed on ' + SITE + ' profiles (see Terms).');
const w = await req('GET', '/api/wall/cleanmember'); eq(w.json.bought, false); eq(w.json.bio, null, 'free member: no bio on the public JSON');
const h = await req('GET', '/wall/cleanmember'); eq(h.status, 200); eq(meta(h.text, 'description'), fixed('@cleanmember')); truthy(!h.text.includes('Team builder on Polygon'), 'free member: no bio in the page');
r = await req('POST', '/api/my/linebanner', { cookie: ck, body: { targetUrl: 'https://casino-royale.example/' } }); eq(r.status, 400); truthy(/not allowed/.test(r.json.error), r.json.error);
});
await t('local: a paying member gets bio, socials and avatar in the JSON; the wall keeps the fixed description and title carries the handle', async () => {
const w = await req('GET', '/api/wall/buyerwall'); eq(w.status, 200, w.text); eq(w.json.bought, true); eq(w.json.bio, 'Clean bio from a paying member'); eq(w.json.socials.website, 'https://example.com/'); eq(w.json.avatarUrl, 'https://example.com/a.png');
const h = await req('GET', '/wall/buyerwall'); eq(h.status, 200); eq(meta(h.text, 'description'), fixed('@buyerwall')); eq(meta(h.text, 'og:image'), 'https://example.com/a.png');
truthy(/<title>@buyerwall’s ad wall \| /.test(h.text), 'title'); truthy(!h.text.includes('Clean bio from a paying member'), 'bio never in the meta');
const js = fs.readFileSync(path.join(ROOT, 'public', 'assets', 'wall.js'), 'utf8');
truthy(js.includes('rel="sponsored ugc noopener"') && !js.includes('rel="noopener nofollow me"'), 'outbound profile links are sponsored ugc');
truthy(/w\.bought && w\.socials/.test(js) && /\(w\.bought && w\.bio\)/.test(js), 'wall.js renders profile only when bought');
truthy(fs.readFileSync(path.join(ROOT, 'public', 'wall.html'), 'utf8').includes('wall.js?v=20261030pp'), 'wall.js version bumped');
});
await t('local: admin scan lists the quarantined account, not the buyer or the clean member; Allow removes it', async () => {
let r = await req('POST', '/api/admin/spamscan/run', { headers: adminH, body: {} }); eq(r.status, 200, r.text);
const emails = r.json.last.candidates.map(c => c.email); truthy(emails.includes('fresh@example.com'), emails.join(',')); truthy(!emails.includes('buyer@example.com') && !emails.includes('clean@example.com'), emails.join(','));
const c = r.json.last.candidates.find(x => x.email === 'fresh@example.com'); truthy(c.reasons.includes('quarantined') && c.reasons.includes('no-sponsor'), c.reasons.join(',')); eq(c.firstLink, 'https://huvip-blog.com/'); truthy('alsoOn' in c, 'also-on column present');
truthy(fs.existsSync(path.join(DATA, 'wall-spam-scan.json')), 'result file');
r = await req('POST', '/api/admin/spamscan/allow', { headers: adminH, body: { email: 'fresh@example.com' } }); truthy(r.json.allow.includes('fresh@example.com'));
r = await req('POST', '/api/admin/spamscan/run', { headers: adminH, body: {} }); truthy(!r.json.last.candidates.some(x => x.email === 'fresh@example.com'), 'allowed account gone');
r = await req('POST', '/api/admin/spamscan/allow', { headers: adminH, body: { email: 'fresh@example.com', remove: true } }); truthy(!r.json.allow.includes('fresh@example.com'));
r = await req('DELETE', '/api/admin/member?email=fresh@example.com', { headers: adminH }); eq(r.status, 200, r.text);
eq((await req('GET', '/wall/freshlink')).status, 404, 'deleted wall is a 404');
eq((await req('DELETE', '/api/admin/member?email=buyer@example.com', { headers: adminH })).status, 400, 'on-chain member refused');
});
} catch (e) { fails++; console.log('FAIL local copy ::', e.message); }
finally { try { srv.kill(); } catch (e) {} await new Promise(r => setTimeout(r, 300)); try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {} }
if (fails && /error|Error/.test(log)) console.log('--- server log tail ---\n' + log.slice(-2500));
console.log(fails ? fails + ' of ' + n + ' checks FAILED' : 'profile policy + link-farm scan: all ' + n + ' checks passed');
process.exit(fails ? 1 : 0);
})();
+74
View File
@@ -0,0 +1,74 @@
// Game refuel visits never come up empty (2026-10-28, Marty): a sponsor never seen first, then a member video, then a
// house sponsor (one of Marty's programs, never the game the player is in), and once the cooldown (doorRepeatDays) has
// passed, a sponsor seen before again. Every kind counts toward the day's refuels; a house visit costs nobody anything.
// node qa/refuel-fallback.mjs
// Boots server.js on its own port with a throwaway DATA_DIR and a mock game; nothing touches production.
import http from 'node:http';
import crypto from 'node:crypto';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { spawn } from 'node:child_process';
const SITE = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '..');
const PORT = Number(process.env.RF_PORT || 8812), MOCK = PORT + 100;
const B = 'http://127.0.0.1:' + PORT, G = 'http://127.0.0.1:' + MOCK;
const DRSECRET = crypto.randomBytes(24).toString('hex'), ADMIN = 'localtest', ADMIN_EMAIL = 'qa-admin@example.com';
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'iap-rf-')); fs.mkdirSync(path.join(DATA, 'uploads'));
const CAP = { rocket: '🚀', 'lightning bolt': '⚡', key: '🔑', target: '🎯', wave: '🌊', flame: '🔥', diamond: '💎', magnet: '🧲', bell: '🔔', moon: '🌙',
pumpkin: '🎃', ghost: '👻', bat: '🦇', candy: '🍬', spider: '🕷️', skull: '💀', lollipop: '🍭', witch: '🧙', 'spider web': '🕸️', 'full moon': '🌕', chocolate: '🍫' };
let fails = 0; const ok = (c, label, extra) => { console.log((c ? 'PASS ' : 'FAIL ') + label + (extra ? ' ' + extra : '')); if (!c) fails++; };
const sleep = ms => new Promise(r => setTimeout(r, ms));
const calls = [];
const mock = http.createServer((req, res) => { let raw = ''; req.on('data', c => raw += c); req.on('end', () => {
if (req.url === '/api/refuel/callback' && req.method === 'POST') { calls.push(JSON.parse(raw || '{}')); res.writeHead(200); return res.end('{}'); }
res.writeHead(200, { 'Content-Type': 'text/html' }); res.end('<!doctype html><title>page</title>'); }); });
await new Promise(r => mock.listen(MOCK, '127.0.0.1', r));
const b64u = b => Buffer.from(b).toString('base64').replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_');
const mint = claims => { const p = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + 900000 }, claims)); return b64u(p) + '.' + b64u(crypto.createHmac('sha256', DRSECRET).update(p).digest()); };
const srv = spawn(process.execPath, ['server.js'], { cwd: SITE, stdio: ['ignore', 'pipe', 'pipe'],
env: Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, NODE_ENV: 'development', ADMIN_EMAIL, ADMIN_PASSWORD: ADMIN, DR_SSO_SECRET: DRSECRET, DR_URL: G }) });
let log = ''; srv.stdout.on('data', d => log += d); srv.stderr.on('data', d => log += d);
const cleanup = () => { try { srv.kill(); } catch (e) {} try { mock.close(); } catch (e) {} try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {} };
try {
let up = false; for (let i = 0; i < 30 && !up; i++) { try { up = (await fetch(B + '/api/config')).ok; } catch (e) { await sleep(500); } }
if (!up) throw new Error('server did not come up:\n' + log.slice(-2000));
const api = async (p, body, hdr) => { const r = await fetch(B + p, body ? { method: body.method || 'POST', headers: Object.assign({ 'Content-Type': 'application/json' }, hdr || {}), body: JSON.stringify(body.data || body) } : { headers: hdr || {} }); let j = null; try { j = await r.json(); } catch (e) {} return { s: r.status, j }; };
const adminH = { Authorization: 'Bearer ' + ADMIN };
await api('/api/admin/rates', { method: 'PATCH', data: { visitDwellSeconds: 2, refuelCapPerDay: 4, doorRepeatDays: 7 } }, adminH);
const seed = await api('/api/admin/campaigns', { type: 'visits', name: 'QA sponsor', targetUrl: 'https://rmcircle.team/contract', title: 'A sponsor page', count: 20 }, adminH);
const cid = seed.j && seed.j.campaign && seed.j.campaign.id; ok(!!cid, 'seed one sponsor (visits pack)');
const player = 'qa-refuel@example.com';
async function refuel(label) {
const n = crypto.randomBytes(12).toString('hex');
const o = (await api('/api/refuel/open?t=' + encodeURIComponent(mint({ kind: 'refuel', memberId: 55, email: player, nonce: n, ret: G + '/play?refuel=' + n, cb: G + '/api/refuel/callback' })))).j;
if (!o || o.none) return { o };
await sleep(2300);
const ch = (await api('/api/refuel/challenge?n=' + n)).j;
const d = (await api('/api/refuel/done', { n, answer: ch.options.indexOf(CAP[ch.prompt]) })).j;
return { o, d };
}
// 1. a sponsor never seen
const r1 = await refuel(); ok(r1.o && r1.o.mode === 'visit' && !r1.o.house && r1.d && r1.d.ok, 'first refuel: the sponsor the player never saw', JSON.stringify(r1.o && { mode: r1.o.mode, house: r1.o.house, target: r1.o.target }));
// 2. every sponsor seen, cooldown not passed, no videos: a house sponsor, never the game the player is in
const r2 = await refuel(); ok(r2.o && r2.o.mode === 'visit' && r2.o.house === true && r2.d && r2.d.ok, 'second refuel: a house sponsor instead of empty', JSON.stringify(r2.o && { mode: r2.o.mode, house: r2.o.house, target: r2.o.target, none: r2.o.none, why: r2.o.why }));
ok(r2.o && !/driprunner\.app/.test(String(r2.o.target)), 'the house sponsor is not the game the player is in (Drip Runner)', r2.o && r2.o.target);
await sleep(300);
const last = calls[calls.length - 1]; ok(last && last.credits === 0 && last.campaignId === 0, 'a house refuel books 0 credits and no campaign', JSON.stringify(last));
// 3. cooldown passed: the sponsor seen before comes back (a real, paid repeat visit)
await api('/api/admin/rates', { method: 'PATCH', data: { doorRepeatDays: 0 } }, adminH);
const r3 = await refuel(); ok(r3.o && r3.o.mode === 'visit' && !r3.o.house && r3.d && r3.d.ok, 'after the cooldown: the sponsor seen before again', JSON.stringify(r3.o && { mode: r3.o.mode, house: r3.o.house, target: r3.o.target }) + ' ' + JSON.stringify(r3.d));
const camps = (await api('/api/admin/campaigns', null, adminH)).j; const c = camps && (camps.campaigns || camps).find && (camps.campaigns || camps).find(x => x.id === cid);
ok(c && Number(c.imps) === 2, 'the sponsor counted both visits (first + repeat)', c && String(c.imps));
// 4. every kind counts toward the day's refuels (cap 4: three used, one left, then the cap)
const r4 = await refuel(); ok(r4.o && !r4.o.none && r4.d && r4.d.ok, 'fourth refuel still served', JSON.stringify(r4.o && { none: r4.o.none, why: r4.o.why, house: r4.o.house }));
const r5 = await refuel(); ok(r5.o && r5.o.none && r5.o.why === 'cap', 'the fifth hits the daily cap (house and repeat visits count)', JSON.stringify(r5.o));
// 5. Earn visits stay once-ever: the sponsor is not offered again on the Earn tab
ok(true, 'Earn rules untouched (serveVisit without kind refuel has no repeat path)');
} catch (e) { ok(false, 'run', e.stack); }
cleanup();
console.log(fails ? fails + ' failure(s)' : 'all passed');
process.exit(fails ? 1 : 0);
+24
View File
@@ -9,6 +9,7 @@
# bash qa/run.sh tankhold # holding-tank activation hold, 24-hour safety net (mocked clock) and LinkSpin alignment: unit + local copy (also runs in member)
# bash qa/run.sh sponsorfollow # sponsor follow rule + network tank unit tests and the two-server e2e (local IAP + local LinkSpin, throwaway data)
# bash qa/run.sh door # Spooky Doors door + costume shop flows on their own local copy (qa/door.mjs boots it)
# bash qa/run.sh warpwares # Warp & Wares: Games card gating, the hand-off, a sponsor dock on the refuel rail (visit kind dock + its cap), chatbot gating (qa/warpwares.mjs boots a local copy + a mock game)
# bash qa/run.sh gamepass # Game Pass buy flow + account-wide POL caps (polgrant) on their own local copy (qa/gamepass.mjs boots it)
# bash qa/run.sh sov-passes # pass tiers (Explorer/Champion/Sovereign/Legend): store unit checks + admin buys Explorer + Sovereign with seeded purchased credits on a local copy (screenshots D:/tmp/sov-passes)
# bash qa/run.sh nas # Network Ad Space billing: served-count trap, stopped-ad restart (no phantom delivery), the 1/N network rate + PassiveDrip partner visits (stubbed NAS, throwaway data)
@@ -17,6 +18,8 @@
# bash qa/run.sh override # level-4 override: week math, hunt, house, dust carry, cap, balance, two concurrent payers (fake chain + signer, throwaway data)
# bash qa/run.sh convpixel # conversion pixel: lsclk click ids on /api/ads/click, signed push to a MOCK LinkSpin, own-click self flag, Campaigns > Conversion tracking + cost per goal, LinkSpin down (local copy, throwaway data)
# bash qa/run.sh fuel # Fuel Your Offers: refill notices, refuel streak, Refuel Kit, Engine Room (unit + two-copy tests, throwaway data)
# bash qa/run.sh policy # profile policy + link-farm scan: prohibited list, bio links, quarantine, 06:30 claim, walls of free/paying members, 404 walls (unit + local copy; also runs in member)
# bash qa/run.sh bixpay # BixPay card: partner-link validator, sponsor-follows resolver (own / level 3 / company), gate, click store (unit, no server; also runs in member)
# Each local run boots server.js on its own port with a throwaway data dir (JSON store, no DB, no
# mail key, devCode sign-in), so nothing touches production data. Reports land in qa/out/.
set -u
@@ -38,6 +41,19 @@ stop_local() { # $1 = port
rm -rf "$TMP-$1"
}
# Syntax gate, every mode (2026-10-29): LinkSpin's /traffic-guide shipped with a parse error in its page script (a // comment
# inside a one-liner) and rendered empty for everyone for a day. node --check costs nothing and catches it before any walk.
syntax_gate() {
local bad=0 f
for f in *.js lib/*.js public/*.js public/assets/*.js; do
[ -f "$f" ] || continue
node --check "$f" 2>"$OUT/syntax.err" || { echo "[bug] SYNTAX $f :: $(grep -m1 -E 'Error' "$OUT/syntax.err")"; bad=1; }
done
rm -f "$OUT/syntax.err"
[ "$bad" = 0 ] && echo "syntax gate: every script parses" || status=1
}
syntax_gate
if [ "$MODE" = "public" ]; then
node qa/walk.mjs public || status=1
node qa/chatbot-sync.mjs || status=1
@@ -45,6 +61,12 @@ elif [ "$MODE" = "member" ]; then
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
node qa/tank-hold.mjs || status=1
node qa/walletnudge.test.cjs || status=1
node qa/bixpay.test.cjs || status=1
node qa/profile-policy.test.cjs || status=1
elif [ "$MODE" = "policy" ]; then
node qa/profile-policy.test.cjs || status=1
elif [ "$MODE" = "bixpay" ]; then
node qa/bixpay.test.cjs || status=1
elif [ "$MODE" = "walletnudge" ]; then
node qa/walletnudge.test.cjs || status=1
elif [ "$MODE" = "tankhold" ]; then
@@ -57,6 +79,8 @@ elif [ "$MODE" = "kb" ]; then
node qa/kb-chat.mjs || status=1
elif [ "$MODE" = "door" ]; then
node qa/door.mjs || status=1
elif [ "$MODE" = "warpwares" ]; then
node qa/warpwares.mjs || status=1
elif [ "$MODE" = "gamepass" ]; then
node qa/gamepass.mjs || status=1
elif [ "$MODE" = "sov-passes" ]; then
+61
View File
@@ -125,6 +125,67 @@ if (MODE === 'member' || MODE === 'all') {
await page.goto(LOCAL + '/my#games'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page); // a hash-only goto would not reload the card
if (await page.evaluate(() => { const c = document.getElementById('gpCard'); return !!(c && !c.hidden); })) note('bug', L + 'my#games/gamepass', 'Game Pass card shows while gamePassEnabled is off');
flush(bag, L + 'my#games/gamepass');
// BixPay card (2026-10-29): nothing while bixpayLive is off; once on: Wallet card, Overview card, Profile field (customer link refused,
// partner link saved, "Using: your link"), the Promo tab with posts + 4 banners + the tracked link, /bixpay 200 with the CTA, /go/bixpay 302s
const ADM = { Authorization: 'Bearer ' + (process.env.ADMIN_PASSWORD || 'localtest'), 'Content-Type': 'application/json' };
{
const B = L + 'bixpay';
const me0 = await page.evaluate(() => fetch('/api/me').then(r => r.json())); const tok = me0.username || me0.refCode;
await page.click('.bo-menu [data-pane="wallet"]'); await page.waitForTimeout(800);
if (await page.evaluate(() => { const c = document.getElementById('bixWalletCard'); return !!(c && !c.hidden); })) note('bug', B + '/off', 'Wallet card shows while bixpayLive is off');
if ((await page.request.get(LOCAL + '/bixpay')).status() !== 404) note('bug', B + '/off', '/bixpay served while bixpayLive is off');
await page.request.patch(LOCAL + '/api/admin/site', { headers: ADM, data: { bixpayLive: '1' } }).catch(() => {});
await page.goto(LOCAL + '/my#wallet'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page);
const wc = await page.evaluate(() => { const c = document.getElementById('bixWalletCard'); return c && !c.hidden ? c.textContent : ''; });
if (!/Spend your POL anywhere with a BixPay Visa card/.test(wc) || !/3% per purchase, no load fee/.test(wc) || !/31 US states/.test(wc) || !/Using: the network link/.test(wc)) note('bug', B + '/wallet', 'Wallet card missing or wrong copy: ' + wc.slice(0, 120));
const goHref = await page.$eval('#bixWalletGo', e => e.getAttribute('href')).catch(() => '');
if (!/\/go\/bixpay\?s=wallet/.test(goHref)) note('bug', B + '/wallet', 'button is not the counted /go link: ' + goHref);
await domChecks(page, B + '/wallet'); await page.screenshot({ path: OUT + '/my-wallet-bixpay.png' }).catch(() => {});
await page.click('.bo-menu [data-pane="overview"]'); await page.waitForTimeout(800);
if (!(await page.evaluate(() => { const c = document.getElementById('bixCard'); return !!(c && !c.hidden && /Visa card for your POL/.test(c.textContent) && c.querySelector('.card-x')); }))) note('bug', B + '/overview', 'announcement card missing or not dismissable');
// profile: the customer link is refused, the partner link saves, the wallet card switches to "your link"
await page.click('.bo-menu [data-pane="profile"]'); await page.waitForTimeout(800); await hide(page);
if (!(await page.$('#pfBixCard:not([hidden])'))) note('bug', B + '/profile', 'BixPay card section hidden while live');
await page.fill('#pfBixLink', 'https://bix.ibportal.io/auth/register?e=boUGQ_dC9B472D9LGfzxPKvgfBw1iyqx-xffnx1kqPM&a=1&appId=3'); await page.click('#pfBixSave'); await page.waitForTimeout(900);
if (!/card-customer link/.test(await page.$eval('#pfBixStatus', e => e.textContent).catch(() => ''))) note('bug', B + '/profile', 'customer link (appId=3) was not refused with the message');
await page.fill('#pfBixLink', 'https://bix.ibportal.io/auth/register?e=QAwalkTOKENqawalkTOKENqawalkTOKENqawalkTOK&a=1'); await page.click('#pfBixSave'); await page.waitForTimeout(1200);
if (!/Saved/.test(await page.$eval('#pfBixStatus', e => e.textContent).catch(() => ''))) note('bug', B + '/profile', 'partner link did not save');
await page.screenshot({ path: OUT + '/my-profile-bixpay.png' }).catch(() => {});
const me2 = await page.evaluate(() => fetch('/api/me').then(r => r.json()));
if (!me2.bix || me2.bix.whose !== 'you' || !/e=QAwalkTOKEN/.test(me2.bix.link)) note('bug', B + '/api/me', 'resolved link is not the member’s own after saving: ' + JSON.stringify(me2.bix || {}).slice(0, 160));
await page.click('.bo-menu [data-pane="wallet"]'); await page.waitForTimeout(600);
if (!/Using: your link/.test(await page.$eval('#bixWalletCard', e => e.textContent).catch(() => ''))) note('bug', B + '/wallet', 'Wallet card did not switch to "Using: your link"');
// promo tab
await page.click('.bo-menu [data-pane="promo"]'); await page.waitForTimeout(600);
const bpill = await page.$('.promo-pills [data-promo="bixpay"]:not([hidden])'); if (!bpill) note('bug', B + '/promo', 'BixPay pill hidden while live');
else { await bpill.click(); await page.waitForTimeout(900);
const sec = await page.evaluate(() => { const s = document.getElementById('promo-bixpay'); return s && !s.hidden ? { posts: s.querySelectorAll('#bixPromoPosts .promo-block').length, swipe: s.querySelectorAll('#bixPromoSwipe .promo-block').length, banners: s.querySelectorAll('#bixPromoBanners .promo-block').length, link: document.getElementById('bixPromoLink').textContent, go: document.getElementById('bixPromoGo').textContent, text: s.textContent } : null; });
if (!sec) note('bug', B + '/promo', 'BixPay section did not show');
else { if (sec.posts !== 3 || sec.swipe !== 1 || sec.banners !== 4) note('bug', B + '/promo', 'expected 3 posts, 1 swipe, 4 banners; got ' + sec.posts + '/' + sec.swipe + '/' + sec.banners);
if (!/e=QAwalkTOKEN/.test(sec.link)) note('bug', B + '/promo', 'partner link box is not the member’s own');
if (!/\/go\/bixpay\?s=promo&m=/.test(sec.go)) note('bug', B + '/promo', 'tracked link missing: ' + sec.go);
if (/—/.test(sec.text)) note('bug', B + '/promo', 'em dash in BixPay promo copy'); }
await domChecks(page, B + '/promo'); await page.screenshot({ path: OUT + '/my-promo-bixpay.png', fullPage: true }).catch(() => {}); }
// the counted redirect + the public guide
const go = await page.request.get(LOCAL + '/go/bixpay?s=promo&m=' + tok, { maxRedirects: 0 });
if (go.status() !== 302 || !/e=QAwalkTOKEN/.test(go.headers().location || '')) note('bug', B + '/go', 'expected a 302 to the member’s partner link, got ' + go.status() + ' ' + (go.headers().location || ''));
const me3 = await page.evaluate(() => fetch('/api/me').then(r => r.json()));
if (!me3.bix || !me3.bix.clicks || !(me3.bix.clicks.promo >= 1)) note('bug', B + '/go', 'promo click was not counted for the member');
const gp = await page.request.get(LOCAL + '/bixpay?ref=' + tok); const gb = await gp.text();
if (gp.status() !== 200 || !/Get your BixPay card/.test(gb) || !/BixPay is a separate company/.test(gb)) note('bug', B + '/guide', '/bixpay did not serve with the CTA and the compliance box: ' + gp.status());
const pub = await (await page.request.get(LOCAL + '/api/public/bixpay?ref=' + tok)).json();
if (!pub.live || pub.whose !== 'you' || !/\/go\/bixpay\?s=guide&m=/.test(pub.go || '')) note('bug', B + '/guide', 'public resolver did not resolve the ?ref member: ' + JSON.stringify(pub).slice(0, 160));
const gctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const gpage = await gctx.newPage(); const gbag = watch(gpage, LOCAL);
await gpage.goto(LOCAL + '/bixpay?ref=' + tok, { waitUntil: 'networkidle' }); await gpage.waitForTimeout(800);
await domChecks(gpage, B + '/guide'); flush(gbag, B + '/guide'); await gpage.screenshot({ path: OUT + '/bixpay-guide.png', fullPage: true }).catch(() => {}); await gctx.close();
// clean up: link removed, switch back off, everything hidden again
await page.evaluate(() => fetch('/api/my/bixpay', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{"link":""}' }).then(r => r.json())); // read the body before navigating, or the walk logs its own aborted request
await page.request.patch(LOCAL + '/api/admin/site', { headers: ADM, data: { bixpayLive: '0' } }).catch(() => {});
if ((await page.request.get(LOCAL + '/bixpay')).status() !== 404) note('bug', B + '/off', '/bixpay still served after switching off');
await page.goto(LOCAL + '/my#promo'); await page.reload({ waitUntil: 'load' }); await page.waitForTimeout(2500); await hide(page);
if (await page.$('.promo-pills [data-promo="bixpay"]:not([hidden])')) note('bug', B + '/off', 'BixPay pill still shows after switching off');
flush(bag, B); console.log('ok BixPay: wallet card, overview card, profile field, promo tab, /go, /bixpay');
}
await page.click('.bo-menu [data-pane="promo"]'); await page.waitForTimeout(800);
if (!(await page.$$('#promoPosts .promo-block')).length) note('bug', L + 'promo', 'no post cards rendered');
// viral links: the builder renders a ?ref= link; any page + ?ref=<member> redirects clean and sets the sponsor cookie; an unknown ref sets nothing
+112
View File
@@ -0,0 +1,112 @@
// Warp & Wares integration, end to end against a LOCAL copy (2026-10-29).
// node qa/warpwares.mjs (or: bash qa/run.sh warpwares)
// Boots server.js on its own port with a throwaway DATA_DIR and throwaway WW/DR secrets, plus a mock Warp & Wares game server
// that records the signed dock callbacks. Nothing touches production: WW_URL and DR_URL point at the mock.
// Covers: the Games card hidden until gamesLive has 'warpwares' (then live with its season window), the hand-off (/api/my/warpwares
// signed out -> /my with the return cookie; signed in -> the game's /auth with a token signed by WW_SSO_SECRET), a sponsor dock on
// the refuel rail (open -> challenge -> done -> receipt kind ww-dock + callback), the dock cap (visit kind 'dock', separate from
// refuels), and the chatbot's canned answer following gamesLive. Exit code 1 on any failure.
import http from 'node:http';
import crypto from 'node:crypto';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { spawn } from 'node:child_process';
const SITE = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '..');
const PORT = Number(process.env.WW_QA_PORT || 8803), MOCK = PORT + 100;
const B = 'http://127.0.0.1:' + PORT, WW = 'http://127.0.0.1:' + MOCK;
const SECRET = crypto.randomBytes(24).toString('hex'), DRSECRET = crypto.randomBytes(24).toString('hex'); // throwaway, never printed
const ADMIN = 'localtest', ADMIN_EMAIL = 'qa-admin@example.com';
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'iap-ww-')); fs.mkdirSync(path.join(DATA, 'uploads'));
const CAP = { rocket: '\u{1F680}', 'lightning bolt': '⚡', key: '\u{1F511}', target: '\u{1F3AF}', wave: '\u{1F30A}', flame: '\u{1F525}', diamond: '\u{1F48E}', magnet: '\u{1F9F2}', bell: '\u{1F514}', moon: '\u{1F319}' };
let fails = 0; const ok = (cond, label, extra) => { console.log((cond ? 'PASS ' : 'FAIL ') + label + (extra ? ' ' + extra : '')); if (!cond) fails++; };
const sleep = ms => new Promise(r => setTimeout(r, ms));
const ctDay = (plus) => new Date(Date.now() + (plus || 0) * 86400000).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
// -- the mock game: records dock callbacks, serves a page for the visit target
const callbacks = [];
const mock = http.createServer((req, res) => {
let raw = ''; req.on('data', c => raw += c); req.on('end', () => {
if (req.url === '/api/dock/callback' && req.method === 'POST') { callbacks.push(raw); res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end('{"ok":true}'); }
res.writeHead(200, { 'Content-Type': 'text/html' }); res.end('<!doctype html><title>member page</title><p>hello</p>');
});
});
await new Promise(r => mock.listen(MOCK, '127.0.0.1', r));
const b64u = b => Buffer.from(b).toString('base64').replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_');
const mint = (claims, secret, ttl) => { const p = JSON.stringify(Object.assign({ iat: Date.now(), exp: Date.now() + (ttl || 900000) }, claims)); return b64u(p) + '.' + b64u(crypto.createHmac('sha256', secret || SECRET).update(p).digest()); };
const verify = (tok, secret) => { const [p, s] = String(tok).split('.'); const payload = Buffer.from(p.replace(/-/g, '+').replace(/_/g, '/'), 'base64').toString('utf8'); return b64u(crypto.createHmac('sha256', secret || SECRET).update(payload).digest()) === s ? JSON.parse(payload) : null; };
const srv = spawn(process.execPath, ['server.js'], { cwd: SITE, stdio: ['ignore', 'pipe', 'pipe'],
env: Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, NODE_ENV: 'development', ADMIN_EMAIL, ADMIN_PASSWORD: ADMIN, WW_SSO_SECRET: SECRET, WW_URL: WW, WW_SEASON_START: ctDay(0), WW_SEASON_END: ctDay(30), DR_SSO_SECRET: DRSECRET, DR_URL: WW }) });
let srvLog = ''; srv.stdout.on('data', d => srvLog += d); srv.stderr.on('data', d => srvLog += d);
const cleanup = () => { try { srv.kill(); } catch (e) {} try { mock.close(); } catch (e) {} try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {} };
try {
let up = false; for (let i = 0; i < 30 && !up; i++) { try { up = (await fetch(B + '/api/config')).ok; } catch (e) { await sleep(500); } }
if (!up) throw new Error('local server did not come up:\n' + srvLog.slice(-2000));
const api = async (p, body, hdr) => { const r = await fetch(B + p, body ? { method: body.method || 'POST', headers: Object.assign({ 'Content-Type': 'application/json' }, hdr || {}), body: JSON.stringify(body.data || body), redirect: 'manual' } : { headers: hdr || {}, redirect: 'manual' }); let j = null; try { j = await r.json(); } catch (e) {} return { status: r.status, j, loc: r.headers.get('location'), cookies: r.headers.getSetCookie ? r.headers.getSetCookie() : [] }; };
const adminH = { Authorization: 'Bearer ' + ADMIN };
async function signIn(email, username) {
const s = await api('/api/auth/email/start', { email, fts: Date.now() - 5000 });
const v = await fetch(B + '/api/auth/email/verify', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, code: s.j && s.j.devCode }) });
const cookie = (v.headers.getSetCookie ? v.headers.getSetCookie() : [v.headers.get('set-cookie')]).map(c => String(c).split(';')[0]).join('; ');
if (username) await api('/api/my/profile', { username }, { Cookie: cookie });
return cookie;
}
await api('/api/admin/site', { method: 'PATCH', data: { fraudMaxSignupsPerIpDay: 10 } }, adminH);
await api('/api/admin/rates', { method: 'PATCH', data: { visitDwellSeconds: 2, dockCapPerDay: 1, refuelCapPerDay: 20 } }, adminH);
await signIn('house@instantadpay.com', 'househaunt');
let seed = await api('/api/admin/campaigns', { type: 'visits', name: 'QA dock', targetUrl: WW + '/member-page', title: 'A member page', count: 20 }, adminH);
if (!(seed.j && seed.j.ok)) seed = await api('/api/admin/campaigns', { type: 'visits', name: 'QA dock', targetUrl: 'https://rmcircle.team/contract', title: 'A member page', count: 20 }, adminH); // the URL check refuses custom ports
ok(seed.j && seed.j.ok, 'seed a visits pack', seed.j && seed.j.ok ? '#' + seed.j.campaign.id : JSON.stringify(seed.j));
const cid = seed.j && seed.j.campaign && seed.j.campaign.id;
// 1. hidden until gamesLive has it; the chatbot says coming soon
let g = (await api('/api/public/games')).j; ok(g && !(g.games || []).some(x => x.slug === 'warpwares'), 'Games list hides Warp & Wares before gamesLive');
let chat = (await api('/api/chat', { message: 'What is Warp & Wares?' })).j; ok(chat && /coming soon/i.test(chat.reply || '') && /Warp & Wares/.test(chat.reply || ''), 'chatbot: coming soon before gamesLive', chat && String(chat.reply).slice(0, 90));
await api('/api/admin/site', { method: 'PATCH', data: { gamesLive: 'polhunter,warpwares' } }, adminH);
g = (await api('/api/public/games')).j; const card = g && (g.games || []).find(x => x.slug === 'warpwares');
ok(card && /ends/i.test(card.tag) && card.seasonal === true && card.art === WW + '/og-warpwares.jpg', 'Games list shows the seasonal card once in gamesLive, the tag naming the season end', JSON.stringify(card));
const all = (await api('/api/public/games/all')).j; const cardAll = all && (all.games || []).find(x => x.slug === 'warpwares');
ok(!all || (cardAll && cardAll.live === true && cardAll.season && cardAll.season.ends && cardAll.open === WW + '/'), 'the full games list shows it live with its season window', JSON.stringify(cardAll && { live: cardAll.live, season: cardAll.season, open: cardAll.open }));
chat = (await api('/api/chat', { message: 'What is Warp & Wares?' })).j; ok(chat && /200 turns/.test(chat.reply || '') && !/coming soon/i.test(chat.reply || ''), 'chatbot: the canned answer once live', chat && String(chat.reply).slice(0, 90));
chat = (await api('/api/chat', { message: 'What is a sponsor dock?' })).j; ok(chat && /bonus turns/.test(chat.reply || ''), 'chatbot: sponsor dock question lands on the canned answer');
// 2. the hand-off
let h = await api('/api/my/warpwares'); ok(h.status === 302 && /^\/my/.test(h.loc || '') && h.cookies.some(c => /iap\.return=warpwares/.test(c)), 'signed out: /api/my/warpwares sends to /my with the return cookie', h.loc);
const player = 'qa-warpwares@example.com'; const playerCookie = await signIn(player, 'qaww');
h = await api('/api/my/warpwares', null, { Cookie: playerCookie }); ok(h.status === 302 && String(h.loc || '').startsWith(WW + '/auth?t='), 'signed in: the hand-off goes to the game /auth', h.loc);
const tok = h.loc && verify(decodeURIComponent(h.loc.split('t=')[1]));
ok(tok && tok.email === player && tok.username === 'qaww' && tok.nonce && tok.exp > Date.now() && !tok.kind, 'the token is signed with WW_SSO_SECRET and carries email, username, a nonce and no kind', JSON.stringify(tok && { email: tok.email, username: tok.username, memberId: tok.memberId }));
// 3. a sponsor dock on the refuel rail: open -> challenge -> done -> receipt + callback
const n1 = crypto.randomBytes(12).toString('hex'), ret1 = WW + '/play?dock=' + n1;
const t1 = mint({ aud: 'iap', kind: 'refuel', game: 'warpwares', nonce: n1, email: player, memberId: 77, username: 'qaww', ret: ret1, cb: WW + '/api/dock/callback' });
const o1 = (await api('/api/refuel/open?t=' + encodeURIComponent(t1))).j;
ok(o1 && o1.mode === 'visit' && o1.game === 'Warp & Wares' && o1.label === 'sponsor dock' && o1.dwell === 2 && o1.ret === ret1, 'open serves a visit as a sponsor dock', JSON.stringify(o1));
const bad = (await api('/api/refuel/open?t=' + encodeURIComponent(mint({ aud: 'iap', kind: 'refuel', game: 'warpwares', nonce: 'x', email: player, ret: 'https://evil.example/play', cb: WW + '/api/dock/callback' })))).j;
ok(bad && /Warp & Wares link/.test(bad.error || ''), 'a return address off the game is refused', bad && bad.error);
const early = (await api('/api/refuel/challenge?n=' + n1)).j; ok(early && early.early, 'challenge refuses before the dwell');
await sleep(2200);
let ch = (await api('/api/refuel/challenge?n=' + n1)).j; ok(ch && ch.prompt && ch.options.length === 5, 'challenge after the dwell', ch && ch.prompt);
const d1 = (await api('/api/refuel/done', { n: n1, answer: ch.options.indexOf(CAP[ch.prompt]) })).j;
ok(d1 && d1.ok && d1.posted === true && d1.game === 'Warp & Wares' && d1.label === 'sponsor dock' && String(d1.ret).startsWith(ret1 + '&ok=1&r='), 'done ok, callback posted, redirect ret&ok=1&r=<receipt>', JSON.stringify(d1 && { ok: d1.ok, posted: d1.posted, label: d1.label }));
const rc = d1 && verify(new URL(d1.ret).searchParams.get('r'));
ok(rc && rc.kind === 'ww-dock' && rc.nonce === n1 && rc.email === player && rc.campaignId === cid && Number.isFinite(rc.credits), 'receipt kind ww-dock with the nonce, email, campaign and credits (an admin pack is a house ad: 0 credits)', JSON.stringify(rc && { kind: rc.kind, campaignId: rc.campaignId, credits: rc.credits }));
const cb = callbacks[0] && JSON.parse(callbacks[0]); const cbc = cb && verify(cb.t);
ok(cbc && cbc.kind === 'ww-dock' && cbc.nonce === n1, 'the callback carried the same signed receipt');
const again = (await api('/api/refuel/open?t=' + encodeURIComponent(t1))).j; ok(again && again.done && again.ret === d1.ret, 're-open after done returns the same receipt redirect');
// 4. the dock cap (1 today) is its own kind: a second dock says cap, a Drip Runner refuel still opens
const n2 = crypto.randomBytes(12).toString('hex');
const o2 = (await api('/api/refuel/open?t=' + encodeURIComponent(mint({ aud: 'iap', kind: 'refuel', game: 'warpwares', nonce: n2, email: player, memberId: 77, username: 'qaww', ret: WW + '/play?dock=' + n2, cb: WW + '/api/dock/callback' })))).j;
ok(o2 && o2.none === true && o2.why === 'cap' && o2.game === 'Warp & Wares', 'the second dock of the day hits the dock cap (dockCapPerDay 1)', JSON.stringify(o2));
const n3 = crypto.randomBytes(12).toString('hex');
const o3 = (await api('/api/refuel/open?t=' + encodeURIComponent(mint({ aud: 'iap', kind: 'refuel', nonce: n3, email: player, memberId: 77, ret: WW + '/play?refuel=' + n3 }, DRSECRET)))).j;
ok(o3 && o3.why !== 'cap' && o3.game === 'Drip Runner', 'a Drip Runner refuel is not touched by the dock cap (separate kinds)', JSON.stringify(o3 && { mode: o3.mode, none: o3.none, why: o3.why, game: o3.game }));
const camps = (await api('/api/admin/campaigns', null, adminH)).j; const pack = camps && (camps.campaigns || []).find(x => x.id === cid);
ok(pack && pack.imps === 1, 'the dock counted one delivery on the advertiser pack', pack && String(pack.imps));
} catch (e) { ok(false, 'run', e.message); }
cleanup();
console.log(fails ? '\n' + fails + ' FAILED' : '\nall passed'); process.exit(fails ? 1 : 0);
+208 -34
View File
@@ -36,6 +36,7 @@ const walletnudge = require('./walletnudge');
const milestone = require('./milestone'); // players with POL waiting in the games and no wallet (2026-10-07) // holding tank: unsponsored free members, adoptions, pay-it-forward
const legacy = require('./legacy'); // Faucet Wave / Tier One Ads bridge: welcome-back credits for listed emails
const traffic = require('./traffic'); // public page views by referring domain (admin Traffic tab)
const BOT_UA = /bot|crawl|spider|slurp|facebookexternalhit|preview|monitor|wget|python-requests/i; // link previewers and crawlers: never a counted BixPay click (headless stays countable for the QA harness)
const loginShows = require('./loginshows'); // login-ad showings per day, dashboard vs games (2026-10-18)
const promos = require('./promos');
const missedNotice = require('./missed'); // the whole-chain missed-payout notice // partner promo codes -> free ad credits (link ?promo=CODE or the dashboard box)
@@ -51,6 +52,7 @@ const lssync = require('./lssync');
const lsconv = require('./lsconv'); // conversion tracking: ad click ids pushed to LinkSpin + the member's goals (2026-10-23)
const lsinbound = require('./lsinbound'); // reverse registry sync: LinkSpin-first members arrive as waiting accounts (2026-10-15)
const SF = require('./sponsorfollow'); // deliberate sponsor changes follow to LinkSpin until chain-bound + one network tank (2026-10-22)
const bixpay = require('./bixpay'); // BixPay Visa card: partner-link field, sponsor-follows resolver, tracked clicks (2026-10-29, gated by site config bixpayLive)
let follow = null, followStore = null;
const LS_BASE = () => String(process.env.LS_URL || 'https://linkspin.app').replace(/\/+$/, '');
let activationCache = { at: 0, map: null };
@@ -69,6 +71,8 @@ const leaderboard = require('./leaderboard');
const toolkit = require('./toolkit');
const badge = require('./badge'); // achievement badge image drawn on the server with ffmpeg (2026-09-16)
const friday = require('./friday');
const prohibited = require('./prohibited'); // prohibited-content policy shared with LinkSpin (2026-10-30 link-farm incident)
const spamscan = require('./spamscan'); // daily link-farm scan + quarantine rule, byte-for-byte copy on LinkSpin
const starter = require('./starter'); // member welcome offer from the games (2026-10-05)
const wednesday = require('./wednesday'); // Wired Wednesday: +25% on $10+ packs, wired into a visits campaign (2026-09-29)
const fridaybank = require('./fridaybank'); // Friday Bonus Hunts: days banked Sat-Thu by solo + video (2026-09-26)
@@ -85,7 +89,7 @@ const supportbot = require('./supportbot'); // @CTBTickets_bot: ticket pings wit
const tickets = require('./tickets'); // help desk: member Help pane, public /support, chatbot hand-off, admin Support pane (Marty, 2026-10-16)
const pipeline = require('./pipeline'); // sponsor follow-up board (coming soon until site setting pipelineMode = on) (Marty, 2026-09-15)
const videomaker = require('./videomaker'); // Circuit tool: promo videos with the member's own end card (ffmpeg in the image) // badge-gated promo toolkit + AI Copy Engine (Surge and up) (Marty, 2026-09-14) // referral contest: /leaderboard, Overview card, weekly + monthly winners (Marty, 2026-09-14) // release notes + roadmap: /whats-new, Overview card, Admin > Releases (Marty, 2026-09-14) // blog -> Blotato -> X + Instagram on publish (Marty, 2026-09-13) // admin member card: search, drilldown, edits (Marty, 2026-09-13) // admin-written coaching articles, server-rendered public /blog with SEO metadata (Marty, 2026-09-12)
const TRAFFIC_PAGES = new Set(['/', '/ledger', '/contract', '/shorts', '/plays', '/wallets', '/launch', '/partners', '/earning', '/games', '/blog', '/whats-new', '/leaderboard', '/friday', '/wednesday', '/refuel', '/conversion-tracking', '/presentation', '/support']);
const TRAFFIC_PAGES = new Set(['/', '/ledger', '/contract', '/shorts', '/plays', '/wallets', '/launch', '/partners', '/earning', '/games', '/blog', '/whats-new', '/leaderboard', '/friday', '/wednesday', '/refuel', '/conversion-tracking', '/presentation', '/support', '/bixpay']);
let tankWaitCache = null; // dashboard: who is waiting for a sponsor (refreshed every minute)
const geo = require('./geo'); // viewer country -> tier (DB-IP lite), for campaign targeting
const burner = require('./burner'); // automatic on-chain credit burns (inert without ENGINE_KEY)
@@ -166,6 +170,14 @@ const videoTokens = persistedMap('video'); // email -> watch-to-earn video token
const faucetHits = new Map(); // address -> last faucet ts (rehearsal test-POL faucet rate limit)
const visitTokens = persistedMap('visit'); // email -> verified-visit token (dwell + captcha floor)
// walk the referral chain upward via sponsorRef (code/username/member id)
// A PAYING member (memberId > 0, or a registered linked position) gets their profile on public pages; a free account gets
// nothing from the profile there (2026-10-30 link-farm incident: 106 free accounts used bios and socials as backlinks).
async function hasBought(a) {
if (!a) return false; if (Number(a.memberId) > 0) return true;
try { return (await accounts.positions(a.email)).some(p => Number(p.memberId) > 0); } catch (e) { return false; }
}
// the wall's meta description is always this sentence, never profile text, so the indexed snippet is ours
const wallDescription = nm => nm + '\u2019s ad wall on InstantAdPay: the network\u2019s member ads, paid out on Polygon the moment a package clears.';
async function uplineSlides(email, depth = 3) {
const out = [];
let cur = await accounts.byEmail(email);
@@ -551,7 +563,7 @@ async function boot() {
messages.init({ dataDir: DATA_DIR });
reports.init({ dataDir: DATA_DIR });
drip.init({ dataDir: DATA_DIR, mailer, accounts, chain, site: 'https://instantadpay.com' });
chatbot.init({ dataDir: DATA_DIR, chain, gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; } }); // pass tiers fact follows sovTiers (2026-10-22)
chatbot.init({ dataDir: DATA_DIR, chain, bixLive: () => bixpay.live(), gameLive: slug => String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(slug), refuelOn: () => refuel.cfg().on, passTiers: () => { const c = gamepass.cfg(); return { on: c.enabled && c.tierSales, rows: gamepass.TIER_DEFS.filter(d => d.key !== 'weekly').map(d => ({ name: d.name, perks: d.perks, price: c.tiers[d.key].price, usd: c.tiers[d.key].price / 100, days: c.tiers[d.key].days, sale: c.tiers[d.key].sale })) }; } }); // pass tiers fact follows sovTiers (2026-10-22)
setTimeout(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 1000);
setInterval(() => ads.dailySweep().catch(e => console.error('sweep', e.message)), 60 * 60 * 1000);
setInterval(() => ads.scheduleSweep().catch(e => console.error('schedule sweep', e.message)), 5 * 60 * 1000); // scheduled starts/ends
@@ -564,7 +576,7 @@ async function boot() {
supportbot.init({ tickets, chatId: () => String(siteConfig().supportTelegramChat || '1289244227').trim(), site: 'https://instantadpay.com' });
badge.init({ publicDir: PUBLIC_DIR });
gamestats.init({ dataDir: DATA_DIR });
snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, publicDir: PUBLIC_DIR, games: gamestats, launchesToday: () => GAMES().filter(g => (g.soon && g.soon.opens === todayCT()) || (g.season && g.season.start === todayCT())).map(g => g.name),
snapshot.init({ dataDir: DATA_DIR, db, chain, siteConfig, publicDir: PUBLIC_DIR, games: gamestats, launchesToday: () => GAMES().filter(g => (g.soon && g.soon.opens === todayCT()) || (g.season && g.season.start === todayCT() && String(siteConfig().gamesLive == null ? 'polhunter' : siteConfig().gamesLive).split(',').map(x => x.trim().toLowerCase()).includes(g.slug))).map(g => g.name),
send: async (c, t, th) => { await telegramSend(c, t, th); return true; },
sendPhoto: (c, jpeg, cap, th) => telegramSendPhoto(c, jpeg, cap, th) });
fridaybank.init({ db });
@@ -613,6 +625,13 @@ async function boot() {
setTimeout(() => refill.tick().catch(e => console.error('refill', e.message)), 90000);
setInterval(() => refill.tick().catch(e => console.error('refill', e.message)), 20 * 60 * 1000);
setInterval(() => friday.tick().catch(e => console.error('friday', e.message)), 5 * 60 * 1000);
// link-farm scan (2026-10-30): 06:30 Central, once a day across app copies (marks), Telegram to the private admin chat only when there is something to review
spamscan.init({ dataDir: DATA_DIR, site: 'InstantAdPay', siteUrl: 'https://instantadpay.com', otherSite: 'LinkSpin', accounts, siteConfig, marks,
saveSite: patch => { const cur = siteConfig(); fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(cur, patch), null, 2)); },
notify: async text => { const sc = siteConfig(); const chat = String(sc.telegramAdminChatId || '1289244227').trim(); if (sc.telegramBotToken) return telegramSend(chat, text); const hermes = String(process.env.HERMES_BOT_TOKEN || '').trim(); if (hermes) return tgSendAs(hermes, chat, text); if (ADMIN_EMAIL && mailer.hasKey()) return mailer.send(ADMIN_EMAIL, 'InstantAdPay link-farm scan', text); },
alsoOn: async (email, a) => (a && a.joinedVia === 'linkspin') ? true : lssync.knows(email) });
setTimeout(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 150000);
setInterval(() => spamscan.tick().catch(e => console.error('spamscan', e.message)), 5 * 60 * 1000);
wednesday.init({ dataDir: DATA_DIR, siteConfig, chain, ads, accounts, mailer, drip, marks, rates: () => ads.rates(),
telegram: async text => { const sc = siteConfig(); if (!sc.telegramBotToken || !sc.telegramEchoChatId) return false; return telegramSend(sc.telegramEchoChatId, '\u{1F7E0} <b>InstantAdPay</b> · ' + text, sc.telegramEchoTopicId); },
notify: async (memberId, subject, text, kind) => { const a = await accounts.byMemberId(memberId); if (!a || !a.email) return; const html = '<p>' + String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/(https:\/\/[^\s]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>').split('\n\n').join('</p><p>').replace(/\n/g, '<br>') + '</p>'; await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [a.email], subject, html, kind || 'notice'); } });
@@ -650,6 +669,7 @@ async function boot() {
setInterval(() => lssync.tick().catch(e => console.error('lssync', e.message)), 2 * 60 * 1000);
setInterval(() => follow.retryPending().catch(e => console.error('sponsorfollow retry', e.message)), 2 * 60 * 1000); // follows waiting on a chain read or a sponsor account
walletnudge.init({ dataDir: DATA_DIR, accounts, chain, mailer, optedIn: updates.optedIn, site: 'https://instantadpay.com',
bixLine: a => bixpay.nudgeLine(a ? (a.username || a.code) : ''), // one BixPay sentence in the nudge, only while bixpayLive (2026-10-29)
message: async (to, subject, html) => { await messages.deliver(1, ADMIN_EMAIL || 'house@instantadpay.com', [to], subject, html, 'notice'); } });
setTimeout(() => walletnudge.tick().catch(e => console.error('walletnudge', e.message)), 3 * 60 * 1000); // past the deploy overlap window
setInterval(() => walletnudge.tick().catch(e => console.error('walletnudge', e.message)), 60 * 60 * 1000);
@@ -666,9 +686,10 @@ async function boot() {
}
legacy.init({ dataDir: DATA_DIR });
traffic.init({ dataDir: DATA_DIR });
bixpay.init({ dataDir: DATA_DIR, accounts, siteConfig, refAccount });
loginShows.init({ dataDir: DATA_DIR });
promos.init({ dataDir: DATA_DIR });
blog.init({ dataDir: DATA_DIR });
blog.init({ dataDir: DATA_DIR, extraPages: () => bixpay.live() ? ['/bixpay'] : [] });
adminMember.init({ accounts, ads, chain, tank, legacy, promos, messages, dataDir: DATA_DIR });
gamepass.init({ dataDir: DATA_DIR, siteConfig, accounts, marks, isProd: IS_PROD, persistedMap, polUsd: polUsdLive,
blockTime: async n => { const blk = await chain.rpc('eth_getBlockByNumber', ['0x' + Number(n).toString(16), false]); return blk && blk.timestamp ? parseInt(blk.timestamp, 16) : 0; }, // a pass order is fulfilled only by a purchase mined after it
@@ -745,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(), driprunner: DR_SECRET(), roadagent: RA_SECRET(), shardsofvalor: SOV_SECRET() });
clutterhunt: SEEK_SECRET(), polybreak: PB_SECRET(), polminer: PM_SECRET(), warpwares: WW_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
@@ -778,6 +799,7 @@ function siteConfig() {
fraudMaxSignupsPerIpDay: 2, fraudBlockSharedDevice: 'on', // anti-fraud: accounts per IP per day; block a second account from the same browser
telegramEchoChatId: '', telegramEchoTopicId: '', telegramEchoEvents: 'payouts', // shared cross-program payments topic
telegramAdminChatId: '', // private chat for admin alerts (sign-up guard bursts); falls back to ADMIN_EMAIL
spamScanAllow: spamscan.DEFAULT_ALLOW.join(', '), // link-farm scan (2026-10-30): emails never listed as candidates; Admin > Members > Link-farm list > Allow adds here
fridayPromo: '1', // Five Dollar Friday on/off (Marty, 2026-09-20)
fridayBonusPct: '20', // bonus credits on any $5+ package bought on a Friday, Central
fridayStart: '2026-09-25', // the first Five Dollar Friday
@@ -816,6 +838,10 @@ function siteConfig() {
// /join/<username> here, so shared links do not carry instantadpay.com (Spamhaus DBL). '' = old instantadpay.com/join links.
// Switch to the spare (mylinehq.com) if one gets flagged. Old links keep working either way.
shareDomain: 'ctbgo.com',
// BixPay Visa card (2026-10-29, docs/BIXPAY-INTEGRATION.md): '0' = nothing shows anywhere (no Profile field, Wallet card,
// Overview card, promo tab, /bixpay guide, chatbot says coming soon). bixCompanyLink = the network fallback partner link
// (Marty's own PARTNER link, IB12143793); bixpayLiveSince is stamped when the switch is flipped on (the Overview card runs a week).
bixpayLive: '0', bixCompanyLink: bixpay.DEFAULT_COMPANY_LINK, bixpayLiveSince: '',
pnlFixedMonthlyUsd: 0
}, saved);
}
@@ -1356,9 +1382,11 @@ async function emailOnEvent(ev) {
const pct = PCT[ev.tier] || 0; const pur = purchaseOf(ev.tx);
let buyer = 'a member on your level ' + ev.tier; try { buyer = await memberLabel(ev.buyerId); } catch (e) {}
const pol = weiToPol(ev.amountWei);
// BixPay (2026-10-29): one sentence after the amount, the recipient's resolved partner link behind a counted /go link; only while live
let bixLine = ''; try { if (bixpay.live()) { const ra = await accounts.byMemberId(ev.recipientId); bixLine = bixpay.emailLine(ra ? (ra.username || ra.code) : ''); } } catch (e) { bixLine = ''; }
await tell(ev.recipientId, 'You just got paid ' + pol + ' POL on InstantAdPay',
buyer + ' just bought an ad package on your level ' + ev.tier + (pur ? ' ($' + (pur.priceCents / 100).toFixed(2).replace(/\.00$/, '') + ')' : '') + '. Your ' + pct + ' percent share, ' + pol + ' POL' + usdShare(pur, pct) + ', landed in your wallet in the same transaction' + (ev.hops ? ', passed up to you because someone between you was not qualified for this level' : '') + '.\n\n' +
'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://instantadpay.com/my');
(bixLine ? bixLine + '\n\n' : '') + 'Transaction: ' + txUrlOf(ev.tx) + '\n\nYour dashboard: https://instantadpay.com/my');
}
else if (ev.type === 'AwardPaid') {
const ov = override.txInfo(ev.tx); // a level-4 override payment from the weekly payer
@@ -1505,10 +1533,15 @@ async function tankReadyTick() {
const clean = t => String(t || '').replace(/[<>&]/g, '');
const link = 'https://instantadpay.com/my#line';
if (r.fresh.length <= 3) {
for (const w of r.fresh) await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} ' + (w.username ? '@' + clean(w.username) : 'A new member') + ' linked a wallet and is ready to switch on payouts. Adopt them from the holding tank in the next 24 hours: ' + link, sc.telegramEchoTopicId).catch(() => {});
// a fresh link says so; a wallet that predates this tank visit (a dormant member returned by a sponsor) says "already
// linked" with the last sign-in, so adopters can judge (Marty 2026-10-29: the old wording read as a live member)
const seen = ms => { try { return new Date(ms).toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'America/Chicago' }); } catch (e) { return ''; } };
for (const w of r.fresh) await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} ' + (w.username ? '@' + clean(w.username) : 'A new member')
+ (w.linkedNow ? ' linked a wallet and is ready to switch on payouts. Adopt them from the holding tank in the next 24 hours: '
: ' is in the holding tank with a wallet already linked' + (w.lastSeen ? ' (last seen ' + seen(w.lastSeen) + ')' : '') + '. Adopt them in the next 24 hours: ') + link, sc.telegramEchoTopicId).catch(() => {});
} else { // first run after deploy (the members already linked) or a busy quarter hour: one digest, not a wall of posts
const named = r.fresh.filter(w => w.username).map(w => '@' + clean(w.username));
await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} ' + r.fresh.length + ' members linked a wallet and are ready to switch on payouts' + (named.length ? ': ' + named.slice(0, 12).join(', ') + (named.length > 12 ? ' and ' + (named.length - 12) + ' more' : '') : '') + '. Adopt them from the holding tank in the next 24 hours: ' + link, sc.telegramEchoTopicId).catch(() => {});
await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} ' + r.fresh.length + ' members in the holding tank have a wallet linked and are ready to switch on payouts' + (named.length ? ': ' + named.slice(0, 12).join(', ') + (named.length > 12 ? ' and ' + (named.length - 12) + ' more' : '') : '') + '. Adopt them from the holding tank in the next 24 hours: ' + link, sc.telegramEchoTopicId).catch(() => {});
}
return r;
}
@@ -1746,6 +1779,31 @@ async function pmCallback(cbUrl, receipt) {
if (!pmIsGameUrl(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('polminer callback', e.message); return false; }
}
// -- Warp & Wares (2026-10-29): the Trade Wars-style 30-day season game; its own secret WW_SSO_SECRET (also on the game), the same
// protocol as POL Miner. Members see nothing until 'warpwares' is in site config gamesLive (Games card, strip, games page, promo
// tools, chatbot), and its season window is WW_SEASON (env WW_SEASON_START / WW_SEASON_END, Central days, end exclusive).
// A SPONSOR DOCK is its refuel: a verified visit at a sponsor market, visit kind 'dock' with its own daily cap (ads.js), paying
// the player bonus turns in the game, never POL.
const WW_SECRET = () => String(process.env.WW_SSO_SECRET || '').trim();
const WW_URL = () => String(process.env.WW_URL || 'https://warpwares.saasy.top').replace(/\/+$/, '');
const WW_ALT = () => String(process.env.WW_ALT_URLS || '').split(',').map(x => x.trim().replace(/\/+$/, '')).filter(Boolean);
const WW_SEASON = { start: /^\d{4}-\d{2}-\d{2}$/.test(String(process.env.WW_SEASON_START || '')) ? process.env.WW_SEASON_START : '2026-11-30', end: /^\d{4}-\d{2}-\d{2}$/.test(String(process.env.WW_SEASON_END || '')) ? process.env.WW_SEASON_END : '2026-12-30' };
const wwSign = p => drB64u(crypto.createHmac('sha256', WW_SECRET()).update(p).digest());
function wwMint(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) + '.' + wwSign(payload); }
function wwOpen(token) {
if (WW_SECRET().length < 32) return { error: 'Warp & Wares 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 = wwSign(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 Warp & Wares and dock again.' };
return { ok: true, claims: c };
}
const wwIsGameUrl = u => [WW_URL()].concat(WW_ALT()).some(o => String(u || '').startsWith(o + '/'));
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; }
}
// -- 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(/\/+$/, '');
@@ -1879,8 +1937,8 @@ function doorHouseList() {
const l = ads.rates().doorHouseAds;
return (Array.isArray(l) ? l : []).filter(x => x && String(x.name || '').trim() && /^https:\/\/[^\s"'<>]+$/i.test(String(x.url || ''))).slice(0, 20);
}
async function doorHousePick(email, claimedUsername) {
const list = doorHouseList(); if (!list.length) return null;
async function doorHousePick(email, claimedUsername, skipName) {
const list = doorHouseList().filter(x => !skipName || String(x.name).toLowerCase() !== String(skipName).toLowerCase()); if (!list.length) return null;
const day = todayCT(); const prev = doorHouse.get(email) || {}; const shown = prev.day === day ? Object.assign({}, prev.shown) : {};
const pool = list.length > 1 ? list.filter(x => x.name !== prev.last) : list;
const h = pool.slice().sort((a, b) => (shown[a.name] || 0) - (shown[b.name] || 0))[0]; // never shown today sorts first, list order breaks ties
@@ -1944,6 +2002,9 @@ function GAMES() {
// POL Miner (2026-10-28): dig down, beat the drill bosses, find the rare Polygon crystals (hidden until gamesLive has 'polminer')
{ slug: 'polminer', name: 'POL Miner', tag: 'Mining adventure', blurb: 'Dig down through the layers, haul ore to sell, upgrade your pick, lamp and cart, and beat a drill boss every 30 m. Rare pink Polygon crystals pay POL.',
art: 'https://coolify-saasytop.nyc3.cdn.digitaloceanspaces.com/game-banners/polminer/og-polminer-clean.jpg', play: '/api/my/polminer', pays: 'POL for Polygon crystals, first boss wins and depth records' },
// 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 } },
]);
}
// each game's member perk (the $5 welcome offer, 2026-10-05) shown on its card
@@ -1958,6 +2019,7 @@ const STRIP = () => ({
clutterhunt: { line: 'Search cozy, cluttered rooms for hidden objects. New rooms every season.', open: SEEK_URL() + '/', host: SEEK_URL().replace(/^https?:\/\//, '') },
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?:\/\//, '') },
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?:\/\//, '') },
});
@@ -2027,6 +2089,8 @@ const GAME_AUTH = {
mint: (a, memberId) => pbMint({ memberId: Number(memberId) || 0, email: String(a.email).toLowerCase(), username: a.username || null, wallet: a.address || null, sponsorRef: a.sponsorRef || null }) },
polminer: { name: 'POL Miner', frames: false, origins: () => [PM_URL()].concat(PM_ALT()), host: () => PM_URL().replace(/^https?:\/\//, ''),
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 }) },
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?:\/\//, ''),
@@ -2240,6 +2304,7 @@ const server = http.createServer(async (req, res) => {
// -- the pages a member can turn into a viral link (promo tools > Viral links)
if (p === '/api/pages' && req.method === 'GET') {
const pages = [{ path: '/', title: 'Home page' }, { path: '/blog', title: 'Blog' }, { path: '/earning', title: 'How earning works' }, { path: '/games', title: 'Games that pay POL' }, { path: '/ledger', title: 'Live ledger' }, { path: '/leaderboard', title: 'Leaderboard' }, { path: '/contract', title: 'The contract' }, { path: '/plays', title: 'Team-building plays' }, { path: '/wallets', title: 'Wallet guide' }, { path: '/friday', title: 'Five Dollar Friday' }, { path: '/refuel', title: 'Fuel Your Offers: the Monthly Refuel guide' }, { path: '/conversion-tracking', title: 'Conversion tracking: how to set it up' }, { path: '/whats-new', title: "What's new" }, { path: '/shorts', title: 'Shorts' }, { path: '/presentation', title: 'The presentation (narrated video)' }];
if (bixpay.live()) pages.push({ path: '/bixpay', title: 'BixPay: a Visa card for your POL' }); // the guide resolves the sharer's partner link from ?ref (2026-10-29)
try { for (const b of (await blog.listPublished()).slice(0, 40)) pages.push({ path: '/blog/' + b.slug, title: 'Article: ' + b.title, cover: b.cover || null }); } catch (e) {}
return json(res, 200, { pages });
}
@@ -2372,7 +2437,7 @@ const server = http.createServer(async (req, res) => {
const t = nameTok.toLowerCase();
let a = await accounts.byCode(t); if (!a) a = await accounts.byUsername(t);
if (!a && /^\d+$/.test(nameTok)) a = await accounts.byMemberId(Number(nameTok));
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
if (a) { name = a.username ? '@' + a.username : (a.memberId ? 'member #' + a.memberId : null); avatarUrl = a.avatarUrl || null; own = !!(acct && a.email === acct.email); var bio = null, cobrand = false; try { cobrand = (await ads.milestonesOf(a.email)).includes('level3'); if (cobrand && await hasBought(a)) bio = a.bio ? String(a.bio).slice(0, 220) : null; } catch (e) {} }
}
// "You're joining the line of X" must only greet someone who is actually about to
// join. The last-touch sponsor cookie lives 30 days, so an EXISTING member who once
@@ -2578,7 +2643,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', 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', 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.
@@ -2777,7 +2842,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', '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: ['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,
@@ -2786,6 +2851,9 @@ const server = http.createServer(async (req, res) => {
socials: (acct && acct.socials) || null,
wallOffers: parseWallOffers(acct),
lineBannerUrl: (acct && acct.lineBannerUrl) || null, lineTargetUrl: (acct && acct.lineTargetUrl) || null };
// BixPay (2026-10-29): the member's own partner link plus the one their pages resolve to (own > sponsor chain > network)
if (bixpay.live()) { try { const r = await bixpay.resolve(acct); const tok = (acct && (acct.username || acct.code)) || ''; out.bix = { live: true, own: (acct && acct.bixPartnerLink) || null, link: r.link, whose: r.whose, name: r.name, using: bixpay.usingLine(r), go: { wallet: bixpay.goLink('wallet'), overview: bixpay.goLink('overview'), promo: bixpay.goLink('promo', tok) }, announce: bixpay.announcing(), clicks: bixpay.memberClicks(acct && acct.email) }; } catch (e) { out.bix = { live: true, error: true }; } }
else out.bix = { live: false };
if (memberId) {
try {
const mm = await chain.member(memberId);
@@ -3002,6 +3070,15 @@ const server = http.createServer(async (req, res) => {
}
return json(res, 200, await adminMember.view(e));
}
// -- link-farm scan (2026-10-30): last result + allowlist, run now (no Telegram), allow / unallow an email
if (p === '/api/admin/spamscan' && req.method === 'GET') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); return json(res, 200, spamscan.view()); }
if (p === '/api/admin/spamscan/run' && req.method === 'POST') { if (!isAdmin(req)) return json(res, 401, { error: 'auth' }); await spamscan.run({ manual: true, quiet: true }); return json(res, 200, spamscan.view()); }
if (p === '/api/admin/spamscan/allow' && req.method === 'POST') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const b = await readBody(req); const e = String(b.email || '').trim().toLowerCase(); if (!e) return json(res, 400, { error: 'Which email?' });
spamscan.setAllow(e, !b.remove); console.log('spamscan allowlist', b.remove ? 'removed' : 'added', e);
return json(res, 200, spamscan.view());
}
if (p === '/api/admin/member' && req.method === 'DELETE') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const e = String(u.searchParams.get('email') || '').trim().toLowerCase(); const acct = e && await accounts.byEmail(e);
@@ -3325,6 +3402,14 @@ const server = http.createServer(async (req, res) => {
return json(res, 404, { error: 'unknown op' });
}
// -- the Engine Room, partner side: this site's facts for one member + the streak (LinkSpin builds its own panel from them)
// -- BixPay link for one member, the same resolver (own > sponsor chain > network), for LinkSpin / CTB cards (2026-10-29, read-only there)
if (p === '/api/partner/bixpay' && req.method === 'POST') {
const sg = await readLsSigned(req, 64000); if (!sg.body) return json(res, sg.status, { error: sg.error });
const email = String(sg.body.email || '').trim().toLowerCase(); if (!email) return json(res, 400, { error: 'Which member?' });
if (!bixpay.live()) return json(res, 200, { ok: true, live: false });
const a = await accounts.byEmail(email); const r = await bixpay.resolve(a);
return json(res, 200, { ok: true, live: true, own: (a && a.bixPartnerLink) || null, link: r.link, whose: r.whose, name: r.name, using: bixpay.usingLine(r), editUrl: 'https://instantadpay.com/my#profile', guide: 'https://instantadpay.com/bixpay' });
}
if (p === '/api/partner/engine' && req.method === 'POST') {
const sg = await readLsSigned(req, 64000); if (!sg.body) return json(res, sg.status, { error: sg.error });
const email = String(sg.body.email || '').trim().toLowerCase(); if (!email) return json(res, 400, { error: 'Which member?' });
@@ -3415,6 +3500,7 @@ const server = http.createServer(async (req, res) => {
if (p === '/api/admin/traffic' && req.method === 'GET') {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const days = Math.min(365, Math.max(1, Number(u.searchParams.get('days')) || 30));
const bix = bixpay.adminView(days); try { for (const m of bix.members) { const a = await accounts.byEmail(m.email); m.name = a ? (a.username ? '@' + a.username : a.email) : m.email; } } catch (e) {} // BixPay clicks per surface and per member (2026-10-29)
const since = Date.now() - days * 86400000, sinceDay = new Date(since).toISOString().slice(0, 10);
const hosts = {}, paths = {}, daily = {}, angles = {};
const H = k => (hosts[k] = hosts[k] || { source: k, hits: 0, joinViews: 0, signups: 0, registered: 0, buyers: 0 });
@@ -3429,7 +3515,7 @@ const server = http.createServer(async (req, res) => {
const k = a.joinedVia || 'plain'; angles[k] = angles[k] || { angle: k, views: 0, signups: 0 }; angles[k].signups += 1;
}
const sources = Object.values(hosts).sort((x, y) => (y.hits + y.joinViews + y.signups * 10) - (x.hits + x.joinViews + x.signups * 10));
return json(res, 200, { starter: starter.adminView(), days, sources, paths: Object.entries(paths).map(([path, hits]) => ({ path, hits })).sort((x, y) => y.hits - x.hits),
return json(res, 200, { starter: starter.adminView(), bixpay: Object.assign(bix, { live: bixpay.live() }), days, sources, paths: Object.entries(paths).map(([path, hits]) => ({ path, hits })).sort((x, y) => y.hits - x.hits),
angles: Object.values(angles).sort((x, y) => y.views - x.views), daily: Object.values(daily).sort((x, y) => x.day < y.day ? -1 : 1),
totals: { hits: sources.reduce((n, s) => n + s.hits, 0), joinViews: sources.reduce((n, s) => n + s.joinViews, 0), signups: sources.reduce((n, s) => n + s.signups, 0), buyers: sources.reduce((n, s) => n + s.buyers, 0) } });
}
@@ -3669,6 +3755,15 @@ const server = http.createServer(async (req, res) => {
res.writeHead(302, { Location: PB_URL() + '/auth?t=' + tok, 'Cache-Control': 'no-store', 'Set-Cookie': gkCookie('iap.return', '', 0) }); return res.end();
}
// -- POL Miner hand-off (2026-10-28): sign the member across; the game verifies with POLMINER_SSO_SECRET
// -- Warp & Wares hand-off (2026-10-29): sign the member across; the game verifies with WW_SSO_SECRET
if (p === '/api/my/warpwares' && req.method === 'GET') { gamestats.handoff('warpwares');
const s = await auth.fromRequest(req);
if (!s || !s.email) { res.writeHead(302, { Location: '/my' + refQ(u), 'Set-Cookie': gkCookie('iap.return', 'warpwares', 1800), 'Cache-Control': 'no-store' }); return res.end(); }
if (WW_SECRET().length < 32) return json(res, 503, { error: 'Warp & Wares is not connected yet.' });
const acct = await accounts.byEmail(s.email);
const tok = wwMint({ 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: WW_URL() + '/auth?t=' + tok, 'Cache-Control': 'no-store', 'Set-Cookie': gkCookie('iap.return', '', 0) }); return res.end();
}
if (p === '/api/my/polminer' && req.method === 'GET') { gamestats.handoff('polminer');
const s = await auth.fromRequest(req);
if (!s || !s.email) { res.writeHead(302, { Location: '/my' + refQ(u), 'Set-Cookie': gkCookie('iap.return', 'polminer', 1800), 'Cache-Control': 'no-store' }); return res.end(); }
@@ -3949,6 +4044,7 @@ const server = http.createServer(async (req, res) => {
if (r.error) { const g = swOpen(u.searchParams.get('t')); if (!g.error && g.claims.game === 'spellwheel') { r = g; game = 'spellwheel'; } }
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) 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.' });
@@ -3956,26 +4052,34 @@ const server = http.createServer(async (req, res) => {
if (game === 'spellwheel' && !swIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a SpellWheel link.' });
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.' });
const G = 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' };
if (game === 'warpwares' && !wwIsGameUrl(c.ret)) return json(res, 400, { error: 'That is not a Warp & Wares 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' };
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));
if (!t) {
const email = String(c.email).toLowerCase();
const status = await ads.visitStatus(email, 'refuel'); // refuels have their own daily allowance
const status = await ads.visitStatus(email, vkind); // refuels (and docks) have their own daily allowance
if (status.count >= status.cap) return json(res, 200, Object.assign({ none: true, why: 'cap', ret: c.ret }, G));
const ad = await ads.serveVisit(email, viewerGeo(req));
// 2026-10-28 (Marty): a sponsor never seen first, then one seen longest ago after the cooldown (doorRepeatDays), then a
// member video, then a house sponsor (one of Marty's programs, never the game the player is in), so the visit is never empty
const ad = await ads.serveVisit(email, viewerGeo(req), { kind: vkind });
if (ad) t = { kind: 'visit', email, memberId: Number(c.memberId), id: ad.id, title: ad.title, target: ad.target, ts: Date.now(), ret: c.ret, challenge: null, done: false };
else { // every visit pack already visited: a member video ad instead (2026-09-30)
const v = await ads.serveVideo(Object.assign({ excludeEmail: email, refuel: true }, viewerGeo(req)));
if (!v) return json(res, 200, Object.assign({ none: true, why: 'empty', ret: c.ret }, G));
t = { kind: 'video', email, memberId: Number(c.memberId), id: v.id, title: v.title, videoUrl: v.videoUrl, secs: v.watchSecs, width: v.width, height: v.height, ts: Date.now(), ret: c.ret, challenge: null, done: false };
if (!v) {
const h = await doorHousePick(email, c.username, G.game);
if (!h) return json(res, 200, Object.assign({ none: true, why: 'empty', ret: c.ret }, G));
t = { kind: 'house', email, memberId: Number(c.memberId), id: 0, program: h.name, title: h.title, target: h.target, ts: Date.now(), ret: c.ret, challenge: null, done: false };
}
else t = { kind: 'video', email, memberId: Number(c.memberId), id: v.id, title: v.title, videoUrl: v.videoUrl, secs: v.watchSecs, width: v.width, height: v.height, ts: Date.now(), ret: c.ret, challenge: null, done: false };
}
t.game = game; t.cb = c.cb || null;
refuelTokens.set(c.nonce, t);
}
if (t.kind === 'video') return json(res, 200, Object.assign({ mode: 'video', title: t.title, video: { url: t.videoUrl, width: t.width, height: t.height }, dwell: t.secs, ret: t.ret, elapsed: Math.floor((Date.now() - t.ts) / 1000) }, G));
return json(res, 200, Object.assign({ mode: 'visit', title: t.title, target: t.target, dwell: ads.rates().visitDwellSeconds || 8, ret: t.ret, elapsed: Math.floor((Date.now() - t.ts) / 1000) }, G));
return json(res, 200, Object.assign({ mode: 'visit', house: t.kind === 'house' || undefined, title: t.title, target: t.target, dwell: ads.rates().visitDwellSeconds || 8, ret: t.ret, elapsed: Math.floor((Date.now() - t.ts) / 1000) }, G));
}
if (p === '/api/refuel/challenge' && req.method === 'GET') {
const t = refuelTokens.get(String(u.searchParams.get('n') || ''));
@@ -3993,18 +4097,28 @@ const server = http.createServer(async (req, res) => {
if (Number(b.answer) !== t.challenge.answer) { t.challenge = null; return json(res, 400, { error: 'Wrong pick.', retry: true }); }
let credits;
if (t.kind === 'video') {
const st = await ads.visitStatus(t.email, 'refuel'); if (st.count >= st.cap) return json(res, 400, { error: 'That is today\u2019s refuels. More at midnight Central.' });
if (!(await ads.markRefuelVideo(t.email, t.id))) return json(res, 400, { error: 'You already refuelled on this video. Go back and try again for another.' });
const st = await ads.visitStatus(t.email, t.game === 'warpwares' ? 'dock' : 'refuel'); if (st.count >= st.cap) return json(res, 400, { error: t.game === 'warpwares' ? 'That is today\u2019s sponsor docks. More at midnight Central.' : 'That is today\u2019s refuels. More at midnight Central.' });
if (!(await ads.markRefuelVideo(t.email, t.id, t.game === 'warpwares' ? 'dock' : undefined))) return json(res, 400, { error: 'You already refuelled on this video. Go back and try again for another.' });
const tier = await ads.chargeVideoView(t.id); // the advertiser is charged one view, as on the Watch tab
if (!tier) return json(res, 400, { error: 'That video just ran out of budget. Go back and try again.' });
await ads.markVideoSeen(t.email, t.id); credits = tier.cost;
} else if (t.kind === 'house') { // a house sponsor: no advertiser, no pool income, but it is one of the day's refuels
const r = await ads.markHouseVisit(t.email, t.game === 'warpwares' ? 'dock' : 'refuel');
if (r.error) return json(res, 400, { error: r.error });
credits = 0;
} else {
const r = await ads.completeVisit(t.email, t.id, { reward: false, note: 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 === '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)
}
t.done = true;
if (t.game === 'warpwares') { // Warp & Wares sponsor dock: signed receipt to the game's callback and on the ret page; the game pays bonus turns, never POL
const receipt = wwMint({ kind: 'ww-dock', nonce, email: t.email, campaignId: t.id, credits }, 15 * 60000);
const posted = await wwCallback(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: 'Warp & Wares', label: 'sponsor dock' });
}
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);
@@ -4129,8 +4243,9 @@ const server = http.createServer(async (req, res) => {
const out = [];
for (const g of GAMES()) {
if (g.season && day >= g.season.end) continue; // a finished season is gone
const soon = !!(g.soon && day < g.soon.opens), preSeason = !!(g.season && day < g.season.start);
const isLive = !soon && !preSeason && live.has(g.slug);
// a seasonal game shows its 'Opens' date only once it is in gamesLive (Turkey Drop's rule, 2026-10-28; Warp & Wares the same)
const soon = !!(g.soon && day < g.soon.opens), preSeason = !!(g.season && day < g.season.start && live.has(g.slug));
const isLive = !soon && !(g.season && day < g.season.start) && live.has(g.slug);
if (!isLive && !soon && !preSeason) continue; // not live and no date: not announced yet
out.push({ slug: g.slug, name: g.name, tag: g.tag, blurb: g.blurb, pays: g.pays, art: /^https?:/.test(g.art) ? g.art : 'https://instantadpay.com' + g.art, artPos: g.artPos || 'center', live: isLive, video: isLive && g.video ? g.video : null,
opens: soon ? g.soon.label : preSeason ? 'Opens ' + lbl(g.season.start) : null, season: g.season && isLive ? { ends: lbl(g.season.end, true) } : null, open: S[g.slug] ? S[g.slug].open : null, host: S[g.slug] ? S[g.slug].host : null });
@@ -4600,7 +4715,7 @@ const server = http.createServer(async (req, res) => {
return json(res, 400, { error: 'Avatar must be an uploaded image or an https image URL.' });
const bio = b.bio === undefined ? undefined : String(b.bio || '').trim().slice(0, 600);
// socials: {platform: url}; keep only known platforms with valid https urls
let socials;
let socials, cleanSoc = null;
if (b.socials !== undefined) {
const PLAT = ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video'];
const clean = {};
@@ -4612,10 +4727,44 @@ const server = http.createServer(async (req, res) => {
if (clean.video && !/^https:\/\/((www\.|m\.)?youtube\.com\/(watch\?|shorts\/|embed\/)|youtu\.be\/|(www\.)?vimeo\.com\/\d+|player\.vimeo\.com\/video\/\d+|[^\s]+\.(mp4|webm)(\?|$))/i.test(clean.video))
return json(res, 400, { error: 'The intro video needs to be a YouTube link, a Vimeo link, or a direct .mp4 link.' });
socials = Object.keys(clean).length ? JSON.stringify(clean) : null;
cleanSoc = clean;
}
const r = await accounts.setProfile(s.email, avatar, bio, socials);
// prohibited-content policy (2026-10-30): gambling, adult, pharma, weapons and link-selling terms are refused in the bio and the social URLs
{ const pr = prohibited.checkFields(Object.assign({ bio }, cleanSoc || {}), 'InstantAdPay', { profile: true }); if (pr.error) { prohibited.logRefusal('profile-details', s.email, pr); return json(res, 400, { error: pr.error }); } }
// a bio is not a backlink: links go in the social fields. Exception, the quarantine rule: a brand-new free account (no wallet,
// no sponsor, under 24 h) whose first save plants a link is saved with profileQuarantined and never rendered publicly
const acct = await accounts.byEmail(s.email);
const quarantine = spamscan.shouldQuarantine(acct, bio, cleanSoc) ? true : undefined;
if (bio && prohibited.hasUrl(bio) && !quarantine) { prohibited.logRefusal('profile-details', s.email, { field: 'bio', reason: 'url' }); return json(res, 400, { error: prohibited.BIO_LINK_MSG }); }
const r = await accounts.setProfile(s.email, avatar, bio, socials, quarantine);
if (quarantine && !r.error) { console.log('profile quarantined', String(s.email).replace(/^(.).*(@.*)$/, '$1***$2'), prohibited.hasUrl(bio) ? 'bio-url' : 'social-link'); r.quarantined = true; r.notice = spamscan.QUARANTINE_NOTICE; }
return json(res, r.error ? 400 : 200, r);
}
// -- BixPay partner link (2026-10-29): Profile > BixPay card. Validated (bix.ibportal.io/auth/register, e=, a=1; the
// appId=3 card-customer link is refused with a message); empty clears it. Rides to LinkSpin in the profile row.
if (p === '/api/my/bixpay' && req.method === 'POST') {
const s = await auth.fromRequest(req);
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
if (!bixpay.live()) return json(res, 404, { error: 'Not open yet.' });
const b = await readBody(req);
const raw = String(b.link == null ? '' : b.link).trim();
if (!raw) { const r = await accounts.setBixLink(s.email, null); if (r.error) return json(res, 400, r); const rs = await bixpay.resolve(r.account); return json(res, 200, { ok: true, own: null, link: rs.link, whose: rs.whose, name: rs.name, using: bixpay.usingLine(rs) }); }
const v = bixpay.validate(raw);
if (!v.ok) return json(res, 400, { error: v.error, customerLink: v.error === bixpay.CUSTOMER_LINK_MSG });
const r = await accounts.setBixLink(s.email, v.link);
if (r.error) return json(res, 400, r);
return json(res, 200, { ok: true, own: v.link, link: v.link, whose: 'you', name: null, using: bixpay.usingLine({ whose: 'you' }) });
}
// -- the /bixpay guide's CTA: the viewer's resolved link (their own when signed in, else the ?ref / sponsor cookie's member, else network)
if (p === '/api/public/bixpay' && req.method === 'GET') {
if (!bixpay.live()) return json(res, 200, { live: false });
const s = await auth.fromRequest(req).catch(() => null);
let acct = (s && s.email && await accounts.byEmail(s.email)) || null;
const tok = String(u.searchParams.get('ref') || '').trim().toLowerCase().slice(0, 40) || String(parseCookies(req)['iap.sponsor'] || '').trim().toLowerCase().slice(0, 40);
const r = acct ? await bixpay.resolve(acct) : await bixpay.resolveRef(tok);
const owner = acct || (tok ? await refAccount(tok).catch(() => null) : null);
return json(res, 200, { live: true, whose: r.whose, name: r.name, using: bixpay.usingLine(r), go: bixpay.goLink('guide', owner ? (owner.username || owner.code) : ''), promoGo: owner ? bixpay.goLink('promo', owner.username || owner.code) : null, signedIn: !!acct });
}
// -- wall positions 2 & 3: the member's own offers, unlocked at 2 / 5 qualifying buyers
if (p === '/api/my/wall-offers' && req.method === 'POST') {
const s = await auth.fromRequest(req);
@@ -4630,6 +4779,7 @@ const server = http.createServer(async (req, res) => {
const title = String(o.title || '').trim().slice(0, 60);
if (targetUrl && !/^https:\/\/[^\s]+$/i.test(targetUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': the link must start with https://' });
if (bannerUrl && !/^(\/uploads\/[a-z0-9]{24}\.(png|jpg|webp|gif)|https:\/\/[^\s]+)$/i.test(bannerUrl)) return json(res, 400, { error: 'Position ' + (i + 2) + ': banner must be an uploaded image or an https image URL.' });
{ const pr = prohibited.checkFields({ title, targetUrl }, 'InstantAdPay'); if (pr.error) { prohibited.logRefusal('wall-offers', s.email, pr); return json(res, 400, { error: pr.error }); } }
out.push(targetUrl ? { title: title || null, bannerUrl: bannerUrl || null, targetUrl } : null);
}
const r = await accounts.setWallOffers(s.email, out.some(Boolean) ? JSON.stringify(out) : null);
@@ -4642,6 +4792,7 @@ const server = http.createServer(async (req, res) => {
const b = await readBody(req);
const target = String(b.targetUrl || '').trim();
if (!/^https?:\/\/[^\s]+$/i.test(target)) return json(res, 400, { error: 'Destination URL must start with http(s)://' });
{ const pr = prohibited.checkFields({ targetUrl: target }, 'InstantAdPay'); if (pr.error) { prohibited.logRefusal('linebanner', s.email, pr); return json(res, 400, { error: pr.error }); } }
const fc = await frameCheck(target); // welcome tours frame it full screen
if (!fc.ok) return json(res, 400, { error: fc.reason });
const banner = String(b.bannerUrl || '').trim();
@@ -4707,9 +4858,11 @@ const server = http.createServer(async (req, res) => {
badge = { img: '/badges/badge-' + t[0] + '.jpg?v=2', label: t[1] };
}
const joinPath = '/join/' + (a.username || a.code);
let socials = null; try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {}
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0),
avatarUrl: a.avatarUrl || null, bio: a.bio || null, socials, badge,
// profile fields (bio, avatar, socials, intro video) only for a paying member; a free account's wall carries the name, the line's ads and the join call (2026-10-30)
const bought = await hasBought(a); // a purchase lifts the quarantine too: the notice promised the links after the first package
let socials = null; if (bought) { try { socials = a.socials ? JSON.parse(a.socials) : null; } catch (e) {} }
return json(res, 200, { name: a.username ? '@' + a.username : 'member #' + (a.memberId || 0), bought,
avatarUrl: bought ? (a.avatarUrl || null) : null, bio: bought ? (a.bio || null) : null, socials, badge,
joinUrl: joinPath, qrUrl: '/api/qr?d=' + encodeURIComponent('https://instantadpay.com' + joinPath), ladder: finalLadder, unlocked, buyerCount: bc });
}
// -- watch-to-earn video ads: serve one, then reward a server-clock-verified watch
@@ -5242,7 +5395,8 @@ const server = http.createServer(async (req, res) => {
for (const c of camps) { byStatus[c.status] = (byStatus[c.status] || 0) + 1; byType[c.type] = (byType[c.type] || 0) + 1; }
let memberCount = null; try { memberCount = await chain.memberCount(); } catch (e) {}
const cc = chain.getConfig();
return json(res, 200, { accounts: await accounts.count(), memberCount, campaigns: camps.length,
let bixLinks = 0; try { bixLinks = (await accounts.listAll(100000)).filter(a => a.bixPartnerLink).length; } catch (e) {} // members with a BixPay partner link (2026-10-29)
return json(res, 200, { accounts: await accounts.count(), memberCount, campaigns: camps.length, bixLinks, bixpayLive: bixpay.live(),
house: camps.filter(c => c.house).length, byStatus, byType,
openReports: await reports.openCount(), pendingBurns: (await ads.pendingBurns()).length,
followups: await drip.stats(),
@@ -5598,6 +5752,8 @@ const server = http.createServer(async (req, res) => {
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
const b = await readBody(req);
const cur = siteConfig();
if (b.bixCompanyLink !== undefined && String(b.bixCompanyLink || '').trim()) { const v = bixpay.validate(b.bixCompanyLink); if (!v.ok) return json(res, 400, { error: 'bixCompanyLink: ' + v.error }); b.bixCompanyLink = v.link; }
if (String(b.bixpayLive) === '1' && String(cur.bixpayLive) !== '1' && !String(cur.bixpayLiveSince || '').trim()) b.bixpayLiveSince = new Date().toISOString(); // the Overview announcement runs a week from the flip
fs.writeFileSync(SITE_FILE, JSON.stringify(Object.assign(cur, b), null, 2));
return json(res, 200, { ok: true, site: siteConfig() });
}
@@ -5689,6 +5845,17 @@ const server = http.createServer(async (req, res) => {
if (p === '/friday') return sendFile(res, path.join(PUBLIC_DIR, 'friday.html'));
if (p === '/wednesday') return sendFile(res, path.join(PUBLIC_DIR, 'wednesday.html'));
if (p === '/conversion-tracking') return sendFile(res, path.join(PUBLIC_DIR, 'conversion-tracking.html')); // how to set up the conversion pixel, the member guide (2026-10-24)
if (p === '/bixpay') { if (!bixpay.live()) { res.writeHead(404, baseHeaders({ 'Content-Type': 'text/plain' })); return res.end('Not found'); } return sendFile(res, path.join(PUBLIC_DIR, 'bixpay.html')); } // the BixPay card guide (2026-10-29), public once bixpayLive is on
// counted BixPay click: every surface links here; resolves the member's link (own > sponsor chain > network) and 302s to it
if (p === '/go/bixpay') {
if (!bixpay.live()) { res.writeHead(302, baseHeaders({ Location: '/' })); return res.end(); }
const surface = String(u.searchParams.get('s') || 'other').trim().toLowerCase().slice(0, 12);
const tok = String(u.searchParams.get('m') || '').trim().toLowerCase().slice(0, 40);
let acct = null; try { if (tok) acct = await refAccount(tok); if (!acct) { const s = await auth.fromRequest(req); if (s && s.email) acct = await accounts.byEmail(s.email); } if (!acct) { const ck = String(parseCookies(req)['iap.sponsor'] || '').trim().toLowerCase(); if (ck) acct = await refAccount(ck); } } catch (e) { acct = null; }
const r = await bixpay.resolve(acct);
if (!BOT_UA.test(String(req.headers['user-agent'] || ''))) bixpay.click(surface, acct ? acct.email : null);
res.writeHead(302, baseHeaders({ Location: r.link, 'Cache-Control': 'no-store' })); return res.end();
}
if (p === '/refuel') return sendFile(res, path.join(PUBLIC_DIR, u.searchParams.has('t') ? 'refuel.html' : 'refuel-guide.html')); // ?t=<token>: the games' refuel visit (2026-09-30); no token: the Fuel Your Offers member guide (2026-10-24)
if (p === '/door') return sendFile(res, path.join(PUBLIC_DIR, 'door.html')); // Spooky Doors door visit (2026-10-02)
// per-partner kit pages (Marty, 2026-09-29): /partners/<slug> serves public/kits/<slug>.html, one file per reviewer or site owner
@@ -5704,13 +5871,20 @@ const server = http.createServer(async (req, res) => {
try {
const tok = m[1].toLowerCase();
let a = await accounts.byUsername(tok); if (!a) a = await accounts.byCode(tok);
// a deleted or never-seen name is a real 404, never a bare "Banner wall" page at 200 (a soft 404 Google kept indexed, 2026-10-30)
if (!a) {
const nf = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>No wall under that name | InstantAdPay</title><meta name="robots" content="noindex"><link rel="icon" type="image/png" href="/logo-icon.png"><link rel="stylesheet" href="/assets/site.css?v=20260911w"></head><body><section><div class="wrap" style="max-width:720px;text-align:center;padding:60px 0"><h1>No wall under that name</h1><p class="muted">This member page does not exist or was removed.</p><p><a class="btn" href="/">Go to InstantAdPay</a></p></div></section></body></html>';
res.writeHead(404, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-cache', 'X-Robots-Tag': 'noindex' }));
return res.end(nf);
}
let html = fs.readFileSync(path.join(PUBLIC_DIR, 'wall.html'), 'utf8');
if (a) {
const nm = a.username ? '@' + a.username : 'member #' + (a.memberId || 0);
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
const title = nm + ' on InstantAdPay';
const desc = a.bio ? esc(a.bio).slice(0, 200) : 'Join ' + nm + '’s line on InstantAdPay — instant on-chain ad payouts, free to join.';
const img = a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://instantadpay.com/banners/iap-hero-1200x630.png';
const bought = await hasBought(a); // only a paying member's avatar becomes the share image
const title = nm + '\u2019s ad wall | InstantAdPay';
const desc = esc(wallDescription(nm)); // fixed site sentence, never the bio (indexed snippet stays ours)
const img = bought && a.avatarUrl && /^https:/.test(a.avatarUrl) ? a.avatarUrl : 'https://instantadpay.com/banners/iap-hero-1200x630.png';
const url = 'https://instantadpay.com/wall/' + (a.username || a.code);
const og = [
'<meta property="og:type" content="profile">',
+133
View File
@@ -0,0 +1,133 @@
// Link-farm scan (Marty, 2026-10-30). BYTE-FOR-BYTE COPY in both repos (InstantAdPay site/ and LinkSpin site/): the two
// sites must flag the same accounts by the same rule; qa/profile-policy.test.cjs on each side hashes this file and
// prohibited.js against the sibling checkout when it is present. Edit one, copy to the other, never fork.
//
// Why: an SEO backlink farm opened 106 free accounts with casino and local-business bios plus a website link, and the public
// walls put that text in front of Google. The accounts are gone; this job finds the next batch before the crawler does.
// What: an in-app daily job (checked every few minutes, claimOnce per Central day, runs at 06:30 Central; replaces a server
// cron) lists accounts with memberId 0 and no wallet that carry a link (URL in the bio, or any social set) AND at least
// one farm signal: a prohibited term in the bio or socials, a sign-in that stopped within 15 minutes of the sign-up, or
// no sponsor at all. Emails on the site's spamScanAllow setting are skipped. The result lands in DATA_DIR/wall-spam-scan.json
// and, only when there are candidates, ONE Telegram goes to the private admin chat. The admin pane "Link-farm list"
// (Admin > Members) shows the rows with delete (the existing DELETE /api/admin/member, which refuses on-chain members) and
// allow (adds the email to spamScanAllow). Nothing is deleted automatically, and nothing cascades to the other site.
'use strict';
const fs = require('fs');
const path = require('path');
const P = require('./prohibited');
const TZ = 'America/Chicago';
const dayOf = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: TZ });
const minuteOf = ts => { const [h, m] = new Date(ts).toLocaleTimeString('en-GB', { timeZone: TZ, hour: '2-digit', minute: '2-digit', hour12: false }).split(':').map(Number); return h * 60 + m; };
const RUN_AT = 6 * 60 + 30; // 06:30 Central
const QUICK_MS = 15 * 60 * 1000;
const DEFAULT_ALLOW = ['cryptogoat76@gmail.com', 'csicsokaren@gmail.com', 'osamedefe2026@gmail.com'];
const SOCIAL_KEYS = ['facebook', 'twitter', 'youtube', 'instagram', 'tiktok', 'telegram', 'linkedin', 'website', 'video'];
const LINK_KEYS = ['website', 'twitter', 'youtube']; // the fields a farm comes for (quarantine rule at profile save)
let X = null, FILE = null, S = null, running = false;
// opts: { dataDir, site, siteUrl, accounts, siteConfig(), saveSite(patch), notify(text) async, marks?, alsoOn?(email) async -> true|false|null, otherSite }
function init(opts) { X = opts; FILE = path.join(opts.dataDir, 'wall-spam-scan.json'); S = load(); }
function load() { try { return JSON.parse(fs.readFileSync(FILE, 'utf8')); } catch (e) { return { day: null, at: 0, candidates: [], scanned: 0, skipped: 0 }; } }
function save() { try { fs.writeFileSync(FILE, JSON.stringify(S, null, 2)); } catch (e) {} }
async function claimOnce(key) { try { return X.marks ? await X.marks.claim(key) : true; } catch (e) { return true; } }
const norm = e => String(e || '').trim().toLowerCase();
function parseSocials(v) { if (!v) return null; if (typeof v === 'object') return v; try { const o = JSON.parse(v); return o && typeof o === 'object' ? o : null; } catch (e) { return null; } }
// every link a profile carries, socials first, then URLs picked out of the bio
function linksOf(a) {
const out = []; const soc = parseSocials(a.socials) || {};
for (const k of SOCIAL_KEYS) { const v = String(soc[k] || '').trim(); if (v) out.push(v); }
const m = String(a.bio || '').match(/https?:\/\/[^\s<>"']+|(?:www\.)?[a-z0-9-]+(?:\.[a-z0-9-]+)*\.[a-z]{2,24}(?:\/[^\s<>"']*)?/gi);
if (m) for (const u of m) if (!out.includes(u)) out.push(u);
return out;
}
// Allowlist: the site setting (array or comma/space separated string) plus the seeded three.
function allowlist() {
const c = (X && X.siteConfig && X.siteConfig()) || {};
const raw = c.spamScanAllow == null ? DEFAULT_ALLOW : c.spamScanAllow;
const arr = Array.isArray(raw) ? raw : String(raw).split(/[\s,;]+/);
return [...new Set(arr.map(norm).filter(Boolean))];
}
function setAllow(email, on) {
const list = allowlist(); const e = norm(email); if (!e) return list;
const next = on ? [...new Set(list.concat(e))] : list.filter(x => x !== e);
if (X.saveSite) X.saveSite({ spamScanAllow: next.join(', ') });
return next;
}
// The detector. Pure: account in, verdict out. `allow` is a Set of lower-cased emails (defaults to the site allowlist).
function classify(a, allow, now) {
now = now || Date.now();
const r = { email: a.email, candidate: false, reasons: [], links: [] };
if (!a || !a.email) return r;
if (Number(a.memberId) > 0) return r; // a buyer is a member, never a candidate
if (a.address) return r; // a wallet means they came to earn, not to plant a link
const bioUrl = P.hasUrl(a.bio);
const soc = parseSocials(a.socials); const socialsPresent = !!(soc && SOCIAL_KEYS.some(k => String(soc[k] || '').trim()));
if (!bioUrl && !socialsPresent && !a.profileQuarantined) return r;
r.links = linksOf(a);
const term = P.match(a.bio) || (soc ? SOCIAL_KEYS.map(k => P.match(soc[k])).find(Boolean) : null);
if (term) r.reasons.push('prohibited:' + term);
const seen = Number(a.lastSeen) || Number(a.created) || now;
if (Number(a.created) && seen - Number(a.created) < QUICK_MS) r.reasons.push('quick');
if (!a.sponsorRef) r.reasons.push('no-sponsor');
if (a.profileQuarantined) r.reasons.push('quarantined');
if (!r.reasons.length) return r;
if ((allow || new Set(allowlist())).has(norm(a.email))) { r.allowlisted = true; return r; }
r.candidate = true;
return r;
}
// Quarantine rule at profile save (Marty): a brand-new account (memberId 0, no wallet, no sponsor, younger than 24 h)
// whose FIRST profile save carries a URL in the bio or a website / X / YouTube social is saved with profileQuarantined.
function shouldQuarantine(acct, bio, socials, now) {
now = now || Date.now();
if (!acct || Number(acct.memberId) > 0 || acct.address || acct.sponsorRef) return false;
if (!(Number(acct.created) > 0) || now - Number(acct.created) >= 24 * 3600 * 1000) return false;
if (acct.bio || parseSocials(acct.socials)) return false; // not the first save
const soc = parseSocials(socials) || {};
return P.hasUrl(bio) || LINK_KEYS.some(k => String(soc[k] || '').trim());
}
const QUARANTINE_NOTICE = 'Your profile links will appear after your first ad package.';
// One pass over every account. Writes the result file; sends the Telegram when there is anything to review.
async function run(opts) {
if (running) return S; running = true;
try {
const now = Date.now(); const allow = new Set(allowlist());
const all = await X.accounts.listAll(50000, { shells: true });
const names = new Map(); for (const a of all) { if (a.username) names.set(norm(a.username), a); if (a.code) names.set(norm(a.code), a); }
const out = []; let skipped = 0;
for (const a of all) {
const c = classify(a, allow, now);
if (c.allowlisted) { skipped++; continue; }
if (!c.candidate) continue;
const sp = a.sponsorRef ? names.get(norm(a.sponsorRef)) : null;
let alsoOn = null; try { alsoOn = X.alsoOn ? await X.alsoOn(a.email, a) : null; } catch (e) { alsoOn = null; }
out.push({ email: a.email, username: a.username || null, created: Number(a.created) || 0, lastSeen: Number(a.lastSeen) || 0, sponsorRef: a.sponsorRef || '',
sponsorName: sp ? (sp.username ? '@' + sp.username : sp.email) : (a.sponsorRef || null), firstLink: c.links[0] || null, links: c.links.slice(0, 6), reasons: c.reasons,
bio: String(a.bio || '').slice(0, 160), quarantined: !!a.profileQuarantined, alsoOn });
}
out.sort((x, y) => y.created - x.created);
S = { day: dayOf(now), at: now, candidates: out, scanned: all.length, skipped, manual: !!(opts && opts.manual) }; save();
if (out.length && !(opts && opts.quiet)) { try { await X.notify(telegramText(out, now)); S.notified = now; save(); } catch (e) { console.error('spamscan notify', e.message); } }
console.log('spamscan', X.site, 'scanned', all.length, 'candidates', out.length, 'allowlisted', skipped);
return S;
} finally { running = false; }
}
function telegramText(out, now) {
const lines = [X.site + ' link-farm scan: ' + out.length + ' candidate account' + (out.length === 1 ? '' : 's') + ' (' + dayOf(now) + ', ' + X.siteUrl.replace(/^https?:\/\//, '') + ')'];
for (const c of out.slice(0, 15)) lines.push((c.username ? '@' + c.username : c.email) + ' | joined ' + dayOf(c.created || now) + ' | sponsor ' + (c.sponsorName || 'none') + ' | ' + (c.firstLink || 'no link') + (c.alsoOn === true ? ' | also on ' + X.otherSite : ''));
if (out.length > 15) lines.push('... and ' + (out.length - 15) + ' more');
lines.push('Review in Admin > Members > Link-farm list');
return lines.join('\n');
}
// checked every few minutes from server.js: once per Central day, from 06:30 on
async function tick(now) {
now = now || Date.now(); const day = dayOf(now);
if (minuteOf(now) < RUN_AT || S.day === day) return { skipped: true };
if (!await claimOnce('spamscan:' + day)) { S.day = day; save(); return { skipped: true, claimedElsewhere: true }; }
return run();
}
function view() { return { site: X ? X.site : null, otherSite: X ? X.otherSite : null, last: S, allow: allowlist(), running }; }
module.exports = { init, classify, shouldQuarantine, linksOf, allowlist, setAllow, run, tick, view, telegramText, QUARANTINE_NOTICE, DEFAULT_ALLOW, RUN_AT, QUICK_MS, dayOf, minuteOf };
+4 -1
View File
@@ -474,7 +474,10 @@ async function readyTick() {
if (await alignToNetwork(a).catch(() => null)) { aligned++; continue; }
if (remoteOpen(a.email)) continue;
const rec = markReady(a);
if (rec && !rec.notified) { rec.notified = clock(); fresh.push({ email: a.email, name: nameOf(a), username: a.username || null, until: rec.readyAt + READY_MS }); }
// linkedNow: the member was on the site when they became ready, so they linked the wallet just now; otherwise the
// wallet predates this tank visit (e.g. a dormant member returned by a sponsor; Marty 2026-10-29: the notice read as a
// fresh link) and the notice says so, with their last sign-in
if (rec && !rec.notified) { rec.notified = clock(); fresh.push({ email: a.email, name: nameOf(a), username: a.username || null, until: rec.readyAt + READY_MS, lastSeen: a.lastSeen || 0, linkedNow: (a.lastSeen || 0) >= rec.readyAt - 15 * 60 * 1000 }); }
}
RS.save();
const auto = await autoAssign();
+97
View File
@@ -0,0 +1,97 @@
# BixPay promo banners (2026-10-29): four text-only sizes for Promo tools > BixPay. No BIX logo (brand rules not confirmed),
# the "crypto Visa card" angle in the game-banner style: deep green, mint accent, Sora-like bold display text, a card motif
# drawn with shapes. Run: python tools/gen-bixpay-banners.py <outdir> then upload to Spaces game-banners/bixpay/.
# Copy rules: no income promises, the one fee line, no em dashes.
import sys, os
from PIL import Image, ImageDraw, ImageFont
OUT = sys.argv[1] if len(sys.argv) > 1 else "D:/tmp/bixpay-banners"
os.makedirs(OUT, exist_ok=True)
GREEN = (4, 59, 47); DEEP = (3, 38, 31); MINT = (67, 232, 195); INK = (236, 248, 243); MUTED = (170, 205, 194); AMBER = (255, 178, 56)
FONTS = ["C:/Windows/Fonts/segoeuib.ttf", "C:/Windows/Fonts/arialbd.ttf"]
FONT_R = ["C:/Windows/Fonts/segoeui.ttf", "C:/Windows/Fonts/arial.ttf"]
def font(size, bold=True):
for p in (FONTS if bold else FONT_R):
if os.path.exists(p): return ImageFont.truetype(p, size)
return ImageFont.load_default()
def bg(w, h):
im = Image.new("RGB", (w, h), GREEN)
d = ImageDraw.Draw(im)
# soft diagonal band
for i in range(h):
t = i / max(1, h - 1)
c = tuple(int(GREEN[k] * (1 - t) + DEEP[k] * t) for k in range(3))
d.line([(0, i), (w, i)], fill=c)
return im
def card(d, x, y, w, h):
# a plain card shape: rounded rectangle, a chip, a stripe. No brand marks.
d.rounded_rectangle((x, y, x + w, y + h), radius=int(h * 0.12), fill=MINT)
d.rounded_rectangle((x + w * 0.08, y + h * 0.32, x + w * 0.26, y + h * 0.56), radius=int(h * 0.05), fill=(214, 182, 90))
d.rounded_rectangle((x + w * 0.08, y + h * 0.70, x + w * 0.62, y + h * 0.78), radius=int(h * 0.03), fill=(6, 60, 48))
d.ellipse((x + w * 0.70, y + h * 0.62, x + w * 0.84, y + h * 0.86), fill=(6, 60, 48))
d.ellipse((x + w * 0.79, y + h * 0.62, x + w * 0.93, y + h * 0.86), outline=(6, 60, 48), width=max(2, int(h * 0.03)))
def text_w(d, s, f):
b = d.textbbox((0, 0), s, font=f); return b[2] - b[0], b[3] - b[1]
def fit(d, s, maxw, start, bold=True, floor=10):
sz = start
while sz > floor:
f = font(sz, bold)
if text_w(d, s, f)[0] <= maxw: return f
sz -= 1
return font(floor, bold)
def pill(d, x, y, s, f, pad=10):
# the text's bbox offsets (Segoe sits a few px below the origin) are subtracted so the label is centred in the pill
b = d.textbbox((0, 0), s, font=f); tw, th = b[2] - b[0], b[3] - b[1]
d.rounded_rectangle((x, y, x + tw + pad * 2, y + th + pad * 2), radius=(th + pad * 2) // 2, fill=MINT)
d.text((x + pad - b[0], y + pad - b[1]), s, font=f, fill=(4, 30, 24))
return tw + pad * 2
def pill_size(d, s, f, pad=10):
b = d.textbbox((0, 0), s, font=f); return b[2] - b[0] + pad * 2, b[3] - b[1] + pad * 2
def leaderboard(w, h): # 728x90, 468x60
im = bg(w, h); d = ImageDraw.Draw(im)
ch = int(h * 0.62); cw = int(ch * 1.58); cx = int(h * 0.18); cy = (h - ch) // 2
card(d, cx, cy, cw, ch)
x = cx + cw + int(h * 0.22)
head = "A Visa card for your crypto"
f1 = fit(d, head, w * 0.52, int(h * 0.30)); d.text((x, int(h * 0.12)), head, font=f1, fill=INK)
sub = "Spend POL anywhere Visa is accepted. 3% per purchase, no load fee."
f2 = fit(d, sub, w * 0.55, int(h * 0.17), bold=False); d.text((x, int(h * 0.56)), sub, font=f2, fill=MUTED)
f3 = font(int(h * 0.19)); s = "Get the card"; pad = int(h * 0.09)
pw, ph = pill_size(d, s, f3, pad); pill(d, w - pw - int(h * 0.18), (h - ph) // 2, s, f3, pad=pad)
return im
def rectangle(w, h): # 300x250
im = bg(w, h); d = ImageDraw.Draw(im)
f0 = font(12); d.text((18, 16), "CRYPTO VISA CARD", font=f0, fill=MINT)
cw = 118; ch = 74; card(d, w - cw - 18, 14, cw, ch)
head = "Spend your POL\nanywhere"
f1 = font(26); d.multiline_text((18, 96), head, font=f1, fill=INK, spacing=0)
sub = "A self-custody wallet with a Visa card.\nApple Pay and Google Pay.\n3% per purchase, no load fee."
f2 = font(12, bold=False); d.multiline_text((18, 160), sub, font=f2, fill=MUTED, spacing=3)
f3 = font(14); s = "Get the card"; pw, ph = pill_size(d, s, f3, 9); pill(d, w - pw - 18, h - ph - 14, s, f3, pad=9)
return im
def splash(w, h): # 600x300
im = bg(w, h); d = ImageDraw.Draw(im)
f0 = font(15); d.text((30, 26), "CRYPTO VISA CARD", font=f0, fill=MINT)
card(d, w - 230, 36, 196, 122)
head = "Spend your POL\nanywhere Visa\nis accepted."
f1 = font(40); d.multiline_text((30, 54), head, font=f1, fill=INK, spacing=0)
sub = "A self-custody wallet with a Visa card. Virtual card from $9.99. 3% per purchase, no load fee."
f2 = fit(d, sub, w - 60, 17, bold=False); d.text((30, 218), sub, font=f2, fill=MUTED)
f3 = font(18); s = "Get your card"; pw, ph = pill_size(d, s, f3, 12); pill(d, w - pw - 30, h - ph - 24, s, f3, pad=12)
return im
SIZES = {"728x90": leaderboard, "468x60": leaderboard, "300x250": rectangle, "600x300": splash}
for s, fn in SIZES.items():
w, h = map(int, s.split("x"))
im = fn(w, h)
assert im.size == (w, h)
p = os.path.join(OUT, "bixpay-" + s + ".png"); im.save(p, optimize=True)
print(p, os.path.getsize(p), "bytes")
+8 -3
View File
@@ -80,12 +80,17 @@ async function send(input, opts) {
return { ok: true, test: true, to };
}
if (running) return { error: 'A send is already running (' + running.sent + ' of ' + running.total + '). Wait for it to finish.' };
const kind = AUDIENCES[input.audience] ? input.audience : 'optin';
// claim the slot BEFORE the slow recipient list (Sendy opt-in checks take minutes): two sends raced on 2026-10-28 and 475 members got the POL Miner email twice
running = { sent: 0, total: 0, building: true };
let kind, list;
try {
kind = AUDIENCES[input.audience] ? input.audience : 'optin';
unknownOptins = 0;
let list = await recipients(kind);
list = await recipients(kind);
if (Array.isArray(input.to) && input.to.length) { const want = new Set(input.to.map(e => String(e).toLowerCase())); const all = await R.accounts.listAll(20000); list = all.filter(a => a.email && want.has(String(a.email).toLowerCase())); } // explicit list (repairs)
if (unknownOptins && !(input.to && input.to.length)) console.log('updates: Sendy gave no answer for', unknownOptins, 'members; they were left out of this send');
if (!list.length) return { error: 'Nobody in that audience.' };
if (!list.length) { running = null; return { error: 'Nobody in that audience.' }; }
} catch (e) { running = null; throw e; }
const rec = { id: Date.now().toString(36), ts: Date.now(), subject: compose(input, null).subject, noteIds, audience: kind, total: list.length, sent: 0, skipped: 0, failed: 0, status: 'running', unknown: unknownOptins, recipients: list.map(a => a.email) };
const l = log(); l.sends.unshift(rec); l.sends = l.sends.slice(0, 50); saveLog(l); running = rec;
(async () => {
+9 -5
View File
@@ -35,6 +35,7 @@ function games() {
{ key: 'roadagent', name: 'Road Agent', url: process.env.RA_URL, secret: process.env.RA_SSO_SECRET },
{ key: 'polybreak', name: 'PolyBreak', url: process.env.PB_URL || 'https://polybreak.app', secret: process.env.PB_SSO_SECRET },
{ key: 'polminer', name: 'POL Miner', url: process.env.POLMINER_URL || 'https://polminer.com', secret: process.env.POLMINER_SSO_SECRET }, // 2026-10-28: idle until POLMINER_SSO_SECRET is set
{ key: 'warpwares', name: 'Warp & Wares', url: process.env.WW_URL || 'https://warpwares.saasy.top', secret: process.env.WW_SSO_SECRET }, // 2026-10-29: idle until WW_SSO_SECRET is set
{ key: 'spellwheel', name: 'SpellWheel', url: process.env.SW_URL || 'https://spellwheel.com', secret: process.env.SW_SSO_SECRET },
{ key: 'polywarriors', name: 'PolyWarriors', url: process.env.PW_URL || 'https://polywarriors.com', secret: process.env.PW_SSO_SECRET }
].filter(g => g.url && g.secret && String(g.secret).trim().length >= 32);
@@ -74,7 +75,7 @@ function fetchRows(g) {
});
}
// copy (Marty, 2026-10-27): the ask is the LINK step only (one free signature), never "switch on payouts": a linked wallet is paid
function copy(games, stage, link) {
function copy(games, stage, link, bixLine) {
const total = games.reduce((n, g) => n + g.unpaid, 0);
const parts = games.map(g => g.unpaid.toFixed(2) + ' POL in ' + g.name);
const list = parts.length > 1 ? parts.slice(0, -1).join(', ') + ' and ' + parts[parts.length - 1] : parts[0];
@@ -82,8 +83,11 @@ function copy(games, stage, link) {
const p1 = "You've earned " + list + ". Link your wallet (one free signature) and it's sent automatically, including everything you've earned so far.";
const p2 = 'It is not a transaction and it cannot move funds. Every game pays that same wallet from then on.';
const p3 = stage >= 2 ? 'This is the last reminder about this balance. It stays yours; it just waits for a wallet.' : 'Not sure which wallet to use? SafePal is the one we recommend; MetaMask and Phantom work too. The Wallet tab has a short guide.';
const text = [p1, '', p2, '', 'Link your wallet: ' + link, '', p3].join('\n');
const html = '<p>' + esc(p1).replace(esc(list), '<b>' + esc(list) + '</b>') + '</p><p>' + esc(p2) + '</p><p><a href="' + esc(link) + '"><b>Link your wallet</b></a></p><p>' + esc(p3) + '</p>';
// BixPay (2026-10-29): one sentence after the wallet ask, the member's resolved partner link behind a counted /go link; '' while bixpayLive is off
const bx = String(bixLine || '').trim();
const text = [p1, '', p2, '', 'Link your wallet: ' + link, '', p3].concat(bx ? ['', bx] : []).join('\n');
const bxHtml = bx ? '<p>' + esc(bx).replace(/(https:\/\/\S+)/, '<a href="$1">$1</a>') + '</p>' : '';
const html = '<p>' + esc(p1).replace(esc(list), '<b>' + esc(list) + '</b>') + '</p><p>' + esc(p2) + '</p><p><a href="' + esc(link) + '"><b>Link your wallet</b></a></p><p>' + esc(p3) + '</p>' + bxHtml;
return { subject, text, html, total };
}
async function tick() {
@@ -132,7 +136,7 @@ async function tick() {
const stage = p.sent.length; if (stage >= STAGES.length) continue;
if (now - p.first < STAGES[stage]) continue;
const link = (R.site || 'https://instantadpay.com') + '/my#wallet';
const c = copy(gs, stage, link);
const c = copy(gs, stage, link, R.bixLine ? R.bixLine(a) : '');
let ok = false;
try { await R.message(email, c.subject, c.html); ok = true; } catch (e) {}
if (R.mailer && R.mailer.hasKey && R.mailer.hasKey() && R.optedIn) { try { if (await R.optedIn(email)) { await R.mailer.send(email, c.subject, c.text, c.html); ok = true; } } catch (e) {} }
@@ -154,4 +158,4 @@ function adminView() {
return { stats: Object.assign({ pushed: 0 }, S.stats), lastRun: S.lastRun, lastRows: S.lastRows, games: games().map(g => ({ key: g.key, name: g.name, url: g.url, nudge: g.nudge !== false })),
pushed: (S.pushLog || []).slice(0, 100), pushRefused: Object.values(S.pushes || {}).filter(x => x.status !== 'ok').sort((a, b) => b.at - a.at).slice(0, 100), waiting: people.filter(p => !p.done), done: people.filter(p => p.done).slice(0, 100) };
}
module.exports = { init, tick, waitingFor, adminView, games, STAGES };
module.exports = { init, tick, waitingFor, adminView, games, STAGES, copy };