1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bozon_ynh.git synced 2024-09-03 18:16:09 +02:00
This commit is contained in:
ewilly 2019-11-18 10:23:03 +01:00
parent 6c43d1c3ed
commit cface75870
3 changed files with 36 additions and 14 deletions

View file

@ -19,7 +19,7 @@
"multi_instance": false,
"services": [
"nginx",
"php7-fpm"
"php7.0-fpm"
],
"arguments": {
"install" : [

View file

@ -3,11 +3,7 @@
#
# Package dependencies
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
PKG_DEPENDENCIES="php-zip php-curl php-gd"
else
PKG_DEPENDENCIES="php5-curl php5-gd"
fi
PKG_DEPENDENCIES="php-zip php-curl php-gd"
# Check if directory/file already exists (path in argument)
myynh_check_path () {
@ -49,3 +45,35 @@ myynh_set_permissions () {
chown -R "$app": "$data_path"
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"
}

View file

@ -74,14 +74,8 @@ ynh_app_setting_set "$app" unprotected_uris "/"
yunohost app ssowatconf
# fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?)
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 https://localhost"$path_url"/ > /dev/null 2>&1
sleep 1
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 -X POST \
--data-urlencode creation="1" \
--data-urlencode login="$admin" \
--data-urlencode pass="$password" \
--data-urlencode confirm="$password" \
https://localhost"$path_url"/index.php?p=login > /dev/null 2>&1
admin_url="/index.php?p=login"
myynh_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 [ $is_public -eq 0 ]