refactor: replace upgrader with version package for runtime and release information

This commit is contained in:
Jacky 2025-04-21 08:06:27 +00:00
parent 8e212ae79b
commit d0cf93d5e3
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
11 changed files with 182 additions and 121 deletions

View file

@ -3,8 +3,7 @@ package cluster
import (
"net/http"
analytic2 "github.com/0xJacky/Nginx-UI/internal/analytic"
"github.com/0xJacky/Nginx-UI/internal/upgrader"
"github.com/0xJacky/Nginx-UI/internal/analytic"
"github.com/0xJacky/Nginx-UI/internal/version"
"github.com/dustin/go-humanize"
"github.com/gin-gonic/gin"
@ -21,17 +20,17 @@ func GetCurrentNode(c *gin.Context) {
return
}
runtimeInfo, err := upgrader.GetRuntimeInfo()
runtimeInfo, err := version.GetRuntimeInfo()
if err != nil {
cosy.ErrHandler(c, err)
return
}
cpuInfo, _ := cpu.Info()
memory, _ := analytic2.GetMemoryStat()
memory, _ := analytic.GetMemoryStat()
ver := version.GetVersionInfo()
diskUsage, _ := disk.Usage(".")
nodeInfo := analytic2.NodeInfo{
nodeInfo := analytic.NodeInfo{
NodeRuntimeInfo: runtimeInfo,
CPUNum: len(cpuInfo),
MemoryTotal: memory.Total,
@ -39,9 +38,9 @@ func GetCurrentNode(c *gin.Context) {
Version: ver.Version,
}
stat := analytic2.GetNodeStat()
stat := analytic.GetNodeStat()
c.JSON(http.StatusOK, analytic2.Node{
c.JSON(http.StatusOK, analytic.Node{
NodeInfo: nodeInfo,
NodeStat: stat,
})