1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Fix linter warning and error

This commit is contained in:
tituspijean 2021-02-08 21:19:11 +01:00
parent f93d4e7c15
commit e57336d8b0
6 changed files with 10 additions and 62 deletions

View file

@ -1,28 +0,0 @@
import json
import sys
domain = sys.argv[1]
server_name = sys.argv[2]
with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile:
data = json.load(jsonFile)
if "skipped_urls" not in data:
data["skipped_urls"] = []
if "protected_urls" not in data:
data["protected_urls"] = []
# Remove entry without the domain specified
if "/_matrix" in data["skipped_urls"]:
data["skipped_urls"].remove("/_matrix")
if domain + "/_matrix" not in data["skipped_urls"]:
data["skipped_urls"].append(domain + "/_matrix")
if server_name + "/.well-known/matrix/" not in data["skipped_urls"]:
data["skipped_urls"].append(server_name + "/.well-known/matrix/")
if domain + "/_matrix/cas_server.php/login" not in data["protected_urls"]:
data["protected_urls"].append(domain + "/_matrix/cas_server.php/login")
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

@ -1,15 +0,0 @@
import json
import sys
domain = sys.argv[1]
server_name = sys.argv[2]
with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile:
data = json.load(jsonFile)
data["skipped_urls"].remove(domain + "/_matrix")
data["skipped_urls"].remove(server_name + "/.well-known/matrix/")
data["protected_urls"].remove(domain + "/_matrix/cas_server.php/login")
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

@ -383,10 +383,9 @@ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# 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".
python3 ../conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32"
ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login
ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)"
ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)"
ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server"
#=================================================
# UPDATE HOOKS

View file

@ -75,13 +75,6 @@ ynh_script_progression --message="Removing dependencies" --weight=15
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SETUP SSOWAT
#=================================================
# Remove the skipped url
python3 ../conf/remove_sso_conf.py $domain $server_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================

View file

@ -216,9 +216,9 @@ ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
# 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".
python3 ../settings/conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32"
ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)"
ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)"
ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server"
#=================================================
# SETUP LOGROTATE

View file

@ -148,7 +148,7 @@ if [ -e "/var/lib/matrix-$app" ]; then
fi
mv "/var/lib/matrix-$app" "$data_path"
# matrix-synapse:x:994:994::/var/lib/matrix-synapse:/usr/sbin/nologin
sed --in-place -r "s@matrix-$app\:x\:(\n*:\n*)\:\:/var/lib/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:(\n*:\n*)\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd
ynh_replace_string "s@matrix-$app\:x\:(\n*:\n*)\:\:/var/lib/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:(\n*:\n*)\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd
fi
#=================================================
@ -451,10 +451,9 @@ ynh_add_fail2ban_config --use_template
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# 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".
python3 ../conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32"
ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login
ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)"
ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)"
ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server"
#=================================================
# SECURE FILES AND DIRECTORIES