1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/question2answer_ynh.git synced 2024-09-03 20:16:07 +02:00

URLencode the q2a_name

This commit is contained in:
Nils VAN ZUIJLEN 2021-03-26 18:20:59 +01:00
parent 1622f13c13
commit ae4ad4ca83
2 changed files with 18 additions and 3 deletions

View file

@ -55,6 +55,21 @@ ynh_local_curl_csrf () {
curl --silent --show-error --insecure --location --header "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar $cookiefile --cookie $cookiefile
}
#Convert --data to --data-urlencode before ynh_local_curl
myynh_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
}
#=================================================
# FUTURE OFFICIAL HELPERS

View file

@ -30,7 +30,7 @@ admin=$YNH_APP_ARG_ADMIN
email=`ynh_user_get_info "$admin" 'mail'`
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
q2a_name=${YNH_APP_ARG_Q2A_NAME// /%20}
q2a_name=$YNH_APP_ARG_Q2A_NAME
### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID
@ -206,8 +206,8 @@ admin_temp_pass=$(ynh_string_random 10)
ynh_local_curl "/index.php?qa=install" "create=Set+up+the+Database+including+User+Management"
ynh_local_curl "/index.php?qa=install" "handle=$admin" "password=$admin_temp_pass" "email=$email" "super=Set+up+the+Super+Administrator"
ynh_local_curl_csrf "/index.php?qa=admin&qa_1=general"\
"option_site_title=$q2a_name"\
"option_site_url=https%3A%2F%2F$domain$path_url"\
`myynh_urlencode "option_site_title=$q2a_name"`\
`myynh_urlencode "option_site_url=https://$domain$path_url"`\
"option_neat_urls=0"\
"option_site_language=$language"\
"option_site_theme=SnowFlat"\