test status

master
Bel LaPointe 2023-03-27 06:51:15 -06:00
parent 88a78c489f
commit 45b873f462
1 changed files with 6 additions and 3 deletions

View File

@ -182,13 +182,16 @@ func (v01 *V01) serveGMStatus(w http.ResponseWriter, r *http.Request) {
log.Printf("status with %+v", v01.cfg)
users := map[string]interface{}{}
for k, v := range v01.cfg.Users {
v2 := map[string]interface{}{
"Last Activity": time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond))),
"Lag": time.Duration(v.LastLag) / time.Millisecond,
v2 := map[string]interface{}{}
if v.LastLag > 0 {
v2["Lag"] = time.Duration(v.LastLag) / time.Millisecond
}
if v.Player > 0 {
v2["Player"] = v.Player
}
if v.LastTSMS > 0 {
v2["Last Activity"] = time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond)))
}
users[k] = v2
}
yaml.NewEncoder(w).Encode(map[string]interface{}{