From e5f93690dbe93df22217e5c2b5f209c63f46931c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 26 May 2022 16:41:22 +0200 Subject: [PATCH] Fix linter warning --- check_process | 2 +- config_panel.toml | 6 +++--- manifest.json | 6 +++--- scripts/_common.sh | 1 + scripts/change_url | 4 ++-- scripts/config | 12 ++++++------ scripts/install | 15 +++------------ scripts/upgrade | 9 +++++++-- 8 files changed, 26 insertions(+), 29 deletions(-) diff --git a/check_process b/check_process index 868b46f..36801bc 100644 --- a/check_process +++ b/check_process @@ -2,7 +2,7 @@ ; Manifest domain="domain.tld" (DOMAIN) path="/_matrix/static/" (PATH) - is_public=1 (PUBLIC|public=1|private=0) + is_free_registration=1 (PUBLIC|public=1|private=0) server_name="domain.tld" (DOMAIN) ; Checks pkg_linter=1 diff --git a/config_panel.toml b/config_panel.toml index aeff9ab..4e3c698 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,11 +13,11 @@ name = "Synapse configuration" default = false help = "True to send anonymous statistics about synapse to improve the performances" - [synapse_config.server_config.is_public] - ask = "Server public" + [synapse_config.server_config.is_free_registration] + ask = "Server with free registration" type = "boolean" default = false - help = "Is it a public server" + help = "A public server means that anybody will be able to register on this server." [synapse_config.server_config.allow_public_rooms] ask = "Public rooms directory" diff --git a/manifest.json b/manifest.json index d635973..d3519ed 100644 --- a/manifest.json +++ b/manifest.json @@ -47,11 +47,11 @@ "default": "Same than the domain" }, { - "name": "is_public", + "name": "is_free_registration", "type": "boolean", "ask": { - "en": "Is it a public server?", - "fr": "Est-ce un serveur public ?" + "en": "Is it a server with free registration ?", + "fr": "Est-ce un serveur avec création de compte libre ?" }, "default": false, "help": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 2b53b3a..a9a969f 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,6 @@ dependances="coturn build-essential python3-dev libffi-dev python3-pip python3-setuptools sqlite3 libssl-dev python3-venv libxml2-dev libxslt1-dev python3-lxml zlib1g-dev libjpeg-dev libpq-dev postgresql acl" python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)" +app=$YNH_APP_INSTANCE_NAME install_sources() { # Install/upgrade synapse in virtualenv diff --git a/scripts/change_url b/scripts/change_url index d1c1bf1..984aca4 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,7 +26,7 @@ server_name=$(ynh_app_setting_get --app=$app --key=server_name) final_path=$(ynh_app_setting_get --app=$app --key=final_path) synapse_old_version=$(ynh_app_setting_get --app=$app --key=synapse_version) jitsi_server=$(ynh_app_setting_get --app=$app --key=jitsi_server) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) +is_free_registration=$(ynh_app_setting_get --app=$app --key=is_free_registration) port=$(ynh_app_setting_get --app=$app --key=synapse_port) synapse_tls_port=$(ynh_app_setting_get --app=$app --key=synapse_tls_port) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) @@ -102,7 +102,7 @@ else macaroon_secret_key_param='macaroon_secret_key: "'$macaroon_secret_key'"' fi -if [ $is_public -eq 0 ] +if [ $is_free_registration -eq 0 ] then allowed_access=False sso_enabled=True diff --git a/scripts/config b/scripts/config index 6c1028c..c82486f 100644 --- a/scripts/config +++ b/scripts/config @@ -23,7 +23,7 @@ app=$YNH_APP_INSTANCE_NAME report_stats=$(ynh_app_setting_get --app $app --key report_stats) allow_public_rooms=$(ynh_app_setting_get --app=$app --key=allow_public_rooms) disable_backup_before_upgrade=$(ynh_app_setting_get --app $app --key disable_backup_before_upgrade) -is_public=$(ynh_app_setting_get --app $app --key is_public) +is_free_registration=$(ynh_app_setting_get --app $app --key is_free_registration) jitsi_server=$(ynh_app_setting_get --app=$app --key=jitsi_server) e2e_enabled_by_default=$(ynh_app_setting_get --app=$app --key=e2e_enabled_by_default) @@ -37,7 +37,7 @@ show_config() { ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS=$report_stats" ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS=$allow_public_rooms" ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_CLIENT_CONFIG_JITSI_SERVER=$jitsi_server" - ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC=${is_public}" + ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_FREE_REGISTRATION=${is_free_registration}" ynh_return "YNH_CONFIG_SYNAPSE_CONFIG_CLIENT_CONFIG_E2E_ENABLED_BY_DEFAULT=${e2e_enabled_by_default}" if [[ ${disable_backup_before_upgrade:-0} -eq 1 ]] @@ -56,7 +56,7 @@ apply_config() { report_stats=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_SERVER_STATISTICS:-$report_stats} allow_public_rooms=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_ALLOW_PUBLIC_ROOMS:-$allow_public_rooms} do_backup_before_upgrade=${YNH_CONFIG_PACKAGE_CONFIG_PACKAGE_CONFIG_BACKUP_BEFORE_UPGRADE:-} - is_public=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_PUBLIC:-$is_public} + is_free_registration=${YNH_CONFIG_SYNAPSE_CONFIG_SERVER_CONFIG_IS_FREE_REGISTRATION:-$is_free_registration} jitsi_server=${YNH_CONFIG_SYNAPSE_CONFIG_CLIENT_CONFIG_JITSI_SERVER:-$jitsi_server} e2e_enabled_by_default=${YNH_CONFIG_SYNAPSE_CONFIG_CLIENT_CONFIG_E2E_ENABLED_BY_DEFAULT:-$e2e_enabled_by_default} @@ -81,7 +81,7 @@ apply_config() { ynh_app_setting_set --app $app --key report_stats --value $report_stats ynh_app_setting_set --app $app --key allow_public_rooms --value $allow_public_rooms - ynh_app_setting_set --app $app --key is_public --value $is_public + ynh_app_setting_set --app $app --key is_free_registration --value $is_free_registration ynh_app_setting_set --app $app --key jitsi_server --value $jitsi_server ynh_app_setting_set --app=$app --key=e2e_enabled_by_default --value=$e2e_enabled_by_default @@ -96,7 +96,7 @@ apply_config() { domain=$(ynh_app_setting_get --app $app --key domain) server_name=$(ynh_app_setting_get --app $app --key server_name) synapse_db_pwd=$(ynh_app_setting_get --app $app --key synapse_db_pwd) - is_public=$(ynh_app_setting_get --app $app --key is_public) + is_free_registration=$(ynh_app_setting_get --app $app --key is_free_registration) port=$(ynh_app_setting_get --app $app --key synapse_port) synapse_tls_port=$(ynh_app_setting_get --app $app --key synapse_tls_port) turnserver_tls_port=$(ynh_app_setting_get --app $app --key turnserver_tls_port) @@ -124,7 +124,7 @@ apply_config() { macaroon_secret_key_param='macaroon_secret_key: "'$macaroon_secret_key'"' fi - if [ $is_public -eq 0 ] + if [ $is_free_registration -eq 0 ] then allowed_access=False sso_enabled=True diff --git a/scripts/install b/scripts/install index d6cdb88..660f4bf 100644 --- a/scripts/install +++ b/scripts/install @@ -21,15 +21,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -is_public=$YNH_APP_ARG_IS_PUBLIC - -app=$YNH_APP_INSTANCE_NAME - #================================================= # SET CONSTANTS #================================================= @@ -50,7 +41,7 @@ default_domain_value="Same than the domain" domain=$YNH_APP_ARG_DOMAIN server_name=$YNH_APP_ARG_SERVER_NAME -is_public=$YNH_APP_ARG_IS_PUBLIC +is_free_registration=$YNH_APP_ARG_IS_FREE_REGISTRATION jitsi_server=$YNH_APP_ARG_JITSI_SERVER path_url="/_matrix" final_path="/opt/yunohost/matrix-$app" @@ -90,7 +81,7 @@ ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=jitsi_server --value=$jitsi_server ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=synapse_version --value=$upstream_version -ynh_app_setting_set --app=$app --key=is_public --value=$is_public +ynh_app_setting_set --app=$app --key=is_free_registration --value=$is_free_registration ynh_app_setting_set --app=$app --key=report_stats --value=$report_stats ynh_app_setting_set --app=$app --key=allow_public_rooms --value=$allow_public_rooms ynh_app_setting_set --app=$app --key=e2e_enabled_by_default --value=$e2e_enabled_by_default @@ -279,7 +270,7 @@ ynh_app_setting_set --app=$app --key=turnserver_pwd --value=$turnserver_pwd macaroon_secret_key_param='macaroon_secret_key: "'$macaroon_secret_key'"' -if [ $is_public -eq 0 ] +if [ $is_free_registration -eq 0 ] then allowed_access=False sso_enabled=True diff --git a/scripts/upgrade b/scripts/upgrade index b836c65..6a8ebbe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,7 +26,7 @@ jitsi_server=$(ynh_app_setting_get --app=$app --key=jitsi_server) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) synapse_old_version=$(ynh_app_setting_get --app=$app --key=synapse_version) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) +is_free_registration=$(ynh_app_setting_get --app=$app --key=is_free_registration) port=$(ynh_app_setting_get --app=$app --key=synapse_port) synapse_tls_port=$(ynh_app_setting_get --app=$app --key=synapse_tls_port) turnserver_tls_port=$(ynh_app_setting_get --app=$app --key=turnserver_tls_port) @@ -131,6 +131,11 @@ if [ -z $allow_public_rooms ]; then ynh_app_setting_set --app=$app --key=allow_public_rooms --value=$allow_public_rooms fi +if [ -z $is_free_registration ]; then + is_free_registration=$(ynh_app_setting_get --app=$app --key=is_""public) + ynh_app_setting_set --app=$app --key=is_free_registration --value=$is_free_registration +fi + #================================================= # MIGRATION 6 : Migrate data directory #================================================= @@ -232,7 +237,7 @@ else macaroon_secret_key_param='macaroon_secret_key: "'$macaroon_secret_key'"' fi -if [ $is_public -eq 0 ] +if [ $is_free_registration -eq 0 ] then allowed_access=False sso_enabled=True