From df7878f62e7de8dd18ed0f68745a3de738b30f84 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 17 Nov 2020 12:17:08 +0100 Subject: [PATCH 01/59] Fix check_process warning --- check_process | 15 +----- manifest.json | 2 +- scripts/change_url | 123 +++++++++++++++++++++++++++++++++++++++++++++ scripts/upgrade | 6 +++ 4 files changed, 132 insertions(+), 14 deletions(-) create mode 100644 scripts/change_url diff --git a/check_process b/check_process index 0365448..5800f60 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,7 @@ port="7777" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=0 + setup_sub_dir=1 setup_root=1 setup_nourl=0 setup_private=1 @@ -14,21 +14,10 @@ upgrade=1 backup_restore=1 multi_instance=0 - # incorrect_path=0 port_already_use=1 - change_url=0 + change_url=1 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=na Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 69088ac..da689f1 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "maxime.bugeia@gmail.com" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": false, "services": [ diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..8be33b3 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,123 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +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" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the nginx config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config +fi + +# Change the domain for nginx +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading nginx web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 4db3213..56e241a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -182,6 +182,12 @@ chown -R $app: "$final_path/static" chown -R $app: "$data_path" chmod +x /usr/bin/$app +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= + +yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log" + #================================================= # START SYSTEMD SERVICE #================================================= From d60726a01fba95a073c455f940688adb08aeebd2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 17 Nov 2020 12:43:48 +0100 Subject: [PATCH 02/59] Update change_url --- scripts/change_url | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 8be33b3..89ef6c9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,11 +28,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -74,7 +75,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -112,7 +113,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload From 074a7456dd0837269ef7e3f81e4ae8d63192fa43 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 Nov 2020 14:27:30 +0100 Subject: [PATCH 03/59] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index da689f1..9fb931a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh2", + "version": "0.1.0~ynh3", "url": "https://github.com/seejohnrun/haste-server", "license": "MIT", "maintainer": { From 596eb11f05d6b80135c0f3815b450256b65926be Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 2 Dec 2020 12:29:00 +0100 Subject: [PATCH 04/59] Fix linter warning --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index f2cff50..ed331ee 100755 --- a/scripts/restore +++ b/scripts/restore @@ -109,7 +109,7 @@ yunohost service add $app --description "Haste is an open-source pastebin softwa ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # START SYSTEMD SERVICE From 81cac450cb25826d83cba8d9542dd83b377f61f3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 14 Dec 2020 10:28:35 +0100 Subject: [PATCH 05/59] Update remove --- scripts/remove | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index 4897edc..8ea90bb 100755 --- a/scripts/remove +++ b/scripts/remove @@ -25,7 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." --weight=1 From 86b2b431e5605947db351ea3e2c2033c0c9f190f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 19 Dec 2020 23:02:40 +0100 Subject: [PATCH 06/59] Set badge in SVG --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1598caf..9cc0d9c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Haste for YunoHost [![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) -[![Install Haste with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=haste) +[![Install Haste with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Lire ce readme en français.](./README_fr.md)* From a5776c1587f5eb513d7150cd44c321d295da2a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 26 Dec 2020 09:33:43 +0100 Subject: [PATCH 07/59] Use SVG for badge --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 1b03b9b..a2f9108 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,7 +1,7 @@ # Haste pour YunoHost [![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) -[![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=haste) +[![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Read this readme in english.](./README.md)* From f633cbdd8bbb6a2aca0ce8a5f0a2c9100f372333 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 9 Jan 2021 22:32:30 +0100 Subject: [PATCH 08/59] Finding an available port --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b1e72a9..fd8f1f5 100755 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ ynh_app_setting_set --app=$app --key=path_url --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --weight=2 +ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port port=$(ynh_find_port --port=7777) From beb4acd9c90e6fecd683afd06e55cec1987da6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 Feb 2021 23:17:03 +0100 Subject: [PATCH 09/59] Patch (#21) * Fix linter warnings --- conf/app.src | 4 ++-- conf/nginx.conf | 6 +++--- manifest.json | 18 ++++-------------- pull_request_template.md | 4 +--- scripts/_common.sh | 2 +- scripts/change_url | 2 +- scripts/install | 10 +++++----- scripts/restore | 4 ++-- scripts/upgrade | 6 +++--- 9 files changed, 22 insertions(+), 34 deletions(-) diff --git a/conf/app.src b/conf/app.src index 58197b4..0cee885 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/677a22987adf0a364d8e03243d3ace20e11b4719.tar.gz -SOURCE_SUM=69cbc631151e09792b83e32b9d6fde8a3eabe40bf252a5b9a7065228aae4e167 +SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/5d2965ffc5d9b309ef6d4be9e8c2288c83d72c73.tar.gz +SOURCE_SUM=099bf0cec59614f0f6151f0809c8580b85d5fe701892dda96263b8aee743d5d8 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index abd8968..6e14d50 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,11 +5,11 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__; - proxy_set_header Host $host; + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; proxy_buffering off; - client_max_body_size 50M; + client_max_body_size 50M; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.json b/manifest.json index 82603b9..bee1aca 100644 --- a/manifest.json +++ b/manifest.json @@ -6,12 +6,12 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh4", + "version": "0.1.0~ynh5", "url": "https://github.com/seejohnrun/haste-server", "license": "MIT", "maintainer": { - "name": "mbugeia", - "email": "maxime.bugeia@gmail.com" + "name": "eric_G", + "email": "" }, "requirements": { "yunohost": ">= 4.0.0" @@ -29,17 +29,7 @@ "en": "Choose a domain name for Haste", "fr": "Choisissez un nom de domaine pour Haste" }, - "example": "example.com" - }, - { - "name": "path", - "type": "path", - "ask": { - "en": "Choose a path for Haste, only / is allowed.", - "fr": "Choisissez un chemin pour Haste, seul / est autorisé." - }, - "example": "/", - "default": "/" + "example": "paste.example.com" }, { "name": "is_public", diff --git a/pull_request_template.md b/pull_request_template.md index 3cf2e53..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/haste_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/haste_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/_common.sh b/scripts/_common.sh index ac79128..7912aa4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=12 +nodejs_version=14 #================================================= # PERSONAL HELPERS diff --git a/scripts/change_url b/scripts/change_url index 89ef6c9..aac1a25 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -108,7 +108,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index fd8f1f5..08d6cc8 100755 --- a/scripts/install +++ b/scripts/install @@ -155,7 +155,7 @@ cp ../conf/haste.sh /usr/bin/$app chown -R root: $final_path chown -R $app: "$final_path/static" -chown -R $app: "$data_path" +chown -R $app: $data_path chmod +x /usr/bin/$app #================================================= @@ -174,7 +174,7 @@ ynh_use_logrotate # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description="Haste is an open-source pastebin software" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -182,16 +182,16 @@ yunohost service add $app --description="Haste is an open-source pastebin softwa ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index e385747..556d104 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ chown $app -R /var/log/$app # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description="Haste is an open-source pastebin software" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # RESTORE SYSTEMD @@ -116,7 +116,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4217ab9..aa85cb6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -172,21 +172,21 @@ cp ../conf/haste.sh /usr/bin/$app chown -R root: $final_path chown -R $app: "$final_path/static" -chown -R $app: "$data_path" +chown -R $app: $data_path chmod +x /usr/bin/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description="Haste is an open-source pastebin software" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX From 317d78ad2b0d82340a89922d4d1fee133bf91919 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 3 Feb 2021 11:39:43 +0100 Subject: [PATCH 10/59] Small fixes --- README.md | 4 ++-- README_fr.md | 4 ++-- manifest.json | 8 ++++++++ scripts/upgrade | 7 +++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9cc0d9c..8f7bad3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0 +**Shipped version:** 0.1.0 (7.10.2020) ## Screenshots @@ -23,7 +23,7 @@ Haste is an open-source pastebin software written in node.js, which is easily in ## Configuration -How to configure this app: a plain file with SSH. + * How to configure this app: a plain file with SSH. ## Documentation diff --git a/README_fr.md b/README_fr.md index a2f9108..96398ad 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Vue d'ensemble Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0 +**Version incluse :** 0.1.0 (7.10.2020) ## Captures d'écran @@ -23,7 +23,7 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install ## Configuration -Comment configurer cette application: un fichier brut en SSH. + * Comment configurer cette application: un fichier brut en SSH. ## Documentation diff --git a/manifest.json b/manifest.json index bee1aca..a326386 100644 --- a/manifest.json +++ b/manifest.json @@ -13,6 +13,10 @@ "name": "eric_G", "email": "" }, + "previous_maintainers": [{ + "name": "mbugeia", + "email": "maxime.bugeia@gmail.com" + }], "requirements": { "yunohost": ">= 4.0.0" }, @@ -29,6 +33,10 @@ "en": "Choose a domain name for Haste", "fr": "Choisissez un nom de domaine pour Haste" }, + "help": { + "en": "Haste can only be installed in a root domain or subdomain", + "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine " + }, "example": "paste.example.com" }, { diff --git a/scripts/upgrade b/scripts/upgrade index aa85cb6..01df40f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,6 +47,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 83e41ada67fef856f2584e59cb2b9c79e6ac5790 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 7 Mar 2021 21:14:09 +0100 Subject: [PATCH 11/59] Cleaning up --- scripts/install | 1 - scripts/upgrade | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index 08d6cc8..cb83642 100755 --- a/scripts/install +++ b/scripts/install @@ -43,7 +43,6 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=path_url --value=$path_url #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 01df40f..3e1450b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,7 +17,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path_url) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) From 35b7f7672eca540d6f627a292f5934844b9e0503 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Mar 2021 09:08:10 +0100 Subject: [PATCH 12/59] Update manifest.json --- manifest.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/manifest.json b/manifest.json index 274f709..3dc1c02 100644 --- a/manifest.json +++ b/manifest.json @@ -29,10 +29,6 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Haste", - "fr": "Choisissez un nom de domaine pour Haste" - }, "help": { "en": "Haste can only be installed in a root domain or subdomain", "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine " @@ -42,10 +38,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public site? (you won't be able to use Haste command easily if not)", - "fr": "Est-ce un site publique ? (si non, vous ne pourrez pas utiliser la commande Haste facilement)" - }, "help": { "en": "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Haste sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." From 5089f3923808632ab13b9b90e0f22d8d116d92e1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Mar 2021 10:17:52 +0100 Subject: [PATCH 13/59] Cleaning up --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade | 9 --------- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8f7bad3..d80c0c4 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Haste is an open-source pastebin software written in node.js, which is easily in ## Documentation * Official documentation: https://hastebin.com/about.md - * YunoHost documentation: If specific documentation is needed, feel free to contribute. + * YunoHost documentation: https://yunohost.org/en/app_haste ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index 96398ad..bbdfd91 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,7 +28,7 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install ## Documentation * Documentation officielle: https://hastebin.com/about.md - * Documentation YunoHost: Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. + * Documentation YunoHost: https://yunohost.org/fr/app_haste ## Caractéristiques spécifiques YunoHost diff --git a/manifest.json b/manifest.json index 3dc1c02..2883421 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh5", + "version": "0.1.0~ynh6", "url": "https://github.com/seejohnrun/haste-server", "license": "MIT", "maintainer": { diff --git a/scripts/upgrade b/scripts/upgrade index 3e1450b..afddbcd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,15 +31,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app From 6ef92b99dbb621000b6e4afbf46be9ff6aca1ee6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 8 Apr 2021 23:19:13 +0200 Subject: [PATCH 14/59] Fix badges --- README.md | 4 ++-- README_fr.md | 4 ++-- 2 files changed, 4 insertions(+), 4 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 From 3a2576e525459744f571317b9380d2ccf224e5f5 Mon Sep 17 00:00:00 2001 From: YunoHost Bot Date: Tue, 11 May 2021 07:31:05 +0200 Subject: [PATCH 15/59] [autopatch] Update issue and PR templates (#25) Co-authored-by: Yunohost-Bot <> --- pull_request_template.md | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 pull_request_template.md diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* From 9fbd26504e88d7935438aa67005e547c152a33bb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 11 May 2021 10:16:15 +0200 Subject: [PATCH 16/59] Add templates --- .github/ISSUE_TEMPLATE.md | 55 ++++++++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) From 6a6634aaa554b8bed9b212bf0abc5cfe9a5d66cc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:26:49 +0200 Subject: [PATCH 17/59] Fix --- manifest.json | 2 +- scripts/install | 9 +++++---- scripts/restore | 7 ++++--- scripts/upgrade | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index 2883421..4c864be 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh6", + "version": "0.1.0~ynh7", "url": "https://github.com/seejohnrun/haste-server", "license": "MIT", "maintainer": { diff --git a/scripts/install b/scripts/install index 780a33c..a56291a 100755 --- a/scripts/install +++ b/scripts/install @@ -95,8 +95,8 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # ADD 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_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 @@ -146,8 +146,9 @@ cp ../conf/haste.sh /usr/bin/$app # SECURE FILES AND DIRECTORIES #================================================= -chown -R root: $final_path -chown -R $app: "$final_path/static" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" chown -R $app: $data_path chmod +x /usr/bin/$app diff --git a/scripts/restore b/scripts/restore index 556d104..523831b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -84,9 +84,10 @@ ynh_restore_file --origin_path="/usr/bin/$app" # SECURE FILES AND DIRECTORIES #================================================= -chown -R root: $final_path -chown -R $app: "$final_path/static" -chown -R $app: "/home/yunohost.app/$app" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chown -R $app: $data_path chmod +x /usr/bin/$app #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3addda7..e6e8bd6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -157,8 +157,9 @@ cp ../conf/haste.sh /usr/bin/$app # SECURE FILES AND DIRECTORIES #================================================= -chown -R root: $final_path -chown -R $app: "$final_path/static" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" chown -R $app: $data_path chmod +x /usr/bin/$app From c99abeec97c9409114d77438faceefc43e0fea1f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:29:27 +0200 Subject: [PATCH 18/59] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 523831b..8fbcb19 100755 --- a/scripts/restore +++ b/scripts/restore @@ -87,7 +87,7 @@ ynh_restore_file --origin_path="/usr/bin/$app" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R $app: $data_path +chown -R $app: "/home/yunohost.app/$app" chmod +x /usr/bin/$app #================================================= From f2ce62c8b4df24106626db021da0dc3c480ae1a1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:41:51 +0200 Subject: [PATCH 19/59] Fix --- scripts/backup | 3 ++- scripts/change_url | 2 +- scripts/install | 1 + scripts/remove | 3 ++- scripts/restore | 5 +++-- scripts/upgrade | 14 ++++++++++---- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/backup b/scripts/backup index 60b4845..9c7fc73 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -54,7 +55,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP DATADIR DIRECTORY #================================================= -ynh_backup --src_path="/home/yunohost.app/$app" +ynh_backup --src_path="$data_path" #================================================= # BACKUP BINARY diff --git a/scripts/change_url b/scripts/change_url index aac1a25..b1655f3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +new_path="/" app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/install b/scripts/install index a56291a..8d254b7 100755 --- a/scripts/install +++ b/scripts/install @@ -119,6 +119,7 @@ data_path="/home/yunohost.app/${app}" # Create app folders mkdir -p "$data_path" +ynh_app_setting_set --app=$app --key=data_path --value=$data_path #================================================= # CONFIGURE HASTE diff --git a/scripts/remove b/scripts/remove index 8ea90bb..e9b14d8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # STANDARD REMOVE @@ -75,7 +76,7 @@ ynh_secure_remove --file="/usr/bin/$app" # REMOVE DATADIR DIRECTORY #================================================= -ynh_secure_remove --file="/home/yunohost.app/$app" +ynh_secure_remove --file="$data_path" #================================================= # REMOVE NODEJS diff --git a/scripts/restore b/scripts/restore index 8fbcb19..9d68823 100755 --- a/scripts/restore +++ b/scripts/restore @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -72,7 +73,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # RESTORE VARIOUS FILES #================================================= -ynh_restore_file "/home/yunohost.app/$app" +ynh_restore_file "$data_path" #================================================= # RESTORE BINARY @@ -87,7 +88,7 @@ ynh_restore_file --origin_path="/usr/bin/$app" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R $app: "/home/yunohost.app/$app" +chown -R $app: "$data_path" chmod +x /usr/bin/$app #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e6e8bd6..e8e797d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +19,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path_url) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # CHECK VERSION @@ -37,6 +38,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# If data_path doesn't exist, create it +if [ -z "$data_path" ]; then + data_path="/home/yunohost.app/${app}" + mkdir -p "$data_path" + ynh_app_setting_set --app=$app --key=data_path --value=$data_path +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -135,7 +143,6 @@ ynh_add_systemd_config #================================================= # Define app's data directory -data_path="/home/yunohost.app/$app" ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" # Replace ajax.googleapis by local file @@ -147,9 +154,8 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ # UPGRADE HASTE BINARY #================================================= -ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain}${path_url}" --target_file="../conf/haste.sh" - -cp ../conf/haste.sh /usr/bin/$app +haste_url="${domain}${path_url}" +ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION From b20202e14e57b3493fe6f3e10a442000dc237e8c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:51:45 +0200 Subject: [PATCH 20/59] Update install --- scripts/install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 8d254b7..05612cf 100755 --- a/scripts/install +++ b/scripts/install @@ -136,10 +136,8 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ # ADD HASTE AS A BINARY FILE #================================================= -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 +haste_url="${domain}${path_url}" +ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION From 0ab0b298de4e7cef08e59e43351a488e8ed20b1b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:55:36 +0200 Subject: [PATCH 21/59] Fix --- manifest.json | 2 +- scripts/upgrade | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 4c864be..b3dde7a 100644 --- a/manifest.json +++ b/manifest.json @@ -18,7 +18,7 @@ "email": "maxime.bugeia@gmail.com" }], "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": false, "services": [ diff --git a/scripts/upgrade b/scripts/upgrade index e8e797d..23933b2 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,7 +84,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=7 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config.js" fi #================================================= @@ -142,9 +142,6 @@ ynh_add_systemd_config # UPGRADE HASTE CONFIGURATION #================================================= -# Define app's data directory -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" From 5901c05fb3eb56b19efba5a32770aec8b591fe01 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 08:58:24 +0200 Subject: [PATCH 22/59] Update check_process --- check_process | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/check_process b/check_process index ee1a894..ffc8451 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,7 @@ port="7777" (PORT) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 @@ -14,7 +14,6 @@ upgrade=1 backup_restore=1 multi_instance=0 - port_already_use=1 change_url=1 ;;; Options Email= From 36f7a7988b7050044be833b3aafc324be09c6c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:13:37 +0200 Subject: [PATCH 23/59] Patch (#27) * Fix * Auto-update README * Update systemd.service * Update nginx.conf Co-authored-by: Yunohost-Bot <> --- README.md | 55 ++++++++----------- README_fr.md | 57 +++++++------------- conf/nginx.conf | 4 +- conf/systemd.service | 30 +++++++++++ doc/DESCRIPTION.md | 1 + doc/DESCRIPTION_fr.md | 1 + doc/DISCLAIMER.md | 14 +++++ doc/DISCLAIMER_fr.md | 15 ++++++ {sources => doc/screenshots}/screenshot.png | Bin manifest.json | 13 +++-- scripts/install | 12 +++-- scripts/restore | 5 +- scripts/upgrade | 6 +-- 13 files changed, 125 insertions(+), 88 deletions(-) create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DESCRIPTION_fr.md create mode 100644 doc/DISCLAIMER.md create mode 100644 doc/DISCLAIMER_fr.md rename {sources => doc/screenshots}/screenshot.png (100%) diff --git a/README.md b/README.md index 4a124be..e9b3098 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Haste for YunoHost [![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) @@ -5,49 +10,29 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Haste quickly and simply on a YunoHost server. +> *This package allows you to install Haste quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview + Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0 (7.10.2020) + +**Shipped version:** 0.1.0~ynh8 + +**Demo:** http://hastebin.com/ ## Screenshots -![](sources/screenshot.png) +![](./doc/screenshots/screenshot.png) -## Demo - -* [Official demo](http://hastebin.com/) - -## Configuration - - * How to configure this app: a plain file with SSH. - -## Documentation - - * Official documentation: https://hastebin.com/about.md - * YunoHost documentation: https://yunohost.org/en/app_haste - -## YunoHost specific features +## Disclaimers / important information #### Multi-user support * Are LDAP and HTTP auth supported? **No** * Can the app be used by multiple users? **Yes** -#### Supported architectures - -* 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 - -* Any known limitations. - -## Additional information - ## `haste` command This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal: @@ -58,13 +43,13 @@ https://haste.example.com/zuyejeduzu ``` The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple client for uploading data to you Haste server. -## Links +## Documentation and resources - * Report a bug: https://github.com/YunoHost-Apps/haste_ynh/issues - * Upstream app repository: https://github.com/seejohnrun/haste-server - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://example.com +* Official user documentation: https://hastebin.com/about.md +* Upstream app code repository: https://github.com/seejohnrun/haste-server +* YunoHost documentation for this app: https://yunohost.org/app_haste +* Report a bug: https://github.com/YunoHost-Apps/haste_ynh/issues ## Developer info @@ -76,3 +61,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testin or sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index d7ad440..6a33daf 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,51 +3,32 @@ [![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) [![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +> *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble + Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0 (7.10.2020) + +**Version incluse :** 0.1.0~ynh8 + +**Démo :** http://hastebin.com/ ## Captures d'écran -![](sources/screenshot.png) +![](./doc/screenshots/screenshot.png) -## Démo +## Avertissements / informations importantes -* [Démo officielle](http://hastebin.com/) - -## Configuration - - * Comment configurer cette application: un fichier brut en SSH. - -## Documentation - - * Documentation officielle: https://hastebin.com/about.md - * Documentation YunoHost: https://yunohost.org/fr/app_haste - -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur +### Support multi-utilisateur * L'authentification LDAP et HTTP est-elle prise en charge ? **Non** * L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** -#### Architectures supportées - -* 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 - -* Limitations connues. - -## Informations additionnelles - ## `haste` command Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal : @@ -59,13 +40,13 @@ https://haste.example.com/zuyejeduzu Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simple pour télécharger des données sur votre serveur Haste. -## Liens +## Documentations et ressources - * Signaler un bug : https://github.com/YunoHost-Apps/haste_ynh/issues - * Dépôt de l'application principale : https://github.com/seejohnrun/haste-server - * Site web YunoHost : https://yunohost.org/ - ---- +* Site officiel de l'app : https://example.com +* Documentation officielle utilisateur : https://hastebin.com/about.md +* Dépôt de code officiel de l'app : https://github.com/seejohnrun/haste-server +* Documentation YunoHost pour cette app : https://yunohost.org/app_haste +* Signaler un bug : https://github.com/YunoHost-Apps/haste_ynh/issues ## Informations pour les développeurs @@ -77,3 +58,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testin ou sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 6e14d50..1648c31 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,8 +5,8 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__; - proxy_set_header Host $host; + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; proxy_buffering off; client_max_body_size 50M; diff --git a/conf/systemd.service b/conf/systemd.service index c8af1d9..a25a77e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -13,5 +13,35 @@ StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit Restart=always +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..94f198b --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..11d7dbc --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..4fcef40 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,14 @@ +#### Multi-user support + +* Are LDAP and HTTP auth supported? **No** +* Can the app be used by multiple users? **Yes** + +## `haste` command + +This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal: + +```bash +cat something | haste +https://haste.example.com/zuyejeduzu +``` +The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple client for uploading data to you Haste server. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..caa910a --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,15 @@ +### Support multi-utilisateur + +* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** +* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** + +## `haste` command + +Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal : + +```bash +cat something | haste +https://haste.example.com/zuyejeduzu +``` + +Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simple pour télécharger des données sur votre serveur Haste. diff --git a/sources/screenshot.png b/doc/screenshots/screenshot.png similarity index 100% rename from sources/screenshot.png rename to doc/screenshots/screenshot.png diff --git a/manifest.json b/manifest.json index b3dde7a..04f6401 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,15 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh7", - "url": "https://github.com/seejohnrun/haste-server", + "version": "0.1.0~ynh8", + "url": "http://hastebin.com/", + "upstream": { + "license": "MIT", + "website": "https://example.com", + "demo": "http://hastebin.com/", + "userdoc": "https://hastebin.com/about.md", + "code": "https://github.com/seejohnrun/haste-server" + }, "license": "MIT", "maintainer": { "name": "eric_G", @@ -31,7 +38,7 @@ "type": "domain", "help": { "en": "Haste can only be installed in a root domain or subdomain", - "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine " + "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" }, "example": "paste.example.com" }, diff --git a/scripts/install b/scripts/install index 05612cf..307e3c2 100755 --- a/scripts/install +++ b/scripts/install @@ -96,7 +96,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= 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 @@ -104,10 +103,10 @@ ynh_add_systemd_config # INSTALL HASTEBIN #================================================= -pushd "$final_path" || ynh_die +pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_npm install -popd || ynh_die +popd #================================================= # CREATE DIRECTORY FOR DATA @@ -116,10 +115,14 @@ ynh_script_progression --message="Creating the data directory..." # Define app's data directory data_path="/home/yunohost.app/${app}" +ynh_app_setting_set --app=$app --key=data_path --value=$data_path # Create app folders mkdir -p "$data_path" -ynh_app_setting_set --app=$app --key=data_path --value=$data_path + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # CONFIGURE HASTE @@ -148,7 +151,6 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R $app: $data_path chmod +x /usr/bin/$app #================================================= diff --git a/scripts/restore b/scripts/restore index 9d68823..0cb0ac8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,8 +33,6 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -ynh_webpath_available $domain $path_url \ - || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " @@ -66,6 +64,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # INSTALL NODEJS #================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -73,7 +72,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # RESTORE VARIOUS FILES #================================================= -ynh_restore_file "$data_path" +ynh_restore_file --origin_path="$data_path" #================================================= # RESTORE BINARY diff --git a/scripts/upgrade b/scripts/upgrade index 23933b2..8f9fae4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,10 +115,10 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # UPGRADE NPM MODULES #================================================= -pushd "$final_path" || ynh_die +pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_npm install -popd || ynh_die +popd #================================================= # SETUP LOGROTATE @@ -134,7 +134,6 @@ 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_add_systemd_config @@ -163,7 +162,6 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -chown -R $app: $data_path chmod +x /usr/bin/$app #================================================= From 3315da199dd6ae27be55dbc567467cf7736904fa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 21 Sep 2021 23:36:07 +0200 Subject: [PATCH 24/59] Update manifest.json --- manifest.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 04f6401..deeb49a 100644 --- a/manifest.json +++ b/manifest.json @@ -39,8 +39,7 @@ "help": { "en": "Haste can only be installed in a root domain or subdomain", "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" - }, - "example": "paste.example.com" + } }, { "name": "is_public", From 37cea19f5809e40be39cf880087e85c7c892c9a5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 17 Nov 2021 15:44:03 +0100 Subject: [PATCH 25/59] 4.3 --- conf/nginx.conf | 4 ---- manifest.json | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1648c31..ad28511 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,6 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://127.0.0.1:__PORT__; proxy_set_header Host $host; diff --git a/manifest.json b/manifest.json index deeb49a..012d429 100644 --- a/manifest.json +++ b/manifest.json @@ -25,7 +25,7 @@ "email": "maxime.bugeia@gmail.com" }], "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ From 404bf7a8a926b71885a854712df9d25e69e58045 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 18 Nov 2021 11:47:22 +0100 Subject: [PATCH 26/59] Fix ynh_npm --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 307e3c2..b24ea50 100755 --- a/scripts/install +++ b/scripts/install @@ -105,7 +105,7 @@ ynh_add_systemd_config pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less ynh_npm install + ynh_exec_warn_less $ynh_npm install popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8f9fae4..c21fc75 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,7 +117,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less ynh_npm install + ynh_exec_warn_less $ynh_npm install popd #================================================= From c693260e036a381b8bd9041b31e823b94b2a0875 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 5 Dec 2021 17:37:59 +0100 Subject: [PATCH 27/59] Add purge option --- check_process | 8 ++++---- conf/app.src | 1 - manifest.json | 2 +- scripts/remove | 11 +++++++++++ scripts/restore | 3 +-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index ffc8451..c7e7a34 100644 --- a/check_process +++ b/check_process @@ -1,9 +1,9 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/" (PATH) - is_public=1 (PUBLIC|public=1|private=0) - port="7777" (PORT) + domain="domain.tld" + path="/" + is_public=1 + port="7777" ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/conf/app.src b/conf/app.src index 0cee885..c6b22d8 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,3 @@ SOURCE_SUM=099bf0cec59614f0f6151f0809c8580b85d5fe701892dda96263b8aee743d5d8 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index 012d429..6e1eb2a 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "url": "http://hastebin.com/", "upstream": { "license": "MIT", - "website": "https://example.com", + "website": "http://hastebin.com/", "demo": "http://hastebin.com/", "userdoc": "https://hastebin.com/about.md", "code": "https://github.com/seejohnrun/haste-server" diff --git a/scripts/remove b/scripts/remove index e9b14d8..e567844 100755 --- a/scripts/remove +++ b/scripts/remove @@ -78,6 +78,17 @@ ynh_secure_remove --file="/usr/bin/$app" ynh_secure_remove --file="$data_path" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." --weight=1 + ynh_secure_remove --file="$data_path" +fi + #================================================= # REMOVE NODEJS #================================================= diff --git a/scripts/restore b/scripts/restore index 0cb0ac8..234e2c8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,8 +33,7 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " +test ! -d $final_path || ynh_die "There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS From 83bea09950a9544600db16d26d8447b6a9dd53d8 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 5 Dec 2021 16:38:08 +0000 Subject: [PATCH 28/59] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9b3098..83e735c 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple clien ## Documentation and resources -* Official app website: https://example.com +* Official app website: http://hastebin.com/ * Official user documentation: https://hastebin.com/about.md * Upstream app code repository: https://github.com/seejohnrun/haste-server * YunoHost documentation for this app: https://yunohost.org/app_haste diff --git a/README_fr.md b/README_fr.md index 6a33daf..fb36773 100644 --- a/README_fr.md +++ b/README_fr.md @@ -42,7 +42,7 @@ Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simp ## Documentations et ressources -* Site officiel de l'app : https://example.com +* Site officiel de l'app : http://hastebin.com/ * Documentation officielle utilisateur : https://hastebin.com/about.md * Dépôt de code officiel de l'app : https://github.com/seejohnrun/haste-server * Documentation YunoHost pour cette app : https://yunohost.org/app_haste From 2271f9da2d1670a46c984ac510e2575f15830de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 5 Dec 2021 20:53:33 +0100 Subject: [PATCH 29/59] Update version (#30) * update * Auto-update README Co-authored-by: Yunohost-Bot <> --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 83e735c..0bf6adc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh8 +**Shipped version:** 0.1.0~ynh9 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index fb36773..bbf79c6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh8 +**Version incluse :** 0.1.0~ynh9 **Démo :** http://hastebin.com/ diff --git a/conf/app.src b/conf/app.src index c6b22d8..2a3fe06 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/5d2965ffc5d9b309ef6d4be9e8c2288c83d72c73.tar.gz -SOURCE_SUM=099bf0cec59614f0f6151f0809c8580b85d5fe701892dda96263b8aee743d5d8 +SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7af15cc32de1c5381e713aa4c1d1e996ef3592be.tar.gz +SOURCE_SUM=0173723915f46a7cfa5bc49e9b90afcfcd7afe855b2e97da3b5c214d7f87ab20 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 6e1eb2a..20f48da 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh8", + "version": "0.1.0~ynh9", "url": "http://hastebin.com/", "upstream": { "license": "MIT", From f0fa61e13f0b8925d6e8491aecfea9697d01f286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 25 Apr 2022 17:33:02 +0200 Subject: [PATCH 30/59] Upgrade (#32) * Fix * Auto-update README Co-authored-by: yunohost-bot --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0bf6adc..7efa71e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh9 +**Shipped version:** 0.1.0~ynh10 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index bbf79c6..7ada107 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh9 +**Version incluse :** 0.1.0~ynh10 **Démo :** http://hastebin.com/ diff --git a/conf/app.src b/conf/app.src index 2a3fe06..c2f6e6f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7af15cc32de1c5381e713aa4c1d1e996ef3592be.tar.gz -SOURCE_SUM=0173723915f46a7cfa5bc49e9b90afcfcd7afe855b2e97da3b5c214d7f87ab20 +SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/72863858338a57d54eb9dee55530e90ebbc22453.tar.gz +SOURCE_SUM=0a9cfd42748e4410a3aa340d99ed6473962a013e9d5607b86121c32d5e0a5dd8 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 20f48da..4a1cd29 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh9", + "version": "0.1.0~ynh10", "url": "http://hastebin.com/", "upstream": { "license": "MIT", From c6c45ae3c31550cfe5c5f4c4410afcc3cec767ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 13 May 2022 21:58:55 +0200 Subject: [PATCH 31/59] Update _common.sh (#34) * Update _common.sh * Fix --- scripts/_common.sh | 2 +- scripts/install | 7 ++++--- scripts/remove | 8 ++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7912aa4..9195d57 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=14 +nodejs_version=18 #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index b24ea50..b9b6f53 100755 --- a/scripts/install +++ b/scripts/install @@ -94,14 +94,15 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # ADD SYSTEMD SERVICE #================================================= +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 #================================================= # INSTALL HASTEBIN #================================================= +ynh_script_progression --message="Installing $app..." --weight=5 pushd "$final_path" ynh_use_nodejs @@ -111,7 +112,7 @@ popd #================================================= # CREATE DIRECTORY FOR DATA #================================================= -ynh_script_progression --message="Creating the data directory..." +ynh_script_progression --message="Creating the data directory..." --weight=1 # Define app's data directory data_path="/home/yunohost.app/${app}" diff --git a/scripts/remove b/scripts/remove index e567844..f79f779 100755 --- a/scripts/remove +++ b/scripts/remove @@ -69,15 +69,10 @@ ynh_remove_logrotate #================================================= # REMOVE HASTE BINARY #================================================= +ynh_script_progression --message="Removing various files..." --weight=1 ynh_secure_remove --file="/usr/bin/$app" -#================================================= -# REMOVE DATADIR DIRECTORY -#================================================= - -ynh_secure_remove --file="$data_path" - #================================================= # REMOVE DATA DIR #================================================= @@ -92,6 +87,7 @@ fi #================================================= # REMOVE NODEJS #================================================= +ynh_script_progression --message="Removing dependencies..." --weight=5 ynh_remove_nodejs From 3c3f1bc59a1fc63dceb993fad25bbfe2e294cb17 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 13 May 2022 22:11:40 +0200 Subject: [PATCH 32/59] cleaning up --- check_process | 5 +++++ scripts/backup | 2 +- scripts/install | 2 ++ scripts/restore | 26 +++++++++++++++++++------- scripts/upgrade | 4 ++++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index c7e7a34..3554c31 100644 --- a/check_process +++ b/check_process @@ -12,9 +12,14 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=0ea46c375b775316cec39a96fa917ec240e45970 backup_restore=1 multi_instance=0 change_url=1 ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=0ea46c375b775316cec39a96fa917ec240e45970 + name=Testing (#33) + manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/scripts/backup b/scripts/backup index 9c7fc73..bc99ca4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -55,7 +55,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP DATADIR DIRECTORY #================================================= -ynh_backup --src_path="$data_path" +ynh_backup --src_path="$data_path" --is_big #================================================= # BACKUP BINARY diff --git a/scripts/install b/scripts/install index b9b6f53..db3dbb8 100755 --- a/scripts/install +++ b/scripts/install @@ -128,6 +128,7 @@ chown -R $app:www-data "$data_path" #================================================= # CONFIGURE HASTE #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" @@ -169,6 +170,7 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" diff --git a/scripts/restore b/scripts/restore index 234e2c8..3ff4e61 100755 --- a/scripts/restore +++ b/scripts/restore @@ -40,6 +40,7 @@ test ! -d $final_path || ynh_die "There is already a directory: $final_path " #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -70,12 +71,21 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE VARIOUS FILES #================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$data_path" +ynh_restore_file --origin_path="$data_path" --not_mandatory + +# Create app folders +mkdir -p "$data_path" + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # RESTORE BINARY #================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file --origin_path="/usr/bin/$app" @@ -100,6 +110,7 @@ chown $app -R /var/log/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" @@ -111,6 +122,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -118,12 +136,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c21fc75..103c625 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -108,12 +108,14 @@ ynh_system_user_create --username=$app #================================================= # UPGRADE NODEJS #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=8 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # UPGRADE NPM MODULES #================================================= +ynh_script_progression --message="Installing $app..." --weight=8 pushd "$final_path" ynh_use_nodejs @@ -149,6 +151,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ #================================================= # UPGRADE HASTE BINARY #================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 haste_url="${domain}${path_url}" ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" @@ -167,6 +170,7 @@ chmod +x /usr/bin/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" From 5dec26150f5555fcb3cfb352c0dbf31e4f4c46c8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 13 May 2022 23:10:25 +0200 Subject: [PATCH 33/59] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4a1cd29..175b920 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh10", + "version": "0.1.0~ynh11", "url": "http://hastebin.com/", "upstream": { "license": "MIT", From 7411c31388c0bb98839476fdc7bcd561e78801df Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 13 May 2022 21:10:31 +0000 Subject: [PATCH 34/59] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7efa71e..b60f95a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh10 +**Shipped version:** 0.1.0~ynh11 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 7ada107..d82e115 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh10 +**Version incluse :** 0.1.0~ynh11 **Démo :** http://hastebin.com/ From 91a0b48aba3668b940cbd97dddc4abf621de960d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 8 Jun 2022 02:35:21 +0000 Subject: [PATCH 35/59] Auto-update README --- README.md | 19 ++++++++++--------- README_fr.md | 25 +++++++++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b60f95a..c4e4139 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Haste for YunoHost -[![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Working status](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) [![Install Haste with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Lire ce readme en français.](./README_fr.md)* @@ -24,7 +24,7 @@ Haste is an open-source pastebin software written in node.js, which is easily in ## Screenshots -![](./doc/screenshots/screenshot.png) +![Screenshot of Haste](./doc/screenshots/screenshot.png) ## Disclaimers / important information @@ -45,21 +45,22 @@ The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple clien ## Documentation and resources -* Official app website: http://hastebin.com/ -* Official user documentation: https://hastebin.com/about.md -* Upstream app code repository: https://github.com/seejohnrun/haste-server -* YunoHost documentation for this app: https://yunohost.org/app_haste -* Report a bug: https://github.com/YunoHost-Apps/haste_ynh/issues +* Official app website: +* Official user documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/haste_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug or sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index d82e115..d955647 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Haste pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) [![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -20,7 +24,7 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install ## Captures d'écran -![](./doc/screenshots/screenshot.png) +![Capture d'écran de Haste](./doc/screenshots/screenshot.png) ## Avertissements / informations importantes @@ -42,21 +46,22 @@ Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simp ## Documentations et ressources -* Site officiel de l'app : http://hastebin.com/ -* Documentation officielle utilisateur : https://hastebin.com/about.md -* Dépôt de code officiel de l'app : https://github.com/seejohnrun/haste-server -* Documentation YunoHost pour cette app : https://yunohost.org/app_haste -* Signaler un bug : https://github.com/YunoHost-Apps/haste_ynh/issues +* Site officiel de l'app : +* Documentation officielle utilisateur : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/haste_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ou sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** From 9ec097995ee21dc2aff7fc19b9c6019bfe35f48a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Aug 2022 18:55:13 +0200 Subject: [PATCH 36/59] set relative path for --keep opt --- manifest.json | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 175b920..b11044b 100644 --- a/manifest.json +++ b/manifest.json @@ -25,7 +25,7 @@ "email": "maxime.bugeia@gmail.com" }], "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.0.9" }, "multi_instance": false, "services": [ diff --git a/scripts/upgrade b/scripts/upgrade index 103c625..cb8eb0a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,7 +84,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=7 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config.js" + ynh_setup_source --dest_dir="$final_path" --keep="config.js" fi #================================================= From 6081e9131c8339e697246738047f53041fe71306 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 15 Aug 2022 16:55:20 +0000 Subject: [PATCH 37/59] Auto-update README --- README.md | 1 + README_fr.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4e4139..f477b55 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Haste is an open-source pastebin software written in node.js, which is easily in **Shipped version:** 0.1.0~ynh11 + **Demo:** http://hastebin.com/ ## Screenshots diff --git a/README_fr.md b/README_fr.md index d955647..4b8ceff 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh11 +**Version incluse :** 0.1.0~ynh11 + **Démo :** http://hastebin.com/ From 91d83b41c684f742e6978e14be875c658c355774 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Aug 2022 18:55:40 +0200 Subject: [PATCH 38/59] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b11044b..586c845 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh11", + "version": "0.1.0~ynh12", "url": "http://hastebin.com/", "upstream": { "license": "MIT", From 82f6fb908d00a7bda01fa2b764353ad95a6ac64d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 15 Aug 2022 16:55:52 +0000 Subject: [PATCH 39/59] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f477b55..865ec6e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh11 +**Shipped version:** 0.1.0~ynh12 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 4b8ceff..b485d60 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh11 +**Version incluse :** 0.1.0~ynh12 **Démo :** http://hastebin.com/ From 769f022e7353d9477bcac2660b5daedf1a27a322 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Oct 2022 12:06:15 +0200 Subject: [PATCH 40/59] Upgrade to upstream --- conf/app.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index c2f6e6f..280fea2 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/72863858338a57d54eb9dee55530e90ebbc22453.tar.gz -SOURCE_SUM=0a9cfd42748e4410a3aa340d99ed6473962a013e9d5607b86121c32d5e0a5dd8 +SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz +SOURCE_SUM=8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 586c845..e68fac5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh12", + "version": "0.1.0~ynh13", "url": "http://hastebin.com/", "upstream": { "license": "MIT", From 3f8c057eb4a73841a622c404b575e3b040a53be4 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 16 Oct 2022 10:06:21 +0000 Subject: [PATCH 41/59] Auto-update README --- README.md | 3 +-- README_fr.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 865ec6e..18d7bf5 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh12 - +**Shipped version:** 0.1.0~ynh13 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index b485d60..0ca82a2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,8 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh12 - +**Version incluse :** 0.1.0~ynh13 **Démo :** http://hastebin.com/ From 4065c7d68284cf14b61664369a47221f68ca83e2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Oct 2022 12:21:24 +0200 Subject: [PATCH 42/59] Reorder script --- scripts/install | 18 ++++++++--------- scripts/restore | 30 ++++++++++++---------------- scripts/upgrade | 53 ++++++++++++++++++++++++------------------------- 3 files changed, 48 insertions(+), 53 deletions(-) diff --git a/scripts/install b/scripts/install index db3dbb8..aadca27 100755 --- a/scripts/install +++ b/scripts/install @@ -56,6 +56,14 @@ ynh_script_progression --message="Finding an available port..." --weight=2 port=$(ynh_find_port --port=7777) ynh_app_setting_set --app=$app --key=port --value=$port +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=3 + +# Create a system user +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -73,14 +81,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -115,7 +115,7 @@ popd ynh_script_progression --message="Creating the data directory..." --weight=1 # Define app's data directory -data_path="/home/yunohost.app/${app}" +data_path=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=data_path --value=$data_path # Create app folders diff --git a/scripts/restore b/scripts/restore index 3ff4e61..866e600 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,17 +33,11 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path || ynh_die "There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -51,6 +45,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -59,6 +57,13 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir=$final_path +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # SPECIFIC RESTORE #================================================= @@ -88,15 +93,6 @@ chown -R $app:www-data "$data_path" ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file --origin_path="/usr/bin/$app" - -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chown -R $app: "$data_path" chmod +x /usr/bin/$app #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index cb8eb0a..86f523a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,27 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +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" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -52,28 +73,15 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= -# STOP SYSTEMD SERVICE +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -95,14 +103,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC UPGRADE #================================================= @@ -135,8 +135,7 @@ 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" - +env_path="$PATH" ynh_add_systemd_config #================================================= From ab63cb6681276e63a241e7818f017174e32ded3f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 16 Oct 2022 14:09:10 +0200 Subject: [PATCH 43/59] Update restore --- scripts/restore | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/restore b/scripts/restore index 866e600..9fe4ea3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -38,6 +38,14 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -49,14 +57,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= From ff56827807dbfcee9fb07d01973226b76e628e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 11 Jan 2023 22:34:00 +0100 Subject: [PATCH 44/59] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index a25a77e..83e4dbe 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Haste is an open-source pastebin software +Description=Haste: pastebin software After=network.target syslog.target [Service] From 8315780f403b63605a5454287d373b6b57c38d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 3 Apr 2023 16:56:48 +0200 Subject: [PATCH 45/59] Version 2 (#38) * v2 * Auto-update README * v2 * Auto-update README * fix * Update config.js --------- Co-authored-by: yunohost-bot --- README.md | 20 +---- README_fr.md | 37 +++------ conf/app.src | 5 -- conf/config.js | 2 +- conf/systemd.service | 2 +- doc/{DISCLAIMER.md => ADMIN.md} | 7 +- doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 5 -- manifest.json | 55 ------------- manifest.toml | 58 ++++++++++++++ scripts/backup | 24 +----- scripts/change_url | 85 +------------------- scripts/install | 109 +++----------------------- scripts/remove | 40 ---------- scripts/restore | 79 ++----------------- scripts/upgrade | 84 ++------------------ tests.toml | 9 +++ 16 files changed, 111 insertions(+), 510 deletions(-) delete mode 100644 conf/app.src rename doc/{DISCLAIMER.md => ADMIN.md} (64%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (70%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/README.md b/README.md index 18d7bf5..c46eb68 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Haste for YunoHost -[![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Working status](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Working status](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) + [![Install Haste with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Lire ce readme en français.](./README_fr.md)* @@ -26,23 +27,6 @@ Haste is an open-source pastebin software written in node.js, which is easily in ![Screenshot of Haste](./doc/screenshots/screenshot.png) -## Disclaimers / important information - -#### Multi-user support - -* Are LDAP and HTTP auth supported? **No** -* Can the app be used by multiple users? **Yes** - -## `haste` command - -This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal: - -```bash -cat something | haste -https://haste.example.com/zuyejeduzu -``` -The [Haste-client](https://github.com/seejohnrun/haste-client) is a simple client for uploading data to you Haste server. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 0ca82a2..197cc42 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,15 +5,16 @@ It shall NOT be edited by hand. # Haste pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/haste.svg)](https://dash.yunohost.org/appci/app/haste) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/haste.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/haste.maintain.svg) + [![Installer Haste avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=haste) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Haste rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer Haste rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) @@ -22,33 +23,15 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install **Démo :** http://hastebin.com/ -## Captures d'écran +## Captures d’écran -![Capture d'écran de Haste](./doc/screenshots/screenshot.png) - -## Avertissements / informations importantes - -### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** -* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** - -## `haste` command - -Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal : - -```bash -cat something | haste -https://haste.example.com/zuyejeduzu -``` - -Le [client Haste](https://github.com/seejohnrun/haste-client) est un client simple pour télécharger des données sur votre serveur Haste. +![Capture d’écran de Haste](./doc/screenshots/screenshot.png) ## Documentations et ressources -* Site officiel de l'app : +* Site officiel de l’app : * Documentation officielle utilisateur : -* Dépôt de code officiel de l'app : +* Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -64,4 +47,4 @@ ou sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 280fea2..0000000 --- a/conf/app.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz -SOURCE_SUM=8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true diff --git a/conf/config.js b/conf/config.js index 6d07a95..16a5d10 100644 --- a/conf/config.js +++ b/conf/config.js @@ -25,7 +25,7 @@ }, "storage": { "type": "file", - "path": "__DATA_PATH__" + "path": "__DATA_DIR__" }, "documents": { "about": "./about.md" diff --git a/conf/systemd.service b/conf/systemd.service index 83e4dbe..ac28b34 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target syslog.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__ +WorkingDirectory=__INSTALL_DIR__ Environment="PATH=__ENV_PATH__" ExecStart=__YNH_NPM__ start StandardOutput=append:/var/log/__APP__/__APP__.log diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 64% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 4fcef40..77c0e89 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -1,11 +1,6 @@ -#### Multi-user support - -* Are LDAP and HTTP auth supported? **No** -* Can the app be used by multiple users? **Yes** - ## `haste` command -This Haste package for Yunohost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal: +This Haste package for YunoHost includes the [`haste` command](https://github.com/diethnis/standalones/blob/master/hastebin.sh), allowing you to share content from terminal: ```bash cat something | haste diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 70% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md index caa910a..3852877 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/ADMIN_fr.md @@ -1,8 +1,3 @@ -### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** -* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** - ## `haste` command Ce paquet de Haste pour YunoHost comprend une commande [`haste`](https://github.com/diethnis/standalones/blob/master/hastebin.sh), vous permettant de partager du contenu avec le terminal : diff --git a/manifest.json b/manifest.json deleted file mode 100644 index e68fac5..0000000 --- a/manifest.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "Haste", - "id": "haste", - "packaging_format": 1, - "description": { - "en": "Open-source pastebin allowing to upload texts", - "fr": "Pastebin open-source permettant de mettre en ligne du texte" - }, - "version": "0.1.0~ynh13", - "url": "http://hastebin.com/", - "upstream": { - "license": "MIT", - "website": "http://hastebin.com/", - "demo": "http://hastebin.com/", - "userdoc": "https://hastebin.com/about.md", - "code": "https://github.com/seejohnrun/haste-server" - }, - "license": "MIT", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "previous_maintainers": [{ - "name": "mbugeia", - "email": "maxime.bugeia@gmail.com" - }], - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain", - "help": { - "en": "Haste can only be installed in a root domain or subdomain", - "fr": "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" - } - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Haste sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..1bde19f --- /dev/null +++ b/manifest.toml @@ -0,0 +1,58 @@ +packaging_format = 2 + +id = "haste" +name = "Haste" +description.en = "Open-source pastebin allowing to upload texts" +description.fr = "Pastebin open-source permettant de mettre en ligne du texte" + +version = "0.1.0~ynh13" + +maintainers = ["eric_G"] + +[upstream] +license = "MIT" +website = "http://hastebin.com/" +demo = "http://hastebin.com/" +userdoc = "https://hastebin.com/about.md" +code = "https://github.com/seejohnrun/haste-server" + +[integration] +yunohost = ">= 11.1.16" +architectures = "all" +multi_instance = false +ldap = false +sso = true +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + [install.domain] + help.en = "Haste can only be installed in a root domain or subdomain" + help.fr = "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" + type = "domain" + full_domain = true + + [install.init_main_permission] + help.en = "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin." + help.fr = "Si cette case est cochée, Haste sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + +[resources] + [resources.sources.main] + url = "https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz" + sha256 = "8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd" + autoupdate.upstream = "https://github.com/seejohnrun/haste-server/" + autoupdate.strategy = "latest_github_commit" + + [resources.ports] + + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" diff --git a/scripts/backup b/scripts/backup index bc99ca4..d45b6dc 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,24 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -37,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -52,10 +34,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= -# BACKUP DATADIR DIRECTORY +# BACKUP DATA_DIR DIRECTORY #================================================= -ynh_backup --src_path="$data_path" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP BINARY diff --git a/scripts/change_url b/scripts/change_url index b1655f3..88c026d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path="/" - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the nginx config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config -fi - -# Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # GENERIC FINALISATION @@ -110,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index aadca27..a12f48f 100755 --- a/scripts/install +++ b/scripts/install @@ -9,69 +9,13 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE FAILURE OF THE SCRIPT -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path_url --value=$path_url - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -port=$(ynh_find_port --port=7777) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=2 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir=$final_path +ynh_setup_source --dest_dir=$install_dir #================================================= # NGINX CONFIGURATION @@ -86,7 +30,7 @@ ynh_add_nginx_config #================================================= # INSTALL NODEJS #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -104,44 +48,28 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Installing $app..." --weight=5 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less $ynh_npm install popd -#================================================= -# CREATE DIRECTORY FOR DATA -#================================================= -ynh_script_progression --message="Creating the data directory..." --weight=1 - -# Define app's data directory -data_path=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=data_path --value=$data_path - -# Create app folders -mkdir -p "$data_path" - -chmod 750 "$data_path" -chmod -R o-rwx "$data_path" -chown -R $app:www-data "$data_path" - #================================================= # CONFIGURE HASTE #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" +ynh_add_config --template="../conf/config.js" --destination="$install_dir/config.js" # Replace ajax.googleapis by local file -cp ../sources/jquery.min.js "$final_path/static/jquery.min.js" +cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" -ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$final_path/static/index.html" +ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" #================================================= # ADD HASTE AS A BINARY FILE #================================================= -haste_url="${domain}${path_url}" +haste_url="${domain}${path}" ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" #================================================= @@ -150,9 +78,9 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" # SECURE FILES AND DIRECTORIES #================================================= -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app #================================================= @@ -182,23 +110,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index f79f779..2972035 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) - #================================================= # STANDARD REMOVE #================================================= @@ -41,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=2 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -73,17 +54,6 @@ ynh_script_progression --message="Removing various files..." --weight=1 ynh_secure_remove --file="/usr/bin/$app" -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="$data_path" -fi - #================================================= # REMOVE NODEJS #================================================= @@ -91,16 +61,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=5 ynh_remove_nodejs -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 9fe4ea3..b4f893f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,60 +9,15 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=6 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC RESTORE @@ -78,14 +33,9 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$data_path" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -# Create app folders -mkdir -p "$data_path" - -chmod 750 "$data_path" -chmod -R o-rwx "$data_path" -chown -R $app:www-data "$data_path" +chown -R $app:www-data "$data_dir" #================================================= # RESTORE BINARY @@ -108,21 +58,13 @@ chown $app -R /var/log/$app #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= @@ -132,13 +74,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 86f523a..54b12c9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,38 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -48,41 +22,6 @@ 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" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - -# If data_path doesn't exist, create it -if [ -z "$data_path" ]; then - data_path="/home/yunohost.app/${app}" - mkdir -p "$data_path" - ynh_app_setting_set --app=$app --key=data_path --value=$data_path -fi - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -92,7 +31,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=7 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="config.js" + ynh_setup_source --dest_dir="$install_dir" --keep="config.js" fi #================================================= @@ -117,7 +56,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Installing $app..." --weight=8 -pushd "$final_path" +pushd "$install_dir" ynh_use_nodejs ynh_exec_warn_less $ynh_npm install popd @@ -143,16 +82,16 @@ ynh_add_systemd_config #================================================= # Replace ajax.googleapis by local file -cp ../sources/jquery.min.js "$final_path/static/jquery.min.js" +cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" -ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$final_path/static/index.html" +ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" #================================================= # UPGRADE HASTE BINARY #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -haste_url="${domain}${path_url}" +haste_url="${domain}${path}" ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" #================================================= @@ -161,9 +100,9 @@ ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" # SECURE FILES AND DIRECTORIES #================================================= -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app #================================================= @@ -180,13 +119,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..307d66b --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.0ea46c37.name = "Upgrade from #33" \ No newline at end of file From 741f42f19652065a63415f165e100079df1e2585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 3 Apr 2023 16:57:46 +0200 Subject: [PATCH 46/59] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1bde19f..35937b0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Haste" description.en = "Open-source pastebin allowing to upload texts" description.fr = "Pastebin open-source permettant de mettre en ligne du texte" -version = "0.1.0~ynh13" +version = "0.1.0~ynh14" maintainers = ["eric_G"] From bc467aa7cc4093c7e1e5de9615077d8d9c5c0b7e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 3 Apr 2023 14:57:52 +0000 Subject: [PATCH 47/59] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c46eb68..c85dd47 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh13 +**Shipped version:** 0.1.0~ynh14 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 197cc42..6e75ddc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh13 +**Version incluse :** 0.1.0~ynh14 **Démo :** http://hastebin.com/ From eaf6b8d96ad74c96e4c33b04eb77325d8c2aab5c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 4 Apr 2023 18:49:39 +0200 Subject: [PATCH 48/59] source autoupdate: fix version format because upstream doesn't have proper versioning ... --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 35937b0..2729ed7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -43,8 +43,8 @@ ram.runtime = "50M" [resources.sources.main] url = "https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz" sha256 = "8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd" - autoupdate.upstream = "https://github.com/seejohnrun/haste-server/" autoupdate.strategy = "latest_github_commit" + autoupdate.force_version = "0.1.%Y.%m.%d" [resources.ports] From 751ea304c6e5ad8d7db89297a581de3e37a07a75 Mon Sep 17 00:00:00 2001 From: YunoHost Bot Date: Tue, 4 Apr 2023 21:53:45 +0200 Subject: [PATCH 49/59] Upgrade to v0.1.2023.03.06 (#40) * Upgrade to v0.1.2023.03.06 * Auto-update README --- README.md | 2 +- README_fr.md | 2 +- manifest.toml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c85dd47..2d28b90 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh14 +**Shipped version:** 0.1.2023.03.06~ynh14 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 6e75ddc..564252e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh14 +**Version incluse :** 0.1.2023.03.06~ynh14 **Démo :** http://hastebin.com/ diff --git a/manifest.toml b/manifest.toml index 2729ed7..d2412e5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Haste" description.en = "Open-source pastebin allowing to upload texts" description.fr = "Pastebin open-source permettant de mettre en ligne du texte" -version = "0.1.0~ynh14" +version = "0.1.2023.03.06~ynh14" maintainers = ["eric_G"] @@ -41,8 +41,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/seejohnrun/haste-server/archive/7c65fb2f9b2e4b292e03c5d70957431bcc27d2c0.tar.gz" - sha256 = "8d420e2b47a640b38230114551ddffe86489cb6607af0659740385e6a9e36ebd" + url = "https://github.com/seejohnrun/haste-server/archive/b52b394bad909ddf151073987671e843540d91d6.tar.gz" + sha256 = "c9e70ded0cb205a91448d5102d043831679271229deaee37dd69167c652d5d1d" autoupdate.strategy = "latest_github_commit" autoupdate.force_version = "0.1.%Y.%m.%d" From 8c43ff9549a6c48f4c15702b850197d874fa0a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 3 Jun 2023 14:04:26 +0200 Subject: [PATCH 50/59] cleaning --- manifest.toml | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 1cb23e1..515d83c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ userdoc = "https://hastebin.com/about.md" code = "https://github.com/seejohnrun/haste-server" [integration] -yunohost = ">= 11.1.16" +yunohost = ">= 11.1.19" architectures = "all" multi_instance = false ldap = false diff --git a/scripts/install b/scripts/install index a12f48f..3de9d32 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ ynh_add_nginx_config #================================================= # INSTALL NODEJS #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=10 +ynh_script_progression --message="Installing dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version From 15b84068a466f396cf46c6e16374aa88a3c3395e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:22:41 +0200 Subject: [PATCH 51/59] Update manifest.toml --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 515d83c..8dd3c71 100644 --- a/manifest.toml +++ b/manifest.toml @@ -31,7 +31,6 @@ ram.runtime = "50M" help.en = "Haste can only be installed in a root domain or subdomain" help.fr = "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" type = "domain" - full_domain = true [install.init_main_permission] help.en = "If enabled, Haste will be accessible by people who do not have an account. This can be changed later via the webadmin." From 864a61b3466baea8872055586734f31b6bbae2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 18 Aug 2023 11:27:51 +0200 Subject: [PATCH 52/59] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 8dd3c71..946e544 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ userdoc = "https://hastebin.com/about.md" code = "https://github.com/seejohnrun/haste-server" [integration] -yunohost = ">= 11.1.19" +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false From 56d7d709f2bad216b53288c106a122f11f9772e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 30 Aug 2023 19:11:05 +0200 Subject: [PATCH 53/59] Update manifest.toml --- manifest.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 946e544..7c71cd1 100644 --- a/manifest.toml +++ b/manifest.toml @@ -28,8 +28,6 @@ ram.runtime = "50M" [install] [install.domain] - help.en = "Haste can only be installed in a root domain or subdomain" - help.fr = "Haste ne peut être installé que dans un domaine racine ou un sous-domaine" type = "domain" [install.init_main_permission] From a4732926c030b51baefa8106f8d1c6fd3e037a97 Mon Sep 17 00:00:00 2001 From: YunoHost Bot Date: Thu, 21 Sep 2023 18:36:47 +0200 Subject: [PATCH 54/59] Upgrade to v0.1.2023.09.21 (#42) * Upgrade to v0.1.2023.09.21 * Auto-update README --- README.md | 2 +- README_fr.md | 2 +- manifest.toml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c6bec9d..1154d27 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.2023.03.06~ynh1 +**Shipped version:** 0.1.2023.09.21~ynh1 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 91d531d..048fc93 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.2023.03.06~ynh1 +**Version incluse :** 0.1.2023.09.21~ynh1 **Démo :** http://hastebin.com/ diff --git a/manifest.toml b/manifest.toml index 7c71cd1..a3f308e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Haste" description.en = "Open-source pastebin allowing to upload texts" description.fr = "Pastebin open-source permettant de mettre en ligne du texte" -version = "0.1.2023.03.06~ynh1" +version = "0.1.2023.09.21~ynh1" maintainers = ["eric_G"] @@ -38,8 +38,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://github.com/seejohnrun/haste-server/archive/b52b394bad909ddf151073987671e843540d91d6.tar.gz" - sha256 = "c9e70ded0cb205a91448d5102d043831679271229deaee37dd69167c652d5d1d" + url = "https://github.com/seejohnrun/haste-server/archive/ded18b0c2e1ad05eaba6ab5bb938ae6b54cb5147.tar.gz" + sha256 = "2f4ac83e9fe2f78b4b48d3999cfbc879ed29fd15d5c1d21c316ef66ddfde89f1" autoupdate.strategy = "latest_github_commit" autoupdate.force_version = "0.1.%Y.%m.%d" From 7c9d3e52f52d15ec48b8ff0247c539bb0d334695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 9 Dec 2023 21:49:43 +0100 Subject: [PATCH 55/59] cleaning --- check_process | 25 ---------------- manifest.toml | 3 ++ scripts/install | 77 +++++++++++++++++++------------------------------ scripts/remove | 27 ----------------- scripts/restore | 16 +++++----- scripts/upgrade | 45 +++++++++-------------------- 6 files changed, 54 insertions(+), 139 deletions(-) delete mode 100644 check_process diff --git a/check_process b/check_process deleted file mode 100644 index 3554c31..0000000 --- a/check_process +++ /dev/null @@ -1,25 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/" - is_public=1 - port="7777" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=0ea46c375b775316cec39a96fa917ec240e45970 - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=0ea46c375b775316cec39a96fa917ec240e45970 - name=Testing (#33) - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/manifest.toml b/manifest.toml index a3f308e..5322f7d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,8 +20,11 @@ code = "https://github.com/seejohnrun/haste-server" yunohost = ">= 11.2" architectures = "all" multi_instance = false + ldap = false + sso = true + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index 3de9d32..615d5d3 100755 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,14 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL NODEJS +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -25,24 +33,30 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - -#================================================= -# ADD SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - env_path="$PATH" ynh_add_systemd_config +# FIXME Currently, the log is only redirected to syslog. +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown $app -R /var/log/$app + +ynh_use_logrotate + +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" + +#================================================= +# CONFIGURE HASTE +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="config.js" --destination="$install_dir/config.js" + +# Replace ajax.googleapis by local file +cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" + +ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" + #================================================= # INSTALL HASTEBIN #================================================= @@ -53,24 +67,12 @@ pushd "$install_dir" ynh_exec_warn_less $ynh_npm install popd -#================================================= -# CONFIGURE HASTE -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/config.js" --destination="$install_dir/config.js" - -# Replace ajax.googleapis by local file -cp ../sources/jquery.min.js "$install_dir/static/jquery.min.js" - -ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" --replace_string="jquery.min.js" --target_file="$install_dir/static/index.html" - #================================================= # ADD HASTE AS A BINARY FILE #================================================= haste_url="${domain}${path}" -ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" +ynh_add_config --template="haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION @@ -83,25 +85,6 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app -#================================================= -# HANDLE LOG FILES AND SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# FIXME Currently, the log is only redirected to syslog. -mkdir -p /var/log/$app -touch /var/log/$app/$app.log -chown $app -R /var/log/$app - -ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 2972035..9434ca3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,43 +22,16 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE HASTE BINARY -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - ynh_secure_remove --file="/usr/bin/$app" -#================================================= -# REMOVE NODEJS -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=5 - ynh_remove_nodejs #================================================= diff --git a/scripts/restore b/scripts/restore index b4f893f..2dccb71 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,6 +9,13 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL NODEJS +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -19,15 +26,6 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# SPECIFIC RESTORE -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE VARIOUS FILES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 54b12c9..45bdbce 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,13 @@ then ynh_setup_source --dest_dir="$install_dir" --keep="config.js" fi +#================================================= +# UPGRADE NODEJS +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=8 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # NGINX CONFIGURATION #================================================= @@ -42,14 +49,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# UPGRADE NODEJS -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=8 +# FIXME Currently, the log is only redirected to syslog. +ynh_use_logrotate --non-append -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +env_path="$PATH" +ynh_add_systemd_config + +yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" #================================================= # UPGRADE NPM MODULES @@ -61,22 +67,6 @@ pushd "$install_dir" ynh_exec_warn_less $ynh_npm install popd -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# FIXME Currently, the log is only redirected to syslog. -ynh_use_logrotate --non-append - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - -env_path="$PATH" -ynh_add_systemd_config - #================================================= # UPGRADE HASTE CONFIGURATION #================================================= @@ -92,7 +82,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ ynh_script_progression --message="Updating a configuration file..." --weight=1 haste_url="${domain}${path}" -ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" +ynh_add_config --template="haste.sh" --destination="/usr/bin/$app" #================================================= # GENERIC FINALIZATION @@ -105,13 +95,6 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x /usr/bin/$app -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= From 2e2607ce02c2e58d063297bf071bbeb4834d3f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 10 Dec 2023 11:16:42 +0100 Subject: [PATCH 56/59] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5322f7d..aa2fdab 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Haste" description.en = "Open-source pastebin allowing to upload texts" description.fr = "Pastebin open-source permettant de mettre en ligne du texte" -version = "0.1.2023.09.21~ynh1" +version = "0.1.2023.09.21~ynh2" maintainers = ["eric_G"] From 4806f07bf8928ddf9403850433769ed0bcd5db57 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 10 Dec 2023 10:16:46 +0000 Subject: [PATCH 57/59] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35a2593..1cd399b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.2023.09.21~ynh1 +**Shipped version:** 0.1.2023.09.21~ynh2 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index b04b184..cd74234 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.2023.09.21~ynh1 +**Version incluse :** 0.1.2023.09.21~ynh2 **Démo :** http://hastebin.com/ From d2a30d1471fc429101af91f44b844f91c90faa39 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Fri, 15 Mar 2024 02:31:46 +0100 Subject: [PATCH 58/59] Update links in manifest.toml --- manifest.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index aa2fdab..e81ec47 100644 --- a/manifest.toml +++ b/manifest.toml @@ -11,10 +11,9 @@ maintainers = ["eric_G"] [upstream] license = "MIT" -website = "http://hastebin.com/" -demo = "http://hastebin.com/" -userdoc = "https://hastebin.com/about.md" -code = "https://github.com/seejohnrun/haste-server" +demo = "https://www.toptal.com/developers/hastebin" +userdoc = "https://www.toptal.com/developers/hastebin/about" +code = "https://github.com/toptal/haste-server" [integration] yunohost = ">= 11.2" From b7a37ffc8d2e85e9549b7fc4a351d3d76c8c522a Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 15 Mar 2024 01:31:50 +0000 Subject: [PATCH 59/59] Auto-update README --- README.md | 16 +++++++--------- README_fr.md | 18 ++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 1cd399b..a285a52 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -18,10 +18,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) - **Shipped version:** 0.1.2023.09.21~ynh2 -**Demo:** http://hastebin.com/ +**Demo:** ## Screenshots @@ -29,11 +28,10 @@ Haste is an open-source pastebin software written in node.js, which is easily in ## Documentation and resources -* Official app website: -* Official user documentation: -* Upstream app code repository: -* YunoHost Store: -* Report a bug: +- Official user documentation: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info @@ -41,7 +39,7 @@ Please send your pull request to the [testing branch](https://github.com/YunoHos To try the testing branch, please proceed like that. -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug or sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug diff --git a/README_fr.md b/README_fr.md index cd74234..4379ab4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ @@ -18,10 +18,9 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) - **Version incluse :** 0.1.2023.09.21~ynh2 -**Démo :** http://hastebin.com/ +**Démo :** ## Captures d’écran @@ -29,11 +28,10 @@ Haste est un logiciel pastebin open-source écrit en node.js, facilement install ## Documentations et ressources -* Site officiel de l’app : -* Documentation officielle utilisateur : -* Dépôt de code officiel de l’app : -* YunoHost Store: -* Signaler un bug : +- Documentation officielle utilisateur : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs @@ -41,10 +39,10 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno Pour essayer la branche testing, procédez comme suit. -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ou sudo yunohost app upgrade haste -u https://github.com/YunoHost-Apps/haste_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :**