2025-09-16 09:40:30 +01:00
|
|
|
#!/usr/bin/env bash
|
2024-06-20 22:05:10 -04:00
|
|
|
|
2025-09-16 09:40:30 +01:00
|
|
|
# Gotify notification template for podcheck v2
|
|
|
|
|
# Requires: GOTIFY_DOMAIN, GOTIFY_TOKEN
|
2024-08-17 08:50:39 -04:00
|
|
|
|
2025-09-16 09:40:30 +01:00
|
|
|
if [[ -z "${GOTIFY_DOMAIN:-}" ]] || [[ -z "${GOTIFY_TOKEN:-}" ]]; then
|
|
|
|
|
echo "Error: GOTIFY_DOMAIN and GOTIFY_TOKEN must be configured"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
2024-08-17 08:50:39 -04:00
|
|
|
|
2025-09-16 09:40:30 +01:00
|
|
|
# Prepare the Gotify message
|
|
|
|
|
if [[ -n "${NOTIFICATION_MESSAGE:-}" ]]; then
|
|
|
|
|
# Build Gotify URL
|
|
|
|
|
gotify_url="${GOTIFY_DOMAIN}/message?token=${GOTIFY_TOKEN}"
|
|
|
|
|
|
|
|
|
|
# Send to Gotify
|
|
|
|
|
if curl -F "title=${NOTIFICATION_TITLE:-Podcheck Notification}" \
|
|
|
|
|
-F "message=${NOTIFICATION_MESSAGE}" \
|
|
|
|
|
-F "priority=5" \
|
|
|
|
|
-X POST "${gotify_url}" \
|
|
|
|
|
${CurlArgs:-} &>/dev/null; then
|
|
|
|
|
return 0
|
|
|
|
|
else
|
|
|
|
|
echo "Failed to send Gotify notification"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "No notification message provided"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|