Switch mjolnir-antispam from using spam_checker to modules

`spam_checker` has been deprecated for quite a while.
While it still probably works and while newer versions of
mjolnir-antispam still use it, we should switch to the new API.
This commit is contained in:
Slavi Pantaleev 2023-08-26 20:07:40 +03:00
parent 4e08ad98b6
commit e03ec11fcf
2 changed files with 14 additions and 10 deletions

View file

@ -840,7 +840,16 @@ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames: false
# these rooms. # these rooms.
# ["!roomid:example.org"] # ["!roomid:example.org"]
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists: [] matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists: []
# A dictionary with various fields controlling max length.
# See https://github.com/matrix-org/mjolnir/blob/main/docs/synapse_module.md for details.
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_message_max_length: {}
# Actual configuration passed to the mjolnir-antispam Synapse module
matrix_synapse_ext_spam_checker_mjolnir_antispam_config:
block_invites: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites }}"
block_messages: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages }}"
block_usernames: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames }}"
ban_lists: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists }}"
message_max_length: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_message_max_length }}"
# Enable this to activate the E2EE disabling Synapse module. # Enable this to activate the E2EE disabling Synapse module.
# See: https://github.com/digitalentity/matrix_encryption_disabler # See: https://github.com/digitalentity/matrix_encryption_disabler

View file

@ -14,18 +14,13 @@
become_user: "{{ matrix_synapse_username }}" become_user: "{{ matrix_synapse_username }}"
- ansible.builtin.set_fact: - ansible.builtin.set_fact:
matrix_synapse_spam_checker: > matrix_synapse_modules: >
{{ {{
matrix_synapse_spam_checker matrix_synapse_modules | default([])
+ +
[{ [{
"module": "mjolnir.AntiSpam", "module": "mjolnir.Module",
"config": { "config": matrix_synapse_ext_spam_checker_mjolnir_antispam_config,
"block_invites": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites,
"block_messages": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages,
"block_usernames": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames,
"ban_lists": matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists,
}
}] }]
}} }}