mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-07 01:13:21 +00:00
⚡️(frontend) backport phone number formatting to the backend
Use the Python port of Google's phone number library on the backend instead of the JS one on the client. Saves 140Kb of unnecessary JS and avoids a complex dynamic import that would have been required to optimize loading. The transformation is static: the phone number lives in the Django settings, so the backend can format it once and pass the result to the client. This avoids every client loading the 140Kb library and re-computing the same information. Moreover, within a single client, the transformation was previously re-computed several times during a webapp lifecycle.
This commit is contained in:
committed by
aleb_the_flash
parent
8984d863df
commit
7390673bfc
@@ -8,6 +8,8 @@ from rest_framework import views as drf_views
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
from core.utils import build_telephony_config
|
||||
|
||||
|
||||
def exception_handler(exc, context):
|
||||
"""Handle Django ValidationError as an accepted exception.
|
||||
@@ -58,13 +60,7 @@ def get_frontend_configuration(request):
|
||||
"allowed_mimetypes"
|
||||
],
|
||||
},
|
||||
"telephony": {
|
||||
"enabled": settings.ROOM_TELEPHONY_ENABLED,
|
||||
"phone_number": settings.ROOM_TELEPHONY_PHONE_NUMBER
|
||||
if settings.ROOM_TELEPHONY_ENABLED
|
||||
else None,
|
||||
"default_country": settings.ROOM_TELEPHONY_DEFAULT_COUNTRY,
|
||||
},
|
||||
"telephony": build_telephony_config(),
|
||||
"subtitle": {"enabled": settings.ROOM_SUBTITLE_ENABLED},
|
||||
"livekit": {
|
||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||
|
||||
Reference in New Issue
Block a user