add flag `--disable-networking`

closes #1418
pull/1452/head
Mikael Finstad 3 years ago
parent d2414e9c4e
commit bc4edf9829
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -38,6 +38,7 @@ let mainWindow;
let askBeforeClose = false;
let rendererReady = false;
let newVersion;
let disableNetworking;
const openFiles = (paths) => mainWindow.webContents.send('openFiles', paths);
@ -143,7 +144,7 @@ function parseCliArgs(rawArgv = process.argv) {
// dev: First 2 args are electron and the electron.js
const argsWithoutAppName = rawArgv.length > ignoreFirstArgs ? rawArgv.slice(ignoreFirstArgs) : [];
return yargsParser(argsWithoutAppName, { boolean: ['allow-multiple-instances'] });
return yargsParser(argsWithoutAppName, { boolean: ['allow-multiple-instances', 'disable-networking'] });
}
const argv = parseCliArgs();
@ -187,6 +188,8 @@ if (!argv.allowMultipleInstances && !safeRequestSingleInstanceLock({ argv: proce
if (filesToOpen.length === 0) filesToOpen = argv._;
const { settingsJson } = argv;
({ disableNetworking } = argv);
if (settingsJson != null) {
logger.info('initializing settings', settingsJson);
Object.entries(JSON5.parse(settingsJson)).forEach(([key, value]) => {
@ -207,7 +210,7 @@ if (!argv.allowMultipleInstances && !safeRequestSingleInstanceLock({ argv: proce
const enableUpdateCheck = configStore.get('enableUpdateCheck');
if (enableUpdateCheck && !isStoreBuild) {
if (!disableNetworking && enableUpdateCheck && !isStoreBuild) {
newVersion = await checkNewVersion();
// newVersion = '1.2.3';
if (newVersion) updateMenu();
@ -265,4 +268,6 @@ function focusWindow() {
}
}
module.exports = { focusWindow, isDev };
const hasDisabledNetworking = () => !!disableNetworking;
module.exports = { focusWindow, isDev, hasDisabledNetworking };

@ -91,7 +91,7 @@ const remote = window.require('@electron/remote');
const { dialog } = remote;
const { focusWindow } = remote.require('./electron');
const { focusWindow, hasDisabledNetworking } = remote.require('./electron');
const calcShouldShowWaveform = (zoomedDuration) => (zoomedDuration != null && zoomedDuration < ffmpegExtractWindow * 8);
@ -2029,7 +2029,7 @@ const App = memo(() => {
}, []);
useEffect(() => {
if (!isStoreBuild) loadMifiLink().then(setMifiLink);
if (!isStoreBuild && !hasDisabledNetworking()) loadMifiLink().then(setMifiLink);
}, []);
const haveCustomFfPath = !!customFfPath;

Loading…
Cancel
Save