minor backend tweaks

This commit is contained in:
ari melody 2025-02-01 15:15:14 +00:00
parent e1026aeb69
commit ce73637776
Signed by: ari
GPG key ID: CF99829C92678188
3 changed files with 9 additions and 8 deletions

View file

@ -1,7 +1,7 @@
const fs = require('fs');
const http = require('http');
const path = require('path');
const Websocket = require('ws');
import fs from 'fs';
import http from 'http';
import path from 'path';
import WebSocket from 'ws';
const VERSION = "1.1.0";
@ -136,7 +136,7 @@ function get_real_address(req) {
return req.connection.remoteAddress;
}
const wss = new Websocket.Server({ server });
const wss = new WebSocket.Server({ server });
wss.on('connection', (socket, req) => {
console.log(`${new Date().toISOString()} - WS OPEN - ${get_real_address(req)} (active connections: ${sockets.length + 1})`);
/*
@ -271,7 +271,7 @@ function generate_colour() {
}
server.listen(PORT, HOST, () => {
console.log(`OpenTerminal is now LIVE on http://${HOST === '0.0.0.0' ? '127.0.0.1' : HOST}:${PORT}`);
console.log(`OpenTerminal is now LIVE on http://${HOST}:${PORT}`);
if (TRUSTED_PROXIES.length > 0) console.log(`Using X-Forwarded-For headers for hosts: ${TRUSTED_PROXIES.join(", ")}`);
});