electron-node-red/main.js

560 wiersze
19 KiB
JavaScript

2016-05-06 12:18:15 +00:00
2016-03-09 21:49:41 +00:00
'use strict';
const pkg = require('./package.json');
let options;
if (pkg.hasOwnProperty("NRelectron")) { options = pkg["NRelectron"] }
let packages;
if (pkg.hasOwnProperty("dependencies")) { packages = pkg["dependencies"] }
2016-03-09 21:49:41 +00:00
// Some settings you can edit if you don't set them in package.json
//console.log(options)
2020-10-05 22:57:58 +00:00
const editable = options.editable || false; // set this to false to create a run only application - no editor/no console
const allowLoadSave = options.allowLoadSave || false; // set to true to allow import and export of flow file
let showMap = options.showMap || false; // set to true to add Worldmap to the menu
const kioskMode = options.kioskMode || false; // set to true to start in kiosk mode
2020-10-05 22:57:58 +00:00
const addNodes = options.addNodes || false; // set to false to block installing extra nodes
let flowfile = options.flowFile || 'electronflow.json'; // default Flows file name - loaded at start
2019-10-23 23:00:08 +00:00
2019-11-14 21:37:47 +00:00
const urldash = "/ui/#/0"; // url for the dashboard page
const urledit = "/red"; // url for the editor page
const urlconsole = "/console.htm"; // url for the console page
const urlmap = "/worldmap"; // url for the worldmap
const nrIcon = "nodered.png" // Icon for the app in root dir (usually 256x256)
let urlStart = urldash; // Start on this page
if (!packages.hasOwnProperty("node-red-dashboard")) { urlStart = urledit; }
if (options.start.toLowerCase() === "editor") { urlStart = urledit; }
if (options.start.toLowerCase() === "map") { urlStart = urlmap; }
if (!packages.hasOwnProperty("node-red-contrib-web-worldmap")) { showMap = false; }
2019-10-23 23:00:08 +00:00
// TCP port to use
//const listenPort = "18880"; // fix it if you like
const listenPort = parseInt(Math.random()*16383+49152) // or random ephemeral port
2016-10-30 22:06:48 +00:00
const os = require('os');
const fs = require('fs');
2018-08-20 20:16:39 +00:00
const url = require('url');
const path = require('path');
const http = require('http');
const express = require("express");
2016-03-09 21:49:41 +00:00
const electron = require('electron');
2020-10-05 22:57:58 +00:00
const Store = require('electron-store');
2024-01-23 14:12:26 +00:00
const store = new Store()
var isDev
(async () => { isDev = await import('electron-is-dev'); })()
2018-08-20 20:16:39 +00:00
2020-10-03 17:50:44 +00:00
const {app, Menu, TouchBar} = electron;
const ipc = electron.ipcMain;
const dialog = electron.dialog;
2016-03-09 21:49:41 +00:00
const BrowserWindow = electron.BrowserWindow;
2020-06-01 16:38:23 +00:00
const Tray = electron.Tray;
const { TouchBarButton, TouchBarSpacer } = TouchBar;
2016-10-30 22:06:48 +00:00
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) { console.log("Second instance - quitting."); app.quit(); }
2016-03-09 21:49:41 +00:00
var RED = require("node-red");
var red_app = express();
// Add a simple route for static content served from 'public'
2018-08-20 20:16:39 +00:00
red_app.use("/",express.static("web"));
//red_app.use(express.static(__dirname +"/public"));
2016-03-09 21:49:41 +00:00
// Create a server
var server = http.createServer(red_app);
// Setup user directory and flowfile (if editable)
var userdir = __dirname;
2020-10-05 22:57:58 +00:00
if (editable === true) {
// if running as raw electron use the current directory (mainly for dev)
if (process.argv[1] && (process.argv[1] === "main.js")) {
userdir = __dirname;
if ((process.argv.length > 2) && ((process.argv[process.argv.length-1].indexOf(".json") > -1)||(process.argv[process.argv.length-1].indexOf(".flow") > -1))) {
if (path.isAbsolute(process.argv[process.argv.length-1])) {
flowfile = process.argv[process.argv.length-1];
}
else {
flowfile = path.join(process.cwd(),process.argv[process.argv.length-1]);
}
2020-10-05 22:57:58 +00:00
store.set("electronFlow",flowfile)
}
2020-10-05 23:27:22 +00:00
else { flowfile = path.join(userdir,flowfile); }
2016-10-30 22:06:48 +00:00
}
else { // We set the user directory to be in the users home directory...
console.log("ARG",process.argv)
userdir = os.homedir() + '/.node-red';
if (!fs.existsSync(userdir)) {
fs.mkdirSync(userdir);
}
if ((process.argv.length > 1) && ((process.argv[process.argv.length-1].indexOf(".json") > -1) || (process.argv[process.argv.length-1].indexOf(".flow") > -1))) {
if (path.isAbsolute(process.argv[process.argv.length-1])) {
flowfile = process.argv[process.argv.length-1];
}
else {
flowfile = path.join(process.cwd(),process.argv[process.argv.length-1]);
}
2020-10-05 22:57:58 +00:00
store.set("electronFlow",flowfile)
}
else {
if (!fs.existsSync(userdir+"/"+flowfile)) {
fs.writeFileSync(userdir+"/"+flowfile, fs.readFileSync(__dirname+"/"+flowfile));
}
2019-04-09 16:13:57 +00:00
let credFile = flowfile.replace(".json","_cred.json");
if (fs.existsSync(__dirname+"/"+credFile) && !fs.existsSync(userdir+"/"+credFile)) {
fs.writeFileSync(userdir+"/"+credFile, fs.readFileSync(__dirname+"/"+credFile));
}
2020-10-05 22:57:58 +00:00
flowfile = path.join(userdir,flowfile);
}
2016-10-30 22:06:48 +00:00
}
}
2020-10-05 22:57:58 +00:00
else { store.clear(); }
flowfile = store.get('electronFlow',flowfile);
2020-10-09 09:01:41 +00:00
var myFlow;
2020-10-15 13:25:30 +00:00
try { myFlow = fs.readFileSync(flowfile).toString() }
2020-10-09 09:01:41 +00:00
catch(e) { myFlow = []; }
if (urlStart == urlmap && myFlow.indexOf("worldmap") == -1) { urlStart = urledit; }
2020-10-15 13:25:30 +00:00
if (urlStart == urldash && myFlow.indexOf("ui_base") == -1) { urlStart = urledit; }
2020-10-09 09:01:41 +00:00
myFlow = null;
2020-10-05 22:57:58 +00:00
// console.log("CWD",process.cwd());
// console.log("DIR",__dirname);
// console.log("UserDir :",userdir);
2018-08-20 20:16:39 +00:00
// console.log("PORT",listenPort);
2020-10-06 10:49:19 +00:00
console.log("Store",app.getPath('userData'))
2020-10-09 09:01:41 +00:00
console.log("FlowFile :",flowfile);
2018-08-20 20:16:39 +00:00
// Keep a global reference of the window objects, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow = null;
2018-08-20 20:16:39 +00:00
let conWindow;
2020-06-01 16:38:23 +00:00
let tray;
2018-08-21 14:46:46 +00:00
let logBuffer = [];
let logLength = 250; // No. of lines of console log to keep.
const levels = [ "", "fatal", "error", "warn", "info", "debug", "trace" ];
2016-10-30 22:06:48 +00:00
2019-10-23 23:00:08 +00:00
ipc.on('clearLogBuffer', function() { logBuffer = []; });
2016-03-09 21:49:41 +00:00
// Create the settings object - see default settings.js file for other options
var settings = {
2019-10-26 18:49:22 +00:00
uiHost: "localhost", // only allow local connections, remove if you want to allow external access
2020-11-17 22:13:05 +00:00
uiPort: listenPort,
2019-10-23 23:00:08 +00:00
httpAdminRoot: "/red", // set to false to disable editor and deploy
2016-03-09 21:49:41 +00:00
httpNodeRoot: "/",
2016-10-30 22:06:48 +00:00
userDir: userdir,
2016-10-31 23:22:06 +00:00
flowFile: flowfile,
2020-10-04 23:00:45 +00:00
flowFilePretty: true,
2020-10-06 08:09:52 +00:00
autoInstallModules: true,
2020-10-04 23:00:45 +00:00
editorTheme: {
projects:{ enabled:false },
header: { title: options.productName },
palette: { editable:addNodes }
}, // enable projects feature
2019-10-23 23:00:08 +00:00
functionGlobalContext: { }, // enables global context - add extras ehre if you need them
functionExternalModules: true,
2018-08-20 20:16:39 +00:00
logging: {
websock: {
level: 'info',
metrics: false,
handler: function() {
return function(msg) {
if (editable) { // No logging if not editable
var ts = (new Date(msg.timestamp)).toISOString();
ts = ts.replace("Z"," ").replace("T"," ");
var line = "";
if (msg.type && msg.id) {
line = ts+" : ["+levels[msg.level/10]+"] ["+msg.type+":"+msg.id+"] "+msg.msg;
}
else {
line = ts+" : ["+levels[msg.level/10]+"] "+msg.msg;
}
logBuffer.push(line);
if (conWindow) { conWindow.webContents.send('debugMsg', line); }
if (logBuffer.length > logLength) { logBuffer.shift(); }
}
2018-08-20 20:16:39 +00:00
}
}
}
}
2016-03-09 21:49:41 +00:00
};
if (!editable) {
settings.httpAdminRoot = false;
settings.readOnly = true;
}
2016-03-09 21:49:41 +00:00
// Initialise the runtime with a server and settings
RED.init(server,settings);
2019-10-23 23:00:08 +00:00
// Serve the editor UI from /red (if editable)
if (settings.httpAdminRoot !== false) {
red_app.use(settings.httpAdminRoot,RED.httpAdmin);
}
2016-03-09 21:49:41 +00:00
2018-08-20 20:16:39 +00:00
// Serve the http nodes UI from /
2016-03-09 21:49:41 +00:00
red_app.use(settings.httpNodeRoot,RED.httpNode);
2016-05-06 12:18:15 +00:00
// Create the Application's main menu
2019-10-27 10:46:03 +00:00
var template = [{
label: "View",
2019-10-27 10:46:03 +00:00
submenu: [
2020-10-05 22:57:58 +00:00
{ label: 'Open Flow',
2019-10-27 10:46:03 +00:00
accelerator: "Shift+CmdOrCtrl+O",
click() { openFlow(); }
},
{ label: 'Save Flow As',
accelerator: "Shift+CmdOrCtrl+S",
click() { saveFlow(); }
},
{ type: 'separator' },
{ label: 'Console',
accelerator: "Shift+CmdOrCtrl+C",
click() { createConsole(); }
},
{ label: 'Dashboard',
accelerator: "Shift+CmdOrCtrl+D",
click() { mainWindow.loadURL("http://localhost:"+listenPort+urldash); }
},
{ label: 'Editor',
accelerator: "Shift+CmdOrCtrl+E",
click() { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
},
{ label: 'Worldmap',
accelerator: "Shift+CmdOrCtrl+M",
click() { mainWindow.loadURL("http://localhost:"+listenPort+urlmap); }
},
{ type: 'separator' },
{ type: 'separator' },
{ label: 'Documentation',
click() { electron.shell.openExternal('https://nodered.org/docs') }
},
{ label: 'Flows and Nodes',
click() { electron.shell.openExternal('https://flows.nodered.org') }
},
{ label: 'Discourse Forum',
click() { electron.shell.openExternal('https://discourse.nodered.org/') }
},
{ type: 'separator' },
{ role: 'togglefullscreen' },
{ role: 'quit' }
]
}];
if (!showMap) { template[0].submenu.splice(6,1); }
if (!editable) {
2019-10-27 10:46:03 +00:00
template[0].submenu.splice(3,1);
template[0].submenu.splice(4,1);
}
2019-10-27 10:46:03 +00:00
if (!allowLoadSave) { template[0].submenu.splice(0,2); }
// Top and tail menu on Mac
2020-10-03 17:50:44 +00:00
if (process.platform === 'darwin') {
2019-10-27 10:46:03 +00:00
template[0].submenu.unshift({ type: 'separator' });
template[0].submenu.unshift({ label: "About "+options.productName||"Node-RED Electron", selector: "orderFrontStandardAboutPanel:" });
2019-10-27 10:46:03 +00:00
template[0].submenu.unshift({ type: 'separator' });
template[0].submenu.unshift({ type: 'separator' });
}
// Add Dev menu if in dev mode
2024-01-23 14:12:26 +00:00
if (isDev) {
template.push({
label: 'Development',
submenu: [
{ label: 'Reload', accelerator: 'CmdOrCtrl+R',
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.reload()
}
},
{ label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
}
}
]
})
}
function saveFlow() {
2020-10-04 23:00:45 +00:00
const file_path = dialog.showSaveDialogSync({
title:"Save Flow As",
filters:[{ name:'JSON', extensions:['json','flow'] }],
2020-10-04 23:00:45 +00:00
properties: ["showHiddenFiles"],
2020-10-05 22:57:58 +00:00
defaultPath: flowfile,
2020-10-04 23:00:45 +00:00
buttonLabel: "Save Flow"
});
2020-10-04 23:00:45 +00:00
if (file_path) {
var flo = JSON.stringify(RED.nodes.getFlows().flows, null , 2);
fs.writeFile(file_path, flo, function(err) {
if (err) { dialog.showErrorBox('Error', err); }
else {
2020-10-05 22:57:58 +00:00
store.set("electronFlow",file_path);
2020-10-04 23:00:45 +00:00
dialog.showMessageBoxSync({
icon: nrIcon,
message:"Flow file saved as\n\n"+file_path,
buttons: ["OK"]
});
2020-10-05 22:57:58 +00:00
app.relaunch();
app.exit();
2020-10-04 23:00:45 +00:00
}
});
}
}
function openFlow() {
2020-10-04 23:00:45 +00:00
const fileNames = dialog.showOpenDialogSync({
title:"Load Flow File",
filters:[{ name:'JSON', extensions:['json','flow'] }],
2020-10-04 23:00:45 +00:00
properties: ["openFile","showHiddenFiles"],
2020-10-05 22:57:58 +00:00
defaultPath: flowfile,
2020-10-04 23:00:45 +00:00
buttonLabel: "Load Flow"
});
if (fileNames && fileNames.length > 0) {
fs.readFile(fileNames[0], 'utf-8', function (err, data) {
try {
var flo = JSON.parse(data);
if (Array.isArray(flo) && (flo.length > 0)) {
2020-10-05 22:57:58 +00:00
//RED.nodes.setFlows(flo,"full");
store.set("electronFlow",fileNames[0]);
app.relaunch();
app.exit();
2020-10-04 23:00:45 +00:00
}
else {
dialog.showErrorBox("Error", "Failed to parse flow file.\n\n "+fileNames[0]+".\n\nAre you sure it's a flow file ?");
}
}
2020-10-04 23:00:45 +00:00
catch(e) {
dialog.showErrorBox("Error", "Failed to load flow file.\n\n "+fileNames[0]);
}
});
}
}
2018-08-21 13:46:02 +00:00
2018-08-21 16:25:48 +00:00
// Create the console log window
2018-08-20 20:16:39 +00:00
function createConsole() {
2018-08-21 13:46:02 +00:00
if (conWindow) { conWindow.show(); return; }
2018-08-20 20:16:39 +00:00
// Create the hidden console window
conWindow = new BrowserWindow({
2018-08-21 16:25:48 +00:00
title: "Node-RED Console",
width: 800,
height: 600,
icon: path.join(__dirname, nrIcon),
autoHideMenuBar: true,
// titleBarStyle: "hidden",
webPreferences: {
2021-09-09 22:46:34 +00:00
nodeIntegration: true,
2022-12-13 10:09:43 +00:00
nativeWindowOpen: true,
contextIsolation: false
}
2018-08-20 20:16:39 +00:00
});
2022-12-13 10:09:43 +00:00
// conWindow.loadURL(url.format({
// pathname: path.join(__dirname, urlconsole),
// protocol: 'file:',
// slashes: true
// }))
conWindow.loadURL(path.join(__dirname, urlconsole));
2018-08-20 20:16:39 +00:00
conWindow.webContents.on('did-finish-load', () => {
2018-08-21 14:46:46 +00:00
conWindow.webContents.send('logBuff', logBuffer);
2018-08-20 20:16:39 +00:00
});
2018-08-21 16:25:48 +00:00
conWindow.on('closed', () => {
2018-08-20 20:16:39 +00:00
conWindow = null;
});
//conWindow.webContents.openDevTools();
const touchButton5 = new TouchBarButton({
2020-10-03 17:50:44 +00:00
label: 'Clear Log',
2020-10-19 21:11:56 +00:00
backgroundColor: '#640000',
2020-10-03 17:50:44 +00:00
click: () => { logBuffer = []; conWindow.webContents.send('logBuff', logBuffer); }
});
const consoleTouchBar = new TouchBar({
items: [ touchButton5 ]
2020-10-03 17:50:44 +00:00
});
conWindow.setTouchBar(consoleTouchBar);
2018-08-20 20:16:39 +00:00
}
2016-03-09 21:49:41 +00:00
2018-08-21 16:25:48 +00:00
// Create the main browser window
2016-11-01 08:54:10 +00:00
function createWindow() {
2016-05-06 12:18:15 +00:00
mainWindow = new BrowserWindow({
title: "Node-RED",
width: 1024,
height: 768,
icon: path.join(__dirname, nrIcon),
fullscreenable: true,
autoHideMenuBar: false,
// titleBarStyle: "hidden",
2019-10-26 17:30:16 +00:00
kiosk: kioskMode,
webPreferences: {
2021-09-09 22:46:34 +00:00
nodeIntegration: false,
nativeWindowOpen: true
}
2016-05-06 12:18:15 +00:00
});
2020-10-03 17:50:44 +00:00
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
if (process.platform !== 'darwin') { mainWindow.setAutoHideMenuBar(true); }
mainWindow.loadURL(`file://${__dirname}/load.html`);
2016-05-06 12:18:15 +00:00
2018-08-20 20:16:39 +00:00
mainWindow.webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) {
2019-11-14 21:37:47 +00:00
if ((httpResponseCode == 404) && (newURL == ("http://localhost:"+listenPort+urlStart))) {
2018-08-20 20:16:39 +00:00
setTimeout(mainWindow.webContents.reload, 250);
2016-05-06 12:18:15 +00:00
}
});
2019-10-26 17:30:16 +00:00
// mainWindow.webContents.on('did-finish-load', (a) => {
// console.log("FINISHED LOAD",a);
2018-08-20 20:16:39 +00:00
// });
2016-05-06 12:18:15 +00:00
mainWindow.webContents.on("new-window", function(e, url, frameName, disposition, option) {
2016-05-06 12:18:15 +00:00
// if a child window opens... modify any other options such as width/height, etc
// in this case make the child overlap the parent exactly...
2019-10-26 20:50:41 +00:00
//console.log("NEW WINDOW",url);
2016-05-06 12:18:15 +00:00
var w = mainWindow.getBounds();
option.x = w.x;
option.y = w.y;
option.width = w.width;
option.height = w.height;
2016-05-06 12:18:15 +00:00
})
mainWindow.on('close', function(e) {
const choice = require('electron').dialog.showMessageBoxSync(this, {
type: 'question',
icon: nrIcon,
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you sure you want to quit?'
});
if (choice === 1) {
e.preventDefault();
}
});
2018-08-21 16:25:48 +00:00
mainWindow.on('closed', () => {
2016-05-06 12:18:15 +00:00
mainWindow = null;
});
2018-08-21 16:25:48 +00:00
2020-10-03 17:50:44 +00:00
// If on a Mac add some touchbar buttons...
if (process.platform === 'darwin') {
2020-10-10 16:10:47 +00:00
2020-10-03 17:50:44 +00:00
const touchButton1 = new TouchBarButton({
2020-10-10 16:10:47 +00:00
label: 'Dashboard',
2020-10-19 21:11:56 +00:00
backgroundColor: '#640000',
2020-10-10 16:10:47 +00:00
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urldash); }
2020-10-03 17:50:44 +00:00
});
const touchButton2 = new TouchBarButton({
2020-10-10 16:10:47 +00:00
label: 'Editor',
2020-10-19 21:11:56 +00:00
backgroundColor: '#640000',
2020-10-10 16:10:47 +00:00
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
2020-10-03 17:50:44 +00:00
});
const touchButton3 = new TouchBarButton({
label: 'Map',
2020-10-19 21:11:56 +00:00
backgroundColor: '#640000',
2020-10-03 17:50:44 +00:00
click: () => { mainWindow.loadURL("http://localhost:"+listenPort+urlmap); }
});
const touchButton4 = new TouchBarButton({
label: 'Console',
2020-10-19 21:11:56 +00:00
backgroundColor: '#640000',
click: () => { createConsole(); }
});
2020-10-10 16:10:47 +00:00
var items = [ touchButton1 ];
if (editable) { items.push(touchButton2) }
2020-10-03 17:50:44 +00:00
if (showMap) { items.push(touchButton3) }
if (editable) {
2020-10-10 16:10:47 +00:00
items.push(new TouchBarSpacer({ size: 'flexible' }));
items.push(touchButton4);
}
2020-10-03 17:50:44 +00:00
2020-10-10 16:10:47 +00:00
// Only bother to add buttons if more than one
if (items.length != 1) {
const mainTouchBar = new TouchBar({ items: items });
mainWindow.setTouchBar(mainTouchBar);
}
2020-10-03 17:50:44 +00:00
}
// Start the app full screen
//mainWindow.setFullScreen(true)
// Open the DevTools at start
2018-08-21 16:25:48 +00:00
//mainWindow.webContents.openDevTools();
2016-03-09 21:49:41 +00:00
}
2020-06-01 16:38:23 +00:00
// Create the tray icon and context menu
function createTray() {
tray = new Tray(path.join(__dirname, "nrtray.png"));
const contextMenu = Menu.buildFromTemplate([
{
label: 'Show',
click: function() {
mainWindow.show();
}
},
{
label: 'Quit',
click: function() {
app.quit();
}
}
]);
tray.setToolTip('Node-RED Electron application.')
tray.setContextMenu(contextMenu);
}
// Called when Electron has finished initialization and is ready to create browser windows.
// app.on('ready', () => {
// createTray()
// myWindow = createWindow()
// })
app.whenReady().then(() => {
createTray();
createWindow();
})
app.on('second-instance', (event, commandLine, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) { mainWindow.restore(); }
mainWindow.focus();
}
2020-06-01 16:38:23 +00:00
})
2016-03-09 21:49:41 +00:00
// Quit when all windows are closed.
app.on('window-all-closed', function () {
2016-05-06 12:18:15 +00:00
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
2018-08-20 20:16:39 +00:00
if (process.platform !== 'darwin') { app.quit(); }
2016-03-09 21:49:41 +00:00
});
2016-11-01 08:54:10 +00:00
app.on('activate', function() {
2016-05-06 12:18:15 +00:00
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
mainWindow.loadURL("http://localhost:"+listenPort+urlStart);
2016-05-06 12:18:15 +00:00
}
2016-03-09 21:49:41 +00:00
});
2020-10-03 17:50:44 +00:00
if (process.platform === 'darwin') {
app.setAboutPanelOptions({
applicationVersion: pkg.version,
version: pkg.dependencies["node-red"],
2021-09-09 22:46:34 +00:00
copyright: "Copyright © 2021 "+pkg.author.name,
credits: "Node-RED and other components are copyright the JS Foundation and other contributors."
});
2020-06-01 16:38:23 +00:00
// Don't show in the dock bar if you like
//app.dock.hide();
}
// Start the Node-RED runtime, then load the inital dashboard page
RED.start().then(function() {
2019-10-26 18:49:22 +00:00
server.listen(listenPort,"localhost",function() {
mainWindow.loadURL("http://localhost:"+listenPort+urlStart);
});
});