minor backend tweaks
This commit is contained in:
parent
e1026aeb69
commit
ce73637776
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "openterminal",
|
"name": "openterminal",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "openterminal",
|
"name": "openterminal",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ws": "^8.17.1"
|
"ws": "^8.17.1"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./server/main.js",
|
"main": "./server/main.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./server/main.js",
|
"start": "node ./server/main.js",
|
||||||
"dev": "nodemon ./server/main.js"
|
"dev": "nodemon ./server/main.js"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const fs = require('fs');
|
import fs from 'fs';
|
||||||
const http = require('http');
|
import http from 'http';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
const Websocket = require('ws');
|
import WebSocket from 'ws';
|
||||||
|
|
||||||
const VERSION = "1.1.0";
|
const VERSION = "1.1.0";
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ function get_real_address(req) {
|
||||||
return req.connection.remoteAddress;
|
return req.connection.remoteAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wss = new Websocket.Server({ server });
|
const wss = new WebSocket.Server({ server });
|
||||||
wss.on('connection', (socket, req) => {
|
wss.on('connection', (socket, req) => {
|
||||||
console.log(`${new Date().toISOString()} - WS OPEN - ${get_real_address(req)} (active connections: ${sockets.length + 1})`);
|
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, () => {
|
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(", ")}`);
|
if (TRUSTED_PROXIES.length > 0) console.log(`Using X-Forwarded-For headers for hosts: ${TRUSTED_PROXIES.join(", ")}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue