1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 21:29:02 +08:00

fix: Geoip lang select

Signed-off-by: zu1k <i@zu1k.com>
This commit is contained in:
zu1k 2022-05-09 14:59:02 +08:00
parent c0643f7731
commit 8078e86156

View File

@ -7,6 +7,8 @@ import (
"net" "net"
"os" "os"
"github.com/spf13/viper"
"github.com/oschwald/geoip2-golang" "github.com/oschwald/geoip2-golang"
) )
@ -41,11 +43,9 @@ func (g GeoIP) Find(query string, params ...string) (result fmt.Stringer, err er
return return
} }
lang := "zh-CN" lang := viper.GetString("selected.lang")
if len(params) > 0 { if lang == "" {
if _, ok := record.Country.Names[params[0]]; ok { lang = "zh-CN"
lang = params[0]
}
} }
result = Result{ result = Result{