Fixes room list, adds OpenGraph so link previews look good
This commit is contained in:
parent
8b9a434be3
commit
c87654ed7c
|
|
@ -3,6 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<meta property="og:title" content="Y.A.R.N HTML5" />
|
||||||
|
<meta property="og:description" content="A collaborative story-writing game. Remake of the 2000s GameSpy Arcade classic." />
|
||||||
<title>Y.A.R.N. 2026</title>
|
<title>Y.A.R.N. 2026</title>
|
||||||
|
|
||||||
<!-- re-use the same CSS-variables and base look -->
|
<!-- re-use the same CSS-variables and base look -->
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,14 @@ app.get('/', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, 'public', 'menu.html'));
|
res.sendFile(path.join(__dirname, 'public', 'menu.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/api/rooms', (req, res) => {
|
||||||
|
const roomList = Object.keys(games).map(name => ({
|
||||||
|
name,
|
||||||
|
playerCount: games[name].players.length
|
||||||
|
}));
|
||||||
|
res.json({ rooms: roomList });
|
||||||
|
});
|
||||||
|
|
||||||
// Socket.IO connection handling
|
// Socket.IO connection handling
|
||||||
io.on('connection', (socket) => {
|
io.on('connection', (socket) => {
|
||||||
let currentRoom = null;
|
let currentRoom = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue