From b5b33ba494a6cfb6d24732353ef5e22d53bf830f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 23 Apr 2021 22:36:24 +0200 Subject: [PATCH] Patch (#24) * Cleaning up --- README.md | 4 ++-- README_fr.md | 4 ++-- conf/config.js | 2 +- conf/haste.sh | 2 +- scripts/install | 10 ++-------- scripts/upgrade | 18 ++++-------------- 6 files changed, 12 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index d80c0c4..4a124be 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ Haste is an open-source pastebin software written in node.js, which is easily in #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/haste/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste.svg)](https://ci-apps.yunohost.org/ci/apps/haste/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/) ## Limitations diff --git a/README_fr.md b/README_fr.md index bbdfd91..d7ad440 100644 --- a/README_fr.md +++ b/README_fr.md @@ -39,8 +39,8 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/haste/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/haste.svg)](https://ci-apps.yunohost.org/ci/apps/haste/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/haste.svg)](https://ci-apps-arm.yunohost.org/ci/apps/haste/) ## Limitations diff --git a/conf/config.js b/conf/config.js index 0825b96..6d07a95 100644 --- a/conf/config.js +++ b/conf/config.js @@ -25,7 +25,7 @@ }, "storage": { "type": "file", - "path": "__YNH_DATA_PATH__" + "path": "__DATA_PATH__" }, "documents": { "about": "./about.md" diff --git a/conf/haste.sh b/conf/haste.sh index d3e8798..a60804b 100644 --- a/conf/haste.sh +++ b/conf/haste.sh @@ -4,7 +4,7 @@ set -e set -u LOCAL_PASTE_URL="http://127.0.0.1:__PORT__" -PASTE_URL="https://__YNH_HASTE_URL__" +PASTE_URL="https://__HASTE_URL__" _die() { printf "Error: %s\n" "$*" diff --git a/scripts/install b/scripts/install index cb83642..780a33c 100755 --- a/scripts/install +++ b/scripts/install @@ -124,13 +124,7 @@ mkdir -p "$data_path" # CONFIGURE HASTE #================================================= -cp ../conf/config.js "$final_path/config.js" - -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.js" -ynh_replace_string --match_string="__YNH_DATA_PATH__" --replace_string="$data_path" --target_file="$final_path/config.js" - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/config.js" +ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" # Replace ajax.googleapis by local file cp ../sources/jquery.min.js "$final_path/static/jquery.min.js" @@ -141,7 +135,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ # ADD HASTE AS A BINARY FILE #================================================= -ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain}${path_url%/}" --target_file="../conf/haste.sh" +ynh_replace_string --match_string="__HASTE_URL__" --replace_string="${domain}${path_url%/}" --target_file="../conf/haste.sh" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh" cp ../conf/haste.sh /usr/bin/$app diff --git a/scripts/upgrade b/scripts/upgrade index afddbcd..3addda7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,8 +125,8 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" ynh_add_systemd_config @@ -134,19 +134,9 @@ ynh_add_systemd_config # UPGRADE HASTE CONFIGURATION #================================================= -# Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different "$final_path/config.js" - -cp ../conf/config.js "$final_path/config.js" - # Define app's data directory -data_path="/home/yunohost.app/${app}" - -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.js" -ynh_replace_string --match_string="__YNH_DATA_PATH__" --replace_string="$data_path" --target_file="$final_path/config.js" - -# Recalculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/config.js" +data_path="/home/yunohost.app/$app" +ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" # Replace ajax.googleapis by local file cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"