1
0
世界 3 жил өмнө
parent
commit
c8d9688bcf

+ 9 - 2
app/src/main/java/io/nekohasekai/sagernet/group/RawUpdater.kt

@@ -289,7 +289,7 @@ object RawUpdater : GroupUpdater() {
                                 serverAddress = proxy["server"] as String
                                 serverPort = proxy["port"].toString().toInt()
                                 password = proxy["password"] as String
-                                method = proxy["cipher"] as String
+                                method = clashCipher(proxy["cipher"] as String)
                                 plugin = pluginStr
                                 name = proxy["name"] as String?
 
@@ -370,7 +370,7 @@ object RawUpdater : GroupUpdater() {
                                     "name" -> entity.name = opt.value as String
                                     "server" -> entity.serverAddress = opt.value as String
                                     "port" -> entity.serverPort = opt.value.toString().toInt()
-                                    "cipher" -> entity.method = opt.value as String
+                                    "cipher" -> entity.method = clashCipher(opt.value as String)
                                     "password" -> entity.password = opt.value as String
                                     "obfs" -> entity.obfs = opt.value as String
                                     "protocol" -> entity.protocol = opt.value as String
@@ -420,6 +420,13 @@ object RawUpdater : GroupUpdater() {
         return null
     }
 
+    fun clashCipher(cipher: String): String {
+        return when (cipher) {
+            "dummy" -> "none"
+            else -> cipher
+        }
+    }
+
     fun parseWireGuard(conf: String): List<WireGuardBean> {
         val ini = Ini(StringReader(conf))
         val iface = ini["Interface"] ?: error("Missing 'Interface' selection")