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 untrusted user: arya
GPG Key ID: 842D12BDA50DF120
1 changed files with 8 additions and 2 deletions

View File

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