Notify_v2.sh bug fixes (#188)

* Notify_v2.sh bug fixes

* Clarify notify_v2.sh usage in README.md

* Fix JSON newline handling in Discord and Telegram channels

* Additional error messages when notification templates fail to be sourced

* Additional variable for self-hosted ntfy.sh domain

* Notify_v2.sh additional fixes

* Clarify usage in README.md and notify template comments

* Support sourcing template files from project root

* Add days old message to notification title

* Handle JSON with jq in Discord and Telegram templates

* Tweak notify_v2.sh usage docs and comments

* Remove extra newline from notification body

* replaced jq with jqbin, reodered setting of jqbin, changed source for hostname var

* moved the setting of jqbin a bit further up after further testing

---------

Co-authored-by: Matthew Oleksowicz <matt@everyoneneeds.it>
Co-authored-by: mag37 <robin.ivehult@gmail.com>
This commit is contained in:
vorezal 2025-05-29 16:43:34 -04:00 committed by GitHub
parent 22871442db
commit 57650f1673
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 109 additions and 38 deletions

View file

@ -2,7 +2,9 @@
NOTIFY_GOTIFY_VERSION="v0.3"
#
# Required receiving services must already be set up.
# Do not modify this file directly. Set GOTIFY_TOKEN and GOTIFY_DOMAIN in your dockcheck.config file.
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
# Do not modify this file directly within the "notify_templates" subdirectory. Set GOTIFY_TOKEN and GOTIFY_DOMAIN in your dockcheck.config file.
if [[ -z "${GOTIFY_TOKEN:-}" ]] || [[ -z "${GOTIFY_DOMAIN:-}" ]]; then
printf "Gotify notification channel enabled, but required configuration variables are missing. Gotify notifications will not be sent.\n"
@ -20,7 +22,7 @@ trigger_gotify_notification() {
ContentType="text/plain"
fi
JsonData=$( jq -n \
JsonData=$( "$jqbin" -n \
--arg body "$MessageBody" \
--arg title "$MessageTitle" \
--arg type "$ContentType" \