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
|
|
@ -182,8 +182,13 @@ type meView struct {
|
|||
Perms []string `json:"perms,omitempty"`
|
||||
Immunity int `json:"immunity,omitempty"`
|
||||
// Verify is true when GroupVerify's tables are in the database, for the Verification page.
|
||||
Verify bool `json:"verify,omitempty"`
|
||||
Site string `json:"site"`
|
||||
Verify bool `json:"verify,omitempty"`
|
||||
// Playtime is "on" once PlaytimeHistory has recorded something, "empty" before that, and
|
||||
// left out when the panel has no playtime database (see playtime.go).
|
||||
Playtime string `json:"playtime,omitempty"`
|
||||
// PlaytimeStaff: this viewer sees the staff-only playtime figures, on either site.
|
||||
PlaytimeStaff bool `json:"playtimeStaff,omitempty"`
|
||||
Site string `json:"site"`
|
||||
}
|
||||
|
||||
func (s *Server) me(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -203,6 +208,8 @@ func (s *Server) me(w http.ResponseWriter, r *http.Request) {
|
|||
if info, err := s.verifyInfo(r.Context()); err == nil {
|
||||
v.Verify = info.Tables
|
||||
}
|
||||
v.PlaytimeStaff = s.ptStaff(r.Context(), id)
|
||||
}
|
||||
v.Playtime = s.ptState(r.Context())
|
||||
writeJSON(w, http.StatusOK, v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue