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 2016-10-12 20:59:47 +02:00
parent 1b2760b4ef
commit c326837466

View file

@ -84,34 +84,33 @@ sudo cp ../conf/php-fpm.conf "$phpfpm_conf"
sudo chown root: "$phpfpm_conf"
sudo chmod 644 "$phpfpm_conf"
# if app is private, remove url to SSOWat conf from skipped_uris
if [ "$is_public" = "No" ];
then
# escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html)
domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
pathluaregex=$(echo "$path" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
# redirect to SSOwat login in
#ynh_app_setting_delete "$app" unprotected_uris
ynh_app_setting_set "$app" unprotected_regex \
"${domainluaregex}${pathluaregex}/index.php%?f=.+$", \
"${domainluaregex}${pathluaregex}/index.php%?zipfolder=.+$", \
"${domainluaregex}${pathluaregex}/private/temp/.+%.zip$", \
"${domainluaregex}${pathluaregex}/core/js/.*$", \
"${domainluaregex}${pathluaregex}/templates/.*$"
else
ynh_app_setting_set "$app" unprotected_uris "/"
fi
# restart services
sudo service php5-fpm restart || true
sudo service nginx restart || true
# set temporary public access
ynh_app_setting_set "$app" unprotected_uris "/"
sudo yunohost app ssowatconf
# fill the superadmin creation form
curl_path=$([ "$path" == "/" ] || echo "$path")
curl https://"$domain""$curl_path"/index.php?p=login > /dev/null 2>&1
curl https://"$domain""$curl_path"/ > /dev/null 2>&1
curl -X POST \
--data-urlencode creation="1" \
--data-urlencode login="$admin" \
--data-urlencode pass="$password" \
--data-urlencode confirm="$password" \
https://"$domain""$curl_path"/index.php?p=login > /dev/null 2>&1
# if app is private, remove url to SSOWat conf from skipped_uris
if [ "$is_public" = "No" ];
then
ynh_app_setting_delete "$app" unprotected_uris
# escape magic chars in vars (lua magic chars are ().%+-*?[^$ according to https://www.lua.org/pil/20.2.html)
domainluaregex=$(echo "$domain" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
pathluaregex=$(echo "$path" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g')
regexList=${domainluaregex}${pathluaregex}/index.php%?f=.+$","${domainluaregex}${pathluaregex}/index.php%?zipfolder=.+$","${domainluaregex}${pathluaregex}/private/temp/.+%.zip$","${domainluaregex}${pathluaregex}/core/js/.*$","${domainluaregex}${pathluaregex}/templates/.*$"
ynh_app_setting_set "$app" unprotected_regex "$regexList"
fi
sudo yunohost app ssowatconf