fix crash on old version android (<= 9) (#183)
Some checks failed
EasyTier Core / pre_job (push) Has been cancelled
EasyTier GUI / pre_job (push) Has been cancelled
EasyTier Mobile / pre_job (push) Has been cancelled
EasyTier Test / pre_job (push) Has been cancelled
EasyTier Core / build (macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, arm-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, arm-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, armv7-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, armv7-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, mips-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, mipsel-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (ubuntu-latest, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / core-result (push) Has been cancelled
EasyTier GUI / build-gui (aarch64-apple-darwin, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (aarch64-unknown-linux-gnu, ubuntu-latest, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (x86_64-pc-windows-msvc, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / build-gui (x86_64-unknown-linux-gnu, ubuntu-latest, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / gui-result (push) Has been cancelled
EasyTier Mobile / build-mobile (ubuntu-latest, android) (push) Has been cancelled
EasyTier Mobile / mobile-result (push) Has been cancelled
EasyTier Test / test (push) Has been cancelled

* fix crash on old version android (<= 9)
* fix listener select
This commit is contained in:
Sijie.Sun 2024-07-19 23:55:11 +08:00 committed by GitHub
parent 8858492fb4
commit fc9812dd54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 12 deletions

View File

@ -102,6 +102,10 @@ const searchListenerSuggestiong = (e: { query: string }) => {
}
}
if (ret.length === 0) {
ret.push(e.query)
}
listenerSuggestions.value = ret
}

View File

@ -2,7 +2,6 @@ package com.plugin.vpnservice
import android.content.Intent
import android.net.VpnService
import android.net.IpPrefix
import android.os.Build
import android.os.ParcelFileDescriptor
import android.os.Bundle
@ -11,16 +10,6 @@ import java.util.Arrays
import app.tauri.plugin.JSObject
fun stringToIpPrefix(ipPrefixString: String): IpPrefix {
val parts = ipPrefixString.split("/")
if (parts.size != 2) throw IllegalArgumentException("Invalid IP prefix string")
val address = InetAddress.getByName(parts[0])
val prefixLength = parts[1].toInt()
return IpPrefix(address, prefixLength)
}
class TauriVpnService : VpnService() {
companion object {
@JvmField var triggerCallback: (String, JSObject) -> Unit = { _, _ -> }
@ -99,7 +88,9 @@ class TauriVpnService : VpnService() {
builder.addDnsServer(dns)
for (route in routes) {
builder.addRoute(stringToIpPrefix(route))
val ipParts = ipv4Addr.split("/")
if (ipParts.size != 2) throw IllegalArgumentException("Invalid IP addr string")
builder.addAddress(ipParts[0], ipParts[1].toInt())
}
for (app in disallowedApplications) {