mirror of
https://github.com/YunoHost-Apps/lstu_ynh.git
synced 2024-09-03 19:36:12 +02:00
Merge pull request #26 from YunoHost-Apps/add-change-theme
Add change theme
This commit is contained in:
commit
14bc637716
5 changed files with 22 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
path="/path" (PATH)
|
path="/path" (PATH)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
|
theme="milligram" (THEME)
|
||||||
password="verysecretpassword" (PASSWORD)
|
password="verysecretpassword" (PASSWORD)
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
# choose a theme. See the available themes in `themes` directory
|
# choose a theme. See the available themes in `themes` directory
|
||||||
# optional, default is 'default'
|
# optional, default is 'default'
|
||||||
theme => 'default',
|
theme => '__SELECTED_THEME__', # default or milligram
|
||||||
|
|
||||||
# number of URLs to be displayed per page in /stats
|
# number of URLs to be displayed per page in /stats
|
||||||
# optional, default is 10
|
# optional, default is 10
|
||||||
|
|
|
@ -51,6 +51,16 @@
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "theme",
|
||||||
|
"type": "string",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a theme",
|
||||||
|
"fr": "Choisissez un theme"
|
||||||
|
},
|
||||||
|
"choices": ["default","milligram"],
|
||||||
|
"default": "milligram"
|
||||||
|
},
|
||||||
|
{
|
||||||
"name": "password",
|
"name": "password",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
|
|
@ -27,6 +27,7 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
theme=$YNH_APP_ARG_THEME
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
@ -65,6 +66,7 @@ ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
ynh_app_setting_set $app port $port
|
ynh_app_setting_set $app port $port
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
ynh_app_setting_set $app theme $theme
|
||||||
hashed_password=$(echo -n $password | sha256sum | cut -d' ' -f1)
|
hashed_password=$(echo -n $password | sha256sum | cut -d' ' -f1)
|
||||||
ynh_app_setting_set $app hashed_password $hashed_password
|
ynh_app_setting_set $app hashed_password $hashed_password
|
||||||
|
|
||||||
|
@ -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_NAME__" "$db_name" "${final_path}/lstu.conf"
|
||||||
ynh_replace_string "__DB_USER__" "$db_user" "${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 "__DB_PWD__" "$db_pwd" "${final_path}/lstu.conf"
|
||||||
|
ynh_replace_string "__SELECTED_THEME__" "$theme" "${final_path}/lstu.conf"
|
||||||
ynh_replace_string "__PASSWORD_HASHED__" "$hashed_password" "${final_path}/lstu.conf"
|
ynh_replace_string "__PASSWORD_HASHED__" "$hashed_password" "${final_path}/lstu.conf"
|
||||||
|
|
||||||
secret=$(ynh_string_random 24)
|
secret=$(ynh_string_random 24)
|
||||||
|
|
|
@ -35,6 +35,7 @@ secret=$(ynh_app_setting_get $app secret)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get $app psqlpwd)
|
db_pwd=$(ynh_app_setting_get $app psqlpwd)
|
||||||
|
theme=$(ynh_app_setting_get $app theme)
|
||||||
hashed_password=$(ynh_app_setting_get $app hashed_password)
|
hashed_password=$(ynh_app_setting_get $app hashed_password)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -69,6 +70,11 @@ if [ -z "$db_pwd" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$theme" ]; then
|
||||||
|
theme="milligram"
|
||||||
|
ynh_app_setting_set $app theme $theme
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$hashed_password" ]; then
|
if [ -z "$hashed_password" ]; then
|
||||||
# Generate random password
|
# Generate random password
|
||||||
password=$(openssl rand -hex 8)
|
password=$(openssl rand -hex 8)
|
||||||
|
@ -112,6 +118,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_NAME__" "$db_name" "${final_path}/lstu.conf"
|
||||||
ynh_replace_string "__DB_USER__" "$db_user" "${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 "__DB_PWD__" "$db_pwd" "${final_path}/lstu.conf"
|
||||||
|
ynh_replace_string "__SELECTED_THEME__" "$theme" "${final_path}/lstu.conf"
|
||||||
ynh_replace_string "__PASSWORD_HASHED__" "$hashed_password" "${final_path}/lstu.conf"
|
ynh_replace_string "__PASSWORD_HASHED__" "$hashed_password" "${final_path}/lstu.conf"
|
||||||
|
|
||||||
ynh_replace_string "__SECRET__" "$secret" "${final_path}/lstu.conf"
|
ynh_replace_string "__SECRET__" "$secret" "${final_path}/lstu.conf"
|
||||||
|
|
Loading…
Add table
Reference in a new issue