diff --git a/app/src/main.ts b/app/src/main.ts index 390af21..7fede7a 100644 --- a/app/src/main.ts +++ b/app/src/main.ts @@ -29,6 +29,21 @@ if (require('electron-squirrel-startup')) { const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8')); +// Take in a URL on the command line as an override +if (process.argv.length > 1) { + const maybeUrl = process.argv[1]; + try { + new URL(maybeUrl); + appArgs.targetUrl = maybeUrl; + console.info('Loading override URL passed as argument:', maybeUrl); + } catch (err) { + console.error( + 'Not loading override URL passed as argument, because failed to parse:', + maybeUrl, + ); + } +} + // Nativefier is a browser, and an old browser is an insecure / badly-performant one. // Given our builder/app design, we currently don't have an easy way to offer // upgrades from the app themselves (like browsers do).