diff --git a/Schermata.png b/Schermata.png new file mode 100644 index 0000000..9d71ab6 Binary files /dev/null and b/Schermata.png differ diff --git a/index.html b/index.html index c19d545..526e0fe 100644 --- a/index.html +++ b/index.html @@ -1,146 +1,115 @@ - - + + + Windjammers Arcade -
+
+
P1: 0
SET 1
CPU: 0
-
P1: W/A/S/D
- +
P1: W/A/S/D + F G H
+
diff --git a/server.js b/server.js new file mode 100644 index 0000000..c7945d6 --- /dev/null +++ b/server.js @@ -0,0 +1,41 @@ +const http = require('http'); +const fs = require('fs'); +const path = require('path'); + +const PORT = 8090; +const ROOT = '/home/codex/giochino'; + +const MIME = { + '.html': 'text/html', + '.js': 'application/javascript', + '.css': 'text/css', + '.png': 'image/png', + '.jpg': 'image/jpeg', + '.svg': 'image/svg+xml', + '.json': 'application/json' +}; + +const server = http.createServer((req, res) => { + let filePath = path.join(ROOT, req.url === '/' ? 'index.html' : req.url); + const ext = path.extname(filePath); + const contentType = MIME[ext] || 'application/octet-stream'; + + fs.readFile(filePath, (err, data) => { + if (err) { + res.writeHead(404, {'Content-Type': 'text/plain'}); + res.end('404 Not Found: ' + req.url); + return; + } + res.writeHead(200, {'Content-Type': contentType}); + res.end(data); + }); +}); + +server.listen(PORT, '0.0.0.0', () => { + console.log(`Server attivo su http://0.0.0.0:${PORT}/`); + console.log(`Cartella: ${ROOT}`); +}); + +server.on('error', (err) => { + console.error('Errore server:', err.message); +}); diff --git a/server2.js b/server2.js new file mode 100644 index 0000000..b8871dc --- /dev/null +++ b/server2.js @@ -0,0 +1,20 @@ +const http = require('http'); +const fs = require('fs'); +const path = require('path'); + +const PORT = 8091; +const ROOT = '/home/codex/giochino'; + +const MIME = { '.html': 'text/html', '.js': 'application/javascript', '.css': 'text/css', '.png': 'image/png' }; + +const server = http.createServer((req, res) => { + let filePath = path.join(ROOT, req.url === '/' ? 'index.html' : req.url); + const ext = path.extname(filePath); + fs.readFile(filePath, (err, data) => { + if (err) { res.writeHead(404); res.end('404'); return; } + res.writeHead(200, { 'Content-Type': MIME[ext] || 'text/plain' }); + res.end(data); + }); +}); + +server.listen(PORT, '0.0.0.0', () => console.log(`Server: http://0.0.0.0:${PORT}/`)); diff --git a/validate.py b/validate.py new file mode 100644 index 0000000..401e8c1 --- /dev/null +++ b/validate.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python3 +""" +Debug & Validation per il gioco Windjammers +Verifica: sintassi JS, struttura HTML, funzioni critiche, errori comuni +""" + +import re +import sys +import json + +def extract_js(html_path): + """Estrae il JavaScript dall'HTML""" + with open(html_path, 'r') as f: + html = f.read() + match = re.search(r'', html, re.DOTALL) + if not match: + return None, "Nessun tag