feat: include publicID in admin-bot live stats players (#4404)

## Description:

The live stats endpoint enriches each player with username/connected but
not publicId, so an account-keyed caller (e.g. an admin bot, which knows
players by account, not per-session clientID) can't map a stats row back
to a player directly. Add publicId from the same activeClients source —
mirrors the kick_player targetPublicID path.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory

## Please put your Discord username so you can be contacted if a bug or
regression is found:

zixer._
This commit is contained in:
Zixer1
2026-06-24 21:44:51 -04:00
committed by GitHub
parent 181368f962
commit c8a42d4c33
2 changed files with 34 additions and 8 deletions
+10 -5
View File
@@ -1419,6 +1419,7 @@ export class GameServer {
turn: number;
players: (PlayerLiveStats & {
username: string | null;
publicID: string | null;
connected: boolean;
})[];
} | null {
@@ -1427,11 +1428,15 @@ export class GameServer {
}
return {
turn: this.latestLiveStats.turn,
players: this.latestLiveStats.players.map((p) => ({
...p,
username: this.allClients.get(p.clientID)?.username ?? null,
connected: !this.isClientDisconnected(p.clientID),
})),
players: this.latestLiveStats.players.map((p) => {
const client = this.allClients.get(p.clientID);
return {
...p,
username: client?.username ?? null,
publicID: client?.publicId ?? null,
connected: !this.isClientDisconnected(p.clientID),
};
}),
};
}
}