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 @@ - + 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").