1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ntfy_ynh.git synced 2024-09-03 19:46:27 +02:00

Update upstream to v2.8.0 (#30)

* Switch to manifest src handling (#26)

* Switch to manifest src handling - take 1

* Switch to manifest src handling - take 2

* Switch to manifest src handling - take 3

* Update pkg to 2.7.0~ynh2

* Auto-update README

* Upgrade to v2.8.0

* Auto-update README

* Update manifest.toml

* Create DESCRIPTION_fr.md

* Auto-update README

* cleaning

* Script style cleanup

Co-authored-by: Alexander Wühr <alex@pnyhf.eu>
Co-authored-by: Salamandar <6552989+Salamandar@users.noreply.github.com>

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: Salamandar <6552989+Salamandar@users.noreply.github.com>
This commit is contained in:
Alexander Wühr 2023-12-15 12:58:34 +01:00 committed by GitHub
parent 0647ea45ef
commit dbdb3bbc9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 280 additions and 71 deletions

View file

@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
ntfy (pronounce: *notify*) is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, entirely without signup, cost or setup. It's also open source if you want to run your own. ntfy (pronounce: *notify*) is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, entirely without signup, cost or setup. It's also open source if you want to run your own.
**Shipped version:** 2.7.0~ynh2 **Shipped version:** 2.8.0~ynh1
**Demo:** https://ntfy.sh/app **Demo:** https://ntfy.sh/app
## Documentation and resources ## Documentation and resources

View file

@ -16,10 +16,9 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble ## Vue densemble
ntfy (pronounce: *notify*) is a simple HTTP-based pub-sub notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, entirely without signup, cost or setup. It's also open source if you want to run your own. ntfy (prononcer : *notify*) est un simple service de notification pub-sub basé sur HTTP. Il vous permet d'envoyer des notifications sur votre téléphone ou votre ordinateur via des scripts depuis n'importe quel ordinateur, sans inscription, sans frais ni configuration. Il est également open source si vous souhaitez exécuter le vôtre.
**Version incluse :** 2.8.0~ynh1
**Version incluse :** 2.7.0~ynh2
**Démo :** https://ntfy.sh/app **Démo :** https://ntfy.sh/app
## Documentations et ressources ## Documentations et ressources

View file

@ -1,5 +1,7 @@
location / { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
proxy_pass http://localhost:__PORT__/; location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;

View file

@ -2,4 +2,9 @@
HOME=__INSTALL_DIR__ HOME=__INSTALL_DIR__
if [ ! -f "$HOME/data/user.db" ]; then
echo "Waiting for server to start"
sleep 2
fi
NTFY_CONFIG_FILE="$HOME/server.yml" $HOME/ntfy $@ NTFY_CONFIG_FILE="$HOME/server.yml" $HOME/ntfy $@

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
ntfy (prononcer : *notify*) est un simple service de notification pub-sub basé sur HTTP. Il vous permet d'envoyer des notifications sur votre téléphone ou votre ordinateur via des scripts depuis n'importe quel ordinateur, sans inscription, sans frais ni configuration. Il est également open source si vous souhaitez exécuter le vôtre.

View file

@ -1,4 +1,5 @@
### Configuration ### Configuration
By default, only user selected at installation can read from and write to topics. To change this refer to the upstream project's documentation: https://docs.ntfy.sh/config/#access-control By default, only user selected at installation can read from and write to topics. To change this refer to the upstream project's documentation: https://docs.ntfy.sh/config/#access-control
The configuration file is located at `__INSTALL_DIR__/server.yml` and can be edited directly. The configuration file is located at `__INSTALL_DIR__/server.yml` and can be edited directly.

13
doc/admin_fr.md Normal file
View file

@ -0,0 +1,13 @@
### Configuration
Par défaut, seul l'utilisateur sélectionné lors de l'installation peut lire et écrire dans les rubriques. Pour modifier cela, reportez-vous à la documentation du projet : https://docs.ntfy.sh/config/#access-control
Le fichier de configuration se trouve dans `__INSTALL_DIR__/server.yml` et peut être modifié directement.
Pour configurer les utilisateurs, les jetons, les acls et les niveaux, vous trouverez un petit script wrapper dans `__INSTALL_DIR__/ntfy.sh`.
``` merde
sudo ~__APP__/ntfy.sh utilisateur ajoutez votre_nouveau_nom d'utilisateur
```
par exemple, ajoutera un nouvel utilisateur.

View file

@ -5,7 +5,7 @@ name = "ntfy"
description.en = "Open Source Push Notification Server" description.en = "Open Source Push Notification Server"
description.fr = "Serveur open source de notification" description.fr = "Serveur open source de notification"
version = "2.7.0~ynh2" version = "2.8.0~ynh1"
maintainers = ["Alexander Wühr"] maintainers = ["Alexander Wühr"]
@ -22,8 +22,11 @@ fund = "https://liberapay.com/ntfy"
yunohost = ">= 11.2" yunohost = ">= 11.2"
architectures = ["amd64", "arm64", "armhf"] architectures = ["amd64", "arm64", "armhf"]
multi_instance = true multi_instance = true
ldap = false ldap = false
sso = false sso = false
disk = "50M" disk = "50M"
ram.build = "50M" ram.build = "50M"
ram.runtime = "50M" ram.runtime = "50M"
@ -51,14 +54,14 @@ ram.runtime = "50M"
autoupdate.asset.arm64 = '.*_linux_arm64\.tar\.gz' autoupdate.asset.arm64 = '.*_linux_arm64\.tar\.gz'
autoupdate.asset.armhf = '.*_linux_armv7\.tar\.gz' autoupdate.asset.armhf = '.*_linux_armv7\.tar\.gz'
amd64.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.7.0/ntfy_2.7.0_linux_amd64.tar.gz" amd64.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.8.0/ntfy_2.8.0_linux_amd64.tar.gz"
amd64.sha256 = "2218bea3204348700034cff652437e317b8ed2466aa58d8b2444b41b68eaf5e2" amd64.sha256 = "7158312a9f6e49daf94355e63a8fa73e04f3c2d5defc2bba0cbf3e35fdf7bf9a"
arm64.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.7.0/ntfy_2.7.0_linux_arm64.tar.gz" arm64.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.8.0/ntfy_2.8.0_linux_arm64.tar.gz"
arm64.sha256 = "1e0e1bc4183e3ffecbe8d8b1b91b5df8965d907968588c19b7a591719bd146fb" arm64.sha256 = "918d0a81355288ef60e8ef0d0587630f069c5c75909a12d6abbdb2e1628dbc52"
armhf.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.7.0/ntfy_2.7.0_linux_armv7.tar.gz" armhf.url = "https://github.com/binwiederhier/ntfy/releases/download/v2.8.0/ntfy_2.8.0_linux_armv7.tar.gz"
armhf.sha256 ="84981fe6f4234fb8e6429b0c6cbe7090bab1f773e1994b42237c40c244cdd326" armhf.sha256 ="bf63f969b64889158bb0daa2f55f2e3356516a0c4ff2f57d0392a0c7df0abefc"
[resources.system_user] [resources.system_user]

View file

@ -8,16 +8,6 @@
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
ntfy_setup_source() {
ynh_setup_source -d "$install_dir"
mkdir -p "$install_dir/data"
chown -R $app:$app "$install_dir"
chmod -R 750 "$install_dir/data"
ynh_secure_remove "$install_dir/client"
ynh_secure_remove "$install_dir/server"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -1,10 +1,39 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_backup -s "$install_dir" #=================================================
ynh_backup -s "/etc/nginx/conf.d/$domain.d/$app.conf" # DECLARE DATA AND CONF FILES TO BACKUP
ynh_backup -s "/etc/systemd/system/$app.service" #=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed. (YunoHost will then actually copy those files to the archive)" ynh_print_info --message="Backup script completed. (YunoHost will then actually copy those files to the archive)"

View file

@ -1,15 +1,48 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_script_progression --message="Updating systemd service..." --weight=1 #=================================================
ynh_add_systemd_config # 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=1
ynh_script_progression --message="Updating webserver configuration..." --weight=1
ynh_change_url_nginx_config ynh_change_url_nginx_config
ynh_script_progression --message="Restarting systemd service..." --weight=1 #=================================================
ynh_systemd_action --action=restart # SPECIFIC MODIFICATIONS
#=================================================
ynh_script_progression --message="Updating systemd service..." --weight=1
ynh_script_progression --message="URL change completed" --last ynh_add_systemd_config
#=================================================
# GENERIC FINALISATION
#=================================================
# 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"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -1,32 +1,78 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=6 ynh_script_progression --message="Setting up source files..." --weight=6
ntfy_setup_source
ynh_setup_source --dest_dir="$install_dir"
mkdir -p "$install_dir/data"
chmod -R 750 "$install_dir/data"
chown -R $app:$app "$install_dir"
ynh_secure_remove "$install_dir/client"
ynh_secure_remove "$install_dir/server"
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding configuration file..." --weight=1 ynh_script_progression --message="Adding configuration file..." --weight=1
ynh_add_config -t "server.yml" -d "$install_dir/server.yml"
ynh_script_progression --message="Configuring systemd service..." --weight=1 ynh_add_config --template="server.yml" --destination="$install_dir/server.yml"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_add_systemd_config ynh_add_systemd_config
ynh_script_progression --message="Starting systemd service..." --weight=1 yunohost service add $app --description="Open Source Push Notification Server" --log="/var/log/$app/$app.log"
ynh_systemd_action --action=start
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 #=================================================
yunohost service add $app # ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Adding a command wrapper..." --weight=1
ynh_add_config -t "ntfy.sh" -d "$install_dir/ntfy.sh" ynh_add_config -t "ntfy.sh" -d "$install_dir/ntfy.sh"
chown $app:$app "$install_dir/ntfy.sh" chown $app:$app "$install_dir/ntfy.sh"
chmod u+x "$install_dir/ntfy.sh" chmod u+x "$install_dir/ntfy.sh"
ynh_script_progression --message="Configuring web server..." --weight=2 #=================================================
ynh_add_nginx_config # GENERIC FINALIZATION
#=================================================
# 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"
#=================================================
# ADD ADMIN
#=================================================
ynh_script_progression --message="Adding admin user..." --weight=1 ynh_script_progression --message="Adding admin user..." --weight=1
ynh_exec_as $app NTFY_PASSWORD="$password" $install_dir/ntfy.sh user add --role=admin $admin ynh_exec_as $app NTFY_PASSWORD="$password" $install_dir/ntfy.sh user add --role=admin $admin
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation completed" --last ynh_script_progression --message="Installation completed" --last

View file

@ -3,13 +3,26 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_script_progression --message="Removing service in YunoHost..." --weight=1 #=================================================
yunohost service remove $app # REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SYSTEMD SERVICE
#=================================================
# 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
yunohost service remove $app
fi
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_script_progression --message="Removing the systemd service..." --weight=1
ynh_remove_systemd_config ynh_remove_systemd_config
ynh_script_progression --message="Removing the web server configuration..." --weight=2
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal completed" --last ynh_script_progression --message="Removal completed" --last

View file

@ -1,25 +1,51 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_script_progression --message="Restoring the main directory..." --weight=1 #=================================================
ynh_restore_file -o "$install_dir" # RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_script_progression --message="Restoring the web server configuration..." --weight=1 ynh_restore_file --origin_path="$install_dir"
ynh_restore_file -o "/etc/nginx/conf.d/$domain.d/$app.conf"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
ynh_systemd_action --action=enable systemctl enable $app.service --quiet
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Open Source Push Notification Server" --log="/var/log/$app/$app.log"
yunohost service add $app
ynh_script_progression --message="Starting a systemd service..." --weight=1 #=================================================
ynh_systemd_action --action=start # GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_script_progression --message="Reloading the web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed" --last ynh_script_progression --message="Restoration completed" --last

View file

@ -1,35 +1,83 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# 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"
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=6 ynh_script_progression --message="Upgrading source files..." --weight=6
ntfy_setup_source
ynh_setup_source --dest_dir="$install_dir"
mkdir -p "$install_dir/data"
chmod -R 750 "$install_dir/data"
chown -R $app:$app "$install_dir"
ynh_secure_remove "$install_dir/client"
ynh_secure_remove "$install_dir/server"
fi fi
ynh_script_progression --message="Updating configuration file..." --weight=1 #=================================================
ynh_add_config -t "server.yml" -d "$install_dir/server.yml" # REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_add_systemd_config ynh_add_systemd_config
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Open Source Push Notification Server" --log="/var/log/$app/$app.log"
yunohost service add $app
#=================================================
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="server.yml" --destination="$install_dir/server.yml"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Updating simple command wrapper..." --weight=1 ynh_script_progression --message="Updating simple command wrapper..." --weight=1
ynh_add_config -t "ntfy.sh" -d "$install_dir/ntfy.sh"
ynh_add_config --template="ntfy.sh" --destination="$install_dir/ntfy.sh"
chown $app:$app "$install_dir/ntfy.sh" chown $app:$app "$install_dir/ntfy.sh"
chmod u+x "$install_dir/ntfy.sh" chmod u+x "$install_dir/ntfy.sh"
ynh_script_progression --message="Upgrading web server configuration..." --weight=2 #=================================================
ynh_add_nginx_config # START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Restarting systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --action=restart
ynh_script_progression --message="Upgrade completed" --last #=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last