File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ const amMainInstance = app.requestSingleInstanceLock();
9090if ( ! amMainInstance ) {
9191 app . quit ( ) ;
9292} else {
93+ const cliArgs = process . argv . slice ( 1 ) ;
94+
9395 app . on ( 'ready' , ( ) => {
9496 Menu . setApplicationMenu ( menu ) ;
9597 } ) ;
@@ -151,6 +153,18 @@ if (!amMainInstance) {
151153 window.httpToolkitDesktopVersion = '${ packageJson . version } ';
152154 window.postMessage({ httpToolkitDesktopVersion: window.httpToolkitDesktopVersion }, '*');
153155 ` ) ;
156+
157+ if ( cliArgs [ 0 ] === '--with-forwarding' ) {
158+ if ( ! cliArgs [ 1 ] || ! cliArgs [ 1 ] . includes ( '|' ) || cliArgs [ 1 ] . match ( / ' " \n / ) ) {
159+ console . error ( 'Invalid --with-forwarding argument' ) ;
160+ app . quit ( 1 ) ;
161+ } else {
162+ contents . executeJavaScript ( `
163+ window.httpToolkitForwardingDefault = '${ cliArgs [ 1 ] } ';
164+ window.postMessage({ httpToolkitForwardingDefault: window.httpToolkitForwardingDefault }, '*');
165+ ` ) ;
166+ }
167+ }
154168 } ) ;
155169
156170 // Redirect all navigations & new windows to the system browser
You can’t perform that action at this time.
0 commit comments