summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-10-06 14:40:30 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-10-06 14:40:30 +0200
commitc5f19c9bad161bebc4a8304ab2c984d4ee60e98e (patch)
treee0b82c7f37c8e90598a97081332e033e0465d36e
parent41ae2978f2b4ffba4f968bc04c4818bb1914d138 (diff)
downloadmullvadvpn-c5f19c9bad161bebc4a8304ab2c984d4ee60e98e.tar.xz
mullvadvpn-c5f19c9bad161bebc4a8304ab2c984d4ee60e98e.zip
Add command line option to not open devtools
-rw-r--r--gui/src/main/command-line-options.ts5
-rw-r--r--gui/src/main/index.ts6
-rw-r--r--gui/src/main/user-interface.ts7
-rw-r--r--gui/tasks/electron.js8
4 files changed, 12 insertions, 14 deletions
diff --git a/gui/src/main/command-line-options.ts b/gui/src/main/command-line-options.ts
new file mode 100644
index 0000000000..258d3fc45c
--- /dev/null
+++ b/gui/src/main/command-line-options.ts
@@ -0,0 +1,5 @@
+export enum CommandLineOptions {
+ showChanges = '--show-changes',
+ disableResetNavigation = '--disable-reset-navigation', // development only
+ disableDevtoolsOpen = '--disable-devtools-open', // development only
+}
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 9a396d4307..6ede38b87f 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -18,6 +18,7 @@ import { SystemNotification } from '../shared/notifications/notification';
import Account, { AccountDelegate, LocaleProvider } from './account';
import { getOpenAtLogin } from './autostart';
import { readChangelog } from './changelog';
+import { CommandLineOptions } from './command-line-options';
import { ConnectionObserver, DaemonRpc, SubscriptionListener } from './daemon-rpc';
import Expectation from './expectation';
import { IpcMainEventChannel } from './ipc-event-channel';
@@ -54,11 +55,6 @@ const execAsync = util.promisify(exec);
const linuxSplitTunneling = process.platform === 'linux' && require('./linux-split-tunneling');
const windowsSplitTunneling = process.platform === 'win32' && require('./windows-split-tunneling');
-enum CommandLineOptions {
- showChanges = '--show-changes',
- disableResetNavigation = '--disable-reset-navigation', // development only
-}
-
const ALLOWED_PERMISSIONS = ['clipboard-sanitized-write'];
const SANDBOX_DISABLED = app.commandLine.hasSwitch('no-sandbox');
diff --git a/gui/src/main/user-interface.ts b/gui/src/main/user-interface.ts
index 712d7e42b8..70a86284bb 100644
--- a/gui/src/main/user-interface.ts
+++ b/gui/src/main/user-interface.ts
@@ -8,6 +8,7 @@ import { IAccountData, ILocation, TunnelState } from '../shared/daemon-rpc-types
import { messages, relayLocations } from '../shared/gettext';
import log from '../shared/logging';
import { Scheduler } from '../shared/scheduler';
+import { CommandLineOptions } from './command-line-options';
import { DaemonRpc } from './daemon-rpc';
import { changeIpcWebContents, IpcMainEventChannel } from './ipc-event-channel';
import { isMacOs11OrNewer } from './platform-version';
@@ -87,8 +88,10 @@ export default class UserInterface implements WindowControllerDelegate {
if (process.env.NODE_ENV === 'development') {
await this.installDevTools();
- // The devtools doesn't open on Windows if openDevTools is called without a delay here.
- window.once('ready-to-show', () => window.webContents.openDevTools({ mode: 'detach' }));
+ if (!process.argv.includes(CommandLineOptions.disableDevtoolsOpen)) {
+ // The devtools doesn't open on Windows if openDevTools is called without a delay here.
+ window.once('ready-to-show', () => window.webContents.openDevTools({ mode: 'detach' }));
+ }
}
switch (process.platform) {
diff --git a/gui/tasks/electron.js b/gui/tasks/electron.js
index 3469756397..e3360f36fb 100644
--- a/gui/tasks/electron.js
+++ b/gui/tasks/electron.js
@@ -1,16 +1,10 @@
const { spawn } = require('child_process');
const electron = require('electron');
-const DISABLE_RESET_NAVIGATION = '--disable-reset-navigation';
-
let subprocess;
function startElectron(done) {
- const args = [];
- if (process.argv.includes(DISABLE_RESET_NAVIGATION)) {
- args.push(DISABLE_RESET_NAVIGATION);
- }
-
+ const args = process.argv.slice(3);
subprocess = spawn(electron, ['.', ...args], {
env: { ...process.env, NODE_ENV: 'development' },
stdio: 'inherit',