Share-link domains: ctbgo.com (active, site config shareDomain) and mylinehq.com (spare) 302 /<name> to /join/<name> (query kept, noindex); member invite line and promo tools now hand out https://ctbgo.com/<name>; old instantadpay.com/join links keep working

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-20 05:46:58 -05:00
parent 4df932723e
commit 2e0a4af28f
3 changed files with 23 additions and 3 deletions
+9 -2
View File
@@ -1,3 +1,8 @@
// member share links go out on the share domain (2026-10-20): https://ctbgo.com/<name> -> /join/<name> 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 @@
+ '<br>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.';
+1 -1
View File
@@ -1186,7 +1186,7 @@
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20261016p"></script>
<script src="/assets/support.js?v=20261016a"></script>
<script src="/assets/my.js?v=20261018tiers"></script>
<script src="/assets/my.js?v=20261020share"></script>
<script src="/assets/chat.js?v=20261016n"></script>
</body>
</html>
+13
View File
@@ -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://<shareDomain>/<username>, which 302s to
// /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',
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): /<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)) {
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']);