From 7cc3aae041966cd111d1ef9d0b14a3812c60edc2 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Sun, 9 Oct 2022 21:59:33 +0200 Subject: [PATCH 1/5] fix(mautrix-discord): allow configuring the restricted_rooms option --- roles/matrix-bridge-mautrix-discord/defaults/main.yml | 4 ++++ roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/matrix-bridge-mautrix-discord/defaults/main.yml b/roles/matrix-bridge-mautrix-discord/defaults/main.yml index dbc23031d..0cc180527 100644 --- a/roles/matrix-bridge-mautrix-discord/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-discord/defaults/main.yml @@ -140,3 +140,7 @@ matrix_mautrix_discord_registration: "{{ matrix_mautrix_discord_registration_yam matrix_mautrix_discord_bridge_encryption_allow: false matrix_mautrix_discord_bridge_encryption_default: "{{ matrix_mautrix_discord_bridge_encryption_allow }}" matrix_mautrix_discord_bridge_encryption_key_sharing_allow: "{{ matrix_mautrix_discord_bridge_encryption_allow }}" + +# On conduit this option may prevent you from joining spaces created by the bridge. +# Setting this to false fixes the issue. +matrix_mautrix_discord_restricted_rooms: true \ No newline at end of file diff --git a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 index fdd4f788d..cd64f5d9c 100644 --- a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 +++ b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 @@ -101,7 +101,7 @@ bridge: message_error_notices: true # Should the bridge use space-restricted join rules instead of invite-only for guild rooms? # This can avoid unnecessary invite events in guild rooms when members are synced in. - restricted_rooms: true + restricted_rooms: {{ matrix_mautrix_discord_restricted_rooms }} # Should the bridge update the m.direct account data event when double puppeting is enabled. # Note that updating the m.direct event is not atomic (except with mautrix-asmux) # and is therefore prone to race conditions. From 1d024975d650c99f4393c74aa0bcae698c40f435 Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Mon, 10 Oct 2022 07:10:15 +0000 Subject: [PATCH 2/5] Automatically set restricted_rooms to false on conduit --- group_vars/matrix_servers | 4 ++++ roles/matrix-bridge-mautrix-discord/defaults/main.yml | 2 +- roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index cfccd3876..ae5395fbe 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -695,6 +695,10 @@ matrix_mautrix_discord_login_shared_secret: "{{ matrix_synapse_ext_password_prov matrix_mautrix_discord_database_engine: "{{ 'postgres' if matrix_postgres_enabled else 'sqlite' }}" matrix_mautrix_discord_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'maudiscord.db') | to_uuid }}" +# Enabling bridge.restricted_rooms for this bridge does not work well with Conduit, so we disable it by default. +# See: todo: add link to upstream issue +matrix_mautrix_discord_bridge_restricted_rooms: "{{ false if matrix_homeserver_implementation == 'conduit' else true }}" + ###################################################################### # # /matrix-bridge-mautrix-discord diff --git a/roles/matrix-bridge-mautrix-discord/defaults/main.yml b/roles/matrix-bridge-mautrix-discord/defaults/main.yml index 0cc180527..d3eae38a6 100644 --- a/roles/matrix-bridge-mautrix-discord/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-discord/defaults/main.yml @@ -143,4 +143,4 @@ matrix_mautrix_discord_bridge_encryption_key_sharing_allow: "{{ matrix_mautrix_d # On conduit this option may prevent you from joining spaces created by the bridge. # Setting this to false fixes the issue. -matrix_mautrix_discord_restricted_rooms: true \ No newline at end of file +matrix_mautrix_discord_bridge_restricted_rooms: true \ No newline at end of file diff --git a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 index cd64f5d9c..f88d0829c 100644 --- a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 +++ b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 @@ -101,7 +101,7 @@ bridge: message_error_notices: true # Should the bridge use space-restricted join rules instead of invite-only for guild rooms? # This can avoid unnecessary invite events in guild rooms when members are synced in. - restricted_rooms: {{ matrix_mautrix_discord_restricted_rooms }} + restricted_rooms: {{ matrix_mautrix_discord_bridge_restricted_rooms }} # Should the bridge update the m.direct account data event when double puppeting is enabled. # Note that updating the m.direct event is not atomic (except with mautrix-asmux) # and is therefore prone to race conditions. From 81f90f0ad1d70dabbaacd84736c8281c090861e5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 10 Oct 2022 17:09:42 +0300 Subject: [PATCH 3/5] Use |to_json for matrix_mautrix_discord_bridge_restricted_rooms --- roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 index f88d0829c..039923350 100644 --- a/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 +++ b/roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2 @@ -101,7 +101,7 @@ bridge: message_error_notices: true # Should the bridge use space-restricted join rules instead of invite-only for guild rooms? # This can avoid unnecessary invite events in guild rooms when members are synced in. - restricted_rooms: {{ matrix_mautrix_discord_bridge_restricted_rooms }} + restricted_rooms: {{ matrix_mautrix_discord_bridge_restricted_rooms|to_json }} # Should the bridge update the m.direct account data event when double puppeting is enabled. # Note that updating the m.direct event is not atomic (except with mautrix-asmux) # and is therefore prone to race conditions. From 752d2ba8d0e4ed458633e9acbfd3a4680fe8ddaf Mon Sep 17 00:00:00 2001 From: Samuel Meenzen Date: Wed, 2 Nov 2022 20:39:14 +0100 Subject: [PATCH 4/5] Update matrix_servers --- group_vars/matrix_servers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 3988a2b31..2e3a217c0 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -696,7 +696,7 @@ matrix_mautrix_discord_database_engine: "{{ 'postgres' if matrix_postgres_enable matrix_mautrix_discord_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'maudiscord.db') | to_uuid }}" # Enabling bridge.restricted_rooms for this bridge does not work well with Conduit, so we disable it by default. -# See: todo: add link to upstream issue +# This will be fixed in the upcoming `0.5.0` release of conduit. matrix_mautrix_discord_bridge_restricted_rooms: "{{ false if matrix_homeserver_implementation == 'conduit' else true }}" ###################################################################### From e1cfb6e79ff09f80063db89bc4fee10d6a621222 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 3 Nov 2022 07:42:08 +0200 Subject: [PATCH 5/5] Make yamllint happy --- roles/matrix-bridge-mautrix-discord/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/matrix-bridge-mautrix-discord/defaults/main.yml b/roles/matrix-bridge-mautrix-discord/defaults/main.yml index d3eae38a6..7163954a4 100644 --- a/roles/matrix-bridge-mautrix-discord/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-discord/defaults/main.yml @@ -143,4 +143,4 @@ matrix_mautrix_discord_bridge_encryption_key_sharing_allow: "{{ matrix_mautrix_d # On conduit this option may prevent you from joining spaces created by the bridge. # Setting this to false fixes the issue. -matrix_mautrix_discord_bridge_restricted_rooms: true \ No newline at end of file +matrix_mautrix_discord_bridge_restricted_rooms: true