From 22b7e38e4410f4307d0dcc4cff5ecc752019e653 Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 1 Aug 2026 11:21:15 -0500 Subject: [PATCH] =?UTF-8?q?Fix:=20IDENT=20declared=20before=20updateAll()?= =?UTF-8?q?=20=E2=80=94=20TDZ=20crash=20broke=20init=20(ROI=20storage=20ke?= =?UTF-8?q?y=20reads=20it=20on=20first=20paint)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- index.html | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 9222c5f..61dbb4b 100644 --- a/index.html +++ b/index.html @@ -2333,6 +2333,18 @@ document.querySelectorAll('.tab-btn').forEach(btn => { if (boost && /^\d{1,6}$/.test(boost)) document.getElementById('boostFunds').value = boost; })(); +// ─── CTB Identity (sponsor alignment) ─────────────────────── +// One member, two usernames: their Crypto Team Build username and their +// ClickBaitPays username (the affiliateid on their CTB downline-builder +// entry for program #73). member-program-link.php resolves either direction. +// Share links may carry ?ctb= (canonical) or the legacy +// ?ref=; both end up fully resolved here. +// MUST be declared before updateAll(): the ROI storage key reads IDENT +// during the first paint (TDZ crash caught live 2026-08-01). +const CTB_LOOKUP_URL = 'https://cryptoteambuild.com/api/member-program-link.php'; +const HUB_BASE = 'https://ctbrewards.saasy.top'; +const IDENT = { cbp: getRefFromURL() || 'cryptoteambuild', ctb: '', fallback: false }; + updateAll(); // ─── URL Param Helpers ────────────────────────────────────── @@ -2341,16 +2353,6 @@ function getRefFromURL() { return p.get('ref') || ''; } -// ─── CTB Identity (sponsor alignment) ─────────────────────── -// One member, two usernames: their Crypto Team Build username and their -// ClickBaitPays username (the affiliateid on their CTB downline-builder -// entry for program #73). member-program-link.php resolves either direction. -// Share links may carry ?ctb= (canonical) or the legacy -// ?ref=; both end up fully resolved here. -const CTB_LOOKUP_URL = 'https://cryptoteambuild.com/api/member-program-link.php'; -const HUB_BASE = 'https://ctbrewards.saasy.top'; -const IDENT = { cbp: getRefFromURL() || 'cryptoteambuild', ctb: '', fallback: false }; - function getCbpUser() { return IDENT.cbp; } function hubUrl() {