kopia lustrzana https://github.com/dceejay/electron-node-red
Bump to electron 2.0.7
rodzic
0b424fd6be
commit
44f02b969a
140
main.js
140
main.js
|
@ -130,25 +130,27 @@ var template = [{
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: 'Documentation',
|
{ label: 'Documentation',
|
||||||
click() { require('electron').shell.openExternal('https://nodered.org/docs') }
|
click() { electron.shell.openExternal('https://nodered.org/docs') }
|
||||||
},
|
},
|
||||||
{ label: 'Flows and Nodes',
|
{ label: 'Flows and Nodes',
|
||||||
click() { require('electron').shell.openExternal('https://flows.nodered.org') }
|
click() { electron.shell.openExternal('https://flows.nodered.org') }
|
||||||
},
|
},
|
||||||
{ label: 'Discourse Forum',
|
{ label: 'Discourse Forum',
|
||||||
click() { require('electron').shell.openExternal('https://discourse.nodered.org/') }
|
click() { electron.shell.openExternal('https://discourse.nodered.org/') }
|
||||||
}
|
},
|
||||||
]}, {
|
|
||||||
label: "Edit",
|
|
||||||
submenu: [
|
|
||||||
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
|
|
||||||
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
|
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
|
{ role: 'quit' }
|
||||||
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
|
|
||||||
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
|
|
||||||
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
|
|
||||||
]}, {
|
]}, {
|
||||||
|
// label: "Edit",
|
||||||
|
// submenu: [
|
||||||
|
// { label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
|
||||||
|
// { label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
|
||||||
|
// { type: "separator" },
|
||||||
|
// { label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
|
||||||
|
// { label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
|
||||||
|
// { label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
|
||||||
|
// { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
|
||||||
|
// ]}, {
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: 'Reload',
|
{ label: 'Reload',
|
||||||
|
@ -181,11 +183,15 @@ var template = [{
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Create the console log window
|
||||||
function createConsole() {
|
function createConsole() {
|
||||||
if (conWindow) { conWindow.show(); return; }
|
if (conWindow) { conWindow.show(); return; }
|
||||||
// Create the hidden console window
|
// Create the hidden console window
|
||||||
conWindow = new BrowserWindow({
|
conWindow = new BrowserWindow({
|
||||||
title:"Node-RED Console", width:800, height:600, frame:true, show:true
|
title: "Node-RED Console",
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
icon: path.join(__dirname, 'nodered.png')
|
||||||
});
|
});
|
||||||
//conWindow.loadURL("http://localhost:"+listenPort+urlconsole);
|
//conWindow.loadURL("http://localhost:"+listenPort+urlconsole);
|
||||||
conWindow.loadURL(url.format({
|
conWindow.loadURL(url.format({
|
||||||
|
@ -196,15 +202,14 @@ function createConsole() {
|
||||||
conWindow.webContents.on('did-finish-load', () => {
|
conWindow.webContents.on('did-finish-load', () => {
|
||||||
conWindow.webContents.send('logBuff', logBuffer);
|
conWindow.webContents.send('logBuff', logBuffer);
|
||||||
});
|
});
|
||||||
|
conWindow.on('closed', () => {
|
||||||
conWindow.on('closed', function() {
|
|
||||||
conWindow = null;
|
conWindow = null;
|
||||||
});
|
});
|
||||||
//conWindow.webContents.openDevTools();
|
//conWindow.webContents.openDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the main browser window
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
// Create the browser window.
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
@ -215,7 +220,7 @@ function createWindow() {
|
||||||
//titleBarStyle: "hidden",
|
//titleBarStyle: "hidden",
|
||||||
width: 1024,
|
width: 1024,
|
||||||
height: 768,
|
height: 768,
|
||||||
icon: __dirname + "/nodered.png"
|
icon: path.join(__dirname, 'nodered.png')
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) {
|
mainWindow.webContents.on('did-get-response-details', function(event, status, newURL, originalURL, httpResponseCode) {
|
||||||
|
@ -241,13 +246,12 @@ function createWindow() {
|
||||||
//frameName = "child";
|
//frameName = "child";
|
||||||
})
|
})
|
||||||
|
|
||||||
// Open the DevTools.
|
mainWindow.on('closed', () => {
|
||||||
//mainWindow.webContents.openDevTools();
|
|
||||||
|
|
||||||
// Emitted when the window is closed.
|
|
||||||
mainWindow.on('closed', function() {
|
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Open the DevTools.
|
||||||
|
//mainWindow.webContents.openDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when Electron has finished initialization and is ready to create browser windows.
|
// Called when Electron has finished initialization and is ready to create browser windows.
|
||||||
|
@ -279,63 +283,57 @@ RED.start().then(function() {
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// All this Squirrel stuff is for the Windows installer
|
// All this Squirrel stuff is for the Windows installer
|
||||||
function handleSquirrelEvent() {
|
function handleSquirrelEvent() {
|
||||||
if (process.argv.length === 1) {
|
if (process.argv.length === 1) { return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ChildProcess = require('child_process');
|
const path = require('path');
|
||||||
const path = require('path');
|
const ChildProcess = require('child_process');
|
||||||
|
const appFolder = path.resolve(process.execPath, '..');
|
||||||
|
const rootAtomFolder = path.resolve(appFolder, '..');
|
||||||
|
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
|
||||||
|
const exeName = path.basename(process.execPath);
|
||||||
|
const spawn = function(command, args) {
|
||||||
|
let spawnedProcess, error;
|
||||||
|
|
||||||
const appFolder = path.resolve(process.execPath, '..');
|
try { spawnedProcess = ChildProcess.spawn(command, args, {detached: true}); }
|
||||||
const rootAtomFolder = path.resolve(appFolder, '..');
|
catch (error) {}
|
||||||
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
|
return spawnedProcess;
|
||||||
const exeName = path.basename(process.execPath);
|
};
|
||||||
|
|
||||||
const spawn = function(command, args) {
|
const spawnUpdate = function(args) {
|
||||||
let spawnedProcess, error;
|
return spawn(updateDotExe, args);
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
const squirrelEvent = process.argv[1];
|
||||||
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
|
switch (squirrelEvent) {
|
||||||
} catch (error) {}
|
case '--squirrel-install':
|
||||||
|
case '--squirrel-updated':
|
||||||
|
// Optionally do things such as:
|
||||||
|
// - Add your .exe to the PATH
|
||||||
|
// - Write to the registry for things like file associations and
|
||||||
|
// explorer context menus
|
||||||
|
|
||||||
return spawnedProcess;
|
// Install desktop and start menu shortcuts
|
||||||
};
|
spawnUpdate(['--createShortcut', exeName]);
|
||||||
|
|
||||||
const spawnUpdate = function(args) {
|
setTimeout(app.quit, 1000);
|
||||||
return spawn(updateDotExe, args);
|
return true;
|
||||||
};
|
|
||||||
|
|
||||||
const squirrelEvent = process.argv[1];
|
case '--squirrel-uninstall':
|
||||||
switch (squirrelEvent) {
|
// Undo anything you did in the --squirrel-install and
|
||||||
case '--squirrel-install':
|
// --squirrel-updated handlers
|
||||||
case '--squirrel-updated':
|
|
||||||
// Optionally do things such as:
|
|
||||||
// - Add your .exe to the PATH
|
|
||||||
// - Write to the registry for things like file associations and
|
|
||||||
// explorer context menus
|
|
||||||
|
|
||||||
// Install desktop and start menu shortcuts
|
// Remove desktop and start menu shortcuts
|
||||||
spawnUpdate(['--createShortcut', exeName]);
|
spawnUpdate(['--removeShortcut', exeName]);
|
||||||
|
|
||||||
setTimeout(app.quit, 1000);
|
setTimeout(app.quit, 1000);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case '--squirrel-uninstall':
|
case '--squirrel-obsolete':
|
||||||
// Undo anything you did in the --squirrel-install and
|
// This is called on the outgoing version of your app before
|
||||||
// --squirrel-updated handlers
|
// we update to the new version - it's the opposite of
|
||||||
|
// --squirrel-updated
|
||||||
|
|
||||||
// Remove desktop and start menu shortcuts
|
app.quit();
|
||||||
spawnUpdate(['--removeShortcut', exeName]);
|
return true;
|
||||||
|
}
|
||||||
setTimeout(app.quit, 1000);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case '--squirrel-obsolete':
|
|
||||||
// This is called on the outgoing version of your app before
|
|
||||||
// we update to the new version - it's the opposite of
|
|
||||||
// --squirrel-updated
|
|
||||||
|
|
||||||
app.quit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "7.0.63",
|
"version": "8.10.26",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.63.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz",
|
||||||
"integrity": "sha512-YPVhjU3cADo7M7M1KWeEki9MUMZd3yz5FLq0BXkPrY2jpr0B9VRd4iQ2vBSiLrjvLkIPPluzxQFYJ5JkGubtIw==",
|
"integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
|
@ -1276,9 +1276,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"deep-extend": {
|
"deep-extend": {
|
||||||
"version": "0.5.1",
|
"version": "0.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||||
"integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==",
|
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"delayed-stream": {
|
"delayed-stream": {
|
||||||
|
@ -1409,12 +1409,12 @@
|
||||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "1.7.9",
|
"version": "2.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-1.7.9.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-2.0.7.tgz",
|
||||||
"integrity": "sha1-rdVOn4+D7QL2UZ7BATX2mLGTNs8=",
|
"integrity": "sha512-MRrDE6mrp+ZrIBpZM27pxbO2yEDKYfkmc6Ll79BtedMNEZsY4+oblupeDJL6RM6meUIp82KMo63W7fP65Tb89Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "^7.0.18",
|
"@types/node": "^8.0.24",
|
||||||
"electron-download": "^3.0.1",
|
"electron-download": "^3.0.1",
|
||||||
"extract-zip": "^1.0.3"
|
"extract-zip": "^1.0.3"
|
||||||
}
|
}
|
||||||
|
@ -1756,37 +1756,15 @@
|
||||||
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
||||||
},
|
},
|
||||||
"extract-zip": {
|
"extract-zip": {
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz",
|
||||||
"integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
|
"integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"concat-stream": "1.6.0",
|
"concat-stream": "1.6.2",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"mkdirp": "0.5.0",
|
"mkdirp": "0.5.1",
|
||||||
"yauzl": "2.4.1"
|
"yauzl": "2.4.1"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"concat-stream": {
|
|
||||||
"version": "1.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
|
|
||||||
"integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"readable-stream": "^2.2.2",
|
|
||||||
"typedarray": "^0.0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mkdirp": {
|
|
||||||
"version": "0.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
|
|
||||||
"integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"minimist": "0.0.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extsprintf": {
|
"extsprintf": {
|
||||||
|
@ -2096,9 +2074,9 @@
|
||||||
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
|
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
|
||||||
},
|
},
|
||||||
"home-path": {
|
"home-path": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz",
|
||||||
"integrity": "sha1-eIspgVsS1Tus9XVkhHbm+QQdEz8=",
|
"integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"hosted-git-info": {
|
"hosted-git-info": {
|
||||||
|
@ -3890,12 +3868,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rc": {
|
"rc": {
|
||||||
"version": "1.2.7",
|
"version": "1.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||||
"integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==",
|
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"deep-extend": "^0.5.1",
|
"deep-extend": "^0.6.0",
|
||||||
"ini": "~1.3.0",
|
"ini": "~1.3.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"strip-json-comments": "~2.0.1"
|
"strip-json-comments": "~2.0.1"
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/dceejay/electron-node-red#readme",
|
"homepage": "https://github.com/dceejay/electron-node-red#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "1.7.9",
|
"electron": "~2.0.7",
|
||||||
"electron-rebuild": "~1.7.3",
|
"electron-rebuild": "~1.7.3",
|
||||||
"electron-squirrel-startup": "*",
|
"electron-squirrel-startup": "*",
|
||||||
"electron-winstaller": "2.5.2"
|
"electron-winstaller": "2.5.2"
|
||||||
|
|
Ładowanie…
Reference in New Issue