Skip to content

Commit

Permalink
Update electron for server_manager (Jigsaw-Code#521)
Browse files Browse the repository at this point in the history
* Update electron for server_manager

* Undo csv-parse upgrade -- it failed due to transitive dependencies of
restify and caused merge conflicts
  • Loading branch information
Jonathan Cohen authored Oct 29, 2019
1 parent 7dac479 commit 07748c2
Show file tree
Hide file tree
Showing 4 changed files with 499 additions and 668 deletions.
17 changes: 7 additions & 10 deletions src/server_manager/electron_app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function createMainWindow() {
height: 1024,
minWidth: 600,
minHeight: 768,
maximizable: false,
icon: path.join(__dirname, 'web_app', 'ui_components', 'icons', 'launcher.png'),
webPreferences: {
nodeIntegration: false,
Expand Down Expand Up @@ -115,10 +116,6 @@ function createMainWindow() {
}
});

// Disable window maximization. Setting "maximizable: false" in BrowserWindow
// options does not work as documented.
win.setMaximizable(false);

return win;
}

Expand Down Expand Up @@ -183,9 +180,13 @@ function main() {
let mainWindow: Electron.BrowserWindow;

// Mark secure to avoid mixed content warnings when loading DigitalOcean pages via https://.
electron.protocol.registerStandardSchemes(['outline'], {secure: true});
electron.protocol.registerSchemesAsPrivileged([{ scheme: 'outline', privileges: { standard: true, secure: true } }]);

const isSecondInstance = app.makeSingleInstance((argv, workingDirectory) => {
if(!app.requestSingleInstanceLock()) {
console.log('another instance is running - exiting');
app.quit();
}
app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) {
Expand All @@ -195,10 +196,6 @@ function main() {
}
});

if (isSecondInstance) {
app.quit();
}

app.on('ready', () => {
const menuTemplate = menu.getMenuTemplate(debugMode);
if (menuTemplate.length > 0) {
Expand Down
9 changes: 5 additions & 4 deletions src/server_manager/electron_app/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ export function getMenuTemplate(debugMode: boolean): Electron.MenuItemConstructo
template.push(
// From default_app's main.js.
{
submenu: [
role: 'appMenu',
submenu: electron.Menu.buildFromTemplate([
{role: 'about'}, {type: 'separator'}, {role: 'services', submenu: []},
{type: 'separator'}, {role: 'hide'}, {role: 'hideothers'}, {role: 'unhide'},
{type: 'separator'}, {role: 'hide'}, {role: 'hideOthers'}, {role: 'unhide'},
{type: 'separator'}, {role: 'quit'}
]
])
},
// editMenu is required for copy+paste keyboard shortcuts to work on Mac.
{role: 'editMenu'});
Expand All @@ -37,7 +38,7 @@ export function getMenuTemplate(debugMode: boolean): Electron.MenuItemConstructo
if (debugMode) {
template.push({
label: 'Developer',
submenu: [{role: 'reload'}, {role: 'forcereload'}, {role: 'toggledevtools'}]
submenu: electron.Menu.buildFromTemplate([{role: 'reload'}, {role: 'forceReload'}, {role: 'toggleDevTools'}])
});
}

Expand Down
6 changes: 3 additions & 3 deletions src/server_manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"body-parser": "^1.18.3",
"bytes": "^3.1.0",
"clipboard-polyfill": "^2.4.6",
"electron-updater": "3.2.3",
"electron-updater": "^4.1.2",
"eventemitter3": "^2.0.3",
"express": "^4.16.3",
"jsonic": "^0.3.1",
Expand All @@ -28,8 +28,8 @@
"@types/semver": "^5.5.0",
"bower": "^1.8.0",
"browserify": "^14.5.0",
"electron": "^2.0.16",
"electron-builder": "20.34.0",
"electron": "^7.0.0",
"electron-builder": "^21.2.0",
"electron-icon-maker": "^0.0.4",
"gulp": "^4.0.0",
"gulp-posthtml": "^3.0.4",
Expand Down
Loading

0 comments on commit 07748c2

Please sign in to comment.