1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redirect_ynh.git synced 2024-09-03 20:16:10 +02:00

Just adding some getops

This commit is contained in:
Kayou 2024-01-02 23:05:32 +01:00 committed by GitHub
parent 2be200f19a
commit 2684e51427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -5,13 +5,13 @@ URL_REGEX_SECURE='^(http://(127\.[0-9]+\.[0-9]+\.[0-9]+|localhost)|https://.*)(:
_validate_redirect_uri() {
if [[ ! $target =~ $URL_REGEX_VALID ]]; then
ynh_die "Invalid destination: $target" 1
ynh_die --message="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_die "For secure reason, you can't use an unencrypted http remote destination couple with ssowat for your reverse proxy: $target" 1
ynh_die --message="For secure reason, you can't use an unencrypted http remote destination couple with ssowat for your reverse proxy: $target" 1
fi
}

View file

@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# Copy the conf files
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup --src_path="/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# END OF SCRIPT

View file

@ -3,7 +3,7 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_restore_file --origin_path="/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

View file

@ -12,12 +12,12 @@ if [[ "${redirect_type:-}" == *"proxy"* ]]; then
else
redirect_type="redirect"
fi
ynh_app_setting_set $app 'redirect_type' $redirect_type
ynh_app_setting_set --app=$app --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="$redirect_path"
ynh_app_setting_set --app=$app --key=target --value="$target"
fi
# When testing on the CI, we need a service to test the reverse-proxying