mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-27 12:19:10 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7d89600ea |
@@ -12,18 +12,15 @@ and this project adheres to
|
||||
|
||||
- ✨(backend) allow searching the recording admin table by owner email
|
||||
- ✨(frontend) add participant color gradient when camera is off #1490
|
||||
- ✨(all) allow forcing SSO display name for authenticated users
|
||||
|
||||
### Changed
|
||||
|
||||
- 🗑️(settings) deprecate SUMMARY_SERVICE_VERSION=1
|
||||
- ⬆️(mail) update mjml to v5 and @html-to/text-cli
|
||||
- 🚸(frontend) initialize the join input name with the persisted full name
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🩹(backend) identify externally provisioned users to PostHog
|
||||
- 🐛(backend) fix info panel crash for unregistered rooms
|
||||
|
||||
## [1.23.0] - 2026-07-08
|
||||
|
||||
|
||||
@@ -68,9 +68,6 @@ def get_frontend_configuration(request):
|
||||
"enable_firefox_proxy_workaround": settings.LIVEKIT_ENABLE_FIREFOX_PROXY_WORKAROUND,
|
||||
"default_sources": settings.LIVEKIT_DEFAULT_SOURCES,
|
||||
},
|
||||
"authenticated_users_can_edit_display_name": (
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME
|
||||
),
|
||||
}
|
||||
frontend_configuration.update(settings.FRONTEND_CONFIGURATION)
|
||||
return Response(frontend_configuration)
|
||||
|
||||
@@ -92,7 +92,6 @@ from core.services.subtitle import SubtitleException, SubtitleService
|
||||
from core.tasks.file import process_file_deletion
|
||||
|
||||
from ..authentication.livekit import LiveKitTokenAuthentication
|
||||
from ..models import RoomAccessLevel
|
||||
from . import permissions, serializers, throttling
|
||||
from .feature_flag import FeatureFlag
|
||||
|
||||
@@ -268,9 +267,6 @@ class RoomViewSet(
|
||||
username = request.query_params.get("username", None)
|
||||
data = {
|
||||
"id": None,
|
||||
"slug": slug,
|
||||
"is_administrable": False,
|
||||
"access_level": RoomAccessLevel.PUBLIC,
|
||||
"livekit": {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
"room": slug,
|
||||
|
||||
@@ -130,9 +130,6 @@ def test_api_rooms_retrieve_anonymous_unregistered_allowed(mock_token):
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"id": None,
|
||||
"slug": "unregistered-room",
|
||||
"access_level": "public",
|
||||
"is_administrable": False,
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": "unregistered-room",
|
||||
@@ -165,9 +162,6 @@ def test_api_rooms_retrieve_anonymous_unregistered_allowed_not_normalized(mock_t
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"id": None,
|
||||
"slug": "reunion",
|
||||
"access_level": "public",
|
||||
"is_administrable": False,
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": "reunion",
|
||||
|
||||
@@ -2,109 +2,13 @@
|
||||
Test utils functions
|
||||
"""
|
||||
|
||||
# pylint: disable=W0621
|
||||
import json
|
||||
from unittest import mock
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
from livekit.api import TwirpError
|
||||
|
||||
from core.factories import UserFactory
|
||||
from core.utils import (
|
||||
NotificationError,
|
||||
create_livekit_client,
|
||||
generate_token,
|
||||
notify_participants,
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
def decode_token(token: str) -> dict:
|
||||
"""Decode a LiveKit JWT access token for inspection."""
|
||||
return jwt.decode(
|
||||
token,
|
||||
settings.LIVEKIT_CONFIGURATION["api_secret"],
|
||||
algorithms=["HS256"],
|
||||
)
|
||||
|
||||
|
||||
def test_generate_token_authenticated_uses_full_name():
|
||||
"""The token's display name should default to the user's full name."""
|
||||
user = UserFactory(full_name="Jane Doe")
|
||||
|
||||
token = generate_token(room="my-room", user=user)
|
||||
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Jane Doe"
|
||||
assert claims["sub"] == str(user.sub)
|
||||
|
||||
|
||||
def test_generate_token_authenticated_fallback_user_representation():
|
||||
"""
|
||||
When the user has no full name, the token's display name should fall back
|
||||
to the user's string representation.
|
||||
"""
|
||||
user = UserFactory(full_name=None)
|
||||
|
||||
token = generate_token(room="my-room", user=user)
|
||||
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == str(user)
|
||||
|
||||
|
||||
def test_generate_token_explicit_username_overrides_default():
|
||||
"""An explicitly provided username should take precedence over the full name."""
|
||||
user = UserFactory(full_name="Jane Doe")
|
||||
|
||||
token = generate_token(room="my-room", user=user, username="Custom Name")
|
||||
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Custom Name"
|
||||
|
||||
|
||||
def test_authenticated_username_ignored_when_editing_disabled(settings):
|
||||
"""With editing disabled, an authenticated user's username is ignored."""
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = False
|
||||
user = UserFactory(full_name="Jane Doe")
|
||||
token = generate_token(room="my-room", user=user, username="Custom Name")
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Jane Doe"
|
||||
|
||||
|
||||
def test_authenticated_default_name_unaffected_when_editing_disabled(settings):
|
||||
"""Disabling editing doesn't disturb the default full-name path."""
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = False
|
||||
user = UserFactory(full_name="Jane Doe")
|
||||
token = generate_token(room="my-room", user=user)
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Jane Doe"
|
||||
|
||||
|
||||
def test_anonymous_uses_username_when_provided():
|
||||
"""An anonymous user's provided username is used as the display name."""
|
||||
token = generate_token(room="my-room", user=AnonymousUser(), username="Guest42")
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Guest42"
|
||||
|
||||
|
||||
def test_anonymous_username_used_even_when_editing_disabled(settings):
|
||||
"""The setting governs authenticated users only; anonymous can still set a name."""
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = False
|
||||
token = generate_token(room="my-room", user=AnonymousUser(), username="Guest42")
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Guest42"
|
||||
|
||||
|
||||
def test_anonymous_falls_back_to_anonymous_label():
|
||||
"""With no username, an anonymous user is labelled 'Anonymous'."""
|
||||
token = generate_token(room="my-room", user=AnonymousUser())
|
||||
claims = decode_token(token)
|
||||
assert claims["name"] == "Anonymous"
|
||||
from core.utils import NotificationError, create_livekit_client, notify_participants
|
||||
|
||||
|
||||
@mock.patch("asyncio.get_running_loop")
|
||||
|
||||
@@ -109,16 +109,11 @@ def generate_token(
|
||||
default_username = "Anonymous"
|
||||
else:
|
||||
identity = str(user.sub)
|
||||
default_username = user.full_name or str(user)
|
||||
default_username = str(user)
|
||||
|
||||
if color is None:
|
||||
color = generate_color(identity)
|
||||
|
||||
can_edit = (
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME or user.is_anonymous
|
||||
)
|
||||
display_name = (username or default_username) if can_edit else default_username
|
||||
|
||||
token = (
|
||||
AccessToken(
|
||||
api_key=settings.LIVEKIT_CONFIGURATION["api_key"],
|
||||
@@ -126,7 +121,7 @@ def generate_token(
|
||||
)
|
||||
.with_grants(video_grants)
|
||||
.with_identity(identity)
|
||||
.with_name(display_name)
|
||||
.with_name(username or default_username)
|
||||
.with_attributes(
|
||||
{"color": color, "room_admin": "true" if is_admin_or_owner else "false"}
|
||||
)
|
||||
|
||||
@@ -671,11 +671,6 @@ class Base(Configuration):
|
||||
environ_name="PARTICIPANT_FORBIDDEN_PERMISSION_FIELDS",
|
||||
environ_prefix=None,
|
||||
)
|
||||
AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = values.BooleanValue(
|
||||
True,
|
||||
environ_name="AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME",
|
||||
environ_prefix=None,
|
||||
)
|
||||
|
||||
# Recording settings
|
||||
RECORDING_ENABLE = values.BooleanValue(
|
||||
|
||||
@@ -58,7 +58,6 @@ export interface ApiConfig {
|
||||
transcription_destination?: string
|
||||
max_participants_for_sound: number
|
||||
auto_mute_on_join_threshold: number
|
||||
authenticated_users_can_edit_display_name: boolean
|
||||
}
|
||||
|
||||
const fetchConfig = (): Promise<ApiConfig> => {
|
||||
|
||||
@@ -9,11 +9,10 @@ import { useState } from 'react'
|
||||
|
||||
import { menuRecipe } from '@/primitives/menuRecipe'
|
||||
import { ApiRoom } from '@/features/rooms/api/ApiRoom'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { userStore } from '@/stores/user'
|
||||
import { loadUserChoices } from '@livekit/components-core'
|
||||
|
||||
export const CreateMeetingMenu = () => {
|
||||
const { username } = useSnapshot(userStore)
|
||||
const { username } = loadUserChoices()
|
||||
|
||||
const { t } = useTranslation('home')
|
||||
const { mutateAsync: createRoom } = useCreateRoom()
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'
|
||||
import { styled } from '@/styled-system/jsx'
|
||||
import { FocusLayout } from '@/features/rooms/livekit/components/FocusLayout'
|
||||
import { SecondaryScreenShareStrip } from './SecondaryScreenShareStrip'
|
||||
|
||||
export interface FocusAreaProps {
|
||||
focusTrack: TrackReferenceOrPlaceholder
|
||||
secondaryScreenShareTracks: TrackReferenceOrPlaceholder[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Main focus track with an optional strip of secondary screen shares below.
|
||||
*/
|
||||
export function FocusArea({
|
||||
focusTrack,
|
||||
secondaryScreenShareTracks,
|
||||
}: FocusAreaProps) {
|
||||
return (
|
||||
<FocusColumn>
|
||||
<MainFocusSlot>
|
||||
<FocusLayout trackRef={focusTrack} />
|
||||
</MainFocusSlot>
|
||||
<SecondaryScreenShareStrip tracks={secondaryScreenShareTracks} />
|
||||
</FocusColumn>
|
||||
)
|
||||
}
|
||||
|
||||
const FocusColumn = styled('div', {
|
||||
base: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
})
|
||||
|
||||
const MainFocusSlot = styled('div', {
|
||||
base: {
|
||||
position: 'relative',
|
||||
flex: 1,
|
||||
minHeight: 0,
|
||||
overflow: 'hidden',
|
||||
'& .lk-participant-tile': {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
'& .lk-participant-media-video': {
|
||||
objectFit: 'contain',
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,66 @@
|
||||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'
|
||||
import { memo } from 'react'
|
||||
import { styled } from '@/styled-system/jsx'
|
||||
import { ParticipantTile } from '@/features/rooms/livekit/components/ParticipantTile'
|
||||
import { getTrackKey } from '@/features/pip/utils/pipTrackSelection'
|
||||
|
||||
export interface SecondaryScreenShareStripProps {
|
||||
tracks: TrackReferenceOrPlaceholder[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Compact horizontal strip for non-focused screen shares.
|
||||
* Each tile keeps pin controls so users can switch focus to any share.
|
||||
*/
|
||||
export const SecondaryScreenShareStrip = memo(
|
||||
({ tracks }: SecondaryScreenShareStripProps) => {
|
||||
if (tracks.length === 0) return null
|
||||
|
||||
return (
|
||||
<StripContainer>
|
||||
{tracks.map((track) => (
|
||||
<ShareTile key={getTrackKey(track)}>
|
||||
<ParticipantTile trackRef={track} />
|
||||
</ShareTile>
|
||||
))}
|
||||
</StripContainer>
|
||||
)
|
||||
}
|
||||
)
|
||||
SecondaryScreenShareStrip.displayName = 'SecondaryScreenShareStrip'
|
||||
|
||||
const StripContainer = styled('div', {
|
||||
base: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
gap: '0.5rem',
|
||||
flexShrink: 0,
|
||||
height: '120px',
|
||||
minHeight: '80px',
|
||||
maxHeight: '140px',
|
||||
padding: '0.5rem 0 0',
|
||||
overflowX: 'auto',
|
||||
overflowY: 'hidden',
|
||||
boxSizing: 'border-box',
|
||||
},
|
||||
})
|
||||
|
||||
const ShareTile = styled('div', {
|
||||
base: {
|
||||
position: 'relative',
|
||||
flex: '0 0 auto',
|
||||
height: '100%',
|
||||
aspectRatio: '16 / 9',
|
||||
minWidth: 0,
|
||||
borderRadius: '8px',
|
||||
overflow: 'hidden',
|
||||
backgroundColor: 'primaryDark.100',
|
||||
'& .lk-participant-tile': {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
'& .lk-participant-media-video': {
|
||||
objectFit: 'contain',
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,84 @@
|
||||
import {
|
||||
isEqualTrackRef,
|
||||
isTrackReference,
|
||||
type TrackReferenceOrPlaceholder,
|
||||
} from '@livekit/components-core'
|
||||
import { Track } from 'livekit-client'
|
||||
|
||||
export function getSubscribedScreenShareTracks(
|
||||
tracks: TrackReferenceOrPlaceholder[]
|
||||
): TrackReferenceOrPlaceholder[] {
|
||||
return tracks
|
||||
.filter(isTrackReference)
|
||||
.filter(
|
||||
(track) =>
|
||||
track.publication.source === Track.Source.ScreenShare &&
|
||||
track.publication.isSubscribed
|
||||
)
|
||||
}
|
||||
|
||||
export function getNewScreenShareTracks(
|
||||
screenShareTracks: TrackReferenceOrPlaceholder[],
|
||||
knownTrackSids: Set<string>
|
||||
): TrackReferenceOrPlaceholder[] {
|
||||
return screenShareTracks.filter(
|
||||
(track) =>
|
||||
track.publication.trackSid &&
|
||||
!knownTrackSids.has(track.publication.trackSid)
|
||||
)
|
||||
}
|
||||
|
||||
export function syncKnownScreenShareSids(
|
||||
screenShareTracks: TrackReferenceOrPlaceholder[],
|
||||
knownTrackSids: Set<string>
|
||||
): void {
|
||||
const currentSids = new Set(
|
||||
screenShareTracks
|
||||
.map((track) => track.publication.trackSid)
|
||||
.filter((sid): sid is string => !!sid)
|
||||
)
|
||||
|
||||
screenShareTracks.forEach((track) => {
|
||||
if (track.publication.trackSid) {
|
||||
knownTrackSids.add(track.publication.trackSid)
|
||||
}
|
||||
})
|
||||
|
||||
knownTrackSids.forEach((sid) => {
|
||||
if (!currentSids.has(sid)) {
|
||||
knownTrackSids.delete(sid)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getNewestScreenShareTrack(
|
||||
screenShareTracks: TrackReferenceOrPlaceholder[]
|
||||
): TrackReferenceOrPlaceholder | undefined {
|
||||
if (screenShareTracks.length === 0) return undefined
|
||||
return screenShareTracks[screenShareTracks.length - 1]
|
||||
}
|
||||
|
||||
export function splitTracksForFocusLayout(
|
||||
tracks: TrackReferenceOrPlaceholder[],
|
||||
focusTrack: TrackReferenceOrPlaceholder | undefined,
|
||||
screenShareTracks: TrackReferenceOrPlaceholder[]
|
||||
): {
|
||||
carouselTracks: TrackReferenceOrPlaceholder[]
|
||||
secondaryScreenShareTracks: TrackReferenceOrPlaceholder[]
|
||||
} {
|
||||
const hasActiveScreenShares = screenShareTracks.length > 0
|
||||
|
||||
const secondaryScreenShareTracks = screenShareTracks.filter(
|
||||
(track) => !focusTrack || !isEqualTrackRef(track, focusTrack)
|
||||
)
|
||||
|
||||
const carouselTracks = tracks.filter((track) => {
|
||||
if (focusTrack && isEqualTrackRef(track, focusTrack)) return false
|
||||
if (hasActiveScreenShares && track.source === Track.Source.ScreenShare) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
return { carouselTracks, secondaryScreenShareTracks }
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export type ApiRoom = {
|
||||
id: string
|
||||
name: string
|
||||
slug: string
|
||||
pin_code?: string
|
||||
pin_code: string
|
||||
is_administrable: boolean
|
||||
access_level: ApiAccessLevel
|
||||
livekit?: ApiLiveKit
|
||||
|
||||
@@ -36,7 +36,6 @@ import { PictureInPictureConference } from '@/features/pip/components/PictureInP
|
||||
import { notifyAutoMutedOnJoin } from '@/features/notifications/utils'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { userPreferencesStore } from '@/stores/userPreferences'
|
||||
import { userStore } from '@/stores/user'
|
||||
|
||||
export const Conference = ({
|
||||
roomId,
|
||||
@@ -54,8 +53,6 @@ export const Conference = ({
|
||||
userChoices: LocalUserChoices
|
||||
}
|
||||
|
||||
const { username } = useSnapshot(userStore)
|
||||
|
||||
useEffect(() => {
|
||||
posthog.capture('visit-room', { slug: roomId })
|
||||
}, [roomId, posthog])
|
||||
@@ -86,10 +83,10 @@ export const Conference = ({
|
||||
queryFn: () =>
|
||||
fetchRoom({
|
||||
roomId: roomId as string,
|
||||
username: username,
|
||||
username: userConfig.username,
|
||||
}).catch((error) => {
|
||||
if (error.statusCode == '404') {
|
||||
createRoom({ slug: roomId, username })
|
||||
createRoom({ slug: roomId, username: userConfig.username })
|
||||
}
|
||||
}),
|
||||
retry: false,
|
||||
|
||||
@@ -42,17 +42,14 @@ import {
|
||||
saveAudioInputDeviceId,
|
||||
saveAudioInputEnabled,
|
||||
saveAudioOutputDeviceId,
|
||||
saveUsername,
|
||||
saveVideoInputDeviceId,
|
||||
saveVideoInputEnabled,
|
||||
userChoicesStore,
|
||||
} from '@/stores/userChoices'
|
||||
|
||||
import { saveUsername, userStore } from '@/stores/user'
|
||||
|
||||
import { useCannotUseDevice } from '../livekit/hooks/useCannotUseDevice'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { useUser } from '@/features/auth/api/useUser'
|
||||
import { useConfig } from '@/api/useConfig'
|
||||
|
||||
const onError = (e: Error) => console.error('ERROR', e)
|
||||
|
||||
@@ -117,9 +114,6 @@ export const Join = ({
|
||||
}) => {
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'join' })
|
||||
|
||||
const { data: configData } = useConfig()
|
||||
const { isLoggedIn, user } = useUser()
|
||||
|
||||
const {
|
||||
audioEnabled,
|
||||
videoEnabled,
|
||||
@@ -127,10 +121,9 @@ export const Join = ({
|
||||
audioOutputDeviceId,
|
||||
videoDeviceId,
|
||||
processorConfig,
|
||||
username,
|
||||
} = useSnapshot(userChoicesStore)
|
||||
|
||||
const { username } = useSnapshot(userStore)
|
||||
|
||||
const initialUserChoices = useRef<LocalUserChoices | null>(null)
|
||||
|
||||
if (initialUserChoices.current === null) {
|
||||
@@ -141,6 +134,7 @@ export const Join = ({
|
||||
audioOutputDeviceId,
|
||||
videoDeviceId,
|
||||
processorConfig,
|
||||
username,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,23 +448,20 @@ export const Join = ({
|
||||
<H lvl={1} margin="sm" centered>
|
||||
{t('heading')}
|
||||
</H>
|
||||
{(!isLoggedIn ||
|
||||
configData?.authenticated_users_can_edit_display_name) && (
|
||||
<Field
|
||||
type="text"
|
||||
onChange={saveUsername}
|
||||
label={t('usernameLabel')}
|
||||
id="input-name"
|
||||
defaultValue={username || user?.full_name}
|
||||
validate={(value) => !value && t('errors.usernameEmpty')}
|
||||
wrapperProps={{
|
||||
noMargin: true,
|
||||
fullWidth: true,
|
||||
}}
|
||||
autoComplete="name"
|
||||
maxLength={50}
|
||||
/>
|
||||
)}
|
||||
<Field
|
||||
type="text"
|
||||
onChange={saveUsername}
|
||||
label={t('usernameLabel')}
|
||||
id="input-name"
|
||||
defaultValue={username}
|
||||
validate={(value) => !value && t('errors.usernameEmpty')}
|
||||
wrapperProps={{
|
||||
noMargin: true,
|
||||
fullWidth: true,
|
||||
}}
|
||||
autoComplete="name"
|
||||
maxLength={50}
|
||||
/>
|
||||
</VStack>
|
||||
</Form>
|
||||
)
|
||||
|
||||
@@ -1,21 +1,52 @@
|
||||
import { useFocusToggle } from '@livekit/components-react'
|
||||
import {
|
||||
isTrackReferencePinned,
|
||||
} from '@livekit/components-core'
|
||||
import { useFocusToggle, useMaybeLayoutContext } from '@livekit/components-react'
|
||||
import { type Participant, Track } from 'livekit-client'
|
||||
import { useCallback } from 'react'
|
||||
import type { MouseEvent } from 'react'
|
||||
import Source = Track.Source
|
||||
|
||||
export const useFocusToggleParticipant = (participant: Participant) => {
|
||||
const trackRef = {
|
||||
participant: participant,
|
||||
publication: participant.getTrackPublication(Source.Camera),
|
||||
source: Source.Camera,
|
||||
}
|
||||
const getParticipantPinTrackRef = (participant: Participant) => {
|
||||
const screenSharePublication = participant.getTrackPublication(
|
||||
Source.ScreenShare
|
||||
)
|
||||
const source =
|
||||
participant.isScreenShareEnabled && screenSharePublication
|
||||
? Source.ScreenShare
|
||||
: Source.Camera
|
||||
|
||||
const { mergedProps, inFocus } = useFocusToggle({
|
||||
return {
|
||||
participant,
|
||||
publication: participant.getTrackPublication(source),
|
||||
source,
|
||||
}
|
||||
}
|
||||
|
||||
export const useFocusToggleParticipant = (participant: Participant) => {
|
||||
const layoutContext = useMaybeLayoutContext()
|
||||
const trackRef = getParticipantPinTrackRef(participant)
|
||||
|
||||
const { mergedProps, inFocus: isFocusedTrack } = useFocusToggle({
|
||||
trackRef,
|
||||
props: {},
|
||||
})
|
||||
|
||||
const inFocus =
|
||||
isFocusedTrack ||
|
||||
(!!layoutContext?.pin.state &&
|
||||
[Source.Camera, Source.ScreenShare].some((source) => {
|
||||
const ref = {
|
||||
participant,
|
||||
publication: participant.getTrackPublication(source),
|
||||
source,
|
||||
}
|
||||
return (
|
||||
!!ref.publication &&
|
||||
isTrackReferencePinned(ref, layoutContext.pin.state)
|
||||
)
|
||||
}))
|
||||
|
||||
const toggle = useCallback(() => {
|
||||
const syntheticEvent = {
|
||||
preventDefault: () => {},
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { ControlBar } from './ControlBar/ControlBar'
|
||||
import { FocusLayout } from '../components/FocusLayout'
|
||||
import { ParticipantTile } from '../components/ParticipantTile'
|
||||
import { SidePanel } from '../components/SidePanel'
|
||||
import { RecordingProvider } from '@/features/recording'
|
||||
@@ -39,8 +38,16 @@ import { getParticipantName } from '@/features/rooms/utils/getParticipantName'
|
||||
import { useScreenReaderAnnounce } from '@/hooks/useScreenReaderAnnounce'
|
||||
import { ReactionPortals } from '@/features/reactions/components/ReactionPortals'
|
||||
import { CarouselLayout } from '@/features/layout/components/CarouselLayout'
|
||||
import { FocusArea } from '@/features/layout/components/FocusArea'
|
||||
import { GridLayout } from '@/features/layout/components/GridLayout'
|
||||
import { RoomContentArea } from '@/features/layout/components/RoomContentArea'
|
||||
import {
|
||||
getNewScreenShareTracks,
|
||||
getNewestScreenShareTrack,
|
||||
getSubscribedScreenShareTracks,
|
||||
splitTracksForFocusLayout,
|
||||
syncKnownScreenShareSids,
|
||||
} from '@/features/layout/utils/screenShareLayout'
|
||||
import { usePictureInPicture } from '@/features/pip/hooks/usePictureInPicture'
|
||||
import { PipRoomPlaceholder } from '@/features/pip/components/PipRoomPlaceholder'
|
||||
|
||||
@@ -73,6 +80,7 @@ export interface VideoConferenceProps extends React.HTMLAttributes<HTMLDivElemen
|
||||
export function VideoConference({ ...props }: VideoConferenceProps) {
|
||||
const lastAutoFocusedScreenShareTrack =
|
||||
useRef<TrackReferenceOrPlaceholder | null>(null)
|
||||
const knownScreenShareTrackSids = useRef<Set<string>>(new Set())
|
||||
const lastPinnedParticipantIdentityRef = useRef<string | null>(null)
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'pinAnnouncements' })
|
||||
const { t: tRooms } = useTranslation('rooms')
|
||||
@@ -114,14 +122,11 @@ export function VideoConference({ ...props }: VideoConferenceProps) {
|
||||
|
||||
useNoiseReduction()
|
||||
|
||||
const screenShareTracks = tracks
|
||||
.filter(isTrackReference)
|
||||
.filter((track) => track.publication.source === Track.Source.ScreenShare)
|
||||
const screenShareTracks = getSubscribedScreenShareTracks(tracks)
|
||||
|
||||
const focusTrack = usePinnedTracks(layoutContext)?.[0]
|
||||
const carouselTracks = tracks.filter(
|
||||
(track) => !isEqualTrackRef(track, focusTrack)
|
||||
)
|
||||
const { carouselTracks, secondaryScreenShareTracks } =
|
||||
splitTracksForFocusLayout(tracks, focusTrack, screenShareTracks)
|
||||
|
||||
const { isOpen: isPictureInPictureOpen } = usePictureInPicture()
|
||||
|
||||
@@ -181,31 +186,48 @@ export function VideoConference({ ...props }: VideoConferenceProps) {
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
// Code duplicated from LiveKit; this warning will be addressed in the refactoring.
|
||||
useEffect(() => {
|
||||
// If screen share tracks are published, and no pin is set explicitly, auto set the screen share.
|
||||
if (
|
||||
screenShareTracks.some((track) => track.publication.isSubscribed) &&
|
||||
lastAutoFocusedScreenShareTrack.current === null
|
||||
) {
|
||||
log.debug('Auto set screen share focus:', {
|
||||
newScreenShareTrack: screenShareTracks[0],
|
||||
})
|
||||
layoutContext.pin.dispatch?.({
|
||||
msg: 'set_pin',
|
||||
trackReference: screenShareTracks[0],
|
||||
})
|
||||
lastAutoFocusedScreenShareTrack.current = screenShareTracks[0]
|
||||
const newScreenShares = getNewScreenShareTracks(
|
||||
screenShareTracks,
|
||||
knownScreenShareTrackSids.current
|
||||
)
|
||||
syncKnownScreenShareSids(
|
||||
screenShareTracks,
|
||||
knownScreenShareTrackSids.current
|
||||
)
|
||||
|
||||
if (newScreenShares.length > 0) {
|
||||
const newestScreenShare = getNewestScreenShareTrack(newScreenShares)
|
||||
if (newestScreenShare) {
|
||||
log.debug('Auto set screen share focus:', {
|
||||
newScreenShareTrack: newestScreenShare,
|
||||
})
|
||||
layoutContext.pin.dispatch?.({
|
||||
msg: 'set_pin',
|
||||
trackReference: newestScreenShare,
|
||||
})
|
||||
lastAutoFocusedScreenShareTrack.current = newestScreenShare
|
||||
}
|
||||
} else if (
|
||||
lastAutoFocusedScreenShareTrack.current &&
|
||||
!screenShareTracks.some(
|
||||
(track) =>
|
||||
track.publication.trackSid ===
|
||||
lastAutoFocusedScreenShareTrack.current?.publication?.trackSid
|
||||
)
|
||||
focusTrack?.source === Track.Source.ScreenShare &&
|
||||
!screenShareTracks.some((track) => isEqualTrackRef(track, focusTrack))
|
||||
) {
|
||||
log.debug('Auto clearing screen share focus.')
|
||||
layoutContext.pin.dispatch?.({ msg: 'clear_pin' })
|
||||
lastAutoFocusedScreenShareTrack.current = null
|
||||
const newestRemaining = getNewestScreenShareTrack(screenShareTracks)
|
||||
if (newestRemaining) {
|
||||
log.debug('Auto switching to remaining screen share:', {
|
||||
screenShareTrack: newestRemaining,
|
||||
})
|
||||
layoutContext.pin.dispatch?.({
|
||||
msg: 'set_pin',
|
||||
trackReference: newestRemaining,
|
||||
})
|
||||
lastAutoFocusedScreenShareTrack.current = newestRemaining
|
||||
} else {
|
||||
log.debug('Auto clearing screen share focus.')
|
||||
layoutContext.pin.dispatch?.({ msg: 'clear_pin' })
|
||||
lastAutoFocusedScreenShareTrack.current = null
|
||||
}
|
||||
}
|
||||
|
||||
if (focusTrack && !isTrackReference(focusTrack)) {
|
||||
const updatedFocusTrack = tracks.find(
|
||||
(tr) =>
|
||||
@@ -281,7 +303,14 @@ export function VideoConference({ ...props }: VideoConferenceProps) {
|
||||
>
|
||||
<ParticipantTile />
|
||||
</CarouselLayout>
|
||||
{focusTrack && <FocusLayout trackRef={focusTrack} />}
|
||||
{focusTrack && (
|
||||
<FocusArea
|
||||
focusTrack={focusTrack}
|
||||
secondaryScreenShareTracks={
|
||||
secondaryScreenShareTracks
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</FocusLayoutContainer>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -8,9 +8,8 @@ import { HStack } from '@/styled-system/jsx'
|
||||
import { useState } from 'react'
|
||||
import { LoginButton } from '@/components/LoginButton'
|
||||
import { useRenameParticipant } from '@/features/rooms/api/renameParticipant'
|
||||
import { saveUsername } from '@/stores/user'
|
||||
import { saveUsername } from '@/stores/userChoices'
|
||||
import { logout } from '@/features/auth/utils/logout'
|
||||
import { useConfig } from '@/api/useConfig'
|
||||
|
||||
export type AccountTabProps = Pick<DialogProps, 'onOpenChange'> &
|
||||
Pick<TabPanelProps, 'id'>
|
||||
@@ -18,7 +17,6 @@ export type AccountTabProps = Pick<DialogProps, 'onOpenChange'> &
|
||||
export const AccountTab = ({ id, onOpenChange }: AccountTabProps) => {
|
||||
const { t } = useTranslation('settings')
|
||||
const room = useRoomContext()
|
||||
const { data } = useConfig()
|
||||
const { user, isLoggedIn } = useUser()
|
||||
|
||||
const { renameParticipant } = useRenameParticipant()
|
||||
@@ -47,17 +45,15 @@ export const AccountTab = ({ id, onOpenChange }: AccountTabProps) => {
|
||||
return (
|
||||
<TabPanel padding={'md'} flex id={id}>
|
||||
<H lvl={2}>{t('account.heading')}</H>
|
||||
{(!isLoggedIn || data?.authenticated_users_can_edit_display_name) && (
|
||||
<Field
|
||||
type="text"
|
||||
label={t('account.nameLabel')}
|
||||
value={name}
|
||||
onChange={setName}
|
||||
validate={(value) => {
|
||||
return !value ? <p>{t('account.nameError')}</p> : null
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<Field
|
||||
type="text"
|
||||
label={t('account.nameLabel')}
|
||||
value={name}
|
||||
onChange={setName}
|
||||
validate={(value) => {
|
||||
return !value ? <p>{t('account.nameError')}</p> : null
|
||||
}}
|
||||
/>
|
||||
<H lvl={2}>{t('account.authentication')}</H>
|
||||
{isLoggedIn ? (
|
||||
<>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import { proxy, subscribe } from 'valtio'
|
||||
import { STORAGE_KEYS } from '@/utils/storageKeys'
|
||||
|
||||
type State = {
|
||||
username: string
|
||||
}
|
||||
|
||||
const DEFAULT_STATE = {
|
||||
username: '',
|
||||
}
|
||||
|
||||
function getUserState(): State {
|
||||
try {
|
||||
const stored = localStorage.getItem(STORAGE_KEYS.USER)
|
||||
if (!stored) return DEFAULT_STATE
|
||||
const parsed = JSON.parse(stored)
|
||||
return {
|
||||
...parsed,
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
console.error(
|
||||
'[UserPreferencesStore] Failed to parse stored settings:',
|
||||
error
|
||||
)
|
||||
return DEFAULT_STATE
|
||||
}
|
||||
}
|
||||
|
||||
export const userStore = proxy<State>(getUserState())
|
||||
|
||||
subscribe(userStore, () => {
|
||||
localStorage.setItem(STORAGE_KEYS.USER, JSON.stringify(userStore))
|
||||
})
|
||||
|
||||
export const saveUsername = (username: string) => {
|
||||
userStore.username = username
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import { VideoQuality } from 'livekit-client'
|
||||
|
||||
export type VideoResolution = 'h720' | 'h360' | 'h180'
|
||||
|
||||
export type LocalUserChoices = Omit<LocalUserChoicesLK, 'username'> & {
|
||||
export type LocalUserChoices = LocalUserChoicesLK & {
|
||||
processorConfig?: ProcessorConfig
|
||||
noiseReductionEnabled?: boolean
|
||||
audioOutputDeviceId?: string
|
||||
@@ -32,13 +32,7 @@ function getUserChoicesState(): LocalUserChoices {
|
||||
|
||||
export const userChoicesStore = proxy<LocalUserChoices>(getUserChoicesState())
|
||||
subscribe(userChoicesStore, () => {
|
||||
// TEMPORARY: cast needed because our store omits `username`, which we no
|
||||
// longer persis in this store, while LiveKit's `saveUserChoices` still expects the full
|
||||
// `LocalUserChoices` shape. `username` ends up `undefined` in the saved
|
||||
// object, which `saveUserChoices` tolerates at runtime.
|
||||
// We are migrating away from LiveKit's persistence logic to our own store
|
||||
// handling for more control — this cast can be removed once that lands.
|
||||
saveUserChoices(userChoicesStore as LocalUserChoicesLK, false)
|
||||
saveUserChoices(userChoicesStore, false)
|
||||
})
|
||||
|
||||
// we run some logic on store loading to check if the processor config is still valid
|
||||
@@ -96,6 +90,10 @@ export const saveVideoSubscribeQuality = (quality: VideoQuality) => {
|
||||
userChoicesStore.videoSubscribeQuality = quality
|
||||
}
|
||||
|
||||
export const saveUsername = (username: string) => {
|
||||
userChoicesStore.username = username
|
||||
}
|
||||
|
||||
export const saveNoiseReductionEnabled = (enabled: boolean) => {
|
||||
userChoicesStore.noiseReductionEnabled = enabled
|
||||
}
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
export const STORAGE_KEYS = {
|
||||
NOTIFICATIONS: 'app_notification_settings',
|
||||
USER_PREFERENCES: 'app_user_preferences',
|
||||
USER: 'app_user',
|
||||
ACCESSIBILITY: 'app_accessibility_settings',
|
||||
} as const
|
||||
|
||||
@@ -191,8 +191,6 @@ backend:
|
||||
SUMMARY_SERVICE_API_TOKEN: password
|
||||
SUMMARY_SERVICE_WEBHOOK_API_TOKEN: webhook-password
|
||||
RECORDING_DOWNLOAD_BASE_URL: https://meet.127.0.0.1.nip.io/recording
|
||||
OIDC_USERINFO_FULLNAME_FIELDS: first_name, last_name
|
||||
OIDC_USERINFO_SHORTNAME_FIELD: first_name
|
||||
|
||||
migrate:
|
||||
command:
|
||||
|
||||
Reference in New Issue
Block a user