Update InstallNET.sh

This commit is contained in:
Molly Lau 2022-12-03 18:16:52 +09:00 committed by GitHub
parent ab6d567faa
commit 50dbde8738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -365,11 +365,11 @@ function getDisk(){
# $1 is timezone checkfile direction, $2 $3 $4 are api keys. # $1 is timezone checkfile direction, $2 $3 $4 are api keys.
function getUserTimezone(){ function getUserTimezone(){
if [[ "$TimeZone" == "" ]]; then if [[ "$TimeZone" == "" ]]; then
UserIP=`who am i | awk '{print $5}' | sed 's/(//g' | sed 's/)//g'` GuestIP=`who am i | awk '{print $5}' | sed 's/(//g' | sed 's/)//g'`
for Count in "$2" "$3" "$4"; do for Count in "$2" "$3" "$4"; do
[[ "$TimeZone" == "Asia/Shanghai" ]] && break [[ "$TimeZone" == "Asia/Shanghai" ]] && break
tmpApi=`echo -n "$Count" | base64 -d` tmpApi=`echo -n "$Count" | base64 -d`
TimeZone=`curl -s "https://api.ipgeolocation.io/timezone?apiKey=$tmpApi&ip=$UserIP" | jq '.timezone' | tr -d '"'` TimeZone=`curl -s "https://api.ipgeolocation.io/timezone?apiKey=$tmpApi&ip=$GuestIP" | jq '.timezone' | tr -d '"'`
checkTz=`echo $TimeZone | cut -d'/' -f 1` checkTz=`echo $TimeZone | cut -d'/' -f 1`
[[ -n "$checkTz" && "$checkTz" =~ ^[a-zA-Z] ]] && break [[ -n "$checkTz" && "$checkTz" =~ ^[a-zA-Z] ]] && break
done done