Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 017fb45e71 | |||
| c87b982964 | |||
| 5496cc0f0e |
@@ -2,28 +2,19 @@
|
||||
# Review regularly and remove entries once Debian ships a fix.
|
||||
|
||||
# util-linux
|
||||
CVE-2026-76642 exp:2026-12-05
|
||||
CVE-2026-78408 exp:2026-12-05
|
||||
CVE-2026-78409 exp:2026-12-05
|
||||
CVE-2026-78410 exp:2026-12-05
|
||||
CVE-2026-76642
|
||||
CVE-2026-78408
|
||||
CVE-2026-78409
|
||||
CVE-2026-78410
|
||||
|
||||
# acl
|
||||
CVE-2026-54369 exp:2026-12-05
|
||||
CVE-2026-54369
|
||||
|
||||
# ncurses
|
||||
CVE-2025-69720 exp:2026-12-05
|
||||
CVE-2025-69720
|
||||
|
||||
# systemd
|
||||
CVE-2026-16742 exp:2026-12-05
|
||||
CVE-2026-16742
|
||||
|
||||
# perl-base (fix deferred by Debian)
|
||||
CVE-2026-9538 exp:2026-12-05
|
||||
|
||||
# libsqlite3-0 (fixed in sid 3.54.1-1; trixie marked no-dsa / minor)
|
||||
CVE-2026-119373 exp:2026-12-05
|
||||
CVE-2026-119374 exp:2026-12-05
|
||||
CVE-2026-119379 exp:2026-12-05
|
||||
|
||||
# zlib (fixed in sid 1:1.3.dfsg+really1.3.2-4; trixie still vulnerable)
|
||||
CVE-2026-76844 exp:2026-12-05
|
||||
CVE-2026-85091 exp:2026-12-05
|
||||
CVE-2026-9538
|
||||
@@ -10,7 +10,6 @@ and this project adheres to
|
||||
|
||||
### Added
|
||||
|
||||
- 🌐(i18n) add Portuguese language support
|
||||
- ✨(frontend) add jittered exponential backoff to LiveKit reconnections
|
||||
- ✨(frontend) tell participants when a recording is interrupted
|
||||
|
||||
@@ -23,35 +22,11 @@ and this project adheres to
|
||||
- ⬆️(backend) update python dependencies
|
||||
- ⬆️(agents) update python dependencies
|
||||
- ⬆️(summary) update python dependencies
|
||||
- 🔒️(backend) issue room access tokens via POST rooms/{id}/join/ only
|
||||
- 🔒️(frontend) send the display name in the join request body
|
||||
- 🔥(backend) drop is_administrable from unregistered room payloads
|
||||
- 🍱(frontend) add Portuguese glyphs to Marianne subsetted fonts
|
||||
- 🚸(frontend) bring new speakers to the top of the carousel
|
||||
- 🚸(frontend) bring raised hands into view in the carousel
|
||||
- ⚡️(frontend) preload notification sound on the pre-join screen when idle
|
||||
- ⚡️(frontend) cache mediapipe models served by nginx
|
||||
- ⚡️(frontend) preload background effects assets on hover
|
||||
- ⚡️(frontend) lazy load the settings dialog
|
||||
- ⚡️(frontend) serve preset virtual backgrounds as WebP
|
||||
|
||||
### Fixed
|
||||
|
||||
- 📌(summary) pin kombu to keep celery workers compatible with redis 5
|
||||
- 🐛(frontend) show a page when the connection ends unexpectedly
|
||||
- 🐛(frontend) show the transcript mic hint when every mic is muted
|
||||
- 🐛(frontend) show join errors instead of silently waiting in the lobby
|
||||
- 🐛(frontend) send users who cannot enter directly back to the lobby
|
||||
- 🔒️(backend) refuse unregistered rooms whose slug is a UUID
|
||||
- 🔒️(agents) upgrade python to 3.14.10 to fix CVE-2026-109518
|
||||
- 🔒️(docker) upgrade musl-utils to 1.2.6-r3 to fix CVE-2026-107891
|
||||
- ♿️(frontend) close the invite dialog with the Escape key #1916
|
||||
- 🔒️(docker) move frontend to nginx/nginx-unprivileged image
|
||||
- 🐛(frontend) accept meeting links with query params in join dialog
|
||||
- 🐛(backend) allow muting when everyone_can_mute is stored as null #1942
|
||||
- 🐛(frontend) apply the sans font token on every page
|
||||
- 🐛(frontend) promote the active speaker in the carousel layout
|
||||
- ⚡️(frontend) serve sounds as content-hashed, long-term cached assets
|
||||
|
||||
## [1.37.0] - 2026-11-01
|
||||
|
||||
@@ -63,13 +38,6 @@ and this project adheres to
|
||||
- ⬆️(backend) upgrade django-lasuite to v1.0.0
|
||||
- ⚡️(docker) build frontend assets natively for arm64 images
|
||||
|
||||
### Fixed
|
||||
|
||||
- 🔒️(summary) protect signed URLs in models, source logs and analytics metadata
|
||||
- 🔒️(summary) mask secret validation inputs and sanitize upstream and task errors
|
||||
- 🔒️(summary) scrub sensitive Sentry event and breadcrumb content while retaining
|
||||
redacted frame locals and application DEBUG diagnostics
|
||||
|
||||
## [1.36.3] - 2026-10-23
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -9,8 +9,7 @@ RUN python -m pip install --upgrade pip
|
||||
# Upgrade system packages to install security updates
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache --upgrade 'ca-certificates>=20261020-r0' \
|
||||
'musl-utils>=1.2.6-r3' && \
|
||||
apk add --no-cache --upgrade 'ca-certificates>=20261020-r0' && \
|
||||
update-ca-certificates
|
||||
|
||||
# ---- Back-end builder image ----
|
||||
|
||||
@@ -16,35 +16,6 @@ the following command inside your docker container:
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
|
||||
### Room access tokens moved to POST /join/
|
||||
|
||||
LiveKit access tokens are no longer returned when reading a room. They are henceforth issued by a dedicated `POST
|
||||
/api/v1.0/rooms/{id}/join/` endpoint, which receives the display name in its JSON body. Display names therefore no
|
||||
longer appear in URLs and token retrieval by logged-in users is now protected against CSRF.
|
||||
|
||||
- `GET /api/v1.0/rooms/{id}/` no longer returns the `livekit` block, and neither do the list, create and update
|
||||
responses
|
||||
- The `username` field of `POST /api/v1.0/rooms/{id}/request-entry/` is now limited to 255 characters
|
||||
- When the caller may enter the room directly, the response contains the room data plus a `livekit` block
|
||||
- When the caller must go through the lobby, the response has no `livekit` block
|
||||
- Session-authenticated callers must send the CSRF token (`X-CSRFToken` header and `csrftoken` cookie)
|
||||
- Every join returning a `livekit` block mints a new token, valid for 6 hours, and anonymous callers get a new
|
||||
participant identity each time.
|
||||
- Joining again returns no `livekit` block to callers admitted through the lobby.
|
||||
- Unregistered rooms are always entered directly: joining one always returns a `livekit` block.
|
||||
- Unregistered rooms are no longer described with an `is_administrable` field,
|
||||
|
||||
### Unregistered rooms can no longer be named after a UUID
|
||||
|
||||
When `ALLOW_UNREGISTERED_ROOMS` is enabled, reading or joining a room whose identifier normalizes to an empty slug or to
|
||||
a UUID now returns a 404 instead of describing or letting callers join the unregistered room.
|
||||
|
||||
This closes a lobby bypass since a registered LiveKit room is named after its room id. An identifier crafted to not
|
||||
parse as a UUID, yet to normalize to an existing room's id, matched no registered room and was treated as an
|
||||
unregistered one. The token minted for that unregistered room was valid for the registered room: anyone could join a
|
||||
trusted or restricted room without being admitted through the lobby.
|
||||
|
||||
## v1.37.0
|
||||
|
||||
### Crisp support chat replaced by the La Suite support form
|
||||
|
||||
@@ -33,7 +33,7 @@ server {
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|mp3)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
@@ -58,13 +58,19 @@ RUN npx webpack --mode production
|
||||
|
||||
|
||||
# ---- Front-end image ----
|
||||
FROM nginx/nginx-unprivileged:1.30.6-alpine3.24 AS frontend-production
|
||||
FROM nginxinc/nginx-unprivileged:1.30.6-alpine3.24 AS frontend-production
|
||||
|
||||
USER root
|
||||
RUN apk del curl && \
|
||||
RUN apk upgrade --no-cache libexpat && \
|
||||
apk add --no-cache --upgrade 'pcre2>=10.49-r0' 'tiff>=4.7.2-r0' \
|
||||
'libx11>=1.8.14-r0' 'ca-certificates>=20261020-r0' \
|
||||
'brotli-libs>=1.2.1-r0' && \
|
||||
apk del curl && \
|
||||
rm -f /usr/share/nginx/html/50x.html
|
||||
USER nginx
|
||||
|
||||
USER nginx
|
||||
|
||||
# Un-privileged user running the application
|
||||
ARG DOCKER_USER
|
||||
USER ${DOCKER_USER}
|
||||
|
||||
@@ -71,13 +71,8 @@ server {
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
location ^~ /assets/mediapipe/models/ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|mp3)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM python:3.14.10-slim AS base
|
||||
FROM python:3.14.8-slim AS base
|
||||
|
||||
# Install system dependencies required by LiveKit, fetching packages over HTTPS only for Bureautix proxy
|
||||
RUN sed -i "s|^URIs: http://|URIs: https://|" /etc/apt/sources.list.d/debian.sources \
|
||||
|
||||
@@ -137,7 +137,7 @@ class CanMuteParticipant(permissions.BasePermission):
|
||||
- Admins and owners can always mute.
|
||||
- When `everyone_can_mute` is enabled on the room, any participant
|
||||
currently in the room (proven by a valid LiveKit token for that room)
|
||||
can mute. It is enabled unless explicitly set to `False`.
|
||||
can mute.
|
||||
"""
|
||||
|
||||
def has_object_permission(self, request, view, obj):
|
||||
@@ -149,7 +149,8 @@ class CanMuteParticipant(permissions.BasePermission):
|
||||
if not is_livekit_token_auth and obj.is_administrator_or_owner(request.user):
|
||||
return True
|
||||
|
||||
if obj.configuration.get("everyone_can_mute") is False:
|
||||
everyone_can_mute = obj.configuration.get("everyone_can_mute", True)
|
||||
if not everyone_can_mute:
|
||||
return False
|
||||
|
||||
if not is_livekit_token_auth:
|
||||
|
||||
@@ -27,12 +27,9 @@ from timezone_field.rest_framework import TimeZoneSerializerField
|
||||
|
||||
from core import models, utils
|
||||
from core.api.exceptions import ensure_room_not_deleted
|
||||
from core.services.lobby import LobbyService
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DISPLAY_NAME_MAX_LENGTH = 255
|
||||
|
||||
|
||||
class UserSerializer(serializers.ModelSerializer):
|
||||
"""Serialize users."""
|
||||
@@ -173,18 +170,17 @@ class RoomSerializer(serializers.ModelSerializer):
|
||||
return value
|
||||
|
||||
def to_representation(self, instance):
|
||||
"""Add accesses only for administrator and owner users."""
|
||||
"""
|
||||
Add users only for administrator users.
|
||||
Add LiveKit credentials for public instance or related users/groups
|
||||
"""
|
||||
output = super().to_representation(instance)
|
||||
request = self.context.get("request")
|
||||
|
||||
if not request:
|
||||
return output
|
||||
|
||||
if "role" in self.context:
|
||||
role = self.context["role"]
|
||||
else:
|
||||
role = instance.get_role(request.user)
|
||||
|
||||
role = instance.get_role(request.user)
|
||||
is_admin_or_owner = models.RoleChoices.check_administrator_role(
|
||||
role
|
||||
) or models.RoleChoices.check_owner_role(role)
|
||||
@@ -197,9 +193,26 @@ class RoomSerializer(serializers.ModelSerializer):
|
||||
)
|
||||
output["accesses"] = access_serializer.data
|
||||
|
||||
if not LobbyService.can_bypass_lobby(
|
||||
room=instance, user=request.user, role=role
|
||||
):
|
||||
should_access_room = (
|
||||
(
|
||||
instance.access_level == models.RoomAccessLevel.TRUSTED
|
||||
and request.user.is_authenticated
|
||||
)
|
||||
or role is not None
|
||||
or instance.is_public
|
||||
)
|
||||
|
||||
if should_access_room:
|
||||
room_id = f"{instance.id!s}"
|
||||
username = request.query_params.get("username", None)
|
||||
output["livekit"] = utils.generate_livekit_config(
|
||||
room_id=room_id,
|
||||
user=request.user,
|
||||
username=username,
|
||||
configuration=output["configuration"],
|
||||
role=role,
|
||||
)
|
||||
else:
|
||||
del output["pin_code"]
|
||||
|
||||
return output
|
||||
@@ -342,23 +355,10 @@ class StartRecordingSerializer(BaseValidationOnlySerializer):
|
||||
return value
|
||||
|
||||
|
||||
class JoinRoomSerializer(BaseValidationOnlySerializer):
|
||||
"""Validate the data sent to join a room."""
|
||||
|
||||
username = serializers.CharField(
|
||||
required=False,
|
||||
allow_blank=True,
|
||||
allow_null=True,
|
||||
max_length=DISPLAY_NAME_MAX_LENGTH,
|
||||
help_text="Display name in the room. The default name is used when it "
|
||||
"is missing, null or blank.",
|
||||
)
|
||||
|
||||
|
||||
class RequestEntrySerializer(BaseValidationOnlySerializer):
|
||||
"""Validate request entry data."""
|
||||
|
||||
username = serializers.CharField(required=True, max_length=DISPLAY_NAME_MAX_LENGTH)
|
||||
username = serializers.CharField(required=True)
|
||||
participant_id = serializers.CharField(
|
||||
required=False, allow_null=True, max_length=128
|
||||
)
|
||||
@@ -675,9 +675,7 @@ class RaiseHandSerializer(BaseValidationOnlySerializer):
|
||||
class RenameParticipantSerializer(BaseValidationOnlySerializer):
|
||||
"""Serializer for renaming a participant in a room."""
|
||||
|
||||
name = serializers.CharField(
|
||||
min_length=1, max_length=DISPLAY_NAME_MAX_LENGTH, allow_blank=False
|
||||
)
|
||||
name = serializers.CharField(min_length=1, max_length=255, allow_blank=False)
|
||||
|
||||
|
||||
class ExternalProcessEventSerializer(BaseValidationOnlySerializer):
|
||||
|
||||
@@ -309,35 +309,35 @@ class RoomViewSet( # pylint: disable=too-many-public-methods
|
||||
ensure_room_not_deleted(obj)
|
||||
return obj
|
||||
|
||||
def _get_object_or_unregistered_slug(self):
|
||||
"""Return the requested room, or the slug of an unregistered room."""
|
||||
try:
|
||||
return self.get_object(), None
|
||||
except Http404:
|
||||
slug = slugify(self.kwargs["pk"])
|
||||
if not settings.ALLOW_UNREGISTERED_ROOMS or not slug or utils.is_uuid(slug):
|
||||
raise
|
||||
return None, slug
|
||||
|
||||
@staticmethod
|
||||
def _get_unregistered_room_data(slug):
|
||||
"""Describe an unregistered room, which only exists by its slug."""
|
||||
return {
|
||||
"id": None,
|
||||
"slug": slug,
|
||||
"access_level": RoomAccessLevel.PUBLIC,
|
||||
}
|
||||
|
||||
def retrieve(self, request, *args, **kwargs):
|
||||
"""
|
||||
Allow unregistered rooms when activated.
|
||||
LiveKit credentials are never returned: they are obtained by joining.
|
||||
For unregistered rooms we only return a null id and the livekit room and token.
|
||||
"""
|
||||
room, slug = self._get_object_or_unregistered_slug()
|
||||
if room is None:
|
||||
return drf_response.Response(self._get_unregistered_room_data(slug))
|
||||
try:
|
||||
instance = self.get_object()
|
||||
except Http404:
|
||||
if not settings.ALLOW_UNREGISTERED_ROOMS:
|
||||
raise
|
||||
slug = slugify(self.kwargs["pk"])
|
||||
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,
|
||||
"token": utils.generate_token(
|
||||
room=slug, user=request.user, username=username
|
||||
),
|
||||
},
|
||||
}
|
||||
else:
|
||||
data = self.get_serializer(instance).data
|
||||
|
||||
return drf_response.Response(self.get_serializer(room).data)
|
||||
return drf_response.Response(data)
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""Limit listed rooms to the ones related to the authenticated user."""
|
||||
@@ -572,55 +572,6 @@ class RoomViewSet( # pylint: disable=too-many-public-methods
|
||||
{"message": f"Recording stopped for room {room.slug}."}
|
||||
)
|
||||
|
||||
@decorators.action(
|
||||
detail=True,
|
||||
methods=["post"],
|
||||
url_path="join",
|
||||
permission_classes=[],
|
||||
)
|
||||
def join(self, request, pk=None): # pylint: disable=unused-argument
|
||||
"""
|
||||
Join a room, getting LiveKit credentials when allowed to enter directly.
|
||||
|
||||
The response contains the room with a livekit object holding the url,
|
||||
room and token to connect with when the requester may enter without
|
||||
going through the lobby. Otherwise, it has no livekit object and the
|
||||
client should request entry through the lobby.
|
||||
|
||||
Unregistered rooms, when allowed, are always joined directly.
|
||||
"""
|
||||
|
||||
serializer = serializers.JoinRoomSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
username = serializer.validated_data.get("username") or None
|
||||
|
||||
room, slug = self._get_object_or_unregistered_slug()
|
||||
if room is None:
|
||||
return drf_response.Response(
|
||||
{
|
||||
**self._get_unregistered_room_data(slug),
|
||||
"livekit": utils.generate_livekit_config(
|
||||
room_id=slug, user=request.user, username=username
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
role = room.get_role(request.user)
|
||||
data = self.get_serializer(
|
||||
room, context={**self.get_serializer_context(), "role": role}
|
||||
).data
|
||||
|
||||
if LobbyService.can_bypass_lobby(room=room, user=request.user, role=role):
|
||||
data["livekit"] = utils.generate_livekit_config(
|
||||
room_id=str(room.id),
|
||||
user=request.user,
|
||||
username=username,
|
||||
configuration=data["configuration"],
|
||||
role=role,
|
||||
)
|
||||
|
||||
return drf_response.Response(data)
|
||||
|
||||
@decorators.action(
|
||||
detail=True,
|
||||
methods=["post"],
|
||||
|
||||
@@ -66,8 +66,6 @@ def test_api_rooms_create_authenticated(reset_cache):
|
||||
assert room.name == "my room"
|
||||
assert room.slug == "my-room"
|
||||
assert room.accesses.filter(role="owner", user=user).exists() is True
|
||||
assert "livekit" not in response.json()
|
||||
assert response.json()["pin_code"] == room.pin_code
|
||||
|
||||
rooms_data = cache.keys("room-creation-callback_*")
|
||||
assert not rooms_data
|
||||
@@ -497,4 +495,3 @@ def test_api_rooms_create_authenticated_with_user_access_token():
|
||||
assert response.status_code == 201
|
||||
room = Room.objects.get()
|
||||
assert room.accesses.filter(role="owner", user=user).exists()
|
||||
assert "livekit" not in response.json()
|
||||
|
||||
@@ -1,580 +0,0 @@
|
||||
"""
|
||||
Test rooms API endpoints in the Meet core app: join.
|
||||
"""
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.utils.crypto import get_random_string
|
||||
|
||||
import jwt
|
||||
import pytest
|
||||
from faker import Faker
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from ...factories import (
|
||||
RoomFactory,
|
||||
UserFactory,
|
||||
UserResourceAccessFactory,
|
||||
)
|
||||
from ...models import RoleChoices, RoomAccessLevel
|
||||
from ..utils import generate_user_access_token
|
||||
|
||||
fake = Faker()
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
livekit_token = fake.sha256()
|
||||
|
||||
ANONYMOUS = "anonymous"
|
||||
NO_ROLE = "no-role"
|
||||
|
||||
# Who may join a room directly, without going through the lobby
|
||||
# room.get_role(user) returns None both for an anonymous user and for an
|
||||
# authenticated user without access, hence the NO_ROLE
|
||||
ACCESS_MATRIX = [
|
||||
(RoomAccessLevel.PUBLIC, ANONYMOUS, True),
|
||||
(RoomAccessLevel.TRUSTED, ANONYMOUS, False),
|
||||
(RoomAccessLevel.RESTRICTED, ANONYMOUS, False),
|
||||
(RoomAccessLevel.PUBLIC, NO_ROLE, True),
|
||||
(RoomAccessLevel.TRUSTED, NO_ROLE, True),
|
||||
(RoomAccessLevel.RESTRICTED, NO_ROLE, False),
|
||||
*[
|
||||
(access_level, role, True)
|
||||
for access_level in RoomAccessLevel
|
||||
for role in RoleChoices
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
def decode_token(token):
|
||||
"""Decode a LiveKit access token for inspection."""
|
||||
return jwt.decode(
|
||||
token,
|
||||
settings.LIVEKIT_CONFIGURATION["api_secret"],
|
||||
algorithms=["HS256"],
|
||||
)
|
||||
|
||||
|
||||
def join_url(room_id):
|
||||
"""Return the url to join a room."""
|
||||
return f"/api/v1.0/rooms/{room_id!s}/join/"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("access_level", "requester", "can_join_directly"), ACCESS_MATRIX
|
||||
)
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_access(mock_token, access_level, requester, can_join_directly):
|
||||
"""
|
||||
Joining a room should return LiveKit credentials and the pin code only to
|
||||
users who may enter without going through the lobby, and the accesses
|
||||
only to the room's administrators and owners.
|
||||
"""
|
||||
room = RoomFactory(
|
||||
access_level=access_level,
|
||||
configuration={"can_publish_sources": ["camera"]},
|
||||
)
|
||||
client = APIClient()
|
||||
user = AnonymousUser()
|
||||
username = fake.user_name()
|
||||
|
||||
role = None
|
||||
if requester != ANONYMOUS:
|
||||
user = UserFactory()
|
||||
client.force_login(user)
|
||||
if requester != NO_ROLE:
|
||||
role = requester
|
||||
UserResourceAccessFactory(resource=room, user=user, role=role)
|
||||
|
||||
response = client.post(join_url(room.id), {"username": username}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
content = response.json()
|
||||
|
||||
accesses = content.pop("accesses", None)
|
||||
|
||||
if role in (RoleChoices.ADMIN, RoleChoices.OWNER):
|
||||
assert {access["id"] for access in accesses} == {
|
||||
str(access.id) for access in room.accesses.all()
|
||||
}
|
||||
else:
|
||||
assert accesses is None
|
||||
|
||||
expected = {
|
||||
"id": str(room.id),
|
||||
"name": room.name,
|
||||
"slug": room.slug,
|
||||
"configuration": {"can_publish_sources": ["camera"]},
|
||||
"access_level": str(access_level),
|
||||
}
|
||||
if can_join_directly:
|
||||
expected["pin_code"] = room.pin_code
|
||||
expected["livekit"] = {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
"room": str(room.id),
|
||||
"token": livekit_token,
|
||||
}
|
||||
assert content == expected
|
||||
|
||||
if can_join_directly:
|
||||
mock_token.assert_called_once_with(
|
||||
room=str(room.id),
|
||||
user=user,
|
||||
username=username,
|
||||
color=None,
|
||||
sources=["camera"],
|
||||
role=role,
|
||||
participant_id=None,
|
||||
)
|
||||
else:
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_by_slug(mock_token):
|
||||
"""It should be possible to join a room by its slug, not normalized."""
|
||||
room = RoomFactory(name="Réunion", access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().post(join_url("Réunion"), {}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["id"] == str(room.id)
|
||||
assert response.json()["livekit"]["room"] == str(room.id)
|
||||
mock_token.assert_called_once()
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_members_num_queries(mock_token, django_assert_num_queries):
|
||||
"""The role of the requester should only be looked up once."""
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED)
|
||||
UserResourceAccessFactory(resource=room, user=user, role=RoleChoices.MEMBER)
|
||||
client = APIClient()
|
||||
client.force_login(user)
|
||||
|
||||
with django_assert_num_queries(3):
|
||||
response = client.post(join_url(room.id), {}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" in response.json()
|
||||
assert mock_token.call_args.kwargs["role"] == RoleChoices.MEMBER
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role", [RoleChoices.ADMIN, RoleChoices.OWNER])
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_administrators_num_queries(
|
||||
mock_token, role, django_assert_num_queries
|
||||
):
|
||||
"""Only the accesses should be queried on top of the role for administrators."""
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED)
|
||||
UserResourceAccessFactory(resource=room, user=user, role=role)
|
||||
client = APIClient()
|
||||
client.force_login(user)
|
||||
|
||||
with django_assert_num_queries(4):
|
||||
response = client.post(join_url(room.id), {}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" in response.json()
|
||||
assert "accesses" in response.json()
|
||||
assert mock_token.call_args.kwargs["role"] == role
|
||||
|
||||
|
||||
def test_api_rooms_join_get_not_allowed():
|
||||
"""Joining a room should only be possible with a POST request."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().get(join_url(room.id))
|
||||
|
||||
assert response.status_code == 405
|
||||
|
||||
|
||||
@pytest.mark.parametrize("authenticated", [False, True])
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_unregistered_allowed(mock_token, authenticated, settings):
|
||||
"""
|
||||
Joining an unregistered room should return LiveKit credentials for the
|
||||
room named after the slug, when unregistered rooms are allowed.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = True
|
||||
client = APIClient()
|
||||
user = AnonymousUser()
|
||||
username = fake.user_name()
|
||||
if authenticated:
|
||||
user = UserFactory()
|
||||
client.force_login(user)
|
||||
|
||||
response = client.post(
|
||||
join_url("unregistered-room"), {"username": username}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"id": None,
|
||||
"slug": "unregistered-room",
|
||||
"access_level": "public",
|
||||
"livekit": {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
"room": "unregistered-room",
|
||||
"token": livekit_token,
|
||||
},
|
||||
}
|
||||
mock_token.assert_called_once_with(
|
||||
room="unregistered-room",
|
||||
user=user,
|
||||
username=username,
|
||||
color=None,
|
||||
sources=None,
|
||||
role=None,
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_unregistered_allowed_not_normalized(mock_token, settings):
|
||||
"""
|
||||
Joining an unregistered room by a slug that is not normalized should use
|
||||
the LiveKit room named after the url-safe slug.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = True
|
||||
|
||||
response = APIClient().post(join_url("Réunion"), {}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"id": None,
|
||||
"slug": "reunion",
|
||||
"access_level": "public",
|
||||
"livekit": {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
"room": "reunion",
|
||||
"token": livekit_token,
|
||||
},
|
||||
}
|
||||
mock_token.assert_called_once_with(
|
||||
room="reunion",
|
||||
user=AnonymousUser(),
|
||||
username=None,
|
||||
color=None,
|
||||
sources=None,
|
||||
role=None,
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
def test_api_rooms_join_unregistered_token_claims(settings):
|
||||
"""The token of an unregistered room should be scoped to it and carry the name."""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = True
|
||||
username = fake.user_name()
|
||||
|
||||
response = APIClient().post(
|
||||
join_url("unregistered-room"), {"username": username}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == username
|
||||
assert claims["video"]["room"] == "unregistered-room"
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_unregistered_not_allowed(mock_token, settings):
|
||||
"""
|
||||
Joining an unregistered room should return a 404 if unregistered rooms
|
||||
are not allowed.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = False
|
||||
|
||||
response = APIClient().post(join_url("unregistered-room"), {}, format="json")
|
||||
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("lookup", ["---", "!!!", "_"])
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_unregistered_empty_slug(mock_token, lookup, settings):
|
||||
"""
|
||||
Joining an unregistered room whose slug is empty once normalized should
|
||||
return a 404 rather than credentials for a room with no name.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = True
|
||||
|
||||
response = APIClient().post(join_url(lookup), {}, format="json")
|
||||
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("template", ["{}!", "_{}", "{}~", "{}!!"])
|
||||
@pytest.mark.parametrize(
|
||||
"access_level", [RoomAccessLevel.TRUSTED, RoomAccessLevel.RESTRICTED]
|
||||
)
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_unregistered_uuid_slug(
|
||||
mock_token, access_level, template, settings
|
||||
):
|
||||
"""
|
||||
Joining an unregistered room whose slug is a UUID once normalized should
|
||||
return a 404 rather than credentials for the registered room with that id.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = True
|
||||
room = RoomFactory(access_level=access_level)
|
||||
|
||||
response = APIClient().post(
|
||||
join_url(template.format(str(room.id).upper())), {}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("allow_unregistered_rooms", [True, False])
|
||||
@pytest.mark.parametrize("lookup", ["id", "slug"])
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_soft_deleted(
|
||||
mock_token, lookup, allow_unregistered_rooms, settings
|
||||
):
|
||||
"""
|
||||
Joining a soft-deleted room should return a 410, and never fall back
|
||||
to an unregistered room with the same slug.
|
||||
"""
|
||||
settings.ALLOW_UNREGISTERED_ROOMS = allow_unregistered_rooms
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
room.soft_delete()
|
||||
|
||||
response = APIClient().post(join_url(getattr(room, lookup)), {}, format="json")
|
||||
|
||||
assert response.status_code == 410
|
||||
assert response.json() == {"detail": "This room has been deleted."}
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("payload", "expected_username"),
|
||||
[
|
||||
({"username": "Jean Bon"}, "Jean Bon"),
|
||||
({"username": " Jean Bon "}, "Jean Bon"),
|
||||
({"username": "x" * 255}, "x" * 255),
|
||||
({}, None),
|
||||
({"username": None}, None),
|
||||
({"username": ""}, None),
|
||||
({"username": " "}, None),
|
||||
],
|
||||
)
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_username(mock_token, payload, expected_username):
|
||||
"""
|
||||
The trimmed display name should be passed on to the token, a missing or
|
||||
blank one leaving the default name to the token generation.
|
||||
"""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().post(join_url(room.id), payload, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["livekit"]["token"] == livekit_token
|
||||
assert mock_token.call_args.kwargs["username"] == expected_username
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_username_too_long(mock_token):
|
||||
"""A display name exceeding 255 characters should be rejected."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().post(
|
||||
join_url(room.id), {"username": "a" * 256}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.json() == {
|
||||
"username": ["Ensure this field has no more than 255 characters."]
|
||||
}
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value=livekit_token)
|
||||
def test_api_rooms_join_username_in_query_string_ignored(mock_token):
|
||||
"""The display name should only be read from the request body."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
username = fake.user_name()
|
||||
|
||||
response = APIClient().post(
|
||||
f"{join_url(room.id)}?username={username}", {}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert mock_token.call_args.kwargs["username"] is None
|
||||
|
||||
|
||||
def test_api_rooms_join_token_claims_anonymous():
|
||||
"""The token should carry the submitted display name and be scoped to the room."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
username = fake.user_name()
|
||||
|
||||
response = APIClient().post(
|
||||
join_url(room.id), {"username": username}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == username
|
||||
assert claims["video"]["room"] == str(room.id)
|
||||
assert claims["video"]["roomAdmin"] is False
|
||||
|
||||
|
||||
def test_api_rooms_join_token_claims_anonymous_default_name():
|
||||
"""An anonymous user joining without a display name should get the default one."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().post(join_url(room.id), {"username": ""}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == "Anonymous"
|
||||
|
||||
|
||||
def test_api_rooms_join_token_claims_owner():
|
||||
"""The token of an owner should carry the submitted name and the room admin grant."""
|
||||
username = fake.user_name()
|
||||
user = UserFactory(full_name=fake.name())
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED, users=[(user, "owner")])
|
||||
client = APIClient()
|
||||
client.force_login(user)
|
||||
|
||||
response = client.post(join_url(room.id), {"username": username}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == username
|
||||
assert claims["sub"] == str(user.sub)
|
||||
assert claims["video"]["roomAdmin"] is True
|
||||
|
||||
|
||||
def test_api_rooms_join_display_name_edit_disabled(settings):
|
||||
"""
|
||||
An authenticated user should keep their account's name when display name
|
||||
edition is disabled, whatever name they submit.
|
||||
"""
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = False
|
||||
full_name = f"{fake.first_name()} {fake.last_name()}"
|
||||
user = UserFactory(full_name=full_name)
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient()
|
||||
client.force_login(user)
|
||||
|
||||
response = client.post(join_url(room.id), {"username": "Impostor"}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == full_name
|
||||
|
||||
|
||||
def test_api_rooms_join_display_name_edit_disabled_anonymous(settings):
|
||||
"""Anonymous users should still choose their display name when edition is disabled."""
|
||||
settings.AUTHENTICATED_PARTICIPANTS_CAN_EDIT_DISPLAY_NAME = False
|
||||
username = fake.user_name()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
|
||||
response = APIClient().post(
|
||||
join_url(room.id), {"username": username}, format="json"
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["name"] == username
|
||||
|
||||
|
||||
def test_api_rooms_join_session_without_csrf_token():
|
||||
"""A session-authenticated request without a CSRF token should be rejected."""
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient(enforce_csrf_checks=True)
|
||||
client.force_login(user)
|
||||
|
||||
response = client.post(join_url(room.id), {"username": "Jane"}, format="json")
|
||||
|
||||
assert response.status_code == 403
|
||||
assert response.json()["detail"].startswith("CSRF Failed")
|
||||
|
||||
|
||||
def test_api_rooms_join_session_with_csrf_token():
|
||||
"""A session-authenticated request with a valid CSRF token should be accepted."""
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient(enforce_csrf_checks=True)
|
||||
client.force_login(user)
|
||||
csrf_secret = get_random_string(32)
|
||||
client.cookies[settings.CSRF_COOKIE_NAME] = csrf_secret
|
||||
|
||||
response = client.post(
|
||||
join_url(room.id),
|
||||
{"username": "Jane"},
|
||||
format="json",
|
||||
HTTP_X_CSRFTOKEN=csrf_secret,
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" in response.json()
|
||||
|
||||
|
||||
def test_api_rooms_join_session_with_csrf_token_foreign_origin():
|
||||
"""A session-authenticated request from a foreign origin should be rejected."""
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient(enforce_csrf_checks=True)
|
||||
client.force_login(user)
|
||||
csrf_secret = get_random_string(32)
|
||||
client.cookies[settings.CSRF_COOKIE_NAME] = csrf_secret
|
||||
|
||||
response = client.post(
|
||||
join_url(room.id),
|
||||
{"username": "Jane"},
|
||||
format="json",
|
||||
HTTP_X_CSRFTOKEN=csrf_secret,
|
||||
HTTP_ORIGIN="https://evil.example",
|
||||
)
|
||||
|
||||
assert response.status_code == 403
|
||||
assert response.json()["detail"].startswith("CSRF Failed: Origin checking failed")
|
||||
|
||||
|
||||
def test_api_rooms_join_anonymous_without_csrf_token():
|
||||
"""
|
||||
An anonymous request carries no ambient credential, so it should not be
|
||||
subject to CSRF checks.
|
||||
"""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient(enforce_csrf_checks=True)
|
||||
|
||||
response = client.post(join_url(room.id), {"username": "Anonymous"}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" in response.json()
|
||||
|
||||
|
||||
def test_api_rooms_join_user_access_token_without_csrf_token():
|
||||
"""
|
||||
A request authenticated with a user access token carries no ambient
|
||||
credential, so it should not be subject to CSRF checks.
|
||||
"""
|
||||
username = fake.user_name()
|
||||
user = UserFactory()
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED, users=[(user, "owner")])
|
||||
client = APIClient(enforce_csrf_checks=True)
|
||||
client.credentials(HTTP_AUTHORIZATION=f"Bearer {generate_user_access_token(user)}")
|
||||
|
||||
response = client.post(join_url(room.id), {"username": username}, format="json")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["pin_code"] == room.pin_code
|
||||
assert "accesses" in response.json()
|
||||
claims = decode_token(response.json()["livekit"]["token"])
|
||||
assert claims["sub"] == str(user.sub)
|
||||
@@ -61,7 +61,6 @@ def test_api_rooms_list_authenticated():
|
||||
}
|
||||
results_id = {result["id"] for result in results}
|
||||
assert expected_ids == results_id
|
||||
assert all("livekit" not in result for result in results)
|
||||
|
||||
|
||||
@mock.patch.object(PageNumberPagination, "get_page_size", return_value=2)
|
||||
@@ -173,4 +172,3 @@ def test_api_rooms_list_authenticated_with_user_access_token():
|
||||
assert response.status_code == 200
|
||||
assert response.data["count"] == 1
|
||||
assert response.data["results"][0]["id"] == str(room.id)
|
||||
assert "livekit" not in response.data["results"][0]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Test rooms API endpoints in the Meet core app: lobby functionality.
|
||||
"""
|
||||
|
||||
# pylint: disable=W0621,W0613,W0212,too-many-lines
|
||||
# pylint: disable=W0621,W0613,W0212
|
||||
import uuid
|
||||
from unittest import mock
|
||||
|
||||
@@ -360,40 +360,6 @@ def test_request_entry_invalid_data():
|
||||
assert response.status_code == 400
|
||||
|
||||
|
||||
def test_request_entry_username_too_long():
|
||||
"""Should return 400 for a username exceeding 255 characters."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED)
|
||||
client = APIClient()
|
||||
|
||||
with mock.patch.object(utils, "notify_participants") as mock_notify:
|
||||
response = client.post(
|
||||
f"/api/v1.0/rooms/{room.id}/request-entry/",
|
||||
{"username": "a" * 256},
|
||||
)
|
||||
|
||||
assert response.status_code == 400
|
||||
assert response.json() == {
|
||||
"username": ["Ensure this field has no more than 255 characters."]
|
||||
}
|
||||
mock_notify.assert_not_called()
|
||||
assert not LobbyService()._index_members(room.id)
|
||||
|
||||
|
||||
def test_request_entry_username_at_max_length():
|
||||
"""Should accept a username of exactly 255 characters."""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED)
|
||||
client = APIClient()
|
||||
|
||||
with mock.patch.object(utils, "notify_participants", return_value=None):
|
||||
response = client.post(
|
||||
f"/api/v1.0/rooms/{room.id}/request-entry/",
|
||||
{"username": "a" * 255},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["username"] == "a" * 255
|
||||
|
||||
|
||||
def test_request_entry_room_not_found():
|
||||
"""Should return 404 for non-existent room."""
|
||||
client = APIClient()
|
||||
|
||||
@@ -166,30 +166,6 @@ def test_mute_participant_everyone_can_mute_disabled_blocks_non_admin(
|
||||
mock_livekit_client.room.mute_published_track.assert_not_called()
|
||||
|
||||
|
||||
def test_mute_participant_everyone_can_mute_null_allows_non_admin(
|
||||
mock_livekit_client,
|
||||
):
|
||||
"""Should treat a stored null everyone_can_mute as unset, hence enabled."""
|
||||
client = APIClient()
|
||||
room = RoomFactory(configuration={"everyone_can_mute": None})
|
||||
|
||||
user = AnonymousUser()
|
||||
token = utils.generate_token(str(room.id), user)
|
||||
|
||||
url = reverse("rooms-mute-participant", kwargs={"pk": room.id})
|
||||
response = client.post(
|
||||
url,
|
||||
{"participant_identity": str(uuid4()), "track_sid": "test-track-sid"},
|
||||
format="json",
|
||||
HTTP_AUTHORIZATION=f"X-LiveKit-Token {token}",
|
||||
)
|
||||
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert response.data == {"status": "success"}
|
||||
|
||||
mock_livekit_client.room.mute_published_track.assert_called_once()
|
||||
|
||||
|
||||
def test_mute_participant_everyone_can_mute_disabled_allows_admin(mock_livekit_client):
|
||||
"""Should allow admins and owners to mute when everyone_can_mute is False."""
|
||||
client = APIClient()
|
||||
|
||||
@@ -366,22 +366,6 @@ def test_rename_participant_name_too_long(room, token):
|
||||
assert "name" in response.data
|
||||
|
||||
|
||||
def test_rename_participant_name_at_max_length(mock_livekit_client, room, token):
|
||||
"""Test rename accepts a name of exactly 255 characters."""
|
||||
client = APIClient()
|
||||
url = reverse("rooms-rename", kwargs={"pk": room.id})
|
||||
response = client.post(
|
||||
url,
|
||||
{"name": "a" * 255},
|
||||
format="json",
|
||||
HTTP_AUTHORIZATION=f"X-LiveKit-Token {token}",
|
||||
)
|
||||
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
call_kwargs = mock_livekit_client.room.update_participant.call_args
|
||||
assert call_kwargs[0][0].name == "a" * 255
|
||||
|
||||
|
||||
def test_rename_participant_forbidden_without_token(room):
|
||||
"""Test rename returns 403 when no LiveKit token is provided."""
|
||||
client = APIClient()
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
"""Test rooms API endpoints in the Meet core app: retrieve."""
|
||||
"""
|
||||
Test rooms API endpoints in the Meet core app: retrieve.
|
||||
"""
|
||||
|
||||
import random
|
||||
from unittest import mock
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.test.utils import override_settings
|
||||
from django.utils import timezone as dj_timezone
|
||||
|
||||
@@ -109,11 +112,18 @@ def test_api_rooms_retrieve_anonymous_private_slug_not_normalized():
|
||||
|
||||
|
||||
@override_settings(ALLOW_UNREGISTERED_ROOMS=True)
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
def test_api_rooms_retrieve_anonymous_unregistered_allowed(mock_token):
|
||||
"""
|
||||
Retrieving an unregistered room should describe it if unregistered rooms
|
||||
are allowed, without any LiveKit token: those are obtained by joining.
|
||||
Retrieving an unregistered room should return a Livekit token
|
||||
if unregistered rooms are allowed.
|
||||
"""
|
||||
client = APIClient()
|
||||
response = client.get("/api/v1.0/rooms/unregistered-room/")
|
||||
@@ -123,17 +133,32 @@ def test_api_rooms_retrieve_anonymous_unregistered_allowed(mock_token):
|
||||
"id": None,
|
||||
"slug": "unregistered-room",
|
||||
"access_level": "public",
|
||||
"is_administrable": False,
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": "unregistered-room",
|
||||
"token": "foo",
|
||||
},
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room="unregistered-room", user=AnonymousUser(), username=None
|
||||
)
|
||||
|
||||
|
||||
@override_settings(ALLOW_UNREGISTERED_ROOMS=True)
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
def test_api_rooms_retrieve_anonymous_unregistered_allowed_not_normalized(mock_token):
|
||||
"""
|
||||
Getting an unregistered room by a slug that is not normalized should work
|
||||
and return the url-safe slug.
|
||||
and use the Livekit room on the url-safe name.
|
||||
"""
|
||||
client = APIClient()
|
||||
response = client.get("/api/v1.0/rooms/Réunion/")
|
||||
@@ -143,9 +168,17 @@ def test_api_rooms_retrieve_anonymous_unregistered_allowed_not_normalized(mock_t
|
||||
"id": None,
|
||||
"slug": "reunion",
|
||||
"access_level": "public",
|
||||
"is_administrable": False,
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": "reunion",
|
||||
"token": "foo",
|
||||
},
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room="reunion", user=AnonymousUser(), username=None
|
||||
)
|
||||
|
||||
|
||||
@override_settings(ALLOW_UNREGISTERED_ROOMS=False)
|
||||
@@ -160,36 +193,6 @@ def test_api_rooms_retrieve_anonymous_unregistered_not_allowed():
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
|
||||
|
||||
@override_settings(ALLOW_UNREGISTERED_ROOMS=True)
|
||||
@pytest.mark.parametrize("lookup", ["---", "!!!", "_"])
|
||||
def test_api_rooms_retrieve_anonymous_unregistered_empty_slug(lookup):
|
||||
"""
|
||||
Retrieving an unregistered room whose slug is empty once normalized should
|
||||
return a 404.
|
||||
"""
|
||||
client = APIClient()
|
||||
response = client.get(f"/api/v1.0/rooms/{lookup}/")
|
||||
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
|
||||
|
||||
@override_settings(ALLOW_UNREGISTERED_ROOMS=True)
|
||||
@pytest.mark.parametrize("template", ["{}!", "_{}", "{}~"])
|
||||
def test_api_rooms_retrieve_anonymous_unregistered_uuid_slug(template):
|
||||
"""
|
||||
Retrieving an unregistered room whose slug is a UUID once normalized should
|
||||
return a 404.
|
||||
"""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.RESTRICTED)
|
||||
|
||||
client = APIClient()
|
||||
response = client.get(f"/api/v1.0/rooms/{template.format(room.id)}/")
|
||||
|
||||
assert response.status_code == 404
|
||||
assert response.json() == {"detail": "No Room matches the given query."}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("allow_unregistered_rooms", [True, False])
|
||||
@pytest.mark.parametrize("lookup", ["id", "slug"])
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@@ -213,33 +216,52 @@ def test_api_rooms_retrieve_soft_deleted(
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
def test_api_rooms_retrieve_anonymous_public(mock_token):
|
||||
"""
|
||||
Anonymous users should be able to retrieve a public room with its pin code,
|
||||
but should not be given any token: those are obtained by joining.
|
||||
Anonymous users should be able to retrieve a room with a token provided, if the room is public.
|
||||
"""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.PUBLIC)
|
||||
client = APIClient()
|
||||
response = client.get(f"/api/v1.0/rooms/{room.id!s}/")
|
||||
|
||||
assert response.status_code == 200
|
||||
expected_name = f"{room.id!s}"
|
||||
assert response.json() == {
|
||||
"configuration": {},
|
||||
"access_level": str(room.access_level),
|
||||
"id": str(room.id),
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": expected_name,
|
||||
"token": "foo",
|
||||
},
|
||||
"name": room.name,
|
||||
"pin_code": room.pin_code,
|
||||
"slug": room.slug,
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once()
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
def test_api_rooms_retrieve_authenticated_public(mock_token):
|
||||
"""
|
||||
Authenticated users should be allowed to retrieve a public room to which
|
||||
they are not related, with its pin code but without any token.
|
||||
Authenticated users should be allowed to retrieve a room and get a token for a room to
|
||||
which they are not related, provided the room is public.
|
||||
They should not see related users.
|
||||
"""
|
||||
room = RoomFactory(
|
||||
@@ -256,23 +278,44 @@ def test_api_rooms_retrieve_authenticated_public(mock_token):
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
expected_name = f"{room.id!s}"
|
||||
assert response.json() == {
|
||||
"configuration": {"can_publish_sources": ["camera"]},
|
||||
"access_level": str(room.access_level),
|
||||
"id": str(room.id),
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": expected_name,
|
||||
"token": "foo",
|
||||
},
|
||||
"name": room.name,
|
||||
"pin_code": room.pin_code,
|
||||
"slug": room.slug,
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room=expected_name,
|
||||
user=user,
|
||||
username=None,
|
||||
color=None,
|
||||
sources=["camera"],
|
||||
role=None,
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
def test_api_rooms_retrieve_authenticated_trusted(mock_token):
|
||||
"""
|
||||
Authenticated users should be allowed to retrieve a trusted room to which
|
||||
they are not related, with its pin code but without any token.
|
||||
Authenticated users should be allowed to retrieve a room and get a token for a room to
|
||||
which they are not related, provided the room has a trusted access_level.
|
||||
They should not see related users.
|
||||
"""
|
||||
room = RoomFactory(access_level=RoomAccessLevel.TRUSTED)
|
||||
@@ -286,16 +329,30 @@ def test_api_rooms_retrieve_authenticated_trusted(mock_token):
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
expected_name = f"{room.id!s}"
|
||||
assert response.json() == {
|
||||
"configuration": {},
|
||||
"access_level": str(room.access_level),
|
||||
"id": str(room.id),
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": expected_name,
|
||||
"token": "foo",
|
||||
},
|
||||
"name": room.name,
|
||||
"pin_code": room.pin_code,
|
||||
"slug": room.slug,
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room=expected_name,
|
||||
user=user,
|
||||
username=None,
|
||||
color=None,
|
||||
sources=None,
|
||||
role=None,
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
def test_api_rooms_retrieve_authenticated():
|
||||
@@ -324,6 +381,13 @@ def test_api_rooms_retrieve_authenticated():
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
def test_api_rooms_retrieve_members(mock_token, django_assert_num_queries, settings):
|
||||
"""
|
||||
Users who are members of a room should not be allowed to see related users.
|
||||
@@ -351,19 +415,40 @@ def test_api_rooms_retrieve_members(mock_token, django_assert_num_queries, setti
|
||||
|
||||
assert "accesses" not in content_dict
|
||||
|
||||
expected_name = str(room.id)
|
||||
assert content_dict == {
|
||||
"configuration": {"can_publish_sources": ["camera"]},
|
||||
"access_level": str(room.access_level),
|
||||
"id": str(room.id),
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": expected_name,
|
||||
"token": "foo",
|
||||
},
|
||||
"name": room.name,
|
||||
"pin_code": room.pin_code,
|
||||
"slug": room.slug,
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room=expected_name,
|
||||
user=user,
|
||||
username=None,
|
||||
color=None,
|
||||
sources=["camera"],
|
||||
role=str(RoleChoices.MEMBER),
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
@override_settings(
|
||||
LIVEKIT_CONFIGURATION={
|
||||
"api_key": "key",
|
||||
"api_secret": "secret",
|
||||
"url": "test_url_value",
|
||||
}
|
||||
)
|
||||
def test_api_rooms_retrieve_administrators(
|
||||
mock_token, django_assert_num_queries, settings
|
||||
):
|
||||
@@ -426,16 +511,30 @@ def test_api_rooms_retrieve_administrators(
|
||||
],
|
||||
key=lambda x: x["id"],
|
||||
)
|
||||
expected_name = str(room.id)
|
||||
assert content_dict == {
|
||||
"access_level": str(room.access_level),
|
||||
"id": str(room.id),
|
||||
"configuration": {},
|
||||
"livekit": {
|
||||
"url": "test_url_value",
|
||||
"room": expected_name,
|
||||
"token": "foo",
|
||||
},
|
||||
"name": room.name,
|
||||
"pin_code": room.pin_code,
|
||||
"slug": room.slug,
|
||||
}
|
||||
|
||||
mock_token.assert_not_called()
|
||||
mock_token.assert_called_once_with(
|
||||
room=expected_name,
|
||||
user=user,
|
||||
username=None,
|
||||
color=None,
|
||||
sources=None,
|
||||
role=str(user_access.role),
|
||||
participant_id=None,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("access_level", RoomAccessLevel)
|
||||
@@ -468,77 +567,3 @@ def test_api_rooms_retrieve_authenticated_with_user_access_token():
|
||||
assert response.data["id"] == str(room.id)
|
||||
assert response.data["pin_code"] == room.pin_code
|
||||
assert "accesses" in response.data
|
||||
assert "livekit" not in response.data
|
||||
|
||||
|
||||
@pytest.mark.parametrize("access_level", RoomAccessLevel)
|
||||
@pytest.mark.parametrize("role", [None, *RoleChoices])
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
def test_api_rooms_retrieve_never_returns_livekit_credentials(
|
||||
mock_token, role, access_level
|
||||
):
|
||||
"""Retrieving a room should never mint a LiveKit token."""
|
||||
room = RoomFactory(access_level=access_level)
|
||||
user = UserFactory()
|
||||
if role is not None:
|
||||
UserResourceAccessFactory(resource=room, user=user, role=role)
|
||||
client = APIClient()
|
||||
client.force_login(user)
|
||||
|
||||
response = client.get(f"/api/v1.0/rooms/{room.id!s}/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" not in response.json()
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("access_level", RoomAccessLevel)
|
||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||
def test_api_rooms_retrieve_anonymous_never_returns_livekit_credentials(
|
||||
mock_token, access_level
|
||||
):
|
||||
"""An anonymous user should never get a LiveKit token by retrieving a room."""
|
||||
room = RoomFactory(access_level=access_level)
|
||||
|
||||
response = APIClient().get(f"/api/v1.0/rooms/{room.id!s}/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "livekit" not in response.json()
|
||||
mock_token.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("access_level", "authenticated", "role", "pin_code_exposed"),
|
||||
[
|
||||
(RoomAccessLevel.PUBLIC, False, None, True),
|
||||
(RoomAccessLevel.TRUSTED, False, None, False),
|
||||
(RoomAccessLevel.RESTRICTED, False, None, False),
|
||||
(RoomAccessLevel.PUBLIC, True, None, True),
|
||||
(RoomAccessLevel.TRUSTED, True, None, True),
|
||||
(RoomAccessLevel.RESTRICTED, True, None, False),
|
||||
(RoomAccessLevel.RESTRICTED, True, RoleChoices.MEMBER, True),
|
||||
(RoomAccessLevel.RESTRICTED, True, RoleChoices.ADMIN, True),
|
||||
(RoomAccessLevel.RESTRICTED, True, RoleChoices.OWNER, True),
|
||||
],
|
||||
)
|
||||
def test_api_rooms_retrieve_pin_code_exposure(
|
||||
access_level, authenticated, role, pin_code_exposed
|
||||
):
|
||||
"""
|
||||
The pin code should only be exposed to users who may join the room
|
||||
without going through the lobby.
|
||||
"""
|
||||
room = RoomFactory(access_level=access_level)
|
||||
client = APIClient()
|
||||
if authenticated:
|
||||
user = UserFactory()
|
||||
if role is not None:
|
||||
UserResourceAccessFactory(resource=room, user=user, role=role)
|
||||
client.force_login(user)
|
||||
|
||||
response = client.get(f"/api/v1.0/rooms/{room.id!s}/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert ("pin_code" in response.json()) is pin_code_exposed
|
||||
if pin_code_exposed:
|
||||
assert response.json()["pin_code"] == room.pin_code
|
||||
|
||||
@@ -113,7 +113,6 @@ def test_api_rooms_update_administrators(mock_update_metadata):
|
||||
format="json",
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "livekit" not in response.json()
|
||||
room.refresh_from_db()
|
||||
assert room.name == "New name"
|
||||
assert room.slug == "new-name"
|
||||
@@ -468,7 +467,6 @@ def test_api_rooms_update_authenticated_with_user_access_token(privileged_role):
|
||||
room.accesses.filter(user=user).update(role=privileged_role)
|
||||
response = client.patch(f"/api/v1.0/rooms/{room.id!s}/", {"name": "new name"})
|
||||
assert response.status_code == 200
|
||||
assert "livekit" not in response.json()
|
||||
room.refresh_from_db()
|
||||
assert room.name == "new name"
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
"""
|
||||
Test utils.is_uuid
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from faker import Faker
|
||||
|
||||
from core import utils
|
||||
|
||||
fake = Faker()
|
||||
|
||||
UUID = fake.uuid4()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"value",
|
||||
[
|
||||
UUID,
|
||||
UUID.upper(),
|
||||
UUID.replace("-", ""),
|
||||
f"{{{UUID}}}",
|
||||
f"urn:uuid:{UUID}",
|
||||
],
|
||||
ids=["canonical", "uppercase", "hex", "braces", "urn"],
|
||||
)
|
||||
def test_utils_is_uuid_true(value):
|
||||
"""Strings that parse as a UUID should be recognized."""
|
||||
assert utils.is_uuid(value) is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"value",
|
||||
["", "my-room", "abc-defg-hij", f"{UUID}!", f"_{UUID}", UUID[:-1]],
|
||||
ids=["empty", "slug", "room-slug", "suffix", "prefix", "truncated"],
|
||||
)
|
||||
def test_utils_is_uuid_false(value):
|
||||
"""Strings that do not parse as a UUID should not be recognized."""
|
||||
assert utils.is_uuid(value) is False
|
||||
@@ -16,7 +16,7 @@ import string
|
||||
from datetime import timedelta
|
||||
from functools import lru_cache
|
||||
from typing import List, Optional
|
||||
from uuid import UUID, uuid4
|
||||
from uuid import uuid4
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.storage import default_storage
|
||||
@@ -336,15 +336,6 @@ def generate_room_slug():
|
||||
return "-".join(parts)
|
||||
|
||||
|
||||
def is_uuid(value: str) -> bool:
|
||||
"""Tell whether a value parses as a UUID."""
|
||||
try:
|
||||
UUID(value)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def detect_mimetype(file_buffer: bytes, filename: str | None = None) -> str:
|
||||
"""
|
||||
Detect MIME type using multiple methods for better accuracy.
|
||||
|
||||
@@ -708,7 +708,3 @@ msgstr "Deutsch"
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Spanisch"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Portugiesisch"
|
||||
|
||||
@@ -703,7 +703,3 @@ msgstr "German"
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Spanish"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Portuguese"
|
||||
|
||||
@@ -705,7 +705,3 @@ msgstr "Alemán"
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Español"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Portugués"
|
||||
|
||||
@@ -709,7 +709,3 @@ msgstr "Allemand"
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Espagnol"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Portugais"
|
||||
|
||||
@@ -703,7 +703,3 @@ msgstr "Duits"
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Spaans"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Portugees"
|
||||
|
||||
@@ -1,699 +0,0 @@
|
||||
# Portuguese (Brazil) translation for La Suite numérique Meet.
|
||||
# Copyright (C) 2026 La Suite numérique
|
||||
# This file is distributed under the same license as the Meet package.
|
||||
# Contributed by Alan Turing Laboratory (ATLab) - Federal University of Ceará (UFC), Brazil.
|
||||
# Railton Vasconcelos <railton.vasconcelos14@gmail.com>, 2026.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: lasuite-meet\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-09-02 22:52+0000\n"
|
||||
"PO-Revision-Date: 2026-11-07 21:00-0300\n"
|
||||
"Last-Translator: Railton Vasconcelos <railton.vasconcelos14@gmail.com> (ATLab - UFC)\n"
|
||||
"Language-Team: Alan Turing Laboratory (ATLab) - Federal University of Ceará (UFC)\n"
|
||||
"Language: pt_BR\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: core/admin.py:67
|
||||
msgid "Personal info"
|
||||
msgstr "Informações pessoais"
|
||||
|
||||
#: core/admin.py:80
|
||||
msgid "Permissions"
|
||||
msgstr "Permissões"
|
||||
|
||||
#: core/admin.py:92
|
||||
msgid "Important dates"
|
||||
msgstr "Datas importantes"
|
||||
|
||||
#: core/admin.py:206
|
||||
msgid "Content"
|
||||
msgstr "Conteúdo"
|
||||
|
||||
#: core/admin.py:217
|
||||
msgid "Deletion"
|
||||
msgstr "Exclusão"
|
||||
|
||||
#: core/admin.py:226
|
||||
msgid "Derived info"
|
||||
msgstr "Informações derivadas"
|
||||
|
||||
#: core/admin.py:237
|
||||
msgid "Timestamps"
|
||||
msgstr "Carimbos de data e hora"
|
||||
|
||||
#: core/admin.py:240
|
||||
msgid "File preview"
|
||||
msgstr "Pré-visualização do arquivo"
|
||||
|
||||
#: core/admin.py:300 core/admin.py:450
|
||||
msgid "No owner"
|
||||
msgstr "Sem proprietário"
|
||||
|
||||
#: core/admin.py:303 core/admin.py:453
|
||||
msgid "Multiple owners"
|
||||
msgstr "Vários proprietários"
|
||||
|
||||
#: core/admin.py:316
|
||||
msgid "Resend notification to external service"
|
||||
msgstr "Reenviar notificação ao serviço externo"
|
||||
|
||||
#: core/admin.py:339
|
||||
#, python-format
|
||||
msgid "Failed to notify for recording %(id)s"
|
||||
msgstr "Falha ao notificar sobre a gravação %(id)s"
|
||||
|
||||
#: core/admin.py:347
|
||||
#, python-format
|
||||
msgid "Failed to notify for recording %(id)s: %(error)s"
|
||||
msgstr "Falha ao notificar sobre a gravação %(id)s: %(error)s"
|
||||
|
||||
#: core/admin.py:355
|
||||
#, python-format
|
||||
msgid "Successfully sent notifications for %(count)s recording(s)."
|
||||
msgstr "Notificações enviadas com sucesso para %(count)s gravação(ões)."
|
||||
|
||||
#: core/admin.py:363
|
||||
#, python-format
|
||||
msgid "Skipped %(count)s expired recording(s)."
|
||||
msgstr "%(count)s gravação(ões) expirada(s) ignorada(s)."
|
||||
|
||||
#: core/admin.py:368
|
||||
msgid "Mark selected recordings as 'Failed to Stop'"
|
||||
msgstr "Marcar gravações selecionadas como 'Falha ao parar'"
|
||||
|
||||
#: core/admin.py:386
|
||||
#, python-format
|
||||
msgid "%(count)s recording(s) successfully marked as 'Failed to Stop'."
|
||||
msgstr "%(count)s gravação(ões) marcada(s) com sucesso como 'Falha ao parar'."
|
||||
|
||||
#: core/admin.py:394
|
||||
#, python-format
|
||||
msgid "Skipped %(count)s recording(s) with an ineligible status."
|
||||
msgstr "%(count)s gravação(ões) com status inelegível ignorada(s)."
|
||||
|
||||
#: core/admin.py:517
|
||||
msgid "No scopes"
|
||||
msgstr "Sem escopos"
|
||||
|
||||
#: core/admin.py:519
|
||||
msgid "Scopes"
|
||||
msgstr "Escopos"
|
||||
|
||||
#: core/api/filters.py:25
|
||||
msgid "Creator is me"
|
||||
msgstr "Criado por mim"
|
||||
|
||||
#: core/api/serializers.py:108
|
||||
msgid "You must be administrator or owner of a room to add accesses to it."
|
||||
msgstr "Você deve ser administrador ou proprietário de uma sala para adicionar acessos a ela."
|
||||
|
||||
#: core/api/serializers.py:560
|
||||
msgid "This file extension is not allowed."
|
||||
msgstr "Esta extensão de arquivo não é permitida."
|
||||
|
||||
#: core/api/viewsets.py:1268
|
||||
msgid "You have reached the maximum number of files for this type."
|
||||
msgstr "Você atingiu o número máximo de arquivos para este tipo."
|
||||
|
||||
#: core/models.py:38
|
||||
msgid "Member"
|
||||
msgstr "Membro"
|
||||
|
||||
#: core/models.py:39
|
||||
msgid "Administrator"
|
||||
msgstr "Administrador"
|
||||
|
||||
#: core/models.py:40
|
||||
msgid "Owner"
|
||||
msgstr "Proprietário"
|
||||
|
||||
#: core/models.py:56
|
||||
msgid "Initiated"
|
||||
msgstr "Iniciada"
|
||||
|
||||
#: core/models.py:57
|
||||
msgid "Active"
|
||||
msgstr "Ativa"
|
||||
|
||||
#: core/models.py:58
|
||||
msgid "Stopped"
|
||||
msgstr "Parada"
|
||||
|
||||
#: core/models.py:59
|
||||
msgid "Saved"
|
||||
msgstr "Salva"
|
||||
|
||||
#: core/models.py:60
|
||||
msgid "Aborted"
|
||||
msgstr "Cancelada"
|
||||
|
||||
#: core/models.py:61
|
||||
msgid "Failed to Start"
|
||||
msgstr "Falha ao iniciar"
|
||||
|
||||
#: core/models.py:62
|
||||
msgid "Failed to Stop"
|
||||
msgstr "Falha ao parar"
|
||||
|
||||
#: core/models.py:63
|
||||
msgid "Notification succeeded"
|
||||
msgstr "Notificação enviada com sucesso"
|
||||
|
||||
#: core/models.py:66
|
||||
msgid "External process successful"
|
||||
msgstr "Processo externo concluído com sucesso"
|
||||
|
||||
#: core/models.py:68
|
||||
msgid "External process failed"
|
||||
msgstr "Falha no processo externo"
|
||||
|
||||
#: core/models.py:97
|
||||
msgid "SCREEN_RECORDING"
|
||||
msgstr "GRAVAÇÃO_DE_TELA"
|
||||
|
||||
#: core/models.py:98
|
||||
msgid "TRANSCRIPT"
|
||||
msgstr "TRANSCRIÇÃO"
|
||||
|
||||
#: core/models.py:104
|
||||
msgid "Public Access"
|
||||
msgstr "Acesso público"
|
||||
|
||||
#: core/models.py:105
|
||||
msgid "Trusted Access"
|
||||
msgstr "Acesso confiável"
|
||||
|
||||
#: core/models.py:106
|
||||
msgid "Restricted Access"
|
||||
msgstr "Acesso restrito"
|
||||
|
||||
#: core/models.py:118
|
||||
msgid "id"
|
||||
msgstr "id"
|
||||
|
||||
#: core/models.py:119
|
||||
msgid "primary key for the record as UUID"
|
||||
msgstr "chave primária do registro como UUID"
|
||||
|
||||
#: core/models.py:125
|
||||
msgid "created on"
|
||||
msgstr "criado em"
|
||||
|
||||
#: core/models.py:126
|
||||
msgid "date and time at which a record was created"
|
||||
msgstr "data e hora em que o registro foi criado"
|
||||
|
||||
#: core/models.py:131
|
||||
msgid "updated on"
|
||||
msgstr "atualizado em"
|
||||
|
||||
#: core/models.py:132
|
||||
msgid "date and time at which a record was last updated"
|
||||
msgstr "data e hora da última atualização do registro"
|
||||
|
||||
#: core/models.py:150
|
||||
msgid "sub"
|
||||
msgstr "sub"
|
||||
|
||||
#: core/models.py:152
|
||||
msgid ""
|
||||
"Optional for pending users; required upon account activation. 255 characters "
|
||||
"or fewer. Printable ASCII characters only."
|
||||
msgstr ""
|
||||
"Opcional para usuários pendentes; obrigatório na ativação da conta. Até 255 "
|
||||
"caracteres. Apenas caracteres ASCII imprimíveis."
|
||||
|
||||
#: core/validators.py:22
|
||||
msgid "Enter a valid sub. This value should be printable ASCII only."
|
||||
msgstr "Insira um sub válido. Este valor deve conter apenas caracteres ASCII imprimíveis."
|
||||
|
||||
#: core/models.py:161
|
||||
msgid "identity email address"
|
||||
msgstr "endereço de e-mail de identidade"
|
||||
|
||||
#: core/models.py:166
|
||||
msgid "admin email address"
|
||||
msgstr "endereço de e-mail administrativo"
|
||||
|
||||
#: core/models.py:168
|
||||
msgid "full name"
|
||||
msgstr "nome completo"
|
||||
|
||||
#: core/models.py:170
|
||||
msgid "short name"
|
||||
msgstr "nome curto"
|
||||
|
||||
#: core/models.py:176
|
||||
msgid "language"
|
||||
msgstr "idioma"
|
||||
|
||||
#: core/models.py:177
|
||||
msgid "The language in which the user wants to see the interface."
|
||||
msgstr "O idioma no qual o usuário deseja visualizar a interface."
|
||||
|
||||
#: core/models.py:183
|
||||
msgid "The timezone in which the user wants to see times."
|
||||
msgstr "O fuso horário no qual o usuário deseja visualizar os horários."
|
||||
|
||||
#: core/models.py:190
|
||||
msgid "default room access level"
|
||||
msgstr "nível de acesso padrão da sala"
|
||||
|
||||
#: core/models.py:192
|
||||
msgid ""
|
||||
"Access level applied by default to new rooms created by this user. When "
|
||||
"empty, the instance default is used."
|
||||
msgstr ""
|
||||
"Nível de acesso aplicado por padrão às novas salas criadas por este usuário. "
|
||||
"Quando vazio, o padrão da instância é utilizado."
|
||||
|
||||
#: core/models.py:199
|
||||
msgid "default room configuration"
|
||||
msgstr "configuração padrão da sala"
|
||||
|
||||
#: core/models.py:201
|
||||
msgid "Configurations applied by default to new rooms created by this user."
|
||||
msgstr "Configurações aplicadas por padrão às novas salas criadas por este usuário."
|
||||
|
||||
#: core/models.py:205
|
||||
msgid "device"
|
||||
msgstr "dispositivo"
|
||||
|
||||
#: core/models.py:207
|
||||
msgid "Whether the user is a device or a real user."
|
||||
msgstr "Define se o usuário é um dispositivo ou um usuário real."
|
||||
|
||||
#: core/models.py:210
|
||||
msgid "staff status"
|
||||
msgstr "status da equipe"
|
||||
|
||||
#: core/models.py:212
|
||||
msgid "Whether the user can log into this admin site."
|
||||
msgstr "Define se o usuário pode acessar este painel de administração."
|
||||
|
||||
#: core/models.py:215
|
||||
msgid "active"
|
||||
msgstr "ativo"
|
||||
|
||||
#: core/models.py:218
|
||||
msgid ""
|
||||
"Whether this user should be treated as active. Unselect this instead of "
|
||||
"deleting accounts."
|
||||
msgstr ""
|
||||
"Define se este usuário deve ser tratado como ativo. Desmarque esta opção em "
|
||||
"vez de excluir contas."
|
||||
|
||||
#: core/models.py:231
|
||||
msgid "user"
|
||||
msgstr "usuário"
|
||||
|
||||
#: core/models.py:232
|
||||
msgid "users"
|
||||
msgstr "usuários"
|
||||
|
||||
#: core/models.py:298
|
||||
msgid "Resource"
|
||||
msgstr "Recurso"
|
||||
|
||||
#: core/models.py:299
|
||||
msgid "Resources"
|
||||
msgstr "Recursos"
|
||||
|
||||
#: core/models.py:357
|
||||
msgid "Resource access"
|
||||
msgstr "Acesso a recurso"
|
||||
|
||||
#: core/models.py:358
|
||||
msgid "Resource accesses"
|
||||
msgstr "Acessos a recursos"
|
||||
|
||||
#: core/models.py:364
|
||||
msgid "Resource access with this User and Resource already exists."
|
||||
msgstr "Já existe um acesso para este usuário e este recurso."
|
||||
|
||||
#: core/models.py:421
|
||||
msgid "Visio room configuration"
|
||||
msgstr "Configuração da sala de videoconferência"
|
||||
|
||||
#: core/models.py:422
|
||||
msgid "Values for Visio parameters to configure the room."
|
||||
msgstr "Valores dos parâmetros de videoconferência para configurar a sala."
|
||||
|
||||
#: core/models.py:429
|
||||
msgid "Room PIN code"
|
||||
msgstr "Código PIN da sala"
|
||||
|
||||
#: core/models.py:430
|
||||
msgid "Unique n-digit code that identifies this room in telephony mode."
|
||||
msgstr "Código único de n dígitos que identifica esta sala no modo telefonia."
|
||||
|
||||
#: core/models.py:436 core/models.py:597
|
||||
msgid "Room"
|
||||
msgstr "Sala"
|
||||
|
||||
#: core/models.py:437
|
||||
msgid "Rooms"
|
||||
msgstr "Salas"
|
||||
|
||||
#: core/models.py:608
|
||||
msgid "Worker ID"
|
||||
msgstr "ID do worker"
|
||||
|
||||
#: core/models.py:610
|
||||
msgid ""
|
||||
"Enter an identifier for the worker recording.This ID is retained even when "
|
||||
"the worker stops, allowing for easy tracking."
|
||||
msgstr ""
|
||||
"Insira um identificador para a gravação do worker. Este ID é mantido mesmo "
|
||||
"quando o worker para, facilitando o rastreamento."
|
||||
|
||||
#: core/models.py:618
|
||||
msgid "Recording mode"
|
||||
msgstr "Modo de gravação"
|
||||
|
||||
#: core/models.py:619
|
||||
msgid "Defines the mode of recording being called."
|
||||
msgstr "Define o modo de gravação utilizado."
|
||||
|
||||
#: core/models.py:624 core/models.py:625
|
||||
msgid "Recording options"
|
||||
msgstr "Opções de gravação"
|
||||
|
||||
#: core/models.py:632
|
||||
msgid "External Process ID"
|
||||
msgstr "ID do processo externo"
|
||||
|
||||
#: core/models.py:633
|
||||
msgid "ID of the external process associated with the recording."
|
||||
msgstr "ID do processo externo associado à gravação."
|
||||
|
||||
#: core/models.py:639
|
||||
msgid "Recording"
|
||||
msgstr "Gravação"
|
||||
|
||||
#: core/models.py:640
|
||||
msgid "Recordings"
|
||||
msgstr "Gravações"
|
||||
|
||||
#: core/models.py:750
|
||||
msgid "Recording/user relation"
|
||||
msgstr "Relação gravação/usuário"
|
||||
|
||||
#: core/models.py:751
|
||||
msgid "Recording/user relations"
|
||||
msgstr "Relações gravação/usuário"
|
||||
|
||||
#: core/models.py:757
|
||||
msgid "This user is already in this recording."
|
||||
msgstr "Este usuário já está nesta gravação."
|
||||
|
||||
#: core/models.py:763
|
||||
msgid "This team is already in this recording."
|
||||
msgstr "Esta equipe já está nesta gravação."
|
||||
|
||||
#: core/models.py:769
|
||||
msgid "Either user or team must be set, not both."
|
||||
msgstr "Deve ser definido o usuário ou a equipe, mas não ambos."
|
||||
|
||||
#: core/models.py:786
|
||||
msgid "Create rooms"
|
||||
msgstr "Criar salas"
|
||||
|
||||
#: core/models.py:787
|
||||
msgid "List rooms"
|
||||
msgstr "Listar salas"
|
||||
|
||||
#: core/models.py:788
|
||||
msgid "Retrieve room details"
|
||||
msgstr "Obter detalhes da sala"
|
||||
|
||||
#: core/models.py:789
|
||||
msgid "Update rooms"
|
||||
msgstr "Atualizar salas"
|
||||
|
||||
#: core/models.py:790
|
||||
msgid "Delete rooms"
|
||||
msgstr "Excluir salas"
|
||||
|
||||
#: core/models.py:803
|
||||
msgid "Application name"
|
||||
msgstr "Nome da aplicação"
|
||||
|
||||
#: core/models.py:804
|
||||
msgid "Descriptive name for this application."
|
||||
msgstr "Nome descritivo para esta aplicação."
|
||||
|
||||
#: core/models.py:814
|
||||
msgid "Hashed on Save. Copy it now if this is a new secret."
|
||||
msgstr "Criptografado ao salvar. Copie agora se este for um novo segredo."
|
||||
|
||||
#: core/models.py:825
|
||||
msgid "Application"
|
||||
msgstr "Aplicação"
|
||||
|
||||
#: core/models.py:826
|
||||
msgid "Applications"
|
||||
msgstr "Aplicações"
|
||||
|
||||
#: core/models.py:849
|
||||
msgid "Enter a valid domain"
|
||||
msgstr "Insira um domínio válido"
|
||||
|
||||
#: core/models.py:852
|
||||
msgid "Domain"
|
||||
msgstr "Domínio"
|
||||
|
||||
#: core/models.py:853
|
||||
msgid "Email domain this application can act on behalf of."
|
||||
msgstr "Domínio de e-mail em nome do qual esta aplicação pode atuar."
|
||||
|
||||
#: core/models.py:865
|
||||
msgid "Application domain"
|
||||
msgstr "Domínio da aplicação"
|
||||
|
||||
#: core/models.py:866
|
||||
msgid "Application domains"
|
||||
msgstr "Domínios da aplicação"
|
||||
|
||||
#: core/models.py:884
|
||||
msgid "Pending"
|
||||
msgstr "Pendente"
|
||||
|
||||
#: core/models.py:885
|
||||
msgid "Analyzing"
|
||||
msgstr "Analisando"
|
||||
|
||||
#: core/models.py:892
|
||||
msgid "Ready"
|
||||
msgstr "Pronto"
|
||||
|
||||
#: core/models.py:898
|
||||
msgid "Background image"
|
||||
msgstr "Imagem de fundo"
|
||||
|
||||
#: core/models.py:910
|
||||
msgid "title"
|
||||
msgstr "título"
|
||||
|
||||
#: core/models.py:934
|
||||
msgid "Malware detection info when the analysis status is unsafe."
|
||||
msgstr "Informações de detecção de malware quando o status da análise não for seguro."
|
||||
|
||||
#: core/models.py:939
|
||||
msgid "File"
|
||||
msgstr "Arquivo"
|
||||
|
||||
#: core/models.py:940
|
||||
msgid "Files"
|
||||
msgstr "Arquivos"
|
||||
|
||||
#: core/models.py:1060
|
||||
msgid "This file is already hard deleted."
|
||||
msgstr "Este arquivo já foi excluído permanentemente."
|
||||
|
||||
#: core/models.py:1070
|
||||
msgid "To hard delete a file, it must first be soft deleted."
|
||||
msgstr "Para excluir permanentemente um arquivo, ele deve primeiro ser marcado para exclusão."
|
||||
|
||||
#: core/recording/event/notification.py:124
|
||||
msgid "Your recording is ready"
|
||||
msgstr "Sua gravação está pronta"
|
||||
|
||||
#: core/recording/event/notification.py:195
|
||||
msgid "Transcription"
|
||||
msgstr "Transcrição"
|
||||
|
||||
#: core/recording/event/notification.py:206
|
||||
#, python-brace-format
|
||||
msgid "Meeting \"{room}\" on {room_recording_date} at {room_recording_time}"
|
||||
msgstr "Reunião \"{room}\" em {room_recording_date} às {room_recording_time}"
|
||||
|
||||
#: core/services/invitation.py:44
|
||||
#, python-brace-format
|
||||
msgid "Video call in progress: {sender.email} is waiting for you to connect"
|
||||
msgstr "Videochamada em andamento: {sender.email} está aguardando você se conectar"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:151
|
||||
#: core/templates/mail/html/screen_recording.html:151
|
||||
#: core/templates/mail/text/invitation.txt:4
|
||||
#: core/templates/mail/text/screen_recording.txt:4
|
||||
msgid "Logo email"
|
||||
msgstr "Logotipo do e-mail"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:181
|
||||
#: core/templates/mail/text/invitation.txt:6
|
||||
msgid "invites you to join an ongoing video call"
|
||||
msgstr "convida você para participar de uma videochamada em andamento"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:192
|
||||
#: core/templates/mail/text/invitation.txt:8
|
||||
msgid "JOIN THE CALL"
|
||||
msgstr "ENTRAR NA CHAMADA"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:219
|
||||
#: core/templates/mail/text/invitation.txt:14
|
||||
msgid ""
|
||||
"If you can't click the button, copy and paste the URL into your browser to "
|
||||
"join the call."
|
||||
msgstr ""
|
||||
"Se não conseguir clicar no botão, copie e cole a URL no seu navegador para "
|
||||
"entrar na chamada."
|
||||
|
||||
#: core/templates/mail/html/invitation.html:227
|
||||
#: core/templates/mail/text/invitation.txt:16
|
||||
msgid "Tips for a better experience:"
|
||||
msgstr "Dicas para uma melhor experiência:"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:229
|
||||
#: core/templates/mail/text/invitation.txt:18
|
||||
msgid "Use Chrome or Firefox for better call quality"
|
||||
msgstr "Use o Chrome ou o Firefox para melhor qualidade de chamada"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:230
|
||||
#: core/templates/mail/text/invitation.txt:19
|
||||
msgid "Test your microphone and camera before joining"
|
||||
msgstr "Teste seu microfone e sua câmera antes de entrar"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:231
|
||||
#: core/templates/mail/text/invitation.txt:20
|
||||
msgid "Make sure you have a stable internet connection"
|
||||
msgstr "Certifique-se de ter uma conexão de internet estável"
|
||||
|
||||
#: core/templates/mail/html/invitation.html:240
|
||||
#: core/templates/mail/html/screen_recording.html:237
|
||||
#: core/templates/mail/text/invitation.txt:22
|
||||
#: core/templates/mail/text/screen_recording.txt:24
|
||||
#, python-format
|
||||
msgid " Thank you for using %(brandname)s. "
|
||||
msgstr " Obrigado por usar o %(brandname)s. "
|
||||
|
||||
#: core/templates/mail/html/invitation.html:271
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This mail has been sent to %(email)s by <a href=\"%(href)s\">%(name)s</a>"
|
||||
msgstr ""
|
||||
"Este e-mail foi enviado para %(email)s por <a href=\"%(href)s\">%(name)s</a>"
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:180
|
||||
#: core/templates/mail/text/screen_recording.txt:7
|
||||
msgid "Your recording is ready!"
|
||||
msgstr "Sua gravação está pronta!"
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:187
|
||||
#: core/templates/mail/text/screen_recording.txt:9
|
||||
#, python-format
|
||||
msgid ""
|
||||
" Your recording of \"%(room_name)s\" on %(recording_date)s at "
|
||||
"%(recording_time)s is now ready to download. "
|
||||
msgstr ""
|
||||
" Sua gravação de \"%(room_name)s\" em %(recording_date)s às "
|
||||
"%(recording_time)s já está pronta para download. "
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:187
|
||||
#: core/templates/mail/text/screen_recording.txt:9
|
||||
#, python-format
|
||||
msgid " The recording will expire in %(days)s days. "
|
||||
msgstr " A gravação expirará em %(days)s dias. "
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:192
|
||||
#: core/templates/mail/text/screen_recording.txt:10
|
||||
msgid ""
|
||||
" Sharing the recording via link is not yet available. Only organizers can "
|
||||
"download it. "
|
||||
msgstr ""
|
||||
" O compartilhamento da gravação por link ainda não está disponível. Apenas "
|
||||
"os organizadores podem baixá-la. "
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:198
|
||||
#: core/templates/mail/text/screen_recording.txt:12
|
||||
msgid "To keep this recording permanently:"
|
||||
msgstr "Para manter esta gravação permanentemente:"
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:200
|
||||
#, python-format
|
||||
msgid "Click the \"<a href=\"%(link)s\">Open</a>\" link below "
|
||||
msgstr "Clique no link \"<a href=\"%(link)s\">Abrir</a>\" abaixo "
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:201
|
||||
#: core/templates/mail/text/screen_recording.txt:15
|
||||
msgid "Use the \"Download\" button in the interface "
|
||||
msgstr "Use o botão \"Baixar\" na interface "
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:202
|
||||
#: core/templates/mail/text/screen_recording.txt:16
|
||||
msgid "Save the file to your preferred location"
|
||||
msgstr "Salve o arquivo no local de sua preferência"
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:213
|
||||
#: core/templates/mail/text/screen_recording.txt:18
|
||||
msgid "Open"
|
||||
msgstr "Abrir"
|
||||
|
||||
#: core/templates/mail/html/screen_recording.html:222
|
||||
#: core/templates/mail/text/screen_recording.txt:20
|
||||
#, python-format
|
||||
msgid ""
|
||||
" If you have any questions or need assistance, please contact our support "
|
||||
"team at %(support_email)s. "
|
||||
msgstr ""
|
||||
" Se tiver alguma dúvida ou precisar de ajuda, entre em contato com nossa "
|
||||
"equipe de suporte em %(support_email)s. "
|
||||
|
||||
#: core/templates/mail/text/invitation.txt:24
|
||||
#, python-format
|
||||
msgid "This mail has been sent to %(email)s by %(name)s [%(href)s]"
|
||||
msgstr "Este e-mail foi enviado para %(email)s por %(name)s [%(href)s]"
|
||||
|
||||
#: core/templates/mail/text/screen_recording.txt:14
|
||||
#, python-format
|
||||
msgid "Click the \"Open [%(link)s]\" link below "
|
||||
msgstr "Clique no link \"Abrir [%(link)s]\" abaixo "
|
||||
|
||||
#: meet/settings.py:238
|
||||
msgid "English"
|
||||
msgstr "Inglês"
|
||||
|
||||
#: meet/settings.py:239
|
||||
msgid "French"
|
||||
msgstr "Francês"
|
||||
|
||||
#: meet/settings.py:240
|
||||
msgid "Dutch"
|
||||
msgstr "Holandês"
|
||||
|
||||
#: meet/settings.py:241
|
||||
msgid "German"
|
||||
msgstr "Alemão"
|
||||
|
||||
#: meet/settings.py:242
|
||||
msgid "Spanish"
|
||||
msgstr "Espanhol"
|
||||
|
||||
#: meet/settings.py:243
|
||||
msgid "Portuguese"
|
||||
msgstr "Português"
|
||||
@@ -302,7 +302,6 @@ class Base(Configuration):
|
||||
("nl-nl", _("Dutch")),
|
||||
("de-de", _("German")),
|
||||
("es-es", _("Spanish")),
|
||||
("pt-br", _("Portuguese")),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -47,10 +47,14 @@ ENV VITE_MEDIA_BASE_URL=${VITE_MEDIA_BASE_URL}
|
||||
RUN npm run build
|
||||
|
||||
# ---- Front-end image ----
|
||||
FROM nginx/nginx-unprivileged:1.30.6-alpine3.24 AS frontend-production
|
||||
FROM nginxinc/nginx-unprivileged:1.30.6-alpine3.24 AS frontend-production
|
||||
|
||||
USER root
|
||||
RUN apk del curl && \
|
||||
RUN apk upgrade --no-cache libexpat && \
|
||||
apk add --no-cache --upgrade 'pcre2>=10.49-r0' 'tiff>=4.7.2-r0' \
|
||||
'libx11>=1.8.14-r0' 'ca-certificates>=20261020-r0' \
|
||||
'brotli-libs>=1.2.1-r0' && \
|
||||
apk del curl && \
|
||||
rm -f /usr/share/nginx/html/50x.html
|
||||
USER nginx
|
||||
|
||||
|
||||
@@ -10,13 +10,8 @@ server {
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
location ^~ /assets/mediapipe/models/ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
# Serve static files with caching
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|mp3)$ {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
"input": ["src/**/*.{ts,tsx}", "!src/styled-system/**/*", "!src/**/*.d.ts"],
|
||||
"output": "src/locales/$LOCALE/$NAMESPACE.json",
|
||||
"createOldCatalogs": false,
|
||||
"locales": ["en", "fr", "de", "nl", "es", "pt"],
|
||||
"locales": ["en", "fr", "de", "nl", "es"],
|
||||
"sort": true
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"@tanstack/react-query": "5.101.4",
|
||||
"@timephy/rnnoise-wasm": "1.0.0",
|
||||
"hoofd": "1.7.3",
|
||||
"howler": "2.2.4",
|
||||
"humanize-duration": "3.34.1",
|
||||
"i18next": "26.3.6",
|
||||
"i18next-browser-languagedetector": "8.2.1",
|
||||
@@ -36,6 +35,7 @@
|
||||
"react-dom": "18.3.1",
|
||||
"react-i18next": "17.0.12",
|
||||
"react-stately": "3.49.0",
|
||||
"use-sound": "5.0.0",
|
||||
"valtio": "2.3.2",
|
||||
"wouter": "3.10.0"
|
||||
},
|
||||
@@ -44,7 +44,6 @@
|
||||
"@pandacss/dev": "1.11.1",
|
||||
"@tanstack/eslint-plugin-query": "5.100.14",
|
||||
"@tanstack/react-query-devtools": "5.100.14",
|
||||
"@types/howler": "2.2.13",
|
||||
"@types/humanize-duration": "3.27.4",
|
||||
"@types/node": "24.12.4",
|
||||
"@types/react": "18.3.12",
|
||||
@@ -2556,13 +2555,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/howler": {
|
||||
"version": "2.2.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/howler/-/howler-2.2.13.tgz",
|
||||
"integrity": "sha512-40+EBjqIHHrC4VShlz/7i0lBUsE3QkgzZinQQji74Hd8sBkJZUBaT7LWFLK6rcabsDOOQpoMbEJvtaFQwxOu/g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/humanize-duration": {
|
||||
"version": "3.27.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/humanize-duration/-/humanize-duration-3.27.4.tgz",
|
||||
@@ -6466,8 +6458,7 @@
|
||||
"node_modules/howler": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/howler/-/howler-2.2.4.tgz",
|
||||
"integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w=="
|
||||
},
|
||||
"node_modules/html-parse-stringify": {
|
||||
"version": "4.0.1",
|
||||
@@ -11186,6 +11177,18 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/use-sound": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/use-sound/-/use-sound-5.0.0.tgz",
|
||||
"integrity": "sha512-MNHT3FFC5HxNCrgZtrnpIMJI2cw/0D2xismcrtyht8BTuF5FhFhb57xO/jlQr2xJaFrc/0btzRQvGyHQwB7PVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"howler": "^2.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8"
|
||||
}
|
||||
},
|
||||
"node_modules/use-sync-external-store": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"@tanstack/react-query": "5.101.4",
|
||||
"@timephy/rnnoise-wasm": "1.0.0",
|
||||
"hoofd": "1.7.3",
|
||||
"howler": "2.2.4",
|
||||
"humanize-duration": "3.34.1",
|
||||
"i18next": "26.3.6",
|
||||
"i18next-browser-languagedetector": "8.2.1",
|
||||
@@ -44,6 +43,7 @@
|
||||
"react-dom": "18.3.1",
|
||||
"react-i18next": "17.0.12",
|
||||
"react-stately": "3.49.0",
|
||||
"use-sound": "5.0.0",
|
||||
"valtio": "2.3.2",
|
||||
"wouter": "3.10.0"
|
||||
},
|
||||
@@ -52,7 +52,6 @@
|
||||
"@pandacss/dev": "1.11.1",
|
||||
"@tanstack/eslint-plugin-query": "5.100.14",
|
||||
"@tanstack/react-query-devtools": "5.100.14",
|
||||
"@types/howler": "2.2.13",
|
||||
"@types/humanize-duration": "3.27.4",
|
||||
"@types/node": "24.12.4",
|
||||
"@types/react": "18.3.12",
|
||||
|
||||
@@ -36,9 +36,6 @@ const config: Config = {
|
||||
jsxFramework: 'react',
|
||||
outdir: 'src/styled-system',
|
||||
globalFontface: {},
|
||||
globalVars: {
|
||||
'--global-font-body': 'var(--fonts-sans)',
|
||||
},
|
||||
theme: {
|
||||
...pandaPreset.theme,
|
||||
// media queries are defined in em so that zooming with text-only mode triggers breakpoints
|
||||
|
||||
|
Before Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 309 KiB |
|
Before Width: | Height: | Size: 394 KiB |
|
Before Width: | Height: | Size: 436 KiB |
|
Before Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 294 KiB |
|
Before Width: | Height: | Size: 348 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,7 +1,7 @@
|
||||
import { fetchApi } from './fetchApi'
|
||||
import { keys } from './queryKeys'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import type { RecordingMode } from '@/features/recording/types'
|
||||
import { RecordingMode } from '@/features/recording'
|
||||
import type { ApiAccessLevel } from '@/features/rooms/api/ApiRoom'
|
||||
import type { Track, VideoCodec } from 'livekit-client'
|
||||
type Source = Track.Source
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import { useMediaDeviceSelect } from '@livekit/components-react'
|
||||
import { reportError } from '@/features/analytics/telemetry'
|
||||
import { canTestAudioOutput } from '@/features/rooms/utils/canTestAudioOutput'
|
||||
import upriseSoundSrc from '@/assets/sounds/uprise.mp3'
|
||||
|
||||
export const SoundTester = () => {
|
||||
const { t } = useTranslation('settings')
|
||||
@@ -56,7 +55,7 @@ export const SoundTester = () => {
|
||||
{/* eslint-disable jsx-a11y/media-has-caption */}
|
||||
<audio
|
||||
ref={audioRef}
|
||||
src={upriseSoundSrc}
|
||||
src="/sounds/uprise.mp3"
|
||||
onEnded={() => setIsPlaying(false)}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { getPosthog } from '../utils'
|
||||
import { useIsAnalyticsEnabled } from './useIsAnalyticsEnabled'
|
||||
|
||||
/**
|
||||
* Same contract as `useFeatureFlagEnabled` from 'posthog-js/react', without a
|
||||
* static import of posthog-js: that import puts the whole SDK on the critical
|
||||
* path of every screen, defeating the lazy `getPosthog()`.
|
||||
*/
|
||||
export const useFeatureFlagEnabled = (flag: string): boolean | undefined => {
|
||||
const isAnalyticsEnabled = useIsAnalyticsEnabled()
|
||||
const [enabled, setEnabled] = useState<boolean | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAnalyticsEnabled) return
|
||||
let cancelled = false
|
||||
let unsubscribe: (() => void) | undefined
|
||||
void getPosthog().then((ph) => {
|
||||
if (cancelled) return
|
||||
setEnabled(ph.isFeatureEnabled(flag))
|
||||
unsubscribe = ph.onFeatureFlags(() =>
|
||||
setEnabled(ph.isFeatureEnabled(flag))
|
||||
)
|
||||
})
|
||||
return () => {
|
||||
cancelled = true
|
||||
unsubscribe?.()
|
||||
}
|
||||
}, [flag, isAnalyticsEnabled])
|
||||
|
||||
return enabled
|
||||
}
|
||||
@@ -7,11 +7,7 @@ import {
|
||||
} from 'react-aria-components'
|
||||
import { RiArrowDownSFill } from '@remixicon/react'
|
||||
import { css, cx } from '@/styled-system/css'
|
||||
import {
|
||||
DIAGNOSTIC_OUTPUT_LANG,
|
||||
getSummaryLang,
|
||||
type ConnectionTestStepResult,
|
||||
} from '../types'
|
||||
import type { ConnectionTestStepResult } from '../types'
|
||||
import { StepStatusIndicator } from './StepStatusIndicator'
|
||||
|
||||
/** Each step is its own bounded card, collapsed or not. */
|
||||
@@ -69,7 +65,7 @@ const labelClass = css({
|
||||
const valueClass = css({
|
||||
fontFamily: 'mono',
|
||||
textStyle: 'xs',
|
||||
color: 'greyscale.600',
|
||||
color: 'greyscale.500',
|
||||
overflowWrap: 'anywhere',
|
||||
})
|
||||
|
||||
@@ -114,11 +110,7 @@ const StepRowContent = ({ step }: { step: ConnectionTestStepResult }) => {
|
||||
<>
|
||||
<span className={identityClass}>
|
||||
<span className={labelClass}>{t(`steps.${step.id}`)}</span>
|
||||
{step.summary && (
|
||||
<span className={valueClass} lang={getSummaryLang(step)}>
|
||||
{step.summary}
|
||||
</span>
|
||||
)}
|
||||
{step.summary && <span className={valueClass}>{step.summary}</span>}
|
||||
</span>
|
||||
<StepStatusIndicator
|
||||
status={step.status}
|
||||
@@ -178,7 +170,7 @@ export const ConnectionTestStepRow = ({
|
||||
{/* Collapsed panels stay in the DOM for aria-controls, but the log
|
||||
lines themselves are only mounted when actually visible. */}
|
||||
{isExpanded && (
|
||||
<ul className={logListClass} lang={DIAGNOSTIC_OUTPUT_LANG}>
|
||||
<ul className={logListClass}>
|
||||
{step.logs?.map((log, index) => (
|
||||
<li key={`${log.level}-${index}`} className={logItemClass}>
|
||||
{log.message}
|
||||
|
||||
@@ -153,7 +153,7 @@ const counterValueClass = css({
|
||||
})
|
||||
|
||||
/** A zero count is context, not a result: it recedes instead of shouting. */
|
||||
const emptyCounterClass = css({ color: 'greyscale.600' })
|
||||
const emptyCounterClass = css({ color: 'greyscale.400' })
|
||||
const emptySquareClass = css({
|
||||
backgroundColor: 'transparent!',
|
||||
border: '1px solid {colors.greyscale.250}',
|
||||
|
||||
@@ -25,10 +25,10 @@ export const statusSquareClass: Record<ConnectionTestStepStatus, string> = {
|
||||
* failure and warning.
|
||||
*/
|
||||
export const statusTextClass: Record<ConnectionTestStepStatus, string> = {
|
||||
pending: css({ color: 'greyscale.600' }),
|
||||
pending: css({ color: 'greyscale.500' }),
|
||||
running: css({ color: 'greyscale.700' }),
|
||||
success: css({ color: 'greyscale.1000' }),
|
||||
warning: css({ color: 'warning', fontWeight: 'medium' }),
|
||||
failed: css({ color: 'danger.600', fontWeight: 'medium' }),
|
||||
skipped: css({ color: 'greyscale.600' }),
|
||||
skipped: css({ color: 'greyscale.500' }),
|
||||
}
|
||||
|
||||
@@ -136,16 +136,14 @@ const ConnectionTest = () => {
|
||||
<h2 className={sectionTitleClass}>
|
||||
{t(`groups.${group.id}`)}
|
||||
</h2>
|
||||
<ul className={rowsClass}>
|
||||
<div className={rowsClass}>
|
||||
{group.steps.map((id) => {
|
||||
const step = stepsById.get(id)
|
||||
return step ? (
|
||||
<li key={id}>
|
||||
<ConnectionTestStepRow step={step} />
|
||||
</li>
|
||||
<ConnectionTestStepRow key={id} step={step} />
|
||||
) : null
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
|
||||
|
||||
@@ -32,23 +32,6 @@ export type ConnectionTestStepResult = {
|
||||
data?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export const DIAGNOSTIC_OUTPUT_LANG = 'en'
|
||||
|
||||
const LANGUAGE_NEUTRAL_STEPS: ReadonlySet<ConnectionTestStepId> = new Set([
|
||||
'browser',
|
||||
'microphone',
|
||||
'camera',
|
||||
'devices',
|
||||
])
|
||||
|
||||
export const getSummaryLang = ({
|
||||
id,
|
||||
status,
|
||||
}: Pick<ConnectionTestStepResult, 'id' | 'status'>) =>
|
||||
LANGUAGE_NEUTRAL_STEPS.has(id) && status === 'success'
|
||||
? undefined
|
||||
: DIAGNOSTIC_OUTPUT_LANG
|
||||
|
||||
export type ConnectionTestGroupId = 'local' | 'network'
|
||||
|
||||
/** Display order: everything local first, then everything that leaves the machine. */
|
||||
|
||||
@@ -9,8 +9,12 @@ 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'
|
||||
|
||||
export const CreateMeetingMenu = () => {
|
||||
const { username } = useSnapshot(userStore)
|
||||
|
||||
const { t } = useTranslation('home')
|
||||
const { mutateAsync: createRoom } = useCreateRoom()
|
||||
const [laterRoom, setLaterRoom] = useState<null | ApiRoom>(null)
|
||||
@@ -26,9 +30,9 @@ export const CreateMeetingMenu = () => {
|
||||
className={menuRecipe({ icon: true, variant: 'light' }).item}
|
||||
onAction={() => {
|
||||
const slug = generateRoomId()
|
||||
createRoom({ slug }).then((data) =>
|
||||
createRoom({ slug, username }).then((data) =>
|
||||
navigateTo('room', data.slug, {
|
||||
state: { create: true },
|
||||
state: { create: true, initialRoomData: data },
|
||||
})
|
||||
)
|
||||
}}
|
||||
@@ -41,7 +45,7 @@ export const CreateMeetingMenu = () => {
|
||||
className={menuRecipe({ icon: true, variant: 'light' }).item}
|
||||
onAction={() => {
|
||||
const slug = generateRoomId()
|
||||
createRoom({ slug }).then(setLaterRoom)
|
||||
createRoom({ slug, username }).then(setLaterRoom)
|
||||
}}
|
||||
data-attr="create-option-later"
|
||||
>
|
||||
|
||||
@@ -41,23 +41,18 @@ const Image = styled('img', {
|
||||
const Dot = styled('div', {
|
||||
base: {
|
||||
borderRadius: '50%',
|
||||
borderStyle: 'solid',
|
||||
borderWidth: '1px',
|
||||
boxSizing: 'border-box',
|
||||
display: 'inline-block',
|
||||
height: '.5rem',
|
||||
height: '.375rem',
|
||||
margin: '0 .25rem',
|
||||
width: '.5rem',
|
||||
width: '.375rem',
|
||||
},
|
||||
variants: {
|
||||
selected: {
|
||||
true: {
|
||||
backgroundColor: 'primary.800',
|
||||
borderColor: 'primary.800',
|
||||
},
|
||||
false: {
|
||||
backgroundColor: 'primary.100',
|
||||
borderColor: 'primary.500',
|
||||
backgroundColor: 'primary.300',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Field, Ul, H, P, Form, Dialog } from '@/primitives'
|
||||
import { navigateTo } from '@/navigation/navigateTo'
|
||||
import { extractRoomId } from '@/features/rooms'
|
||||
import { isRoomValid } from '@/features/rooms'
|
||||
|
||||
export const JoinMeetingDialog = () => {
|
||||
const { t } = useTranslation('home')
|
||||
|
||||
const handleSubmit = (data: { roomId?: FormDataEntryValue }) => {
|
||||
const extracted = extractRoomId(data.roomId as string)
|
||||
if (!extracted) return
|
||||
navigateTo('room', `${extracted.roomId}${extracted.suffix}`)
|
||||
const roomId = (data.roomId as string)
|
||||
.trim()
|
||||
.replace(`${window.location.origin}/`, '')
|
||||
navigateTo('room', roomId)
|
||||
}
|
||||
|
||||
const validateRoomId = (value: string) => {
|
||||
const trimmed = value.trim()
|
||||
if (!trimmed) return null
|
||||
return !extractRoomId(trimmed) ? (
|
||||
return !isRoomValid(trimmed) ? (
|
||||
<>
|
||||
<p>{t('joinInputError')}</p>
|
||||
<Ul>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'
|
||||
import { getScrollBarWidth } from '@livekit/components-core'
|
||||
import * as React from 'react'
|
||||
import { TrackLoop } from '@livekit/components-react'
|
||||
import { TrackLoop, useVisualStableUpdate } from '@livekit/components-react'
|
||||
import { useSize } from '@/features/rooms/livekit/hooks/useResizeObserver'
|
||||
import { useCarouselTiles } from '../hooks/useCarouselTiles'
|
||||
import { useSpeakerPromotionTrigger } from '../hooks/useSpeakerPromotionTrigger'
|
||||
|
||||
const MIN_HEIGHT = 130
|
||||
const MIN_WIDTH = 140
|
||||
@@ -25,9 +23,8 @@ export interface CarouselLayoutProps extends React.HTMLAttributes<HTMLMediaEleme
|
||||
* The `CarouselLayout` component displays a list of tracks in a scroll container.
|
||||
* It will display as many tiles as possible and overflow the rest.
|
||||
* @remarks
|
||||
* Tiles are ordered by `useCarouselTiles`: screen shares, new speakers and
|
||||
* raised hands enter at the top, right below the local camera, and the other
|
||||
* tiles keep their order.
|
||||
* To ensure visual stability when tiles are reordered due to track updates,
|
||||
* the component uses the `useVisualStableUpdate` hook.
|
||||
* @example
|
||||
* ```tsx
|
||||
* const tracks = useTracks([Track.Source.Camera]);
|
||||
@@ -69,11 +66,7 @@ export function CarouselLayout({
|
||||
setPrevTiles(tilesThatFit)
|
||||
}
|
||||
|
||||
const sortedTiles = useCarouselTiles(tracks, maxVisibleTiles)
|
||||
// The carousel scrolls, so only the first tiles are guaranteed on screen.
|
||||
useSpeakerPromotionTrigger(sortedTiles.slice(0, maxVisibleTiles), tracks, {
|
||||
raisedHands: true,
|
||||
})
|
||||
const sortedTiles = useVisualStableUpdate(tracks, maxVisibleTiles)
|
||||
|
||||
React.useLayoutEffect(() => {
|
||||
if (asideEl.current) {
|
||||
|
||||
@@ -46,7 +46,7 @@ export function GridLayout({ tracks, ...props }: GridLayoutProps) {
|
||||
|
||||
const { layout } = useGridLayout(gridEl, tracks.length)
|
||||
const pagination = usePagination(layout.maxTiles, tracks)
|
||||
useSpeakerPromotionTrigger(pagination.tracks, tracks)
|
||||
useSpeakerPromotionTrigger(pagination.tracks)
|
||||
|
||||
useSwipe(gridEl, {
|
||||
onLeftSwipe: pagination.nextPage,
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'
|
||||
import { useRef } from 'react'
|
||||
import { orderCarouselTiles } from '../utils/orderCarouselTiles'
|
||||
|
||||
/**
|
||||
* Carousel counterpart of LiveKit's `useVisualStableUpdate`: same sort, same
|
||||
* stable update, but screen shares and new speakers end up at the top. See
|
||||
* `orderCarouselTiles`.
|
||||
*
|
||||
* Like `useVisualStableUpdate`, it only reorders when its host renders.
|
||||
*/
|
||||
export function useCarouselTiles(
|
||||
tracks: TrackReferenceOrPlaceholder[],
|
||||
maxVisibleTiles: number
|
||||
) {
|
||||
const previous = useRef<TrackReferenceOrPlaceholder[]>([])
|
||||
previous.current = orderCarouselTiles(
|
||||
previous.current,
|
||||
tracks,
|
||||
maxVisibleTiles
|
||||
)
|
||||
return previous.current
|
||||
}
|
||||
@@ -8,65 +8,41 @@ import { useEffect, useReducer, useRef } from 'react'
|
||||
* Tripwire for speaker promotion.
|
||||
*
|
||||
* Listens to `RoomEvent.ActiveSpeakersChanged` imperatively and forces ONE
|
||||
* re-render of the host when a speaker has a tile in `allTiles` but none in
|
||||
* `visibleTiles`. That render re-runs the host's tile ordering, which reads
|
||||
* live `participant.isSpeaking` state and performs the actual swap.
|
||||
* re-render of the host component only when an active speaker has none of
|
||||
* their tiles are within the visible span (`maxVisibleTiles`). That render
|
||||
* re-runs `useVisualStableUpdate`, which reads live `participant.isSpeaking`
|
||||
* state and performs the actual swap.
|
||||
*
|
||||
* Speakers already visible cost nothing, nor do speakers the layout doesn't
|
||||
* show at all (e.g. the pinned participant, rendered by the focus view).
|
||||
* Speakers already visible are ignored. Everything else costs zero React work.
|
||||
*
|
||||
* With `raisedHands`, it also trips when a hand goes up or down while a
|
||||
* raised hand is hidden: the hand that just went up, or the next one waiting
|
||||
* for the slot of a hand that went down. Only for hosts whose ordering
|
||||
* promotes raised hands; others would render for nothing.
|
||||
*
|
||||
* Requires the parent to NOT re-render on these events itself, i.e.
|
||||
* Requires the parent to NOT re-render on speaker events itself, i.e.
|
||||
* `useTracks(..., { updateOnlyOn: [] })` upstream.
|
||||
*/
|
||||
export function useSpeakerPromotionTrigger(
|
||||
/** Tiles inside the span the layout guarantees to speakers. */
|
||||
visibleTiles: TrackReferenceOrPlaceholder[],
|
||||
/** Every tile the layout shows, visible or not. */
|
||||
allTiles: TrackReferenceOrPlaceholder[],
|
||||
{ raisedHands = false }: { raisedHands?: boolean } = {}
|
||||
sortedTiles: TrackReferenceOrPlaceholder[]
|
||||
) {
|
||||
const room = useRoomContext()
|
||||
const [, forceRender] = useReducer((n: number) => n + 1, 0)
|
||||
|
||||
// Read by the listeners at event time, so they never re-subscribe.
|
||||
const tilesRef = useRef({ visibleTiles, allTiles })
|
||||
tilesRef.current = { visibleTiles, allTiles }
|
||||
// Refs so the listener reads current values without re-subscribing
|
||||
// and without itself being a render dependency.
|
||||
const tilesRef = useRef(sortedTiles)
|
||||
tilesRef.current = sortedTiles
|
||||
|
||||
useEffect(() => {
|
||||
const renderIfHidden = (participants: Participant[]) => {
|
||||
const { visibleTiles, allTiles } = tilesRef.current
|
||||
const visible = new Set(visibleTiles.map((t) => t.participant.identity))
|
||||
const shown = new Set(allTiles.map((t) => t.participant.identity))
|
||||
const hidden = participants.some(
|
||||
({ identity }) => shown.has(identity) && !visible.has(identity)
|
||||
const onActiveSpeakersChanged = (speakers: Participant[]) => {
|
||||
const tiles = tilesRef.current
|
||||
const hiddenSpeakerExists = speakers.some(
|
||||
(speaker) =>
|
||||
!tiles.some((t) => t.participant.identity === speaker.identity)
|
||||
)
|
||||
if (hidden) {
|
||||
if (hiddenSpeakerExists) {
|
||||
forceRender()
|
||||
}
|
||||
}
|
||||
|
||||
const onAttributesChanged = (changed: Record<string, string>) => {
|
||||
if ('handRaisedAt' in changed) {
|
||||
renderIfHidden(
|
||||
tilesRef.current.allTiles
|
||||
.map((t) => t.participant)
|
||||
.filter((p) => !!p.attributes.handRaisedAt)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
room.on(RoomEvent.ActiveSpeakersChanged, renderIfHidden)
|
||||
if (raisedHands) {
|
||||
room.on(RoomEvent.ParticipantAttributesChanged, onAttributesChanged)
|
||||
}
|
||||
room.on(RoomEvent.ActiveSpeakersChanged, onActiveSpeakersChanged)
|
||||
return () => {
|
||||
room.off(RoomEvent.ActiveSpeakersChanged, renderIfHidden)
|
||||
room.off(RoomEvent.ParticipantAttributesChanged, onAttributesChanged)
|
||||
room.off(RoomEvent.ActiveSpeakersChanged, onActiveSpeakersChanged)
|
||||
}
|
||||
}, [room, raisedHands])
|
||||
}, [room])
|
||||
}
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
import type { TrackReferenceOrPlaceholder } from '@livekit/components-core'
|
||||
import { Track } from 'livekit-client'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { orderCarouselTiles } from './orderCarouselTiles'
|
||||
|
||||
type Tile = TrackReferenceOrPlaceholder
|
||||
|
||||
// Placeholder tiles are enough: the real LiveKit sort and update run on them.
|
||||
const tile = (
|
||||
identity: string,
|
||||
joinedAt: number,
|
||||
{
|
||||
source = Track.Source.Camera,
|
||||
isLocal = false,
|
||||
isSpeaking = false,
|
||||
hasSpoken = isSpeaking,
|
||||
handRaisedAt,
|
||||
}: {
|
||||
source?: Track.Source
|
||||
isLocal?: boolean
|
||||
isSpeaking?: boolean
|
||||
hasSpoken?: boolean
|
||||
handRaisedAt?: string
|
||||
} = {}
|
||||
) =>
|
||||
({
|
||||
participant: {
|
||||
identity,
|
||||
isLocal,
|
||||
isSpeaking,
|
||||
audioLevel: isSpeaking ? 1 : 0,
|
||||
lastSpokeAt: hasSpoken ? new Date(joinedAt) : undefined,
|
||||
joinedAt: new Date(joinedAt),
|
||||
isCameraEnabled: false,
|
||||
attributes: handRaisedAt ? { handRaisedAt } : {},
|
||||
},
|
||||
source,
|
||||
}) as unknown as Tile
|
||||
|
||||
const names = (tiles: Tile[]) =>
|
||||
tiles.map((t) =>
|
||||
t.source === Track.Source.ScreenShare
|
||||
? `${t.participant.identity}:screen`
|
||||
: t.participant.identity
|
||||
)
|
||||
|
||||
const me = tile('me', 0, { isLocal: true })
|
||||
const [a, b, c, d, e] = ['a', 'b', 'c', 'd', 'e'].map((id, i) =>
|
||||
tile(id, i + 1)
|
||||
)
|
||||
const speaking = (t: Tile) =>
|
||||
tile(t.participant.identity, t.participant.joinedAt!.getTime(), {
|
||||
isSpeaking: true,
|
||||
})
|
||||
const quietAgain = (t: Tile) =>
|
||||
tile(t.participant.identity, t.participant.joinedAt!.getTime(), {
|
||||
hasSpoken: true,
|
||||
})
|
||||
const handUp = (t: Tile, minute = 0) =>
|
||||
tile(t.participant.identity, t.participant.joinedAt!.getTime(), {
|
||||
isLocal: t.participant.isLocal,
|
||||
handRaisedAt: new Date(Date.UTC(2026, 0, 1, 10, minute)).toISOString(),
|
||||
})
|
||||
const screenOf = (t: Tile) =>
|
||||
tile(t.participant.identity, t.participant.joinedAt!.getTime(), {
|
||||
source: Track.Source.ScreenShare,
|
||||
})
|
||||
|
||||
describe('orderCarouselTiles', () => {
|
||||
it('follows the LiveKit sort on the first render', () => {
|
||||
expect(names(orderCarouselTiles([], [d, c, b, a, me], 3))).toEqual([
|
||||
'me',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
])
|
||||
})
|
||||
|
||||
it('puts a new speaker right below the local camera', () => {
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d, e], 4)
|
||||
const next = orderCarouselTiles(previous, [me, a, b, c, d, speaking(e)], 4)
|
||||
|
||||
// LiveKit alone would give me, a, b, e: `e` takes the slot of `c`.
|
||||
expect(names(next).slice(0, 4)).toEqual(['me', 'e', 'a', 'b'])
|
||||
})
|
||||
|
||||
it('keeps the order of the tiles that stay visible', () => {
|
||||
let tiles = orderCarouselTiles([], [me, a, b, c, d, e], 4)
|
||||
tiles = orderCarouselTiles(tiles, [me, a, b, c, speaking(d), e], 4)
|
||||
expect(names(tiles).slice(0, 4)).toEqual(['me', 'd', 'a', 'b'])
|
||||
|
||||
// `d` went quiet, `e` speaks: `d` stays ahead of `a`, `b` is evicted.
|
||||
tiles = orderCarouselTiles(
|
||||
tiles,
|
||||
[me, a, b, c, quietAgain(d), speaking(e)],
|
||||
4
|
||||
)
|
||||
expect(names(tiles).slice(0, 4)).toEqual(['me', 'e', 'd', 'a'])
|
||||
})
|
||||
|
||||
it('does not move a visible participant who speaks', () => {
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d], 4)
|
||||
const next = orderCarouselTiles(previous, [me, a, b, speaking(c), d], 4)
|
||||
|
||||
expect(names(next)).toEqual(['me', 'a', 'b', 'c', 'd'])
|
||||
})
|
||||
|
||||
it('keeps screen shares above a new speaker', () => {
|
||||
const previous = orderCarouselTiles([], [me, screenOf(a), a, b, c, d], 4)
|
||||
expect(names(previous).slice(0, 4)).toEqual(['me', 'a:screen', 'a', 'b'])
|
||||
|
||||
const next = orderCarouselTiles(
|
||||
previous,
|
||||
[me, screenOf(a), a, b, c, speaking(d)],
|
||||
4
|
||||
)
|
||||
expect(names(next).slice(0, 4)).toEqual(['me', 'a:screen', 'd', 'a'])
|
||||
})
|
||||
|
||||
it('puts a screen share that starts below the local camera', () => {
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d], 4)
|
||||
const next = orderCarouselTiles(previous, [me, a, b, c, d, screenOf(d)], 4)
|
||||
|
||||
expect(names(next).slice(0, 4)).toEqual(['me', 'd:screen', 'a', 'b'])
|
||||
})
|
||||
|
||||
it('fills the slot of a participant who left without reordering', () => {
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d], 4)
|
||||
const next = orderCarouselTiles(previous, [me, b, c, d], 4)
|
||||
|
||||
expect(names(next)).toEqual(['me', 'd', 'b', 'c'])
|
||||
})
|
||||
|
||||
it('brings a raised hand to the top like a speaker', () => {
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d, e], 4)
|
||||
const next = orderCarouselTiles(previous, [me, a, b, c, d, handUp(e)], 4)
|
||||
|
||||
expect(names(next).slice(0, 4)).toEqual(['me', 'e', 'a', 'b'])
|
||||
})
|
||||
|
||||
it('keeps a raised hand visible when others speak', () => {
|
||||
let tiles = orderCarouselTiles([], [me, a, b, c, d, e], 3)
|
||||
tiles = orderCarouselTiles(tiles, [me, a, b, c, d, handUp(e)], 3)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'e', 'a'])
|
||||
|
||||
// `d` speaks: it evicts `a`, not the raised hand.
|
||||
tiles = orderCarouselTiles(tiles, [me, a, b, c, speaking(d), handUp(e)], 3)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'd', 'e'])
|
||||
})
|
||||
|
||||
it('lets the current speaker in when hands fill the carousel', () => {
|
||||
let tiles = orderCarouselTiles([], [me, handUp(a, 1), handUp(b, 2), c], 3)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'a', 'b'])
|
||||
|
||||
// The last hand raised gives way to the speaker.
|
||||
tiles = orderCarouselTiles(
|
||||
tiles,
|
||||
[me, handUp(a, 1), handUp(b, 2), speaking(c)],
|
||||
3
|
||||
)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'c', 'a'])
|
||||
})
|
||||
|
||||
it('gives the slot of a lowered hand to the next one waiting', () => {
|
||||
let tiles = orderCarouselTiles(
|
||||
[],
|
||||
[me, handUp(a, 1), handUp(b, 2), handUp(c, 3)],
|
||||
3
|
||||
)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'a', 'b'])
|
||||
|
||||
// `a` lowers their hand: `c` was waiting and takes over.
|
||||
tiles = orderCarouselTiles(tiles, [me, a, handUp(b, 2), handUp(c, 3)], 3)
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'c', 'b'])
|
||||
})
|
||||
|
||||
it('shows the first hands raised when there are too many', () => {
|
||||
const tiles = orderCarouselTiles(
|
||||
[],
|
||||
[me, a, handUp(b, 3), handUp(c, 1), handUp(d, 2)],
|
||||
3
|
||||
)
|
||||
|
||||
expect(names(tiles).slice(0, 3)).toEqual(['me', 'c', 'd'])
|
||||
})
|
||||
|
||||
it('keeps the local camera first when the local hand is raised', () => {
|
||||
const tiles = orderCarouselTiles([], [a, screenOf(a), b, handUp(me)], 3)
|
||||
|
||||
expect(names(tiles)).toEqual(['me', 'a:screen', 'a', 'b'])
|
||||
})
|
||||
|
||||
it('is stable when run twice on the same input', () => {
|
||||
const tracks = [me, a, b, c, d, speaking(e)]
|
||||
const previous = orderCarouselTiles([], [me, a, b, c, d, e], 4)
|
||||
|
||||
const once = orderCarouselTiles(previous, tracks, 4)
|
||||
expect(names(orderCarouselTiles(once, tracks, 4))).toEqual(names(once))
|
||||
})
|
||||
})
|
||||
@@ -1,88 +0,0 @@
|
||||
import {
|
||||
log,
|
||||
sortTrackReferences,
|
||||
updatePages,
|
||||
type TrackReferenceOrPlaceholder,
|
||||
} from '@livekit/components-core'
|
||||
import { Track } from 'livekit-client'
|
||||
|
||||
// LiveKit's track reference id changes when a placeholder gets its track;
|
||||
// this key doesn't, so turning a camera on is not seen as a new tile.
|
||||
const keyOf = (tile: TrackReferenceOrPlaceholder) =>
|
||||
`${tile.participant.identity}_${tile.source}`
|
||||
|
||||
/** When the participant raised their hand, if it is still raised. */
|
||||
const handRaisedAt = (tile: TrackReferenceOrPlaceholder) => {
|
||||
if (tile.source !== Track.Source.Camera) return undefined
|
||||
const time = Date.parse(tile.participant.attributes.handRaisedAt ?? '')
|
||||
return Number.isNaN(time) ? undefined : time
|
||||
}
|
||||
|
||||
/**
|
||||
* LiveKit's sort knows nothing about raised hands. This moves them right
|
||||
* after the tiles that must stay ahead (local camera, screen shares, whoever
|
||||
* is speaking now), first raised first, so they are among the first tiles
|
||||
* picked as visible for as long as the hand is up.
|
||||
*/
|
||||
const sortWithRaisedHands = (tracks: TrackReferenceOrPlaceholder[]) => {
|
||||
const rank = (tile: TrackReferenceOrPlaceholder) => {
|
||||
const { isLocal, isSpeaking } = tile.participant
|
||||
if (isLocal || isSpeaking || tile.source === Track.Source.ScreenShare) {
|
||||
return 0
|
||||
}
|
||||
return handRaisedAt(tile) === undefined ? 2 : 1
|
||||
}
|
||||
return sortTrackReferences(tracks).sort((a, b) => {
|
||||
if (rank(a) !== rank(b)) return rank(a) - rank(b)
|
||||
// Equal ranks keep LiveKit's order, except raised hands: first come first.
|
||||
return rank(a) === 1 ? handRaisedAt(a)! - handRaisedAt(b)! : 0
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Orders the carousel tiles; the first `maxVisibleTiles` are the visible ones.
|
||||
*
|
||||
* This is what LiveKit's `useVisualStableUpdate` does, plus one step:
|
||||
* 1. `sortTrackReferences` decides which tiles deserve to be visible, with
|
||||
* raised hands added to it, see `sortWithRaisedHands`;
|
||||
* 2. `updatePages` applies that to the `previous` order with as few moves as
|
||||
* possible: an incoming tile is swapped with the outgoing one;
|
||||
* 3. added here: within the visible tiles, the local camera goes first, then
|
||||
* the screen shares, then the speakers and raised hands that step 2 just
|
||||
* brought in. The other tiles keep the order step 2 gave them.
|
||||
*
|
||||
* Step 2 alone leaves an incoming tile wherever the evicted one happened to
|
||||
* be, often at the bottom of the column.
|
||||
*/
|
||||
export function orderCarouselTiles(
|
||||
previous: TrackReferenceOrPlaceholder[],
|
||||
tracks: TrackReferenceOrPlaceholder[],
|
||||
maxVisibleTiles: number
|
||||
): TrackReferenceOrPlaceholder[] {
|
||||
const sorted = sortWithRaisedHands(tracks)
|
||||
|
||||
let stable = sorted
|
||||
try {
|
||||
stable = updatePages(previous, sorted, maxVisibleTiles)
|
||||
} catch (error) {
|
||||
log.error('Error while running updatePages(): ', error)
|
||||
}
|
||||
|
||||
const previouslyVisible = new Set(
|
||||
previous.slice(0, maxVisibleTiles).map(keyOf)
|
||||
)
|
||||
const rank = (tile: TrackReferenceOrPlaceholder) => {
|
||||
if (tile.source === Track.Source.ScreenShare) return 1
|
||||
if (tile.participant.isLocal) return 0
|
||||
const justCameIn = !previouslyVisible.has(keyOf(tile))
|
||||
const wantsAttention =
|
||||
tile.participant.isSpeaking || handRaisedAt(tile) !== undefined
|
||||
return justCameIn && wantsAttention ? 2 : 3
|
||||
}
|
||||
|
||||
return [
|
||||
// Array.prototype.sort is stable: tiles of equal rank keep their order.
|
||||
...stable.slice(0, maxVisibleTiles).sort((a, b) => rank(a) - rank(b)),
|
||||
...stable.slice(maxVisibleTiles),
|
||||
]
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { useEffect } from 'react'
|
||||
import { notificationsStore } from '@/stores/notifications'
|
||||
import { runWhenIdle } from '@/utils/runWhenIdle'
|
||||
import { loadNotificationSound } from '../notificationSound'
|
||||
|
||||
/**
|
||||
* Fetch and decode the notification sound while the browser is idle, so it
|
||||
* doesn't compete with the room connection and is ready for the first
|
||||
* notification. Meant for screens shown before the meeting, e.g. pre-join.
|
||||
*/
|
||||
export const usePreloadNotificationSound = () => {
|
||||
useEffect(() => {
|
||||
const isAnySoundEnabled = Array.from(
|
||||
notificationsStore.soundNotifications.values()
|
||||
).some(Boolean)
|
||||
const saveData = (navigator as { connection?: { saveData?: boolean } })
|
||||
.connection?.saveData
|
||||
if (!isAnySoundEnabled || saveData) return
|
||||
|
||||
return runWhenIdle(() => {
|
||||
// Best effort: the room loads the sound itself if this fails.
|
||||
loadNotificationSound().catch(() => {})
|
||||
})
|
||||
}, [])
|
||||
}
|
||||
@@ -1,25 +1,24 @@
|
||||
import { useEffect } from 'react'
|
||||
import useSound from 'use-sound'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { notificationsStore } from '@/stores/notifications'
|
||||
import type { NotificationType } from '@/features/notifications/NotificationType'
|
||||
import {
|
||||
loadNotificationSound,
|
||||
playNotificationSound,
|
||||
} from '@/features/notifications/notificationSound'
|
||||
|
||||
// fixme - handle dynamic audio output changes
|
||||
export const useNotificationSound = () => {
|
||||
const notificationsSnap = useSnapshot(notificationsStore)
|
||||
|
||||
useEffect(() => {
|
||||
loadNotificationSound().catch(() => {})
|
||||
}, [])
|
||||
|
||||
const [play] = useSound('/sounds/notifications.mp3', {
|
||||
sprite: {
|
||||
participantJoined: [0, 1150],
|
||||
handRaised: [1400, 180],
|
||||
messageReceived: [1580, 300],
|
||||
participantWaiting: [2039, 710],
|
||||
success: [2740, 1304],
|
||||
},
|
||||
volume: notificationsSnap.soundNotificationVolume,
|
||||
})
|
||||
const triggerNotificationSound = (type: NotificationType) => {
|
||||
const isSoundEnabled = notificationsSnap.soundNotifications.get(type)
|
||||
if (isSoundEnabled) {
|
||||
playNotificationSound(type, notificationsSnap.soundNotificationVolume)
|
||||
}
|
||||
if (isSoundEnabled) play({ id: type })
|
||||
}
|
||||
return { triggerNotificationSound }
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import type { Howl } from 'howler'
|
||||
import type { NotificationType } from './NotificationType'
|
||||
import notificationSoundSrc from '@/assets/sounds/notifications.mp3'
|
||||
|
||||
const NOTIFICATION_SOUND_SPRITE: Record<string, [number, number]> = {
|
||||
participantJoined: [0, 1150],
|
||||
handRaised: [1400, 180],
|
||||
messageReceived: [1580, 300],
|
||||
participantWaiting: [2039, 710],
|
||||
success: [2740, 1304],
|
||||
}
|
||||
|
||||
let howl: Howl | undefined
|
||||
let howlPromise: Promise<Howl> | undefined
|
||||
|
||||
/**
|
||||
* Lazily load howler and the notification sound sprite.
|
||||
*
|
||||
* The Howl instance is shared by every consumer: whoever calls first triggers
|
||||
* the (single) download and decoding of the file, later calls reuse it. It can
|
||||
* thus be called ahead of time, e.g. from the pre-join screen, so the sound is
|
||||
* ready before the first notification of the meeting.
|
||||
*/
|
||||
export const loadNotificationSound = (): Promise<Howl> => {
|
||||
if (!howlPromise) {
|
||||
howlPromise = import('howler')
|
||||
.then(
|
||||
({ Howl }) =>
|
||||
new Promise<Howl>((resolve, reject) => {
|
||||
const instance = new Howl({
|
||||
src: [notificationSoundSrc],
|
||||
// The extension is kept by the build, but don't rely on it.
|
||||
format: ['mp3'],
|
||||
sprite: NOTIFICATION_SOUND_SPRITE,
|
||||
onload: () => {
|
||||
howl = instance
|
||||
resolve(instance)
|
||||
},
|
||||
onloaderror: (_id, error) => {
|
||||
instance.unload()
|
||||
reject(new Error(`Notification sound failed to load: ${error}`))
|
||||
},
|
||||
})
|
||||
})
|
||||
)
|
||||
.catch((error) => {
|
||||
// Let a later call retry.
|
||||
howlPromise = undefined
|
||||
throw error
|
||||
})
|
||||
}
|
||||
return howlPromise
|
||||
}
|
||||
|
||||
/**
|
||||
* Play a notification sound, if the sprite is already loaded. A sound which
|
||||
* isn't ready is skipped rather than played late.
|
||||
*/
|
||||
export const playNotificationSound = (
|
||||
type: NotificationType,
|
||||
volume: number
|
||||
) => {
|
||||
if (!howl) return
|
||||
howl.volume(volume)
|
||||
howl.play(type)
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
|
||||
import { useEffectsPreload } from '@/features/rooms/livekit/hooks/useEffectsPreload'
|
||||
import { Button } from '@/primitives'
|
||||
import { RiImageCircleAiFill } from '@remixicon/react'
|
||||
|
||||
export const EffectsButton = React.memo(() => {
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'participantTileFocus' })
|
||||
const { isEffectsOpen, toggleEffects } = useSidePanel()
|
||||
const { hoverProps, focusProps } = useEffectsPreload()
|
||||
return (
|
||||
<Button
|
||||
{...hoverProps}
|
||||
{...focusProps}
|
||||
size={'sm'}
|
||||
variant={'primaryTextDark'}
|
||||
square
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Div, Text } from '@/primitives'
|
||||
import { Button, Div, H, Text } from '@/primitives'
|
||||
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useRoomId } from '@/features/rooms/livekit/hooks/useRoomId'
|
||||
@@ -189,9 +189,9 @@ export const ScreenRecordingSidePanel = () => {
|
||||
})}
|
||||
/>
|
||||
<VStack gap={0} marginBottom={15}>
|
||||
<Text as="h2" variant="h1" margin="sm" fullWidth>
|
||||
<H lvl={1} margin={'sm'} fullWidth>
|
||||
{t('heading')}
|
||||
</Text>
|
||||
</H>
|
||||
<LimitDescription
|
||||
keyPrefix={'screenRecording'}
|
||||
supportArticleLink={data?.support?.help_article_recording}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { A, Button, Div, Text } from '@/primitives'
|
||||
import { A, Button, Div, H, Text } from '@/primitives'
|
||||
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useRoomId } from '@/features/rooms/livekit/hooks/useRoomId'
|
||||
@@ -203,9 +203,9 @@ export const TranscriptSidePanel = () => {
|
||||
})}
|
||||
/>
|
||||
<VStack gap={0} marginBottom={15}>
|
||||
<Text as="h2" variant="h1" margin="sm" fullWidth>
|
||||
<H lvl={1} margin={'sm'}>
|
||||
{t('heading')}
|
||||
</Text>
|
||||
</H>
|
||||
<LimitDescription
|
||||
keyPrefix={'transcript'}
|
||||
supportArticleLink={data?.support?.help_article_transcript}
|
||||
@@ -240,9 +240,6 @@ export const TranscriptSidePanel = () => {
|
||||
<Button
|
||||
variant="text"
|
||||
size="xs"
|
||||
aria-label={t('details.languageAriaLabel', {
|
||||
language: selectedLanguageLabel,
|
||||
})}
|
||||
onPress={() =>
|
||||
openSettingsDialog(SettingsDialogExtendedKey.TRANSCRIPTION)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
|
||||
import { useFeatureFlagEnabled } from 'posthog-js/react'
|
||||
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
|
||||
import type { RecordingMode } from '../types'
|
||||
import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
|
||||
import { useFeatureFlagEnabled } from 'posthog-js/react'
|
||||
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
|
||||
import type { RecordingMode } from '../types'
|
||||
import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
|
||||
import { useFeatureFlagEnabled } from 'posthog-js/react'
|
||||
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
|
||||
import { FeatureFlags } from '@/features/analytics/enums'
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ export type ApiRoom = {
|
||||
name: string
|
||||
slug: string
|
||||
pin_code?: string
|
||||
is_administrable: boolean
|
||||
access_level: ApiAccessLevel
|
||||
livekit?: ApiLiveKit
|
||||
configuration?: RoomConfiguration
|
||||
|
||||
@@ -6,13 +6,15 @@ import type { ApiRoom } from './ApiRoom'
|
||||
export interface CreateRoomParams {
|
||||
slug: string
|
||||
callbackId?: string
|
||||
username?: string
|
||||
}
|
||||
|
||||
const createRoom = ({
|
||||
slug,
|
||||
callbackId,
|
||||
username = '',
|
||||
}: CreateRoomParams): Promise<ApiRoom> => {
|
||||
return fetchApi('rooms/', {
|
||||
return fetchApi(`rooms/?username=${encodeURIComponent(username)}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
name: slug,
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { type ApiRoom } from './ApiRoom'
|
||||
import { fetchApi } from '@/api/fetchApi'
|
||||
|
||||
export const fetchRoom = ({ roomId }: { roomId: string }) => {
|
||||
return fetchApi<ApiRoom>(`/rooms/${roomId}/`)
|
||||
export const fetchRoom = ({
|
||||
roomId,
|
||||
username,
|
||||
}: {
|
||||
roomId: string
|
||||
username?: string
|
||||
}) => {
|
||||
const query = username ? `?username=${encodeURIComponent(username)}` : ''
|
||||
|
||||
return fetchApi<ApiRoom>(`/rooms/${roomId}/${query}`)
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { type ApiRoom } from './ApiRoom'
|
||||
import { fetchApi } from '@/api/fetchApi'
|
||||
|
||||
export type JoinRoomParams = {
|
||||
roomId: string
|
||||
username?: string
|
||||
}
|
||||
|
||||
export const joinRoom = ({ roomId, username }: JoinRoomParams) => {
|
||||
return fetchApi<ApiRoom>(`/rooms/${roomId}/join/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ username }),
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
@@ -10,16 +10,17 @@ import {
|
||||
ConnectionErrorReason,
|
||||
DisconnectReason,
|
||||
MediaDeviceFailure,
|
||||
type Room,
|
||||
type RoomOptions,
|
||||
VideoPresets,
|
||||
} from 'livekit-client'
|
||||
import { getMediaDeviceFailure } from '@/features/rooms/livekit/utils/mediaPermissions'
|
||||
import { keys } from '@/api/queryKeys'
|
||||
import { queryClient } from '@/api/queryClient'
|
||||
import { Screen } from '@/layout/Screen'
|
||||
import { QueryAware } from '@/components/QueryAware'
|
||||
import { ErrorScreen } from '@/components/ErrorScreen'
|
||||
import { joinRoom } from '../api/joinRoom'
|
||||
import { fetchRoom } from '../api/fetchRoom'
|
||||
import type { ApiRoom } from '../api/ApiRoom'
|
||||
import { useCreateRoom } from '../api/createRoom'
|
||||
import { InviteDialog } from './InviteDialog'
|
||||
import { VideoConference } from '../livekit/prefabs/VideoConference'
|
||||
@@ -31,7 +32,7 @@ import {
|
||||
captureMediaEvent,
|
||||
reportError,
|
||||
} from '@/features/analytics/telemetry'
|
||||
import { type ApiConfig, useConfig } from '@/api/useConfig'
|
||||
import { useConfig } from '@/api/useConfig'
|
||||
import { isFireFox } from '@/utils/livekit'
|
||||
import { useIsMobile } from '@/utils/useIsMobile'
|
||||
import { navigateTo } from '@/navigation/navigateTo'
|
||||
@@ -47,13 +48,6 @@ import { resolveAudioOutputDeviceId } from '@/features/rooms/utils/resolveAudioO
|
||||
import { ConnectionEndReason } from '@/features/rooms/utils/connectionEndReason'
|
||||
import { createLiveKitRoom } from '@/features/rooms/livekit/utils/reconnectPolicy'
|
||||
|
||||
// Some clients (like DINUM) operate in bandwidth-constrained environments
|
||||
// These settings help ensure successful connections in poor network conditions
|
||||
const connectOptions = {
|
||||
maxRetries: 5, // Default: 1. Only for unreachable server scenarios
|
||||
peerConnectionTimeout: 60000, // Default: 15s. Extended for slow TURN/TLS negotiation
|
||||
}
|
||||
|
||||
const handleError = (e: Error) => {
|
||||
const failure = getMediaDeviceFailure(e)
|
||||
if (failure && failure !== MediaDeviceFailure.Other) return
|
||||
@@ -72,111 +66,65 @@ const handleError = (e: Error) => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Warm up connection to LiveKit server before joining room
|
||||
* This prefetch helps reduce initial connection latency by establishing
|
||||
* an early HTTP connection to the WebRTC signaling server
|
||||
*
|
||||
* It should cache DNS and TLS keys.
|
||||
*/
|
||||
const warmUpConnection = async (room: Room, livekit: ApiConfig['livekit']) => {
|
||||
await room.prepareConnection(livekit.url)
|
||||
|
||||
if (isFireFox() && livekit.enable_firefox_proxy_workaround) {
|
||||
try {
|
||||
const wssUrl =
|
||||
livekit.url.replace('https://', 'wss://').replace(/\/$/, '') + '/rtc'
|
||||
|
||||
/**
|
||||
* FIREFOX + PROXY WORKAROUND:
|
||||
*
|
||||
* Issue: On Firefox behind proxy configurations, WebSocket signaling fails to establish.
|
||||
* Symptom: Client receives HTTP 200 instead of expected 101 (Switching Protocols).
|
||||
* Root Cause: Certificate/security issue where the initial request is considered insecure.
|
||||
*
|
||||
* Solution: Pre-establish a WebSocket connection to the signaling server, which fails.
|
||||
* This "primes" the connection, allowing subsequent WebSocket establishments to work correctly.
|
||||
*
|
||||
* Note: This issue is reproducible on LiveKit's demo app.
|
||||
* Reference: livekit-examples/meet/issues/466
|
||||
*/
|
||||
const ws = new WebSocket(wssUrl)
|
||||
// 401 unauthorized response is expected
|
||||
ws.onerror = () => ws.readyState <= 1 && ws.close()
|
||||
} catch (e) {
|
||||
console.debug('Firefox WebSocket workaround failed.', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getConnectionEndReason = (
|
||||
reason: DisconnectReason | undefined,
|
||||
hasConnected: boolean
|
||||
) => {
|
||||
switch (reason) {
|
||||
case DisconnectReason.CLIENT_INITIATED:
|
||||
return undefined
|
||||
case DisconnectReason.DUPLICATE_IDENTITY:
|
||||
case DisconnectReason.PARTICIPANT_REMOVED:
|
||||
case DisconnectReason.ROOM_DELETED:
|
||||
return reason
|
||||
default:
|
||||
// Reconnecting gave up, or the join itself failed
|
||||
return hasConnected
|
||||
? ConnectionEndReason.Lost
|
||||
: ConnectionEndReason.Failed
|
||||
}
|
||||
}
|
||||
|
||||
export const Conference = ({
|
||||
roomId,
|
||||
initialRoomData,
|
||||
mode = 'join',
|
||||
onLobbyRequired,
|
||||
}: {
|
||||
roomId: string
|
||||
mode?: 'join' | 'create'
|
||||
onLobbyRequired: () => void
|
||||
initialRoomData?: ApiRoom
|
||||
}) => {
|
||||
const { t } = useTranslation('rooms')
|
||||
const { data: apiConfig } = useConfig()
|
||||
|
||||
const { userChoices: userConfig } = usePersistentUserChoices() as {
|
||||
userChoices: LocalUserChoices
|
||||
}
|
||||
|
||||
const { username } = useSnapshot(userStore)
|
||||
const userPreferencesSnap = useSnapshot(userPreferencesStore)
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const [hasJoined, setHasJoined] = useState(false)
|
||||
useEffect(() => {
|
||||
void captureMediaEvent('visit-room', { slug: roomId })
|
||||
}, [roomId])
|
||||
const fetchKey = [keys.room, roomId]
|
||||
|
||||
const [isConnectionWarmedUp, setIsConnectionWarmedUp] = useState(false)
|
||||
const hasAutoMutedRef = useRef(false)
|
||||
const hasConnectedRef = useRef(false)
|
||||
|
||||
const { mutateAsync: createRoom, isError: isCreateError } = useCreateRoom()
|
||||
const userPreferencesSnap = useSnapshot(userPreferencesStore)
|
||||
|
||||
const {
|
||||
mutateAsync: createRoom,
|
||||
status: createStatus,
|
||||
isError: isCreateError,
|
||||
} = useCreateRoom({
|
||||
onSuccess: (data) => {
|
||||
queryClient.setQueryData(fetchKey, data)
|
||||
},
|
||||
})
|
||||
|
||||
const {
|
||||
status: fetchStatus,
|
||||
isError: isFetchError,
|
||||
error: fetchError,
|
||||
data: createRoomData,
|
||||
data,
|
||||
} = useQuery({
|
||||
queryKey: [keys.room, roomId],
|
||||
queryKey: fetchKey,
|
||||
staleTime: 6 * 60 * 60 * 1000, // By default, LiveKit access tokens expire 6 hours after generation
|
||||
initialData: initialRoomData,
|
||||
queryFn: () =>
|
||||
joinRoom({ roomId, username }).catch(async (error) => {
|
||||
if (error.statusCode != 404) throw error
|
||||
await createRoom({ slug: roomId })
|
||||
return joinRoom({ roomId, username })
|
||||
fetchRoom({
|
||||
roomId: roomId as string,
|
||||
username: username,
|
||||
}).catch((error) => {
|
||||
if (error.statusCode == '404') {
|
||||
createRoom({ slug: roomId, username })
|
||||
}
|
||||
// A deleted room can't be recreated, surface the error instead
|
||||
if (error.statusCode == '410') throw error
|
||||
}),
|
||||
retry: false,
|
||||
})
|
||||
|
||||
const isLobbyRequired =
|
||||
!!createRoomData && !createRoomData.livekit && !hasJoined
|
||||
const status =
|
||||
createRoomData?.livekit || hasJoined
|
||||
? 'success'
|
||||
: isLobbyRequired
|
||||
? 'pending'
|
||||
: fetchStatus
|
||||
|
||||
const roomOptions = useMemo((): RoomOptions => {
|
||||
return {
|
||||
adaptiveStream: true,
|
||||
@@ -207,11 +155,62 @@ export const Conference = ({
|
||||
apiConfig?.livekit.default_video_codec,
|
||||
])
|
||||
|
||||
const reconnect = apiConfig?.livekit.reconnect
|
||||
const room = useMemo(
|
||||
() => createLiveKitRoom(roomOptions, apiConfig?.livekit.reconnect),
|
||||
[roomOptions, apiConfig?.livekit.reconnect]
|
||||
() => createLiveKitRoom(roomOptions, reconnect),
|
||||
[roomOptions, reconnect]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
/**
|
||||
* Warm up connection to LiveKit server before joining room
|
||||
* This prefetch helps reduce initial connection latency by establishing
|
||||
* an early HTTP connection to the WebRTC signaling server
|
||||
*
|
||||
* It should cache DNS and TLS keys.
|
||||
*/
|
||||
const prepareConnection = async () => {
|
||||
if (!apiConfig || isConnectionWarmedUp) return
|
||||
await room.prepareConnection(apiConfig.livekit.url)
|
||||
|
||||
if (isFireFox() && apiConfig.livekit.enable_firefox_proxy_workaround) {
|
||||
try {
|
||||
const wssUrl =
|
||||
apiConfig.livekit.url
|
||||
.replace('https://', 'wss://')
|
||||
.replace(/\/$/, '') + '/rtc'
|
||||
|
||||
/**
|
||||
* FIREFOX + PROXY WORKAROUND:
|
||||
*
|
||||
* Issue: On Firefox behind proxy configurations, WebSocket signaling fails to establish.
|
||||
* Symptom: Client receives HTTP 200 instead of expected 101 (Switching Protocols).
|
||||
* Root Cause: Certificate/security issue where the initial request is considered insecure.
|
||||
*
|
||||
* Solution: Pre-establish a WebSocket connection to the signaling server, which fails.
|
||||
* This "primes" the connection, allowing subsequent WebSocket establishments to work correctly.
|
||||
*
|
||||
* Note: This issue is reproducible on LiveKit's demo app.
|
||||
* Reference: livekit-examples/meet/issues/466
|
||||
*/
|
||||
const ws = new WebSocket(wssUrl)
|
||||
// 401 unauthorized response is expected
|
||||
ws.onerror = () => ws.readyState <= 1 && ws.close()
|
||||
} catch (e) {
|
||||
console.debug('Firefox WebSocket workaround failed.', e)
|
||||
}
|
||||
}
|
||||
|
||||
setIsConnectionWarmedUp(true)
|
||||
}
|
||||
prepareConnection()
|
||||
}, [room, apiConfig, isConnectionWarmedUp])
|
||||
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const hasAutoMutedRef = useRef(false)
|
||||
const hasConnectedRef = useRef(false)
|
||||
|
||||
/*
|
||||
* Ensure stable WebSocket connection URL. This is critical for legacy browser compatibility
|
||||
* (Firefox <124, Chrome <125, Edge <125) where HTTPS URLs in WebSocket() constructor
|
||||
@@ -226,61 +225,7 @@ export const Conference = ({
|
||||
return livekit_url
|
||||
}, [apiConfig?.livekit])
|
||||
|
||||
const handleConnected = useCallback(async () => {
|
||||
hasConnectedRef.current = true
|
||||
if (!apiConfig) return
|
||||
if (
|
||||
userPreferencesSnap.is_auto_mute_large_room_enabled &&
|
||||
!hasAutoMutedRef.current &&
|
||||
userConfig.audioEnabled &&
|
||||
room.numParticipants > apiConfig.auto_mute_on_join_threshold
|
||||
) {
|
||||
hasAutoMutedRef.current = true
|
||||
await room.localParticipant.setMicrophoneEnabled(false)
|
||||
notifyAutoMutedOnJoin()
|
||||
}
|
||||
}, [
|
||||
apiConfig,
|
||||
room,
|
||||
userConfig.audioEnabled,
|
||||
userPreferencesSnap.is_auto_mute_large_room_enabled,
|
||||
])
|
||||
|
||||
const handleDisconnected = useCallback(
|
||||
(reason?: DisconnectReason) => {
|
||||
navigateTo(
|
||||
'feedback',
|
||||
{},
|
||||
{
|
||||
state: {
|
||||
reason: getConnectionEndReason(reason, hasConnectedRef.current),
|
||||
room_id: roomId,
|
||||
},
|
||||
}
|
||||
)
|
||||
},
|
||||
[roomId]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
void captureMediaEvent('visit-room', { slug: roomId })
|
||||
}, [roomId])
|
||||
|
||||
useEffect(() => {
|
||||
if (createRoomData?.livekit) setHasJoined(true)
|
||||
}, [createRoomData?.livekit])
|
||||
|
||||
useEffect(() => {
|
||||
if (isLobbyRequired) onLobbyRequired()
|
||||
}, [isLobbyRequired, onLobbyRequired])
|
||||
|
||||
useEffect(() => {
|
||||
if (!apiConfig || isConnectionWarmedUp) return
|
||||
warmUpConnection(room, apiConfig.livekit).then(() =>
|
||||
setIsConnectionWarmedUp(true)
|
||||
)
|
||||
}, [room, apiConfig, isConnectionWarmedUp])
|
||||
|
||||
const { t } = useTranslation('rooms')
|
||||
if (fetchError?.statusCode == 410) {
|
||||
return (
|
||||
<ErrorScreen
|
||||
@@ -300,13 +245,20 @@ export const Conference = ({
|
||||
)
|
||||
}
|
||||
|
||||
// Some clients (like DINUM) operate in bandwidth-constrained environments
|
||||
// These settings help ensure successful connections in poor network conditions
|
||||
const connectOptions = {
|
||||
maxRetries: 5, // Default: 1. Only for unreachable server scenarios
|
||||
peerConnectionTimeout: 60000, // Default: 15s. Extended for slow TURN/TLS negotiation
|
||||
}
|
||||
|
||||
return (
|
||||
<QueryAware status={status}>
|
||||
<QueryAware status={isFetchError ? createStatus : fetchStatus}>
|
||||
<Screen header={false} footer={false}>
|
||||
<LiveKitRoom
|
||||
room={room}
|
||||
serverUrl={serverUrl}
|
||||
token={createRoomData?.livekit?.token}
|
||||
token={data?.livekit?.token}
|
||||
connect={isConnectionWarmedUp}
|
||||
audio={userConfig.audioEnabled}
|
||||
video={
|
||||
@@ -321,8 +273,65 @@ export const Conference = ({
|
||||
backgroundColor: 'primaryDark.50 !important',
|
||||
})}
|
||||
onError={handleError}
|
||||
onConnected={handleConnected}
|
||||
onDisconnected={handleDisconnected}
|
||||
onConnected={async () => {
|
||||
hasConnectedRef.current = true
|
||||
if (!apiConfig) return
|
||||
if (
|
||||
userPreferencesSnap.is_auto_mute_large_room_enabled &&
|
||||
!hasAutoMutedRef.current &&
|
||||
userConfig.audioEnabled &&
|
||||
room.numParticipants > apiConfig.auto_mute_on_join_threshold
|
||||
) {
|
||||
hasAutoMutedRef.current = true
|
||||
await room.localParticipant.setMicrophoneEnabled(false)
|
||||
notifyAutoMutedOnJoin()
|
||||
}
|
||||
}}
|
||||
onDisconnected={(e) => {
|
||||
const metadata = {
|
||||
room_id: roomId,
|
||||
}
|
||||
|
||||
switch (e) {
|
||||
case DisconnectReason.CLIENT_INITIATED:
|
||||
navigateTo(
|
||||
'feedback',
|
||||
{},
|
||||
{
|
||||
state: { ...metadata },
|
||||
}
|
||||
)
|
||||
return
|
||||
case DisconnectReason.DUPLICATE_IDENTITY:
|
||||
case DisconnectReason.PARTICIPANT_REMOVED:
|
||||
case DisconnectReason.ROOM_DELETED:
|
||||
navigateTo(
|
||||
'feedback',
|
||||
{},
|
||||
{
|
||||
state: {
|
||||
reason: e,
|
||||
...metadata,
|
||||
},
|
||||
}
|
||||
)
|
||||
return
|
||||
default:
|
||||
// Reconnecting gave up, or the join itself failed
|
||||
navigateTo(
|
||||
'feedback',
|
||||
{},
|
||||
{
|
||||
state: {
|
||||
reason: hasConnectedRef.current
|
||||
? ConnectionEndReason.Lost
|
||||
: ConnectionEndReason.Failed,
|
||||
...metadata,
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<WatchMediaDeviceErrors />
|
||||
<VideoConference />
|
||||
|
||||
@@ -10,16 +10,13 @@ import {
|
||||
RiFileCopyLine,
|
||||
RiSpam2Fill,
|
||||
} from '@remixicon/react'
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { useRoomData } from '@/features/rooms/livekit/hooks/useRoomData'
|
||||
import { ApiAccessLevel } from '@/features/rooms/api/ApiRoom'
|
||||
import { useTelephony } from '@/features/rooms/livekit/hooks/useTelephony'
|
||||
import { formatPinCode } from '@/features/rooms/utils/telephony'
|
||||
import { useCopyRoomToClipboard } from '@/features/rooms/livekit/hooks/useCopyRoomToClipboard'
|
||||
import { useEscapeToClose } from '@/hooks/useEscapeToClose'
|
||||
import { getFirstControlBarFocusable } from '@/utils/dom'
|
||||
import { CONTROL_BAR_REGION_ID } from '@/features/layout/components/ControlBarRegion'
|
||||
|
||||
// fixme - extract in a proper primitive this dialog without overlay
|
||||
const StyledRACDialog = styled(Dialog, {
|
||||
@@ -67,20 +64,9 @@ export const InviteDialog = ({ mode }: { mode: 'join' | 'create' }) => {
|
||||
copyRoomUrlToClipboard,
|
||||
} = useCopyRoomToClipboard(roomData)
|
||||
|
||||
const dialogRef = useRef<HTMLElement>(null)
|
||||
|
||||
const dismiss = () => {
|
||||
// The dialog opens on its own when joining, so there is no trigger to
|
||||
// restore focus to: move it to the control bar instead of body.
|
||||
getFirstControlBarFocusable(CONTROL_BAR_REGION_ID)?.focus()
|
||||
setIsDismissed(true)
|
||||
}
|
||||
|
||||
useEscapeToClose(showInviteDialog, dialogRef, dismiss)
|
||||
|
||||
if (!showInviteDialog) return null
|
||||
return (
|
||||
<StyledRACDialog ref={dialogRef}>
|
||||
<StyledRACDialog>
|
||||
<VStack
|
||||
alignItems="left"
|
||||
justify="start"
|
||||
@@ -95,7 +81,9 @@ export const InviteDialog = ({ mode }: { mode: 'join' | 'create' }) => {
|
||||
invisible
|
||||
variant="tertiaryText"
|
||||
size="xs"
|
||||
onPress={dismiss}
|
||||
onPress={() => {
|
||||
setIsDismissed(true)
|
||||
}}
|
||||
aria-label={t('closeDialog')}
|
||||
>
|
||||
<RiCloseLine />
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
import { SelectDevice } from '../livekit/components/controls/Device/SelectDevice'
|
||||
import { ToggleDevice } from '../livekit/components/controls/Device/ToggleDevice'
|
||||
import { BackgroundProcessorFactory } from '../livekit/components/blur'
|
||||
import { useEffectsPreload } from '../livekit/hooks/useEffectsPreload'
|
||||
import { Lobby } from './Lobby'
|
||||
import { openPermissionsDialog } from '@/stores/permissions'
|
||||
import { isSafari } from '@/utils/livekit'
|
||||
@@ -34,7 +33,6 @@ import { useDeviceMissing } from '../livekit/hooks/useDeviceMissing'
|
||||
import { useJoinTracks } from '../livekit/hooks/useJoinTracks'
|
||||
import { SilentMicDetector } from './SilentMicDetector'
|
||||
import { type PreviewTrack, toggleTrack } from '../utils/toggleTrack'
|
||||
import { usePreloadNotificationSound } from '@/features/notifications/hooks/usePreloadNotificationSound'
|
||||
|
||||
const styles = {
|
||||
page: css({
|
||||
@@ -274,7 +272,6 @@ const Effects = ({
|
||||
}: Pick<EffectsConfigurationProps, 'videoTrack'>) => {
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'join.effects' })
|
||||
const [isDialogOpen, setIsDialogOpen] = useState(false)
|
||||
const { hoverProps, focusProps } = useEffectsPreload()
|
||||
|
||||
if (!BackgroundProcessorFactory.isSupported() || isMobileBrowser()) {
|
||||
return null
|
||||
@@ -302,8 +299,6 @@ const Effects = ({
|
||||
onPress={() => setIsDialogOpen(true)}
|
||||
tooltip={t('description')}
|
||||
aria-label={t('description')}
|
||||
{...hoverProps}
|
||||
{...focusProps}
|
||||
>
|
||||
<RiImageCircleAiFill size={24} />
|
||||
</Button>
|
||||
@@ -463,7 +458,6 @@ export const Join = ({
|
||||
roomId: string
|
||||
}) => {
|
||||
const { audioTrack, videoTrack } = useJoinTracks()
|
||||
usePreloadNotificationSound()
|
||||
|
||||
return (
|
||||
<Screen footer={false}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type ReactNode } from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useSnapshot } from 'valtio'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { VStack } from '@/styled-system/jsx'
|
||||
@@ -10,40 +10,15 @@ import { Form, Text } from '@/primitives'
|
||||
import { Spinner } from '@/primitives/Spinner'
|
||||
import { keys } from '@/api/queryKeys'
|
||||
import { queryClient } from '@/api/queryClient'
|
||||
import type { ApiError } from '@/api/ApiError'
|
||||
import { useLoginHint } from '@/hooks/useLoginHint'
|
||||
import { useUser } from '@/features/auth/api/useUser'
|
||||
import { useConfig } from '@/api/useConfig'
|
||||
import { saveUsername, userStore } from '@/stores/user'
|
||||
import { joinRoom, type JoinRoomParams } from '../api/joinRoom'
|
||||
import { ApiAccessLevel, type ApiRoom } from '../api/ApiRoom'
|
||||
import { ApiLobbyStatus } from '../api/requestEntry'
|
||||
import { fetchRoom } from '../api/fetchRoom'
|
||||
import { ApiAccessLevel } from '../api/ApiRoom'
|
||||
import { ApiLobbyStatus, type ApiRequestEntry } from '../api/requestEntry'
|
||||
import { useLobby } from '../hooks/useLobby'
|
||||
|
||||
const LobbyMessage = ({
|
||||
title,
|
||||
body,
|
||||
children,
|
||||
}: {
|
||||
title: string
|
||||
body: string
|
||||
children?: ReactNode
|
||||
}) => (
|
||||
<VStack alignItems="center" textAlign="center">
|
||||
<H lvl={1} margin={false} centered>
|
||||
{title}
|
||||
</H>
|
||||
<Text
|
||||
as="p"
|
||||
variant="note"
|
||||
className={children ? css({ marginBottom: '1.5rem' }) : undefined}
|
||||
>
|
||||
{body}
|
||||
</Text>
|
||||
{children}
|
||||
</VStack>
|
||||
)
|
||||
|
||||
export const Lobby = ({
|
||||
roomId,
|
||||
enterRoom,
|
||||
@@ -52,92 +27,124 @@ export const Lobby = ({
|
||||
enterRoom: () => void
|
||||
}) => {
|
||||
const { t } = useTranslation('rooms', { keyPrefix: 'join' })
|
||||
|
||||
const { data: configData } = useConfig()
|
||||
const { isLoggedIn, user } = useUser()
|
||||
const { username } = useSnapshot(userStore)
|
||||
const { openLoginHint } = useLoginHint()
|
||||
|
||||
const displayName = username || user?.full_name
|
||||
|
||||
// Join strategy:
|
||||
// 1. Submitting the form asks to join the room, which checks access
|
||||
// 2. The response is written to the [keys.room] cache entry, which
|
||||
// Conference reuses without refetching. It holds the LiveKit credentials
|
||||
// when the user may bypass the lobby
|
||||
// 3. Otherwise the user waits in the lobby, and the credentials returned
|
||||
// once accepted are added to it
|
||||
// Room data strategy:
|
||||
// 1. Initial fetch is performed to check access and get LiveKit configuration
|
||||
// 2. Data remains valid for 6 hours to avoid unnecessary refetches
|
||||
// 3. State is manually updated via queryClient when a waiting participant is accepted
|
||||
// 4. No automatic refetching or revalidation occurs during this period
|
||||
const {
|
||||
mutate: join,
|
||||
data: roomData,
|
||||
error,
|
||||
isError,
|
||||
} = useMutation<ApiRoom, ApiError, JoinRoomParams>({
|
||||
mutationFn: joinRoom,
|
||||
onSuccess: (room) => {
|
||||
queryClient.setQueryData([keys.room, roomId], room)
|
||||
},
|
||||
onError: ({ statusCode }) => {
|
||||
// The room component will handle the room creation if the user is authenticated
|
||||
if (statusCode == 404) enterRoom()
|
||||
},
|
||||
refetch: refetchRoom,
|
||||
} = useQuery({
|
||||
queryKey: [keys.room, roomId],
|
||||
queryFn: () => fetchRoom({ roomId, username: username || user?.full_name }),
|
||||
staleTime: 6 * 60 * 60 * 1000, // By default, LiveKit access tokens expire 6 hours after generation
|
||||
retry: false,
|
||||
enabled: false,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (isError && error?.statusCode == 404) {
|
||||
// The room component will handle the room creation if the user is authenticated
|
||||
enterRoom()
|
||||
}
|
||||
}, [isError, error, enterRoom])
|
||||
|
||||
const handleAccepted = (response: ApiRequestEntry) => {
|
||||
queryClient.setQueryData([keys.room, roomId], {
|
||||
...roomData,
|
||||
livekit: response.livekit,
|
||||
})
|
||||
enterRoom()
|
||||
}
|
||||
|
||||
const { status, startWaiting } = useLobby({
|
||||
roomId,
|
||||
username: displayName || 'anonymous',
|
||||
onAccepted: (response) => {
|
||||
queryClient.setQueryData([keys.room, roomId], {
|
||||
...roomData,
|
||||
livekit: response.livekit,
|
||||
})
|
||||
enterRoom()
|
||||
},
|
||||
username: username || user?.full_name || 'anonymous',
|
||||
onAccepted: handleAccepted,
|
||||
})
|
||||
|
||||
const { openLoginHint } = useLoginHint()
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const { data, error } = await refetchRoom()
|
||||
|
||||
if (error?.statusCode == 410) return
|
||||
|
||||
if (!data?.livekit) {
|
||||
// Display a message to inform the user that by logging in, they won't have to wait for room entry approval.
|
||||
if (data?.access_level == ApiAccessLevel.TRUSTED) {
|
||||
openLoginHint()
|
||||
}
|
||||
startWaiting()
|
||||
return
|
||||
}
|
||||
|
||||
enterRoom()
|
||||
}
|
||||
|
||||
const isRoomDeleted = isError && error?.statusCode == 410
|
||||
const lobbyStatus = isRoomDeleted ? ApiLobbyStatus.DELETED : status
|
||||
const hasJoinFailed = isError && !isRoomDeleted && error?.statusCode != 404
|
||||
|
||||
const handleSubmit = () => {
|
||||
join(
|
||||
{ roomId, username: displayName || undefined },
|
||||
{
|
||||
onSuccess: (data) => {
|
||||
if (data.livekit) {
|
||||
enterRoom()
|
||||
return
|
||||
}
|
||||
if (data.access_level == ApiAccessLevel.TRUSTED) {
|
||||
openLoginHint()
|
||||
}
|
||||
startWaiting()
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
switch (lobbyStatus) {
|
||||
case ApiLobbyStatus.DELETED:
|
||||
return (
|
||||
<LobbyMessage title={t('deleted.title')} body={t('deleted.body')} />
|
||||
<VStack alignItems="center" textAlign="center">
|
||||
<H lvl={1} margin={false} centered>
|
||||
{t('deleted.title')}
|
||||
</H>
|
||||
<Text as="p" variant="note">
|
||||
{t('deleted.body')}
|
||||
</Text>
|
||||
</VStack>
|
||||
)
|
||||
|
||||
case ApiLobbyStatus.TIMEOUT:
|
||||
return (
|
||||
<LobbyMessage
|
||||
title={t('timeoutInvite.title')}
|
||||
body={t('timeoutInvite.body')}
|
||||
/>
|
||||
<VStack alignItems="center" textAlign="center">
|
||||
<H lvl={1} margin={false} centered>
|
||||
{t('timeoutInvite.title')}
|
||||
</H>
|
||||
<Text as="p" variant="note">
|
||||
{t('timeoutInvite.body')}
|
||||
</Text>
|
||||
</VStack>
|
||||
)
|
||||
|
||||
case ApiLobbyStatus.DENIED:
|
||||
return <LobbyMessage title={t('denied.title')} body={t('denied.body')} />
|
||||
return (
|
||||
<VStack alignItems="center" textAlign="center">
|
||||
<H lvl={1} margin={false} centered>
|
||||
{t('denied.title')}
|
||||
</H>
|
||||
<Text as="p" variant="note">
|
||||
{t('denied.body')}
|
||||
</Text>
|
||||
</VStack>
|
||||
)
|
||||
|
||||
case ApiLobbyStatus.WAITING:
|
||||
return (
|
||||
<LobbyMessage title={t('waiting.title')} body={t('waiting.body')}>
|
||||
<VStack alignItems="center" textAlign="center">
|
||||
<H lvl={1} margin={false} centered>
|
||||
{t('waiting.title')}
|
||||
</H>
|
||||
<Text
|
||||
as="p"
|
||||
variant="note"
|
||||
className={css({ marginBottom: '1.5rem' })}
|
||||
>
|
||||
{t('waiting.body')}
|
||||
</Text>
|
||||
<Spinner />
|
||||
</LobbyMessage>
|
||||
</VStack>
|
||||
)
|
||||
|
||||
default:
|
||||
@@ -161,7 +168,7 @@ export const Lobby = ({
|
||||
label={t('usernameLabel')}
|
||||
aria-label={t('usernameLabel')}
|
||||
id="input-name"
|
||||
defaultValue={displayName}
|
||||
defaultValue={username || user?.full_name}
|
||||
validate={(value) => !value && t('errors.usernameEmpty')}
|
||||
wrapperProps={{
|
||||
noMargin: true,
|
||||
@@ -171,11 +178,6 @@ export const Lobby = ({
|
||||
maxLength={50}
|
||||
/>
|
||||
)}
|
||||
{hasJoinFailed && (
|
||||
<Text variant="warning" role="alert" margin={false} centered>
|
||||
{t('errors.joinFailed')}
|
||||
</Text>
|
||||
)}
|
||||
</VStack>
|
||||
</Form>
|
||||
)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
export {
|
||||
roomIdPattern,
|
||||
isRoomValid,
|
||||
extractRoomId,
|
||||
flexibleRoomIdPattern,
|
||||
} from './utils/isRoomValid'
|
||||
export { generateRoomId } from './utils/generateRoomId'
|
||||
|
||||
@@ -3,11 +3,13 @@ import { css } from '@/styled-system/css'
|
||||
import { Separator as RACSeparator } from 'react-aria-components'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { usePatchRoom } from '@/features/rooms/api/patchRoom'
|
||||
import { fetchRoom } from '@/features/rooms/api/fetchRoom'
|
||||
import { ApiAccessLevel } from '@/features/rooms/api/ApiRoom'
|
||||
import { keys } from '@/api/queryKeys'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useParams } from 'wouter'
|
||||
import { usePublishSourcesManager } from '../hooks/usePublishSourcesManager'
|
||||
import { usePermissionsManager } from '../hooks/usePermissionsManager'
|
||||
import { useRoomData } from '../hooks/useRoomData'
|
||||
import { useEffect } from 'react'
|
||||
import { closeSidePanel } from '@/stores/layout'
|
||||
import { useIsAdminOrOwner } from '../hooks/useIsAdminOrOwner'
|
||||
@@ -32,10 +34,12 @@ export const Admin = () => {
|
||||
}
|
||||
}, [isAdminOrOwner])
|
||||
|
||||
// Read the cached room only: an observer with its own queryFn could serve
|
||||
// the refetch that follows a setting change with a GET, which returns no
|
||||
// LiveKit credentials
|
||||
const readOnlyData = useRoomData()
|
||||
const { data: readOnlyData } = useQuery({
|
||||
queryKey: [keys.room, roomId],
|
||||
queryFn: () => fetchRoom({ roomId }),
|
||||
retry: false,
|
||||
enabled: false,
|
||||
})
|
||||
|
||||
const {
|
||||
toggleMicrophone,
|
||||
|
||||