diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 00000000..dadb8eba --- /dev/null +++ b/config_panel.toml @@ -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" diff --git a/scripts/install b/scripts/install index 940ed481..bc1e73a7 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= app_key="base64:$(ynh_string_random --length=32 | base64)" - +open_registration="true" fpm_footprint="low" fpm_free_footprint=0 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=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_free_footprint --value=$fpm_free_footprint ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage diff --git a/scripts/upgrade b/scripts/upgrade index 092fb00b..c32e2c0b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,6 +54,12 @@ if [ -z "${app_key:-}" ]; then ynh_app_setting_set --app="$app" --key=app_key --value="$app_key" 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 ynh_script_progression --message="Ensuring upgrade compatibility to 0.9.0~ynh3..."