From d919cd8097c3452e0f0310bede8f93e5047a670b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Rame=CC=81?= Date: Tue, 31 Mar 2026 14:42:24 +0200 Subject: [PATCH] tmp broken --- .../features/rooms/components/Conference.tsx | 31 +++++++++++-------- .../livekit/components/ParticipantTile.tsx | 22 ++++++++----- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/frontend/src/features/rooms/components/Conference.tsx b/src/frontend/src/features/rooms/components/Conference.tsx index 20c212fd..d0940c44 100644 --- a/src/frontend/src/features/rooms/components/Conference.tsx +++ b/src/frontend/src/features/rooms/components/Conference.tsx @@ -285,22 +285,20 @@ export const Conference = ({ } }, [room, encryptionEnabled, encryptionSetupComplete, isAdmin]) - // Track participants with decryption errors (key exchange in progress) + // Track participants pending key exchange. + // When a new participant joins an encrypted room, mark them as pending. + // Clear when their encryption status becomes true. useEffect(() => { if (!encryptionEnabled) return - const handleEncryptionError = (_err: Error, participant?: { identity: string }) => { - console.debug('[Encryption] encryptionError for participant:', participant?.identity) - if (participant?.identity) { - setPendingParticipants((prev) => { - const next = new Set(prev) - next.add(participant.identity) - return next - }) - } + const handleParticipantConnected = (participant: { identity: string }) => { + setPendingParticipants((prev) => { + const next = new Set(prev) + next.add(participant.identity) + return next + }) } - // Clear a specific participant from pending when their encryption status changes const handleEncryptionStatusChanged = (_encrypted: boolean, participant?: { identity: string }) => { if (participant?.identity) { setPendingParticipants((prev) => { @@ -311,11 +309,18 @@ export const Conference = ({ } } - room.on('encryptionError', handleEncryptionError) + const handleTrackSubscribed = () => { + // If any track is successfully subscribed, clear all pending + setPendingParticipants(new Set()) + } + + room.on('participantConnected', handleParticipantConnected) room.on('participantEncryptionStatusChanged', handleEncryptionStatusChanged) + room.on('trackSubscribed', handleTrackSubscribed) return () => { - room.off('encryptionError', handleEncryptionError) + room.off('participantConnected', handleParticipantConnected) room.off('participantEncryptionStatusChanged', handleEncryptionStatusChanged) + room.off('trackSubscribed', handleTrackSubscribed) } }, [room, encryptionEnabled]) diff --git a/src/frontend/src/features/rooms/livekit/components/ParticipantTile.tsx b/src/frontend/src/features/rooms/livekit/components/ParticipantTile.tsx index 32008831..7d9cdc48 100644 --- a/src/frontend/src/features/rooms/livekit/components/ParticipantTile.tsx +++ b/src/frontend/src/features/rooms/livekit/components/ParticipantTile.tsx @@ -22,7 +22,7 @@ import { import { Track } from 'livekit-client' import { RiHand } from '@remixicon/react' import { useRaisedHand, useRaisedHandPosition } from '../hooks/useRaisedHand' -import { EncryptionBadge, getTrustLevelFromAttributes, useEncryptionContext } from '@/features/encryption' +import { EncryptionBadge, getTrustLevelFromAttributes } from '@/features/encryption' import { useRoomData } from '../hooks/useRoomData' import { RiLockFill } from '@remixicon/react' import { HStack } from '@/styled-system/jsx' @@ -83,8 +83,9 @@ export const ParticipantTile: ( const isEncrypted = useIsEncrypted(trackReference.participant) const roomData = useRoomData() const isEncryptedRoom = roomData?.encryption_enabled ?? false - const { pendingParticipants } = useEncryptionContext() - const isKeyExchangePending = pendingParticipants.has(trackReference.participant.identity) + // In an encrypted room, if a remote participant's encryption status is false, + // it means we can't decrypt their frames yet (key exchange in progress). + const isKeyExchangePending = isEncryptedRoom && !isEncrypted && !trackReference.participant.isLocal const layoutContext = useMaybeLayoutContext() const autoManageSubscription = useFeatureContext()?.autoSubscription @@ -147,27 +148,32 @@ export const ParticipantTile: (
- +
+ +
- + Key exchange in progress