Expired sessions open the sign-in instead of dead-ending: any 401 from the API (or returning to a tab past its session) opens the in-shell sign-in once and reloads the screen; cr-shell tag bumped. Chatbot: login-ad slots now 6 (raised from 3, Marty 2026-10-23)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-23 06:34:25 -05:00
parent f6621a8e34
commit 7c96e59db7
13 changed files with 21 additions and 14 deletions
+1 -1
View File
@@ -69,7 +69,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/ads-screen.js?v=20261020s"></script>
</body>
</html>
+7
View File
@@ -27,6 +27,13 @@ window.CR = (function () {
const FALLBACK = {}; // the classic /my dashboard is retired (2026-10-08); its leftover panes live at /tools
const BUILT = new Set(['links', 'sources', 'pages', 'zones', 'ads', 'credits', 'reports', 'team', 'wallet', 'tools', 'promo', 'training', 'pipeline', 'profile', 'help']); // Training, Pipeline and Profile on the rail, not behind More (Marty 2026-10-11); Help = support tickets (2026-10-16)
let ME = null, toastT;
// Expired session (Marty 2026-10-23: "told me to sign in but never redirected me"): sessions last 24 h, and a screen
// left open past that got 'Sign in first.' errors with no way forward. Any 401 from our API, or coming back to a tab
// whose session has lapsed, opens the in-shell sign-in once and reloads the screen after it.
let lostOpen = false, lastCheck = Date.now();
function sessionLost() { if (lostOpen) return; lostOpen = true; ME = null; toast('Your session ended. Sign in again to keep going.', true); signInFlow(() => location.reload()); }
(function () { const f0 = window.fetch.bind(window); window.fetch = async function (input, init) { const r = await f0(input, init); try { const u = new URL(typeof input === 'string' ? input : input.url, location.href); if (r.status === 401 && u.origin === location.origin && /^\/api\//.test(u.pathname) && !/^\/api\/(auth|me$)/.test(u.pathname) && !/^\/api\/admin\//.test(u.pathname)) sessionLost(); } catch (e) {} return r; }; })();
document.addEventListener('visibilitychange', async () => { if (document.visibilityState !== 'visible' || lostOpen || !ME || !ME.signedIn || Date.now() - lastCheck < 60000) return; lastCheck = Date.now(); const m = await me(true); if (!m || !m.signedIn) sessionLost(); });
function toast(msg, bad) { let t = $('crToast'); if (!t) { t = document.createElement('div'); t.id = 'crToast'; t.className = 'toast'; t.setAttribute('role', 'status'); document.body.appendChild(t); } t.textContent = msg; t.classList.toggle('bad', !!bad); t.classList.add('on'); clearTimeout(toastT); toastT = setTimeout(() => t.classList.remove('on'), 2000); }
async function api(path, body) { const r = await (await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) })).json(); if (r.error) throw new Error(r.error); return r; }
async function get(path) { const r = await (await fetch(path, { headers: { Accept: 'application/json' } })).json(); if (r.error) throw new Error(r.error); return r; }
+1 -1
View File
@@ -82,7 +82,7 @@
</div>
<script src="/assets/common.js?v=20261018p25"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/credits-screen.js?v=20261019pos"></script>
</body>
</html>
+1 -1
View File
@@ -29,7 +29,7 @@
<div id="page">
<div class="body" id="helpBody"><div class="panel"><span class="muted">loading</span></div></div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/help-screen.js?v=20261016a"></script>
</body>
</html>
+1 -1
View File
@@ -252,7 +252,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/links.js?v=20261021t"></script>
<script src="/assets/banner-spin.js?v=20261020bs3"></script>
</body>
+1 -1
View File
@@ -1008,7 +1008,7 @@
</div>
</div>
<script src="/assets/common.js?v=20261018p25"></script>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/tools.js?v=20261011a"></script>
<script src="/assets/wallet.js?v=20261021a"></script>
<script src="/assets/promo.js?v=20261020bs3"></script>
+1 -1
View File
@@ -72,7 +72,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/pages-screen.js?v=20261021t"></script>
</body>
</html>
+1 -1
View File
@@ -89,7 +89,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/reports.js?v=20261020bs3"></script>
</body>
</html>
+1 -1
View File
@@ -123,7 +123,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/sources-screen.js?v=20261012a"></script>
</body>
</html>
+1 -1
View File
@@ -37,7 +37,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/team.js?v=20261020s"></script>
</body>
</html>
+1 -1
View File
@@ -31,7 +31,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/wallet-screen.js?v=20261022usd"></script>
</body>
</html>
+1 -1
View File
@@ -41,7 +41,7 @@
</div>
</div>
</div>
<script src="/assets/cr-shell.js?v=20261018c"></script>
<script src="/assets/cr-shell.js?v=20261023a"></script>
<script src="/assets/zones-screen.js?v=20261010a"></script>
</body>
</html>