@@ -22,6 +22,7 @@ @interface AppDelegate () {
2222 BOOL proxyIsOn;
2323 NSInteger proxyMode; // 0 = v2ray rules; 1 = pac; 2 = global
2424 NSInteger localPort;
25+ NSInteger httpPort;
2526 BOOL udpSupport;
2627 NSInteger selectedServerIndex;
2728 NSMutableArray *profiles;
@@ -250,6 +251,7 @@ - (void)readDefaults {
250251 proxyIsOn = [defaultsDic[@" proxyState" ] boolValue ];
251252 proxyMode = [defaultsDic[@" proxyMode" ] integerValue ];
252253 localPort = [defaultsDic[@" localPort" ] integerValue ];
254+ httpPort = [defaultsDic[@" httpPort" ] integerValue ];
253255 udpSupport = [defaultsDic[@" udpSupport" ] integerValue ];
254256 [profiles removeAllObjects ];
255257 profiles = defaultsDic[@" profiles" ];
@@ -262,6 +264,7 @@ - (NSDictionary*)readDefaultsAsDictionary {
262264 NSNumber *dProxyState = nilCoalescing ([defaults objectForKey: @" proxyIsOn" ], [NSNumber numberWithBool: NO ]); // turn on proxy as default
263265 NSNumber *dMode = nilCoalescing ([defaults objectForKey: @" proxyMode" ], @0 ); // use v2ray rules as defualt mode
264266 NSNumber * dLocalPort = nilCoalescing ([defaults objectForKey: @" localPort" ], @1081 );// use 1081 as default local port
267+ NSNumber * dHttpPort = nilCoalescing ([defaults objectForKey: @" httpPort" ], @8001 ); // use 8001 as default local http port
265268 NSNumber * dUdpSupport = nilCoalescing ([defaults objectForKey: @" udpSupport" ], [NSNumber numberWithBool: NO ]);// do not support udp as default
266269 NSNumber * dShareOverLan = nilCoalescing ([defaults objectForKey: @" shareOverLan" ], [NSNumber numberWithBool: NO ]); // do not share over lan as default
267270 NSString *dDnsString = nilCoalescing ([defaults objectForKey: @" dns" ], @" " );
@@ -294,6 +297,7 @@ - (NSDictionary*)readDefaultsAsDictionary {
294297 return @{@" proxyState" : dProxyState,
295298 @" proxyMode" : dMode,
296299 @" localPort" : dLocalPort,
300+ @" httpPort" : dHttpPort,
297301 @" udpSupport" : dUdpSupport,
298302 @" shareOverLan" : dShareOverLan,
299303 @" profiles" : dProfiles,
@@ -517,7 +521,8 @@ - (void)monitorPAC:(NSString *)filePath {
517521
518522- (IBAction )copyExportCmd : (id )sender {
519523 [[NSPasteboard generalPasteboard ] clearContents ];
520- [[NSPasteboard generalPasteboard ] setString: @" export http_proxy=\" http://127.0.0.1:8001\" " forType: NSStringPboardType ];
524+ NSString * command = [NSString stringWithFormat: @" export http_proxy=\" http://127.0.0.1:%ld \" ; export HTTP_PROXY=\" http://127.0.0.1:%ld \" ; export https_proxy=\" http://127.0.0.1:%ld \" ; export HTTPS_PROXY=\" http://127.0.0.1:%ld \" " , httpPort, httpPort, httpPort, httpPort];
525+ [[NSPasteboard generalPasteboard ] setString: command forType: NSStringPboardType ];
521526}
522527
523528void onPACChange (
0 commit comments