diff --git a/appveyor.yml b/appveyor.yml index 5555abf..f2d9d18 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ artifacts: branches: only: - master - - /^v\d\.\d\.\d/ + - /^v\d\.\d\.\d(-.*)?/ install: - ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1')) diff --git a/package-lock.json b/package-lock.json index d4e3086..648970e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "httptoolkit-desktop", - "version": "0.1.15", + "version": "0.1.16-forwarding", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7adac78..60cbcc2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "httptoolkit-desktop", "productName": "HTTP Toolkit", - "version": "0.1.15", + "version": "0.1.16-forwarding", "private": true, "description": "HTTP(S) debugging proxy, analyzer and client", "main": "src/index.ts", diff --git a/src/index.ts b/src/index.ts index 9e4ba8b..b02d3ba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -90,6 +90,8 @@ const amMainInstance = app.requestSingleInstanceLock(); if (!amMainInstance) { app.quit(); } else { + const cliArgs = process.argv.slice(1); + app.on('ready', () => { Menu.setApplicationMenu(menu); }); @@ -151,6 +153,18 @@ if (!amMainInstance) { window.httpToolkitDesktopVersion = '${packageJson.version}'; window.postMessage({ httpToolkitDesktopVersion: window.httpToolkitDesktopVersion }, '*'); `); + + if (cliArgs[0] === '--with-forwarding') { + if (!cliArgs[1] || !cliArgs[1].includes('|') || cliArgs[1].match(/'"\n/)) { + console.error('Invalid --with-forwarding argument'); + app.quit(1); + } else { + contents.executeJavaScript(` + window.httpToolkitForwardingDefault = '${cliArgs[1]}'; + window.postMessage({ httpToolkitForwardingDefault: window.httpToolkitForwardingDefault }, '*'); + `); + } + } }); // Redirect all navigations & new windows to the system browser