Sign-in: InstantAdPay as the fallback when the hub has no sign-in for the browser (from: { iap }, NETWORK_SSO_SECRET set), so "Sign in with your network account" no longer bounces straight back to /my (Marty 2026-11-20)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-20 07:31:18 -06:00
parent 1987823e4b
commit 856dbcb8d3
+6 -3
View File
@@ -197,13 +197,16 @@ const chatbot = require('./chatbot');
const legal = require('./legal'); const legal = require('./legal');
const chatJson = (res, code, obj, extra) => { res.writeHead(code, Object.assign({ 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' }, extra || {})); res.end(JSON.stringify(obj)); }; const chatJson = (res, code, obj, extra) => { res.writeHead(code, Object.assign({ 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' }, extra || {})); res.end(JSON.stringify(obj)); };
// My Stack POL (Marty approved 2026-11-19): the network sign-in through the hub (networksso.js, the shared file; HUB_SSO=on with // My Stack POL (Marty approved 2026-11-19): the network sign-in through the hub (networksso.js, the shared file; HUB_SSO=on with
// HUB_URL, HUB_SECRET, HUB_SITE=stackpol) and the signed-in area at /my (my.js). Nothing public needs it. Hub only: no // HUB_URL, HUB_SECRET, HUB_SITE=stackpol) and the signed-in area at /my (my.js). Nothing public needs it.
// NETWORK_SSO_SECRET here, so the old pairwise IAP/LinkSpin path stays off (and no `from`: members are emails, like the hub's). // InstantAdPay as the fallback (Marty 2026-11-20: "you click on it ... and it never goes anywhere"): with only the hub, a browser
// the hub has no sign-in for came straight back to /my. NETWORK_SSO_SECRET (the same as IAP's) turns on the pairwise path the other
// rebuilt sites use, and `from: { iap }` makes the hop name this site (&r=stackpol) so InstantAdPay signs the member in and sends
// them back here, not to its own peer LinkSpin.
const networksso = require('./networksso'); const networksso = require('./networksso');
const my = require('./my'); const my = require('./my');
const IAP_BASE = String(process.env.IAP_URL || 'https://instantadpay.com').trim().replace(/\/+$/, ''); const IAP_BASE = String(process.env.IAP_URL || 'https://instantadpay.com').trim().replace(/\/+$/, '');
my.init({ idx: () => IDX, PROGRAMS, BY_KEY, head, tail, esc, fmt, fmtInt, when, ledgerRows, tableHead, SITE, dataDir: DATA_DIR, qr: !!QR }); my.init({ idx: () => IDX, PROGRAMS, BY_KEY, head, tail, esc, fmt, fmtInt, when, ledgerRows, tableHead, SITE, dataDir: DATA_DIR, qr: !!QR });
networksso.init({ self: 'stackpol', peer: 'iap', peerBase: () => IAP_BASE, isProd: /^https:/.test(SITE), dataDir: DATA_DIR, defaultPath: '/my', networksso.init({ self: 'stackpol', peer: 'iap', peerBase: () => IAP_BASE, from: { iap: () => IAP_BASE }, isProd: /^https:/.test(SITE), dataDir: DATA_DIR, defaultPath: '/my',
member: async req => { const s = my.session(req); return s ? { email: s.email, address: s.address } : null; }, member: async req => { const s = my.session(req); return s ? { email: s.email, address: s.address } : null; },
accept: async email => (email ? { ok: true } : { fallback: 'no email' }), // the hub vouches for a network member; Stack POL keeps no accounts accept: async email => (email ? { ok: true } : { fallback: 'no email' }), // the hub vouches for a network member; Stack POL keeps no accounts
signIn: async (email, req, v) => my.mintSession({ email, wallet: v && v.wallet, name: v && v.name }), signIn: async (email, req, v) => my.mintSession({ email, wallet: v && v.wallet, name: v && v.name }),