mirror of
https://github.com/YunoHost-Apps/conduit_ynh.git
synced 2024-09-03 18:16:30 +02:00
Merge pull request #3 from YunoHost-Apps/well-known
Implement .well-known for federation
This commit is contained in:
commit
fbf6623ea5
7 changed files with 37 additions and 2 deletions
5
conf/server_name.conf
Normal file
5
conf/server_name.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
location /.well-known/matrix/server {
|
||||
return 200 '{"m.server": "__DOMAIN__:443"}';
|
||||
add_header Content-Type application/json;
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
}
|
|
@ -64,6 +64,13 @@ ram.runtime = "50M"
|
|||
server_api.allowed = "visitors"
|
||||
server_api.auth_header = false
|
||||
server_api.protected = true
|
||||
|
||||
server_client_infos.url = "__SERVER_NAME__/.well-known/matrix"
|
||||
server_client_infos.label = "Server info for federation. (well-known)"
|
||||
server_client_infos.show_tile = false
|
||||
server_client_infos.allowed = "visitors"
|
||||
server_client_infos.auth_header = false
|
||||
server_client_infos.protected = true
|
||||
|
||||
[resources.ports]
|
||||
main.default = 6167
|
||||
|
|
|
@ -27,6 +27,11 @@ ynh_backup --src_path="$install_dir"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -30,6 +30,12 @@ ynh_script_progression --message="Adding system configurations related to $app..
|
|||
# Create a dedicated NGINX config using the conf/nginx.conf template
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create .well-known redirection for access by federation
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ ynh_remove_systemd_config
|
|||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
# Remove the well-known location
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -22,12 +22,15 @@ chown -R $app:root "$install_dir"
|
|||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
|
|||
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create .well-known redirection for access by federation
|
||||
if yunohost --output-as plain domain list | grep -q "^$server_name$"
|
||||
then
|
||||
ynh_add_config --template="server_name.conf" --destination="/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
|
||||
fi
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
yunohost service add $app --description="Chat server powered by Matrix" --log="/var/log/$app/$app.log"
|
||||
|
|
Loading…
Add table
Reference in a new issue