$ICON is now optional

This commit is contained in:
2024-12-21 18:13:46 +01:00
parent 4cd6972aff
commit a185c38da3
3 changed files with 15 additions and 13 deletions

View File

@@ -24,15 +24,16 @@ AUTH_TOKEN=tk_dd5geasc9844jcm3d45adio3rtchs
#Duplicati Server
DUPLICATI_URL=http://192.168.178.25:8200
SERVER_NAME=n100
# NTFY Icon (Optional / Leer lassen falls nicht benötigt)
ICON=http://192.168.178.25:3030/icons/n100.png
# Zustände, die Benachrichtigungen auslösen
# (Success, Warning, Error, Fatal, Unknown)
SEND_NOTIFICATIONS="Fatal Unknown"
SEND_NOTIFICATIONS="Error Fatal Unknown"
# Optional kann bei jedem Ausführen des Scripts ein Logeintrag erstellt werden.
# Wählen Sie das Logging level. Möglich Werte: off, normal, debug
# Die Logdatei wird im gleichen Verzeichnis wie das Script selbst gespeichert.
# (off, normal, debug)
LOGGING=off
```

View File

@@ -5,13 +5,14 @@ AUTH_TOKEN=tk_elwqvm6niscdn30f45iksdfh6sope
#Duplicati Server
DUPLICATI_URL=http://192.168.178.25:8200
SERVER_NAME=n100
# NTFY Icon (Optional / Leer lassen falls nicht benötigt)
ICON=http://192.168.178.25:3030/icons/n100.png
# Zustände, die Benachrichtigungen auslösen
# (Success, Warning, Error, Fatal, Unknown)
SEND_NOTIFICATIONS="Fatal Error Unknown"
# Optional kann bei jedem Ausführen des Scripts ein Logeintrag erstellt werden.
# Wählen Sie das Logging level. Möglich Werte: off, normal, debug
# Die Logdatei wird im gleichen Verzeichnis wie das Script selbst gespeichert.
# (off, normal, debug)
LOGGING=off

View File

@@ -112,15 +112,15 @@ if should_notify "$DUPLICATI__PARSED_RESULT"; then
CURL_CMD="curl -s -X POST \"$NTFY_URL\" \
-H \"Authorization: Bearer $AUTH_TOKEN\" \
-H \"Priority: $PRIORITY\" \
-H \"Tags: $TAGS\" \
-H \"Icon: $ICON\" \
-H \"Content-Type: application/json\" \
-d '{\"topic\": \"Duplicati\", \"title\": \"$TITLE\", \"message\": \"$MESSAGE\\n\\nServer: $SERVER_NAME\\nJobname: $DUPLICATI__backup_name\\nStatus: $DUPLICATI__PARSED_RESULT\", \"click\": \"\", \"actions\": [{ \"action\": \"view\", \"label\": \"Duplicati öffnen\", \"url\": \"$DUPLICATI_URL\" }]}'
"
-H \"Tags: $TAGS\""
if [ -n "$ICON" ]; then
CURL_CMD="$CURL_CMD -H \"Icon: $ICON\""
fi
CURL_CMD="$CURL_CMD -H \"Content-Type: application/json\" \
-d '{\"topic\": \"Duplicati\", \"title\": \"$TITLE\", \"message\": \"$MESSAGE\\n\\nServer: $SERVER_NAME\\nJobname: $DUPLICATI__backup_name\\nStatus: $DUPLICATI__PARSED_RESULT\", \"click\": \"\", \"actions\": [{ \"action\": \"view\", \"label\": \"Duplicati öffnen\", \"url\": \"$DUPLICATI_URL\" }]}'"
# Log den curl-Befehl
if [[ "$LOGGING" == "debug" ]]; then
log_message "curl Befehl: $CURL_CMD"
fi