add country

This commit is contained in:
Daniel Gibbs 2021-10-17 22:33:58 +01:00
parent 1ca8764ac6
commit e7ffdef7e9
No known key found for this signature in database
GPG Key ID: 2EBB36015C6D78E2
3 changed files with 15 additions and 6 deletions

View File

@ -25,8 +25,9 @@ json=$(cat <<EOF
"color": "${alertcolourdec}",
"fields": [
{
"name": "Game",
"value": "${gamename}"
"name": "Game",
"value": "${gamename}",
"inline": true
},
{
"name": "${alertplayerstitle}",
@ -53,6 +54,12 @@ json=$(cat <<EOF
"value": "${alertversion}",
"inline": true
},
{
"name": "Country",
"value": "${country}",
"inline": true
},
{
"name": "Server time",
"value": "${alertdate}",
"inline": true
@ -73,7 +80,7 @@ json=$(cat <<EOF
"url": "${alertimage}"
},
"footer": {
"text": "Powered by LinuxGSM ${version} - $(date)",
"text": "Powered by LinuxGSM ${version}",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
}
}

View File

@ -41,7 +41,7 @@ fn_github_set_latest_release_version(){
fn_githublocalversionfile "${githubreleaseuser}" "${githubreleaserepo}"
local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest"
githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq -r '.tag_name' )
githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name' )
# error if no version is there
if [ -z "${githubreleaseversion}" ]; then
@ -76,7 +76,7 @@ fn_github_compare_version(){
local githublatestreleaseurl="${github_api}/repos/${githubreleaseuser}/${githubreleaserepo}/releases/latest"
githublocalversion=$(cat "${githublocalversionfile}")
githubreleaseversion=$(curl -s "${githublatestreleaseurl}" | jq '.tag_name' )
githubreleaseversion=$(curl -s --connect-timeout 10 "${githublatestreleaseurl}" | jq '.tag_name' )
# error if no version is there
if [ -z "${githubreleaseversion}" ]; then

View File

@ -253,7 +253,9 @@ netlink=$(${ethtoolcommand} "${netint}" 2>/dev/null| grep Speed | awk '{print $2
# External IP address
if [ -z "${extip}" ]; then
extip="$(curl --connect-timeout 10 -s https://api.ipify.org 2>/dev/null)"
ipapijson=$(curl --connect-timeout 10 -s http://ip-api.com/json)
extip="$(echo "${ipapijson}" | jq -r .query)"
country="$(echo "${ipapijson}" | jq -r .country)"
exitcode=$?
# Should ifconfig.co return an error will use last known IP.
if [ ${exitcode} -eq 0 ]; then