From 1735748ee6c216204559f6095caab015681f84b1 Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 14 Nov 2026 11:38:03 -0600 Subject: [PATCH] Tracked network links (Marty 2026-11-14: "make sure each of these sites is its own traffic source and link spun so we can track it"): the footer's Part of the network links go through the LinkSpin network link for each site with ?src=stackpol (linkspin.app/r/, rel nofollow), so LinkSpin Reports show Stack POL as the source. netsites.js gains tracked() + go on /api/network-sites (same file in all five sites). Footer render checked locally. Co-Authored-By: Claude Opus 5.5 --- layout.js | 2 +- netsites.js | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/layout.js b/layout.js index 3eb035b..8b7997e 100644 --- a/layout.js +++ b/layout.js @@ -168,7 +168,7 @@ function tail(extra) { // Part of the network (Marty 2026-11-14 trust pack): the list comes from the hub (netsites.js, cached), built-in copy if not + '
Part of the networkOne account across the network' + netsites.list().map(s => (s.id === 'stackpol' || /stackpol\.com/.test(s.url)) ? '' + esc(s.name) + ' (you are here)' - : '' + esc(s.name) + '').join('') + '
' + : '' + esc(s.name) + '').join('') + '' + '
Honest numbersTotals are the combined payouts of everyone in the network, read from each program\'s payout records and the Polygon chain. One member\'s results are not a promise of yours. Cryptocurrency involves risk.
' + '

© ' + year + ' Stack POL by TrustClickz, 615 Green Valley Drive, Moody, AL 35004. Part of the Crypto Team Build Network. Stack POL shows payouts; it does not hold, invest or pay out anyone\'s money.

' // PolHunter mission (Marty 2026-11-10): silent unless a hunter arrives with their own #ph token; the code lands on one of the diff --git a/netsites.js b/netsites.js index 2536f92..e9288b4 100644 --- a/netsites.js +++ b/netsites.js @@ -32,9 +32,29 @@ function refresh() { return inflight; } function list() { if (Date.now() - cache.at > TTL) refresh(); return cache.list; } +// Tracked links (Marty 2026-11-14: "make sure each of these sites is its own traffic source and link spun so we can track it"): each +// entry also gets go = the LinkSpin network link for that site with ?src=, so a click shows in LinkSpin Reports under the +// site that sent it (LinkSpin netlinks.js: fixed codes on the admin account). This site = NETWORK_SITE_ID, else the request host. +// No go for this site itself, or when this site cannot be told (a test host): the page then uses the plain url. +const CODES = { iap: 'nwiap', linkspin: 'nwls', dlb: 'nwdlb', vbb: 'nwvbb', stackpol: 'nwsp', earnerscorner: 'nwec' }; +const linksBase = () => String(process.env.NETWORK_LINKS_BASE || 'https://linkspin.app').trim().replace(/\/+$/, ''); +const hostOf = u => { try { return new URL(u).hostname.toLowerCase().replace(/^www\./, ''); } catch (e) { return ''; } }; +function selfId(req, l) { + const env = String(process.env.NETWORK_SITE_ID || '').trim().toLowerCase(); if (env) return env; + const h = String((req && req.headers && (req.headers['x-forwarded-host'] || req.headers.host)) || '').split(',')[0].trim().toLowerCase().replace(/:\d+$/, '').replace(/^www\./, ''); + const m = h && (l || list()).find(s => hostOf(s.url) === h); return m ? m.id : ''; +} +// the LinkSpin-tracked link to site `id` sent from site `from` (from = id: the site's own promo kit); extra = { s1: member username, s2: one path segment } +function tracked(id, from, extra) { + const code = CODES[id]; if (!code || !from) return ''; + const q = new URLSearchParams({ src: from }); for (const [k, v] of Object.entries(extra || {})) if (v) q.set(k, String(v)); + return linksBase() + '/r/' + code + '?' + q.toString(); +} +function withGo(l, me) { return l.map(s => { const go = me && s.id !== me ? tracked(s.id, me) : ''; return go ? Object.assign({}, s, { go }) : s; }); } // GET /api/network-sites: public, cacheable, the same answer on every page function handle(req, res) { + const l = list(); res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'public, max-age=300', 'X-Content-Type-Options': 'nosniff' }); - res.end(JSON.stringify(list())); + res.end(JSON.stringify(withGo(l, selfId(req, l)))); } -module.exports = { list, handle, refresh, FALLBACK, _state: () => cache }; +module.exports = { list, handle, refresh, tracked, selfId, withGo, CODES, FALLBACK, _state: () => cache };