mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 21:53:28 +00:00
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:
@@ -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),
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user