From a4ce9ff4cd4d86d6dffab3229db93443ac2b4175 Mon Sep 17 00:00:00 2001 From: martbost Date: Wed, 25 Nov 2026 11:42:18 -0600 Subject: [PATCH] Podcast Commission Stack as a network site (2026-11-25): fixed link nwpcs, traffic source podcastcommissionstack, conversions at /api/partner/netconv/pcs (NETCONV_SECRET_PCS, events keyed pcs:), its hosts carry the click id Co-Authored-By: Claude Fable 5.2 --- catalog/traffic-sources.json | 18 ++++++++++++++++++ netconv.js | 2 +- netlinks.js | 1 + netsites.js | 2 +- qa/netsrc.test.mjs | 8 +++++--- server.js | 9 +++++---- sources.js | 2 +- 7 files changed, 32 insertions(+), 10 deletions(-) diff --git a/catalog/traffic-sources.json b/catalog/traffic-sources.json index d199758..17a943c 100644 --- a/catalog/traffic-sources.json +++ b/catalog/traffic-sources.json @@ -159,6 +159,24 @@ "verified": true, "source": "network" }, + { + "key": "podcastcommissionstack", + "name": "Podcast Commission Stack", + "site": "podcastcommissionstack.com", + "costModel": "", + "params": [ + { + "key": "clickid", + "token": "{clickid}", + "label": "Click id", + "role": "externalId" + } + ], + "postbackUrl": "", + "notes": "Crypto Team Build Network text-to-audio and podcast tool. Clicks that arrive from Podcast Commission Stack carry ?src=podcastcommissionstack and are counted under this source automatically. Sign-ups, sponsor confirmations and credit purchases on Podcast Commission Stack that follow one of your link clicks are reported back and show under Reports > Conversions.", + "verified": true, + "source": "network" + }, { "key": "socialtube", "name": "Social Tube", diff --git a/netconv.js b/netconv.js index ed6314e..b4bbdfc 100644 --- a/netconv.js +++ b/netconv.js @@ -19,7 +19,7 @@ const path = require('path'); const crypto = require('crypto'); const EVENTS = ['join', 'wallet', 'purchase']; -const SITE_NAMES = { vai: 'Video App Income' }; // events reported by another network site carry its id; none = InstantAdPay +const SITE_NAMES = { vai: 'Video App Income', pcs: 'Podcast Commission Stack' }; // events reported by another network site carry its id; none = InstantAdPay let FILE = null, C = null, R = null, B = null, P = null, M = null; let st = { size: -1, rows: [], keys: new Set(), byClick: new Map(), byRoot: new Map() }; const norm = e => String(e || '').trim().toLowerCase(); diff --git a/netlinks.js b/netlinks.js index 4474e11..80efb75 100644 --- a/netlinks.js +++ b/netlinks.js @@ -15,6 +15,7 @@ const SITES = [ { id: 'viraladsource', code: 'nwvas', name: 'ViralAdSource', url: 'https://viraladsource.com/{s2}?ref={s1}' }, { id: 'yourprogrambuilder', code: 'nwypb', name: 'YourProgramBuilder', url: 'https://yourprogrambuilder.com/{s2}?ref={s1}' }, { id: 'videoappincome', code: 'nwvai', name: 'Video App Income', url: 'https://videoappincome.com/{s2}?ref={s1}' }, // 2026-11-21: s2 = join for the invite page, empty = the sales page + { id: 'podcastcommissionstack', code: 'nwpcs', name: 'Podcast Commission Stack', url: 'https://podcastcommissionstack.com/{s2}?ref={s1}' }, // 2026-11-25: s2 = join for the invite page, empty = the sales page { id: 'socialtube', code: 'nwst', name: 'Social Tube', url: 'https://socialtube.club/{s2}?ref={s1}' }, // 2026-11-22: the network's video gallery; ?ref= keeps the member's credit on every page there { id: 'fivex', code: 'nw5x', name: '5xYourTeam', url: 'https://5xyourteam.com/{s2}?ref={s1}' }, { id: 'downlinehydra', code: 'nwdh', name: 'DownlineHydra', url: 'https://downlinehydra.com/{s2}?ref={s1}' }, diff --git a/netsites.js b/netsites.js index d10283f..7dce448 100644 --- a/netsites.js +++ b/netsites.js @@ -36,7 +36,7 @@ function list() { if (Date.now() - cache.at > TTL) refresh(); return cache.list; // 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', viraladblitz: 'nwvab', viraladsource: 'nwvas', yourprogrambuilder: 'nwypb', videoappincome: 'nwvai', fivex: 'nw5x', downlinehydra: 'nwdh', stackpol: 'nwsp', earnerscorner: 'nwec' }; +const CODES = { iap: 'nwiap', linkspin: 'nwls', dlb: 'nwdlb', vbb: 'nwvbb', viraladblitz: 'nwvab', viraladsource: 'nwvas', yourprogrambuilder: 'nwypb', videoappincome: 'nwvai', podcastcommissionstack: 'nwpcs', fivex: 'nw5x', downlinehydra: 'nwdh', 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) { diff --git a/qa/netsrc.test.mjs b/qa/netsrc.test.mjs index 13d08ac..6720aef 100644 --- a/qa/netsrc.test.mjs +++ b/qa/netsrc.test.mjs @@ -28,9 +28,9 @@ const srcOf = (owner, tpl) => read('sources.json').items.find(x => x.owner === o try { await boot(); const rots = read('rotator.json').rotations.filter(r => r.owner === ADMIN); - ok(['nwiap', 'nwls', 'nwdlb', 'nwvbb', 'nwvab', 'nwvas', 'nwypb', 'nwvai', 'nwst', 'nw5x', 'nwdh', 'nwsp', 'nwec'].every(c => rots.some(r => r.code === c)) && rots.length === 13, 'the admin account has the thirteen network links', rots.map(r => r.code)); + ok(['nwiap', 'nwls', 'nwdlb', 'nwvbb', 'nwvab', 'nwvas', 'nwypb', 'nwvai', 'nwpcs', 'nwst', 'nw5x', 'nwdh', 'nwsp', 'nwec'].every(c => rots.some(r => r.code === c)) && rots.length === 14, 'the admin account has the fourteen network links', rots.map(r => r.code)); const mineSrc = read('sources.json').items.filter(x => x.owner === ADMIN); - ok(['instantadpay', 'linkspin', 'downlinebanners', 'viralbannerblitz', 'viraladblitz', 'viraladsource', 'yourprogrambuilder', 'videoappincome', 'socialtube', '5xyourteam', 'downlinehydra', 'stackpol', 'earnerscorner'].every(t => mineSrc.some(x => x.template === t)) && mineSrc.length === 13, 'and one source per network site', mineSrc.map(x => x.template)); + ok(['instantadpay', 'linkspin', 'downlinebanners', 'viralbannerblitz', 'viraladblitz', 'viraladsource', 'yourprogrambuilder', 'videoappincome', 'podcastcommissionstack', 'socialtube', '5xyourteam', 'downlinehydra', 'stackpol', 'earnerscorner'].every(t => mineSrc.some(x => x.template === t)) && mineSrc.length === 14, 'and one source per network site', mineSrc.map(x => x.template)); let r = await go('/r/nwdlb?src=iap&s1=bob&s2=how'); ok(r.status === 302 && /^https:\/\/downlinebanners\.com\/how\?ref=bob$/.test(r.loc), 'nwdlb: lands on /how with ?ref=bob', r); @@ -38,6 +38,8 @@ try { ok(r.status === 302 && /^https:\/\/instantadpay\.com\/\?ref=amy&lsclk=[a-f0-9]{10}$/.test(r.loc), 'nwiap: home page with ?ref=amy and the click id (InstantAdPay reports joins against it)', r); r = await go('/r/nwvai?src=iap&s1=amy&s2=join'); ok(r.status === 302 && /^https:\/\/videoappincome\.com\/join\?ref=amy&lsclk=[a-f0-9]{10}$/.test(r.loc), 'nwvai: Video App Income join page with ?ref=amy and the click id (it reports sign-ups and purchases against it)', r); + r = await go('/r/nwpcs?src=stackpol&s1=amy&s2=join'); + ok(r.status === 302 && /^https:\/\/podcastcommissionstack\.com\/join\?ref=amy&lsclk=[a-f0-9]{10}$/.test(r.loc), 'nwpcs: Podcast Commission Stack join page with ?ref=amy and the click id', r); r = await go('/r/nwec?src=dlb'); ok(r.status === 302 && /^https:\/\/earnerscorner\.com\/(\?|$)/.test(r.loc), 'nwec: the forum home', r); r = await go('/r/nwdh?src=downlinehydra&s1=bob'); @@ -66,7 +68,7 @@ try { ok(read('sources.json').items.filter(x => x.owner === MEM).length === 2, 'an unknown src makes no source'); await stop(); await boot(); - ok(read('rotator.json').rotations.filter(x => x.owner === ADMIN).length === 13 && read('sources.json').items.filter(x => x.owner === ADMIN).length === 13, 'a reboot makes nothing twice'); + ok(read('rotator.json').rotations.filter(x => x.owner === ADMIN).length === 14 && read('sources.json').items.filter(x => x.owner === ADMIN).length === 14, 'a reboot makes nothing twice'); } catch (e) { fail++; console.error(e); } finally { await stop(); try { fs.rmSync(DATA, { recursive: true, force: true }); } catch (e) {} } console.log('\n' + pass + ' passed, ' + fail + ' failed'); process.exit(fail ? 1 : 0); diff --git a/server.js b/server.js index 7edd0b4..df8930c 100644 --- a/server.js +++ b/server.js @@ -1009,7 +1009,7 @@ function readRaw(req, maxBytes) { // the image pixel cannot read the thank-you page's address, but a browser that sends the full referrer hands it to us function refClickId(req) { try { const r = new URL(String(req.headers.referer || '')); const v = r.searchParams.get('lsclk') || r.searchParams.get('lsid') || ''; return /^[a-z0-9]{6,24}$/i.test(v) ? v : ''; } catch (e) { return ''; } } // the sites of the network a click id may travel to (the landing tag's list, 2026-11-07): this site, InstantAdPay, its share domains -const NETWORK_HOSTS = String(process.env.NETWORK_HOSTS || 'instantadpay.com,instantadpay.link,ctbgo.com,mylinehq.com,videoappincome.com,clickvidpro.com,socialtube.club').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); +const NETWORK_HOSTS = String(process.env.NETWORK_HOSTS || 'instantadpay.com,instantadpay.link,ctbgo.com,mylinehq.com,videoappincome.com,clickvidpro.com,socialtube.club,podcastcommissionstack.com,lstn.page').split(',').map(x => x.trim().toLowerCase()).filter(Boolean); function networkHosts() { return [...new Set([String(SITE_HOST || '').toLowerCase().replace(/:\d+$/, '').replace(/^www\./, '')].concat(NETWORK_HOSTS))].filter(Boolean); } function clickCookie(id) { return 'ls.clk=' + id + '; Path=/; Max-Age=2592000; ' + (IS_PROD ? 'SameSite=None; Secure' : 'SameSite=Lax'); } // an ad click: record a click id for the campaign and append ?lsclk= to the target (existing params kept, an lsclk @@ -3401,8 +3401,9 @@ const server = http.createServer(async (req, res) => { // -- conversions reported by another network site (2026-11-21, first site: Video App Income). Reporting only, like the route below, // but with the site's OWN secret (NETCONV_SECRET_VAI): the shared partner secret can move sponsors, this one can only add // conversion events, and only ones keyed to that site. X-Net-Ts (ms) + X-Net-Sig = hex HMAC-SHA256(secret, 'netconv.v1.' + ts + '\n' + raw). - if (p === '/api/partner/netconv/vai' && req.method === 'POST') { - const secret = String(process.env.NETCONV_SECRET_VAI || '').trim(); if (secret.length < 32) return json(res, 503, { error: 'not configured' }); + // second site 2026-11-25: Podcast Commission Stack at /api/partner/netconv/pcs with NETCONV_SECRET_PCS; its events are keyed pcs:... + if ((p === '/api/partner/netconv/vai' || p === '/api/partner/netconv/pcs') && req.method === 'POST') { + const nsite = p.slice(-3); const secret = String(process.env['NETCONV_SECRET_' + nsite.toUpperCase()] || '').trim(); if (secret.length < 32) return json(res, 503, { error: 'not configured' }); let raw; try { raw = await new Promise((ok, no) => { let d = ''; req.on('data', c => { d += c; if (d.length > 64000) { req.destroy(); no(new Error('too big')); } }); req.on('end', () => ok(d)); req.on('error', no); }); } catch (e) { return json(res, 413, { error: 'too big' }); } const ts = String(req.headers['x-net-ts'] || ''), sig = String(req.headers['x-net-sig'] || ''); if (!/^\d{13}$/.test(ts) || Math.abs(Date.now() - Number(ts)) > 5 * 60000) return json(res, 401, { error: 'stale' }); @@ -3412,7 +3413,7 @@ const server = http.createServer(async (req, res) => { const results = []; for (const ev of (Array.isArray(b.events) ? b.events.slice(0, 200) : [])) { let r = { result: 'bad' }; - if (ev && /^vai:/.test(String(ev.k || ''))) { try { r = await netconv.record(Object.assign({}, ev, { site: 'vai' })); } catch (e) { console.error('netconv vai', e.message); return json(res, 500, { error: 'not recorded' }); } } + if (ev && String(ev.k || '').startsWith(nsite + ':')) { try { r = await netconv.record(Object.assign({}, ev, { site: nsite })); } catch (e) { console.error('netconv ' + nsite, e.message); return json(res, 500, { error: 'not recorded' }); } } results.push({ k: String(ev && ev.k || ''), result: r.result }); } return json(res, 200, { ok: true, results }); diff --git a/sources.js b/sources.js index e9fe953..0f5e9fe 100644 --- a/sources.js +++ b/sources.js @@ -143,7 +143,7 @@ function meta(owner) { const m = {}; for (const s of mine(owner)) m[s.id] = { na // source for that site, made from the network catalog template the first time it is needed. Only network templates qualify. const NET_SRC = { iap: 'instantadpay', instantadpay: 'instantadpay', linkspin: 'linkspin', dlb: 'downlinebanners', downlinebanners: 'downlinebanners', vbb: 'viralbannerblitz', viralbannerblitz: 'viralbannerblitz', stackpol: 'stackpol', earnerscorner: 'earnerscorner', - dh: 'downlinehydra', downlinehydra: 'downlinehydra', vab: 'viraladblitz', viraladblitz: 'viraladblitz', vas: 'viraladsource', viraladsource: 'viraladsource', ypb: 'yourprogrambuilder', yourprogrambuilder: 'yourprogrambuilder', fivex: '5xyourteam', '5xyourteam': '5xyourteam', vai: 'videoappincome', videoappincome: 'videoappincome', st: 'socialtube', socialtube: 'socialtube' }; + dh: 'downlinehydra', downlinehydra: 'downlinehydra', vab: 'viraladblitz', viraladblitz: 'viraladblitz', vas: 'viraladsource', viraladsource: 'viraladsource', ypb: 'yourprogrambuilder', yourprogrambuilder: 'yourprogrambuilder', fivex: '5xyourteam', '5xyourteam': '5xyourteam', vai: 'videoappincome', videoappincome: 'videoappincome', pcs: 'podcastcommissionstack', podcastcommissionstack: 'podcastcommissionstack', st: 'socialtube', socialtube: 'socialtube' }; function networkTemplate(src) { const k = NET_SRC[String(src || '').trim().toLowerCase()]; const t = k ? template(k) : null; return t && t.source === 'network' ? t : null; } function networkSource(owner, src) { const t = networkTemplate(src); if (!t || !owner) return null;