Network hub hook (Marty 2026-11-16): sign out everywhere, hub blocks and erases end sessions here; "Sign out everywhere" button
hubevents.js (new, byte-identical in VBB, DLB, ViralAdBlitz, DownlineHydra, 5xYourTeam): POST /api/hub/events, signed by the hub with HUB_SECRET (same hook InstantAdPay and LinkSpin take). member.signedout and member.blocked: the person is looked up by hub id (/v1/resolve, signed as viraladblitz) and their sessions here end (by the main wallet or any contract wallet). member.erased: matched by the wallet SHA-256s (and email SHA-256) the hub now sends with the event. Only sessions made before the event end (a replay never signs anyone out twice); a failed hub lookup answers 503 so the hub resends. Off with HUB_HOOK=0. Admin status: hubEvents (counts only). My Ads: "Sign out everywhere" next to Sign out (POST /api/auth/logout-everywhere -> networksso.signOutEverywhere, then every session of this member here ends). Smoke: section 17 (same cases as the other wallet sites): 231/231 with UI. my.js?v=8 (the spin-link check now expects v=8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ const shop = require('./shop');
|
||||
const promokit = require('./promokit');
|
||||
const hubreport = require('./hubreport');
|
||||
const hubpeople = require('./hubpeople');
|
||||
const hubevents = require('./hubevents'); // network hub hook (2026-11-16): sign-out-everywhere, block and erase end sessions here
|
||||
const hubline = require('./hubline');
|
||||
const proof = require('./proof');
|
||||
const netsites = require('./netsites');
|
||||
@@ -137,6 +138,8 @@ networksso.init({ self: C.siteId, peer: 'iap', peerBase: () => C.iapBase, from:
|
||||
return cookie('vab.sid', store.mintSession(v.wallet), store.SESSION_TTL / 1000, true);
|
||||
},
|
||||
landing: to => to, signinPath: to => to });
|
||||
// the hub's member.signedout / member.blocked / member.erased: that person's sessions here end (by any of their wallets)
|
||||
hubevents.init({ dataDir: C.dataDir, site: 'viraladblitz', end: who => store.endSessions(x => who.match(x) || who.match(store.member(x.address)), who.before) });
|
||||
|
||||
// ---- old site links (the VBB pattern): /?<old username>, /splashpg.php?pid=N&r=<old>, /lcp.php?pid=N&r=<old> -> the same person's
|
||||
// page here (oldrefs.json, a MySQL document loaded by POST /api/admin/oldrefs, matched by email); any other *.php -> / ----
|
||||
@@ -344,6 +347,17 @@ const server = http.createServer(async (req, res) => {
|
||||
const s = session(req); if (s) store.dropSession(s.token);
|
||||
return json(res, 200, { ok: true }, { 'Set-Cookie': [cookie('vab.sid', '', 0, true), networksso.offCookie()] });
|
||||
}
|
||||
// "Sign out everywhere" (2026-11-16): the hub ends every network sign-in of this member and tells every hooked site; every
|
||||
// session of this wallet here ends now. Same-origin POST only (SameSite=Lax session cookie).
|
||||
if (p === '/api/auth/logout-everywhere' && req.method === 'POST') {
|
||||
const s = session(req); let hub = { ok: false };
|
||||
if (s) { hub = await networksso.signOutEverywhere(s); store.endSessions(x => x.address === s.address, Date.now() + 1000); }
|
||||
return json(res, 200, { ok: true, everywhere: !!hub.ok }, { 'Set-Cookie': [cookie('vab.sid', '', 0, true), networksso.offCookie()] });
|
||||
}
|
||||
if (p === '/api/hub/events' && req.method === 'POST') {
|
||||
let raw = ''; try { raw = (await readRaw(req, 256 * 1024)).toString('utf8'); } catch (e) { return json(res, 413, { error: 'too big' }); }
|
||||
const r = await hubevents.receive(req.headers, raw); return json(res, r.status, r.body);
|
||||
}
|
||||
if (p === '/api/me' && req.method === 'GET') {
|
||||
const s = session(req); if (!s) return json(res, 200, { signedIn: false });
|
||||
const m = store.member(s.address);
|
||||
@@ -432,7 +446,7 @@ const server = http.createServer(async (req, res) => {
|
||||
today: store.today(), totals: S.totals, members: store.members().length, ads: { live: store.liveAds().length, all: store.ads().length },
|
||||
boosts: { orders: B.length, views: B.reduce((t, b) => t + b.views, 0), delivered: B.reduce((t, b) => t + b.delivered, 0), active: B.filter(b => b.remaining > 0).length, late: B.filter(b => b.status === 'finishing-in-network').length, waitingForAd: B.filter(b => b.status === 'waiting-for-ad').length },
|
||||
rows: { visits: store.visits().length, clicks: store.clicks().length, boostViews: store.bviews().length },
|
||||
shop: shop.view(), proof: proof.view(), hub: hubreport.view(), hubLookup: hubpeople.view(), nas: vabnas.view(), linkspin: lstrack.view(), docstore: docstore.view(), oldrefs: Object.keys(oldRefMap()).length });
|
||||
shop: shop.view(), proof: proof.view(), hub: hubreport.view(), hubLookup: hubpeople.view(), hubEvents: hubevents.view(), nas: vabnas.view(), linkspin: lstrack.view(), docstore: docstore.view(), oldrefs: Object.keys(oldRefMap()).length });
|
||||
}
|
||||
if (p === '/api/admin/boosts' && req.method === 'GET') return json(res, 200, { boosts: wire.purchases().map(x => Object.assign(wire.boostView(x), { buyer: x.buyer, usdCents: x.usdCents, weiPaid: x.weiPaid, pays: x.pays || null, over: x.over || null })).sort((a, b) => (b.at || 0) - (a.at || 0)) });
|
||||
if (p === '/api/admin/oldrefs' && req.method === 'POST') {
|
||||
|
||||
Reference in New Issue
Block a user