forked from ProjectSegfault/publapi
fix number of users online counter
This commit is contained in:
parent
80ee0ad38e
commit
c0554fe765
@ -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
|
||||||
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()
|
users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output()
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
log.Error(err2)
|
log.Error(err2)
|
||||||
|
Loading…
Reference in New Issue
Block a user