3 #Support iOS Bark Notification
5 #BARK_API_URL="https://api.day.app/xxxx"
9 # subject content statusCode
13 _statusCode
="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
14 _debug
"_subject" "$_subject"
15 _debug
"_content" "$_content"
16 _debug
"_statusCode" "$_statusCode"
18 BARK_API_URL
="${BARK_API_URL:-$(_readaccountconf_mutable BARK_API_URL)}"
19 if [ -z "$BARK_API_URL" ]; then
21 _err
"You didn't specify a Bark API URL BARK_API_URL yet."
22 _err
"You can download Bark from App Store and get yours."
25 _saveaccountconf_mutable BARK_API_URL
"$BARK_API_URL"
27 BARK_SOUND
="${BARK_SOUND:-$(_readaccountconf_mutable BARK_SOUND)}"
28 _saveaccountconf_mutable BARK_SOUND
"$BARK_SOUND"
30 BARK_GROUP
="${BARK_GROUP:-$(_readaccountconf_mutable BARK_GROUP)}"
31 if [ -z "$BARK_GROUP" ]; then
33 _info
"The BARK_GROUP is not set, so use the default ACME as group name."
35 _saveaccountconf_mutable BARK_GROUP
"$BARK_GROUP"
38 _content
=$
(echo "$_content" | _url_encode
)
39 _subject
=$
(echo "$_subject" | _url_encode
)
41 response
="$(_get "$BARK_API_URL/$_subject/$_content?sound
=$BARK_SOUND&group
=$BARK_GROUP")"
43 if [ "$?" = "0" ] && _contains
"$response" "success"; then
44 _info
"Bark API fired success."
48 _err
"Bark API fired error."