diff --git a/V2rayU/Import.swift b/V2rayU/Import.swift index 5dc311a..fd96ff9 100644 --- a/V2rayU/Import.swift +++ b/V2rayU/Import.swift @@ -296,6 +296,16 @@ class ImportUri { } func importVless(vmess: VlessUri) { + if vmess.fp.isEmpty { + vmess.fp = "chrome" + } + if vmess.security.isEmpty { + vmess.security = "none" + } + if vmess.flow.isEmpty { + vmess.flow = "xtls-rprx-vision" + } + let v2ray = V2rayConfig() v2ray.serverProtocol = V2rayProtocolOutbound.vless.rawValue @@ -398,7 +408,6 @@ class ImportUri { svr.address = trojan.host svr.port = trojan.port svr.password = trojan.password - svr.flow = trojan.flow v2ray.serverTrojan = svr v2ray.enableMux = false @@ -492,7 +501,7 @@ func importByClash(clash: clashProxy) -> ImportUri? { item.address = clash.server item.port = clash.port item.id = clash.uuid ?? "" - item.security = clash.cipher ?? "auto" + item.security = clash.cipher ?? "none" // vless encryption item.type = clash.network ?? "tcp" item.sni = clash.sni ?? clash.server if clash.security == "reality" { diff --git a/V2rayU/Preference/PreferencePac.swift b/V2rayU/Preference/PreferencePac.swift index e5d4817..6abc55b 100644 --- a/V2rayU/Preference/PreferencePac.swift +++ b/V2rayU/Preference/PreferencePac.swift @@ -109,14 +109,17 @@ final class PreferencePacViewController: NSViewController, PreferencePane { let session = URLSession(configuration: getProxyUrlSessionConfigure()) let task = session.dataTask(with: URLRequest(url: reqUrl)){(data: Data?, response: URLResponse?, error: Error?) in if error != nil { - self.tips.stringValue = "Failed to download latest GFW List: \(String(describing: error))" + DispatchQueue.main.async { + self.tips.stringValue = "Failed to download latest GFW List: \(String(describing: error))" + } } else { if data != nil { if let outputStr = String(data: data!, encoding: String.Encoding.utf8) { do { try outputStr.write(toFile: GFWListFilePath, atomically: true, encoding: String.Encoding.utf8) - - self.tips.stringValue = "gfwList has been updated" + DispatchQueue.main.async { + self.tips.stringValue = "gfwList has been updated" + } NSLog("\(self.tips.stringValue)") // save to UserDefaults @@ -124,20 +127,28 @@ final class PreferencePacViewController: NSViewController, PreferencePane { if GeneratePACFile(rewrite: true) { // Popup a user notification - self.tips.stringValue = "PAC has been updated by latest GFW List." + DispatchQueue.main.async { + self.tips.stringValue = "PAC has been updated by latest GFW List." + } NSLog("\(self.tips.stringValue)") } } catch { // Popup a user notification - self.tips.stringValue = "Failed to Write latest GFW List." + DispatchQueue.main.async { + self.tips.stringValue = "Failed to Write latest GFW List." + } NSLog("\(self.tips.stringValue)") } } else { - self.tips.stringValue = "Failed to download latest GFW List." + DispatchQueue.main.async { + self.tips.stringValue = "Failed to download latest GFW List." + } } } else { // Popup a user notification - self.tips.stringValue = "Failed to download latest GFW List." + DispatchQueue.main.async { + self.tips.stringValue = "Failed to download latest GFW List." + } self.tryDownloadByShell(gfwPacListUrl: gfwPacListUrl) } } @@ -153,7 +164,9 @@ final class PreferencePacViewController: NSViewController, PreferencePane { NSLog("curl result: \(msg)") if GeneratePACFile(rewrite: true) { // Popup a user notification - self.tips.stringValue = "PAC has been updated by latest GFW List." + DispatchQueue.main.async { + self.tips.stringValue = "PAC has been updated by latest GFW List." + } } } } @@ -256,6 +269,7 @@ func getPacUserRules() -> String { ||github.com ||chat.openai.com ||openai.com + ||chatgpt.com """ do { let url = URL(fileURLWithPath: PACUserRuleFilePath) diff --git a/V2rayU/v2ray/V2rayConfig.swift b/V2rayU/v2ray/V2rayConfig.swift index 55c4692..ce09939 100644 --- a/V2rayU/v2ray/V2rayConfig.swift +++ b/V2rayU/v2ray/V2rayConfig.swift @@ -770,6 +770,12 @@ class V2rayConfig: NSObject { user.id = val["id"].stringValue user.flow = val["flow"].stringValue user.encryption = val["encryption"].stringValue + if user.flow.isEmpty { + user.flow = "xtls-rprx-vision" + } + if user.encryption.isEmpty { + user.encryption = "none" + } user.level = val["level"].intValue users.append(user) }