Compare commits
4 Commits
86007f0784
...
e2af298317
| Author | SHA1 | Date | |
|---|---|---|---|
| e2af298317 | |||
| ab6124ea9b | |||
| b2b670df14 | |||
| 90596b4d0f |
@@ -141,6 +141,17 @@
|
|||||||
"verified": true,
|
"verified": true,
|
||||||
"source": "network"
|
"source": "network"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "5xyourteam",
|
||||||
|
"name": "5xYourTeam",
|
||||||
|
"site": "5xyourteam.com",
|
||||||
|
"costModel": "",
|
||||||
|
"params": [],
|
||||||
|
"postbackUrl": "",
|
||||||
|
"notes": "Crypto Team Build Network team-building site. Clicks that arrive from 5xYourTeam (its footer, its promo kit) carry ?src=fivex and are counted under this source automatically.",
|
||||||
|
"verified": true,
|
||||||
|
"source": "network"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "stackpol",
|
"key": "stackpol",
|
||||||
"name": "Stack POL",
|
"name": "Stack POL",
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const SITES = [
|
|||||||
{ id: 'dlb', code: 'nwdlb', name: 'Downline Banners', url: 'https://downlinebanners.com/{s2}?ref={s1}' },
|
{ id: 'dlb', code: 'nwdlb', name: 'Downline Banners', url: 'https://downlinebanners.com/{s2}?ref={s1}' },
|
||||||
{ id: 'vbb', code: 'nwvbb', name: 'Viral Banner Blitz', url: 'https://viralbannerblitz.com/{s2}?ref={s1}' },
|
{ id: 'vbb', code: 'nwvbb', name: 'Viral Banner Blitz', url: 'https://viralbannerblitz.com/{s2}?ref={s1}' },
|
||||||
{ id: 'viraladblitz', code: 'nwvab', name: 'ViralAdBlitz', url: 'https://viraladblitz.com/{s2}?ref={s1}' },
|
{ id: 'viraladblitz', code: 'nwvab', name: 'ViralAdBlitz', url: 'https://viraladblitz.com/{s2}?ref={s1}' },
|
||||||
|
{ 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}' },
|
||||||
{ id: 'stackpol', code: 'nwsp', name: 'Stack POL', url: 'https://stackpol.com/{s2}?ref={s1}' },
|
{ id: 'stackpol', code: 'nwsp', name: 'Stack POL', url: 'https://stackpol.com/{s2}?ref={s1}' },
|
||||||
{ id: 'earnerscorner', code: 'nwec', name: 'Earners Corner', url: 'https://earnerscorner.com/{s2}' }
|
{ id: 'earnerscorner', code: 'nwec', name: 'Earners Corner', url: 'https://earnerscorner.com/{s2}' }
|
||||||
];
|
];
|
||||||
|
|||||||
+1
-1
@@ -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=<this site>, so a click shows in LinkSpin Reports under the
|
// entry also gets go = the LinkSpin network link for that site with ?src=<this site>, 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.
|
// 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.
|
// 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', stackpol: 'nwsp', earnerscorner: 'nwec' };
|
const CODES = { iap: 'nwiap', linkspin: 'nwls', dlb: 'nwdlb', vbb: 'nwvbb', viraladblitz: 'nwvab', fivex: 'nw5x', downlinehydra: 'nwdh', stackpol: 'nwsp', earnerscorner: 'nwec' };
|
||||||
const linksBase = () => String(process.env.NETWORK_LINKS_BASE || 'https://linkspin.app').trim().replace(/\/+$/, '');
|
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 ''; } };
|
const hostOf = u => { try { return new URL(u).hostname.toLowerCase().replace(/^www\./, ''); } catch (e) { return ''; } };
|
||||||
function selfId(req, l) {
|
function selfId(req, l) {
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ const BACK_AGE = 1200; // seconds: the provider remembers an unf
|
|||||||
const TRIED_AGE = 1800; // seconds: one silent check per browser per 30 minutes
|
const TRIED_AGE = 1800; // seconds: one silent check per browser per 30 minutes
|
||||||
const OFF_AGE = 12 * 3600; // seconds: no silent check after a sign-out on this site
|
const OFF_AGE = 12 * 3600; // seconds: no silent check after a sign-out on this site
|
||||||
const HINT_AGE = 300; // seconds: the email prefill when the member is not here yet
|
const HINT_AGE = 300; // seconds: the email prefill when the member is not here yet
|
||||||
const NAMES = { iap: 'InstantAdPay', linkspin: 'LinkSpin', bannerline: 'Downline Banners', vbb: 'Viral Banner Blitz', viraladblitz: 'ViralAdBlitz' }; // vbb = Viral Banner Blitz, a wallet site like Downline Banners (2026-11-14); viraladblitz = ViralAdBlitz, a wallet site like VBB (2026-11-15)
|
const NAMES = { iap: 'InstantAdPay', linkspin: 'LinkSpin', bannerline: 'Downline Banners', vbb: 'Viral Banner Blitz', viraladblitz: 'ViralAdBlitz', downlinehydra: 'DownlineHydra' }; // vbb = Viral Banner Blitz, a wallet site like Downline Banners (2026-11-14); viraladblitz = ViralAdBlitz, a wallet site like VBB (2026-11-15); downlinehydra = DownlineHydra (2026-11-15)
|
||||||
const WALLET_RE = /^0x[0-9a-f]{40}$/;
|
const WALLET_RE = /^0x[0-9a-f]{40}$/;
|
||||||
|
|
||||||
let C = null; // { self, peer, peerBase(), isProd, dataDir, db, member(req), accept(email, req, v), signIn(email, req, v), landing(to), signinPath(to), defaultPath,
|
let C = null; // { self, peer, peerBase(), isProd, dataDir, db, member(req), accept(email, req, v), signIn(email, req, v), landing(to), signinPath(to), defaultPath,
|
||||||
|
|||||||
+70
-66
@@ -1,66 +1,70 @@
|
|||||||
// Network sites as traffic sources (2026-11-14). Boots server.js on its own port with a throwaway seeded data dir (JSON store, no DB)
|
// Network sites as traffic sources (2026-11-14). Boots server.js on its own port with a throwaway seeded data dir (JSON store, no DB)
|
||||||
// and checks: the admin account gets one fixed network link per site (nwiap, nwls, nwdlb, nwvbb, nwvab, nwsp, nwec) and one source per
|
// and checks: the admin account gets one fixed network link per site (nwiap, nwls, nwdlb, nwvbb, nwvab, nw5x, nwdh, nwsp, nwec) and one source per
|
||||||
// network site; /r/<code>?src=&s1=&s2= lands on the right page with ?ref=<member>; the click counts under the sending site's source;
|
// network site; /r/<code>?src=&s1=&s2= lands on the right page with ?ref=<member>; the click counts under the sending site's source;
|
||||||
// a member's own link with ?src=<site> gets that site's source made on first use; an unknown src changes nothing; a reboot makes
|
// a member's own link with ?src=<site> gets that site's source made on first use; an unknown src changes nothing; a reboot makes
|
||||||
// nothing twice.
|
// nothing twice.
|
||||||
// node qa/netsrc.test.mjs (from the site dir; PORT default 8973)
|
// node qa/netsrc.test.mjs (from the site dir; PORT default 8973)
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
|
|
||||||
const PORT = Number(process.env.PORT || 8973); const BASE = 'http://127.0.0.1:' + PORT;
|
const PORT = Number(process.env.PORT || 8973); const BASE = 'http://127.0.0.1:' + PORT;
|
||||||
let pass = 0, fail = 0; const ok = (c, what, x) => { if (c) { pass++; console.log(' ok ' + what); } else { fail++; console.log(' FAIL ' + what + (x !== undefined ? ' -> ' + JSON.stringify(x).slice(0, 400) : '')); } };
|
let pass = 0, fail = 0; const ok = (c, what, x) => { if (c) { pass++; console.log(' ok ' + what); } else { fail++; console.log(' FAIL ' + what + (x !== undefined ? ' -> ' + JSON.stringify(x).slice(0, 400) : '')); } };
|
||||||
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-qa-')); const now = Date.now(); const ADMIN = 'admin@ns.test', MEM = 'mem@ns.test';
|
const DATA = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-qa-')); const now = Date.now(); const ADMIN = 'admin@ns.test', MEM = 'mem@ns.test';
|
||||||
fs.writeFileSync(path.join(DATA, 'sources.json'), JSON.stringify({ v: 1, items: [{ id: 'aaaaaaaaaa', owner: MEM, name: 'My mailer', template: 'custom', site: 'mailer.example', params: [], postbackUrl: '', events: ['join'], enabled: true, created: now }] }));
|
fs.writeFileSync(path.join(DATA, 'sources.json'), JSON.stringify({ v: 1, items: [{ id: 'aaaaaaaaaa', owner: MEM, name: 'My mailer', template: 'custom', site: 'mailer.example', params: [], postbackUrl: '', events: ['join'], enabled: true, created: now }] }));
|
||||||
fs.writeFileSync(path.join(DATA, 'rotator.json'), JSON.stringify({ v: 1, rotations: [
|
fs.writeFileSync(path.join(DATA, 'rotator.json'), JSON.stringify({ v: 1, rotations: [
|
||||||
{ id: 1, owner: MEM, name: 'Mine', code: 'memlnk', fallback: '', destinations: [{ id: 1, url: 'https://offer.example.org/', weight: 1, active: true }], created: now, paused: false, nextDest: 2, sourceId: 'aaaaaaaaaa' }], hits: [], conv: [] }));
|
{ id: 1, owner: MEM, name: 'Mine', code: 'memlnk', fallback: '', destinations: [{ id: 1, url: 'https://offer.example.org/', weight: 1, active: true }], created: now, paused: false, nextDest: 2, sourceId: 'aaaaaaaaaa' }], hits: [], conv: [] }));
|
||||||
const env = Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, ADMIN_PASSWORD: 'x'.repeat(16), ADMIN_EMAIL: ADMIN });
|
const env = Object.assign({}, process.env, { PORT: String(PORT), DATA_DIR: DATA, ADMIN_PASSWORD: 'x'.repeat(16), ADMIN_EMAIL: ADMIN });
|
||||||
for (const k of ['NODE_ENV', 'DATABASE_URL', 'ENGINE_KEY', 'LS_SYNC_SECRET', 'OUTBOUND', 'LS_TESTERS', 'CURTAIN', 'HUB_ENABLED', 'HUB_URL', 'NETWORK_LINKS_OWNER', 'NETWORK_SSO_SECRET']) delete env[k];
|
for (const k of ['NODE_ENV', 'DATABASE_URL', 'ENGINE_KEY', 'LS_SYNC_SECRET', 'OUTBOUND', 'LS_TESTERS', 'CURTAIN', 'HUB_ENABLED', 'HUB_URL', 'NETWORK_LINKS_OWNER', 'NETWORK_SSO_SECRET']) delete env[k];
|
||||||
const site = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '..');
|
const site = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '..');
|
||||||
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
||||||
let srv = null;
|
let srv = null;
|
||||||
async function boot() { srv = spawn(process.execPath, ['server.js'], { cwd: site, env, stdio: ['ignore', 'ignore', 'ignore'] }); for (let i = 0; i < 60; i++) { try { if ((await fetch(BASE + '/api/config')).ok) break; } catch (e) {} await sleep(500); } await sleep(3800); }
|
async function boot() { srv = spawn(process.execPath, ['server.js'], { cwd: site, env, stdio: ['ignore', 'ignore', 'ignore'] }); for (let i = 0; i < 60; i++) { try { if ((await fetch(BASE + '/api/config')).ok) break; } catch (e) {} await sleep(500); } await sleep(3800); }
|
||||||
async function stop() { if (srv) srv.kill(); srv = null; await sleep(600); }
|
async function stop() { if (srv) srv.kill(); srv = null; await sleep(600); }
|
||||||
const go = async (p, ref) => { const r = await fetch(BASE + p, { redirect: 'manual', headers: Object.assign({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) Chrome/130 netsrc-qa' }, ref ? { Referer: ref } : {}) }); return { status: r.status, loc: r.headers.get('location') || '' }; };
|
const go = async (p, ref) => { const r = await fetch(BASE + p, { redirect: 'manual', headers: Object.assign({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) Chrome/130 netsrc-qa' }, ref ? { Referer: ref } : {}) }); return { status: r.status, loc: r.headers.get('location') || '' }; };
|
||||||
const read = f => JSON.parse(fs.readFileSync(path.join(DATA, f), 'utf8'));
|
const read = f => JSON.parse(fs.readFileSync(path.join(DATA, f), 'utf8'));
|
||||||
const srcOf = (owner, tpl) => read('sources.json').items.find(x => x.owner === owner && x.template === tpl);
|
const srcOf = (owner, tpl) => read('sources.json').items.find(x => x.owner === owner && x.template === tpl);
|
||||||
try {
|
try {
|
||||||
await boot();
|
await boot();
|
||||||
const rots = read('rotator.json').rotations.filter(r => r.owner === ADMIN);
|
const rots = read('rotator.json').rotations.filter(r => r.owner === ADMIN);
|
||||||
ok(['nwiap', 'nwls', 'nwdlb', 'nwvbb', 'nwvab', 'nwsp', 'nwec'].every(c => rots.some(r => r.code === c)) && rots.length === 7, 'the admin account has the seven network links', rots.map(r => r.code));
|
ok(['nwiap', 'nwls', 'nwdlb', 'nwvbb', 'nwvab', 'nw5x', 'nwdh', 'nwsp', 'nwec'].every(c => rots.some(r => r.code === c)) && rots.length === 9, 'the admin account has the nine network links', rots.map(r => r.code));
|
||||||
const mineSrc = read('sources.json').items.filter(x => x.owner === ADMIN);
|
const mineSrc = read('sources.json').items.filter(x => x.owner === ADMIN);
|
||||||
ok(['instantadpay', 'linkspin', 'downlinebanners', 'viralbannerblitz', 'viraladblitz', 'stackpol', 'earnerscorner'].every(t => mineSrc.some(x => x.template === t)) && mineSrc.length === 7, 'and one source per network site', mineSrc.map(x => x.template));
|
ok(['instantadpay', 'linkspin', 'downlinebanners', 'viralbannerblitz', 'viraladblitz', '5xyourteam', 'downlinehydra', 'stackpol', 'earnerscorner'].every(t => mineSrc.some(x => x.template === t)) && mineSrc.length === 9, 'and one source per network site', mineSrc.map(x => x.template));
|
||||||
|
|
||||||
let r = await go('/r/nwdlb?src=iap&s1=bob&s2=how');
|
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);
|
ok(r.status === 302 && /^https:\/\/downlinebanners\.com\/how\?ref=bob$/.test(r.loc), 'nwdlb: lands on /how with ?ref=bob', r);
|
||||||
r = await go('/r/nwiap?src=vbb&s1=amy');
|
r = await go('/r/nwiap?src=vbb&s1=amy');
|
||||||
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);
|
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/nwec?src=dlb');
|
r = await go('/r/nwec?src=dlb');
|
||||||
ok(r.status === 302 && /^https:\/\/earnerscorner\.com\/(\?|$)/.test(r.loc), 'nwec: the forum home', r);
|
ok(r.status === 302 && /^https:\/\/earnerscorner\.com\/(\?|$)/.test(r.loc), 'nwec: the forum home', r);
|
||||||
r = await go('/r/nwvab?src=vab&s1=bob&s2=boost');
|
r = await go('/r/nwdh?src=downlinehydra&s1=bob');
|
||||||
ok(r.status === 302 && /^https:\/\/viraladblitz\.com\/boost\?ref=bob$/.test(r.loc), 'nwvab: ViralAdBlitz page with the member ref', r);
|
ok(r.status === 302 && /^https:\/\/downlinehydra\.com\/\?ref=bob$/.test(r.loc), 'nwdh: DownlineHydra with the member ref', r);
|
||||||
r = await go('/r/nwvbb?src=linkspin', 'https://linkspin.app/contract');
|
r = await go('/r/nw5x?src=fivex&s1=bob');
|
||||||
ok(r.status === 302 && /^https:\/\/viralbannerblitz\.com\/\?ref=(&|$)/.test(r.loc), 'nwvbb with no member: an empty ref', r);
|
ok(r.status === 302 && /^https:\/\/5xyourteam\.com\/\?ref=bob$/.test(r.loc), 'nw5x: 5xYourTeam with the member ref', r);
|
||||||
await sleep(300);
|
r = await go('/r/nwvab?src=vab&s1=bob&s2=boost');
|
||||||
const hits = read('rotator.json').hits; const byCode = c => { const rr = read('rotator.json').rotations.find(x => x.code === c); return hits.filter(h => h.r === rr.id); };
|
ok(r.status === 302 && /^https:\/\/viraladblitz\.com\/boost\?ref=bob$/.test(r.loc), 'nwvab: ViralAdBlitz page with the member ref', r);
|
||||||
const h1 = byCode('nwdlb')[0], h2 = byCode('nwiap')[0], h3 = byCode('nwec')[0], h4 = byCode('nwvbb')[0];
|
r = await go('/r/nwvbb?src=linkspin', 'https://linkspin.app/contract');
|
||||||
ok(h1 && h1.sr === srcOf(ADMIN, 'instantadpay').id && h1.s === 'instantadpay.com' && h1.q.s1 === 'bob', 'the DLB click counts under the InstantAdPay source (no referrer: the site name)', h1);
|
ok(r.status === 302 && /^https:\/\/viralbannerblitz\.com\/\?ref=(&|$)/.test(r.loc), 'nwvbb with no member: an empty ref', r);
|
||||||
ok(h2 && h2.sr === srcOf(ADMIN, 'viralbannerblitz').id, 'the IAP click counts under the Viral Banner Blitz source', h2);
|
await sleep(300);
|
||||||
ok(h3 && h3.sr === srcOf(ADMIN, 'downlinebanners').id, 'the Earners Corner click counts under the Downline Banners source', h3);
|
const hits = read('rotator.json').hits; const byCode = c => { const rr = read('rotator.json').rotations.find(x => x.code === c); return hits.filter(h => h.r === rr.id); };
|
||||||
ok(h4 && h4.sr === srcOf(ADMIN, 'linkspin').id && h4.s === 'linkspin.app', 'a real referrer is kept as the referrer', h4);
|
const h1 = byCode('nwdlb')[0], h2 = byCode('nwiap')[0], h3 = byCode('nwec')[0], h4 = byCode('nwvbb')[0];
|
||||||
|
ok(h1 && h1.sr === srcOf(ADMIN, 'instantadpay').id && h1.s === 'instantadpay.com' && h1.q.s1 === 'bob', 'the DLB click counts under the InstantAdPay source (no referrer: the site name)', h1);
|
||||||
ok(!srcOf(MEM, 'stackpol'), 'the member has no Stack POL source yet');
|
ok(h2 && h2.sr === srcOf(ADMIN, 'viralbannerblitz').id, 'the IAP click counts under the Viral Banner Blitz source', h2);
|
||||||
r = await go('/r/memlnk?src=stackpol');
|
ok(h3 && h3.sr === srcOf(ADMIN, 'downlinebanners').id, 'the Earners Corner click counts under the Downline Banners source', h3);
|
||||||
ok(r.status === 302 && /^https:\/\/offer\.example\.org\//.test(r.loc), 'a member link with ?src=stackpol still redirects', r);
|
ok(h4 && h4.sr === srcOf(ADMIN, 'linkspin').id && h4.s === 'linkspin.app', 'a real referrer is kept as the referrer', h4);
|
||||||
await go('/r/memlnk?src=nosuchsite'); await go('/r/memlnk'); await sleep(300);
|
|
||||||
const ms = srcOf(MEM, 'stackpol'); const mh = read('rotator.json').hits.filter(h => h.r === 1);
|
ok(!srcOf(MEM, 'stackpol'), 'the member has no Stack POL source yet');
|
||||||
ok(ms && ms.name === 'Stack POL', 'the member got a Stack POL source on first use', ms);
|
r = await go('/r/memlnk?src=stackpol');
|
||||||
ok(mh.length === 3 && mh[0].sr === ms.id && mh[1].sr === 'aaaaaaaaaa' && mh[2].sr === 'aaaaaaaaaa', 'that click counts under it; an unknown src or none keeps the attached source', mh.map(h => h.sr));
|
ok(r.status === 302 && /^https:\/\/offer\.example\.org\//.test(r.loc), 'a member link with ?src=stackpol still redirects', r);
|
||||||
ok(read('sources.json').items.filter(x => x.owner === MEM).length === 2, 'an unknown src makes no source');
|
await go('/r/memlnk?src=nosuchsite'); await go('/r/memlnk'); await sleep(300);
|
||||||
|
const ms = srcOf(MEM, 'stackpol'); const mh = read('rotator.json').hits.filter(h => h.r === 1);
|
||||||
await stop(); await boot();
|
ok(ms && ms.name === 'Stack POL', 'the member got a Stack POL source on first use', ms);
|
||||||
ok(read('rotator.json').rotations.filter(x => x.owner === ADMIN).length === 7 && read('sources.json').items.filter(x => x.owner === ADMIN).length === 7, 'a reboot makes nothing twice');
|
ok(mh.length === 3 && mh[0].sr === ms.id && mh[1].sr === 'aaaaaaaaaa' && mh[2].sr === 'aaaaaaaaaa', 'that click counts under it; an unknown src or none keeps the attached source', mh.map(h => h.sr));
|
||||||
} catch (e) { fail++; console.error(e); }
|
ok(read('sources.json').items.filter(x => x.owner === MEM).length === 2, 'an unknown src makes no source');
|
||||||
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);
|
await stop(); await boot();
|
||||||
|
ok(read('rotator.json').rotations.filter(x => x.owner === ADMIN).length === 9 && read('sources.json').items.filter(x => x.owner === ADMIN).length === 9, '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);
|
||||||
|
|||||||
@@ -142,7 +142,8 @@ try {
|
|||||||
// a session that expired on the provider: the check answers none
|
// a session that expired on the provider: the check answers none
|
||||||
ctx = await newCtx({ iap: 'f'.repeat(64) }); page = await ctx.newPage();
|
ctx = await newCtx({ iap: 'f'.repeat(64) }); page = await ctx.newPage();
|
||||||
await page.goto(LS + '/sso/start?mode=go&to=%2Fads'); await page.waitForTimeout(1500);
|
await page.goto(LS + '/sso/start?mode=go&to=%2Fads'); await page.waitForTimeout(1500);
|
||||||
ok(!(await meOf(ctx, LS)).signedIn && page.url() === LS + '/ads', 'an expired IAP session: the check answers none, normal sign-in');
|
ok(!(await meOf(ctx, LS)).signedIn && page.url().startsWith(IAP + '/my'), 'an expired IAP session on a deliberate tap: IAP asks for its own sign-in first (2026-11-14)', page.url());
|
||||||
|
ok((await ctx.cookies(IAP)).some(c => c.name === 'nsso.back'), 'IAP remembers the unfinished trip while the member signs in');
|
||||||
await ctx.close();
|
await ctx.close();
|
||||||
|
|
||||||
// 6. not on the receiving site yet: C (IAP only) going to LinkSpin, D (LinkSpin only) going to IAP
|
// 6. not on the receiving site yet: C (IAP only) going to LinkSpin, D (LinkSpin only) going to IAP
|
||||||
|
|||||||
@@ -646,7 +646,8 @@ async function boot() {
|
|||||||
networksso.init({ self: 'linkspin', peer: 'iap', peerBase: IAP_BASE, isProd: IS_PROD, dataDir: DATA_DIR, db, defaultPath: '/ads',
|
networksso.init({ self: 'linkspin', peer: 'iap', peerBase: IAP_BASE, isProd: IS_PROD, dataDir: DATA_DIR, db, defaultPath: '/ads',
|
||||||
wallets: { bannerline: () => String(process.env.BL_URL || 'https://downlinebanners.com').replace(/\/+$/, ''), // Downline Banners by wallet (2026-11-13)
|
wallets: { bannerline: () => String(process.env.BL_URL || 'https://downlinebanners.com').replace(/\/+$/, ''), // Downline Banners by wallet (2026-11-13)
|
||||||
vbb: () => String(process.env.VBB_URL || 'https://viralbannerblitz.com').replace(/\/+$/, ''), // Viral Banner Blitz by wallet (2026-11-14)
|
vbb: () => String(process.env.VBB_URL || 'https://viralbannerblitz.com').replace(/\/+$/, ''), // Viral Banner Blitz by wallet (2026-11-14)
|
||||||
viraladblitz: () => String(process.env.VAB_URL || 'https://viraladblitz.com').replace(/\/+$/, '') }, // ViralAdBlitz by wallet (2026-11-15; VAB_URL = staging host until the domain switch)
|
viraladblitz: () => String(process.env.VAB_URL || 'https://viraladblitz.com').replace(/\/+$/, ''), // ViralAdBlitz by wallet (2026-11-15; VAB_URL = staging host until the domain switch)
|
||||||
|
downlinehydra: () => String(process.env.DH_URL || 'https://downlinehydra.com').replace(/\/+$/, '') }, // DownlineHydra (2026-11-15; DH_URL = https://dh.saasy.top until the domain switch)
|
||||||
wallet: async s => { const a = await accounts.byEmail(s.email); const addr = String(s.address || (a && a.address) || '').toLowerCase(); return addr ? { address: addr, name: '' } : null; },
|
wallet: async s => { const a = await accounts.byEmail(s.email); const addr = String(s.address || (a && a.address) || '').toLowerCase(); return addr ? { address: addr, name: '' } : null; },
|
||||||
member: async req => { // a wallet sign-in carries the address, not the email: find the account that owns the wallet (2026-11-13)
|
member: async req => { // a wallet sign-in carries the address, not the email: find the account that owns the wallet (2026-11-13)
|
||||||
const s = await auth.fromRequest(req); if (!s) return null;
|
const s = await auth.fromRequest(req); if (!s) return null;
|
||||||
@@ -1440,7 +1441,7 @@ const server = http.createServer(async (req, res) => {
|
|||||||
// support must reach everyone, invited or not (2026-10-16): someone locked out or not yet let in is exactly who needs it
|
// support must reach everyone, invited or not (2026-10-16): someone locked out or not yet let in is exactly who needs it
|
||||||
if (!zonePath && !supportOpen(p) && curtained(req, res, u)) return; // nothing below this line runs for an uninvited visitor
|
if (!zonePath && !supportOpen(p) && curtained(req, res, u)) return; // nothing below this line runs for an uninvited visitor
|
||||||
// network sign-in with InstantAdPay (2026-11-12): /go/iap, /sso/start, /sso/check, /sso/in, /api/sso/status (app host only)
|
// network sign-in with InstantAdPay (2026-11-12): /go/iap, /sso/start, /sso/check, /sso/in, /api/sso/status (app host only)
|
||||||
if (req.method === 'GET' && (p === '/go/iap' || p.startsWith('/sso/') || p === '/api/sso/status') && !isPagesHost(req) && !isLinkHost(req) && await networksso.handle(req, res, u)) return;
|
if (req.method === 'GET' && (p === '/go/iap' || p === '/go/viraladblitz' || p === '/go/downlinehydra' || p.startsWith('/sso/') || p === '/api/sso/status') && !isPagesHost(req) && !isLinkHost(req) && await networksso.handle(req, res, u)) return;
|
||||||
|
|
||||||
// -- the rotator redirect: one hop, recorded, on any host (LinkSpin)
|
// -- the rotator redirect: one hop, recorded, on any host (LinkSpin)
|
||||||
let rm = /^\/r\/([a-z0-9]{4,12})$/i.exec(p);
|
let rm = /^\/r\/([a-z0-9]{4,12})$/i.exec(p);
|
||||||
|
|||||||
+1
-1
@@ -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.
|
// 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',
|
const NET_SRC = { iap: 'instantadpay', instantadpay: 'instantadpay', linkspin: 'linkspin', dlb: 'downlinebanners', downlinebanners: 'downlinebanners',
|
||||||
vbb: 'viralbannerblitz', viralbannerblitz: 'viralbannerblitz', stackpol: 'stackpol', earnerscorner: 'earnerscorner',
|
vbb: 'viralbannerblitz', viralbannerblitz: 'viralbannerblitz', stackpol: 'stackpol', earnerscorner: 'earnerscorner',
|
||||||
dh: 'downlinehydra', downlinehydra: 'downlinehydra', vab: 'viraladblitz', viraladblitz: 'viraladblitz' };
|
dh: 'downlinehydra', downlinehydra: 'downlinehydra', vab: 'viraladblitz', viraladblitz: 'viraladblitz', fivex: '5xyourteam', '5xyourteam': '5xyourteam' };
|
||||||
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 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) {
|
function networkSource(owner, src) {
|
||||||
const t = networkTemplate(src); if (!t || !owner) return null;
|
const t = networkTemplate(src); if (!t || !owner) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user