mirror of
https://github.com/komari-monitor/komari.git
synced 2026-11-20 23:08:46 +00:00
修改 客户端基本属性逻辑。 修改 最新上报key改为uuid 新增 客户端命名 新增 历史记录数据库压缩。 新增 在线节点信息。 新增 公开API /api/nodes 显示客户端基础属性
24 lines
496 B
Go
24 lines
496 B
Go
package api
|
|
|
|
import (
|
|
"github.com/akizon77/komari/database/clients"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func GetNodesInformation(c *gin.Context) {
|
|
clientList, err := clients.GetAllClientBasicInfo()
|
|
if err != nil {
|
|
c.JSON(500, gin.H{"status": "error", "error": err.Error()})
|
|
return
|
|
}
|
|
|
|
count := len(clientList)
|
|
// 公开信息不展示IP地址
|
|
for i := 0; i < count; i++ {
|
|
clientList[i].IPv4 = ""
|
|
clientList[i].IPv6 = ""
|
|
}
|
|
|
|
c.JSON(200, gin.H{"status": "success", "data": clientList})
|
|
}
|