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

Add support for .well_known access

This commit is contained in:
Josué Tille 2020-03-14 14:35:20 +01:00
parent 2f370d79bc
commit 70b322f6e1
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
5 changed files with 24 additions and 10 deletions

View file

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

@ -390,7 +390,7 @@ 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 || 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"
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
#=================================================

View file

@ -215,7 +215,7 @@ 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 || 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"
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"
#=================================================
# SETUP LOGROTATE

View file

@ -438,7 +438,7 @@ 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 || 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"
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
#=================================================