From 43eb1b4e9dfd32d617344eab8e119c4c36caaa6f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2024 17:56:48 +0200 Subject: [PATCH 1/9] Simplify messy handling of the synapse endpoint conf thingy --- scripts/_common.sh | 46 +++++++++++++++++----------------------------- scripts/change_url | 8 +------- scripts/install | 8 +------- scripts/upgrade | 15 ++------------- 4 files changed, 21 insertions(+), 56 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 95d5663..bc0e388 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,36 +1,24 @@ #!/bin/bash -#================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# 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_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain) +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) - 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" + if [[ -z "$synapse_port" ]] + ynh_die --message="Unable to find synapse port ?!" fi +fi + +_add_synapse_endpoint_nginx_config() { + # In case the domain changed for some reason + old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf)" + 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/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/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 From 754693b325f6416fa28434489a674a074d7a09d7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2024 18:19:27 +0200 Subject: [PATCH 2/9] Zgrmlbl --- scripts/_common.sh | 26 ++++++++++++++------------ scripts/backup | 2 ++ scripts/remove | 2 ++ scripts/restore | 2 ++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index bc0e388..de751a4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,21 @@ #!/bin/bash -synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain) -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" ]] - ynh_die --message="Unable to find synapse port ?!" - fi -fi - _add_synapse_endpoint_nginx_config() { + + synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain) + 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/!($synapse_domain).d/$app.endpoint.conf)" + old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf 2>/dev/null)" for FILE in $old_endpoint_confs_for_this_app do ynh_delete_file_checksum --file="$FILE" 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/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" From 666537d5f7beef6d213e7b2068074d30e950b6df Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2024 18:41:45 +0200 Subject: [PATCH 3/9] Zbrgfnfkl --- scripts/_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index de751a4..8b70209 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,7 +15,9 @@ _add_synapse_endpoint_nginx_config() { fi # In case the domain changed for some reason + shopt -s extglob old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf 2>/dev/null)" + shopt -u extglob for FILE in $old_endpoint_confs_for_this_app do ynh_delete_file_checksum --file="$FILE" From 43333ba262252cfe4436babd826a2244d2a67aeb Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2024 19:01:06 +0200 Subject: [PATCH 4/9] Zeblgflr --- scripts/_common.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8b70209..b470dfd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,9 +15,7 @@ _add_synapse_endpoint_nginx_config() { fi # In case the domain changed for some reason - shopt -s extglob - old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/!($synapse_domain).d/$app.endpoint.conf 2>/dev/null)" - shopt -u extglob + old_endpoint_confs_for_this_app="$(ls /etc/nginx/conf.d/*.d/$app.endpoint.conf 2>/dev/null | grep -v "$synapse_domain.d")" for FILE in $old_endpoint_confs_for_this_app do ynh_delete_file_checksum --file="$FILE" From 5a398f73c2ab49fdf215cbc4ab217c09d4cc89fd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 16 Apr 2024 19:12:24 +0200 Subject: [PATCH 5/9] Bash is awesome --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b470dfd..edc963b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,7 +15,7 @@ _add_synapse_endpoint_nginx_config() { 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")" + 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" From 93a7f77c26b7b80aaa2237e50f6035b5fad3ce88 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 23 Apr 2024 03:47:01 +0200 Subject: [PATCH 6/9] Upgrade to v0.9.4 https://github.com/Awesome-Technologies/synapse-admin/releases/tag/0.9.4 --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index c3c8df4..46ced31 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.9.4~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.9.4/synapse-admin-0.9.4.tar.gz" + sha256 = "9a0fca6632ede55bdee5092c4f40b29cd931993f6a939ec9b8120094cc2406c2" autoupdate.strategy = "latest_github_release" autoupdate.asset = "synapse-admin-.*.tar.gz" From 851179c9e274217326b7090ec5b3f2d9d48956ef Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 23 Apr 2024 01:47:03 +0000 Subject: [PATCH 7/9] Auto-update READMEs --- README.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_zh_Hans.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1107528..f06a3ca 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.9.4~ynh1 ## Screenshots diff --git a/README_eu.md b/README_eu.md index 1bfb92c..5f27289 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.9.4~ynh1 ## Pantaila-argazkiak diff --git a/README_fr.md b/README_fr.md index 2490bbb..c096ed9 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.9.4~ynh1 ## Captures d’écran diff --git a/README_gl.md b/README_gl.md index 51380e9..735ca40 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.9.4~ynh1 ## Capturas de pantalla diff --git a/README_zh_Hans.md b/README_zh_Hans.md index e378be6..86815a1 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.9.4~ynh1 ## 截图 From 3eb27cb36e258eb059943cc66a71cb75f1d53891 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 Apr 2024 03:57:21 +0200 Subject: [PATCH 8/9] Upgrade to v0.10.1 https://github.com/Awesome-Technologies/synapse-admin/releases/tag/0.10.1 --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 46ced31..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.4~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.4/synapse-admin-0.9.4.tar.gz" - sha256 = "9a0fca6632ede55bdee5092c4f40b29cd931993f6a939ec9b8120094cc2406c2" + 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" From f4b9b26515902962088c213a9ea484737dac6ef6 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 25 Apr 2024 01:57:24 +0000 Subject: [PATCH 9/9] Auto-update READMEs --- README.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_zh_Hans.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f06a3ca..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.4~ynh1 +**Shipped version:** 0.10.1~ynh1 ## Screenshots diff --git a/README_eu.md b/README_eu.md index 5f27289..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.4~ynh1 +**Paketatutako bertsioa:** 0.10.1~ynh1 ## Pantaila-argazkiak diff --git a/README_fr.md b/README_fr.md index c096ed9..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.4~ynh1 +**Version incluse :** 0.10.1~ynh1 ## Captures d’écran diff --git a/README_gl.md b/README_gl.md index 735ca40..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.4~ynh1 +**Versión proporcionada:** 0.10.1~ynh1 ## Capturas de pantalla diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 86815a1..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.4~ynh1 +**分发版本:** 0.10.1~ynh1 ## 截图