Skip to content

Commit

Permalink
installer: fix geo_check (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
uubulb authored Aug 5, 2024
1 parent 89fe4ec commit f289b76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br>
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.18.2-brightgreen?style=for-the-badge&logo=linux">
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.18.3-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>
Expand Down
7 changes: 5 additions & 2 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
NZ_VERSION="v0.18.2"
NZ_VERSION="v0.18.3"

red='\033[0;31m'
green='\033[0;32m'
Expand Down Expand Up @@ -53,10 +53,13 @@ geo_check() {
ua="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
set -- $api_list
for url in $api_list; do
text="$(curl -A $ua -m 10 -s $url)"
text="$(curl -A "$ua" -m 10 -s $url)"
endpoint="$(echo $text | sed -n 's/.*h=\([^ ]*\).*/\1/p')"
if echo $text | grep -qw 'CN'; then
isCN=true
break
elif echo $url | grep -q $endpoint; then
break
fi
done
}
Expand Down
7 changes: 5 additions & 2 deletions script/install_en.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
NZ_VERSION="v0.18.2"
NZ_VERSION="v0.18.3"

red='\033[0;31m'
green='\033[0;32m'
Expand Down Expand Up @@ -53,10 +53,13 @@ geo_check() {
ua="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
set -- $api_list
for url in $api_list; do
text="$(curl -A $ua -m 10 -s $url)"
text="$(curl -A "$ua" -m 10 -s $url)"
endpoint="$(echo $text | sed -n 's/.*h=\([^ ]*\).*/\1/p')"
if echo $text | grep -qw 'CN'; then
isCN=true
break
elif echo $url | grep -q $endpoint; then
break
fi
done
}
Expand Down

0 comments on commit f289b76

Please sign in to comment.