Browse Source

refactor: improve Pushbullet alert sending

The code in the `alert_pushbullet.sh` file has been refactored to improve the way Pushbullet alerts are sent. The curl command now includes the access token as a header instead of in the URL, resulting in more secure communication with the Pushbullet API. This change enhances the reliability and security of sending Pushbullet alerts.
pull/4345/head
Daniel Gibbs 2 years ago
parent
commit
0805246011
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 3
      lgsm/modules/alert_pushbullet.sh

3
lgsm/modules/alert_pushbullet.sh

@ -19,7 +19,8 @@ EOF
) )
fn_print_dots "Sending Pushbullet alert" fn_print_dots "Sending Pushbullet alert"
pushbulletsend=$(curl --connect-timeout 10 -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
pushbulletsend=$(curl --connect-timeout 10 -sSL -H "Access-Token: ${pushbullettoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
if [ -n "${pushbulletsend}" ]; then if [ -n "${pushbulletsend}" ]; then
fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}" fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"

Loading…
Cancel
Save