Network sign-in: the way back to every network site (Marty 2026-11-17: "I just logged in to Instant Ad Pay from Viral Ad Source, and it never had a return path back")
Root cause: IAP's networksso `wallets` list was hand-written and had no ViralAdSource line, so
/sso/check?r=viraladsource was refused ("unknown site asking") and the browser was sent to the
IAP dashboard: a signed-out visitor to viraladsource.com/my was even dropped there by the silent
check, and a signed-in IAP member could never be signed in on ViralAdSource through IAP.
- networksso.js: providers also answer every site in the hub's GET /v1/sso-sites; ?return=<site>
&to=/path links remember the way back (nsso.ret, known sites only); /sso/resume finishes it
after the code sign-in; a wallet site with no wallet on the account goes to the Wallet tab
first (nsso.wait, no bounce loop) and the wallet link answers next: /sso/resume; the tap state
lives 1 hour.
- server.js: every /go/<site> and ?return= request goes to networksso (no per-site list; fivex
was missing from it too); walletPath /my#wallet; /api/me nssoBackTo; wallet link next/backTo.
- my.js: "Taking you back to <site>" after the wallet link; one line on the Wallet tab while a
site waits for the wallet. my.js?v=20261117back.
- qa/networksso-return.e2e.mjs: hub-only site, silent check, tap, wallet step, return links,
no open redirect. All network sign-in suites and iap-qa member pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -615,7 +615,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, vbb: VBB_BASE, viraladblitz: VAB_BASE, downlinehydra: DH_BASE, fivex: FIVEX_BASE }, // Downline Banners members are wallets: vouch for the wallet they signed in with, else the account's linked one
|
||||
wallets: { bannerline: BL_BASE, vbb: VBB_BASE, viraladblitz: VAB_BASE, downlinehydra: DH_BASE, fivex: FIVEX_BASE }, // Downline Banners members are wallets: vouch for the wallet they signed in with, else the account's linked one; every other hub sign-in site comes from the hub (2026-11-17)
|
||||
walletPath: '/my#wallet', // a site that needs a wallet, and none linked yet: the Wallet tab first, then back (2026-11-17)
|
||||
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;
|
||||
@@ -2404,7 +2405,8 @@ const server = http.createServer(async (req, res) => {
|
||||
} }
|
||||
// network sign-in with LinkSpin (2026-11-12): /go/linkspin, /sso/start, /sso/check, /sso/in, /api/sso/status
|
||||
if (req.method === 'GET' && await networksso.page(req, res, u)) return; // network hub: daily activity ping + the hub sign-in push (2026-11-15)
|
||||
if (req.method === 'GET' && (p === '/go/linkspin' || p === '/go/bannerline' || p === '/go/vbb' || p === '/go/viraladblitz' || p === '/go/downlinehydra' || p.startsWith('/sso/') || p === '/api/sso/status') && await networksso.handle(req, res, u)) return;
|
||||
// every /go/<site> and every ?return=<site> link goes to networksso (2026-11-17): it knows the hub's sign-in sites, so a new site no longer needs a line here
|
||||
if (req.method === 'GET' && (p.startsWith('/go/') || p.startsWith('/sso/') || p === '/api/sso/status' || u.searchParams.has('return')) && 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') {
|
||||
@@ -3063,7 +3065,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const lr = await accounts.linkWallet(s.email, r.address);
|
||||
if (lr.error) return json(res, 400, lr);
|
||||
await auth.updateSession(s.token, { address: r.address, memberId });
|
||||
return json(res, 200, { ok: true, linked: true, address: r.address, memberId, next: parseCookies(req)['iap.return'] === 'polhunter' ? '/api/my/polhunter' : null });
|
||||
return json(res, 200, { ok: true, linked: true, address: r.address, memberId, next: parseCookies(req)['iap.return'] === 'polhunter' ? '/api/my/polhunter' : networksso.afterWallet(req), backTo: parseCookies(req)['iap.return'] === 'polhunter' ? 'PolHunter' : networksso.backName(req) }); // a network site waiting on this wallet: straight back there (2026-11-17)
|
||||
}
|
||||
const acct = await accounts.byAddress(r.address);
|
||||
if (!acct && await accounts.positionOwner(r.address))
|
||||
@@ -3115,7 +3117,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (tankHold) sponsorBlocked = 'tankHold';
|
||||
else if (!sponsorId && memberId !== _defSpon) { sponsorId = _defSpon; sponsorFallback = true; } // orphan fallback → #1 (never self-sponsor)
|
||||
if (memberId && acct && acct.memberId !== memberId) accounts.setMemberId(acct.email, memberId).catch(() => {});
|
||||
const out = { signedIn: true, nssoBack: networksso.pendingBack(req), gkShop: !!parseCookies(req)['iap.gkshop'], sdShop: !!parseCookies(req)['iap.sdshop'], pwMint: !!parseCookies(req)['iap.pwmint'], returnTo: ['turkeydrop', 'polhunter', 'driprunner', 'passivedrip', 'gemkingdom', 'gkshop', 'spookydoors', 'sdshop', 'pwmint', 'polybreak', 'polminer', 'warpwares', 'shardsofvalor', 'forum'].includes(parseCookies(req)['iap.return']) ? parseCookies(req)['iap.return'] : (networksso.pendingBack(req) ? 'nsso' : null), sponsorBlocked, sponsorRouted, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
const out = { signedIn: true, nssoBack: networksso.pendingBack(req), nssoBackTo: networksso.backName(req), gkShop: !!parseCookies(req)['iap.gkshop'], sdShop: !!parseCookies(req)['iap.sdshop'], pwMint: !!parseCookies(req)['iap.pwmint'], returnTo: ['turkeydrop', 'polhunter', 'driprunner', 'passivedrip', 'gemkingdom', 'gkshop', 'spookydoors', 'sdshop', 'pwmint', 'polybreak', 'polminer', 'warpwares', 'shardsofvalor', 'forum'].includes(parseCookies(req)['iap.return']) ? parseCookies(req)['iap.return'] : (networksso.pendingBack(req) ? 'nsso' : null), sponsorBlocked, sponsorRouted, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
address: s.address || (acct && acct.address) || null, memberId,
|
||||
username: (acct && acct.username) || null, theme: (acct && acct.theme) || null,
|
||||
inviteAsk: !memberId && acct ? tank.inviteAsk(acct) : null, // the Who invited you card (2026-11-07)
|
||||
|
||||
Reference in New Issue
Block a user