merge pushover PR

This commit is contained in:
belgotux
2023-01-09 00:01:57 +01:00
parent 9f0d4d3f9f
commit 6f16022b45
3 changed files with 47 additions and 4 deletions
+31 -2
View File
@@ -86,8 +86,8 @@ function sendPushBullet {
#var verification
if [ "$pushbulletProviderApi" == "" ] || [ "$pushbulletAccessToken" == "" ] ; then
echo "Can't sen push notification without complete variables for PushBullet" 1>&2
addLog "Can't sen push notification without complete variables for PushBullet"
echo "Can't send push notification without complete variables for PushBullet" 1>&2
addLog "Can't send push notification without complete variables for PushBullet"
return 1
fi
@@ -125,4 +125,33 @@ function sendTelegram {
if [ $returnCurl -ne 0 ] ; then cat $tempfile ; fi
rm $tempfile
return $returnCurl
}
function sendPushover {
#replace default mesg
if [ "$1" != "" ] ; then
subjectPushover=$1
fi
if [ "$2" != "" ] ; then
textPushover=$2
fi
#var verification
if [ "$pushoverProviderApi" == "" ] || [ "$pushoverAppToken" == "" ] || [ "$pushoverUserkey" == "" ] ; then
echo "Can't send push notification without complete variables for Pushover" 1>&2
addLog "Can't send push notification without complete variables for Pushover"
return 1
fi
tempfile=$(mktemp --suffix '.nutNotifyPushOver')
curl -s \
--form-string "token=$pushoverAppToken" \
--form-string "user=$pushoverUserkey" \
--form-string "title=$subjectPushover" \
--form-string "message=$textPushover" \
$pushoverProviderApi
returnCurl=$?
if [ $returnCurl -ne 0 ] ; then cat $tempfile ; fi
rm $tempfile
return $returnCurl
}