|
@ -3,23 +3,21 @@ |
|
|
|
|
|
|
|
|
const electron = require('electron'), |
|
|
const electron = require('electron'), |
|
|
app = electron.app, |
|
|
app = electron.app, |
|
|
BrowserWindow = electron.BrowserWindow; |
|
|
BrowserWindow = electron.BrowserWindow, |
|
|
var express = require('express'), |
|
|
path = require('path'), |
|
|
bodyParser = require('body-parser'); |
|
|
|
|
|
const path = require('path'), |
|
|
|
|
|
url = require('url'), |
|
|
url = require('url'), |
|
|
os = require('os'), |
|
|
os = require('os'), |
|
|
spawn = require('child_process').spawn, |
|
|
spawn = require('child_process').spawn, |
|
|
exec = require('child_process').exec, |
|
|
exec = require('child_process').exec, |
|
|
fixPath = require('fix-path'); |
|
|
fixPath = require('fix-path'); |
|
|
var fs = require('fs'), |
|
|
var express = require('express'), |
|
|
|
|
|
bodyParser = require('body-parser'), |
|
|
|
|
|
fs = require('fs'), |
|
|
fsnode = require('fs'), |
|
|
fsnode = require('fs'), |
|
|
fs = require('fs-extra'), |
|
|
fs = require('fs-extra'), |
|
|
mkdirp = require('mkdirp'), |
|
|
mkdirp = require('mkdirp'), |
|
|
pm2 = require('pm2'); |
|
|
pm2 = require('pm2'); |
|
|
|
|
|
|
|
|
var iguanaAppPort = 17777; |
|
|
|
|
|
|
|
|
|
|
|
Promise = require('bluebird'); |
|
|
Promise = require('bluebird'); |
|
|
|
|
|
|
|
|
app.setName('Iguana'); |
|
|
app.setName('Iguana'); |
|
@ -28,30 +26,6 @@ if (os.platform() === 'linux') { |
|
|
process.env.ELECTRON_RUN_AS_NODE = true; |
|
|
process.env.ELECTRON_RUN_AS_NODE = true; |
|
|
console.log(process.env); |
|
|
console.log(process.env); |
|
|
} |
|
|
} |
|
|
if (os.platform() === 'darwin') { |
|
|
|
|
|
fixPath(); |
|
|
|
|
|
var iguanaBin = path.join(__dirname, '../assets/bin/osx/iguana'), |
|
|
|
|
|
iguanaDir = process.env.HOME + '/Library/Application Support/iguana'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (os.platform() === 'linux') { |
|
|
|
|
|
var iguanaBin = path.join(__dirname, '../assets/bin/linux64/iguana'), |
|
|
|
|
|
iguanaDir = process.env.HOME + '/.iguana'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (os.platform() === 'win32') { |
|
|
|
|
|
var iguanaDir = process.env.APPDATA + '/iguana'; |
|
|
|
|
|
iguanaDir = path.normalize(iguanaDir); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var appSettings = { |
|
|
|
|
|
"edexGuiOnly": true, |
|
|
|
|
|
"iguanaGuiOnly": false, |
|
|
|
|
|
"manualIguanaStart": false, |
|
|
|
|
|
"skipBasiliskNetworkCheck": false |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var appConfig = appSettings; |
|
|
|
|
|
|
|
|
|
|
|
// preload.js
|
|
|
// preload.js
|
|
|
const _setImmediate = setImmediate, |
|
|
const _setImmediate = setImmediate, |
|
@ -73,7 +47,7 @@ process.once('loaded', () => { |
|
|
var shepherd = require('./routes/shepherd'), |
|
|
var shepherd = require('./routes/shepherd'), |
|
|
guiapp = express(); |
|
|
guiapp = express(); |
|
|
|
|
|
|
|
|
shepherd.saveLocalAppConf(appSettings); |
|
|
var appConfig = shepherd.loadLocalConfig(); |
|
|
|
|
|
|
|
|
guiapp.use(bodyParser.json()); // support json encoded bodies
|
|
|
guiapp.use(bodyParser.json()); // support json encoded bodies
|
|
|
guiapp.use(bodyParser.urlencoded({ extended: false })); // support encoded bodies
|
|
|
guiapp.use(bodyParser.urlencoded({ extended: false })); // support encoded bodies
|
|
@ -87,8 +61,8 @@ guiapp.use('/gui', express.static(guipath)); |
|
|
|
|
|
|
|
|
guiapp.use('/shepherd', shepherd); |
|
|
guiapp.use('/shepherd', shepherd); |
|
|
|
|
|
|
|
|
var rungui = guiapp.listen(iguanaAppPort, function () { |
|
|
var rungui = guiapp.listen(appConfig.iguanaAppPort, function () { |
|
|
console.log('guiapp listening on port ' + iguanaAppPort + '!'); |
|
|
console.log('guiapp listening on port ' + appConfig.iguanaAppPort + '!'); |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
module.exports = guiapp; |
|
|
module.exports = guiapp; |
|
@ -214,9 +188,9 @@ function createWindow (status) { |
|
|
|
|
|
|
|
|
// load our index.html (i.e. easyDEX GUI)
|
|
|
// load our index.html (i.e. easyDEX GUI)
|
|
|
if (appConfig.edexGuiOnly) { |
|
|
if (appConfig.edexGuiOnly) { |
|
|
mainWindow.loadURL('http://127.0.0.1:' + iguanaAppPort + '/gui/EasyDEX-GUI/'); |
|
|
mainWindow.loadURL('http://127.0.0.1:' + appConfig.iguanaAppPort + '/gui/EasyDEX-GUI/'); |
|
|
} else { |
|
|
} else { |
|
|
mainWindow.loadURL('http://127.0.0.1:' + iguanaAppPort + '/gui/main.html'); |
|
|
mainWindow.loadURL('http://127.0.0.1:' + appConfig.iguanaAppPort + '/gui/main.html'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// DEVTOOLS - only for dev purposes - ca333
|
|
|
// DEVTOOLS - only for dev purposes - ca333
|
|
|