From 368f0b048bc1f853f3c4a79f0ee99de2f4f44fbc Mon Sep 17 00:00:00 2001 From: Matt Lorentz Date: Tue, 17 Mar 2026 19:38:10 +0000 Subject: [PATCH] Expect pubkey in kind 39004 (#101) This adjusts our implementation of the Livekit presence event to match the NIP (https://github.com/nostr-protocol/nips/pull/2238#issuecomment-4057645310). Specifically we now expect the user's Nostr pubkey in the `participant` tag instead of the livekit identity string. I also fixed a bug I found where a malformed `participant` tag would crash the rendering of VoiceWidget, causing it to appear frozen. There is a corresponding zooid PR [here](https://github.com/coracle-social/zooid/pull/11) Co-authored-by: mplorentz Reviewed-on: https://gitea.coracle.social/coracle/flotilla/pulls/101 Co-authored-by: Matt Lorentz Co-committed-by: Matt Lorentz --- src/app/voice.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/voice.ts b/src/app/voice.ts index 40aa962c..e8222e99 100644 --- a/src/app/voice.ts +++ b/src/app/voice.ts @@ -123,7 +123,7 @@ export const deriveVoiceParticipants = (url: string, h: string) => if (!latestEvent) return [] const participants = removeUndefined( map( - (tag: string[]) => (tag[1] ? participantFromLiveKitIdentity(tag[1]) : undefined), + (tag: string[]) => (tag[1] ? {pubkey: tag[1], identity: tag[1]} : undefined), getTags("participant", latestEvent.tags), ), ) @@ -133,8 +133,6 @@ export const deriveVoiceParticipants = (url: string, h: string) => ) const onRoomDisconnected = (reason?: DisconnectReason) => { - speakingParticipants.set([]) - participantPubkeyMap.set(new Map()) currentVoiceSession.set(undefined) if (reason !== undefined && reason !== DisconnectReason.CLIENT_INITIATED) { voiceState.set("disconnected") @@ -144,6 +142,8 @@ const onRoomDisconnected = (reason?: DisconnectReason) => { : "Voice connection lost." pushToast({theme: "error", message}) } + speakingParticipants.set([]) + participantPubkeyMap.set(new Map()) } const onTrackSubscribed = (track: Track) => { @@ -257,11 +257,11 @@ export const leaveVoiceRoom = async () => { const audio = new Audio("/leave-voice-room.mp3") audio.play().catch(() => {}) + voiceState.set("disconnected") + currentVoiceSession.set(undefined) + session.room.disconnect() speakingParticipants.set([]) participantPubkeyMap.set(new Map()) - voiceState.set("disconnected") - session.room.disconnect() - currentVoiceSession.set(undefined) } export const rejoinVoiceRoom = () => {