Ported main.js to TypeScript. Rewrote all imports and replaced with class constructors, not require()().

This commit is contained in:
Matt McWilliams 2024-05-23 20:51:35 -04:00
parent 91ad944c46
commit 5d31bf0020
64 changed files with 530 additions and 409 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.8.110",
"version": "1.8.111",
"ext_port": 1111,
"profiles": {
"mcopy": {

View File

@ -1,10 +1,12 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Alert = void 0;
const electron_1 = require("electron");
const log_1 = require("log");
/* class representing alert functionality */
class Alert {
constructor(ui) {
this.ipc = electron_1.ipcMain;
this.id = 'alert';
this.cb = null;
this.ui = ui;
@ -15,7 +17,6 @@ class Alert {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -54,7 +55,5 @@ class Alert {
}
}
exports.Alert = Alert;
module.exports = function (ui) {
return new Alert(ui);
};
module.exports = { Alert };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/alert/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAGb,6BAA0B;AAI1B,4CAA4C;AAE5C,MAAa,KAAK;IAOjB,YAAc,EAAgB;QAJtB,OAAE,GAAY,OAAO,CAAA;QACrB,OAAE,GAAc,IAAI,CAAA;QAI3B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,EAAE,CAAA;IACZ,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,GAAG,GAAG,MAAM,IAAA,SAAG,EAAC,EAAE,KAAK,EAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAA;QACtC,IAAI,CAAC,MAAM,EAAE,CAAA;IACd,CAAC;IAED;;QAEI;IACI,MAAM;QACb,IAAI,CAAC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C,IAAI,IAAI,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAY,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;QACrG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QAC9B,OAAO,IAAI,OAAO,CAAC,UAAU,OAAkB,EAAE,MAAiB;YACjE,IAAI,CAAC,EAAE,GAAG;gBACT,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;gBACjC,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAA;QACF,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,CAAC;CACD;AAvDD,sBAuDC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAA"}

View File

@ -1,8 +1,12 @@
/// <reference types="node" />
import type { EventEmitter } from 'events';
/**
* Class representing the arduino communication features
**/
export declare class Arduino {
private log;
private eventEmitter;
private cfg;
private path;
private known;
private serial;
@ -17,7 +21,7 @@ export declare class Arduino {
alias: any;
stateStr: any;
hasState: any;
constructor(errorState: Function);
constructor(cfg: any, ee: EventEmitter, errorState: Function);
init(): Promise<void>;
/**
* Enumerate all connected devices that might be Arduinos

View File

@ -22,9 +22,6 @@ const exec = require('child_process').exec;
const parser = new ReadlineParser({ delimiter: '\r\n' });
const newlineRe = new RegExp('\n', 'g');
const returnRe = new RegExp('\r', 'g');
let eventEmitter;
let cfg;
let arduino;
const KNOWN = [
'/dev/tty.usbmodem1a161',
'/dev/tty.usbserial-A800f8dk',
@ -39,7 +36,8 @@ const KNOWN = [
* Class representing the arduino communication features
**/
class Arduino {
constructor(errorState) {
constructor(cfg, ee, errorState) {
this.cfg = {};
this.path = {};
this.known = KNOWN;
this.serial = {};
@ -50,13 +48,15 @@ class Arduino {
this.alias = {};
this.stateStr = {};
this.hasState = {};
this.cfg = cfg;
this.eventEmitter = ee;
this.errorState = errorState;
this.init();
}
async init() {
this.log = await (0, log_1.Log)({ label: 'arduino' });
this.keys = Object.keys(cfg.arduino.cmd);
this.values = this.keys.map((key) => cfg.arduino.cmd[key]);
this.keys = Object.keys(this.cfg.arduino.cmd);
this.values = this.keys.map((key) => this.cfg.arduino.cmd[key]);
}
/**
* Enumerate all connected devices that might be Arduinos
@ -144,7 +144,7 @@ class Arduino {
}
this.timer = new Date().getTime();
this.lock(serial);
await (0, delay_1.delay)(cfg.arduino.serialDelay);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
try {
ms = await this.sendAsync(device, cmd);
}
@ -153,7 +153,7 @@ class Arduino {
return null;
}
this.unlock(serial);
await eventEmitter.emit('arduino_send', cmd);
await this.eventEmitter.emit('arduino_send', cmd);
return ms;
}
/**
@ -169,7 +169,7 @@ class Arduino {
**/
async sendString(device, str) {
let writeSuccess;
await (0, delay_1.delay)(cfg.arduino.serialDelay);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
if (typeof this.serial[this.alias[device]].fake !== 'undefined'
&& this.serial[this.alias[device]].fake) {
return this.serial[this.alias[device]].string(str);
@ -191,7 +191,7 @@ class Arduino {
*
**/
async stateAsync(device, confirm = false) {
const cmd = cfg.arduino.cmd.state;
const cmd = this.cfg.arduino.cmd.state;
const serial = confirm ? this.alias['connect'] : this.alias[device];
return new Promise((resolve, reject) => {
this.queue[cmd] = (state) => {
@ -233,7 +233,7 @@ class Arduino {
}
this.timer = new Date().getTime();
this.lock(serial);
await (0, delay_1.delay)(cfg.arduino.serialDelay);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
try {
results = await this.stateAsync(device, confirm);
}
@ -242,7 +242,7 @@ class Arduino {
return null;
}
this.unlock(serial);
await eventEmitter.emit('arduino_state', cfg.arduino.cmd.state);
await this.eventEmitter.emit('arduino_state', this.cfg.arduino.cmd.state);
return results;
}
/**
@ -280,18 +280,18 @@ class Arduino {
if (this.queue[data] !== undefined) {
this.unlock(serial);
complete = this.queue[data](ms); //execute callback
eventEmitter.emit('arduino_end', data);
this.eventEmitter.emit('arduino_end', data);
delete this.queue[data];
}
else if (data[0] === cfg.arduino.cmd.state) {
else if (data[0] === this.cfg.arduino.cmd.state) {
//this.log.info(`end serial -> ${serial}`)
this.unlock(serial);
complete = this.queue[cfg.arduino.cmd.state](data);
eventEmitter.emit('arduino_end', data);
delete this.queue[cfg.arduino.cmd.state];
complete = this.queue[this.cfg.arduino.cmd.state](data);
this.eventEmitter.emit('arduino_end', data);
delete this.queue[this.cfg.arduino.cmd.state];
return data;
}
else if (data[0] === cfg.arduino.cmd.error) {
else if (data[0] === this.cfg.arduino.cmd.error) {
this.log.error(`Received error from device ${serial}`);
this.unlock(serial);
this.error(serial, data);
@ -340,7 +340,7 @@ class Arduino {
this.serial[serial] = new SerialPort({
path: serial,
autoOpen: false,
baudRate: cfg.arduino.baud,
baudRate: this.cfg.arduino.baud,
parser
});
this.unlock(serial);
@ -381,9 +381,9 @@ class Arduino {
this.confirmExec = null;
this.unlock(this.alias['connect']);
}
else if (data[0] === cfg.arduino.cmd.state) {
this.queue[cfg.arduino.cmd.state](data);
delete this.queue[cfg.arduino.cmd.state];
else if (data[0] === this.cfg.arduino.cmd.state) {
this.queue[this.cfg.arduino.cmd.state](data);
delete this.queue[this.cfg.arduino.cmd.state];
this.unlock(this.alias['connect']);
}
}
@ -400,16 +400,16 @@ class Arduino {
const device = 'connect';
let writeSuccess;
this.confirmExec = function (err, data) {
if (data === cfg.arduino.cmd.connect) {
if (data === this.cfg.arduino.cmd.connect) {
return resolve(true);
}
else {
return reject('Wrong data returned');
}
};
await (0, delay_1.delay)(cfg.arduino.serialDelay);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
try {
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.connect);
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.connect);
}
catch (e) {
return reject(e);
@ -431,62 +431,62 @@ class Arduino {
let writeSuccess;
let type;
this.confirmExec = function (err, data) {
if (data === cfg.arduino.cmd.projector_identifier) {
if (data === this.cfg.arduino.cmd.projector_identifier) {
type = 'projector';
}
else if (data === cfg.arduino.cmd.camera_identifier) {
else if (data === this.cfg.arduino.cmd.camera_identifier) {
type = 'camera';
}
else if (data === cfg.arduino.cmd.light_identifier) {
else if (data === this.cfg.arduino.cmd.light_identifier) {
type = 'light';
}
else if (data === cfg.arduino.cmd.projector_light_identifier) {
else if (data === this.cfg.arduino.cmd.projector_light_identifier) {
type = 'projector,light';
}
else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
else if (data === this.cfg.arduino.cmd.projector_camera_light_identifier) {
type = 'projector,camera,light';
}
else if (data === cfg.arduino.cmd.projector_camera_identifier) {
else if (data === this.cfg.arduino.cmd.projector_camera_identifier) {
type = 'projector,camera';
}
else if (data === cfg.arduino.cmd.projector_second_identifier) {
else if (data === this.cfg.arduino.cmd.projector_second_identifier) {
type = 'projector_second';
}
else if (data === cfg.arduino.cmd.projectors_identifier) {
else if (data === this.cfg.arduino.cmd.projectors_identifier) {
type = 'projector,projector_second';
}
else if (data === cfg.arduino.cmd.camera_second_identifier) {
else if (data === this.cfg.arduino.cmd.camera_second_identifier) {
type = 'camera_second';
}
else if (data === cfg.arduino.cmd.cameras_identifier) {
else if (data === this.cfg.arduino.cmd.cameras_identifier) {
type = 'camera,camera_second';
}
else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
else if (data === this.cfg.arduino.cmd.camera_projectors_identifier) {
type = 'camera,projector,projector_second';
}
else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
else if (data === this.cfg.arduino.cmd.cameras_projector_identifier) {
type = 'camera,camera_second,projector';
}
else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
else if (data === this.cfg.arduino.cmd.cameras_projectors_identifier) {
type = 'camera,camera_second,projector,projector_second';
}
else if (data === cfg.arduino.cmd.capper_identifier) {
else if (data === this.cfg.arduino.cmd.capper_identifier) {
type = 'capper';
}
else if (data === cfg.arduino.cmd.camera_capper_identifier) {
else if (data === this.cfg.arduino.cmd.camera_capper_identifier) {
type = 'camera,capper';
}
else if (data === cfg.arduino.cmd.camera_capper_projector_identifier) {
else if (data === this.cfg.arduino.cmd.camera_capper_projector_identifier) {
type = 'camera,capper,projector';
}
else if (data === cfg.arduino.cmd.camera_capper_projectors_identifier) {
else if (data === this.cfg.arduino.cmd.camera_capper_projectors_identifier) {
type = 'camera,capper,projector,projector_second';
}
return resolve(type);
};
await (0, delay_1.delay)(cfg.arduino.serialDelay);
await (0, delay_1.delay)(this.cfg.arduino.serialDelay);
try {
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.mcopy_identifier);
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.mcopy_identifier);
this.log.info(writeSuccess);
}
catch (e) {
@ -526,19 +526,19 @@ class Arduino {
this.serial[serial] = {
write: async function (cmd, cb) {
const t = {
c: cfg.arduino.cam.time + cfg.arduino.cam.delay,
p: cfg.arduino.proj.time + cfg.arduino.proj.delay,
c: this.cfg.arduino.cam.time + this.cfg.arduino.cam.delay,
p: this.cfg.arduino.proj.time + this.cfg.arduino.proj.delay,
A: 180,
B: 180
};
let timeout = t[cmd];
if (typeof timeout === 'undefined')
timeout = 10;
arduino.timer = +new Date();
this.timer = +new Date();
await (0, delay_1.delay)(timeout);
arduino.end(serial, cmd);
this.end(serial, cmd);
return cb();
},
}.bind(this),
string: async function (str) {
//do nothing
return true;
@ -595,12 +595,5 @@ class Arduino {
}
}
exports.Arduino = Arduino;
if (typeof module !== 'undefined' && module.parent) {
module.exports = function (c, ee, errorState) {
eventEmitter = ee;
cfg = c;
arduino = new Arduino(errorState);
return arduino;
};
}
module.exports = { Arduino };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Camera = void 0;
const electron_1 = require("electron");
const intval_1 = require("intval");
const processing_1 = require("processing");
const delay_1 = require("delay");
@ -19,6 +20,7 @@ class Camera {
this.arduino = null;
this.intval = null;
this.processing = null;
this.ipc = electron_1.ipcMain;
this.id = 'camera';
this.arduino = arduino;
this.cfg = cfg;
@ -33,7 +35,6 @@ class Camera {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -338,7 +339,5 @@ class Camera {
}
}
exports.Camera = Camera;
module.exports = function (arduino, cfg, ui, filmout, second) {
return new Camera(arduino, cfg, ui, filmout, second);
};
module.exports = { Camera };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Capper = void 0;
const electron_1 = require("electron");
const log_1 = require("log");
/** class representing capper functions **/
class Capper {
@ -12,6 +13,7 @@ class Capper {
capper: false
};
this.arduino = null;
this.ipc = electron_1.ipcMain;
this.id = 'capper';
this.arduino = arduino;
this.cfg = cfg;
@ -24,7 +26,6 @@ class Capper {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -86,7 +87,5 @@ class Capper {
}
}
exports.Capper = Capper;
module.exports = function (arduino, cfg, ui, filmout) {
return new Capper(arduino, cfg, ui, filmout);
};
module.exports = { Capper };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capper/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAKb,6BAA0B;AAM1B,2CAA2C;AAE3C,MAAa,MAAM;IAWlB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB,EAAE,OAAiB;QAbtE,UAAK,GAAS;YACrB,MAAM,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B,CAAC;SAC7B;aAAM,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;YACnD,OAAO,GAAG,mBAAmB,CAAC;SAC9B;QAED,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC;QAEtB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC,CAAC;QACnD,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AA7FD,wBA6FC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,CAAA"}

View File

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Commands = void 0;
const electron_1 = require("electron");
const uuid_1 = require("uuid");
const delay_1 = require("delay");
class Commands {
@ -19,6 +20,7 @@ class Commands {
*
**/
constructor(cfg, proj, cam, light, alert, cam2 = null, proj2 = null, capper = null) {
this.ipc = electron_1.ipcMain;
this.cfg = cfg;
this.proj = proj;
this.cam = cam;
@ -30,7 +32,6 @@ class Commands {
this.proj2 = proj2;
if (capper !== null)
this.capper = capper;
this.ipc = require('electron').ipcMain;
}
/**
* Move the projector one frame forward
@ -636,7 +637,5 @@ class Commands {
}
}
exports.Commands = Commands;
module.exports = function (cfg, proj, cam, light, alert, cam2, proj2, capper) {
return new Commands(cfg, proj, cam, light, alert, cam2, proj2, capper);
};
module.exports = { Commands };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Devices = void 0;
const electron_1 = require("electron");
const delay_1 = require("delay");
const log_1 = require("log");
/**
@ -15,6 +16,7 @@ class Devices {
**/
constructor(arduino, settings, mainWindow) {
this.connected = {};
this.ipc = electron_1.ipcMain;
this.arduino = arduino;
this.settings = settings;
this.mainWindow = mainWindow;
@ -27,7 +29,6 @@ class Devices {
**/
async init() {
this.log = await (0, log_1.Log)({ label: 'devices' });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -580,7 +581,5 @@ class Devices {
}
}
exports.Devices = Devices;
module.exports = function (arduino, settings, mainWindow) {
return new Devices(arduino, settings, mainWindow);
};
module.exports = { Devices };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -5,21 +5,22 @@ exports.Display = void 0;
* @module display
* Provides features for displaying a full screen display of images for the digital module.
**/
const electron_1 = require("electron");
const path_1 = require("path");
const url_1 = require("url");
const delay_1 = require("delay");
const log_1 = require("log");
const electron_1 = require("electron");
class WebView {
constructor(platform, display) {
this.opened = false;
this.showing = false;
this.loadWait = {};
this.ipc = electron_1.ipcMain;
const prefs = {
webPreferences: {
nodeIntegration: true,
allowRunningInsecureContent: false,
enableRemoteModule: true,
//enableRemoteModule: true,
contextIsolation: false
},
width: 800,
@ -51,7 +52,6 @@ class WebView {
//this.digitalWindow.hide();
this.platform = platform;
this.display = display;
this.ipc = require('electron').ipcMain;
this.ipc.on('display_load', this.onLoad.bind(this));
}
async init() {
@ -194,7 +194,5 @@ class Display {
}
}
exports.Display = Display;
module.exports = function (sys) {
return new Display(sys);
};
module.exports = { Display };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -352,7 +352,5 @@ class FFMPEG {
}
}
exports.FFMPEG = FFMPEG;
module.exports = (sys) => {
return new FFMPEG(sys);
};
module.exports = { FFMPEG };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -145,7 +145,5 @@ function map (obj : any) {
console.dir(obj);
}
*/
module.exports = (sys) => {
return new FFPROBE(sys);
};
module.exports = { FFPROBE };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffprobe/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G,CAAC,CAAC;YACpB,OAAO,KAAK,CAAA;SACZ;QACD,IAAI,CAAC,UAAU,EAAE;YAChB,iDAAiD;YACjD,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,iBAAiB,CAAC,CAAC,CAAC;YACzD,OAAO,KAAK,CAAC;SACb;QAED,IAAI,GAAG,KAAK,MAAM,EAAE;YACnB,GAAG,GAAG,UAAU,CAAC;SACjB;aAAM,IAAI,GAAG,KAAK,MAAM,EAAE;YAC1B,GAAG,GAAG,OAAO,CAAC;SACd;QACD,IAAI;YACH,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,GAAG,GAAG,MAAM,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC;SACtB;QAAC,OAAO,GAAG,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC;SACb;QAED,IAAI;YACH,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SAC9B;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,GAAG,CAAC,MAAM,CAAC;SAClB;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AA3ID,0BA2IC;AAED;;;;EAIE;AAEF,MAAM,CAAC,OAAO,GAAG,EAAE,OAAO,EAAE,CAAC"}

View File

@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilmOut = void 0;
const electron_1 = require("electron");
const animated_gif_detector_1 = __importDefault(require("animated-gif-detector"));
const path_1 = require("path");
const fs_extra_1 = require("fs-extra");
@ -46,6 +47,7 @@ class FilmOut {
enabled: false,
files: []
};
this.ipc = electron_1.ipcMain;
this.display = display;
this.server = server;
this.ffmpeg = ffmpeg;
@ -59,7 +61,6 @@ class FilmOut {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -503,7 +504,5 @@ class FilmOut {
}
}
exports.FilmOut = FilmOut;
module.exports = (display, server, ffmpeg, ffprobe, ui, light) => {
return new FilmOut(display, server, ffmpeg, ffprobe, ui, light);
};
module.exports = { FilmOut };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Light = void 0;
const electron_1 = require("electron");
const delay_1 = require("delay");
const log_1 = require("log");
class Light {
@ -9,6 +10,7 @@ class Light {
**/
constructor(arduino, cfg, ui) {
this.state = { color: [0, 0, 0] };
this.ipc = electron_1.ipcMain;
this.enabled = true;
this.id = 'light';
this.arduino = arduino;
@ -21,7 +23,6 @@ class Light {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -93,7 +94,5 @@ class Light {
}
}
exports.Light = Light;
module.exports = function (arduino, cfg, ui) {
return new Light(arduino, cfg, ui);
};
module.exports = { Light };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/light/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,iCAA8B;AAC9B,6BAA0B;AAK1B,MAAa,KAAK;IAYjB;;QAEI;IACJ,YAAa,OAAiB,EAAE,GAAS,EAAE,EAAgB;QAdpD,UAAK,GAAS,EAAE,KAAK,EAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAOlC,YAAO,GAAa,IAAI,CAAC;QAEzB,OAAE,GAAY,OAAO,CAAC;QAM7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAED;;QAEI;IACI,KAAK,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ACf,MAAM,EAAE,CAAC;QACT,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC;IAED;;QAEI;IACI,KAAK,CAAC,GAAG,CAAE,GAAc,EAAE,EAAW,EAAE,EAAW;QAC1D,IAAI,GAAG,CAAC;QACR,iBAAiB;QACjB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI;YACH,8BAA8B;YAC9B,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;SACnD;QAAC,OAAO,GAAG,EAAE;YACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,GAAG,CAAA;SACT;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD;AAhGD,sBAgGC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC"}

View File

@ -2,6 +2,7 @@
/** class representing the Projector features **/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Projector = void 0;
const electron_1 = require("electron");
const log_1 = require("log");
class Projector {
/**
@ -13,6 +14,7 @@ class Projector {
dir: true
};
this.arduino = null;
this.ipc = electron_1.ipcMain;
this.id = 'projector';
this.arduino = arduino;
this.cfg = cfg;
@ -27,7 +29,6 @@ class Projector {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -172,7 +173,5 @@ class Projector {
}
}
exports.Projector = Projector;
module.exports = function (arduino, cfg, ui, filmout, second) {
return new Projector(arduino, cfg, ui, filmout, second);
};
module.exports = { Projector };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -98,4 +98,5 @@ export declare class Sequencer {
* @param {integer} x Step to execute command at
**/
private cmdExec;
isRunning(): boolean;
}

View File

@ -1,8 +1,8 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sequencer = void 0;
const log_1 = require("log");
const electron_1 = require("electron");
const log_1 = require("log");
const delay_1 = require("delay");
/** @module lib/sequencer **/
let seq;
@ -23,6 +23,7 @@ class Sequencer {
this.arr = []; //store sequence from gui
this.loops = 1;
this.CMDS = {};
this.ipc = electron_1.ipcMain;
this.id = 'sequence';
this.alerted = false;
this.cfg = cfg;
@ -50,7 +51,6 @@ class Sequencer {
**/
async init() {
this.log = await (0, log_1.Log)({ label: this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -233,9 +233,10 @@ class Sequencer {
//@ts-ignore
return await this.cmd[cmd](this.arr[x]);
}
isRunning() {
return this.running;
}
}
exports.Sequencer = Sequencer;
module.exports = function (cfg, cmd, ui) {
return new Sequencer(cfg, cmd, ui);
};
module.exports = { Sequencer };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -200,7 +200,5 @@ class Server {
}
}
exports.Server = Server;
module.exports = function (ui) {
return new Server(ui);
};
module.exports = { Server };
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -122,5 +122,5 @@ class Settings {
;
}
exports.Settings = Settings;
module.exports = new Settings();
module.exports = { Settings };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/settings/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;AAEZ,2BAA6B;AAC7B,+BAA4B;AAC5B,0CAAyE;AAGzE,MAAa,QAAQ;IAgBpB;;QAEI;IACJ;QAlBQ,SAAI,GAAY,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,uBAAuB,CAAC,CAAC;QACzD,iBAAY,GAAS;YAC5B,MAAM,EAAG;gBACR,IAAI,EAAG,IA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,IAAI,MAAM,EAAE;YACX,GAAG,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,yBAAyB;SACzB;aAAM;YACN,IAAI,CAAC,IAAI,EAAE,CAAC;SACZ;IACF,CAAC;IACD;;QAEI;IACG,KAAK,CAAC,KAAK;QACjB,MAAM,MAAM,GAAa,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,MAAM,EAAE;YACX,IAAI;gBACH,MAAM,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACxB;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;SACD;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAAA,CAAC;CACF;AAlHD,4BAkHC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,CAAA"}

View File

@ -19,4 +19,12 @@ interface System {
tmp: string;
platform: string;
}
/**
* Profile the current system and return an object with
* data about the displays and dependencies for the digital
* projector feature.
*
* @returns {object} Object containing system information
*/
export declare function system(ui: any): Promise<System>;
export type { System, Display, Dependencies };

View File

@ -1,5 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.system = void 0;
const os_1 = require("os");
const electron_1 = require("electron");
const exec_1 = require("exec");
@ -123,5 +124,6 @@ async function system(ui) {
}, 3000);
return obj;
}
module.exports = system;
exports.system = system;
module.exports = { system };
//# sourceMappingURL=index.js.map

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,2BAA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CAAA;IAC/B,GAAG,CAAC,IAAI,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5C,UAAU,CAAC,GAAG,EAAE;QACf,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,GAAG,CAAC;AACZ,CAAC;AAjCD,wBAiCC;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,MAAM,EAAE,CAAC"}

1
app/main.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export {};

View File

@ -1,153 +1,144 @@
/* jshint esversion: 6, asi: true, strict: true*/
/* global require, setTimeout, process, console*/
'use strict'
//process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
const electron = require('electron')
const { Menu, BrowserWindow, app } = electron
const { EventEmitter } = require('events')
const { join } = require('path')
require('@electron/remote/main').initialize()
const ee = new EventEmitter()
const settings = require('settings')
const system = require('system')
const { delay } = require('delay')
const { Log } = require('log')
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const electron_1 = require("electron");
const events_1 = require("events");
const path_1 = require("path");
const settings_1 = require("settings");
const system_1 = require("system");
const log_1 = require("log");
const arduino_1 = require("arduino");
const cam_1 = require("cam");
const proj_1 = require("proj");
const light_1 = require("light");
const capper_1 = require("capper");
const alert_1 = require("alert");
const display_1 = require("display");
const filmout_1 = require("filmout");
const ffmpeg_1 = require("ffmpeg");
const ffprobe_1 = require("ffprobe");
const devices_1 = require("devices");
const cmd_1 = require("cmd");
const sequencer_1 = require("sequencer");
const server_1 = require("server");
require('@electron/remote/main').initialize();
const ee = new events_1.EventEmitter();
//Objects
const mcopy = {}
let SYSTEM
let log
let mainWindow
let arduino
let menu
let display
let ffmpeg
let ffprobe
let cam
let cam2
let proj
let proj2
let light
let filmout
let dev
let cmd
let seq
let capper
let alert
let server
const cfg = require('./data/cfg.json')
const mcopy = {};
let SYSTEM;
let settings;
let log;
let mainWindow;
let arduino;
let menu;
let display;
let ffmpeg;
let ffprobe;
let cam;
let cam2;
let proj;
let proj2;
let light;
let filmout;
let dev;
let cmd;
let seq;
let capper;
let alert;
let server;
const cfg = require('./data/cfg.json');
var createMenu = function () {
const template = require('./data/menu.json')
menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
const template = require('./data/menu.json');
menu = electron_1.Menu.buildFromTemplate(template);
electron_1.Menu.setApplicationMenu(menu);
};
var createWindow = function () {
mainWindow = new BrowserWindow({
const windowOptions = {
width: 800,
height: 600,
minWidth: 800,
minHeight: 600,
icon: join(__dirname, 'assets/icons/icon.png'),
icon: (0, path_1.join)(__dirname, 'assets/icons/icon.png'),
skipTaskbar: true,
toolbar: false,
//toolbar: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
//enableRemoteModule: true,
contextIsolation: false
}
})
mainWindow.loadURL('file://' + __dirname + '/index.html')
};
mainWindow = new electron_1.BrowserWindow(windowOptions);
mainWindow.loadURL('file://' + __dirname + '/index.html');
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
mainWindow.webContents.openDevTools()
} else {
mainWindow.setMenu(null)
mainWindow.setAutoHideMenuBar(true)
mainWindow.webContents.openDevTools();
}
else {
mainWindow.setMenu(null);
mainWindow.setAutoHideMenuBar(true);
}
mainWindow.on('closed', () => {
mainWindow = null
})
require('@electron/remote/main').enable(mainWindow.webContents)
}
mainWindow = null;
});
require('@electron/remote/main').enable(mainWindow.webContents);
};
var errorState = function () {
if (seq && seq.running) {
if (seq && seq.isRunning()) {
//pause sequence if running
seq.pause();
}
mainWindow.webContents.send('error_state', { stop: true });
}
};
var init = async function () {
log = await Log({ label : 'mcopy' })
createWindow()
createMenu()
log = await (0, log_1.Log)({ label: 'mcopy' });
createWindow();
createMenu();
try {
SYSTEM = await system(mainWindow.webContents)
} catch (err) {
console.error(err)
SYSTEM = await (0, system_1.system)(mainWindow.webContents);
}
await settings.restore()
display = require('display')(SYSTEM)
ffmpeg = require('ffmpeg')(SYSTEM)
ffprobe = require('ffprobe')(SYSTEM)
arduino = require('arduino')(cfg, ee, errorState)
dev = require('devices')(arduino, settings, mainWindow)
server = require('server')(mainWindow.webContents)
light = require('light')(arduino, cfg, mainWindow.webContents)
filmout = require('filmout')(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
cam = require('cam')(arduino, cfg, mainWindow.webContents, filmout)
proj = require('proj')(arduino, cfg, mainWindow.webContents, filmout)
alert = require('alert')(mainWindow.webContents)
catch (err) {
console.error(err);
}
settings = new settings_1.Settings();
await settings.restore();
display = new display_1.Display(SYSTEM);
ffmpeg = new ffmpeg_1.FFMPEG(SYSTEM);
ffprobe = new ffprobe_1.FFPROBE(SYSTEM);
arduino = new arduino_1.Arduino(cfg, ee, errorState);
dev = new devices_1.Devices(arduino, settings, mainWindow);
server = new server_1.Server(mainWindow.webContents);
light = new light_1.Light(arduino, cfg, mainWindow.webContents);
filmout = new filmout_1.FilmOut(display, server, ffmpeg, ffprobe, mainWindow.webContents, light);
cam = new cam_1.Camera(arduino, cfg, mainWindow.webContents, filmout);
proj = new proj_1.Projector(arduino, cfg, mainWindow.webContents, filmout);
alert = new alert_1.Alert(mainWindow.webContents);
try {
await dev.enumerate()
} catch (err) {
log.error('Error enumerating connected devices', err)
await dev.enumerate();
}
catch (err) {
log.error('Error enumerating connected devices', err);
}
if (dev && dev.connected && dev.connected.camera_second) {
cam2 = require('cam')(arduino, cfg, mainWindow.webContents, filmout, true)
cam2 = new cam_1.Camera(arduino, cfg, mainWindow.webContents, filmout, true);
}
if (dev && dev.connected && dev.connected.projector_second) {
proj2 = require('proj')(arduino, cfg, mainWindow.webContents, filmout, true)
proj2 = new proj_1.Projector(arduino, cfg, mainWindow.webContents, filmout, true);
}
if (dev && dev.connected && dev.connected.capper) {
capper = require('capper')(arduino, cfg, mainWindow.webContents, filmout, true)
capper = new capper_1.Capper(arduino, cfg, mainWindow.webContents, filmout);
}
cmd = require('cmd')(cfg, proj, cam, light, alert, cam2, proj2, capper)
seq = require('sequencer')(cfg, cmd, mainWindow.webContents)
}
app.on('ready', init)
app.on('window-all-closed', () => {
app.quit()
cmd = new cmd_1.Commands(cfg, proj, cam, light, alert, cam2, proj2, capper);
seq = new sequencer_1.Sequencer(cfg, cmd, mainWindow.webContents);
};
electron_1.app.on('ready', init);
electron_1.app.on('window-all-closed', () => {
electron_1.app.quit();
});
app.on('activate', () => {
electron_1.app.on('activate', () => {
if (mainWindow === null) {
createWindow()
createWindow();
}
});
mcopy.relaunch = function () {
app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])})
app.exit(0)
}
electron_1.app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) });
electron_1.app.exit(0);
};
//# sourceMappingURL=main.js.map

1
app/main.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAAoF;AACpF,mCAAqC;AACrC,+BAA2B;AAC3B,uCAAmC;AACnC,mCAA+B;AAG/B,6BAAyB;AAEzB,qCAAiC;AACjC,6BAA4B;AAC5B,+BAAgC;AAChC,iCAA6B;AAC7B,mCAA+B;AAC/B,iCAA6B;AAC7B,qCAAiC;AACjC,qCAAiC;AACjC,mCAA+B;AAC/B,qCAAiC;AACjC,qCAAiC;AACjC,6BAA8B;AAC9B,yCAAqC;AACrC,mCAA+B;AAE/B,OAAO,CAAC,uBAAuB,CAAC,CAAC,UAAU,EAAE,CAAA;AAE7C,MAAM,EAAE,GAAkB,IAAI,qBAAY,EAAE,CAAA;AAE5C,SAAS;AACT,MAAM,KAAK,GAAS,EAAE,CAAA;AAEtB,IAAI,MAAe,CAAA;AACnB,IAAI,QAAmB,CAAA;AACvB,IAAI,GAAY,CAAA;AAChB,IAAI,UAA0B,CAAA;AAC9B,IAAI,OAAiB,CAAA;AACrB,IAAI,IAAI,CAAA;AACR,IAAI,OAAiB,CAAA;AACrB,IAAI,MAAe,CAAA;AACnB,IAA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C1E;IACD,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE;QACjD,MAAM,GAAG,IAAI,eAAM,CAAC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;KAClE;IAED,GAAG,GAAG,IAAI,cAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACrE,GAAG,GAAG,IAAI,qBAAS,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,cAAG,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AAErB,cAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAChC,cAAG,CAAC,IAAI,EAAE,CAAA;AACX,CAAC,CAAC,CAAC;AAEH,cAAG,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;IACvB,IAAI,UAAU,KAAK,IAAI,EAAE;QACxB,YAAY,EAAE,CAAA;KACd;AACF,CAAC,CAAC,CAAC;AAEH,KAAK,CAAC,QAAQ,GAAG;IAChB,cAAG,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,EAAC,CAAC,CAAA;IAClE,cAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACZ,CAAC,CAAA"}

2
app/package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "mcopy-app",
"version": "1.8.110",
"version": "1.8.111",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@ -1,6 +1,6 @@
{
"name": "mcopy-app",
"version": "1.8.110",
"version": "1.8.111",
"description": "GUI for the mcopy small gauge film optical printer platform",
"main": "main.js",
"scripts": {

View File

@ -5,6 +5,7 @@ set -e
# compile main process code
cd ..
npm run compile
cd ./app
# compile renderer process code

View File

@ -1,5 +1,5 @@
{
"version": "1.8.110",
"version": "1.8.111",
"ext_port": 1111,
"profiles": {
"mcopy": {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "mcopy",
"version": "1.8.110",
"version": "1.8.111",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mcopy",
"version": "1.8.110",
"version": "1.8.111",
"license": "MIT",
"dependencies": {
"alert": "file:app/lib/alert",

View File

@ -1,6 +1,6 @@
{
"name": "mcopy",
"version": "1.8.110",
"version": "1.8.111",
"description": "Small gauge film optical printer platform",
"main": "build.js",
"directories": {

View File

@ -1,5 +1,5 @@
{
"version": "1.8.110",
"version": "1.8.111",
"ext_port": 1111,
"profiles": {
"mcopy": {

View File

@ -12,3 +12,4 @@ rm -r ./lib
cp ./data/cfg.json ./app/data/
cp ./data/cfg.json ./processing/mcopy/
mv ./app/lib/main.* ./app/

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
@ -8,7 +9,7 @@ import type { WebContents } from 'electron';
/* class representing alert functionality */
export class Alert {
private ipc : any
private ipc : typeof ipcMain = ipcMain
private log : Logger
private id : string = 'alert'
private cb : Function = null
@ -24,7 +25,6 @@ export class Alert {
**/
private async init () {
this.log = await Log({ label : this.id })
this.ipc = require('electron').ipcMain
this.listen()
}
@ -65,6 +65,4 @@ export class Alert {
}
}
module.exports = function (ui : WebContents) {
return new Alert(ui);
}
module.exports = { Alert }

View File

@ -18,6 +18,7 @@ import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Device } from 'devices';
import type { EventEmitter } from 'events'
const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline');
@ -27,10 +28,6 @@ const parser : any = new ReadlineParser({ delimiter: '\r\n' });
const newlineRe : RegExp = new RegExp('\n', 'g');
const returnRe : RegExp = new RegExp('\r', 'g');
let eventEmitter : any;
let cfg : any;
let arduino : Arduino;
const KNOWN : string[] = [
'/dev/tty.usbmodem1a161',
'/dev/tty.usbserial-A800f8dk',
@ -49,6 +46,8 @@ const KNOWN : string[] = [
export class Arduino {
private log : Logger;
private eventEmitter : EventEmitter;
private cfg : any = {};
private path : any = {};
private known : string[] = KNOWN;
private serial : any = {};
@ -65,15 +64,17 @@ export class Arduino {
public stateStr : any = {};
public hasState : any = {};
constructor (errorState : Function) {
constructor ( cfg : any, ee : EventEmitter, errorState : Function) {
this.cfg = cfg;
this.eventEmitter = ee;
this.errorState = errorState;
this.init()
this.init();
}
async init () {
this.log = await Log({ label : 'arduino' });
this.keys = Object.keys(cfg.arduino.cmd);
this.values = this.keys.map((key : string) => cfg.arduino.cmd[key]);
this.keys = Object.keys(this.cfg.arduino.cmd);
this.values = this.keys.map((key : string) => this.cfg.arduino.cmd[key]);
}
/**
@ -158,7 +159,7 @@ export class Arduino {
}
this.timer = new Date().getTime()
this.lock(serial)
await delay(cfg.arduino.serialDelay)
await delay(this.cfg.arduino.serialDelay)
try {
ms = await this.sendAsync(device, cmd)
} catch (e) {
@ -167,7 +168,7 @@ export class Arduino {
}
this.unlock(serial)
await eventEmitter.emit('arduino_send', cmd)
await this.eventEmitter.emit('arduino_send', cmd)
return ms
}
@ -184,7 +185,7 @@ export class Arduino {
**/
public async sendString (device : string, str : string) : Promise<any> {
let writeSuccess : any
await delay(cfg.arduino.serialDelay)
await delay(this.cfg.arduino.serialDelay)
if (typeof this.serial[this.alias[device]].fake !== 'undefined'
&& this.serial[this.alias[device]].fake) {
return this.serial[this.alias[device]].string(str)
@ -205,7 +206,7 @@ export class Arduino {
*
**/
private async stateAsync (device : string, confirm : boolean = false) : Promise<string> {
const cmd : string = cfg.arduino.cmd.state
const cmd : string = this.cfg.arduino.cmd.state
const serial : string = confirm ? this.alias['connect'] : this.alias[device]
return new Promise ((resolve, reject) => {
this.queue[cmd] = (state : string) => {
@ -250,7 +251,7 @@ export class Arduino {
this.timer = new Date().getTime()
this.lock(serial)
await delay(cfg.arduino.serialDelay)
await delay(this.cfg.arduino.serialDelay)
try {
results = await this.stateAsync(device, confirm)
@ -260,7 +261,7 @@ export class Arduino {
}
this.unlock(serial)
await eventEmitter.emit('arduino_state', cfg.arduino.cmd.state)
await this.eventEmitter.emit('arduino_state', this.cfg.arduino.cmd.state)
return results
}
@ -300,16 +301,16 @@ export class Arduino {
if (this.queue[data] !== undefined) {
this.unlock(serial)
complete = this.queue[data](ms) //execute callback
eventEmitter.emit('arduino_end', data)
this.eventEmitter.emit('arduino_end', data)
delete this.queue[data]
} else if (data[0] === cfg.arduino.cmd.state) {
} else if (data[0] === this.cfg.arduino.cmd.state) {
//this.log.info(`end serial -> ${serial}`)
this.unlock(serial)
complete = this.queue[cfg.arduino.cmd.state](data)
eventEmitter.emit('arduino_end', data)
delete this.queue[cfg.arduino.cmd.state]
complete = this.queue[this.cfg.arduino.cmd.state](data)
this.eventEmitter.emit('arduino_end', data)
delete this.queue[this.cfg.arduino.cmd.state]
return data
} else if (data[0] === cfg.arduino.cmd.error) {
} else if (data[0] === this.cfg.arduino.cmd.error) {
this.log.error(`Received error from device ${serial}`)
this.unlock(serial)
this.error(serial, data)
@ -358,7 +359,7 @@ export class Arduino {
this.serial[serial] = new SerialPort({
path : serial,
autoOpen : false,
baudRate: cfg.arduino.baud,
baudRate: this.cfg.arduino.baud,
parser
})
this.unlock(serial)
@ -397,9 +398,9 @@ export class Arduino {
this.confirmExec(null, data)
this.confirmExec = null
this.unlock(this.alias['connect'])
} else if (data[0] === cfg.arduino.cmd.state) {
this.queue[cfg.arduino.cmd.state](data)
delete this.queue[cfg.arduino.cmd.state]
} else if (data[0] === this.cfg.arduino.cmd.state) {
this.queue[this.cfg.arduino.cmd.state](data)
delete this.queue[this.cfg.arduino.cmd.state]
this.unlock(this.alias['connect'])
}
}
@ -416,17 +417,17 @@ export class Arduino {
const device : string = 'connect'
let writeSuccess : any
this.confirmExec = function (err : Error, data : string) {
if (data === cfg.arduino.cmd.connect) {
if (data === this.cfg.arduino.cmd.connect) {
return resolve(true)
} else {
return reject('Wrong data returned')
}
}
await delay(cfg.arduino.serialDelay)
await delay(this.cfg.arduino.serialDelay)
try {
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.connect)
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.connect)
} catch (e) {
return reject(e)
}
@ -447,48 +448,48 @@ export class Arduino {
let writeSuccess : any
let type : string
this.confirmExec = function (err : Error, data : string) {
if (data === cfg.arduino.cmd.projector_identifier) {
if (data === this.cfg.arduino.cmd.projector_identifier) {
type = 'projector'
} else if (data === cfg.arduino.cmd.camera_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_identifier) {
type = 'camera'
} else if (data === cfg.arduino.cmd.light_identifier) {
} else if (data === this.cfg.arduino.cmd.light_identifier) {
type = 'light'
} else if (data === cfg.arduino.cmd.projector_light_identifier) {
} else if (data === this.cfg.arduino.cmd.projector_light_identifier) {
type = 'projector,light'
} else if (data === cfg.arduino.cmd.projector_camera_light_identifier) {
} else if (data === this.cfg.arduino.cmd.projector_camera_light_identifier) {
type = 'projector,camera,light'
} else if (data === cfg.arduino.cmd.projector_camera_identifier) {
} else if (data === this.cfg.arduino.cmd.projector_camera_identifier) {
type = 'projector,camera'
} else if (data === cfg.arduino.cmd.projector_second_identifier) {
} else if (data === this.cfg.arduino.cmd.projector_second_identifier) {
type = 'projector_second'
} else if (data === cfg.arduino.cmd.projectors_identifier) {
} else if (data === this.cfg.arduino.cmd.projectors_identifier) {
type = 'projector,projector_second'
} else if (data === cfg.arduino.cmd.camera_second_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_second_identifier) {
type = 'camera_second'
} else if (data === cfg.arduino.cmd.cameras_identifier) {
} else if (data === this.cfg.arduino.cmd.cameras_identifier) {
type = 'camera,camera_second'
} else if (data === cfg.arduino.cmd.camera_projectors_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_projectors_identifier) {
type = 'camera,projector,projector_second'
} else if (data === cfg.arduino.cmd.cameras_projector_identifier) {
} else if (data === this.cfg.arduino.cmd.cameras_projector_identifier) {
type = 'camera,camera_second,projector'
} else if (data === cfg.arduino.cmd.cameras_projectors_identifier) {
} else if (data === this.cfg.arduino.cmd.cameras_projectors_identifier) {
type = 'camera,camera_second,projector,projector_second'
} else if (data === cfg.arduino.cmd.capper_identifier) {
} else if (data === this.cfg.arduino.cmd.capper_identifier) {
type = 'capper'
} else if (data === cfg.arduino.cmd.camera_capper_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_capper_identifier) {
type = 'camera,capper'
} else if (data === cfg.arduino.cmd.camera_capper_projector_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_capper_projector_identifier) {
type = 'camera,capper,projector'
} else if (data === cfg.arduino.cmd.camera_capper_projectors_identifier) {
} else if (data === this.cfg.arduino.cmd.camera_capper_projectors_identifier) {
type = 'camera,capper,projector,projector_second'
}
return resolve(type)
}
await delay(cfg.arduino.serialDelay)
await delay(this.cfg.arduino.serialDelay)
try {
writeSuccess = await this.sendAsync(device, cfg.arduino.cmd.mcopy_identifier)
writeSuccess = await this.sendAsync(device, this.cfg.arduino.cmd.mcopy_identifier)
this.log.info(writeSuccess)
} catch (e) {
return reject(e)
@ -526,21 +527,21 @@ export class Arduino {
this.serial[serial] = {
write : async function (cmd : string, cb : any) {
const t : any = {
c : cfg.arduino.cam.time + cfg.arduino.cam.delay,
p : cfg.arduino.proj.time + cfg.arduino.proj.delay,
c : this.cfg.arduino.cam.time + this.cfg.arduino.cam.delay,
p : this.cfg.arduino.proj.time + this.cfg.arduino.proj.delay,
A : 180,
B : 180
}
let timeout : number = t[cmd]
if (typeof timeout === 'undefined') timeout = 10
arduino.timer = +new Date()
this.timer = +new Date()
await delay(timeout)
arduino.end(serial, cmd)
this.end(serial, cmd)
return cb()
},
}.bind(this),
string : async function (str : string) {
//do nothing
return true
@ -602,11 +603,4 @@ export class Arduino {
}
}
if (typeof module !== 'undefined' && module.parent) {
module.exports = function (c : any, ee : any, errorState : Function) {
eventEmitter = ee
cfg = c
arduino = new Arduino(errorState)
return arduino
}
}
module.exports = { Arduino }

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { Intval } from 'intval';
import { Processing } from 'processing';
import { delay } from 'delay';
@ -29,7 +30,7 @@ export class Camera {
private cfg : any;
private filmout : FilmOut;
private ui : WebContents;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private id : string = 'camera';
/**
*
@ -48,7 +49,6 @@ export class Camera {
**/
private async init () {
this.log = await Log({ label : this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
@ -336,6 +336,4 @@ export class Camera {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean) {
return new Camera(arduino, cfg, ui, filmout, second);
}
module.exports = { Camera };

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { Intval } from 'intval';
import { Processing } from 'processing';
import { delay } from 'delay';
@ -20,7 +21,7 @@ export class Capper {
private cfg : any;
private filmout : FilmOut;
private ui : WebContents;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private id : string = 'capper';
/**
*
@ -38,7 +39,6 @@ export class Capper {
**/
private async init () {
this.log = await Log({ label : this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
@ -107,6 +107,4 @@ export class Capper {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout: FilmOut) {
return new Capper(arduino, cfg, ui, filmout);
}
module.exports = { Capper }

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { v4 as uuid } from 'uuid';
import { delay } from 'delay';
import type { Projector } from 'proj';
@ -21,7 +22,7 @@ export class Commands {
public alertObj : Alert;
private cfg : any;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
/**
* @constructor
@ -49,7 +50,6 @@ export class Commands {
if (proj2 !== null) this.proj2 = proj2;
if (capper !== null) this.capper = capper;
this.ipc = require('electron').ipcMain;
}
/**
@ -649,6 +649,4 @@ export class Commands {
}
}
module.exports = function (cfg : any, proj : any, cam : any, light : any, alert : any, cam2 : any, proj2 : any, capper : any) {
return new Commands(cfg, proj, cam, light, alert, cam2, proj2, capper);
}
module.exports = { Commands };

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
@ -26,7 +27,7 @@ export class Devices {
private arduino : Arduino;
private log : Logger;
private ui : WebContents;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private mainWindow : any
/**
* Constructor assigns arduino, settings, UI browser window and cam objects
@ -45,7 +46,6 @@ export class Devices {
**/
private async init () {
this.log = await Log({ label : 'devices' })
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -591,8 +591,5 @@ export class Devices {
}
module.exports = function (arduino : Arduino, settings : any, mainWindow : BrowserWindow) {
return new Devices(arduino, settings, mainWindow)
}
module.exports = { Devices }
export type { Device }

View File

@ -5,12 +5,13 @@
* Provides features for displaying a full screen display of images for the digital module.
**/
import { ipcMain, BrowserWindow } from 'electron';
import { join as pathJoin, normalize as pathNormalize } from 'path';
import { format as urlFormat } from 'url';
import { delay } from 'delay';
import { Log } from 'log';
import type { BrowserWindowConstructorOptions } from 'electron';
import type { Logger } from 'winston';
import { BrowserWindow } from 'electron';
import type { System, Display as SystemDisplay } from 'system';
class WebView {
@ -20,15 +21,15 @@ class WebView {
private platform : string;
public display : any; //needs type
private loadWait : any = {};
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private log : Logger;
constructor (platform : string, display : any) {
const prefs : any = {
const prefs : BrowserWindowConstructorOptions = {
webPreferences: {
nodeIntegration: true,
allowRunningInsecureContent: false,
enableRemoteModule: true,
//enableRemoteModule: true,
contextIsolation: false
},
width: 800,
@ -62,8 +63,6 @@ class WebView {
this.platform = platform;
this.display = display;
this.ipc = require('electron').ipcMain;
this.ipc.on('display_load', this.onLoad.bind(this));
}
async init () {
@ -210,6 +209,4 @@ export class Display {
}
}
module.exports = function (sys : any) {
return new Display(sys)
}
module.exports = { Display }

View File

@ -406,8 +406,6 @@ export class FFMPEG {
}
module.exports = (sys : System) => {
return new FFMPEG(sys);
}
module.exports = { FFMPEG };
export type { StdErr };

View File

@ -156,6 +156,4 @@ function map (obj : any) {
}
*/
module.exports = (sys : System) => {
return new FFPROBE(sys);
}
module.exports = { FFPROBE };

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { default as animated } from 'animated-gif-detector';
import { extname, join } from 'path';
import { readFile, lstat, readdir } from 'fs-extra';
@ -59,7 +60,7 @@ export class FilmOut {
private ffmpeg : FFMPEG;
private ffprobe : FFPROBE;
private light : Light;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private ui : WebContents;
private log : Logger;
@ -89,7 +90,6 @@ export class FilmOut {
**/
private async init () {
this.log = await Log({ label : this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
/**
@ -543,8 +543,6 @@ export class FilmOut {
}
}
module.exports = (display : Display, server : Server, ffmpeg : FFMPEG, ffprobe : FFPROBE, ui : WebContents, light : Light) => {
return new FilmOut(display, server, ffmpeg, ffprobe, ui, light);
}
module.exports = { FilmOut };
export type { FilmOutState };

View File

@ -1,5 +1,6 @@
'use strict';
import { ipcMain } from 'electron';
import { delay } from 'delay';
import { Log } from 'log';
import type { Logger } from 'winston';
@ -13,7 +14,7 @@ export class Light {
private cfg : any;
private ui : WebContents;
private log : Logger;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private enabled : boolean = true;
private id : string = 'light';
@ -33,7 +34,6 @@ export class Light {
**/
private async init () {
this.log = await Log({ label : this.id });
this.ipc = require('electron').ipcMain;
this.listen();
}
@ -105,6 +105,4 @@ export class Light {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents) {
return new Light(arduino, cfg, ui);
}
module.exports = { Light };

164
src/main.ts Normal file
View File

@ -0,0 +1,164 @@
import { Menu, BrowserWindow, BrowserWindowConstructorOptions, app } from 'electron'
import { EventEmitter } from 'events'
import { join } from 'path'
import { Settings } from 'settings'
import { system } from 'system'
import type { System } from 'system'
import { delay } from 'delay'
import { Log } from 'log'
import type { Logger } from 'winston'
import { Arduino } from 'arduino'
import { Camera } from 'cam'
import { Projector } from 'proj'
import { Light } from 'light'
import { Capper } from 'capper'
import { Alert } from 'alert'
import { Display } from 'display'
import { FilmOut } from 'filmout'
import { FFMPEG } from 'ffmpeg'
import { FFPROBE } from 'ffprobe'
import { Devices } from 'devices'
import { Commands } from 'cmd'
import { Sequencer } from 'sequencer'
import { Server } from 'server'
require('@electron/remote/main').initialize()
const ee : EventEmitter = new EventEmitter()
//Objects
const mcopy : any = {}
let SYSTEM : System
let settings : Settings
let log : Logger
let mainWindow : BrowserWindow
let arduino : Arduino
let menu
let display : Display
let ffmpeg : FFMPEG
let ffprobe : FFPROBE
let cam : Camera
let cam2 : Camera
let proj : Projector
let proj2 : Projector
let light : Light
let filmout : FilmOut
let dev : Devices
let cmd : Commands
let seq : Sequencer
let capper : Capper
let alert : Alert
let server : Server
const cfg : any = require('./data/cfg.json')
var createMenu = function () {
const template = require('./data/menu.json')
menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
var createWindow = function () {
const windowOptions : BrowserWindowConstructorOptions = {
width: 800,
height: 600,
minWidth : 800,
minHeight : 600,
icon: join(__dirname, 'assets/icons/icon.png'),
skipTaskbar: true,
//toolbar: false,
webPreferences : {
nodeIntegration : true,
//enableRemoteModule: true,
contextIsolation : false
}
};
mainWindow = new BrowserWindow(windowOptions)
mainWindow.loadURL('file://' + __dirname + '/index.html')
if (process.argv.indexOf('-d') !== -1 || process.argv.indexOf('--dev') !== -1) {
mainWindow.webContents.openDevTools()
} else {
mainWindow.setMenu(null)
mainWindow.setAutoHideMenuBar(true)
}
mainWindow.on('closed', () => {
mainWindow = null
})
require('@electron/remote/main').enable(mainWindow.webContents)
}
var errorState = function () {
if (seq && seq.isRunning()) {
//pause sequence if running
seq.pause();
}
mainWindow.webContents.send('error_state', { stop : true });
}
var init = async function () {
log = await Log({ label : 'mcopy' })
createWindow()
createMenu()
try {
SYSTEM = await system(mainWindow.webContents)
} catch (err) {
console.error(err)
}
settings = new Settings()
await settings.restore()
display = new Display(SYSTEM)
ffmpeg = new FFMPEG(SYSTEM)
ffprobe = new FFPROBE(SYSTEM)
arduino = new Arduino(cfg, ee, errorState)
dev = new Devices(arduino, settings, mainWindow)
server = new Server(mainWindow.webContents)
light = new Light(arduino, cfg, mainWindow.webContents)
filmout = new FilmOut(display, server, ffmpeg, ffprobe, mainWindow.webContents, light)
cam = new Camera(arduino, cfg, mainWindow.webContents, filmout)
proj = new Projector(arduino, cfg, mainWindow.webContents, filmout)
alert = new Alert(mainWindow.webContents)
try {
await dev.enumerate()
} catch (err) {
log.error('Error enumerating connected devices', err)
}
if (dev && dev.connected && dev.connected.camera_second) {
cam2 = new Camera(arduino, cfg, mainWindow.webContents, filmout, true)
}
if (dev && dev.connected && dev.connected.projector_second) {
proj2 = new Projector(arduino, cfg, mainWindow.webContents, filmout, true)
}
if (dev && dev.connected && dev.connected.capper) {
capper = new Capper(arduino, cfg, mainWindow.webContents, filmout)
}
cmd = new Commands(cfg, proj, cam, light, alert, cam2, proj2, capper)
seq = new Sequencer(cfg, cmd, mainWindow.webContents)
}
app.on('ready', init)
app.on('window-all-closed', () => {
app.quit()
});
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
});
mcopy.relaunch = function () {
app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])})
app.exit(0)
}

View File

@ -1,5 +1,6 @@
/** class representing the Projector features **/
import { ipcMain } from 'electron';
import { Log } from 'log';
import type { Logger } from 'winston';
import type { Arduino } from 'arduino';
@ -20,7 +21,7 @@ export class Projector {
private log : Logger;
private cfg : any;
private ui : WebContents;
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
public filmout : FilmOut;
private id : string = 'projector';
@ -41,7 +42,6 @@ export class Projector {
**/
private async init () {
this.log = await Log({ label : this.id })
this.ipc = require('electron').ipcMain;
this.listen();
}
@ -173,8 +173,6 @@ export class Projector {
}
}
module.exports = function (arduino : Arduino, cfg : any, ui : WebContents, filmout : FilmOut, second : boolean) {
return new Projector(arduino, cfg, ui, filmout, second)
}
module.exports = { Projector }
export type { ProjectorState }

View File

@ -1,9 +1,9 @@
'use strict';
import { ipcMain, powerSaveBlocker } from 'electron';
import { v4 as uuid } from 'uuid';
import { Log } from 'log';
import type { Logger } from 'winston';
import { powerSaveBlocker } from 'electron'
import { delay } from 'delay';
import { Commands } from 'cmd';
import type { WebContents } from 'electron';
@ -25,7 +25,7 @@ export class Sequencer {
private cfg : any;
private cmd : Commands;
private CMDS : any = {};
private ipc : any;
private ipc : typeof ipcMain = ipcMain;
private ui : WebContents;
private log : Logger;
private id : string = 'sequence';
@ -69,7 +69,6 @@ export class Sequencer {
**/
private async init () {
this.log = await Log({ label : this.id })
this.ipc = require('electron').ipcMain;
this.listen();
}
@ -270,8 +269,10 @@ export class Sequencer {
//@ts-ignore
return await this.cmd[cmd](this.arr[x]);
}
public isRunning () : boolean {
return this.running;
}
}
module.exports = function (cfg : any, cmd : Commands, ui : WebContents) {
return new Sequencer(cfg, cmd, ui);
}
module.exports = { Sequencer };

View File

@ -252,8 +252,6 @@ export class Server {
}
}
module.exports = function (ui : WebContents) {
return new Server(ui)
}
module.exports = { Server }
export type { ServerData, ServerTemplate, ServerProxy, ServerProxyList, ServerQueue };

View File

@ -121,4 +121,4 @@ export class Settings {
};
}
module.exports = new Settings();
module.exports = { Settings }

View File

@ -124,7 +124,7 @@ async function displays () : Promise<Display[]> {
*
* @returns {object} Object containing system information
*/
async function system (ui : any) : Promise<System> {
export async function system (ui : any) : Promise<System> {
const obj : System = {
deps : null,
displays : null,
@ -159,6 +159,6 @@ async function system (ui : any) : Promise<System> {
return obj;
}
module.exports = system;
module.exports = { system };
export type { System, Display, Dependencies };