diff --git a/scripts/install b/scripts/install index 9a1184c..daef186 100644 --- a/scripts/install +++ b/scripts/install @@ -344,10 +344,15 @@ ynh_script_progression --message="Configuring permissions..." --weight=1 ynh_permission_url --permission=main --url=$domain/_matrix/cas_server.php/login --auth_header=true ynh_permission_update --permission=main --show_tile=false --protected=true -ynh_permission_create --permission=server_api --url=$domain/_matrix --additional_urls=$server_name/.well-known/matrix \ +ynh_permission_create --permission=server_api --url=$domain/_matrix \ --label="Server access for client apps." --show_tile=false --allowed=visitors \ --auth_header=false --protected=true - +if yunohost --output-as plain domain list | grep -q "^$server_name$"; then + ynh_permission_create --permission=server_client_infos --url=$server_name/.well-known/matrix \ + --label="Server info for clients. (well-known)" --show_tile=false --allowed=visitors \ + --auth_header=false --protected=true +fi + #================================================= # UPDATE HOOKS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 174a103..76bc34a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -408,18 +408,29 @@ ynh_permission_url --permission=main --url=$domain/_matrix/cas_server.php/login ynh_permission_update --permission=main --show_tile=false --protected=true if ! ynh_permission_exists --permission=server_api; then - ynh_permission_create --permission=server_api --url=$domain/_matrix --additional_urls=$server_name/.well-known/matrix \ + ynh_permission_create --permission=server_api --url=$domain/_matrix \ --label="Server access for client apps." --show_tile=false --allowed=visitors \ --auth_header=false --protected=true python3 remove_sso_conf_persistent.py $domain $server_name \ || ynh_print_warn --message="Your file /etc/ssowat/""conf.json.persistent doesn't respect the json syntax. The config file wasn't cleaned. Please clean it manually." else - ynh_permission_url --permission=server_api --url=$domain/_matrix --add_url=$server_name/.well-known/matrix \ + ynh_permission_url --permission=server_api --url=$domain/_matrix --remove_url=$server_name/.well-known/matrix \ --auth_header=false ynh_permission_update --permission=server_api --label="Server access for client apps." --show_tile=false \ --protected=true fi +if yunohost --output-as plain domain list | grep -q "^$server_name"'$' && ! ynh_permission_exists --permission=server_client_infos; then + ynh_permission_create --permission=server_client_infos --url=$server_name/.well-known/matrix \ + --label="Server info for clients. (well-known)" --show_tile=false --allowed=visitors \ + --auth_header=false --protected=true +else + ynh_permission_url --permission=server_client_infos --url=$server_name/.well-known/matrix \ + --auth_header=false + ynh_permission_update --permission=server_client_infos --label="Server info for clients. (well-known)" --show_tile=false \ + --protected=true +fi + #================================================= # SECURE FILES AND DIRECTORIES #=================================================