From 3e0b90bf9e2097a5ca847d780974548a3d4755cf Mon Sep 17 00:00:00 2001 From: Gredin67 Date: Wed, 2 Aug 2023 18:26:08 +0200 Subject: [PATCH] no federation if no captcha --- config_panel.toml | 5 +---- manifest.toml | 2 ++ scripts/install | 6 +++--- scripts/upgrade | 14 +++++++------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 3fd5a87..54b7aa6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -29,7 +29,6 @@ services = ["__APP__"] yes = true no = false help = "If True, Registration of default user accounts from a Client App is disabled. If false and your server is federated, reCAPTCHA verification should be activated to avoid spamming the whole Matrix network." - default = true [main.registration.enable_registration_captcha] ask = "Require CAPTCHA verification for Registration." @@ -38,7 +37,6 @@ services = ["__APP__"] no = false help = "ReCAPTCHA API should be configured. See instructions https://matrix-org.github.io/dendrite/administration/registration#recaptcha-verification" bind = ":/opt/yunohost/__APP__/dendrite.yaml" - default = true visible = "!registration_disabled" [main.registration.guests_disabled] @@ -48,7 +46,6 @@ services = ["__APP__"] no = false help = "Guest registration is also disabled implicitly if Registration from Element is disabled." bind = ":/opt/yunohost/__APP__/dendrite.yaml" - default = true visible = "!registration_disabled" [main.registration.disable_federation] @@ -58,4 +55,4 @@ services = ["__APP__"] no = false help = "Do not communicate with other homeservers of the Matrix Federation." bind = ":/opt/yunohost/__APP__/dendrite.yaml" - default = false \ No newline at end of file + visible = "enable_registration_captcha" diff --git a/manifest.toml b/manifest.toml index 6b6eb05..dde6d63 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,6 +44,8 @@ ram.runtime = "50M" ask.en = "Should the server allow any visitor to register as a user?" ask.fr = "Le serveur doit-il permettre à quiconque de s'enregistrer comme utilisateur ?" type = "boolean" + help.en = "If no, accounts should be registered by an admin after defining a secret. If yes, to protect your server and the federation from spammer, federation will be deactived by default. You must Activate CAPTCHA verification before federation reactivation. See Config Panel for instructions" + help.fr = "Si non, les comptes seront créés par un admin après avoir défini un secret. Si oui, la fédération sera désactivée pour protéger la fédération et vous des spammeurs. Activez la vérification par CAPTCHA avant de réactiver la fédération ! Voir les instructions dans le Config Panel" default = false [resources] diff --git a/scripts/install b/scripts/install index 2e49951..9a23856 100644 --- a/scripts/install +++ b/scripts/install @@ -19,11 +19,11 @@ if [ $registration -eq 1 ] then registration_disabled="false" really_enable_open_registration="--really-enable-open-registration" - enable_registration_captcha="true" + disable_federation="true" else registration_disabled="true" really_enable_open_registration="" - enable_registration_captcha="false" + disable_federation="false" fi #================================================= @@ -108,9 +108,9 @@ chown -R $app:root "$install_dir" #================================================= ## SET STANDARD SETTINGS FROM DEFAULT CONFIG #================================================= -disable_federation="false" guests_disabled="true" registration_shared_secret="" +enable_registration_captcha="false" ynh_app_setting_set --app=$app --key=registration_disabled --value=$registration_disabled ynh_app_setting_set --app=$app --key=disable_federation --value=$disable_federation ynh_app_setting_set --app=$app --key=guests_disabled --value=$guests_disabled diff --git a/scripts/upgrade b/scripts/upgrade index c8c0ea7..81de766 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,9 +61,9 @@ if [ -z $server_name ]; then fi # Define $disable_federation if not already defined -if [ -z $disable_federation ]; then - disable_federation="false" - ynh_app_setting_set --app=$app --key=disable_federation --value=$disable_federation +if [ -z $enable_registration_captcha ]; then + enable_registration_captcha="false" + ynh_app_setting_set --app=$app --key=enable_registration_captcha --value=$enable_registration_captcha fi # Define $guests_disabled if not already defined @@ -88,15 +88,15 @@ else then registration_disabled="false" really_enable_open_registration="--really-enable-open-registration" - enable_registration_captcha="true" + disable_federation="true" ynh_app_setting_set --app=$app --key=registration_disabled --value=$registration_disabled - ynh_app_setting_set --app=$app --key=enable_registration_captcha --value=$enable_registration_captcha + ynh_app_setting_set --app=$app --key=disable_federation --value=$disable_federation else registration_disabled="true" really_enable_open_registration="" - enable_registration_captcha="false" + disable_federation="false" ynh_app_setting_set --app=$app --key=registration_disabled --value=$registration_disabled - ynh_app_setting_set --app=$app --key=enable_registration_captcha --value=$enable_registration_captcha + ynh_app_setting_set --app=$app --key=disable_federation --value=$disable_federation fi fi