diff --git a/public/assets/common.js b/public/assets/common.js index 1c550f7..5e2fb7e 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -48,12 +48,23 @@ window.BL = (function () { // "Part of the network": the list comes from the hub through /api/network-sites, the built-in copy if it does not answer const NET = [['iap', 'InstantAdPay', 'https://instantadpay.com'], ['linkspin', 'LinkSpin', 'https://linkspin.app'], ['dlb', 'Downline Banners', 'https://downlinebanners.com'], ['vbb', 'Viral Banner Blitz', 'https://viralbannerblitz.com'], ['stackpol', 'Stack POL', 'https://stackpol.com'], ['earnerscorner', 'Earners Corner', 'https://earnerscorner.com']].map(a => ({ id: a[0], name: a[1], url: a[2] })); + // the footer links carry a referral username (Marty 2026-11-15): the signed-in member's own network username, else the sponsor this + // visitor came in on (/api/me names both; the bl.ref cookie holds a wallet, so it is never used here). Tracked links get it as s1 + // (LinkSpin sends it on as ?ref=), plain links as ?ref=. Earners Corner takes none. + const REF_RE = /^[A-Za-z0-9_.-]{1,40}$/; + const okRef = v => !!v && REF_RE.test(v) && !/^0x[0-9a-f]{40}$/i.test(v); + function netRef(href, s, ref) { + if (!ref || s.id === 'earnerscorner') return href; + try { const u = new URL(href); u.searchParams.set(s.go ? 's1' : 'ref', ref); return u.toString(); } catch (e) { return href; } + } function netLine(el) { if (!el) return; - const paint = list => { el.innerHTML = 'Part of the network · One account across the network: ' + list.map(s => (s.id === 'dlb' || /downlinebanners\.com/.test(s.url)) - ? '' + esc(s.name) + '' : '' + esc(s.name) + '').join(' · '); }; - paint(NET); - fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) paint(l); }).catch(() => {}); + let list = NET, ref = ''; + const paint = () => { el.innerHTML = 'Part of the network · One account across the network: ' + list.map(s => (s.id === 'dlb' || /downlinebanners\.com/.test(s.url)) + ? '' + esc(s.name) + '' : '' + esc(s.name) + '').join(' · '); }; + paint(); + fetch('/api/network-sites').then(r => r.json()).then(l => { if (Array.isArray(l) && l.length) { list = l; paint(); } }).catch(() => {}); + fetch('/api/me', { credentials: 'same-origin' }).then(r => r.json()).then(m => { const r = m && m.signedIn && okRef(m.username) ? m.username : (m && okRef(m.refName) ? m.refName : ''); if (r) { ref = r; paint(); } }).catch(() => {}); } // one spot tile; href goes through the /go relay, which counts the click function tile(t, opts) { diff --git a/public/board.html b/public/board.html index 19ac82d..bc7a3be 100644 --- a/public/board.html +++ b/public/board.html @@ -31,7 +31,7 @@

The line so far

- + diff --git a/public/contract.html b/public/contract.html index 8e6873f..5644eb9 100644 --- a/public/contract.html +++ b/public/contract.html @@ -35,7 +35,7 @@
  • Open any sale in the live ledger and look at its Logs: one SpotBought event, then one Paid event per payment.
  • - + diff --git a/public/disclaimer.html b/public/disclaimer.html index a8fd5ad..3595156 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -33,7 +33,7 @@

    Your decision

    Only spend what you can afford to lose completely. This is not financial, legal or tax advice. You are responsible for any taxes on what you receive.

    Contact

    Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

    - + diff --git a/public/how.html b/public/how.html index 877b926..e534b16 100644 --- a/public/how.html +++ b/public/how.html @@ -39,7 +39,7 @@

    The momentum fund

    When no spot has sold for 4 hours, the fund buys one (at most 12 a day). It gifts the spot to an active member who owns a paid spot and has not had a gift in 7 days, members who referred someone recently first. If nobody qualifies, the fund keeps the spot and its line money goes back into the fund.

    The rest of the network

    Open board slots show network sites such as InstantAdPay and LinkSpin. On InstantAdPay, ad credits buy advertising, not income.

    - + diff --git a/public/index.html b/public/index.html index 37cc7be..90eb3cc 100644 --- a/public/index.html +++ b/public/index.html @@ -52,7 +52,7 @@ - + diff --git a/public/join.html b/public/join.html index 127b115..3ea605d 100644 --- a/public/join.html +++ b/public/join.html @@ -48,7 +48,7 @@ - + diff --git a/public/ledger.html b/public/ledger.html index 4ea4bf1..7f0ced3 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -30,7 +30,7 @@

    Spot sales

    Loading the ledger...

    - + diff --git a/public/my.html b/public/my.html index a81a128..04b9b92 100644 --- a/public/my.html +++ b/public/my.html @@ -41,7 +41,7 @@ - + diff --git a/public/privacy.html b/public/privacy.html index 5c354f9..320b1bc 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -34,7 +34,7 @@

    Your choices

    You can ask us to delete your account data on this site or on the network hub. Records on the blockchain cannot be deleted by anyone. You can clear the cookies in your browser at any time; you will need to sign in again.

    Contact

    Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

    - + diff --git a/public/promote.html b/public/promote.html index f0df55d..e14c2d6 100644 --- a/public/promote.html +++ b/public/promote.html @@ -33,7 +33,7 @@

    Loading the kit...

    - + diff --git a/public/terms.html b/public/terms.html index 864c24e..e8c638e 100644 --- a/public/terms.html +++ b/public/terms.html @@ -39,7 +39,7 @@

    Limits

    As far as the law allows, we are not responsible for losses caused by the blockchain, your wallet, the price of POL, third-party websites in banners, or events outside our control, and our total responsibility to you is limited to what you paid for the purchase in question. These terms are governed by the laws of the State of Alabama, USA.

    Contact

    Questions, problems or a request about your data: network support, or write to TrustClickz, 615 Green Valley Drive, Moody, AL 35004.

    - + diff --git a/server.js b/server.js index c4ec20a..94535ee 100644 --- a/server.js +++ b/server.js @@ -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)