From 90f5dd50a52d12f96f537292d39a6d2fd54a0895 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Sat, 12 Mar 2016 08:38:41 -0800 Subject: [PATCH] Revert "Show Server Console Version" --- server-console/src/main.js | 157 +++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 87 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index 15dbf698bc..e05106aa6f 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -1,7 +1,7 @@ 'use strict'; const electron = require('electron'); -const app = electron.app; // Module to control application life. +const app = electron.app; // Module to control application life. const BrowserWindow = electron.BrowserWindow; const nativeImage = electron.nativeImage; @@ -57,10 +57,7 @@ function getBuildInfo() { } } - const DEFAULT_BUILD_INFO = { - releaseType: "", - buildIdentifier: "dev" - }; + const DEFAULT_BUILD_INFO = { releaseType: "", buildIdentifier: "dev" }; var buildInfo = DEFAULT_BUILD_INFO; if (buildInfoPath) { @@ -107,7 +104,6 @@ const ipcMain = electron.ipcMain; var isShuttingDown = false; - function shutdown() { if (!isShuttingDown) { // if the home server is running, show a prompt before quit to ask if the user is sure @@ -287,7 +283,8 @@ function openFileBrowser(path) { // NOTE: this looks like it does nothing, but it's very important. // Without it the default behaviour is to quit the app once all windows closed // which is absolutely not what we want for a taskbar application. -app.on('window-all-closed', function() {}); +app.on('window-all-closed', function() { +}); function startInterface(url) { var argArray = []; @@ -323,11 +320,7 @@ LogWindow.prototype = { return; } // Create the browser window. - this.window = new BrowserWindow({ - width: 700, - height: 500, - icon: appIcon - }); + this.window = new BrowserWindow({ width: 700, height: 500, icon: appIcon }); this.window.loadURL('file://' + __dirname + '/log.html'); if (!debug) { @@ -374,7 +367,7 @@ function isStackManagerContentPresent() { if (stats.isFile()) { console.log("Stack Manager entities file discovered at " + modelsPath) - // we found a content file + // we found a content file return true; } } catch (e) { @@ -488,72 +481,70 @@ function buildMenuArray(serverState) { var menuArray = null; if (isShuttingDown) { - menuArray = [{ - label: "Shutting down...", - enabled: false - }]; + menuArray = [ + { + label: "Shutting down...", + enabled: false + } + ]; } else { - menuArray = [{ - label: 'Server - Stopped', - enabled: false - }, { - label: 'Version - ' + buildInfo.buildIdentifier, - enabled: false - }, { - type: 'separator' - }, { - label: 'Go Home', - click: goHomeClicked, - enabled: false - }, { - type: 'separator' - }, { - label: 'Start Server', - click: function() { - homeServer.restart(); - } - }, { - label: 'Stop Server', - visible: false, - click: function() { - homeServer.stop(); - } - }, { - label: 'Settings', - click: function() { - shell.openExternal('http://localhost:40100/settings'); + menuArray = [ + { + label: 'Server - Stopped', + enabled: false }, - enabled: false - }, { - label: 'View Logs', - click: function() { - logWindow.open(); + { + type: 'separator' + }, + { + label: 'Go Home', + click: goHomeClicked, + enabled: false + }, + { + type: 'separator' + }, + { + label: 'Start Server', + click: function() { homeServer.restart(); } + }, + { + label: 'Stop Server', + visible: false, + click: function() { homeServer.stop(); } + }, + { + label: 'Settings', + click: function() { shell.openExternal('http://localhost:40100/settings'); }, + enabled: false + }, + { + label: 'View Logs', + click: function() { logWindow.open(); } + }, + { + type: 'separator' + }, + { + label: 'Share', + click: function() { shell.openExternal('http://localhost:40100/settings/?action=share') } + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: function() { shutdown(); } } - }, { - type: 'separator' - }, { - label: 'Share', - click: function() { - shell.openExternal('http://localhost:40100/settings/?action=share') - } - }, { - type: 'separator' - }, { - label: 'Quit', - accelerator: 'Command+Q', - click: function() { - shutdown(); - } - }]; + ]; var foundStackManagerContent = isStackManagerContentPresent(); if (foundStackManagerContent) { // add a separator and the stack manager content migration option menuArray.splice(menuArray.length - 1, 0, { label: 'Migrate Stack Manager Content', - click: function() { - promptToMigrateContent(); - } + click: function() { promptToMigrateContent(); } }, { type: 'separator' }); @@ -652,13 +643,9 @@ function maybeInstallDefaultContentSet(onComplete) { electron.ipcMain.on('ready', function() { console.log("got ready"); - function sendStateUpdate(state, args) { // console.log(state, window, args); - window.webContents.send('update', { - state: state, - args: args - }); + window.webContents.send('update', { state: state, args: args }); } var aborted = false; @@ -682,9 +669,7 @@ function maybeInstallDefaultContentSet(onComplete) { } else { sendStateUpdate('installing'); } - }), { - throttle: 250 - }).on('progress', function(state) { + }), { throttle: 250 }).on('progress', function(state) { if (!aborted) { // Update progress popup sendStateUpdate('downloading', state); @@ -698,7 +683,7 @@ function maybeInstallDefaultContentSet(onComplete) { console.log("Done", arguments); sendStateUpdate('complete'); }); - unzipper.on('error', function(err) { + unzipper.on('error', function (err) { console.log("aborting"); aborted = true; req.abort(); @@ -788,7 +773,8 @@ app.on('ready', function() { var currentVersion = null; try { currentVersion = parseInt(buildInfo.buildIdentifier); - } catch (e) {} + } catch (e) { + } if (currentVersion !== null) { const CHECK_FOR_UPDATES_INTERVAL_SECONDS = 60 * 30; @@ -818,9 +804,8 @@ app.on('ready', function() { if (dsPath && acPath) { domainServer = new Process('domain-server', dsPath, ["--get-temp-name"], logPath); acMonitor = new ACMonitorProcess('ac-monitor', acPath, ['-n6', - '--log-directory', logPath, - '--http-status-port', httpStatusPort - ], httpStatusPort, logPath); + '--log-directory', logPath, + '--http-status-port', httpStatusPort], httpStatusPort, logPath); homeServer = new ProcessGroup('home', [domainServer, acMonitor]); logWindow = new LogWindow(acMonitor, domainServer); @@ -829,12 +814,10 @@ app.on('ready', function() { }; // handle process updates - homeServer.on('state-update', function(processGroup) { - updateTrayMenu(processGroup.state); - }); + homeServer.on('state-update', function(processGroup) { updateTrayMenu(processGroup.state); }); // start the home server homeServer.start(); } }); -}); \ No newline at end of file +});