Spamhaus DBL cleanup (2026-11-17): close the ad-click redirector, mail links on the share domain

- /api/ads/click/<id> only redirects off-site for an active campaign (or its owner). Ended, paused,
  archived and flagged campaigns (488 of them, e.g. #164 -> shrt1.xyz) kept forwarding forever, a
  standing instantadpay.com redirector. They now land on the home page, uncounted.
- mailer.js rewrites every instantadpay.com URL in subject/text/html and List-Unsubscribe to
  MAIL_BASE (default https://instantadpay.link; '' = off). Email addresses and subdomains untouched.
- Share hosts answer /unsubscribe (GET + RFC 8058 POST) and /banners/* in place; leaderboard, blog,
  presentation, partners, launch, plays, bixpay, wall are pages, not usernames (none taken).
- NAS syndicated ad click URLs go out on instantadpay.link (NAS_CLICK_BASE) for new pushes.
- toolkit.js member links (AI writer, handout QR, split-test, partner promo) use shareDomain.
- my.js: banner "copy URL" on the share domain; bridge link (Wednesday/Friday) now builds from the
  share-form invite line (it silently fell back to the plain invite). my.js?v=20261117dbl.
iap-qa member: 0 bugs; networksso-partner e2e all passed on rerun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 09:29:11 -06:00
parent f1c8ba33c8
commit 8c9d72a768
6 changed files with 39 additions and 15 deletions
+8 -5
View File
@@ -92,7 +92,7 @@ async function status(email) {
const u = usage()[email] || {}; const used = (u.months || {})[monthKey()] || 0;
const allowance = allowanceFor(tier, sc); const cost = Number(sc.aiCreditsPerGen) || 10;
let available = 0; try { const st = await R.ads.viewStatus(email); available = st.earnedAvailable != null ? st.earnedAvailable : (st.earned || 0); } catch (e) {}
const link = 'https://instantadpay.com/join/' + (acct.username || acct.code);
const link = SHARE() + '/join/' + (acct.username || acct.code);
const partner = tier === 'nexus' ? await partnerStatus(email) : null;
const handoutUrl = rank[tier] >= rank.spark && acct.username ? 'https://instantadpay.com/handout/' + acct.username : null;
return { tier, badges, username: acct.username || null, partner, handoutUrl, videoMaker: !!(R.videomaker && R.videomaker.available()), unlocked: ['surge', 'circuit', 'nexus'].includes(tier), engine: !!key(), allowance, used, freeLeft: Math.max(0, allowance - used), cost, available, link,
@@ -129,6 +129,9 @@ async function adminUsage() {
// ---- the rest of the ladder (Marty, 2026-09-14): Spark templates + handout, Circuit split tester + Video
// Maker, Nexus Leader Ops + team grants + a member-funded partner code ----
const KIT = 'https://instantadpay.com';
// member links that get pasted elsewhere go out on the share domain (2026-11-17, Spamhaus DBL: instantadpay.com is listed);
// <share>/join/<user> passes through to the join page. shareDomain '' (admin settings) = the old instantadpay.com links.
const SHARE = () => { const d = String((R && R.siteConfig && R.siteConfig().shareDomain) || '').trim().toLowerCase(); return /^[a-z0-9.-]+\.[a-z]{2,}$/.test(d) ? 'https://' + d : KIT; };
async function tierOf(email) { return tierFor(await R.ads.milestonesOf(email)); }
const rank = { free: 0, spark: 1, surge: 2, circuit: 3, nexus: 4 };
const atLeast = (tier, need) => rank[tier] >= rank[need];
@@ -154,7 +157,7 @@ async function template(email, memberId, ids, kind, budget) {
async function handout(username) {
const a = await R.accounts.byUsername(username); if (!a) return null;
if (!atLeast(await tierOf(a.email), 'spark')) return null;
const link = KIT + '/join/' + username; const qr = '/api/qr?d=' + encodeURIComponent(link);
const link = SHARE() + '/join/' + username; const qr = '/api/qr?d=' + encodeURIComponent(link);
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
return '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>InstantAdPay handout for @' + esc(username) + '</title><meta name="robots" content="noindex">'
+ '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">'
@@ -168,7 +171,7 @@ async function handout(username) {
async function split(email) {
const tier = await tierOf(email);
const st = await R.coach.linkStats(email);
const acct = await R.accounts.byEmail(email); const base = KIT + '/join/' + (acct.username || acct.code);
const acct = await R.accounts.byEmail(email); const base = SHARE() + '/join/' + (acct.username || acct.code);
const rows = (st.angles || []).map(a => ({ angle: a.angle, link: base + (a.angle && a.angle !== 'plain' ? '?v=' + a.angle : ''), views: a.views || 0, views30: a.views30 || 0, joins: a.joins || 0, buyers: a.buyers || 0, rate: a.views ? Math.round(1000 * (a.joins || 0) / a.views) / 10 : 0 }));
const withData = rows.filter(r => r.views >= 10); const best = withData.length ? withData.slice().sort((x, y) => y.rate - x.rate || y.joins - x.joins)[0] : null;
return { unlocked: atLeast(tier, 'circuit'), rows, best: best ? best.angle : null, sources: st.sources || [] };
@@ -219,12 +222,12 @@ async function partnerCode(email, code, credits) {
const r = await R.promos.create({ code, credits: n, funder: email, partner: 'member: ' + email, note: 'member-funded partner code', maxUses: 0, expires: null, active: true });
if (r.error) return r;
const acct = await R.accounts.byEmail(email);
return { ok: true, code: r.code.code, credits: n, link: KIT + '/join/' + (acct.username || acct.code) + '?promo=' + r.code.code, kit: KIT + '/partners?ref=' + (acct.username || acct.code) + '&promo=' + r.code.code };
return { ok: true, code: r.code.code, credits: n, link: SHARE() + '/join/' + (acct.username || acct.code) + '?promo=' + r.code.code, kit: SHARE() + '/partners?ref=' + (acct.username || acct.code) + '&promo=' + r.code.code };
}
async function partnerStatus(email) {
const mine = await R.promos.byFunder(email); const acct = await R.accounts.byEmail(email);
if (!mine.length) return null; const c = mine[0];
return { code: c.code, credits: c.credits, uses: (await R.promos.adminView()).codes.find(x => x.code === c.code)?.uses || 0, link: KIT + '/join/' + (acct.username || acct.code) + '?promo=' + c.code, kit: KIT + '/partners?ref=' + (acct.username || acct.code) + '&promo=' + c.code };
return { code: c.code, credits: c.credits, uses: (await R.promos.adminView()).codes.find(x => x.code === c.code)?.uses || 0, link: SHARE() + '/join/' + (acct.username || acct.code) + '?promo=' + c.code, kit: SHARE() + '/partners?ref=' + (acct.username || acct.code) + '&promo=' + c.code };
}
module.exports = { init, status, generate, adminUsage, TIERS, KINDS, template, handout, split, videos, makeVideo, team, nudge, grant, partnerCode, partnerStatus };