From 0262d93debd41f90ca4c61a14c23ab1a998dbb84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20P=C3=A0mies?= Date: Thu, 2 May 2024 10:56:18 +0200 Subject: [PATCH] integrate gotify notification commands --- updates_notifier.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/updates_notifier.sh b/updates_notifier.sh index 9aafc0d..805832b 100644 --- a/updates_notifier.sh +++ b/updates_notifier.sh @@ -10,7 +10,9 @@ if [[ $EUID -ne 0 ]]; then fi # vars gotify -readonly TOKEN="" +readonly GOTIFY_TOKEN="" +readonly GOTIFY_HOST="" +readonly GOTIFY_PRIORITY=5 apt update -qq @@ -26,5 +28,9 @@ else updates=$(echo $updates|tr -d '\n') OUT="There are **$num** updates: \r" OUT="${OUT} Packages: *$updates*" - sh ./utils/gotifypush.sh "$(hostname) pending updates" "$OUT" 5 $TOKEN + + # send gotify notification + TITLE="$(hostname) pending updates" + EXTRAS="{\"client::display\": {\"contentType\": \"text/markdown\"}}" + curl -X POST "$GOTIFY_HOST/message?token=$GOTIFY_TOKEN" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"message\": \"${OUT}\", \"priority\": ${GOTIFY_PRIORITY}, \"title\": \"${TITLE}\", \"extras\": ${EXTRAS} }" fi