Skip to content

Commit

Permalink
fix: update Pushover alert message formatting
Browse files Browse the repository at this point in the history
The commit fixes the formatting of the Pushover alert message by removing unnecessary information and adding a conditional check for the presence of an alert URL.
  • Loading branch information
dgibbs64 committed Oct 17, 2023
1 parent dec428d commit 237baf8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lgsm/modules/alert_pushover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ else
alertpriority="0"
fi

pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alerttitle} ${alertemoji}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
if [ -z "${alerturl}" ]; then
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}" "https://api.pushover.net/1/messages.json" | grep errors)
else
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
fi

if [ -n "${pushoversend}" ]; then
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
Expand Down

0 comments on commit 237baf8

Please sign in to comment.