Skip to content

Commit fc5e593

Browse files
authored
Merge pull request #6277 from beedaddy/ntfy_token
support NTFY_TOKEN
2 parents 34ea97d + f1dc79f commit fc5e593

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

notify/ntfy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#NTFY_URL="https://ntfy.sh"
66
#NTFY_TOPIC="xxxxxxxxxxxxx"
7+
#NTFY_TOKEN="xxxxxxxxxxxxx"
78

89
ntfy_send() {
910
_subject="$1"
@@ -23,6 +24,12 @@ ntfy_send() {
2324
_saveaccountconf_mutable NTFY_TOPIC "$NTFY_TOPIC"
2425
fi
2526

27+
NTFY_TOKEN="${NTFY_TOKEN:-$(_readaccountconf_mutable NTFY_TOKEN)}"
28+
if [ "$NTFY_TOKEN" ]; then
29+
_saveaccountconf_mutable NTFY_TOKEN "$NTFY_TOKEN"
30+
export _H1="Authorization: Bearer $NTFY_TOKEN"
31+
fi
32+
2633
_data="${_subject}. $_content"
2734
response="$(_post "$_data" "$NTFY_URL/$NTFY_TOPIC" "" "POST" "")"
2835

0 commit comments

Comments
 (0)