This commit is contained in:
cdle
2023-07-07 14:58:30 +08:00
parent 8c4e93d614
commit de0138d01c
2 changed files with 15 additions and 4 deletions
+13 -2
View File
@@ -19,13 +19,15 @@ import (
) )
var DataHome = utils.GetDataHome() var DataHome = utils.GetDataHome()
var version = compiled_at
func GetVersion() (string, error) { func GetVersion() (string, error) {
v, e := httplib.Get("http://172.96.255.172:8765/api/version").String() v, e := httplib.Get("http://172.96.255.172:8765/api/version").String()
if len(v) == 13 { if len(v) == 13 {
if version != v && v != compiled_at {
sillyGirl.Set("version", v) sillyGirl.Set("version", v)
if v != compiled_at { console.Log("发现更新,版本号", v)
console.Log("发现到更新,版本号:", v) version = v
} }
return v, e return v, e
} }
@@ -33,6 +35,15 @@ func GetVersion() (string, error) {
} }
func Init() { func Init() {
go func() {
for {
GetVersion()
if version != compiled_at {
break
}
time.Sleep(time.Minute * 5)
}
}()
initLoc() initLoc()
sillyGirl = MakeBucket("sillyGirl") sillyGirl = MakeBucket("sillyGirl")
_, err := os.Stat(DataHome) _, err := os.Stat(DataHome)
+1 -1
View File
@@ -23,7 +23,7 @@ func main() {
if err == nil { if err == nil {
app.Set("ip", ip) app.Set("ip", ip)
} }
core.GetVersion()
}() }()
core.Init() core.Init()
if app.GetBool("anti_kasi") { if app.GetBool("anti_kasi") {