From e4b7d6460582438ac551eeebc340b03a0a49047e Mon Sep 17 00:00:00 2001 From: martbost Date: Sun, 30 Aug 2026 05:51:26 -0500 Subject: [PATCH] Admin: load the bonus panel after login, not before MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The panel fetched its tool list on DOMContentLoaded — which fires while the admin page is still showing the login form. The request 401'd, the handler returned silently, and the "What" select was left permanently empty with no path back. Loads from the same post-login block as the coaching radar and messages panels now, plus a refetch if the select is opened while still empty. Co-Authored-By: Claude Fable 5 --- public/admin.html | 7 ++++++- public/admin.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/public/admin.html b/public/admin.html index cdea6fa..953df2f 100644 --- a/public/admin.html +++ b/public/admin.html @@ -78,7 +78,12 @@ }catch(e){ msg.style.color='#f0a05a'; msg.textContent='Connection hiccup.'; } $('agGo').disabled=false; } - document.addEventListener('DOMContentLoaded',function(){ boot(); var b=$('agGo'); if(b) b.addEventListener('click',award); }); + window.agBoot=boot; + document.addEventListener('DOMContentLoaded',function(){ + var b=$('agGo'); if(b) b.addEventListener('click',award); + // Belt and braces: if the select is still empty when it's opened, try again. + var sel=$('agTool'); if(sel) sel.addEventListener('focus',function(){ if(!sel.options.length) boot(); }); + }); })(); diff --git a/public/admin.js b/public/admin.js index 0877c5f..1df5838 100644 --- a/public/admin.js +++ b/public/admin.js @@ -43,6 +43,7 @@ function render(){ const orgEl=document.getElementById('orgRoot');if(orgEl&&!orgEl.value)orgEl.value=state.config.orgRootId||'21'; if(!orgShareAutoLoaded&&orgEl&&orgEl.value){orgShareAutoLoaded=true;loadOrgShare();} if(!coachAutoLoaded){coachAutoLoaded=true;loadCoaching();} + if(!grantAutoLoaded){grantAutoLoaded=true;if(window.agBoot)window.agBoot();} if(!msgsAutoLoaded){msgsAutoLoaded=true;loadAdminMsgs();} const efi=document.getElementById('emailFromInput');if(efi&&!efi.value)efi.value=state.config.emailFrom||em.from||''; const f=document.getElementById('configForm'),c=state.config;for(const k of ['siteName','programName','bridgeHeadline','bridgeSubheadline','premiumEntryPol','dappReferralBaseUrl','telegramUrl','supportLabel','bemobPostbackUrl','telegramBotToken','telegramChatId','telegramTopicId','teamRootId','teamAlertEmail','ownerAlertEmail'])if(f.elements[k])f.elements[k].value=c[k]??'';f.elements.showSponsorName.checked=!!c.showSponsorName;f.elements.showQueueProgress.checked=!!c.showQueueProgress; @@ -124,6 +125,7 @@ async function loadCoaching(){ } const cr=document.getElementById('coachRefresh');if(cr)cr.addEventListener('click',loadCoaching); let coachAutoLoaded=false; +let grantAutoLoaded=false; async function loadAdminMsgs(){ const tb=document.getElementById('msgRows');if(!tb)return; try{