Parcourir la source

Gate c10y recaptcha config on it being configured.

pull/5330/head
Catalan Lover il y a 1 mois
Parent
révision
154d22092f
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 649BCCF930C07F70
3 fichiers modifiés avec 14 ajouts et 0 suppressions
  1. +2
    -0
      roles/custom/matrix-continuwuity/defaults/main.yml
  2. +9
    -0
      roles/custom/matrix-continuwuity/tasks/validate_config.yml
  3. +3
    -0
      roles/custom/matrix-continuwuity/templates/continuwuity.toml.j2

+ 2
- 0
roles/custom/matrix-continuwuity/defaults/main.yml Voir le fichier

@@ -1,5 +1,6 @@
# SPDX-FileCopyrightText: 2025 MDAD project contributors # SPDX-FileCopyrightText: 2025 MDAD project contributors
# SPDX-FileCopyrightText: 2025 Slavi Pantaleev # SPDX-FileCopyrightText: 2025 Slavi Pantaleev
# SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later


@@ -191,6 +192,7 @@ matrix_continuwuity_config_turn_password: ''
matrix_continuwuity_self_check_validate_certificates: true matrix_continuwuity_self_check_validate_certificates: true


# If set, registration will require Google ReCAPTCHA verification. # If set, registration will require Google ReCAPTCHA verification.
matrix_continuwuity_recaptcha_enabled: "{{ matrix_continuwuity_config_recaptcha_site_key != '' and matrix_continuwuity_config_recaptcha_private_site_key != '' }}"
matrix_continuwuity_config_recaptcha_site_key: '' matrix_continuwuity_config_recaptcha_site_key: ''
matrix_continuwuity_config_recaptcha_private_site_key: '' matrix_continuwuity_config_recaptcha_private_site_key: ''




+ 9
- 0
roles/custom/matrix-continuwuity/tasks/validate_config.yml Voir le fichier

@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2025 MDAD project contributors # SPDX-FileCopyrightText: 2025 MDAD project contributors
# SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later


@@ -36,3 +37,11 @@
- {'old': 'matrix_continuwuity_docker_image_registry_prefix_upstream', 'new': 'matrix_continuwuity_container_image_registry_prefix_upstream'} - {'old': 'matrix_continuwuity_docker_image_registry_prefix_upstream', 'new': 'matrix_continuwuity_container_image_registry_prefix_upstream'}
- {'old': 'matrix_continuwuity_docker_image_registry_prefix_upstream_default', 'new': 'matrix_continuwuity_container_image_registry_prefix_upstream_default'} - {'old': 'matrix_continuwuity_docker_image_registry_prefix_upstream_default', 'new': 'matrix_continuwuity_container_image_registry_prefix_upstream_default'}
- {'old': 'matrix_continuwuity_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'} - {'old': 'matrix_continuwuity_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}

- name: Fail if required Continuwuity variables are undefined
ansible.builtin.fail:
msg: "The `{{ item.name }}` variable must be defined and have a non-null value."
with_items:
- {'name': 'matrix_continuwuity_config_recaptcha_site_key', when: "{{ matrix_continuwuity_config_recaptcha_private_site_key | string | length > 0 }}"}
- {'name': 'matrix_continuwuity_config_recaptcha_private_site_key', when: "{{ matrix_continuwuity_config_recaptcha_site_key | string | length > 0 }}"}
when: "item.when | bool and (lookup('vars', item.name, default='') == '' or lookup('vars', item.name, default='') is none)"

+ 3
- 0
roles/custom/matrix-continuwuity/templates/continuwuity.toml.j2 Voir le fichier

@@ -2,6 +2,7 @@
SPDX-FileCopyrightText: 2025 MDAD project contributors SPDX-FileCopyrightText: 2025 MDAD project contributors
SPDX-FileCopyrightText: 2025 Slavi Pantaleev SPDX-FileCopyrightText: 2025 Slavi Pantaleev
SPDX-FileCopyrightText: 2025 Suguru Hirahara SPDX-FileCopyrightText: 2025 Suguru Hirahara
SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>


SPDX-License-Identifier: AGPL-3.0-or-later SPDX-License-Identifier: AGPL-3.0-or-later
#} #}
@@ -490,6 +491,7 @@ registration_token = {{ matrix_continuwuity_config_registration_token | to_json
# #
#registration_token_file = #registration_token_file =


{% if matrix_continuwuity_recaptcha_enabled %}
# The public site key for reCaptcha. If this is provided, reCaptcha # The public site key for reCaptcha. If this is provided, reCaptcha
# becomes required during registration. If both captcha *and* # becomes required during registration. If both captcha *and*
# registration token are enabled, both will be required during # registration token are enabled, both will be required during
@@ -509,6 +511,7 @@ recaptcha_site_key = {{ matrix_continuwuity_config_recaptcha_site_key | to_json
# even if `recaptcha_site_key` is set. # even if `recaptcha_site_key` is set.
# #
recaptcha_private_site_key = {{ matrix_continuwuity_config_recaptcha_private_site_key | to_json }} recaptcha_private_site_key = {{ matrix_continuwuity_config_recaptcha_private_site_key | to_json }}
{% endif %}


# Controls whether encrypted rooms and events are allowed. # Controls whether encrypted rooms and events are allowed.
# #


Chargement…
Annuler
Enregistrer