Network sign-in reaches Downline Banners (Marty 2026-11-13): networksso.js vouches for a wallet site (/go/bannerline, /sso/check?r=bannerline carry the member's wallet + username); public /api/network/member lookup (username <-> linked wallet) so Downline Banners share links use the network username
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,7 @@ const SF = require('./sponsorfollow'); // deliberate sponsor changes follow t
|
||||
const bixpay = require('./bixpay'); // BixPay Visa card: partner-link field, sponsor-follows resolver, tracked clicks (2026-10-29, gated by site config bixpayLive)
|
||||
let follow = null, followStore = null;
|
||||
const LS_BASE = () => String(process.env.LS_URL || 'https://linkspin.app').replace(/\/+$/, '');
|
||||
const BL_BASE = () => String(process.env.BL_URL || 'https://new.downlinebanners.com').replace(/\/+$/, ''); // Downline Banners (network sign-in by wallet, 2026-11-13)
|
||||
let activationCache = { at: 0, map: null };
|
||||
function activationByAddress() { // MemberActivated events by wallet, for the Sponsor check (when the contract bound the sponsor)
|
||||
if (activationCache.map && Date.now() - activationCache.at < 60000) return activationCache.map;
|
||||
@@ -568,6 +569,8 @@ async function boot() {
|
||||
// only (the admin portal is never shared); an account that is not here yet, or is still a waiting LinkSpin/BTC4Hits account,
|
||||
// gets the normal email-code sign-in with the email filled in, so every new-account check (anti-fraud, sponsor) runs as before.
|
||||
networksso.init({ self: 'iap', peer: 'linkspin', peerBase: LS_BASE, isProd: IS_PROD, dataDir: DATA_DIR, db, defaultPath: '/my',
|
||||
wallets: { bannerline: BL_BASE }, // Downline Banners members are wallets: vouch for the wallet they signed in with, else the account's linked one
|
||||
wallet: async s => { const a = await accounts.byEmail(s.email); const addr = String(s.address || (a && a.address) || '').toLowerCase(); return addr ? { address: addr, name: (a && a.username) || '' } : null; },
|
||||
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;
|
||||
let email = s.email || null; if (!email && s.address) { try { const a = await accounts.byAddress(s.address); if (a && a.email) email = a.email; } catch (e) {} }
|
||||
@@ -2311,7 +2314,15 @@ const server = http.createServer(async (req, res) => {
|
||||
res.writeHead(302, { Location: to, 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' }); return res.end();
|
||||
} }
|
||||
// network sign-in with LinkSpin (2026-11-12): /go/linkspin, /sso/start, /sso/check, /sso/in, /api/sso/status
|
||||
if (req.method === 'GET' && (p === '/go/linkspin' || p.startsWith('/sso/') || p === '/api/sso/status') && await networksso.handle(req, res, u)) return;
|
||||
if (req.method === 'GET' && (p === '/go/linkspin' || p === '/go/bannerline' || p.startsWith('/sso/') || p === '/api/sso/status') && await networksso.handle(req, res, u)) return;
|
||||
// network member lookup for Downline Banners (2026-11-13, Marty: share links use the InstantAdPay username): ?u=<username> -> the
|
||||
// account's linked wallet, ?a=<wallet> -> the username. Public data only (usernames are public join links, wallets are on-chain).
|
||||
if (req.method === 'GET' && p === '/api/network/member') {
|
||||
let a = null; const un = String(u.searchParams.get('u') || '').trim().toLowerCase(), ad = String(u.searchParams.get('a') || '').trim().toLowerCase();
|
||||
try { if (/^[a-z0-9_]{1,20}$/.test(un)) a = await accounts.byUsername(un); else if (/^0x[0-9a-f]{40}$/.test(ad)) a = await accounts.byAddress(ad); } catch (e) {}
|
||||
const ok = a && a.address && a.username && !fraud.isSuspended(a.email);
|
||||
return json(res, 200, ok ? { username: a.username, address: String(a.address).toLowerCase() } : { username: null, address: null }, { 'Cache-Control': 'public, max-age=300', 'Access-Control-Allow-Origin': '*' });
|
||||
}
|
||||
|
||||
// a LinkSpin click arriving on any page (?lsclk= or ?lsid=): the first-party cookie, 30 days, last click wins (reporting only, lsreport.js).
|
||||
// Added to whatever the page sends, like the viral-link cookies below.
|
||||
|
||||
Reference in New Issue
Block a user