1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yourls_ynh.git synced 2024-09-03 20:35:59 +02:00

Fixed error in path for SSO

This commit is contained in:
anmol 2019-01-05 00:17:57 +05:30
parent df240c649d
commit 4c896e46b9
5 changed files with 19 additions and 9 deletions

View file

@ -3,9 +3,9 @@ import json
with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile:
data = json.load(jsonFile)
if "protected_urls" in data:
data["protected_urls"].append("__DOMAIN__/__PATH__/admin")
data["protected_urls"].append("__DOMAIN____PATH__/admin")
else:
data["protected_urls"] = ["__DOMAIN__/__PATH__/admin"]
data["protected_urls"] = ["__DOMAIN____PATH__/admin"]
with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile:
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))

View file

@ -2,7 +2,7 @@ import json
with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile:
data = json.load(jsonFile)
data["protected_urls"].remove("__DOMAIN__/__PATH__/admin")
data["protected_urls"].remove("__DOMAIN____PATH__/admin")
with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile:
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))

View file

@ -126,9 +126,15 @@ ynh_replace_string "modify this text with something random" "$(ynh_string_random
cp ../conf/add_sso_conf.py $final_path/add_sso_conf.py
cp ../conf/remove_sso_conf.py $final_path/remove_sso_conf.py
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/add_sso_conf.py"
if [ "$path_url" != "/" ]; then
ynh_replace_string "__PATH__" "$path_url" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/remove_sso_conf.py"
else
ynh_replace_string "__PATH__" "" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "" "$final_path/remove_sso_conf.py"
fi
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/remove_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/remove_sso_conf.py"
python3 $final_path/add_sso_conf.py || ynh_die "Your file /etc/ssowat/conf.json.persistent don't respect the json synaxe. Please fix the synaxe to install this app. For more information see here : https://github.com/YunoHost-Apps/synapse_ynh/issues/32"

View file

@ -56,8 +56,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file "$final_path"
# Open access to server without a button the home
# The script "add_sso_conf.py" will just add en entry for the path "/_matrix" in the sso conf.json.persistent file in the cathegory "skipped_urls".
# The script "add_sso_conf.py" will just add en entry for the path "/admin" in the sso conf.json.persistent file in the cathegory "protected_urls".
python3 $final_path/add_sso_conf.py || ynh_die "Your file /etc/ssowat/conf.json.persistent don't respect the json synaxe. Please fix the synaxe to install this app. For more information see here : https://github.com/YunoHost-Apps/synapse_ynh/issues/32"

View file

@ -84,9 +84,14 @@ sudo cp -a "$tmpdir/user/config.php" "$final_path/user"
cp ../conf/add_sso_conf.py $final_path
cp ../conf/remove_sso_conf.py $final_path
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/add_sso_conf.py"
if [ "$path_url" != "/" ]; then
ynh_replace_string "__PATH__" "$path_url" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/remove_sso_conf.py"
else
ynh_replace_string "__PATH__" "" "$final_path/add_sso_conf.py"
ynh_replace_string "__PATH__" "" "$final_path/remove_sso_conf.py"
fi
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/remove_sso_conf.py"
ynh_replace_string "__PATH__" "$path_url" "$final_path/remove_sso_conf.py"
#remove tmp dir
sudo rm -Rf "$tmpdir"