diff --git a/check_process b/check_process index 633486f..cbcaa6a 100644 --- a/check_process +++ b/check_process @@ -1,18 +1,16 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) path="/ampache" (PATH) admin="john" (USER) + is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 setup_nourl=0 - setup_private=0 - setup_public=0 + setup_private=1 + setup_public=1 upgrade=1 upgrade=1 from_commit=11caf9791c48fdcd632193a1c82ea52d4819b328 backup_restore=1 diff --git a/manifest.json b/manifest.json index 1d920c3..571cf98 100644 --- a/manifest.json +++ b/manifest.json @@ -51,6 +51,15 @@ "fr": "Administrateur du serveur Ampache (doit etre un utilisateur Yunohost existant)" }, "example": "homer" + }, + { + "name": "is_public", + "type": "boolean", + "ask": { + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" + }, + "default": true } ] } diff --git a/scripts/install b/scripts/install index 121ba30..3d7877b 100644 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin_ampache=$YNH_APP_ARG_ADMIN +is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -46,6 +47,7 @@ ynh_webpath_register $app $domain $path_url ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app admin $admin_ampache +ynh_app_setting_set $app is_public $is_public #================================================= # STANDARD MODIFICATIONS @@ -177,6 +179,16 @@ ynh_secure_remove /tmp/admin.sql # Set permissions to ampache directory chown -R $app: $final_path +#================================================= +# SETUP SSOWAT +#================================================= + +# Keep app public if necessary +if [ $is_public -eq 0 ] +then + ynh_app_setting_delete $app unprotected_uris +fi + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 03fe0de..795be59 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,6 +16,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) admin_ampache=$(ynh_app_setting_get $app admin) +is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) secret_key=$(ynh_app_setting_get $app secret_key) @@ -24,6 +25,21 @@ secret_key=$(ynh_app_setting_get $app secret_key) # ENSURE DOWNWARD COMPATIBILITY #================================================= +# If is_public doesn't exist, create it +if [ -z $is_public ]; then + is_public=1 + ynh_app_setting_set $app is_public $is_public +fi + +# Fix is_public as a boolean value +if [ "$is_public" = "Yes" ]; then + ynh_app_setting_set $app is_public 1 + is_public=1 +elif [ "$is_public" = "No" ]; then + ynh_app_setting_set $app is_public 0 + is_public=0 +fi + # If db_name doesn't exist, create it if [ -z $db_name ]; then db_name=$(ynh_sanitize_dbid $app) @@ -42,6 +58,8 @@ if [ -z $secret_key ]; then ynh_app_setting_set $app secret_key $secret_key fi +ynh_app_setting_delete $app skipped_uris + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -163,6 +181,15 @@ sleep 1 # Set permissions on app files chown -R $app: $final_path +#================================================= +# SETUP SSOWAT +#================================================= + +# Keep app public if necessary +if [ $is_public -eq 0 ] +then + ynh_app_setting_delete $app unprotected_uris +fi #================================================= # RELOAD NGINX