From b11044de1a89d6c8fdb596bf43e89f6c8612f643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 30 Nov 2023 15:31:49 +0100 Subject: [PATCH] Rework config pannel to use template instead of config edit Edit config has limitation like changing the config file from upstream later and we lost user preferance in the yunohost app settings --- config_panel.toml | 3 --- scripts/_common.sh | 7 +++++++ scripts/install | 5 +---- scripts/upgrade | 7 ++----- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 13e7ae1..ae49309 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -15,8 +15,6 @@ name.fr = "Configuration d'Element" default = "matrix.org" help.en = "Define Matrix default home server address." help.fr = "Définir l'adresse du serveur par défaut de Matrix." - bind = "base_url:__INSTALL_DIR__/config.json" - [main.config.login_for_welcome] ask.en = "Display login as welcome page" @@ -26,4 +24,3 @@ name.fr = "Configuration d'Element" no = false help.en = "When true, the app will use the login form as a welcome page instead of the welcome page itself. This disables use of welcome_url and all welcome page functionality." help.fr = "Quand l'option est sélectionnée, l'application utilisera le formulaire de connexion comme page d'accueil au lieu de la page d'accueil elle-même. Cela désactive l'utilisation de welcome_url et de toutes les fonctionnalités de la page d'accueil." - bind = "login_for_welcome:__INSTALL_DIR__/config.json" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..c71aa26 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,13 @@ # PERSONAL HELPERS #================================================= +configure_element() +{ + ynh_add_config --template="config.json" --destination="$install_dir/config.json" + chmod -R u=rwX,g=rX,o= "$install_dir" + chown -R $app:www-data "$install_dir" +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 9edc574..18fc280 100644 --- a/scripts/install +++ b/scripts/install @@ -37,10 +37,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +configure_element #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index dbb5105..8aa39e7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,12 +52,9 @@ chown -R $app:www-data "$install_dir" #================================================= # ADD A CONFIGURATION #================================================= -#ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression --message="Adding a configuration file..." --weight=1 -#ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" - -#chmod -R o-rwx "$install_dir" -#chown -R $app:www-data "$install_dir" +configure_element #================================================= # REAPPLY SYSTEM CONFIGURATIONS