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' },
|
||||
{ label: 'Documentation',
|
||||
click() { require('electron').shell.openExternal('https://nodered.org/docs') }
|
||||
click() { electron.shell.openExternal('https://nodered.org/docs') }
|
||||
},
|
||||
{ label: 'Flows and Nodes',
|
||||
click() { require('electron').shell.openExternal('https://flows.nodered.org') }
|
||||
click() { electron.shell.openExternal('https://flows.nodered.org') }
|
||||
},
|
||||
{ label: 'Discourse Forum',
|
||||
click() { require('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:" },
|
||||
click() { electron.shell.openExternal('https://discourse.nodered.org/') }
|
||||
},
|
||||
{ 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:" }
|
||||
{ role: 'quit' }
|
||||
]}, {
|
||||
// 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',
|
||||
submenu: [
|
||||
{ label: 'Reload',
|
||||
|
@ -181,11 +183,15 @@ var template = [{
|
|||
// });
|
||||
// }
|
||||
|
||||
// Create the console log window
|
||||
function createConsole() {
|
||||
if (conWindow) { conWindow.show(); return; }
|
||||
// Create the hidden console window
|
||||
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(url.format({
|
||||
|
@ -196,15 +202,14 @@ function createConsole() {
|
|||
conWindow.webContents.on('did-finish-load', () => {
|
||||
conWindow.webContents.send('logBuff', logBuffer);
|
||||
});
|
||||
|
||||
conWindow.on('closed', function() {
|
||||
conWindow.on('closed', () => {
|
||||
conWindow = null;
|
||||
});
|
||||
//conWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
// Create the main browser window
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
|
@ -215,7 +220,7 @@ function createWindow() {
|
|||
//titleBarStyle: "hidden",
|
||||
width: 1024,
|
||||
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) {
|
||||
|
@ -241,13 +246,12 @@ function createWindow() {
|
|||
//frameName = "child";
|
||||
})
|
||||
|
||||
// Open the DevTools.
|
||||
//mainWindow.webContents.openDevTools();
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function() {
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
// Open the DevTools.
|
||||
//mainWindow.webContents.openDevTools();
|
||||
}
|
||||
|
||||
// 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
|
||||
function handleSquirrelEvent() {
|
||||
if (process.argv.length === 1) {
|
||||
return false;
|
||||
}
|
||||
if (process.argv.length === 1) { 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, '..');
|
||||
const rootAtomFolder = path.resolve(appFolder, '..');
|
||||
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
|
||||
const exeName = path.basename(process.execPath);
|
||||
try { spawnedProcess = ChildProcess.spawn(command, args, {detached: true}); }
|
||||
catch (error) {}
|
||||
return spawnedProcess;
|
||||
};
|
||||
|
||||
const spawn = function(command, args) {
|
||||
let spawnedProcess, error;
|
||||
const spawnUpdate = function(args) {
|
||||
return spawn(updateDotExe, args);
|
||||
};
|
||||
|
||||
try {
|
||||
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
|
||||
} catch (error) {}
|
||||
const squirrelEvent = process.argv[1];
|
||||
switch (squirrelEvent) {
|
||||
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) {
|
||||
return spawn(updateDotExe, args);
|
||||
};
|
||||
setTimeout(app.quit, 1000);
|
||||
return true;
|
||||
|
||||
const squirrelEvent = process.argv[1];
|
||||
switch (squirrelEvent) {
|
||||
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
|
||||
case '--squirrel-uninstall':
|
||||
// Undo anything you did in the --squirrel-install and
|
||||
// --squirrel-updated handlers
|
||||
|
||||
// Install desktop and start menu shortcuts
|
||||
spawnUpdate(['--createShortcut', exeName]);
|
||||
// Remove desktop and start menu shortcuts
|
||||
spawnUpdate(['--removeShortcut', exeName]);
|
||||
|
||||
setTimeout(app.quit, 1000);
|
||||
return true;
|
||||
setTimeout(app.quit, 1000);
|
||||
return true;
|
||||
|
||||
case '--squirrel-uninstall':
|
||||
// Undo anything you did in the --squirrel-install and
|
||||
// --squirrel-updated handlers
|
||||
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
|
||||
|
||||
// Remove desktop and start menu shortcuts
|
||||
spawnUpdate(['--removeShortcut', exeName]);
|
||||
|
||||
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;
|
||||
}
|
||||
app.quit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "7.0.63",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.63.tgz",
|
||||
"integrity": "sha512-YPVhjU3cADo7M7M1KWeEki9MUMZd3yz5FLq0BXkPrY2jpr0B9VRd4iQ2vBSiLrjvLkIPPluzxQFYJ5JkGubtIw==",
|
||||
"version": "8.10.26",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz",
|
||||
"integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==",
|
||||
"dev": true
|
||||
},
|
||||
"abbrev": {
|
||||
|
@ -1276,9 +1276,9 @@
|
|||
}
|
||||
},
|
||||
"deep-extend": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz",
|
||||
"integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==",
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"dev": true
|
||||
},
|
||||
"delayed-stream": {
|
||||
|
@ -1409,12 +1409,12 @@
|
|||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"electron": {
|
||||
"version": "1.7.9",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-1.7.9.tgz",
|
||||
"integrity": "sha1-rdVOn4+D7QL2UZ7BATX2mLGTNs8=",
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-2.0.7.tgz",
|
||||
"integrity": "sha512-MRrDE6mrp+ZrIBpZM27pxbO2yEDKYfkmc6Ll79BtedMNEZsY4+oblupeDJL6RM6meUIp82KMo63W7fP65Tb89Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "^7.0.18",
|
||||
"@types/node": "^8.0.24",
|
||||
"electron-download": "^3.0.1",
|
||||
"extract-zip": "^1.0.3"
|
||||
}
|
||||
|
@ -1756,37 +1756,15 @@
|
|||
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
||||
},
|
||||
"extract-zip": {
|
||||
"version": "1.6.6",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
|
||||
"integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
|
||||
"version": "1.6.7",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz",
|
||||
"integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"concat-stream": "1.6.0",
|
||||
"concat-stream": "1.6.2",
|
||||
"debug": "2.6.9",
|
||||
"mkdirp": "0.5.0",
|
||||
"mkdirp": "0.5.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": {
|
||||
|
@ -2096,9 +2074,9 @@
|
|||
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
|
||||
},
|
||||
"home-path": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.5.tgz",
|
||||
"integrity": "sha1-eIspgVsS1Tus9XVkhHbm+QQdEz8=",
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/home-path/-/home-path-1.0.6.tgz",
|
||||
"integrity": "sha512-wo+yjrdAtoXt43Vy92a+0IPCYViiyLAHyp0QVS4xL/tfvVz5sXIW1ubLZk3nhVkD92fQpUMKX+fzMjr5F489vw==",
|
||||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
|
@ -3890,12 +3868,12 @@
|
|||
}
|
||||
},
|
||||
"rc": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz",
|
||||
"integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==",
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"deep-extend": "^0.5.1",
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/dceejay/electron-node-red#readme",
|
||||
"devDependencies": {
|
||||
"electron": "1.7.9",
|
||||
"electron": "~2.0.7",
|
||||
"electron-rebuild": "~1.7.3",
|
||||
"electron-squirrel-startup": "*",
|
||||
"electron-winstaller": "2.5.2"
|
||||
|
|
Ładowanie…
Reference in New Issue