x
This commit is contained in:
+13
-2
@@ -53,12 +53,22 @@ func Init() {
|
|||||||
// utils.ReadYaml(utils.ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyplus/main/conf/demo_config.yaml")
|
// utils.ReadYaml(utils.ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyplus/main/conf/demo_config.yaml")
|
||||||
initToHandleMessage()
|
initToHandleMessage()
|
||||||
sillyGirl.Set("compiled_at", compiled_at)
|
sillyGirl.Set("compiled_at", compiled_at)
|
||||||
console.Log("编译版本:%s", compiled_at)
|
console.Log("编译版本: %s", compiled_at)
|
||||||
initWeb()
|
initWeb()
|
||||||
initCarry()
|
initCarry()
|
||||||
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
|
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
|
||||||
|
var updates = 0
|
||||||
storage.Watch(sillyGirl, "compiled_at", func(old, new, key string) *storage.Final {
|
storage.Watch(sillyGirl, "compiled_at", func(old, new, key string) *storage.Final {
|
||||||
if old != new {
|
if old != new {
|
||||||
|
if updates == 0 {
|
||||||
|
return &storage.Final{
|
||||||
|
Message: "升级中,请耐心等待...",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updates++
|
||||||
|
defer func() {
|
||||||
|
updates--
|
||||||
|
}()
|
||||||
var transport *http.Transport
|
var transport *http.Transport
|
||||||
instance, err := GetProxyTransport("https://raw.githubusercontent.com", "", nil)
|
instance, err := GetProxyTransport("https://raw.githubusercontent.com", "", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -91,14 +101,15 @@ func Init() {
|
|||||||
var resp *http.Response
|
var resp *http.Response
|
||||||
var req *http.Request
|
var req *http.Request
|
||||||
|
|
||||||
console.Debug("正在从 cdle/binary 获取版本号...")
|
|
||||||
proxy := false
|
proxy := false
|
||||||
qurl := "https://raw.githubusercontent.com/cdle/binary/main/compile_time.go"
|
qurl := "https://raw.githubusercontent.com/cdle/binary/main/compile_time.go"
|
||||||
|
|
||||||
version, _ := GetVersion()
|
version, _ := GetVersion()
|
||||||
if version != "" {
|
if version != "" {
|
||||||
|
console.Debug("正在从 github 获取版本号...")
|
||||||
latest_version = version
|
latest_version = version
|
||||||
} else {
|
} else {
|
||||||
|
console.Debug("正在从 cdle/binary 获取版本号...")
|
||||||
req, _ = http.NewRequest("GET", qurl, strings.NewReader(""))
|
req, _ = http.NewRequest("GET", qurl, strings.NewReader(""))
|
||||||
resp, err = client.Do(req)
|
resp, err = client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+4
-4
@@ -339,9 +339,9 @@ func initWeb() {
|
|||||||
srvs = append(srvs, srv)
|
srvs = append(srvs, srv)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
logs.Info("Http服务(%d)重新运行", port)
|
logs.Info("Http服务(%v)重新运行", port)
|
||||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
logs.Error("Http服务(%d)运行失败:%s", port, err.Error())
|
logs.Error("Http服务(%v)运行失败:%s", port, err.Error())
|
||||||
ch <- err
|
ch <- err
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -369,10 +369,10 @@ func initWeb() {
|
|||||||
logs.Info("管理员面板:")
|
logs.Info("管理员面板:")
|
||||||
logs.Info(" > 本机: http://localhost:%d/admin", port)
|
logs.Info(" > 本机: http://localhost:%d/admin", port)
|
||||||
local_ip := getLocalIP()
|
local_ip := getLocalIP()
|
||||||
logs.Info(" > 局域网: http://%s:%d/admin", local_ip, port)
|
logs.Info(" > 局域网: http://%v:%d/admin", local_ip, port)
|
||||||
ip := sillyGirl.GetString("ip")
|
ip := sillyGirl.GetString("ip")
|
||||||
if ip != "" {
|
if ip != "" {
|
||||||
logs.Info(" > 广域网: http://%s:%d/admin", ip, port)
|
logs.Info(" > 广域网: http://%v:%d/admin", ip, port)
|
||||||
}
|
}
|
||||||
sillyGirl.Set("local_ip", local_ip)
|
sillyGirl.Set("local_ip", local_ip)
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user