mirror of
https://github.com/allinssl/allinssl.git
synced 2025-12-15 09:55:37 +08:00
新增企业微信通道
新增申请证书buypass 新增版本更新提醒 webhook、企业微信支持动态参数 监控支持域名加端口 ssh部署支持域名
This commit is contained in:
@@ -4,8 +4,11 @@ import (
|
||||
"ALLinSSL/backend/public"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/joho/godotenv"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"syscall"
|
||||
@@ -183,3 +186,27 @@ func Restart() {
|
||||
}()
|
||||
return
|
||||
}
|
||||
|
||||
func GetVersion() (map[string]string, error) {
|
||||
version := "v1.0.4"
|
||||
update := "0"
|
||||
newVersionObj, err := http.Get("https://download.allinssl.com/version.json")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to fetch version: %v", err)
|
||||
}
|
||||
defer newVersionObj.Body.Close()
|
||||
|
||||
var newVersionData map[string]string
|
||||
body, _ := io.ReadAll(newVersionObj.Body)
|
||||
err = json.Unmarshal(body, &newVersionData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse version data: %v", err)
|
||||
}
|
||||
if version != newVersionData["version"] {
|
||||
update = "1"
|
||||
}
|
||||
newVersionData["new_version"] = newVersionData["version"]
|
||||
newVersionData["version"] = version
|
||||
newVersionData["update"] = update
|
||||
return newVersionData, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user