diff --git a/README.md b/README.md index 1107528..2372aba 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README_eu.md b/README_eu.md index 1bfb92c..07c1b2c 100644 --- a/README_eu.md +++ b/README_eu.md @@ -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 diff --git a/README_fr.md b/README_fr.md index 2490bbb..0179a2d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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 diff --git a/README_gl.md b/README_gl.md index 51380e9..e54d1d3 100644 --- a/README_gl.md +++ b/README_gl.md @@ -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 diff --git a/README_zh_Hans.md b/README_zh_Hans.md index e378be6..b936ed4 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -19,7 +19,7 @@ An admin UI for Matrix Synapse homeserver. -**分发版本:** 0.9.1~ynh1 +**分发版本:** 0.10.1~ynh1 ## 截图 diff --git a/manifest.toml b/manifest.toml index c3c8df4..157c752 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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" diff --git a/scripts/_common.sh b/scripts/_common.sh index 95d5663..edc963b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 -#================================================= diff --git a/scripts/backup b/scripts/backup index 1b290e6..f3775a8 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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" diff --git a/scripts/change_url b/scripts/change_url index a693ba5..7564745 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 diff --git a/scripts/install b/scripts/install index c6cb612..70d2692 100644 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/remove b/scripts/remove index 1e11c2e..7de46d5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -8,6 +8,8 @@ source _common.sh source /usr/share/yunohost/helpers + +synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain) #================================================= # REMOVE SYSTEM CONFIGURATIONS diff --git a/scripts/restore b/scripts/restore index 45fd866..33cf871 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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" diff --git a/scripts/upgrade b/scripts/upgrade index 21ad0a9..e68534c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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