1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

add config panel

This commit is contained in:
Éric Gaspar 2023-06-03 12:01:44 +02:00
parent b5158ba1ef
commit d4c1f305aa
3 changed files with 24 additions and 1 deletions

16
config_panel.toml Normal file
View file

@ -0,0 +1,16 @@
version = "1.0"
[main]
name = "Pixelfed configuration"
services = ["__APP__"]
[main.config]
name = "Configuration Options"
[main.config.open_registration]
ask = "Open Registration"
type = "boolean"
yes = "true"
no = "false"
help = "Registrations are open by default."
bind = "OPEN_REGISTRATION:__INSTALL_DIR__/.env"

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
app_key="base64:$(ynh_string_random --length=32 | base64)" app_key="base64:$(ynh_string_random --length=32 | base64)"
open_registration="true"
fpm_footprint="low" fpm_footprint="low"
fpm_free_footprint=0 fpm_free_footprint=0
fpm_usage="low" fpm_usage="low"
@ -24,6 +24,7 @@ fpm_usage="low"
#================================================= #=================================================
ynh_app_setting_set --app=$app --key=app_key --value=$app_key ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_app_setting_set --app=$app --key=open_registration --value=$open_registration
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage

View file

@ -54,6 +54,12 @@ if [ -z "${app_key:-}" ]; then
ynh_app_setting_set --app="$app" --key=app_key --value="$app_key" ynh_app_setting_set --app="$app" --key=app_key --value="$app_key"
fi fi
# If open_registration doesn't exist, retrieve it
if [ -z "${open_registration:-}" ]; then
open_registration="true"
ynh_app_setting_set --app="$app" --key=open_registration --value=$open_registration
fi
if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then if dpkg --compare-versions "0.9.0~ynh3" gt "$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)" ; then
ynh_script_progression --message="Ensuring upgrade compatibility to 0.9.0~ynh3..." ynh_script_progression --message="Ensuring upgrade compatibility to 0.9.0~ynh3..."