From fe217b897a8e19573d4e049ec9ce39c12c985f69 Mon Sep 17 00:00:00 2001 From: martbost Date: Wed, 9 Sep 2026 11:03:26 -0500 Subject: [PATCH] QA fixes: HEAD on page routes, Shorts signed-out 401, invite-page onboarding handoff, viewer check buttons clear of the overlay close button Co-Authored-By: Claude Fable 5.1 --- public/assets/join.js | 2 +- public/assets/my.js | 9 +++++++++ public/assets/shorts.js | 4 +++- public/join.html | 2 +- public/my.html | 2 +- public/view.html | 3 ++- server.js | 4 ++-- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/public/assets/join.js b/public/assets/join.js index 1288c6d..86c3abc 100644 --- a/public/assets/join.js +++ b/public/assets/join.js @@ -40,7 +40,7 @@ $('jnVerify').addEventListener('click', busy($('jnVerify'), async () => { await api('/api/auth/email/verify', { email: $('jnEmail').value, code: $('jnCode').value, newsletter: !!$('jnNews').checked, followups: !!$('jnNews').checked }); IAP.status('You are in. Taking you to your dashboard…', 'ok'); - location.href = '/my'; + location.href = '/my?welcome=1'; // dashboard runs the username step + welcome tour on arrival })); $('jnEmail').addEventListener('keydown', e => { if (e.key === 'Enter') ($('jnVerify').hidden ? $('jnSend') : $('jnVerify')).click(); }); $('jnCode').addEventListener('keydown', e => { if (e.key === 'Enter') $('jnVerify').click(); }); diff --git a/public/assets/my.js b/public/assets/my.js index 56c01fb..db12d4e 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -476,6 +476,15 @@ if ($('mcFinish')) $('mcFinish').hidden = !walletOnly; if (!signedIn) return; if ($('adminLink')) $('adminLink').hidden = !me.isAdmin; // admin portal link, only for ADMIN_EMAIL + // arrived from an invite page: run onboarding once (username, welcome tour, login ad) + if (/[?&]welcome=1/.test(location.search) && !render.welcomed) { + render.welcomed = true; + history.replaceState(null, '', '/my' + (location.hash || '')); + (async () => { + try { if (!me.username) await showOnboard(); if (!(await showGauntlet())) await showLoginAd(); } catch (e) {} + await render(); + })(); + } setPane(location.hash.slice(1) || 'overview'); $('campGate').hidden = !!me.memberId; $('earnGate').hidden = !!me.memberId; diff --git a/public/assets/shorts.js b/public/assets/shorts.js index 5c085ac..7743d27 100644 --- a/public/assets/shorts.js +++ b/public/assets/shorts.js @@ -13,7 +13,9 @@ st.token = null; st.maxSeen = 0; st.credited = false; st.done = false; $('shOver').hidden = true; $('shCta').hidden = true; $('shNext').hidden = true; let r = null; - try { r = await j('/api/my/videos?orientation=portrait'); } catch (e) {} + // signed-out visitors get the sign-in note without a 401 round trip + let me = null; try { me = await j('/api/me'); } catch (e) {} + if (me && me.signedIn && me.email) { try { r = await j('/api/my/videos?orientation=portrait'); } catch (e) {} } if (!r || r.error) { $('shVideo').hidden = true; $('shMsg').hidden = false; $('shMsg').textContent = 'Sign in on the dashboard to watch shorts and earn.'; return; } $('shStat').textContent = 'today: ' + (r.status.count || 0) + ' / ' + r.status.cap; if (!r.ad) { diff --git a/public/join.html b/public/join.html index a9e5cdc..f9f4b66 100644 --- a/public/join.html +++ b/public/join.html @@ -105,6 +105,6 @@ - + diff --git a/public/my.html b/public/my.html index 4735e34..85ed4a2 100644 --- a/public/my.html +++ b/public/my.html @@ -739,7 +739,7 @@ - + diff --git a/public/view.html b/public/view.html index 0f86436..e9cfed6 100644 --- a/public/view.html +++ b/public/view.html @@ -9,7 +9,8 @@