From 1c820d587c60643fc1d72c51b40a048fa3fc0978 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 14 Oct 2022 18:32:35 +0200 Subject: [PATCH] Add config panel --- conf/config.json | 2 +- config_panel.toml | 16 ++++++++++++++++ scripts/install | 3 +++ scripts/upgrade | 7 +++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 config_panel.toml diff --git a/conf/config.json b/conf/config.json index 50b969a..f76fdf8 100644 --- a/conf/config.json +++ b/conf/config.json @@ -17,6 +17,6 @@ "https://matrix-client.matrix.org": false }, "embedded_pages": { - "login_for_welcome": true + "login_for_welcome": __LOGIN_FOR_WELCOME__ } } diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..eb60310 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,16 @@ +version = "1.0" + +[main] +name = "Element configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration Options" + + [main.config.login_for_welcome] + ask = "Display login as welcome page" + type = "boolean" + yes = "true" + no = "false" + help = "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." + bind = "login_for_welcome:/var/www/__APP__/config.json" diff --git a/scripts/install b/scripts/install index 39c9aec..884772c 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,8 @@ default_home_server=$YNH_APP_ARG_DEFAULT_HOME_SERVER app=$YNH_APP_INSTANCE_NAME +login_for_welcome="true" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -47,6 +49,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server +ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome #================================================= # CREATE DEDICATED USER diff --git a/scripts/upgrade b/scripts/upgrade index 2d4a6b8..a98f683 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,8 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) default_home_server=$(ynh_app_setting_get --app=$app --key=default_home_server) +login_for_welcome=$(ynh_app_setting_get --app=$app --key=login_for_welcome) + #================================================= # CHECK VERSION #================================================= @@ -52,6 +54,11 @@ if [ -z "$default_home_server" ]; then ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server fi +if [ -z "$login_for_welcome" ]; then + login_for_welcome="true" + ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all