Browse Source

Merge pull request #6277 from beedaddy/ntfy_token

support NTFY_TOKEN
pull/6285/head
neil 1 month ago
committed by GitHub
parent
commit
fc5e593e2d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      notify/ntfy.sh

7
notify/ntfy.sh

@ -4,6 +4,7 @@
#NTFY_URL="https://ntfy.sh" #NTFY_URL="https://ntfy.sh"
#NTFY_TOPIC="xxxxxxxxxxxxx" #NTFY_TOPIC="xxxxxxxxxxxxx"
#NTFY_TOKEN="xxxxxxxxxxxxx"
ntfy_send() { ntfy_send() {
_subject="$1" _subject="$1"
@ -23,6 +24,12 @@ ntfy_send() {
_saveaccountconf_mutable NTFY_TOPIC "$NTFY_TOPIC" _saveaccountconf_mutable NTFY_TOPIC "$NTFY_TOPIC"
fi fi
NTFY_TOKEN="${NTFY_TOKEN:-$(_readaccountconf_mutable NTFY_TOKEN)}"
if [ "$NTFY_TOKEN" ]; then
_saveaccountconf_mutable NTFY_TOKEN "$NTFY_TOKEN"
export _H1="Authorization: Bearer $NTFY_TOKEN"
fi
_data="${_subject}. $_content" _data="${_subject}. $_content"
response="$(_post "$_data" "$NTFY_URL/$NTFY_TOPIC" "" "POST" "")" response="$(_post "$_data" "$NTFY_URL/$NTFY_TOPIC" "" "POST" "")"

Loading…
Cancel
Save