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

Merge pull request #50 from YunoHost-Apps/testing

Testing
This commit is contained in:
eric_G 2024-05-18 17:06:58 +02:00 committed by GitHub
commit 637900f033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 36 additions and 63 deletions

View file

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
An admin UI for Matrix Synapse homeserver.
**Shipped version:** 0.9.1~ynh1
**Shipped version:** 0.10.1~ynh1
## Screenshots

View file

@ -19,7 +19,7 @@ EZ editatu eskuz.
An admin UI for Matrix Synapse homeserver.
**Paketatutako bertsioa:** 0.9.1~ynh1
**Paketatutako bertsioa:** 0.10.1~ynh1
## Pantaila-argazkiak

View file

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
An admin UI for Matrix Synapse homeserver.
**Version incluse:** 0.9.1~ynh1
**Version incluse:** 0.10.1~ynh1
## Captures décran

View file

@ -19,7 +19,7 @@ NON debe editarse manualmente.
An admin UI for Matrix Synapse homeserver.
**Versión proporcionada:** 0.9.1~ynh1
**Versión proporcionada:** 0.10.1~ynh1
## Capturas de pantalla

View file

@ -19,7 +19,7 @@
An admin UI for Matrix Synapse homeserver.
**分发版本:** 0.9.1~ynh1
**分发版本:** 0.10.1~ynh1
## 截图

View file

@ -7,7 +7,7 @@ name = "Synapse Admin"
description.en = "Admin UI for Synapse"
description.fr = "Admin UI pour Synapse"
version = "0.9.1~ynh1"
version = "0.10.1~ynh1"
maintainers = []
@ -48,8 +48,8 @@ ram.runtime = "50M"
[resources]
[resources.sources.main]
url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.9.1/synapse-admin-0.9.1.tar.gz"
sha256 = "116587e23651c42bb63da8f660c475f5aca2b3f6a3bc5bcac43322ad1a071f2b"
url = "https://github.com/Awesome-Technologies/synapse-admin/releases/download/0.10.1/synapse-admin-0.10.1.tar.gz"
sha256 = "486d0314316c76cd8ca801a76797352223b88d89d241e23e7b9db409b666c09d"
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "synapse-admin-.*.tar.gz"

View file

@ -1,36 +1,26 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
_add_synapse_endpoint_nginx_config() {
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# UPDATE SYNAPSE ENDPOINT
#=================================================
_update_synapse_nginx_config() {
# This helper fixes when synapse changes domain, shouldn't happen though...
old_synapse_domain="$synapse_domain"
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
ynh_app_setting_set --app=$app --key=synapse_domain --value="$synapse_domain"
if [[ "${synapse_domain}" != "${old_synapse_domain}" ]]; then
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
ynh_delete_file_checksum --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
ynh_secure_remove --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=port_synapse)
if [[ -z "$synapse_port" ]]
then
# The setting was synapse_port in older versions of the app
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
if [[ -z "$synapse_port" ]]
then
ynh_die --message="Unable to find synapse port ?!"
fi
fi
# In case the domain changed for some reason
old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/*.d/$app.endpoint.conf 2>/dev/null | grep -v "$synapse_domain.d" || true)"
for FILE in $old_endpoint_confs_for_this_app
do
ynh_delete_file_checksum --file="$FILE"
ynh_secure_remove --file="$FILE"
done
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -24,6 +24,8 @@ ynh_backup --src_path="$install_dir"
# BACKUP THE NGINX CONFIGURATION
#=================================================
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"

View file

@ -9,19 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# UPDATE SYNAPSE ENDPOINT
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration for Synapse..." --weight=2
_update_synapse_nginx_config
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
_add_synapse_endpoint_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Getting settings from Synapse..." --weight=2
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
ynh_app_setting_set --app=$app --key=synapse_domain --value="$synapse_domain"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -36,9 +32,7 @@ ynh_script_progression --message="Adding system configurations related to $app..
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create NGINX config to access /_synapse/admin endpoint
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
_add_synapse_endpoint_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -9,6 +9,8 @@
source _common.sh
source /usr/share/yunohost/helpers
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================

View file

@ -24,6 +24,8 @@ chown -R $app:www-data "$install_dir"
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"

View file

@ -21,7 +21,7 @@ if ynh_compare_current_package_version --comparison le --version 0.8.3~ynh2; the
fi
# If synapse_app doesn't exist, create it and assume it is `synapse`
if [ -z "$synapse_app" ]; then
if [ -z "${synapse_app:-}" ]; then
synapse_app="synapse"
ynh_app_setting_set --app=$app --key=synapse_app --value=$synapse_app
fi
@ -56,13 +56,6 @@ fi
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# UPDATE SYNAPSE ENDPOINT
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration for Synapse..." --weight=2
_update_synapse_nginx_config
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
@ -70,11 +63,7 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
# Create a dedicated nginx config
ynh_add_nginx_config
# Create NGINX config to access /_synapse/admin endpoint
synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain)
synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port)
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
_add_synapse_endpoint_nginx_config
#=================================================
# END OF SCRIPT