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
+10 -3
View File
@@ -2405,9 +2405,12 @@ const server = http.createServer(async (req, res) => {
// share-link domains (instantadpay.link active since 2026-11-04; ctbgo.com and mylinehq.com still answer): /<ref> goes to that member's join page, anything else to the same path
// here. 302 (not 301) so links never get pinned in caches; the query (?v= angle, ?promo=) rides along.
{ const sh = String(req.headers.host || '').toLowerCase().replace(/:\d+$/, '').replace(/^www\./, '');
if (SHARE_HOSTS.includes(sh)) {
// a public page name is that page, not a username (2026-11-17: the Network Weekend email links instantadpay.link/weekend)
const ref = /^\/(weekend|friday|wednesday|ledger|refuel|facts|games|support|my|join)\/?$/.test(p) ? null : /^\/([A-Za-z0-9_]{1,40})\/?$/.exec(p);
// answered in place on a share host, never redirected (2026-11-17, mail links moved to the share domain): the
// unsubscribe link (RFC 8058 one-click is a POST, which a 302 would break) and the banner images mail and promo tools embed
if (SHARE_HOSTS.includes(sh) && !(p === '/unsubscribe' || ((req.method === 'GET' || req.method === 'HEAD') && /^\/banners\/[\w.-]+$/.test(p)))) {
// a public page name is that page, not a username (2026-11-17: the Network Weekend email links instantadpay.link/weekend;
// leaderboard/blog/presentation added the same day when every email's links moved here; no member holds those names)
const ref = /^\/(weekend|friday|wednesday|ledger|refuel|facts|games|support|my|join|leaderboard|blog|presentation|partners|launch|plays|bixpay|wall)\/?$/.test(p) ? null : /^\/([A-Za-z0-9_]{1,40})\/?$/.exec(p);
const to = 'https://instantadpay.com' + (p === '/' ? '/' : ref ? '/join/' + ref[1] : p) + (u.search || '');
res.writeHead(302, { Location: to, 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' }); return res.end();
} }
@@ -5644,6 +5647,10 @@ const server = http.createServer(async (req, res) => {
let own = false, cm = null;
try { cm = await ads.campaignById(m[1]); } catch (e) {}
try { const s = cm && await auth.fromRequest(req); if (s && s.email) own = !!(cm.owner && String(cm.owner).toLowerCase() === String(s.email).toLowerCase()); } catch (e) {}
// only a running campaign redirects off-site (2026-11-17, Spamhaus DBL): an ended, paused, archived or flagged campaign's
// click link used to keep forwarding to its target forever (e.g. #164 -> a URL shortener), a ready-made instantadpay.com
// redirector for anyone. Those now land on the home page, uncounted. The owner can still open their own link.
if (!own && (!cm || cm.status !== 'active')) { res.writeHead(302, baseHeaders({ Location: '/', 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' })); return res.end(); }
const target = own ? await ads.targetOf(m[1]) : await ads.click(m[1]);
if (!target) { res.writeHead(404, baseHeaders()); return res.end(); }
if (!own) coach.recordClick(m[1], req.headers.referer); // where the click happened