This commit is contained in:
biglyderv 2025-01-15 12:28:57 -05:00
commit 8c889222ce
10 changed files with 4525 additions and 0 deletions

32
index.js Normal file
View file

@ -0,0 +1,32 @@
import express from 'express';
import { Server } from 'socket.io'
import { createServer } from 'http';
import { socketHandler } from './gridwar.js';
const app = express()
const server = createServer(app);
const io = new Server(server);
const port = process.argv[2] || 3069;
app.use((req, res, next) => {
let param = new URL(`https://gw.dervland.net/${req.originalUrl}`).searchParams.get('token');
if (param) {
res.cookie('token', param, {
maxAge: 1000 * 60 * 60 * 24 * 7,
path: '/'
});
}
next();
});
app.use(express.static('./static'));
io.on('connection', (socket) => {
socketHandler(socket, io)
})
server.listen(port, () => {
console.log(`Web server listening on port ${port}`)
})