File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ @implementation SWBAppDelegate {
35
35
FSEventStreamRef fsEventStream;
36
36
NSString *configPath;
37
37
NSString *PACPath;
38
+ NSString *userRulePath;
38
39
AFHTTPRequestOperationManager *manager;
39
40
}
40
41
@@ -111,6 +112,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
111
112
112
113
configPath = [NSString stringWithFormat: @" %@ /%@ " , NSHomeDirectory (), @" .ShadowsocksX" ];
113
114
PACPath = [NSString stringWithFormat: @" %@ /%@ " , configPath, @" gfwlist.js" ];
115
+ userRulePath = [NSString stringWithFormat: @" %@ /%@ " , configPath, @" user-rule.txt" ];
114
116
[self monitorPAC: configPath];
115
117
appDelegate = self;
116
118
}
@@ -452,6 +454,13 @@ - (void)updatePACFromGFWList {
452
454
// Objective-C is bullshit
453
455
NSString *str2 = [[NSString alloc ] initWithData: data2 encoding: NSUTF8StringEncoding];
454
456
NSArray *lines = [str2 componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet ]];
457
+
458
+ NSString *str3 = [[NSString alloc ] initWithContentsOfFile: userRulePath encoding: NSUTF8StringEncoding error: nil ];
459
+ if (str3) {
460
+ NSArray *rules = [str3 componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet ]];
461
+ lines = [lines arrayByAddingObjectsFromArray: rules];
462
+ }
463
+
455
464
NSMutableArray *filtered = [[NSMutableArray alloc ] init ];
456
465
for (NSString *line in lines) {
457
466
if ([line length ] > 0 ) {
You can’t perform that action at this time.
0 commit comments