mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-05 08:27:42 +00:00
fixup! ✨(backend) add connection-test API
This commit is contained in:
@@ -104,3 +104,6 @@ APPLICATION_JWT_AUDIENCE=http://localhost:8071/external-api/v1.0/
|
||||
APPLICATION_JWT_SECRET_KEY=devKey
|
||||
APPLICATION_BASE_URL=http://localhost:3000
|
||||
|
||||
# Diagnostics
|
||||
CONNECTION_TEST_ENABLED = True
|
||||
|
||||
|
||||
@@ -65,6 +65,9 @@ def get_frontend_configuration(request):
|
||||
"default_access_level": settings.RESOURCE_DEFAULT_ACCESS_LEVEL,
|
||||
},
|
||||
"subtitle": {"enabled": settings.ROOM_SUBTITLE_ENABLED},
|
||||
"diagnostics": {
|
||||
"connection_test_enabled": settings.CONNECTION_TEST_ENABLED
|
||||
},
|
||||
"livekit": {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
"force_wss_protocol": settings.LIVEKIT_FORCE_WSS_PROTOCOL,
|
||||
|
||||
@@ -17,6 +17,7 @@ class FeatureFlag:
|
||||
"addons": "ADDONS_ENABLED",
|
||||
"application": "APPLICATION_ENABLED",
|
||||
"roomkit": "ROOMKIT_ENABLED",
|
||||
"connection_test": "CONNECTION_TEST_ENABLED",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1597,6 +1597,7 @@ class DiagnosticsViewSet(viewsets.ViewSet):
|
||||
throttling.ConnectionTestAnonRateThrottle,
|
||||
],
|
||||
)
|
||||
@FeatureFlag.require("connection_test")
|
||||
def connection(self, request):
|
||||
"""Return a short-lived LiveKit token for an ephemeral test room.
|
||||
|
||||
|
||||
@@ -154,3 +154,12 @@ def test_api_diagnostics_connection_is_throttled(throttle_class, client):
|
||||
response = client.post("/api/v1.0/diagnostics/connection/")
|
||||
|
||||
assert response.status_code == 429
|
||||
|
||||
|
||||
def test_api_diagnostics_connection_is_throttled(client, settings):
|
||||
"""Should return a not found error when the connection diagnostics feature is disabled."""
|
||||
|
||||
settings.CONNECTION_TEST_ENABLED = False
|
||||
|
||||
response = client.post("/api/v1.0/diagnostics/connection/")
|
||||
assert response.status_code == 404
|
||||
|
||||
@@ -665,6 +665,11 @@ class Base(Configuration):
|
||||
environ_prefix=None,
|
||||
default=False,
|
||||
)
|
||||
CONNECTION_TEST_ENABLED = values.BooleanValue(
|
||||
environ_name="CONNECTION_TEST_ENABLED",
|
||||
environ_prefix=None,
|
||||
default=False,
|
||||
)
|
||||
CONNECTION_TEST_TOKEN_TTL_SECONDS = values.PositiveIntegerValue(
|
||||
300,
|
||||
environ_name="CONNECTION_TEST_TOKEN_TTL_SECONDS",
|
||||
@@ -1290,6 +1295,8 @@ class Test(Base):
|
||||
ADDONS_CSRF_SECRET = "secret-key-padded-for-minimum-len!-addons" # noqa:S105
|
||||
ADDONS_TOKEN_SECRET_KEY = "secret-key-padded-for-minimum-len!-addons" # noqa:S105
|
||||
|
||||
CONNECTION_TEST_ENABLED = True
|
||||
|
||||
def __init__(self):
|
||||
# pylint: disable=invalid-name
|
||||
self.INSTALLED_APPS += ["drf_spectacular_sidecar"]
|
||||
|
||||
Reference in New Issue
Block a user