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>
This commit is contained in:
@@ -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 };
|
||||
@@ -85,7 +87,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)
|
||||
@@ -551,7 +553,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
|
||||
@@ -650,6 +652,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 +669,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
|
||||
@@ -816,6 +820,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 +1364,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
|
||||
@@ -2245,6 +2255,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 });
|
||||
}
|
||||
@@ -2791,6 +2802,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);
|
||||
@@ -3330,6 +3344,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?' });
|
||||
@@ -3420,6 +3442,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 });
|
||||
@@ -3434,7 +3457,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) } });
|
||||
}
|
||||
@@ -4631,6 +4654,31 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = await accounts.setProfile(s.email, avatar, bio, socials);
|
||||
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);
|
||||
@@ -5257,7 +5305,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(),
|
||||
@@ -5613,6 +5662,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() });
|
||||
}
|
||||
@@ -5704,6 +5755,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
|
||||
|
||||
Reference in New Issue
Block a user