fix number of users online counter

This commit is contained in:
Arya 2023-01-21 17:13:29 +05:30
parent 80ee0ad38e
commit c0554fe765
Signed by: arya
GPG Key ID: 842D12BDA50DF120

View File

@ -89,9 +89,15 @@ func UsersPage(c *fiber.Ctx) error {
} }
usersonlinestr := string(usersonline) usersonlinestr := string(usersonline)
usersonlinededup := utils.Dedup(usersonlinestr) usersonlinededup := utils.Dedup(usersonlinestr)
outputa := int(strings.Count(usersonlinededup, " "))
var output int var output int
if strings.Contains(usersonlinededup, " ") {
outputa := int(strings.Count(usersonlinededup, " "))
output = outputa + 1 output = outputa + 1
} else if usersonlinededup == "" {
output = 0
} else {
output = 1
}
users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output() users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output()
if err2 != nil { if err2 != nil {
log.Error(err2) log.Error(err2)