2 Commits

Author SHA1 Message Date
CherretGit
ad614b3b4a fix ByeDpiVpnService 2025-11-03 02:19:06 +07:00
CherretGit
5c8425573a change commands in ZaprettManager 2025-11-03 02:05:14 +07:00
2 changed files with 11 additions and 16 deletions

View File

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

View File

@@ -16,6 +16,7 @@ private val json = Json {
prettyPrint = true
ignoreUnknownKeys = true
coerceInputValues = true
encodeDefaults = true
}
private fun readConfig(): ZaprettConfig {
@@ -78,13 +79,13 @@ fun restartService(callback: (Boolean) -> Unit) {
}
fun getModuleVersion(callback: (String) -> Unit) {
Shell.cmd("zaprett module-ver").submit { result ->
Shell.cmd("zaprett module-version").submit { result ->
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
}
}
fun getBinVersion(callback: (String) -> Unit) {
Shell.cmd("zaprett bin-ver").submit { result ->
Shell.cmd("zaprett binary-version").submit { result ->
if (result.out.isNotEmpty()) callback(result.out.first()) else "undefined"
}
}
@@ -95,7 +96,7 @@ fun getConfigFile(): File {
fun setStartOnBoot(prefs: SharedPreferences, callback: (Boolean) -> Unit) {
if (prefs.getBoolean("use_module", false)) {
Shell.cmd("zaprett autostart").submit { result ->
Shell.cmd("zaprett set-autostart").submit { result ->
if (result.out.isNotEmpty() && result.out.toString().contains("true")) callback(true) else callback(false)
}
}