diff --git a/manifest.toml b/manifest.toml index 5bf1fa6..76b8a5b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -16,7 +16,8 @@ license = "AGPL-3.0-or-later" website = "https://en.wikipedia.org/wiki/Reverse_proxy" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = "not_relevant" diff --git a/scripts/_common.sh b/scripts/_common.sh index be244cc..971f031 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,12 +5,12 @@ URL_REGEX_SECURE='^(http://(127\.[0-9]+\.[0-9]+\.[0-9]+|localhost)|https://.*)(: _validate_redirect_uri() { if [[ ! $target =~ $URL_REGEX_VALID ]]; then - ynh_die --message="Invalid destination: $target" 1 + ynh_die "Invalid destination: $target" 1 fi # Avoid uncrypted remote destination with reverse proxy mode # Indeed the SSO send the password in all requests in HTTP headers if [[ "$redirect_type" = "reverseproxy" ]] && [[ ! $target =~ $URL_REGEX_SECURE ]]; then - ynh_print_warn --message="Reverseproxying using cleartext HTTP to a possibly external machine ($target) is insecure ... please be super careful about this." + ynh_print_warn "Reverseproxying using cleartext HTTP to a possibly external machine ($target) is insecure ... please be super careful about this." fi } diff --git a/scripts/backup b/scripts/backup index 942c232..3432740 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source /usr/share/yunohost/helpers #================================================= @@ -13,10 +7,10 @@ source /usr/share/yunohost/helpers #================================================= # Copy the conf files -ynh_backup --src_path="/etc/nginx/conf.d/${domain}.d/${app}.conf" +ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index ce47a56..9380722 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,26 +1,18 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 +ynh_script_progression "Updating NGINX web server configuration..." mv ../conf/{"nginx-$redirect_type.conf",nginx.conf} -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 351e62d..8737d80 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -14,13 +8,13 @@ _validate_redirect_uri #================================================= # CONFIGURE NGINX #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression "Configuring NGINX web server..." mv ../conf/{"nginx-$redirect_type.conf",nginx.conf} -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 5ea4099..6529472 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source /usr/share/yunohost/helpers #================================================= @@ -13,10 +7,10 @@ source /usr/share/yunohost/helpers #================================================= # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 060d0d0..15fe892 100644 --- a/scripts/restore +++ b/scripts/restore @@ -3,13 +3,13 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -ynh_restore_file --origin_path="/etc/nginx/conf.d/${domain}.d/${app}.conf" +ynh_restore "/etc/nginx/conf.d/${domain}.d/${app}.conf" -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +ynh_script_progression "Reloading NGINX web server..." +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 3420a87..272b41b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,20 +12,20 @@ if [[ "${redirect_type:-}" == *"proxy"* ]]; then else redirect_type="redirect" fi -ynh_app_setting_set --app=$app --key='redirect_type' --value=$redirect_type +ynh_app_setting_set --key='redirect_type' --value=$redirect_type if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then target="$redirect_path" - ynh_app_setting_delete --app=$app --key=redirect_path - ynh_app_setting_set --app=$app --key=target --value="$target" + ynh_app_setting_delete --key=redirect_path + ynh_app_setting_set --key=target --value="$target" fi #================================================= # CONFIGURE NGINX #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression "Configuring NGINX web server..." mv ../conf/{nginx-$redirect_type.conf,nginx.conf} -ynh_add_nginx_config +ynh_config_add_nginx -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"