From e42740b5891a5da7f2848a24ebb84e1102c5bd24 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 4 Nov 2023 10:09:50 -0700 Subject: [PATCH] matrixsynapse: Update old STUN URIs to remove 'transport' parameter - If the STUN/TURN configuration is not managed by FreedomBox, the parameters are left unchanged. Tests: - Install app after installing Coturn. Notice that STUN URI doesn't have a 'transport' parameter. - Install app without the patches after installing Coturn. Notice that STUN URIs have 'transport' parameter. Then apply patches. Setup is run. 'transport' parameter is removed and only one STUN URI is present. matrix-synapse server restarts successfully and don't have show any errors/warnings regarding STUN/TURN configuration during startup. - Install app without patches and set custom STUN/TURN URIs. Apply patches. Setup is run. The URIs are not changed. Reviewed-by: James Valleroy --- plinth/modules/matrixsynapse/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plinth/modules/matrixsynapse/__init__.py b/plinth/modules/matrixsynapse/__init__.py index 4480adecd..9078111d5 100644 --- a/plinth/modules/matrixsynapse/__init__.py +++ b/plinth/modules/matrixsynapse/__init__.py @@ -44,7 +44,7 @@ class MatrixSynapseApp(app_module.App): app_id = 'matrixsynapse' - _version = 9 + _version = 10 def __init__(self): """Create components for the app.""" @@ -129,9 +129,14 @@ class MatrixSynapseApp(app_module.App): self.get_component('letsencrypt-matrixsynapse').setup_certificates() - # Configure STUN/TURN only if there's a valid TLS domain set for Coturn - config = self.get_component('turn-matrixsynapse').get_configuration() - update_turn_configuration(config, force=True) + if not old_version or get_turn_configuration()[1]: + # Configure STUN/TURN only if there's a valid TLS domain set for + # Coturn. Do this if app is being freshly installed or if it is + # previously installed and configured to use STUN/TURN + # auto-management. + config = self.get_component( + 'turn-matrixsynapse').get_configuration() + update_turn_configuration(config, force=True) def uninstall(self): """De-configure and uninstall the app."""