Dashboard: 'Switch to this position' link when signed in as a different ID (Triple Play holders were pinned to the first wallet by the 30-day cookie); next sign-in forces the wallet account picker

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-08 13:32:19 -05:00
parent 59ec48c346
commit a5e14b1dbc
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -31,5 +31,5 @@
</section>
</main>
<footer class="wrap disclaimer">All figures are read live from the RM Circle smart contract on Polygon and are historical facts, not a promise of future results. Participation involves cryptocurrency and smart-contract risk. Never use funds you cannot afford to lose.<div class="footer-links"><a href="/">Home</a><a href="/contract">Contract Security</a><a href="/disclaimer">Disclaimers</a><a href="/tools">Promo Tools</a><a href="/privacy">Privacy</a><a href="/refunds">Refunds</a></div></footer>
<script src="/track.js"></script><script src="/qrlib.js"></script><script src="/rmc-wallet.js?v=20260920"></script><script src="/inapp-browser.js?v=20260920"></script><script src="/profile-gate.js?v=20260917a"></script><script src="/my.js?v=20261002p"></script><script src="/payouts.js" defer></script><script src="/chat.js?v=20260920" defer></script><script src="/translate.js" defer></script><script src="/tg-app.js" defer></script><script src="/wallet-notice.js" defer></script> <script src="/announce.js?v=20260929a"></script>
<script src="/track.js"></script><script src="/qrlib.js"></script><script src="/rmc-wallet.js?v=20260920"></script><script src="/inapp-browser.js?v=20260920"></script><script src="/profile-gate.js?v=20260917a"></script><script src="/my.js?v=20261008a"></script><script src="/payouts.js" defer></script><script src="/chat.js?v=20260920" defer></script><script src="/translate.js" defer></script><script src="/tg-app.js" defer></script><script src="/wallet-notice.js" defer></script> <script src="/announce.js?v=20260929a"></script>
</body></html>
+4 -1
View File
@@ -372,7 +372,7 @@
let data;
try{data=await(await fetch('/api/public/msg-inbox')).json();}catch(e){el.innerHTML='<div class="empty">Could not load messages — refresh to retry.</div>';return;}
const mine=Number(me.id)===Number(d.id);
let banner=mine?'':`<div class="callout" style="margin-bottom:10px">You're signed in as <strong>#${me.id}</strong> — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.)</div>`;
let banner=mine?'':`<div class="callout" style="margin-bottom:10px">You're signed in as <strong>#${me.id}</strong> — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.) <a href="#" id="msgSwitch" style="white-space:nowrap">Own #${d.id} too? Switch to this position →</a></div>`;
// The one place contact details genuinely matter: a message cannot be delivered
// to someone who has given no way to reach them. Asked here, never forced.
try{
@@ -403,6 +403,7 @@
</div>
<textarea id="msgBody" maxlength="1500" rows="3" placeholder="Plain text, up to 1500 characters. You can message your team and your upline." style="width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#08192880;color:var(--text);font-size:14px"></textarea>
<div style="display:flex;gap:10px;align-items:center;margin-top:8px"><button id="msgSendBtn" class="btn btn-primary">Send →</button><span id="msgStatus" class="micro"></span></div></div>`;
{const sw=document.getElementById('msgSwitch');if(sw)sw.addEventListener('click',async function(ev){ev.preventDefault();sw.textContent='signing out…';try{await fetch('/api/public/signout',{method:'POST'});}catch(e){}try{sessionStorage.setItem('rmc.switch','1');}catch(e){}location.reload();});}
const unreadIds=(data.inbox||[]).filter(m=>!m.read).map(m=>m.mid);
if(unreadIds.length)fetch('/api/public/msg-read',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({mids:unreadIds})}).catch(()=>{});
// The inbox "Add mine" button was rendered with NO click handler, so it sat there
@@ -486,6 +487,8 @@
try{
const eth=await window.RMCWallet.pick();
if(!eth){{var _ia=(window.RMCInApp&&window.RMCInApp.notice('/my'))||'';if(_ia){err.innerHTML=_ia;if(err.style)err.style.display='block';window.RMCInApp.bind('/my');}else{err.textContent='This browser has no wallet in it. Open this page INSIDE your wallet app instead: open Trust, MetaMask, SafePal or Coinbase, find its Browser (or DApps) tab, and type rmcircle.team/my into that address bar. On iPhone, Trust no longer has a browser — use MetaMask or SafePal, or ask your sponsor to link you instead.';}}return;}
let wantSwitch=false;try{wantSwitch=sessionStorage.getItem('rmc.switch')==='1';}catch(e){}
if(wantSwitch){try{await eth.request({method:'wallet_requestPermissions',params:[{eth_accounts:{}}]});}catch(e){}try{sessionStorage.removeItem('rmc.switch');}catch(e){}}
const accs=await eth.request({method:'eth_requestAccounts'});const account=accs[0];
// Match the wallet's active chain to the SIWE message's Chain ID (137),
// or the wallet rejects the signature ("chain ID does not match").