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"
|
chown root: "$data_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Change --data to --data-urlencode
|
#Convert --data to --data-urlencode before ynh_local_curl
|
||||||
myynh_local_curl () {
|
urlencode() {
|
||||||
# Define url of page to curl
|
local data
|
||||||
local local_page=$(ynh_normalize_url_path $1)
|
if [[ $# != 1 ]]; then
|
||||||
local full_path=$path_url$local_page
|
echo "Usage: $0 string-to-urlencode"
|
||||||
|
return 1
|
||||||
if [ "${path_url}" == "/" ]; then
|
fi
|
||||||
full_path=$local_page
|
data="$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "$1" "")"
|
||||||
fi
|
if [[ $? != 3 ]]; then
|
||||||
|
echo "Unexpected error" 1>&2
|
||||||
local full_page_url=https://localhost$full_path
|
return 2
|
||||||
|
fi
|
||||||
# Concatenate all other arguments with '&' to prepare POST data
|
echo "${data##/?}"
|
||||||
local POST_data=""
|
return 0
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ?)
|
# 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_url="/index.php?p=login"
|
||||||
|
admin=$(urlencode $admin)
|
||||||
|
password=$(urlencode $password)
|
||||||
ynh_local_curl $admin_url "creation=1" "login=$admin" "pass=$password" "confirm=$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
|
# if app is private, remove url to SSOWat conf from skipped_uris
|
||||||
|
|
Loading…
Add table
Reference in a new issue