mirror of
https://github.com/YunoHost-Apps/sogo_ynh.git
synced 2024-09-03 20:26:07 +02:00
Cleanup removeme and fix shellcheck
This commit is contained in:
parent
77f7aaf134
commit
76804862a1
1 changed files with 4 additions and 5 deletions
|
@ -27,7 +27,7 @@ location ^~ /Microsoft-Server-ActiveSync {
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:'$port'/SOGo/Microsoft-Server-ActiveSync;
|
proxy_pass http://127.0.0.1:'"$port"'/SOGo/Microsoft-Server-ActiveSync;
|
||||||
}'
|
}'
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
caldav_block='
|
caldav_block='
|
||||||
|
@ -73,7 +73,6 @@ set_permissions() {
|
||||||
|
|
||||||
is_url_handled() {
|
is_url_handled() {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
#REMOVEME? local legacy_args=dp
|
|
||||||
declare -Ar args_array=( [d]=domain= [p]=path= )
|
declare -Ar args_array=( [d]=domain= [p]=path= )
|
||||||
local domain
|
local domain
|
||||||
local path
|
local path
|
||||||
|
@ -82,7 +81,7 @@ is_url_handled() {
|
||||||
|
|
||||||
# Try to get the url with curl, and keep the http code and an eventual redirection url.
|
# Try to get the url with curl, and keep the http code and an eventual redirection url.
|
||||||
local curl_output="$(curl --insecure --silent --output /dev/null \
|
local curl_output="$(curl --insecure --silent --output /dev/null \
|
||||||
--write-out '%{http_code};%{redirect_url}' https://127.0.0.1$path --header "Host: $domain" --resolve $domain:443:127.0.0.1)"
|
--write-out '%{http_code};%{redirect_url}' https://127.0.0.1"$path" --header "Host: $domain" --resolve "$domain":443:127.0.0.1)"
|
||||||
|
|
||||||
# Cut the output and keep only the first part to keep the http code
|
# Cut the output and keep only the first part to keep the http code
|
||||||
local http_code="${curl_output%%;*}"
|
local http_code="${curl_output%%;*}"
|
||||||
|
@ -93,10 +92,10 @@ is_url_handled() {
|
||||||
# Which means either curl got a 404 (or the admin) or the sso.
|
# Which means either curl got a 404 (or the admin) or the sso.
|
||||||
# A handled url should redirect to a publicly accessible url.
|
# A handled url should redirect to a publicly accessible url.
|
||||||
# Return 1 if the url has returned 404
|
# Return 1 if the url has returned 404
|
||||||
if [ "$http_code" = "404" ] || [[ $redirection =~ "/yunohost/admin" ]]; then
|
if [ "$http_code" = "404" ] || [[ "$redirection" =~ "/yunohost/admin" ]]; then
|
||||||
return 1
|
return 1
|
||||||
# Return 1 if the url is redirected to the SSO
|
# Return 1 if the url is redirected to the SSO
|
||||||
elif [[ $redirection =~ "/yunohost/sso" ]]; then
|
elif [[ "$redirection" =~ "/yunohost/sso" ]]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue