mirror of
https://github.com/YunoHost-Apps/redirect_ynh.git
synced 2024-09-03 20:16:10 +02:00
Moar misc fixes following tests...
This commit is contained in:
parent
ef4ed69b65
commit
5ccd094fa9
3 changed files with 12 additions and 25 deletions
|
@ -39,11 +39,6 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
|||
redirect_type=$YNH_APP_ARG_REDIRECT_TYPE
|
||||
redirect_path=$YNH_APP_ARG_REDIRECT_PATH
|
||||
|
||||
# Remove trailing slash to path
|
||||
path_url=${path_url%/}
|
||||
#force location to be / or /foo
|
||||
location=${path_url:-/}
|
||||
|
||||
# Check domain/path availability
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
|
@ -59,7 +54,7 @@ ynh_app_setting_set $app redirect_path "$redirect_path"
|
|||
# Nginx configuration
|
||||
for FILE in $(ls ../conf/nginx-*.conf)
|
||||
do
|
||||
ynh_replace_string "YNH_LOCATION" "$location" $FILE
|
||||
ynh_replace_string "YNH_LOCATION" "$path_url" $FILE
|
||||
done
|
||||
if [ "$redirect_type" = "visible_302" ];
|
||||
then
|
||||
|
@ -79,12 +74,12 @@ fi
|
|||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
if [[ "$is_public" -eq 0 ]]
|
||||
if [ $is_public -eq 0 ]
|
||||
then # Remove the public access
|
||||
ynh_app_setting_delete "$app" skipped_uris
|
||||
fi
|
||||
# Make app public if necessary
|
||||
if [[ "$is_public" -eq 1 ]]
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
|
|
|
@ -39,17 +39,11 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
# Retrieve arguments
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path_url=$(ynh_app_setting_get "$app" path_url)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||
redirect_type=$(ynh_app_setting_get "$app" redirect_type)
|
||||
redirect_path=$(ynh_app_setting_get "$app" redirect_path)
|
||||
|
||||
# Remove trailing slash to path
|
||||
path_url=${path_url%/}
|
||||
|
||||
# Check domain/path availability
|
||||
ynh_webpath_register $app $domain $path
|
||||
|
||||
# Validate redirect path
|
||||
url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
|
||||
[[ ! $redirect_path =~ $url_regex ]] && ynh_die "Invalid destination: $redirect_path" 1
|
||||
|
@ -65,12 +59,12 @@ cp -a ./conf/nginx.conf "$NGINX_CONF"
|
|||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
if [[ "$is_public" -eq 0 ]]
|
||||
if [ "$is_public" -eq 0 ]
|
||||
then # Remove the public access
|
||||
ynh_app_setting_delete "$app" skipped_uris
|
||||
fi
|
||||
# Make app public if necessary
|
||||
if [[ "$is_public" -eq 1 ]]
|
||||
if [ "$is_public" -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
|
|
|
@ -69,17 +69,15 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
# Remove trailing slash to path
|
||||
path_url=${path_url%/}
|
||||
#force location to be / or /foo
|
||||
location=${path_url:-/}
|
||||
|
||||
# Validate redirect path
|
||||
url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
|
||||
[[ ! $redirect_path =~ $url_regex ]] && ynh_die "Invalid destination: $redirect_path" 1
|
||||
|
||||
# Nginx configuration
|
||||
ynh_replace_string "YNH_LOCATION" "$location" ../conf/nginx-*.conf
|
||||
for FILE in $(ls ../conf/nginx-*.conf)
|
||||
do
|
||||
ynh_replace_string "YNH_LOCATION" "$path_url" $FILE
|
||||
done
|
||||
if [ "$redirect_type" = "visible_302" ];
|
||||
then
|
||||
ynh_replace_string "YNH_REDIRECT_PATH" "$redirect_path" ../conf/nginx-visible-302.conf
|
||||
|
@ -98,12 +96,12 @@ fi
|
|||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
if [[ "$is_public" -eq 0 ]]
|
||||
if [ "$is_public" -eq 0 ]
|
||||
then # Remove the public access
|
||||
ynh_app_setting_delete "$app" skipped_uris
|
||||
fi
|
||||
# Make app public if necessary
|
||||
if [[ "$is_public" -eq 1 ]]
|
||||
if [ "$is_public" -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_app_setting_set "$app" unprotected_uris -v "/"
|
||||
|
|
Loading…
Reference in a new issue