From 6aa4b7021bc810aa738f273407fc70faf385a98b Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 4 Oct 2019 19:28:24 +0200 Subject: [PATCH 1/2] Support --with-forwarding preconfiguration argument --- src/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 From 12fbe9e7277ee360a5fb39561f11e981e0f372ce Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Fri, 4 Oct 2019 19:52:01 +0200 Subject: [PATCH 2/2] Test release for 0.1.16 with forwarding --- appveyor.yml | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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",