1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yourls_ynh.git synced 2024-09-03 20:35:59 +02:00
This commit is contained in:
ericgaspar 2020-09-25 19:26:57 +02:00
parent b8de0edaec
commit 6f728c3dec
No known key found for this signature in database
GPG key ID: 574F281483054D44
3 changed files with 3 additions and 54 deletions

View file

@ -1,11 +0,0 @@
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")
else:
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

@ -114,22 +114,6 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --targ
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php" ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php"
ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php" ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php"
# 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".
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 --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/add_sso_conf.py"
if [ "$path_url" != "/" ]; then
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/add_sso_conf.py"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/remove_sso_conf.py"
else
ynh_replace_string --match_string="__PATH__" --replace_string="" --target_file="$final_path/add_sso_conf.py"
ynh_replace_string --match_string="__PATH__" --replace_string="" --target_file="$final_path/remove_sso_conf.py"
fi
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$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/yourls_ynh"
# Set permissions # Set permissions
chown -R $app: $final_path chown -R $app: $final_path
@ -138,10 +122,6 @@ chown -R $app: $final_path
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# Restrict access to admin only
yunohost app addaccess --users=$admin $app
yunohost app ssowatconf
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================

View file

@ -59,10 +59,6 @@ ynh_script_progression --message="Restoring the app main directory..." --time --
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
# 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"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -99,32 +95,16 @@ chown -R $app: $final_path
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
sudo yunohost app setting $app unprotected_uris -v "/" ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
#================================================= ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
# SETUP SSOWAT
#=================================================
# Restrict access to admin only
yunohost app addaccess --users=$admin $app
yunohost app ssowatconf
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================