Skip to content

Commit

Permalink
refactor: improve Pushbullet alert sending
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgibbs64 committed Oct 15, 2023
1 parent b3fafe8 commit 0805246
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lgsm/modules/alert_pushbullet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ EOF
)

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
fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"
Expand Down

0 comments on commit 0805246

Please sign in to comment.