From 51f0c5cc395740a7a7180b6fefd124ea0f21132f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 9 Jun 2024 08:16:18 +0200 Subject: [PATCH] fix --- config_panel.toml.example => config_panel.toml | 6 ++---- scripts/install | 2 ++ scripts/upgrade | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) rename config_panel.toml.example => config_panel.toml (70%) diff --git a/config_panel.toml.example b/config_panel.toml similarity index 70% rename from config_panel.toml.example rename to config_panel.toml index 94fc659..8b1e789 100644 --- a/config_panel.toml.example +++ b/config_panel.toml @@ -10,8 +10,6 @@ services = ["__APP__"] [main.configuration.link] ask = "Public link sharing time" - type = "boolean" - yes = "true" - no = "false" - help = "Public link sharing time in hours" + type = "number" + help = "Indicate the public link sharing time in hours" bind = "public_share_ttl:__DATA_DIR__/config.toml" diff --git a/scripts/install b/scripts/install index 298086f..f7c153a 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,9 @@ source /usr/share/yunohost/helpers #================================================= key=$(ynh_string_random --length=50) + public_share_ttl="48" +ynh_app_setting_set --app=$app --key=public_share_ttl --value=$public_share_ttl #================================================= # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) diff --git a/scripts/upgrade b/scripts/upgrade index c933522..d51d43a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,6 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +if [ -z "${public_share_ttl:-}" ]; then + public_share_ttl="48" + ynh_app_setting_set --app="$app" --key=public_share_ttl --value=$public_share_ttl +fi + +if [ -z "${key:-}" ]; then + key=$(ynh_string_random --length=50) + + ynh_app_setting_set --app="$app" --key=key --value=$key +fi + #================================================= # STOP SYSTEMD SERVICE #=================================================