cvmts: Use npm versions of superqemu/nodejs-rfb.
We publish them now, so let's use them in cvmts! Additionally, this removes the 'shared' module entirely, since it has little purpose anymore. The logger is replaced with pino (because superqemu uses pino for logging itself).
This commit is contained in:
@@ -3,9 +3,8 @@ import IConfig from './IConfig.js';
|
||||
import * as fs from 'fs';
|
||||
import CollabVMServer from './CollabVMServer.js';
|
||||
|
||||
import { QemuVM, QemuVmDefinition } from '@cvmts/qemu';
|
||||
import { QemuVM, QemuVmDefinition } from '@computernewb/superqemu';
|
||||
|
||||
import * as Shared from '@cvmts/shared';
|
||||
import AuthManager from './AuthManager.js';
|
||||
import WSServer from './WebSocket/WSServer.js';
|
||||
import { User } from './User.js';
|
||||
@@ -13,24 +12,25 @@ import TCPServer from './TCP/TCPServer.js';
|
||||
import VM from './VM.js';
|
||||
import VNCVM from './VNCVM/VNCVM.js';
|
||||
import GeoIPDownloader from './GeoIPDownloader.js';
|
||||
import pino from 'pino';
|
||||
|
||||
let logger = new Shared.Logger('CVMTS.Init');
|
||||
let logger = pino();
|
||||
|
||||
logger.Info('CollabVM Server starting up');
|
||||
logger.info('CollabVM Server starting up');
|
||||
|
||||
// Parse the config file
|
||||
|
||||
let Config: IConfig;
|
||||
|
||||
if (!fs.existsSync('config.toml')) {
|
||||
logger.Error('Fatal error: Config.toml not found. Please copy config.example.toml and fill out fields');
|
||||
logger.error('Fatal error: Config.toml not found. Please copy config.example.toml and fill out fields');
|
||||
process.exit(1);
|
||||
}
|
||||
try {
|
||||
var configRaw = fs.readFileSync('config.toml').toString();
|
||||
Config = toml.parse(configRaw);
|
||||
} catch (e) {
|
||||
logger.Error('Fatal error: Failed to read or parse the config file: {0}', (e as Error).message);
|
||||
logger.error('Fatal error: Failed to read or parse the config file: {0}', (e as Error).message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -54,15 +54,6 @@ async function start() {
|
||||
let auth = Config.auth.enabled ? new AuthManager(Config.auth.apiEndpoint, Config.auth.secretKey) : null;
|
||||
switch (Config.vm.type) {
|
||||
case 'qemu': {
|
||||
// Print a warning if qmpSockDir is set
|
||||
// and the host OS is Windows, as this
|
||||
// configuration will very likely not work.
|
||||
if (process.platform === 'win32' && Config.qemu.qmpSockDir !== null) {
|
||||
logger.Warning("You appear to have the option 'qmpSockDir' enabled in the config.");
|
||||
logger.Warning('This is not supported on Windows, and you will likely run into issues.');
|
||||
logger.Warning('To remove this warning, use the qmpHost and qmpPort options instead.');
|
||||
}
|
||||
|
||||
// Fire up the VM
|
||||
let def: QemuVmDefinition = {
|
||||
id: Config.collabvm.node,
|
||||
@@ -78,7 +69,7 @@ async function start() {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
logger.Error('Invalid VM type in config: {0}', Config.vm.type);
|
||||
logger.error(`Invalid VM type in config: ${Config.vm.type}`);
|
||||
process.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user