feat: add group

This commit is contained in:
2024-11-16 23:50:34 +07:00
parent b88b04a235
commit c8e61ed4aa
24 changed files with 534 additions and 86 deletions
+7 -1
View File
@@ -149,7 +149,13 @@ func getDiskUsage(client *lib.SSHClient, wg *sync.WaitGroup, result chan<- strin
return
}
fields := strings.Fields(lines[1])
fields := strings.Fields(lines[len(lines)-2])
if len(fields) < 5 {
return
}
if !strings.HasPrefix(fields[0], "/") {
fields = append([]string{"/"}, fields...)
}
result <- fmt.Sprintf("\x03%s,%s,%s", fields[1], fields[2], fields[4])
}
+1 -1
View File
@@ -13,7 +13,7 @@ func HandleStats(c *websocket.Conn) {
user := utils.GetUserWs(c)
hostRepo := hosts.NewRepository(&hosts.Hosts{User: user})
data, _ := hostRepo.Get(hostId)
data, _ := hostRepo.GetWithKeys(hostId)
if data == nil || !data.HasAccess(&user.User) {
c.WriteMessage(websocket.TextMessage, []byte("Host not found"))