From a5e14b1dbc7597668f23255f3a1b36f7b3e9762a Mon Sep 17 00:00:00 2001 From: martbost Date: Thu, 8 Oct 2026 13:32:19 -0500 Subject: [PATCH] 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 --- public/my.html | 2 +- public/my.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/my.html b/public/my.html index b05d668..4731082 100644 --- a/public/my.html +++ b/public/my.html @@ -31,5 +31,5 @@
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.
- + diff --git a/public/my.js b/public/my.js index 56b9720..e6d0317 100644 --- a/public/my.js +++ b/public/my.js @@ -372,7 +372,7 @@ let data; try{data=await(await fetch('/api/public/msg-inbox')).json();}catch(e){el.innerHTML='
Could not load messages — refresh to retry.
';return;} const mine=Number(me.id)===Number(d.id); - let banner=mine?'':`
You're signed in as #${me.id} — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.)
`; + let banner=mine?'':`
You're signed in as #${me.id} — this inbox is yours. (You're viewing #${d.id}'s page; the "to" box is pre-filled for them.) Own #${d.id} too? Switch to this position →
`; // 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 @@
`; + {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").