Files
linkspin/netlinks.js
T

30 lines
2.3 KiB
JavaScript

// 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 admin account (NETWORK_LINKS_OWNER, else ADMIN_EMAIL) owns one spin link per network site, with a fixed short code, and one
// traffic source per network site (catalog templates marked "network"). Every site links to the others through these:
// https://linkspin.app/r/<code>?src=<the site that sent the click>&s1=<member username>&s2=<page>
// src picks the traffic source (rotator.resolve + sources.networkSource), s1 fills ?ref= (the member keeps the sponsor credit),
// s2 is one path segment (how, join, ...; empty = the home page). Clicks show in that account's Reports by link and by source.
// Made once at boot when missing, never changed after: the owner may edit them like any link.
'use strict';
const SITES = [
{ id: 'iap', code: 'nwiap', name: 'InstantAdPay', url: 'https://instantadpay.com/{s2}?ref={s1}' },
{ id: 'linkspin', code: 'nwls', name: 'LinkSpin', url: 'https://linkspin.app/{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: '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: 'earnerscorner', code: 'nwec', name: 'Earners Corner', url: 'https://earnerscorner.com/{s2}' }
];
function ensure(o) { // { owner, rotator, sources }
const owner = String(o.owner || '').trim().toLowerCase(); if (!owner) return { skipped: 'no owner' };
const out = { owner: owner.replace(/^(.).*(@.*)$/, '$1***$2'), links: [], sources: [] };
for (const s of SITES) {
const src = o.sources.networkSource(owner, s.id); out.sources.push(s.id + ':' + (src ? src.id : 'none'));
const r = o.rotator.ensureFixed(owner, s.code, 'Network: ' + s.name, s.url); out.links.push(s.code + ':' + (r.error || (r.created ? 'made' : 'ok')));
}
return out;
}
module.exports = { SITES, ensure };