struct
parent
45b873f462
commit
1842023224
|
|
@ -179,18 +179,17 @@ func (v01 *V01) serveGM(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func (v01 *V01) serveGMStatus(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("status with %+v", v01.cfg)
|
||||
users := map[string]interface{}{}
|
||||
users := map[string]struct {
|
||||
Lag time.Duration `yaml:"lag,omitempty"`
|
||||
Player int `yaml:"player,omitempty"`
|
||||
IdleFor time.Duration `yaml:"last_activity,omitempty"`
|
||||
}{}
|
||||
for k, v := range v01.cfg.Users {
|
||||
v2 := map[string]interface{}{}
|
||||
if v.LastLag > 0 {
|
||||
v2["Lag"] = time.Duration(v.LastLag) / time.Millisecond
|
||||
}
|
||||
if v.Player > 0 {
|
||||
v2["Player"] = v.Player
|
||||
}
|
||||
v2 := users[k]
|
||||
v2.Lag = time.Duration(v.LastLag) / time.Millisecond
|
||||
v2.Player = v.Player
|
||||
if v.LastTSMS > 0 {
|
||||
v2["Last Activity"] = time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond)))
|
||||
v2.IdleFor = time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond)))
|
||||
}
|
||||
users[k] = v2
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue