Browse Source

remove escaped

pull/3051/head
Daniel Gibbs 5 years ago
parent
commit
3b43b7987d
  1. 4
      lgsm/functions/alert.sh
  2. 6
      lgsm/functions/alert_discord.sh
  3. 2
      lgsm/functions/alert_ifttt.sh
  4. 2
      lgsm/functions/alert_pushbullet.sh
  5. 2
      lgsm/functions/alert_pushover.sh
  6. 4
      lgsm/functions/alert_rocketchat.sh
  7. 4
      lgsm/functions/alert_slack.sh
  8. 5
      lgsm/functions/alert_telegram.sh

4
lgsm/functions/alert.sh

@ -79,10 +79,6 @@ info_distro.sh
info_config.sh
info_messages.sh
# JSON-safe escaping string. - use this is json based alerts
escaped_servername=$(echo -n "${servername}" | jq -sRr "@json")
escaped_alertbody=$(echo -n "${alertbody}" | jq -sRr "@json")
if [ "${alert}" == "permissions" ]; then
fn_alert_permissions
elif [ "${alert}" == "restart" ]; then

6
lgsm/functions/alert_discord.sh

@ -22,8 +22,8 @@ json=$(cat <<EOF
"author": {
"name": "${alertemoji} ${alertsubject} ${alertemoji}",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.png"},
"title": "${escaped_servername}",
"description": ${escaped_alertbody},
"title": "${servername}",
"description": "${alertbody}",
"url": "",
"type": "content",
"thumbnail": {},
@ -41,7 +41,7 @@ json=$(cat <<EOF
},
{
"name": "Server Name",
"value": ${escaped_servername},
"value": "${servername}",
"inline": true
}
]

2
lgsm/functions/alert_ifttt.sh

@ -10,7 +10,7 @@ json=$(cat <<EOF
{
"value1": "${selfname}",
"value2": "${alertemoji} ${alertsubject} ${alertemoji}",
"value3": "Message: \n${escaped_alertbody}\n\nGame: \n${gamename}\n\nServer name: \n${escaped_servername}\n\nHostname: \n${HOSTNAME}\n\nServer IP: \n${alertip}:${port}\n\nMore info: \n${alerturl}"
"value3": "Message: \n${alertbody}\n\nGame: \n${gamename}\n\nServer name: \n${servername}\n\nHostname: \n${HOSTNAME}\n\nServer IP: \n${alertip}:${port}\n\nMore info: \n${alerturl}"
}
EOF
)

2
lgsm/functions/alert_pushbullet.sh

@ -11,7 +11,7 @@ json=$(cat <<EOF
"channel_tag": "${channeltag}",
"type": "note",
"title": "${alertemoji} ${alertsubject} ${alertemoji}",
"body": "Message\n${escaped_alertbody}\n\nGame\n${gamename}\n\nServer name\n${escaped_servername}\n\nHostname\n${HOSTNAME}\n\nServer IP\n${alertip}:${port}\n\nMore info\n${alerturl}"
"body": "Message\n${alertbody}\n\nGame\n${gamename}\n\nServer name\n${servername}\n\nHostname\n${HOSTNAME}\n\nServer IP\n${alertip}:${port}\n\nMore info\n${alerturl}"
}
EOF
)

2
lgsm/functions/alert_pushover.sh

@ -21,7 +21,7 @@ else
alertpriority="0"
fi
pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${escaped_alertbody}<br><br><b>Game</b><br>${escaped_gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
if [ "${pushoversend}" ]; then
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"

4
lgsm/functions/alert_rocketchat.sh

@ -14,7 +14,7 @@ fi
json=$(cat <<EOF
{
"alias": "LinuxGSM",
"text": "*${alertemoji} ${alertsubject} ${alertemoji}* + \n ${escaped_alertbody}",
"text": "*${alertemoji} ${alertsubject} ${alertemoji}* + \n ${alertbody}",
"attachments": [
{
"title": "Linuxgsm Alert",
@ -34,7 +34,7 @@ json=$(cat <<EOF
{
"short": true,
"title": "Server Name:",
"value": "${escaped_servername}"
"value": "${servername}"
}
]
}

4
lgsm/functions/alert_slack.sh

@ -28,7 +28,7 @@ json=$(cat <<EOF
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${alertemoji} ${alertsubject} ${alertemoji}* \n ${escaped_alertbody}"
"text": "*${alertemoji} ${alertsubject} ${alertemoji}* \n ${alertbody}"
}
},
{
@ -47,7 +47,7 @@ json=$(cat <<EOF
},
{
"type": "mrkdwn",
"text": "*Server Name:* \n ${escaped_servername}"
"text": "*Server Name:* \n ${servername}"
}
]
},

5
lgsm/functions/alert_telegram.sh

@ -6,14 +6,11 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
escaped_servername=$(echo -n "${servername}" | jq -sRr "@json")
escaped_alertbody=$(echo -n "${alertbody}" | jq -sRr "@json")
json=$(cat <<EOF
{
"chat_id": "${telegramchatid}",
"parse_mode": "HTML",
"text": "<b>${alertemoji} ${alertsubject} ${alertemoji}</b>\n\n<b>Message</b>\n${escaped_alertbody}\n\n<b>Game</b>\n${gamename}\n\n<b>Server name</b>\n${escaped_servername}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>Server IP</b>\n<a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a>\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>",
"text": "<b>${alertemoji} ${alertsubject} ${alertemoji}</b>\n\n<b>Message</b>\n${alertbody}\n\n<b>Game</b>\n${gamename}\n\n<b>Server name</b>\n${servername}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>Server IP</b>\n<a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a>\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>",
"disable_web_page_preview": "yes",
EOF
)

Loading…
Cancel
Save