diff --git a/public/electron.js b/public/electron.js index 9940824a..20f2ba39 100644 --- a/public/electron.js +++ b/public/electron.js @@ -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 }; diff --git a/src/App.jsx b/src/App.jsx index 04c529f0..734ddca6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -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;