From f475a795074943f77aec8d7183e30d01b0daf50d Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Mon, 22 Nov 2021 18:35:47 +0100 Subject: [PATCH] feat(api): iceServers configuration --- api/chalicelib/blueprints/bp_core_dynamic.py | 5 ++++- api/chalicelib/core/assist.py | 9 +++++++-- api/chalicelib/core/users.py | 4 +++- ee/api/chalicelib/blueprints/bp_core_dynamic.py | 7 ++++++- ee/api/chalicelib/core/users.py | 2 ++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/api/chalicelib/blueprints/bp_core_dynamic.py b/api/chalicelib/blueprints/bp_core_dynamic.py index b695ab54a..5807d7bed 100644 --- a/api/chalicelib/blueprints/bp_core_dynamic.py +++ b/api/chalicelib/blueprints/bp_core_dynamic.py @@ -16,6 +16,7 @@ from chalicelib.core import notifications from chalicelib.core import boarding from chalicelib.core import webhook from chalicelib.core import license +from chalicelib.core import assist from chalicelib.core.collaboration_slack import Slack app = Blueprint(__name__) @@ -47,6 +48,7 @@ def login(): c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True, version=True) c["smtp"] = helper.has_smtp() + c["iceServers"]= assist.get_ice_servers() return { 'jwt': r.pop('jwt'), 'data': { @@ -68,7 +70,8 @@ def get_account(context): "metadata": metadata.get_remaining_metadata_with_count(context['tenantId']) }, **license.get_status(context["tenantId"]), - "smtp": helper.has_smtp() + "smtp": helper.has_smtp(), + "iceServers": assist.get_ice_servers() } } diff --git a/api/chalicelib/core/assist.py b/api/chalicelib/core/assist.py index dbfe8269b..7f9e8465f 100644 --- a/api/chalicelib/core/assist.py +++ b/api/chalicelib/core/assist.py @@ -1,6 +1,6 @@ -from chalicelib.utils import pg_client, helper -from chalicelib.core import projects, sessions, sessions_metas import requests +from chalicelib.core import projects, sessions, sessions_metas +from chalicelib.utils import pg_client, helper from chalicelib.utils.helper import environ SESSION_PROJECTION_COLS = """s.project_id, @@ -72,3 +72,8 @@ def is_live(project_id, session_id, project_key=None): return False connected_peers = connected_peers.json().get("data", []) return str(session_id) in connected_peers + + +def get_ice_servers(): + return environ.get("iceServers") if environ.get("iceServers") is not None \ + and len(environ["iceServers"]) > 0 else None diff --git a/api/chalicelib/core/users.py b/api/chalicelib/core/users.py index c001ea5e2..4a980eefc 100644 --- a/api/chalicelib/core/users.py +++ b/api/chalicelib/core/users.py @@ -8,7 +8,7 @@ from chalicelib.utils import dev from chalicelib.utils.TimeUTC import TimeUTC from chalicelib.utils.helper import environ -from chalicelib.core import tenants +from chalicelib.core import tenants, assist import secrets @@ -440,6 +440,7 @@ def change_password(tenant_id, user_id, email, old_password, new_password): c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True) c["smtp"] = helper.has_smtp() + c["iceServers"]= assist.get_ice_servers() return { 'jwt': r.pop('jwt'), 'data': { @@ -467,6 +468,7 @@ def set_password_invitation(user_id, new_password): c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True) c["smtp"] = helper.has_smtp() + c["iceServers"]= assist.get_ice_servers() return { 'jwt': r.pop('jwt'), 'data': { diff --git a/ee/api/chalicelib/blueprints/bp_core_dynamic.py b/ee/api/chalicelib/blueprints/bp_core_dynamic.py index de2ae3bfb..8ce7d9bc2 100644 --- a/ee/api/chalicelib/blueprints/bp_core_dynamic.py +++ b/ee/api/chalicelib/blueprints/bp_core_dynamic.py @@ -16,6 +16,7 @@ from chalicelib.core import notifications from chalicelib.core import boarding from chalicelib.core import webhook from chalicelib.core import license +from chalicelib.core import assist from chalicelib.core.collaboration_slack import Slack app = Blueprint(__name__) @@ -48,6 +49,9 @@ def login(): c.pop("createdAt") c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True, version=True) + c["smtp"] = helper.has_smtp() + c["iceServers"] = assist.get_ice_servers() + return { 'jwt': r.pop('jwt'), 'data': { @@ -70,7 +74,8 @@ def get_account(context): }, **license.get_status(context["tenantId"]), "smtp": environ["EMAIL_HOST"] is not None and len(environ["EMAIL_HOST"]) > 0, - "saml2": SAML2_helper.is_saml2_available() + "saml2": SAML2_helper.is_saml2_available(), + "iceServers": assist.get_ice_servers() } } diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index ec96b68ac..050738659 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -450,6 +450,7 @@ def change_password(tenant_id, user_id, email, old_password, new_password): c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True) c["smtp"] = helper.has_smtp() + c["iceServers"]= assist.get_ice_servers() return { 'jwt': r.pop('jwt'), 'data': { @@ -477,6 +478,7 @@ def set_password_invitation(tenant_id, user_id, new_password): c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True, stack_integrations=True) c["smtp"] = helper.has_smtp() + c["iceServers"]= assist.get_ice_servers() return { 'jwt': r.pop('jwt'), 'data': {