1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

fix upgrade

This commit is contained in:
Salamandar 2024-01-15 23:24:14 +01:00
parent c0cc162d1f
commit a7ec7c8bef
2 changed files with 41 additions and 48 deletions

View file

@ -3,25 +3,25 @@ version = "1.0"
[main]
name = "StandardNotes Server configuration"
[main.new_user]
name = "New User Options"
[main.new_user]
name = "New User Options"
[main.new_user.disable_user_registration]
ask = "Disable user registration?"
type = "boolean"
default = "false"
help = "false = New users can register\ntrue = No new user registrations allowed"
[main.new_user.disable_user_registration]
ask = "Disable user registration?"
type = "boolean"
default = "false"
help = "false = New users can register\ntrue = No new user registrations allowed"
[main.new_user.files_limit]
ask = "Default files limit"
type = "number"
default = "100"
help = "Choose a default limit in MB for the user file upload space.\n 100 = 100 MB\n 1024 = 1GB\n 10240 = 10GB"
[main.new_user.files_limit]
ask = "Default files limit"
type = "number"
default = "100"
help = "Choose a default limit in MB for the user file upload space.\n 100 = 100 MB\n 1024 = 1GB\n 10240 = 10GB"
[main.subscription]
name = "User Subscription"
[main.subscription]
name = "User Subscription"
[main.subscription.info]
ask = ""
type = "alert"
style = "info"
[main.subscription.info]
ask = ""
type = "alert"
style = "info"

View file

@ -51,62 +51,55 @@ ynh_systemd_action \
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If jwt_secret doesn't exist, create it
if [ -z "$jwt_secret" ]; then
# Create non existing settings
if [ -z "${jwt_secret:-}" ]; then
jwt_secret=$(ynh_string_random --length=48 | base64)
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
fi
# If legacy_jwt_secret doesn't exist, create it
if [ -z "$legacy_jwt_secret" ]; then
if [ -z "${legacy_jwt_secret:-}" ]; then
legacy_jwt_secret=$(ynh_string_random --length=48 | base64)
ynh_app_setting_set --app=$app --key=legacy_jwt_secret --value=$legacy_jwt_secret
ynh_app_setting_set --app="$app" --key=legacy_jwt_secret --value="$legacy_jwt_secret"
fi
# If auth_jwt_secret doesn't exist, create it
if [ -z "$auth_jwt_secret" ]; then
if [ -z "${auth_jwt_secret:-}" ]; then
auth_jwt_secret=$(ynh_string_random --length=48 | base64)
ynh_app_setting_set --app=$app --key=auth_jwt_secret --value=$auth_jwt_secret
ynh_app_setting_set --app="$app" --key=auth_jwt_secret --value="$auth_jwt_secret"
fi
# If pseudo_key_params_key doesn't exist, create it
if [ -z "$pseudo_key_params_key" ]; then
if [ -z "${pseudo_key_params_key:-}" ]; then
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key
ynh_app_setting_set --app="$app" --key=pseudo_key_params_key --value="$pseudo_key_params_key"
fi
# If encryption_server_key doesn't exist, create it
if [ -z "$encryption_server_key" ]; then
if [ -z "${encryption_server_key:-}" ]; then
encryption_server_key=$(hexdump -n 32 -e '4/4 "%08X"' /dev/random) # 32bytes hex key is required
ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key
ynh_app_setting_set --app="$app" --key=encryption_server_key --value="$encryption_server_key"
fi
# If valet_token_secret doesn't exist, create it
if [ -z "$valet_token_secret" ]; then
if [ -z "${valet_token_secret:-}" ]; then
valet_token_secret=$(ynh_string_random --length=48 | base64)
ynh_app_setting_set --app=$app --key=valet_token_secret --value=$valet_token_secret
ynh_app_setting_set --app="$app" --key=valet_token_secret --value="$valet_token_secret"
fi
# If disable_user_registration doesn't exist, create it
if [ -z "$disable_user_registration" ]; then
if [ -z "${disable_user_registration:-}" ]; then
disable_user_registration=false
ynh_app_setting_set --app=$app --key=DISABLE_USER_REGISTRATION --value=$disable_user_registration
ynh_app_setting_set --app="$app" --key=DISABLE_USER_REGISTRATION --value="$disable_user_registration"
fi
# If files_zise doesn't exist, create it
if [ -z "$files_size" ]; then
if [ -z "${files_size:-}" ]; then
files_size=100
ynh_app_setting_set --app=$app --key=FILES_SIZE --value=$files_size
ynh_app_setting_set --app="$app" --key=FILES_SIZE --value="$files_size"
fi
# Delete legacy settings
if [ -n "${api_gateway_version_installed+x}" ]; then
ynh_app_setting_delete --app=$app --key=api_gateway_version_installed
ynh_app_setting_delete --app="$app" --key=api_gateway_version_installed
fi
if [ -n "${auth_version_installed+x}" ]; then
ynh_app_setting_delete --app=$app --key=auth_version_installe
ynh_app_setting_delete --app="$app" --key=auth_version_installe
fi
if [ -n "${syncing_server_version_installed+x}" ]; then
ynh_app_setting_delete --app=$app --key=syncing_server_version_installed
ynh_app_setting_delete --app="$app" --key=syncing_server_version_installed
fi
if [ -n "${install_dir_www+x}" ]; then
ynh_app_setting_delete --app=$app --key=install_dir_www
ynh_app_setting_delete --app="$app" --key=install_dir_www
fi
# If install_dir_extensions exist, delete it
if [ -n "${install_dir_extensions+x}" ]; then
ynh_app_setting_delete --app=$app --key=install_dir_extensions
ynh_app_setting_delete --app="$app" --key=install_dir_extensions
fi
# If old service exsits; remove it