This commit is contained in:
cdle
2023-07-07 17:23:43 +08:00
parent adc9648c79
commit 761859b5fa
2 changed files with 17 additions and 6 deletions
+13 -2
View File
@@ -53,12 +53,22 @@ func Init() {
// utils.ReadYaml(utils.ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyplus/main/conf/demo_config.yaml")
initToHandleMessage()
sillyGirl.Set("compiled_at", compiled_at)
console.Log("编译版本%s", compiled_at)
console.Log("编译版本: %s", compiled_at)
initWeb()
initCarry()
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 {
if old != new {
if updates == 0 {
return &storage.Final{
Message: "升级中,请耐心等待...",
}
}
updates++
defer func() {
updates--
}()
var transport *http.Transport
instance, err := GetProxyTransport("https://raw.githubusercontent.com", "", nil)
if err != nil {
@@ -91,14 +101,15 @@ func Init() {
var resp *http.Response
var req *http.Request
console.Debug("正在从 cdle/binary 获取版本号...")
proxy := false
qurl := "https://raw.githubusercontent.com/cdle/binary/main/compile_time.go"
version, _ := GetVersion()
if version != "" {
console.Debug("正在从 github 获取版本号...")
latest_version = version
} else {
console.Debug("正在从 cdle/binary 获取版本号...")
req, _ = http.NewRequest("GET", qurl, strings.NewReader(""))
resp, err = client.Do(req)
if err != nil {
+4 -4
View File
@@ -339,9 +339,9 @@ func initWeb() {
srvs = append(srvs, srv)
go func() {
logs.Info("Http服务(%d)重新运行", port)
logs.Info("Http服务(%v)重新运行", port)
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
}
}()
@@ -369,10 +369,10 @@ func initWeb() {
logs.Info("管理员面板:")
logs.Info(" > 本机: http://localhost:%d/admin", port)
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")
if ip != "" {
logs.Info(" > 广域网: http://%s:%d/admin", ip, port)
logs.Info(" > 广域网: http://%v:%d/admin", ip, port)
}
sillyGirl.Set("local_ip", local_ip)
go func() {