mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
Update
This commit is contained in:
parent
21d91e42f3
commit
00146b3582
2 changed files with 16 additions and 30 deletions
|
@ -46,34 +46,18 @@ myynh_set_permissions () {
|
|||
chown root: "$data_path"
|
||||
}
|
||||
|
||||
#Change --data to --data-urlencode
|
||||
myynh_local_curl () {
|
||||
# Define url of page to curl
|
||||
local local_page=$(ynh_normalize_url_path $1)
|
||||
local full_path=$path_url$local_page
|
||||
|
||||
if [ "${path_url}" == "/" ]; then
|
||||
full_path=$local_page
|
||||
fi
|
||||
|
||||
local full_page_url=https://localhost$full_path
|
||||
|
||||
# Concatenate all other arguments with '&' to prepare POST data
|
||||
local POST_data=""
|
||||
local arg=""
|
||||
for arg in "${@:2}"
|
||||
do
|
||||
POST_data="${POST_data}${arg}&"
|
||||
done
|
||||
if [ -n "$POST_data" ]
|
||||
then
|
||||
# Add --data-urlencode arg and remove the last character, which is an unecessary '&'
|
||||
POST_data="--data-urlencode ${POST_data::-1}"
|
||||
fi
|
||||
|
||||
# Wait untils nginx has fully reloaded (avoid curl fail with http2)
|
||||
sleep 2
|
||||
|
||||
# Curl the URL
|
||||
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url"
|
||||
#Convert --data to --data-urlencode before ynh_local_curl
|
||||
urlencode() {
|
||||
local data
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "Usage: $0 string-to-urlencode"
|
||||
return 1
|
||||
fi
|
||||
data="$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "$1" "")"
|
||||
if [[ $? != 3 ]]; then
|
||||
echo "Unexpected error" 1>&2
|
||||
return 2
|
||||
fi
|
||||
echo "${data##/?}"
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ yunohost app ssowatconf
|
|||
|
||||
# fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?)
|
||||
admin_url="/index.php?p=login"
|
||||
admin=$(urlencode $admin)
|
||||
password=$(urlencode $password)
|
||||
ynh_local_curl $admin_url "creation=1" "login=$admin" "pass=$password" "confirm=$password"
|
||||
|
||||
# if app is private, remove url to SSOWat conf from skipped_uris
|
||||
|
|
Loading…
Reference in a new issue