diff --git a/cvmts/src/AuthManager.ts b/cvmts/src/AuthManager.ts index 081390b..de8217b 100644 --- a/cvmts/src/AuthManager.ts +++ b/cvmts/src/AuthManager.ts @@ -26,13 +26,11 @@ export default class AuthManager { }); // Make sure the fetch returned okay - if(!response.ok) - throw new Error(`Failed to query quth server: ${response.statusText}`) + if (!response.ok) throw new Error(`Failed to query quth server: ${response.statusText}`); let json = (await response.json()) as JoinResponse; - if (!json.success) - throw new Error(json.error); + if (!json.success) throw new Error(json.error); return json; } diff --git a/cvmts/src/CollabVMServer.ts b/cvmts/src/CollabVMServer.ts index e986557..39e3f10 100644 --- a/cvmts/src/CollabVMServer.ts +++ b/cvmts/src/CollabVMServer.ts @@ -23,8 +23,6 @@ const kCVMTSAssetsRoot = path.resolve(__dirname, '../../assets'); const kRestartTimeout = 5000; - - type ChatHistory = { user: string; msg: string; @@ -115,14 +113,14 @@ export default class CollabVMServer { this.VM = vm; // hack but whatever (TODO: less rickity) - if(config.vm.type == "qemu") { + if (config.vm.type == 'qemu') { (vm as QemuVM).on('statechange', (newState: VMState) => { - if(newState == VMState.Stopped) { - this.logger.Info("stopped ?"); + if (newState == VMState.Stopped) { + this.logger.Info('stopped ?'); setTimeout(async () => { - this.logger.Info("restarting VM"); + this.logger.Info('restarting VM'); await this.VM.Start(); - }, kRestartTimeout) + }, kRestartTimeout); } }); } @@ -642,7 +640,7 @@ export default class CollabVMServer { } } catch (err) { // No - this.logger.Error(`User ${user?.IP.address} ${user?.username ? `with username ${user?.username}` : ''} sent broken Guacamole: ${(err as Error)}`); + this.logger.Error(`User ${user?.IP.address} ${user?.username ? `with username ${user?.username}` : ''} sent broken Guacamole: ${err as Error}`); user?.kick(); } } diff --git a/cvmts/src/IConfig.ts b/cvmts/src/IConfig.ts index 6c7f10d..c049ce6 100644 --- a/cvmts/src/IConfig.ts +++ b/cvmts/src/IConfig.ts @@ -1,4 +1,4 @@ -import VNCVMDef from "./VNCVM/VNCVMDef"; +import VNCVMDef from './VNCVM/VNCVMDef'; export default interface IConfig { http: { @@ -13,7 +13,7 @@ export default interface IConfig { enabled: boolean; host: string; port: number; - } + }; auth: { enabled: boolean; apiEndpoint: string; @@ -26,7 +26,7 @@ export default interface IConfig { }; }; vm: { - type: "qemu" | "vncvm"; + type: 'qemu' | 'vncvm'; }; qemu: { qemuArgs: string; diff --git a/cvmts/src/NetworkClient.ts b/cvmts/src/NetworkClient.ts index ae1c36e..501da5b 100644 --- a/cvmts/src/NetworkClient.ts +++ b/cvmts/src/NetworkClient.ts @@ -1,8 +1,8 @@ export default interface NetworkClient { - getIP() : string; - send(msg: string) : Promise; - close() : void; - on(event: string, listener: (...args: any[]) => void) : void; - off(event: string, listener: (...args: any[]) => void) : void; - isOpen() : boolean; -} \ No newline at end of file + getIP(): string; + send(msg: string): Promise; + close(): void; + on(event: string, listener: (...args: any[]) => void): void; + off(event: string, listener: (...args: any[]) => void): void; + isOpen(): boolean; +} diff --git a/cvmts/src/NetworkServer.ts b/cvmts/src/NetworkServer.ts index fd3ec24..5fce6f6 100644 --- a/cvmts/src/NetworkServer.ts +++ b/cvmts/src/NetworkServer.ts @@ -1,6 +1,6 @@ export default interface NetworkServer { - start() : void; - stop() : void; - on(event: string, listener: (...args: any[]) => void) : void; - off(event: string, listener: (...args: any[]) => void) : void; -} \ No newline at end of file + start(): void; + stop(): void; + on(event: string, listener: (...args: any[]) => void): void; + off(event: string, listener: (...args: any[]) => void): void; +} diff --git a/cvmts/src/TCP/TCPClient.ts b/cvmts/src/TCP/TCPClient.ts index 806e4e1..83e65db 100644 --- a/cvmts/src/TCP/TCPClient.ts +++ b/cvmts/src/TCP/TCPClient.ts @@ -1,55 +1,55 @@ -import EventEmitter from "events"; -import NetworkClient from "../NetworkClient.js"; -import { Socket } from "net"; +import EventEmitter from 'events'; +import NetworkClient from '../NetworkClient.js'; +import { Socket } from 'net'; export default class TCPClient extends EventEmitter implements NetworkClient { - private socket: Socket; - private cache: string; - - constructor(socket: Socket) { - super(); - this.socket = socket; - this.cache = ''; - this.socket.on('end', () => { - this.emit('disconnect'); - }) - this.socket.on('data', (data) => { - var msg = data.toString('utf-8'); - if (msg[msg.length - 1] === '\n') msg = msg.slice(0, -1); - this.cache += msg; - this.readCache(); - }); - } + private socket: Socket; + private cache: string; - private readCache() { - for (var index = this.cache.indexOf(';'); index !== -1; index = this.cache.indexOf(';')) { - this.emit('msg', this.cache.slice(0, index + 1)); - this.cache = this.cache.slice(index + 1); - } - } + constructor(socket: Socket) { + super(); + this.socket = socket; + this.cache = ''; + this.socket.on('end', () => { + this.emit('disconnect'); + }); + this.socket.on('data', (data) => { + var msg = data.toString('utf-8'); + if (msg[msg.length - 1] === '\n') msg = msg.slice(0, -1); + this.cache += msg; + this.readCache(); + }); + } - getIP(): string { - return this.socket.remoteAddress!; - } + private readCache() { + for (var index = this.cache.indexOf(';'); index !== -1; index = this.cache.indexOf(';')) { + this.emit('msg', this.cache.slice(0, index + 1)); + this.cache = this.cache.slice(index + 1); + } + } - send(msg: string): Promise { - return new Promise((res, rej) => { - this.socket.write(msg, (err) => { - if (err) { - rej(err); - return; - } - res(); - }); - }); - } + getIP(): string { + return this.socket.remoteAddress!; + } - close(): void { - this.emit('disconnect'); - this.socket.end(); - } + send(msg: string): Promise { + return new Promise((res, rej) => { + this.socket.write(msg, (err) => { + if (err) { + rej(err); + return; + } + res(); + }); + }); + } - isOpen(): boolean { - return this.socket.writable; - } -} \ No newline at end of file + close(): void { + this.emit('disconnect'); + this.socket.end(); + } + + isOpen(): boolean { + return this.socket.writable; + } +} diff --git a/cvmts/src/TCP/TCPServer.ts b/cvmts/src/TCP/TCPServer.ts index db46372..c32c694 100644 --- a/cvmts/src/TCP/TCPServer.ts +++ b/cvmts/src/TCP/TCPServer.ts @@ -1,40 +1,40 @@ -import EventEmitter from "events"; -import NetworkServer from "../NetworkServer.js"; -import { Server, Socket } from "net"; -import IConfig from "../IConfig.js"; -import { Logger } from "@cvmts/shared"; -import TCPClient from "./TCPClient.js"; -import { IPDataManager } from "../IPData.js"; -import { User } from "../User.js"; +import EventEmitter from 'events'; +import NetworkServer from '../NetworkServer.js'; +import { Server, Socket } from 'net'; +import IConfig from '../IConfig.js'; +import { Logger } from '@cvmts/shared'; +import TCPClient from './TCPClient.js'; +import { IPDataManager } from '../IPData.js'; +import { User } from '../User.js'; export default class TCPServer extends EventEmitter implements NetworkServer { - listener: Server; - Config: IConfig; - logger: Logger; - clients: TCPClient[]; + listener: Server; + Config: IConfig; + logger: Logger; + clients: TCPClient[]; - constructor(config: IConfig) { - super(); - this.logger = new Logger("CVMTS.TCPServer"); - this.Config = config; - this.listener = new Server(); - this.clients = []; - this.listener.on('connection', socket => this.onConnection(socket)); - } + constructor(config: IConfig) { + super(); + this.logger = new Logger('CVMTS.TCPServer'); + this.Config = config; + this.listener = new Server(); + this.clients = []; + this.listener.on('connection', (socket) => this.onConnection(socket)); + } - private onConnection(socket: Socket) { - this.logger.Info(`New TCP connection from ${socket.remoteAddress}`); - var client = new TCPClient(socket); - this.clients.push(client); - this.emit('connect', new User(client, IPDataManager.GetIPData(client.getIP()), this.Config)); - } + private onConnection(socket: Socket) { + this.logger.Info(`New TCP connection from ${socket.remoteAddress}`); + var client = new TCPClient(socket); + this.clients.push(client); + this.emit('connect', new User(client, IPDataManager.GetIPData(client.getIP()), this.Config)); + } - start(): void { - this.listener.listen(this.Config.tcp.port, this.Config.tcp.host, () => { - this.logger.Info(`TCP server listening on ${this.Config.tcp.host}:${this.Config.tcp.port}`); - }) - } - stop(): void { - this.listener.close(); - } -} \ No newline at end of file + start(): void { + this.listener.listen(this.Config.tcp.port, this.Config.tcp.host, () => { + this.logger.Info(`TCP server listening on ${this.Config.tcp.host}:${this.Config.tcp.port}`); + }); + } + stop(): void { + this.listener.close(); + } +} diff --git a/cvmts/src/User.ts b/cvmts/src/User.ts index a434c2f..4b2b9d3 100644 --- a/cvmts/src/User.ts +++ b/cvmts/src/User.ts @@ -49,7 +49,7 @@ export class User { clearInterval(this.msgRecieveInterval); this.msgRecieveInterval = setInterval(() => this.onNoMsg(), 10000); }); - + this.nopSendInterval = setInterval(() => this.sendNop(), 5000); this.msgRecieveInterval = setInterval(() => this.onNoMsg(), 10000); this.sendNop(); @@ -66,7 +66,7 @@ export class User { this.VoteRateLimit = new RateLimiter(3, 3); this.VoteRateLimit.on('limit', () => this.closeConnection()); } - + assignGuestName(existingUsers: string[]): string { var username; do { diff --git a/cvmts/src/VM.ts b/cvmts/src/VM.ts index 11b8a06..dbdf4bb 100644 --- a/cvmts/src/VM.ts +++ b/cvmts/src/VM.ts @@ -1,11 +1,11 @@ -import VMDisplay from "./VMDisplay.js"; +import VMDisplay from './VMDisplay.js'; export default interface VM { - Start(): Promise; - Stop(): Promise; - Reboot(): Promise; - Reset(): Promise; - MonitorCommand(command: string): Promise; - GetDisplay(): VMDisplay; - SnapshotsSupported(): boolean; -} \ No newline at end of file + Start(): Promise; + Stop(): Promise; + Reboot(): Promise; + Reset(): Promise; + MonitorCommand(command: string): Promise; + GetDisplay(): VMDisplay; + SnapshotsSupported(): boolean; +} diff --git a/cvmts/src/VMDisplay.ts b/cvmts/src/VMDisplay.ts index adee89f..b06a6d7 100644 --- a/cvmts/src/VMDisplay.ts +++ b/cvmts/src/VMDisplay.ts @@ -1,12 +1,12 @@ -import { Size } from "@cvmts/shared"; -import EventEmitter from "node:events"; +import { Size } from '@cvmts/shared'; +import EventEmitter from 'node:events'; export default interface VMDisplay extends EventEmitter { - Connect(): void; - Disconnect(): void; - Connected(): boolean; - Buffer(): Buffer; - Size(): Size; - MouseEvent(x: number, y: number, buttons: number): void; - KeyboardEvent(keysym: number, pressed: boolean): void; -} \ No newline at end of file + Connect(): void; + Disconnect(): void; + Connected(): boolean; + Buffer(): Buffer; + Size(): Size; + MouseEvent(x: number, y: number, buttons: number): void; + KeyboardEvent(keysym: number, pressed: boolean): void; +} diff --git a/cvmts/src/VNCVM/VNCVM.ts b/cvmts/src/VNCVM/VNCVM.ts index 52d1cee..c89ec61 100644 --- a/cvmts/src/VNCVM/VNCVM.ts +++ b/cvmts/src/VNCVM/VNCVM.ts @@ -1,31 +1,28 @@ -import EventEmitter from "events"; -import VNCVMDef from "./VNCVMDef"; -import VM from "../VM"; -import VMDisplay from "../VMDisplay"; -import { Clamp, Logger, Rect, Size, Sleep } from "@cvmts/shared"; +import EventEmitter from 'events'; +import VNCVMDef from './VNCVMDef'; +import VM from '../VM'; +import VMDisplay from '../VMDisplay'; +import { Clamp, Logger, Rect, Size, Sleep } from '@cvmts/shared'; import { VncClient } from '@computernewb/nodejs-rfb'; -import { BatchRects } from "@cvmts/qemu"; -import { execaCommand } from "execa"; +import { BatchRects } from '@cvmts/qemu'; +import { execaCommand } from 'execa'; export default class VNCVM extends EventEmitter implements VM, VMDisplay { - def : VNCVMDef; - logger: Logger; - private displayVnc = new VncClient({ - debug: false, - fps: 60, - encodings: [ - VncClient.consts.encodings.raw, - VncClient.consts.encodings.pseudoDesktopSize - ] - }); - private vncShouldReconnect: boolean = false; + def: VNCVMDef; + logger: Logger; + private displayVnc = new VncClient({ + debug: false, + fps: 60, + encodings: [VncClient.consts.encodings.raw, VncClient.consts.encodings.pseudoDesktopSize] + }); + private vncShouldReconnect: boolean = false; - constructor(def : VNCVMDef) { - super(); - this.def = def; - this.logger = new Logger(`CVMTS.VNCVM/${this.def.vncHost}:${this.def.vncPort}`); + constructor(def: VNCVMDef) { + super(); + this.def = def; + this.logger = new Logger(`CVMTS.VNCVM/${this.def.vncHost}:${this.def.vncPort}`); - this.displayVnc.on('connectTimeout', () => { + this.displayVnc.on('connectTimeout', () => { this.Reconnect(); }); @@ -34,7 +31,7 @@ export default class VNCVM extends EventEmitter implements VM, VMDisplay { }); this.displayVnc.on('disconnect', () => { - this.logger.Info('Disconnected'); + this.logger.Info('Disconnected'); this.Reconnect(); }); @@ -43,7 +40,7 @@ export default class VNCVM extends EventEmitter implements VM, VMDisplay { }); this.displayVnc.on('firstFrameUpdate', () => { - this.logger.Info('Connected'); + this.logger.Info('Connected'); // apparently this library is this good. // at least it's better than the two others which exist. this.displayVnc.changeFps(60); @@ -77,17 +74,16 @@ export default class VNCVM extends EventEmitter implements VM, VMDisplay { this.emit('frame'); }); - } + } - - async Reset(): Promise { - if (this.def.restoreCmd) await execaCommand(this.def.restoreCmd, {shell: true}); - else { - await this.Stop(); - await Sleep(1000); - await this.Start(); - } - } + async Reset(): Promise { + if (this.def.restoreCmd) await execaCommand(this.def.restoreCmd, { shell: true }); + else { + await this.Stop(); + await Sleep(1000); + await this.Start(); + } + } private Reconnect() { if (this.displayVnc.connected) return; @@ -98,60 +94,60 @@ export default class VNCVM extends EventEmitter implements VM, VMDisplay { // if we fail after max tries, emit a event this.displayVnc.connect({ - host: this.def.vncHost, - port: this.def.vncPort, - path: null, + host: this.def.vncHost, + port: this.def.vncPort, + path: null }); } - async Start(): Promise { - this.logger.Info('Connecting'); - if (this.def.startCmd) await execaCommand(this.def.startCmd, {shell: true}); - this.Connect(); - } + async Start(): Promise { + this.logger.Info('Connecting'); + if (this.def.startCmd) await execaCommand(this.def.startCmd, { shell: true }); + this.Connect(); + } - async Stop(): Promise { - this.logger.Info('Disconnecting'); - this.Disconnect(); - if (this.def.stopCmd) await execaCommand(this.def.stopCmd, {shell: true}); - } + async Stop(): Promise { + this.logger.Info('Disconnecting'); + this.Disconnect(); + if (this.def.stopCmd) await execaCommand(this.def.stopCmd, { shell: true }); + } - async Reboot(): Promise { - if (this.def.rebootCmd) await execaCommand(this.def.rebootCmd, {shell: true}); - } + async Reboot(): Promise { + if (this.def.rebootCmd) await execaCommand(this.def.rebootCmd, { shell: true }); + } - async MonitorCommand(command: string): Promise { - // TODO: This can maybe run a specified command? - return "This VM does not support monitor commands."; - } + async MonitorCommand(command: string): Promise { + // TODO: This can maybe run a specified command? + return 'This VM does not support monitor commands.'; + } - GetDisplay(): VMDisplay { - return this; - } + GetDisplay(): VMDisplay { + return this; + } - SnapshotsSupported(): boolean { - return true; - } + SnapshotsSupported(): boolean { + return true; + } - Connect(): void { - this.vncShouldReconnect = true; - this.Reconnect(); - } + Connect(): void { + this.vncShouldReconnect = true; + this.Reconnect(); + } - Disconnect(): void { - this.vncShouldReconnect = false; - this.displayVnc.disconnect(); - } + Disconnect(): void { + this.vncShouldReconnect = false; + this.displayVnc.disconnect(); + } - Connected(): boolean { - return this.displayVnc.connected; - } + Connected(): boolean { + return this.displayVnc.connected; + } - Buffer(): Buffer { - return this.displayVnc.fb; - } + Buffer(): Buffer { + return this.displayVnc.fb; + } - Size(): Size { + Size(): Size { if (!this.displayVnc.connected) return { width: 0, @@ -162,13 +158,13 @@ export default class VNCVM extends EventEmitter implements VM, VMDisplay { width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight }; - } + } - MouseEvent(x: number, y: number, buttons: number): void { + MouseEvent(x: number, y: number, buttons: number): void { if (this.displayVnc.connected) this.displayVnc.sendPointerEvent(Clamp(x, 0, this.displayVnc.clientWidth), Clamp(y, 0, this.displayVnc.clientHeight), buttons); - } + } - KeyboardEvent(keysym: number, pressed: boolean): void { + KeyboardEvent(keysym: number, pressed: boolean): void { if (this.displayVnc.connected) this.displayVnc.sendKeyEvent(keysym, pressed); - } -} \ No newline at end of file + } +} diff --git a/cvmts/src/VNCVM/VNCVMDef.ts b/cvmts/src/VNCVM/VNCVMDef.ts index b6d34d9..395977d 100644 --- a/cvmts/src/VNCVM/VNCVMDef.ts +++ b/cvmts/src/VNCVM/VNCVMDef.ts @@ -1,8 +1,8 @@ export default interface VNCVMDef { - vncHost : string; - vncPort : number; - startCmd : string | null; - stopCmd : string | null; - rebootCmd : string | null; - restoreCmd : string | null; -} \ No newline at end of file + vncHost: string; + vncPort: number; + startCmd: string | null; + stopCmd: string | null; + rebootCmd: string | null; + restoreCmd: string | null; +} diff --git a/cvmts/src/WebSocket/WSClient.ts b/cvmts/src/WebSocket/WSClient.ts index bf7daa4..cbb84ed 100644 --- a/cvmts/src/WebSocket/WSClient.ts +++ b/cvmts/src/WebSocket/WSClient.ts @@ -1,62 +1,60 @@ -import { WebSocket } from "ws"; -import NetworkClient from "../NetworkClient.js"; -import EventEmitter from "events"; -import { Logger } from "@cvmts/shared"; +import { WebSocket } from 'ws'; +import NetworkClient from '../NetworkClient.js'; +import EventEmitter from 'events'; +import { Logger } from '@cvmts/shared'; export default class WSClient extends EventEmitter implements NetworkClient { - socket: WebSocket; - ip: string; + socket: WebSocket; + ip: string; - constructor(ws: WebSocket, ip: string) { - super(); - this.socket = ws; - this.ip = ip; - this.socket.on('message', (buf: Buffer, isBinary: boolean) => { + constructor(ws: WebSocket, ip: string) { + super(); + this.socket = ws; + this.ip = ip; + this.socket.on('message', (buf: Buffer, isBinary: boolean) => { // Close the user's connection if they send a non-string message if (isBinary) { this.close(); return; } - this.emit('msg', buf.toString("utf-8")); + this.emit('msg', buf.toString('utf-8')); }); - this.socket.on('close', () => { - this.emit('disconnect'); - }); - } + this.socket.on('close', () => { + this.emit('disconnect'); + }); + } - isOpen(): boolean { - return this.socket.readyState === WebSocket.OPEN; - } + isOpen(): boolean { + return this.socket.readyState === WebSocket.OPEN; + } - getIP(): string { - return this.ip; - } - send(msg: string): Promise { - return new Promise((res,rej) => { - if(!this.isOpen()) + getIP(): string { + return this.ip; + } + send(msg: string): Promise { + return new Promise((res, rej) => { + if (!this.isOpen()) res(); + + this.socket.send(msg, (err) => { + if (err) { + rej(err); + return; + } res(); - - this.socket.send(msg, (err) => { - if (err) { - rej(err); - return; - } - res(); - }); - }); - } + }); + }); + } - close(): void { - if(this.isOpen()) { + close(): void { + if (this.isOpen()) { // While this seems counterintutive, do note that the WebSocket protocol // *sends* a data frame whilist closing a connection. Therefore, if the other end // has forcibly hung up (closed) their connection, the best way to handle that // is to just let the inner TCP socket propegate that, which `ws` will do for us. // Otherwise, we'll try to send data to a closed client then SIGPIPE. - this.socket.close(); + this.socket.close(); } - } - + } } diff --git a/cvmts/src/WebSocket/WSServer.ts b/cvmts/src/WebSocket/WSServer.ts index 918cfe6..76580a9 100644 --- a/cvmts/src/WebSocket/WSServer.ts +++ b/cvmts/src/WebSocket/WSServer.ts @@ -11,18 +11,18 @@ import { User } from '../User.js'; import { Logger } from '@cvmts/shared'; export default class WSServer extends EventEmitter implements NetworkServer { - private httpServer: http.Server; - private wsServer: WebSocketServer; - private clients: WSClient[]; - private Config: IConfig; - private logger: Logger; + private httpServer: http.Server; + private wsServer: WebSocketServer; + private clients: WSClient[]; + private Config: IConfig; + private logger: Logger; - constructor(config : IConfig) { - super(); - this.Config = config; - this.clients = []; - this.logger = new Logger("CVMTS.WSServer"); - this.httpServer = http.createServer(); + constructor(config: IConfig) { + super(); + this.Config = config; + this.clients = []; + this.logger = new Logger('CVMTS.WSServer'); + this.httpServer = http.createServer(); this.wsServer = new WebSocketServer({ noServer: true }); this.httpServer.on('upgrade', (req: http.IncomingMessage, socket: internal.Duplex, head: Buffer) => this.httpOnUpgrade(req, socket, head)); this.httpServer.on('request', (req, res) => { @@ -30,19 +30,19 @@ export default class WSServer extends EventEmitter implements NetworkServer { res.write('This server only accepts WebSocket connections.'); res.end(); }); - } + } - start(): void { - this.httpServer.listen(this.Config.http.port, this.Config.http.host, () => { - this.logger.Info(`WebSocket server listening on ${this.Config.http.host}:${this.Config.http.port}`); - }); - } + start(): void { + this.httpServer.listen(this.Config.http.port, this.Config.http.host, () => { + this.logger.Info(`WebSocket server listening on ${this.Config.http.host}:${this.Config.http.port}`); + }); + } - stop(): void { - this.httpServer.close(); - } + stop(): void { + this.httpServer.close(); + } - private httpOnUpgrade(req: http.IncomingMessage, socket: internal.Duplex, head: Buffer) { + private httpOnUpgrade(req: http.IncomingMessage, socket: internal.Duplex, head: Buffer) { var killConnection = () => { socket.write('HTTP/1.1 400 Bad Request\n\n400 Bad Request'); socket.destroy(); @@ -121,7 +121,7 @@ export default class WSServer extends EventEmitter implements NetworkServer { let ipdata = IPDataManager.GetIPDataMaybe(ip); - if(ipdata != null) { + if (ipdata != null) { let connections = ipdata.refCount; if (connections + 1 > this.Config.collabvm.maxConnections) { socket.write('HTTP/1.1 429 Too Many Requests\n\n429 Too Many Requests'); @@ -136,11 +136,11 @@ export default class WSServer extends EventEmitter implements NetworkServer { } private onConnection(ws: WebSocket, req: http.IncomingMessage, ip: string) { - let client = new WSClient(ws, ip); - this.clients.push(client); + let client = new WSClient(ws, ip); + this.clients.push(client); let user = new User(client, IPDataManager.GetIPData(ip), this.Config); - this.emit('connect', user); + this.emit('connect', user); ws.on('error', (e) => { this.logger.Error(`${e} (caused by connection ${ip})`); diff --git a/cvmts/src/index.ts b/cvmts/src/index.ts index df45e80..fa85223 100644 --- a/cvmts/src/index.ts +++ b/cvmts/src/index.ts @@ -34,7 +34,7 @@ try { } let exiting = false; -let VM : VM; +let VM: VM; async function stop() { if (exiting) return; @@ -47,7 +47,7 @@ async function start() { // Init the auth manager if enabled let auth = Config.auth.enabled ? new AuthManager(Config.auth.apiEndpoint, Config.auth.secretKey) : null; switch (Config.vm.type) { - case "qemu": { + case 'qemu': { // Print a warning if qmpSockDir is set // and the host OS is Windows, as this // configuration will very likely not work. @@ -67,7 +67,7 @@ async function start() { VM = new QemuVM(def); break; } - case "vncvm": { + case 'vncvm': { VM = new VNCVM(Config.vncvm); break; } diff --git a/jpeg-turbo b/jpeg-turbo deleted file mode 160000 index 6718ec1..0000000 --- a/jpeg-turbo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6718ec1fc12aeccdb1b1490a7a258f24e8f83164