mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-07 01:13:21 +00:00
b01a47bfd7
Currently users have no way to reliably test their connection before joining a room. To address this, we plan to build a connection-test page. The testing requires a dedicated LiveKit token, issued without going through the room API, which is tied to registered meetings, lobby rules, and longer-lived access tokens. Introduce a new viewset for all diagnostics-related features. The first route issues a token for diagnostics, even for anonymous users. Each request creates a new dedicated room so users never share the same LiveKit room during tests. Tokens are short-lived (default 10 minutes) to limit reuse, and the endpoint is throttled to prevent abuse. A Celery worker also schedules a callback that deletes the room after a certain delay, in every case.
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""Feature flag handler for the Meet core app."""
|
|
|
|
from functools import wraps
|
|
|
|
from django.conf import settings
|
|
from django.http import Http404
|
|
|
|
|
|
class FeatureFlag:
|
|
"""Check if features are enabled and return error responses."""
|
|
|
|
FLAGS = {
|
|
"recording": "RECORDING_ENABLE",
|
|
"storage_event": "RECORDING_STORAGE_EVENT_ENABLE",
|
|
"subtitle": "ROOM_SUBTITLE_ENABLED",
|
|
"file_upload": "FILE_UPLOAD_ENABLED",
|
|
"addons": "ADDONS_ENABLED",
|
|
"application": "APPLICATION_ENABLED",
|
|
"roomkit": "ROOMKIT_ENABLED",
|
|
"connection_test": "CONNECTION_TEST_ENABLED",
|
|
}
|
|
|
|
@classmethod
|
|
def flag_is_active(cls, flag_name):
|
|
"""Check if a feature flag is active."""
|
|
|
|
setting_name = cls.FLAGS.get(flag_name)
|
|
|
|
if setting_name is None:
|
|
return False
|
|
|
|
return getattr(settings, setting_name, False)
|
|
|
|
@classmethod
|
|
def require(cls, flag_name):
|
|
"""Decorator to check feature at the beginning of endpoint methods."""
|
|
|
|
if flag_name not in cls.FLAGS:
|
|
raise ValueError(f"Unknown feature flag: {flag_name}")
|
|
|
|
def decorator(view_func):
|
|
@wraps(view_func)
|
|
def wrapper(self, request, *args, **kwargs):
|
|
if not cls.flag_is_active(flag_name):
|
|
raise Http404
|
|
return view_func(self, request, *args, **kwargs)
|
|
|
|
return wrapper
|
|
|
|
return decorator
|