mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-03 09:33:46 +00:00
Merge pull request #1243 from RonnieRen/bug/813
override the gwf rules with user rules
This commit is contained in:
@@ -85,7 +85,21 @@ func GeneratePACFile() -> Bool {
|
||||
let userRuleStr = try String(contentsOfFile: PACUserRuleFilePath, encoding: String.Encoding.utf8)
|
||||
let userRuleLines = userRuleStr.components(separatedBy: CharacterSet.newlines)
|
||||
|
||||
lines = userRuleLines + lines
|
||||
lines = userRuleLines + lines.filter { (line) in
|
||||
// ignore the rule from gwf if user provide same rule for the same url
|
||||
var i = line.startIndex
|
||||
while i < line.endIndex {
|
||||
if line[i] == "@" || line[i] == "|" {
|
||||
i = line.index(after: i)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
if i == line.startIndex {
|
||||
return !userRuleLines.contains(line)
|
||||
}
|
||||
return !userRuleLines.contains(String(line[i...]))
|
||||
}
|
||||
} catch {
|
||||
NSLog("Not found user-rule.txt")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user