Footer network links carry a referral username (Marty 2026-11-15): the signed-in member's own network username, else the sponsor the visitor came in on. /api/me now also answers username (signed in) and refName (the sponsor's network username via nameOf; never the wallet, so the bl.ref cookie is not read client side). Tracked links get it as s1 (LinkSpin sends it on as ?ref=), plain links as ?ref=, none for Earners Corner. Same approach as VBB 6798503. common.js?v=20261115nr. Smoke 127/127
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -447,9 +447,13 @@ const server = http.createServer(async (req, res) => {
|
||||
return json(res, 200, { ok: true }, { 'Set-Cookie': [cookie('bl.sid', '', 0, true), networksso.offCookie()] }); // signed out stays signed out here for 12 hours
|
||||
}
|
||||
if (p === '/api/me' && req.method === 'GET') {
|
||||
const s = session(req); if (!s) return json(res, 200, { signedIn: false, sponsor: await sponsorFor(req) });
|
||||
// username / refName (Marty 2026-11-15): the footer's network links carry a referral username, the member's own network
|
||||
// username when signed in, else the sponsor's (usernames only, never the wallet)
|
||||
const nm = async a => (a ? await nameOf(a).catch(() => null) : null);
|
||||
const s = session(req); if (!s) { const sp = await sponsorFor(req); return json(res, 200, { signedIn: false, sponsor: sp, refName: await nm(sp) }); }
|
||||
store.touch(s.address);
|
||||
return json(res, 200, { signedIn: true, address: s.address, member: chain.isMember(s.address), sponsor: await sponsorFor(req) });
|
||||
const sp = await sponsorFor(req); const [username, refName] = await Promise.all([nm(s.address), nm(sp)]);
|
||||
return json(res, 200, { signedIn: true, address: s.address, member: chain.isMember(s.address), sponsor: sp, username, refName });
|
||||
}
|
||||
|
||||
// -- member API (signed in)
|
||||
|
||||
Reference in New Issue
Block a user