File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ # support ntfy
4+
5+ # NTFY_URL="https://ntfy.sh"
6+ # NTFY_TOPIC="xxxxxxxxxxxxx"
7+
8+ ntfy_send () {
9+ _subject=" $1 "
10+ _content=" $2 "
11+ _statusCode=" $3 " # 0: success, 1: error 2($RENEW_SKIP): skipped
12+ _debug " _subject" " $_subject "
13+ _debug " _content" " $_content "
14+ _debug " _statusCode" " $_statusCode "
15+
16+ NTFY_URL=" ${NTFY_URL:- $(_readaccountconf_mutable NTFY_URL)} "
17+ if [ " $NTFY_URL " ]; then
18+ _saveaccountconf_mutable NTFY_URL " $NTFY_URL "
19+ fi
20+
21+ NTFY_TOPIC=" ${NTFY_TOPIC:- $(_readaccountconf_mutable NTFY_TOPIC)} "
22+ if [ " $NTFY_TOPIC " ]; then
23+ _saveaccountconf_mutable NTFY_TOPIC " $NTFY_TOPIC "
24+ fi
25+
26+ _data=" ${_subject} . $_content "
27+ response=" $( _post " $_data " " $NTFY_URL /$NTFY_TOPIC " " " " POST" " " ) "
28+
29+ if [ " $? " = " 0" ] && _contains " $response " " expires" ; then
30+ _info " ntfy event fired success."
31+ return 0
32+ fi
33+
34+ _err " ntfy event fired error."
35+ _err " $response "
36+ return 1
37+ }
You can’t perform that action at this time.
0 commit comments