From 56b1ce1fc9ea9f971f77bf5e04aa83cbce9dfd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 1 Feb 2022 15:51:28 +0100 Subject: [PATCH] Testing (#40) - Fix Urls have tree slashs after installation #19 HedgeDoc edit note icon redirect on https://hedgedoc/s/ without yunohost domain #38 --- README.md | 2 +- README_fr.md | 2 +- conf/config.json.example | 4 ++-- manifest.json | 2 +- scripts/backup | 2 +- scripts/change_url | 9 ++++++--- scripts/install | 13 ++++++++----- scripts/remove | 4 ++-- scripts/restore | 8 +------- scripts/upgrade | 5 ++--- 10 files changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 23b27c2..2922e73 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Collaborative editor to work on notes written in Markdown -**Shipped version:** 1.9.1~ynh1 +**Shipped version:** 1.9.2~ynh1 **Demo:** https://demo.hedgedoc.org/ diff --git a/README_fr.md b/README_fr.md index d0604d2..d11a698 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Éditeur collaboratif pour travailler sur des notes en Markdown -**Version incluse :** 1.9.1~ynh1 +**Version incluse :** 1.9.2~ynh1 **Démo :** https://demo.hedgedoc.org/ diff --git a/conf/config.json.example b/conf/config.json.example index 5f6ec2b..03c46e8 100644 --- a/conf/config.json.example +++ b/conf/config.json.example @@ -3,7 +3,7 @@ "protocolUseSSL": true, "domain": "__DOMAIN__", "port": "__PORT__", - "urlPath": "__PATH__", + "urlPath": "__URL_PATH__", "loglevel": "info", "useCDN": false, "allowGravatar": false, @@ -30,7 +30,7 @@ "addGoogleAnalytics": false }, "db": { - "username": "__DB_NAME__", + "username": "__DB_USER__", "password": "__DB_PWD__", "database": "__DB_NAME__", "host": "localhost", diff --git a/manifest.json b/manifest.json index 6082872..7a33763 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Collaborative editor to work on notes written in Markdown", "fr": "Éditeur collaboratif pour travailler sur des notes en Markdown" }, - "version": "1.9.1~ynh1", + "version": "1.9.2~ynh1", "url": "https://hedgedoc.org", "upstream": { "license": "free", diff --git a/scripts/backup b/scripts/backup index 3115b5b..8d4d217 100644 --- a/scripts/backup +++ b/scripts/backup @@ -66,4 +66,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for HedgeDoc. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index d903e72..a9c8a53 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -73,7 +73,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF @@ -113,10 +113,13 @@ fi ynh_backup_if_checksum_is_different --file="$final_path/config.json" domain=$new_domain -path=${new_path:1} +url_path=${new_path#/} ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +chmod 400 "$final_path/config.json" +chown $app:$app "$final_path/config.json" + #================================================= # GENERIC FINALISATION #================================================= @@ -138,4 +141,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for HedgeDoc" --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index ada5c47..35fb5ac 100644 --- a/scripts/install +++ b/scripts/install @@ -86,9 +86,10 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -124,7 +125,7 @@ popd #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +env_path="$PATH" ynh_add_systemd_config @@ -133,10 +134,12 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -path=${path_url:1} - +url_path=${path_url#/} ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" +chmod 400 "$final_path/config.json" +chown $app:$app "$final_path/config.json" + #================================================= # GENERIC FINALIZATION #================================================= @@ -186,4 +189,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of HedgeDoc completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 60d5336..2e2045a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -63,7 +63,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing HedgeDoc main directory..." --weight=6 +ynh_script_progression --message="Removing $app main directory..." --weight=6 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -90,4 +90,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of HedgeDoc completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 86f21a9..c167e57 100644 --- a/scripts/restore +++ b/scripts/restore @@ -64,12 +64,6 @@ ynh_script_progression --message="Restoring HedgeDoc main directory..." --weight ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." --weight=2 - -# Restore permissions on app files chown -R $app:$app $final_path chmod o-rwx $final_path chmod 600 $final_path/config.json @@ -134,4 +128,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for HedgeDoc" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 96f7520..dbe33a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -126,8 +126,7 @@ fi #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=2 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - +env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config @@ -168,4 +167,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of HedgeDoc completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last