sync ssr-local for protocol method

1. 支持协议参数,为单端口多用户做好准备
2. 支持Group参数,可用于分组节点列表
This commit is contained in:
qinyuhang
2017-01-08 21:10:50 +08:00
parent 3643070280
commit 9ed1eb08e6
11 changed files with 134 additions and 59 deletions
+10 -3
View File
@@ -80,6 +80,7 @@ class ServerProfileManager: NSObject {
openPanel.canChooseFiles = true
openPanel.becomeKey()
openPanel.begin { (result) -> Void in
// TODO not freeze the screen when running import process
if (result == NSFileHandlingPanelOKButton && (openPanel.url) != nil) {
let fileManager = FileManager.default
let filePath:String = (openPanel.url?.path)!
@@ -97,14 +98,17 @@ class ServerProfileManager: NSObject {
profile.method = item["method"] as! String
profile.password = item["password"] as! String
profile.remark = item["remarks"] as! String
if(item["group"] != nil){
profile.ssrGroup = item["group"] as! String
}
if (item["obfs"] != nil) {
profile.ssrObfs = item["obfs"] as! String
profile.ssrProtocol = item["protocol"] as! String
if (item["obfsparam"] != nil){
profile.ssrObfsParam = item["obfsparam"] as! String
}
if (item["protocolparam"] != nil){
profile.ssrProtocolParam = item["protocolparam"] as! String
if (item["protoparam"] != nil){
profile.ssrProtocolParam = item["protoparam"] as! String
}
}
self.profiles.append(profile)
@@ -159,9 +163,12 @@ class ServerProfileManager: NSObject {
configProfile.setValue(profile.ssrObfsParam, forKey: "obfsparam")
}
if profile.ssrProtocolParam != "" {
configProfile.setValue(profile.ssrProtocolParam, forKey: "protoclparam")
configProfile.setValue(profile.ssrProtocolParam, forKey: "protoparam")
}
}
if profile.ssrGroup != "" {
configProfile.setValue(profile.ssrGroup, forKey: "group")
}
configsArray.add(configProfile)
}
jsonArr1.setValue(configsArray, forKey: "configs")