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();
90
90
if ( ! amMainInstance ) {
91
91
app . quit ( ) ;
92
92
} else {
93
+ const cliArgs = process . argv . slice ( 1 ) ;
94
+
93
95
app . on ( 'ready' , ( ) => {
94
96
Menu . setApplicationMenu ( menu ) ;
95
97
} ) ;
@@ -151,6 +153,18 @@ if (!amMainInstance) {
151
153
window.httpToolkitDesktopVersion = '${ packageJson . version } ';
152
154
window.postMessage({ httpToolkitDesktopVersion: window.httpToolkitDesktopVersion }, '*');
153
155
` ) ;
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
+ }
154
168
} ) ;
155
169
156
170
// Redirect all navigations & new windows to the system browser
You can’t perform that action at this time.
0 commit comments