fix ByeDpiVpnService

This commit is contained in:
CherretGit
2025-11-03 02:19:06 +07:00
parent 5c8425573a
commit ad614b3b4a

View File

@@ -266,24 +266,18 @@ class ByeDpiVpnService : VpnService() {
.flatMap { arg -> .flatMap { arg ->
if (getHostListMode(sharedPreferences) == "whitelist") { if (getHostListMode(sharedPreferences) == "whitelist") {
when { when {
arg == "\$hostlist" && list.isNotEmpty() -> listOf("-H", list) arg == "\$hostlist" && list.isNotEmpty() -> listOf("--hosts", list)
arg == "\$hostlist" && list.isEmpty() -> emptyList() arg == "\$hostlist" && list.isEmpty() -> emptyList()
arg == "\$ipset" && list.isNotEmpty() -> listOf("-H", list) arg == "\$ipset" && list.isNotEmpty() -> listOf("--ipset", list)
arg == "\$ipset" && list.isEmpty() -> emptyList() arg == "\$ipset" && list.isEmpty() -> emptyList()
else -> listOf(arg) else -> listOf(arg)
} }
} else { } else {
if (list.isNotEmpty()) { when {
listOf("-H", list, "-An", arg).filter { it != "\$hostlist" } arg == "\$hostlist" && list.isNotEmpty() -> listOf("--hosts", list, "-An", list)
} else { arg == "\$ipset" && ipset.isNotEmpty() -> listOf("--ipset", ipset, "-An", ipset)
listOf("-An", arg).filter { it != "\$hostlist" } arg == "\$hostlist" || arg == "\$ipset" -> emptyList()
} else -> listOf(arg)
if (ipset.isEmpty()) {
listOf("-H", list, "-An", arg).filter { it != "\$ipset" }
}
else {
listOf("-An", arg).filter { it != "\$ipset" }
} }
} }
} }