Send system data with admin request

This commit is contained in:
Sirz Benjie 2025-09-26 13:44:51 -05:00
parent ef409fde2a
commit a0346b5cce
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
2 changed files with 13 additions and 5 deletions

View File

@ -938,6 +938,13 @@ func handleAdminSearch(w http.ResponseWriter, r *http.Request) {
httpError(w, r, err, http.StatusInternalServerError)
return
}
uuid, err = db.Store.FetchUUIDFromUsername(username)
if err == nil {
systemData, err := savedata.GetSystem(db.Store, uuid)
if err == nil {
adminSearchResult.SystemData = &systemData
}
}
writeJSON(w, r, adminSearchResult)
log.Printf("%s: %s searched for username %s", userDiscordId, r.URL.Path, username)

View File

@ -204,6 +204,7 @@ type AdminSearchResponse struct {
GoogleId string `json:"googleId"`
LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly
Registered string `json:"registered"`
SystemData *defs.SystemSaveData `json:"systemData,omitzero"`
}
func (s *store) FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) {