Playtime from PlaytimeHistory's database (SAW_PT_DSN)
A public Playtime tab and player-drawer playtime, and staff-only figures (who's on, staff activity, disconnect reasons, countries, names, sessions) for @css/generic on the staff panel and on the public site when signed in. Hidden unless SAW_PT_DSN is set and its tables are there.
This commit is contained in:
parent
daa7ec2dbc
commit
6d0fc6e463
18 changed files with 2238 additions and 12 deletions
|
|
@ -292,8 +292,18 @@ func (s *Server) publicPlayer(w http.ResponseWriter, r *http.Request) {
|
|||
_, online := s.poll.Current().Find(steamid)
|
||||
// Only whether they're verified: why, and overrides' expiry and who gave them, are for staff.
|
||||
st, verified := s.verifiedSet(r.Context(), []string{steamid})[steamid]
|
||||
writeJSON(w, http.StatusOK, map[string]any{
|
||||
resp := map[string]any{
|
||||
"steamid": steamid, "name": d.Name, "online": online, "rank": s.rankOf(x, steamid),
|
||||
"verified": verified && st.Verified(), "bans": toPublic(bans), "comms": toPublic(comms),
|
||||
})
|
||||
}
|
||||
// Signed-in staff get the staff playtime figures here too, as on the staff panel.
|
||||
id, _, err := s.identity(r)
|
||||
if err != nil {
|
||||
internal(w, r, err)
|
||||
return
|
||||
}
|
||||
if pt := s.playerPlaytime(r, steamid, s.ptStaff(r.Context(), id)); pt != nil {
|
||||
resp["playtime"] = pt
|
||||
}
|
||||
writeJSON(w, http.StatusOK, resp)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue