diff --git a/public/assets/my.js b/public/assets/my.js index 4ea4a76..3e2cdb5 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -1,3 +1,8 @@ +// member share links go out on the share domain (2026-10-20): https://ctbgo.com/ -> /join/ on InstantAdPay. +// The domain comes from site config (shareDomain); empty falls back to this site's own /join link. +let SHARE_DOMAIN = ''; +const SHARE_READY = fetch('/api/config').then(r => r.json()).then(c => { SHARE_DOMAIN = String((c && c.shareDomain) || '').trim(); }).catch(() => {}); +function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(String(ref)) ? 'https://' + SHARE_DOMAIN + '/' + ref : location.origin + '/join/' + ref; } // My account: email-first join/login, wallet link at purchase time, // free payout activation, invite link, on-chain activity. (async function () { @@ -728,7 +733,8 @@ } } catch (e) {} // ready-to-send share message + promo tools, personalized - const link = location.origin + '/join/' + (d.username || d.refCode || d.memberId || ''); + await SHARE_READY; + const link = shareLink(d.username || d.refCode || d.memberId || ''); fillPromo(link, d); // founding-week readiness: shown until every item is done (or the launch moment is a week past) try { @@ -911,7 +917,8 @@ + '
On-chain member: ' + (me.memberId ? '#' + me.memberId : 'not yet'); // the share link works from day one; usernames make it a vanity link if (me.username || me.refCode || me.memberId) { - $('inviteLine').textContent = location.origin + '/join/' + (me.username || me.refCode || me.memberId); + await SHARE_READY; + $('inviteLine').textContent = shareLink(me.username || me.refCode || me.memberId); $('copyInvite').hidden = false; } else { $('inviteLine').textContent = 'Sign in with your email to get your link.'; diff --git a/public/my.html b/public/my.html index 2d491a4..3df5490 100644 --- a/public/my.html +++ b/public/my.html @@ -1186,7 +1186,7 @@ - + diff --git a/server.js b/server.js index 05f4bbb..96b2209 100644 --- a/server.js +++ b/server.js @@ -725,6 +725,10 @@ function siteConfig() { supportTelegramChat: '1289244227', // help desk pings: Marty's PRIVATE chat only (a positive user id; group/channel ids are refused). Sent with telegramBotToken, Hermes bot as fallback supportTemplates: '', // help desk saved replies, JSON [{name, body}] (Admin > Support > Saved replies); empty = the built-in set telegramGamesChatId: '', telegramGamesTopicId: '661565', // Game Achievements topic for the weekly Pass Tournament post (chat blank = the shared echo chat) + // share-link domain (2026-10-20, Marty): member invite links go out as https:///, which 302s to + // /join/ 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', pnlFixedMonthlyUsd: 0 }, saved); } @@ -1880,11 +1884,20 @@ async function gameAnswer(g, slug, acct) { // the game token (only once a userna return { ok: true, needUsername, username: acct.username || null, token: needUsername ? null : g.mint(acct, memberId), pass: gamePassMint(acct.email, slug) }; } +const SHARE_HOSTS = String(process.env.SHARE_HOSTS || 'ctbgo.com,mylinehq.com').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); const server = http.createServer(async (req, res) => { { const t0 = Date.now(); res.on('finish', () => { const ms = Date.now() - t0; if (ms > 3000) console.warn('slow request', req.method, String(req.url || '').split('?')[0].slice(0, 80), ms + 'ms', res.statusCode); }); } // visibility for member-felt delays (2026-10-12) try { const u = new URL(req.url, 'http://x'); const p = u.pathname; + // share-link domains (ctbgo.com, mylinehq.com): / 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)) { + const ref = /^\/([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(); + } } // -- traffic log: public page views by referring domain (admin > Traffic) if (req.method === 'GET' && (TRAFFIC_PAGES.has(p) || /^\/(join|from|wall|blog)\/[^/]+$/.test(p))) traffic.hit(p.startsWith('/blog/') ? '/blog/*' : p, req.headers.referer, req.headers['user-agent']);