From 10b850b34bf69d7ceaf06c15d954bff2bad7ed5f Mon Sep 17 00:00:00 2001 From: martbost Date: Tue, 29 Sep 2026 09:49:01 -0500 Subject: [PATCH] Landing: keep the share link's ?r= when the cookie is refused (URL + localStorage fallback for the join link) Co-Authored-By: Claude Fable 5.1 --- public/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/index.html b/public/index.html index e714a97..7fb0703 100644 --- a/public/index.html +++ b/public/index.html @@ -95,6 +95,11 @@ .map(([l, v]) => '
' + v + '
' + l + '
').join(''); const cfg = await (await fetch('/api/config')).json(); // arrived on a member's share link: sign-ups go to that member's InstantAdPay join page + // the share link's ?r= is the truth even when the cookie was refused (blocked cookies, a framed view, a + // different browser later): read it from the URL, keep a copy in this browser, and build the join link here + // (2026-09-29: referrals were landing under the company with the cookie missing) + try { const rq = String(new URLSearchParams(location.search).get('r') || '').trim().slice(0, 40); if (/^[A-Za-z0-9_.-]{1,40}$/.test(rq)) localStorage.setItem('ph.ref', rq); } catch (e) {} + if (!cfg.ref) { let alt = ''; try { alt = String(new URLSearchParams(location.search).get('r') || localStorage.getItem('ph.ref') || '').trim().slice(0, 40); } catch (e) {} if (/^[A-Za-z0-9_.-]{1,40}$/.test(alt)) { cfg.ref = alt; cfg.joinUrl = 'https://instantadpay.com/join/' + encodeURIComponent(alt) + '?from=polhunter'; } } if (cfg.ref) { document.querySelectorAll('a[href="https://instantadpay.com/?from=polhunter"]').forEach(a => { a.href = cfg.joinUrl; }); const inv = document.createElement('span'); inv.className = 'pill'; inv.style.marginLeft = '10px'; inv.innerHTML = ' Invited by @' + cfg.ref.replace(/[<>&"]/g, ''); document.querySelector('.hero-copy .pill').after(inv); } document.getElementById('recent').innerHTML = (r.recent || []).length ? r.recent.map(x => '
' + x.who + '' + x.site + '+' + x.pol + ' POLverify ↗
').join('') : '
No drips yet. The first hunter gets the first line.
';