Hub activity from every signed-in LinkSpin use (Marty 2026-11-16: "LinkSpin never reports activity", DownlineHydra Wake it)

The page-load ping (networksso.page) only fires on a full top-level navigation with Sec-Fetch-Dest: document and a
member session that carries an email. It never fired for a Control Room tab kept open (client-side moves and the
/api/my/ping heartbeat), browsers that send no Sec-Fetch headers, wallet-only sessions, or the owner working in the
admin portal. Live finding: Marty has had no LinkSpin member session since 2026-11-15 20:20 UTC, before the ping
shipped (b2669cf, 21:36 UTC); 16 other members already had linkspin rows.
- networksso.seen(s): the same once-a-day ping for any signed-in request; called from /api/me (email or wallet),
  the dashboard heartbeat /api/my/ping and the admin portal page (/admin, the owner's email; hub activity only,
  the admin session is never shared).
- qa/networksso-activity.test.mjs (13 checks, real hub, in run.sh sso + member): a signed-in page load records
  site linkspin, once a day, never API/assets/bots/fetches/signed-out, seen() for an open tab and a wallet session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-16 07:28:12 -06:00
parent aa7595a9cd
commit 1db7699e25
4 changed files with 102 additions and 3 deletions
+12 -1
View File
@@ -167,6 +167,17 @@ function activity(w) {
const k = w.email || w.wallet; if (pinged.has(k)) return; pinged.set(k, 1);
hubCall('/v1/activity', Object.assign({ kind: 'visit' }, w), 5000).then(r => { if (r.status >= 500) pinged.delete(k); }).catch(() => { pinged.delete(k); });
}
// a signed-in request the site already answers (2026-11-16, Marty: "LinkSpin never reports activity"): /api/me, the dashboard
// heartbeat (/api/my/ping) and the admin portal call this, so a Control Room tab kept open for days, a browser that sends no
// Sec-Fetch headers and a wallet-only session still count the day's visit. The page-load ping in page() only sees full navigations.
// s = {email} and/or {address}. Same once-a-day rule as page(). -> true when a ping was due or already sent today.
function seen(s) {
try {
if (!C || !hubCreds()) return false;
const w = who(s && s.email ? s : s && s.address ? { address: s.address } : null); if (!w) return false;
activity(w); return true;
} catch (e) { return false; }
}
// a real top-level page load of a page (never an API call, an asset, a fetch, a bot or one of our own hops)
function pageLoad(req, p) {
if (req.method !== 'GET' || isBot(req)) return false;
@@ -352,4 +363,4 @@ async function page(req, res, u) {
// true when this browser came here from a deliberate network tap and still has to finish it after signing in
const pendingBack = req => !!cookies(req)['nsso.back'];
module.exports = { init, handle, page, enabled, pendingBack, mint, verify, spend, safePath, isBot, offCookie, mask, TTL, NAMES, hubOn, hubCreds, signOutEverywhere, mintHub, verifyHub, _hubSeen: t => { hubSeen = t == null ? Date.now() : t; hubChecked = Date.now(); }, _pinged: pinged };
module.exports = { init, handle, page, seen, enabled, pendingBack, mint, verify, spend, safePath, isBot, offCookie, mask, TTL, NAMES, hubOn, hubCreds, signOutEverywhere, mintHub, verifyHub, _hubSeen: t => { hubSeen = t == null ? Date.now() : t; hubChecked = Date.now(); }, _pinged: pinged };