From 29f8a1191b8731a7ada682c0462fd7133d0ed01f Mon Sep 17 00:00:00 2001
From: xurui <1627119275@qq.com>
Date: Wed, 13 Jan 2021 11:41:12 +0800
Subject: [PATCH] =?UTF-8?q?1.=20=E6=98=BE=E7=A4=BA=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
html/update.html | 29 ++++++++++++++++++++++++++---
main.go | 13 +++++++++----
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/html/update.html b/html/update.html
index c1d4a2f..1187c61 100644
--- a/html/update.html
+++ b/html/update.html
@@ -90,7 +90,9 @@
{{ data.body }}
diff --git a/main.go b/main.go
index 9246b46..fb395e1 100644
--- a/main.go
+++ b/main.go
@@ -31,6 +31,7 @@ func getInfo() (size int64, data string) {
fmt.Println(data)
r := regexp.MustCompile(`\"size\":(.+?),`)
if r.MatchString(data) {
+ fmt.Println(r.FindStringSubmatch(data))
var data = r.FindStringSubmatch(data)[1]
size, _ = strconv.ParseInt(data, 10, 64)
}
@@ -47,9 +48,11 @@ func CheckUpdate(size int64) {
}
func main() {
var size, data = getInfo()
- if os.Getenv("Mode") != "dev" {
- CheckUpdate(size)
- }
+ CheckUpdate(size)
+ //
+ //if os.Getenv("Mode") != "dev" {
+ // CheckUpdate(size)
+ //}
mux := http.NewServeMux()
box := packr.NewBox("./html")
mux.Handle("/", http.FileServer(box))
@@ -65,7 +68,9 @@ func main() {
ui, _ := lorca.New("", "", 600, 900)
defer ui.Close()
-
+ ui.Bind("getSize", func() int64 {
+ return size
+ })
ui.Bind("getUpdateInfo", func() string {
return data
})