From 63f3e360039c8dd02c9b437e6c404152a520fe34 Mon Sep 17 00:00:00 2001 From: Philipp Kilian Date: Thu, 16 May 2024 12:21:50 +0200 Subject: [PATCH] meeting: add check function for meeting name length --- b3lb/requirements.txt | 18 +++++++++--------- b3lb/rest/classes/api.py | 4 ++-- b3lb/rest/models.py | 5 +++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/b3lb/requirements.txt b/b3lb/requirements.txt index 886af3d..56d269c 100644 --- a/b3lb/requirements.txt +++ b/b3lb/requirements.txt @@ -1,22 +1,22 @@ # b3lb v3.1 - Delay update to Django 4.x because of dependencies -Django==3.2.23 -PyGObject==3.46.0 -aiohttp==3.8.6 -boto3==1.28.77 +Django==3.2.25 +PyGObject==3.48.2 +aiohttp==3.9.5 +boto3==1.34.106 django-extensions==3.2.3 -celery==5.3.4 +celery==5.4.0 celery-singleton==0.3.1 django-cacheops==7.0.2 -django-db-file-storage==0.5.5 django-celery-admin==0.1 -django-celery-beat==2.5.0 +django-celery-beat==2.6.0 django-celery-results==2.5.1 +django-db-file-storage==0.5.6.1 django-environ==0.11.2 django-redis==5.4.0 -django-storages==1.14.2 +django-storages==1.14.3 intervaltree==3.1.0 pyjwt==2.8.0 psycopg2cffi==2.9.0 requests==2.31.0 -uvicorn[standard]==0.23.2 +uvicorn[standard]==0.29.0 xmltodict==0.13.0 \ No newline at end of file diff --git a/b3lb/rest/classes/api.py b/b3lb/rest/classes/api.py index eeed071..54ebefb 100644 --- a/b3lb/rest/classes/api.py +++ b/b3lb/rest/classes/api.py @@ -34,7 +34,7 @@ from rest.b3lb.metrics import incr_metric, update_create_metrics from rest.b3lb.parameters import ALLOW_START_STOP_RECORDING, AUTO_START_RECORDING, BLOCK, LOGO, OVERRIDE, PARAMETERS_CREATE, PARAMETERS_JOIN, RECORD, SET, USERDATA_BBB_CUSTOM_STYLE_URL from rest.b3lb.utils import get_checksum -from rest.models import ClusterGroupRelation, Meeting, Metric, Node, Parameter, Record, RecordSet, Secret, SecretMeetingList, SecretMetricsList, Stats +from rest.models import check_room_name, ClusterGroupRelation, Meeting, Metric, Node, Parameter, Record, RecordSet, Secret, SecretMeetingList, SecretMetricsList, Stats from typing import Any, Dict, List, Literal, Union from uuid import UUID from urllib.parse import urlencode @@ -432,7 +432,7 @@ def is_node_free(self) -> bool: ## Getter Routines ## def get_meeting_defaults(self) -> Dict[str, Any]: - return {"id": self.meeting_id, "secret": self.secret, "node": self.node, "room_name": self.parameters.get("name", "Unknown"), "end_callback_url": self.parameters.get("meta_endCallbackUrl", "")} + return {"id": self.meeting_id, "secret": self.secret, "node": self.node, "room_name": check_room_name(self.parameters.get("name", "Unknown")), "end_callback_url": self.parameters.get("meta_endCallbackUrl", "")} def get_node_endpoint_url(self) -> str: parameter_str = "" diff --git a/b3lb/rest/models.py b/b3lb/rest/models.py index b1c40f8..86081c1 100644 --- a/b3lb/rest/models.py +++ b/b3lb/rest/models.py @@ -45,6 +45,11 @@ # # FUNCTIONS # +def check_room_name(name: str) -> str: + if len(name) > cst.MEETING_NAME_LENGTH: + return name[:cst.MEETING_NAME_LENGTH] + return name + def get_nonce(): return get_random_string(cst.NONCE_LENGTH, cst.NONCE_CHAR_POOL)