From 3c8a1640ba78593298b9fb2ef199313ad1993fd9 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 14 Feb 2019 23:39:36 +0100 Subject: [PATCH 1/2] add change theme --- conf/lstu.conf.template | 2 +- manifest.json | 10 ++++++++++ scripts/install | 3 +++ scripts/upgrade | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/conf/lstu.conf.template b/conf/lstu.conf.template index 6796cb0..9dbbc8c 100644 --- a/conf/lstu.conf.template +++ b/conf/lstu.conf.template @@ -33,7 +33,7 @@ # choose a theme. See the available themes in `themes` directory # optional, default is 'default' - theme => 'default', + theme => '__SELECTED_THEME__', # default or milligram # number of URLs to be displayed per page in /stats # optional, default is 10 diff --git a/manifest.json b/manifest.json index 9e6a229..0964e64 100644 --- a/manifest.json +++ b/manifest.json @@ -49,6 +49,16 @@ "fr": "Est-ce une application publique ?" }, "default": false + }, + { + "name": "theme", + "type": "string", + "ask": { + "en": "Choose a theme", + "fr": "Choisissez un theme" + }, + "choices": ["default","milligram"], + "default": "milligram" } ] } diff --git a/scripts/install b/scripts/install index 9a54996..91b1ea9 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC +theme=$YNH_APP_ARG_THEME app=$YNH_APP_INSTANCE_NAME @@ -67,6 +68,7 @@ ynh_app_setting_set $app domain $domain ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app port $port ynh_app_setting_set $app path $path_url +ynh_app_setting_set $app theme $theme #================================================= # INSTALL DEPENDENCIES @@ -122,6 +124,7 @@ ynh_replace_string "__PORT__" "$port" "${final_path}/lstu.conf" ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lstu.conf" ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lstu.conf" ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lstu.conf" +ynh_replace_string "__SELECTED_THEME__" "$theme" "${final_path}/lstu.conf" secret=$(ynh_string_random 24) ynh_app_setting_set $app secret $secret diff --git a/scripts/upgrade b/scripts/upgrade index 04c96c8..7f11da8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,7 @@ secret=$(ynh_app_setting_get $app secret) db_name=$(ynh_app_setting_get $app db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get $app psqlpwd) +theme=$(ynh_app_setting_get $app theme) #================================================= # FIX OLD THINGS @@ -68,6 +69,12 @@ if [ -z "$db_pwd" ]; then fi fi +if [ -z "$theme" ]; then + theme="milligram" + ynh_app_setting_set $app theme $theme +fi + + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -97,6 +104,7 @@ ynh_replace_string "__PORT__" "$port" "${final_path}/lstu.conf" ynh_replace_string "__DB_NAME__" "$db_name" "${final_path}/lstu.conf" ynh_replace_string "__DB_USER__" "$db_user" "${final_path}/lstu.conf" ynh_replace_string "__DB_PWD__" "$db_pwd" "${final_path}/lstu.conf" +ynh_replace_string "__SELECTED_THEME__" "$theme" "${final_path}/lstu.conf" ynh_replace_string "__SECRET__" "$secret" "${final_path}/lstu.conf" ynh_store_file_checksum "${final_path}/lstu.conf" From 923b53b7a3d951d772fc837425200052f965e34d Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 15 Feb 2019 00:32:19 +0100 Subject: [PATCH 2/2] add arguement in check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 74c836a..93e2fc5 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ domain="domain.tld" (DOMAIN) path="/path" (PATH) is_public=1 (PUBLIC|public=1|private=0) - + theme="milligram" (THEME) ; Checks pkg_linter=1 setup_sub_dir=1