commit 2d4c3864ef0a5881b52dc78bce672630eac750cd Author: Nicola Date: Wed Jun 24 13:00:51 2026 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c42d01 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +.env +*.log +.DS_Store +Thumbs.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..4ede3d0 --- /dev/null +++ b/README.md @@ -0,0 +1,161 @@ +# ๐ŸŽพ Tennis Roots + +Overlay per streaming tennis (OBS) con controller remoto via WebSocket. + +## Architettura + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” WebSocket โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ Controller (admin) โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ”‚ โ”‚ +โ”‚ /controller/ โ”‚โ†โ”€โ”€ STATE_UPDATE โ”€โ”€โ”€โ”‚ Express + WebSocket โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ Server (hub) โ”‚ + โ”‚ Port 3000 โ”‚ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” WebSocket โ”‚ โ”‚ +โ”‚ Scoreboard (OBS) โ”‚โ†โ”€โ”€ STATE_UPDATE โ”€โ”€โ”€โ”‚ โ”‚ +โ”‚ Match Info (OBS) โ”‚โ†โ”€โ”€ STATE_UPDATE โ”€โ”€โ”€โ”‚ โ”‚ +โ”‚ Clock (OBS) โ”‚โ†โ”€โ”€ STATE_UPDATE โ”€โ”€โ”€โ”‚ โ”‚ +โ”‚ Server Ind. (OBS) โ”‚โ†โ”€โ”€ STATE_UPDATE โ”€โ”€โ”€โ”‚ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +## Quick Start + +```bash +# Clona / entra nel progetto +cd tennis-roots + +# Avvia tutto con uno script +chmod +x start.sh +./start.sh +``` + +Oppure manualmente: + +```bash +cd server +npm install +npm start +``` + +Apri nel browser: +- **Controller**: http://localhost:3000/ +- **Scoreboard**: http://localhost:3000/overlay/scoreboard.html +- **Match info**: http://localhost:3000/overlay/match-info.html +- **Clock**: http://localhost:3000/overlay/clock.html +- **Server indicator**: http://localhost:3000/overlay/server-indicator.html + +## Widget Overlay (per OBS) + +Ogni widget รจ un file HTML indipendente, dimensionabile e posizionabile +liberamente in OBS come **Browser Source**. + +| Widget | URL | Dimensioni suggerite | +|--------|-----|---------------------| +| **Scoreboard** | `/overlay/scoreboard.html` | 820ร—130 px | +| **Match Info** | `/overlay/match-info.html` | 600ร—50 px | +| **Clock** | `/overlay/clock.html` | 150ร—50 px | +| **Server Indicator** | `/overlay/server-indicator.html` | 250ร—50 px | + +### Setup in OBS + +1. Aggiungi **Browser Source** +2. Inserisci URL del widget (es. `http://localhost:3000/overlay/scoreboard.html`) +3. Imposta larghezza/altezza come da tabella +4. **Importante**: spunta "Controlla audio/visibilitร  del browser nella sorgente" +5. Usa filtri di ritaglio/posizionamento per sistemare l'overlay + +## Controller + +Il pannello di controllo admin รจ accessibile a `/controller/`. + +### Sezioni + +- **Stato corrente**: live view del match +- **Punteggio**: pulsanti punto P1/P2, Deuce, Reset Game/Match +- **Servizio**: cambio battuta manuale +- **Giocatori**: modifica nomi e bandiere +- **Info Match**: torneo e round + +### Scorciatoie da tastiera + +| Tasto | Azione | +|-------|--------| +| `1` | Punto P1 | +| `2` | Punto P2 | +| `D` | Deuce | +| `R` | Reset Game | +| `M` | Reset Match | + +## API HTTP + +```bash +# Stato corrente +curl http://localhost:3000/api/state + +# Aggiornamento parziale +curl -X POST http://localhost:3000/api/state \ + -H 'Content-Type: application/json' \ + -d '{"player1":"N. Djokovic","tournament":"US Open"}' + +# Comando +curl -X POST http://localhost:3000/api/command \ + -H 'Content-Type: application/json' \ + -d '{"command":"ADD_POINT","player":1}' +``` + +## WebSocket + +I widget si connettono automaticamente a `ws://localhost:3000/ws`. +Il server propaga gli aggiornamenti a tutti i client connessi. + +### Formato messaggi + +**Da controller a server:** +```json +{ "type": "COMMAND", "command": "ADD_POINT", "player": 1 } +{ "type": "COMMAND", "command": "SET_DEUCE" } +{ "type": "COMMAND", "command": "RESET_GAME" } +{ "type": "COMMAND", "command": "RESET_MATCH" } +{ "type": "COMMAND", "command": "SET_SERVER", "player": 2 } +{ "type": "STATE_UPDATE", "state": { "player1": "...", ... } } +``` + +**Da server a tutti:** +```json +{ "type": "STATE_UPDATE", "state": { ... } } +``` + +## Sviluppo + +```bash +cd server +npm run dev # node --watch +``` + +## Regole punteggio implementate + +- Punti game: 0, 15, 30, 40, Deuce, Vantaggio +- Set: primo a 6 game con 2 di scarto +- **Tiebreak**: a 6-6, primi a 7 punti con 2 di scarto +- Servizio nel tiebreak: punto 1 โ†’ P1, punto 2 โ†’ P2, poi cambio ogni 2 punti +- Match: al meglio dei 3 set + +## Struttura file + +``` +tennis-roots/ +โ”œโ”€โ”€ server/ +โ”‚ โ”œโ”€โ”€ package.json +โ”‚ โ”œโ”€โ”€ index.js # Server Express + WebSocket +โ”‚ โ””โ”€โ”€ node_modules/ +โ”œโ”€โ”€ overlay/ +โ”‚ โ”œโ”€โ”€ common.js # Client WebSocket condiviso +โ”‚ โ”œโ”€โ”€ scoreboard.html +โ”‚ โ”œโ”€โ”€ match-info.html +โ”‚ โ”œโ”€โ”€ clock.html +โ”‚ โ””โ”€โ”€ server-indicator.html +โ”œโ”€โ”€ controller/ +โ”‚ โ””โ”€โ”€ index.html # Pannello di controllo +โ”œโ”€โ”€ start.sh # Script avvio rapido +โ””โ”€โ”€ README.md +``` diff --git a/controller/index.html b/controller/index.html new file mode 100644 index 0000000..48d7013 --- /dev/null +++ b/controller/index.html @@ -0,0 +1,539 @@ + + + + + + ๐ŸŽพ Tennis Roots โ€“ Controller + + + + +
+ + Disconnesso +
+ +

+ ๐ŸŽพ Tennis Roots + Controller +

+ +
+ + +
+

๐Ÿ“Š Stato corrente

+
+
+
+ P1 + + 0 +
+ VS +
+ P2 + + 0 +
+
+
+ + In attesa... +
+
+ + +
+

๐ŸŽพ Punteggio

+
+ + +
+
+ + +
+
+ +
+
+ + +
+

๐ŸŽพ Servizio

+
+ + + +
+
+ + +
+

๐Ÿ‘ค Giocatori

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+

๐Ÿ“‹ Info Match

+
+ + +
+
+ + +
+
+ +
+
+ + +
+

โŒจ๏ธ Scorciatoie

+
+ 1 Punto P1   + 2 Punto P2   + D Deuce   + R Reset Game   + M Reset Match +
+
+ +
+ + + + diff --git a/overlay/clock.html b/overlay/clock.html new file mode 100644 index 0000000..fcd738a --- /dev/null +++ b/overlay/clock.html @@ -0,0 +1,62 @@ + + + + + + Clock + + + +
+
00:00:00
+
+ + + + diff --git a/overlay/common.js b/overlay/common.js new file mode 100644 index 0000000..ec4d6ed --- /dev/null +++ b/overlay/common.js @@ -0,0 +1,131 @@ +/** + * common.js โ€“ Stato condiviso tra i widget overlay via WebSocket + * + * Ogni widget si connette al server Express+WS e ascolta gli aggiornamenti. + * Il pannello di controllo invia comandi/aggiornamenti, il server li + * propaga a tutti i widget connessi. + */ + +// ---- Config ---- +const WS_URL = (() => { + const loc = window.location; + const protocol = loc.protocol === 'https:' ? 'wss:' : 'ws:'; + return `${protocol}//${loc.host}/ws`; +})(); + +let ws = null; +let currentState = {}; +let subscribers = []; +let reconnectTimer = null; +let connectAttempts = 0; + +// ---- WebSocket connection ---- +function connect() { + if (ws && (ws.readyState === 0 || ws.readyState === 1)) return; + + ws = new WebSocket(WS_URL); + + ws.onopen = () => { + console.log('๐ŸŸข WS connected'); + connectAttempts = 0; + }; + + ws.onmessage = (event) => { + try { + const msg = JSON.parse(event.data); + if (msg.type === 'STATE_UPDATE' && msg.state) { + currentState = msg.state; + notifySubscribers(); + } + } catch (err) { + console.error('โŒ WS message error:', err); + } + }; + + ws.onclose = () => { + console.log('๐Ÿ”ด WS disconnected, reconnecting...'); + scheduleReconnect(); + }; + + ws.onerror = (err) => { + console.error('โŒ WS error:', err); + ws.close(); + }; +} + +function scheduleReconnect() { + if (reconnectTimer) clearTimeout(reconnectTimer); + const delay = Math.min(1000 * 2 ** connectAttempts, 10000); + connectAttempts++; + reconnectTimer = setTimeout(connect, delay); +} + +// ---- Subscribe to state updates ---- +/** + * Si iscrive agli aggiornamenti di stato. + * @param {(state: object) => void} callback + * @returns {() => void} unsubscribe function + */ +function onStateUpdate(callback) { + subscribers.push(callback); + // Chiamata immediata con stato corrente (se giร  presente) + if (Object.keys(currentState).length > 0) { + callback({ ...currentState }); + } + return () => { + subscribers = subscribers.filter((cb) => cb !== callback); + }; +} + +function notifySubscribers() { + const state = { ...currentState }; + for (const cb of subscribers) { + try { cb(state); } catch (e) { console.error(e); } + } +} + +/** + * Invia un comando al server (ADD_POINT, RESET_GAME, RESET_MATCH, SET_DEUCE, SET_SERVER) + */ +function sendCommand(command, player = null) { + const msg = { type: 'COMMAND', command }; + if (player !== null) msg.player = player; + sendMessage(msg); +} + +/** + * Invia un aggiornamento parziale di stato al server + */ +function sendStateUpdate(partial) { + sendMessage({ type: 'STATE_UPDATE', state: partial }); +} + +function sendMessage(msg) { + if (ws && ws.readyState === 1) { + ws.send(JSON.stringify(msg)); + } else { + console.warn('โš ๏ธ WS not connected, cannot send'); + } +} + +/** + * Utility: mappa punti โ†’ label tennis + */ +function pointLabel(state) { + // Tiebreak: mostra punti numerici + if (state.tiebreak) { + return [String(state.tiebreakPoints[0]), String(state.tiebreakPoints[1])]; + } + const p1 = state.points[0]; + const p2 = state.points[1]; + if (state.deuce) { + if (state.advantage === 1) return ['AD', '40']; + if (state.advantage === 2) return ['40', 'AD']; + return ['40', '40']; + } + const map = ['0', '15', '30', '40']; + return [map[p1] || '40', map[p2] || '40']; +} + +// ---- Auto-connect ---- +connect(); diff --git a/overlay/match-info.html b/overlay/match-info.html new file mode 100644 index 0000000..3157776 --- /dev/null +++ b/overlay/match-info.html @@ -0,0 +1,105 @@ + + + + + + Match Info + + + +
+
+ ๐ŸŽพ Wimbledon + + Finale ยท Uomini ยท Singolare + + ๐ŸŽพ In corso ยท Set 1 +
+
+ + + + + diff --git a/overlay/scoreboard.html b/overlay/scoreboard.html new file mode 100644 index 0000000..51cb62a --- /dev/null +++ b/overlay/scoreboard.html @@ -0,0 +1,254 @@ + + + + + + Scoreboard + + + +
+
+
+ Giocatore + S1 + S2 + S3 + Punti +
+
+
+ + J. Sinner +
+ 0 + 0 + 0 + 0 +
+
+
+ + C. Alcaraz +
+ 0 + 0 + 0 + 0 +
+
+
+ + + + + diff --git a/overlay/server-indicator.html b/overlay/server-indicator.html new file mode 100644 index 0000000..6a1fc4b --- /dev/null +++ b/overlay/server-indicator.html @@ -0,0 +1,87 @@ + + + + + + Server Indicator + + + +
+
+ + Serve: + J. Sinner +
+
+ + + + + diff --git a/server/index.js b/server/index.js new file mode 100644 index 0000000..bd75ce1 --- /dev/null +++ b/server/index.js @@ -0,0 +1,348 @@ +/** + * Tennis Roots โ€“ Server Express + WebSocket + * + * Funge da hub centrale: + * - Serve gli overlay (statici) + * - Serve il pannello di controllo (statico) + * - Gestisce le connessioni WebSocket per lo stato in tempo reale + */ + +import express from 'express'; +import { createServer } from 'http'; +import { WebSocketServer } from 'ws'; +import { resolve, dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const PORT = process.env.PORT || 3000; + +// ---- Stato di default ---- +const defaultState = { + player1: 'J. Sinner', + player2: 'C. Alcaraz', + flag1: 'it', + flag2: 'es', + sets: [ + [0, 0], + [0, 0], + [0, 0], + ], + games: [0, 0], + points: [0, 0], + server: 1, + currentSet: 0, + matchOver: false, + deuce: false, + advantage: 0, + tiebreak: false, + tiebreakPoints: [0, 0], + tiebreakFirstServer: 1, + tournament: 'Wimbledon', + round: 'Finale ยท Uomini ยท Singolare', + matchStatus: '๐ŸŽพ In corso ยท Set 1', +}; + +let currentState = { ...defaultState }; + +// ---- Utility punteggio tennis ---- +function computeMatchStatus(state) { + if (state.matchOver) { + const p1Sets = state.sets.reduce((a, s) => a + (s[0] > s[1] ? 1 : 0), 0); + const winner = p1Sets >= 2 ? state.player1 : state.player2; + return `๐Ÿ† ${winner} vince!`; + } + const set = state.currentSet + 1; + if (state.tiebreak) { + return `๐ŸŽพ Tiebreak ยท Set ${set} ยท ${state.tiebreakPoints[0]}-${state.tiebreakPoints[1]}`; + } + return `๐ŸŽพ In corso ยท Set ${set}`; +} + +function pointLabel(state) { + // Tiebreak: mostra punti numerici + if (state.tiebreak) { + return [String(state.tiebreakPoints[0]), String(state.tiebreakPoints[1])]; + } + const p1 = state.points[0]; + const p2 = state.points[1]; + if (state.deuce) { + if (state.advantage === 1) return ['AD', '40']; + if (state.advantage === 2) return ['40', 'AD']; + return ['40', '40']; + } + const map = ['0', '15', '30', '40']; + return [map[p1] || '40', map[p2] || '40']; +} + +// ---- Express ---- +const app = express(); +const server = createServer(app); + +// Static files: overlay +app.use('/overlay', express.static(resolve(__dirname, '..', 'overlay'))); + +// Static files: controller +app.use('/controller', express.static(resolve(__dirname, '..', 'controller'))); + +// Redirect root โ†’ controller +app.get('/', (req, res) => { + res.redirect('/controller/'); +}); + +// API: GET stato corrente +app.get('/api/state', (req, res) => { + res.json(currentState); +}); + +// API: POST aggiornamento stato (da controller via HTTP) +app.post('/api/state', express.json(), (req, res) => { + const partial = req.body; + currentState = { ...currentState, ...partial, matchStatus: undefined }; + currentState.matchStatus = computeMatchStatus(currentState); + currentState.timestamp = Date.now(); + broadcast({ type: 'STATE_UPDATE', state: currentState }); + res.json({ ok: true, state: currentState }); +}); + +// API: POST comando (ADD_POINT, RESET_GAME, RESET_MATCH) +app.post('/api/command', express.json(), (req, res) => { + const { command, player } = req.body; + handleCommand(command, player); + res.json({ ok: true, state: currentState }); +}); + +// ---- WebSocket ---- +const wss = new WebSocketServer({ server, path: '/ws' }); + +wss.on('connection', (ws) => { + console.log('๐ŸŸข WebSocket client connected'); + + // Invia stato corrente al nuovo client + ws.send(JSON.stringify({ type: 'STATE_UPDATE', state: currentState })); + + ws.on('message', (data) => { + try { + const msg = JSON.parse(data.toString()); + + if (msg.type === 'COMMAND') { + handleCommand(msg.command, msg.player); + return; + } + + if (msg.type === 'STATE_UPDATE') { + currentState = { ...currentState, ...msg.state, matchStatus: undefined }; + currentState.matchStatus = computeMatchStatus(currentState); + currentState.timestamp = Date.now(); + broadcast({ type: 'STATE_UPDATE', state: currentState }, ws); + return; + } + } catch (err) { + console.error('โŒ Invalid message:', err.message); + } + }); + + ws.on('close', () => { + console.log('๐Ÿ”ด WebSocket client disconnected'); + }); +}); + +function broadcast(message, exclude = null) { + const payload = JSON.stringify(message); + for (const client of wss.clients) { + if (client !== exclude && client.readyState === 1) { + client.send(payload); + } + } +} + +// ---- Comandi ---- +function handleCommand(command, player) { + switch (command) { + case 'ADD_POINT': + addPoint(player); + break; + case 'RESET_GAME': + currentState.points = [0, 0]; + currentState.deuce = false; + currentState.advantage = 0; + currentState.tiebreak = false; + currentState.tiebreakPoints = [0, 0]; + currentState.tiebreakFirstServer = 1; + break; + case 'RESET_MATCH': + currentState = { ...defaultState, timestamp: Date.now() }; + break; + case 'SET_DEUCE': + currentState.deuce = true; + currentState.advantage = 0; + currentState.points = [3, 3]; + break; + case 'SET_SERVER': + currentState.server = player; // player = 1 o 2 + break; + default: + return; + } + currentState.matchStatus = computeMatchStatus(currentState); + currentState.timestamp = Date.now(); + broadcast({ type: 'STATE_UPDATE', state: currentState }); +} + +function addPoint(player) { + const idx = player - 1; + + if (currentState.matchOver) return; + + // ---- TIEBREAK ---- + if (currentState.tiebreak) { + currentState.tiebreakPoints[idx]++; + const tp1 = currentState.tiebreakPoints[0]; + const tp2 = currentState.tiebreakPoints[1]; + + // Aggiorna server per il punto successivo nel tiebreak + updateTiebreakServer(currentState); + + // Vinta se โ‰ฅ7 punti e 2 di scarto + if ((tp1 >= 7 || tp2 >= 7) && Math.abs(tp1 - tp2) >= 2) { + // Ha vinto il tiebreak โ†’ set 7-6 + const won = tp1 > tp2 ? 0 : 1; + currentState.sets[currentState.currentSet][won] = 7; + currentState.sets[currentState.currentSet][1 - won] = 6; + currentState.tiebreak = false; + currentState.tiebreakPoints = [0, 0]; + currentState.games = [0, 0]; + + // Controlla match vinto + let p1Sets = 0, p2Sets = 0; + for (let i = 0; i < 3; i++) { + if (currentState.sets[i][0] > currentState.sets[i][1]) p1Sets++; + else if (currentState.sets[i][1] > currentState.sets[i][0]) p2Sets++; + } + if (p1Sets >= 2 || p2Sets >= 2) { + currentState.matchOver = true; + } else { + currentState.currentSet++; + } + + currentState.server = currentState.server === 1 ? 2 : 1; + } + return; + } + + // ---- GIOCO NORMALE ---- + if (currentState.deuce) { + if (currentState.advantage === player) { + currentState.points = [0, 0]; + currentState.deuce = false; + currentState.advantage = 0; + addGame(player); + } else if (currentState.advantage === 0) { + currentState.advantage = player; + } else { + currentState.advantage = 0; + } + return; + } + + currentState.points[idx]++; + const p1 = currentState.points[0]; + const p2 = currentState.points[1]; + + if (p1 >= 3 && p2 >= 3 && p1 === p2) { + currentState.deuce = true; + currentState.advantage = 0; + return; + } + + if ((p1 >= 4 || p2 >= 4) && Math.abs(p1 - p2) >= 2) { + currentState.points = [0, 0]; + addGame(player); + return; + } +} + +function addGame(player) { + const idx = player - 1; + currentState.games[idx]++; + const [g1, g2] = currentState.games; + const set = currentState.currentSet; + + // 6-6 โ†’ si entra in tiebreak + if (g1 === 6 && g2 === 6) { + currentState.tiebreak = true; + currentState.tiebreakPoints = [0, 0]; + currentState.points = [0, 0]; + currentState.deuce = false; + currentState.advantage = 0; + // Il primo a servire nel tiebreak รจ il giocatore che NON ha servito l'ultimo game + currentState.tiebreakFirstServer = currentState.server === 1 ? 2 : 1; + currentState.server = currentState.tiebreakFirstServer; + return; + } + + if ((g1 >= 6 || g2 >= 6) && Math.abs(g1 - g2) >= 2) { + currentState.sets[set][0] = g1; + currentState.sets[set][1] = g2; + currentState.games = [0, 0]; + + let p1Sets = 0, p2Sets = 0; + for (let i = 0; i < 3; i++) { + if (currentState.sets[i][0] > currentState.sets[i][1]) p1Sets++; + else if (currentState.sets[i][1] > currentState.sets[i][0]) p2Sets++; + } + if (p1Sets >= 2 || p2Sets >= 2) { + currentState.matchOver = true; + } else { + currentState.currentSet++; + } + } else { + currentState.sets[set][0] = g1; + currentState.sets[set][1] = g2; + } + + currentState.server = currentState.server === 1 ? 2 : 1; +} + +/** + * Determina il servitore nel tiebreak. + * Nel tiebreak: + * - Punto 1: servito dal giocatore designato (tiebreakFirstServer) + * - Punto 2: servito dall'altro giocatore + * - Dal punto 3 in poi: cambio servizio ogni 2 punti + */ +function updateTiebreakServer(state) { + const total = state.tiebreakPoints[0] + state.tiebreakPoints[1]; + const first = state.tiebreakFirstServer; + + if (total === 0) { + state.server = first; + } else if (total === 1) { + // Dopo il primo punto, serve l'altro giocatore + state.server = first === 1 ? 2 : 1; + } else { + // Gruppi da 2: alternati + const groupIndex = Math.floor((total - 1) / 2); + if (groupIndex % 2 === 0) { + // Gruppi pari (0, 2, 4...): serve l'altro giocatore + state.server = first === 1 ? 2 : 1; + } else { + // Gruppi dispari (1, 3, 5...): serve il primo giocatore + state.server = first; + } + } +} + +// ---- Avvio ---- +server.listen(PORT, () => { + console.log(` +โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— +โ•‘ ๐ŸŽพ Tennis Roots Server โ•‘ +โ•‘ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•‘ +โ•‘ HTTP : http://localhost:${PORT} โ•‘ +โ•‘ WS : ws://localhost:${PORT}/ws โ•‘ +โ•‘ โ•‘ +โ•‘ Controller : http://localhost:${PORT}/ โ•‘ +โ•‘ Overlay : http://localhost:${PORT}/overlay/ โ•‘ +โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• +`); +}); diff --git a/server/package-lock.json b/server/package-lock.json new file mode 100644 index 0000000..7d1a27a --- /dev/null +++ b/server/package-lock.json @@ -0,0 +1,849 @@ +{ + "name": "tennis-roots-server", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "tennis-roots-server", + "version": "0.1.0", + "dependencies": { + "express": "^4.21.0", + "ws": "^8.18.0" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.20.5", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", + "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.15.1", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", + "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.15.1", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", + "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/server/package.json b/server/package.json new file mode 100644 index 0000000..91f5c8f --- /dev/null +++ b/server/package.json @@ -0,0 +1,14 @@ +{ + "name": "tennis-roots-server", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "start": "node index.js", + "dev": "node --watch index.js" + }, + "dependencies": { + "express": "^4.21.0", + "ws": "^8.18.0" + } +}