mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-23 04:40:40 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9755c32f8c | |||
| fc5c5db72b |
+3
-1
@@ -34,7 +34,7 @@
|
||||
## All commented values are examples only. Modify as needed.
|
||||
##
|
||||
## Uncomment the line below and specify the notification channels you wish to enable in a space separated string
|
||||
# NOTIFY_CHANNELS="apprise discord DSM file generic HA gotify matrix ntfy pushbullet pushover slack smtp telegram file"
|
||||
# NOTIFY_CHANNELS="apprise discord DSM file generic HA gotify matrix ntfy pushbullet pushover slack smtp telegram bark file"
|
||||
#
|
||||
## Uncomment the line below and specify the number of seconds to delay notifications to enable snooze
|
||||
# SNOOZE_SECONDS=86400
|
||||
@@ -90,4 +90,6 @@
|
||||
# TELEGRAM_TOKEN="token-value"
|
||||
# TELEGRAM_TOPIC_ID="0"
|
||||
#
|
||||
# BARK_KEY=""
|
||||
#
|
||||
# FILE_PATH="${ScriptWorkDir}/updates_available.txt"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# NOTIFY_BARK_VERSION="v1.0"
|
||||
|
||||
trigger_bark_notification() {
|
||||
local channel="$1"
|
||||
|
||||
if [[ -z "$jqbin" ]]; then
|
||||
for path in "$jqbin" "jq" "./jq" "../jq" "./jq-linux-TEMP" "../jq-linux-TEMP"; do
|
||||
if command -v "$path" &>/dev/null; then jqbin="$path"; break; fi
|
||||
done
|
||||
fi
|
||||
[[ -z "$jqbin" ]] && { echo "Error: jq missing"; return 1; }
|
||||
|
||||
[[ -z "$BARK_KEY" ]] && { echo "Error: Key not set"; return 1; }
|
||||
|
||||
local sound="${BARK_SOUND:-hello}"
|
||||
local group="${BARK_GROUP:-Dockcheck}"
|
||||
local icon_url="${BARK_ICON_URL:-https://raw.githubusercontent.com/mag37/dockcheck/main/logo.png}"
|
||||
|
||||
|
||||
local title="${MessageTitle%.}"
|
||||
local newline=$'\n'
|
||||
local formatted_body="## $title${newline}${newline}---${newline}${newline}$MessageBody"
|
||||
|
||||
local json_payload=$( "$jqbin" -n \
|
||||
--arg title "$title" \
|
||||
--arg body "$formatted_body" \
|
||||
--arg group "$group" \
|
||||
--arg sound "$sound" \
|
||||
--arg icon "$icon_url" \
|
||||
'{
|
||||
"title": $title,
|
||||
"markdown": $body,
|
||||
"group": $group,
|
||||
"sound": $sound,
|
||||
"icon": $icon,
|
||||
}' )
|
||||
|
||||
|
||||
if curl -s -f -X POST "https://api.day.app/$BARK_KEY" \
|
||||
-H "Content-Type: application/json; charset=utf-8" \
|
||||
-d "$json_payload" > /dev/null 2>&1; then
|
||||
echo "Bark notification sent successfully (Markdown): $title"
|
||||
fi
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
NOTIFY_V2_VERSION="v0.6"
|
||||
NOTIFY_V2_VERSION="v0.7"
|
||||
#
|
||||
# If migrating from an older notify template, remove your existing notify.sh file.
|
||||
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||
@@ -40,7 +40,7 @@ done
|
||||
|
||||
enabled_notify_templates=( "${!unique_templates[@]}" )
|
||||
|
||||
FromHost=$(cat /etc/hostname)
|
||||
FromHost="$(cat /etc/hostname 2>/dev/null)" || FromHost="$(hostname 2>/dev/null)" || FromHost="UNKNOWN"
|
||||
|
||||
CurrentEpochTime=$(date +"%Y-%m-%dT%H:%M:%S")
|
||||
CurrentEpochSeconds=$(date +%s)
|
||||
|
||||
Reference in New Issue
Block a user