zebra-spaces: pass identity pubkey on SFU /subscribe so boots evict the listener path; tear SFU + mesh on self-boot

This commit is contained in:
Russell Ballestrini 2026-05-31 15:20:03 -04:00
parent f56bd39980
commit e72f2e8eed
No known key found for this signature in database

View file

@ -563,7 +563,11 @@ async function sfuSubscribe(){
/* server-initiated offer: POST /subscribe (empty body) — SFU answers with
* an SDP offer containing one m-line per current publisher. We answer it
* and POST the answer back, which completes the initial handshake. */
const offerRes = await fetch(SFU_BASE + '/subscribe?room=' + encodeURIComponent(roomID), {
/* pass our pubkey as `sub` so the SFU can evict us if we're booted —
* server-side boot also calls SFU /internal/block which kicks any
* subscriber whose sub pubkey matches */
const subUrl = SFU_BASE + '/subscribe?room=' + encodeURIComponent(roomID) + '&sub=' + myKeys.pubHex;
const offerRes = await fetch(subUrl, {
method:'POST', headers:{'Content-Type':'application/json'}, body: '{}'
});
if (!offerRes.ok){ pc.close(); throw new Error('sfu subscribe http '+offerRes.status); }
@ -914,10 +918,16 @@ async function handleSignal(raw){
if (mm) logLine('', mm.handle+' was removed by '+(by?by.handle:'a mod'));
if (m.uuid === myUUID){
/* server will close our socket; surface a clear notice and prevent
* the WS reconnect loop from auto-rejoining into a boot loop */
* the WS reconnect loop from auto-rejoining into a boot loop. Tear
* down our SFU + mesh PCs too so we actually stop hearing /
* broadcasting — closing the WS alone leaves the WebRTC paths up. */
wantConnected = false;
showNotice('You were removed from this space'+(by?' by '+by.handle:'')+'.', 'warn');
logLine('err','you were removed from this space');
for (const u of [...peers.keys()]) tearPeer(u);
sfuUnpublish().catch(()=>{});
sfuUnsubscribe().catch(()=>{});
dropMic();
}
members.delete(m.uuid); tearPeer(m.uuid); handraise.delete(m.uuid);
renderRoom();
@ -1288,8 +1298,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');
<footer style="margin:2.2rem auto 0;font-size:0.65rem;color:#999;line-height:1.7;word-break:break-all;font-family:monospace">
<span id="pi-seal" style="color:#777;cursor:default;user-select:none" title="">page integrity</span> &nbsp;·&nbsp; built <span class="stamp-date">2026-05-31</span><br>
md5 <span class="stamp-md5">acd638938338e18678254c89233f5964</span><br>
sha256 <span class="stamp-sha">d34f0432b7ae1eb209b45baf9954279c2098cefee9625b988223b1101f3897f2</span><br>
md5 <span class="stamp-md5">24817c5ddaa87097a6eece30b0dcc5cb</span><br>
sha256 <span class="stamp-sha">03ac79a343c537d43c3faf50478954bd0e0f17aeec21222bb3ff907be79f5a59</span><br>
<span style="color:#bbb">hashes are of this page with these two fields zeroed — to verify, blank them and re-hash</span><br>
<span style="color:#bbb">one self-contained file — <strong>save a copy</strong> and verify against these hashes; point at your own servers with ?signal= and ?turncred=, or <a href="host-your-own.html" style="color:#999">host your own community</a></span>
</footer>