This commit is contained in:
parent
be7aa42d2a
commit
f0d2746b71
@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# TODO: Verify that variables are set properly
|
|
||||||
|
|
||||||
if [ -z ${PLUGIN_GOTIFY_URL} ]; then
|
if [ -z ${PLUGIN_GOTIFY_URL} ]; then
|
||||||
echo "PLUGIN_GOTIFY_URL is not set";
|
echo "PLUGIN_GOTIFY_URL is not set";
|
||||||
@ -11,10 +10,12 @@ if [ -z ${PLUGIN_GOTIFY_TOKEN} ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
res=$(curl -s "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
|
OUTPUT_FILE=$(mktemp)
|
||||||
if [ "$?" -ne "0" ]; then
|
STATUS_CODE=$(curl -s --output "$OUTPUT_FILE" --write-out "%{http_code}" "${PLUGIN_GOTIFY_URL}/message?token=${PLUGIN_GOTIFY_TOKEN}" -F "title=${PLUGIN_TITLE}" -F "message=${PLUGIN_MESSAGE}" -F "priority=5")
|
||||||
echo "Failed to send message"
|
if [ "$STATUS_CODE" -ne "200" ]; then
|
||||||
exit "$?"
|
echo "Failed to send message:"
|
||||||
|
cat "$OUTPUT_FILE" | jq .
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$res" | jq .
|
cat "$OUTPUT_FILE" | jq .
|
Loading…
Reference in New Issue
Block a user