have private lobby show players

This commit is contained in:
evanpelle
2024-12-24 11:47:11 -08:00
parent db4842f938
commit 44d6962b88
4 changed files with 44 additions and 3 deletions
+14
View File
@@ -98,6 +98,20 @@ app.get('/lobby/:id/exists', (req, res) => {
});
});
app.get('/lobby/:id', (req, res) => {
const game = gm.game(req.params.id)
if (game == null) {
console.log(`lobby ${req.params.id} not found`)
return res.status(404).json({ error: 'Game not found' });
}
res.json({
players: game.activeClients.map(c => ({
username: c.username,
clientID: c.clientID
}))
});
});
app.get('/private_lobby/:id', (req, res) => {
res.json({