_subject/_content passed through json encoder, 'borrowed' the _H1 line from slack.sh to specify content type

This commit is contained in:
Daniel Kearns 2019-06-12 15:31:41 +01:00
parent d94b347733
commit 8f2a8a8383

View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#Support PUSHOVER.com api #Support for pushover.net's api. Push notification platform for multiple platforms
PUSHOVER_URI="https://api.pushover.net/1/messages.json" PUSHOVER_URI="https://api.pushover.net/1/messages.json"
@ -32,6 +32,9 @@ pushover_send() {
fi fi
_saveaccountconf_mutable PUSHOVER_SOUND "$PUSHOVER_SOUND" _saveaccountconf_mutable PUSHOVER_SOUND "$PUSHOVER_SOUND"
export _H1="Content-Type: application/json"
_content="$(printf "*%s*\n" "$_content" | _json_encode)"
_subject="$(printf "*%s*\n" "$_subject" | _json_encode)"
_data="{\"token\": \"$PUSHOVER_TOKEN\",\"user\": \"$PUSHOVER_USER\",\"title\": \"$_subject\",\"message\": \"$_content\",\"sound\": \"$PUSHOVER_SOUND\"}" _data="{\"token\": \"$PUSHOVER_TOKEN\",\"user\": \"$PUSHOVER_USER\",\"title\": \"$_subject\",\"message\": \"$_content\",\"sound\": \"$PUSHOVER_SOUND\"}"
response="" #just make shellcheck happy response="" #just make shellcheck happy