From 04a648ec03af2c72563b64cf4c039b061411ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 28 Jan 2025 09:11:09 +0800 Subject: [PATCH 1/4] Update local DNS transport registration --- app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt | 2 -- .../java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt b/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt index 36264e8..fadfad6 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/BoxService.kt @@ -150,7 +150,6 @@ class BoxService( } DefaultNetworkMonitor.start() - Libbox.registerLocalDNSTransport(LocalResolver) Libbox.setMemoryLimit(!Settings.disableMemoryLimit) val newService = try { @@ -263,7 +262,6 @@ class BoxService( } commandServer?.setService(null) boxService = null - Libbox.registerLocalDNSTransport(null) DefaultNetworkMonitor.stop() commandServer?.apply { diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt index a6c6fe0..381fb87 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt @@ -10,6 +10,7 @@ import android.util.Log import androidx.annotation.RequiresApi import io.nekohasekai.libbox.InterfaceUpdateListener import io.nekohasekai.libbox.Libbox +import io.nekohasekai.libbox.LocalDNSTransport import io.nekohasekai.libbox.NetworkInterfaceIterator import io.nekohasekai.libbox.PlatformInterface import io.nekohasekai.libbox.StringIterator @@ -169,6 +170,10 @@ interface PlatformInterfaceWrapper : PlatformInterface { return WIFIState(ssid, wifiInfo.bssid) } + override fun localDNSTransport(): LocalDNSTransport? { + return LocalResolver + } + private class InterfaceArray(private val iterator: Iterator) : NetworkInterfaceIterator { From 9b0f3433cefb038940906fb495ae5d7f2d8de0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 8 Jan 2025 12:21:21 +0800 Subject: [PATCH 2/4] Add support for systemCertificates --- .../sfa/bg/PlatformInterfaceWrapper.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt index 381fb87..068a529 100644 --- a/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt +++ b/app/src/main/java/io/nekohasekai/sfa/bg/PlatformInterfaceWrapper.kt @@ -21,6 +21,9 @@ import java.net.Inet6Address import java.net.InetSocketAddress import java.net.InterfaceAddress import java.net.NetworkInterface +import java.security.KeyStore +import kotlin.io.encoding.Base64 +import kotlin.io.encoding.ExperimentalEncodingApi import io.nekohasekai.libbox.NetworkInterface as LibboxNetworkInterface interface PlatformInterfaceWrapper : PlatformInterface { @@ -174,6 +177,23 @@ interface PlatformInterfaceWrapper : PlatformInterface { return LocalResolver } + @OptIn(ExperimentalEncodingApi::class) + override fun systemCertificates(): StringIterator { + val certificates = mutableListOf() + val keyStore = KeyStore.getInstance("AndroidCAStore") + if (keyStore != null) { + keyStore.load(null, null); + val aliases = keyStore.aliases() + while (aliases.hasMoreElements()) { + val cert = keyStore.getCertificate(aliases.nextElement()) + certificates.add( + "-----BEGIN CERTIFICATE-----\n" + Base64.encode(cert.encoded) + "\n-----END CERTIFICATE-----" + ) + } + } + return StringArray(certificates.iterator()) + } + private class InterfaceArray(private val iterator: Iterator) : NetworkInterfaceIterator { From d5cb5bf928b737c03604ac573206de96f323a0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 20 Feb 2025 22:30:22 +0800 Subject: [PATCH 3/4] Fix missing links for new deprecated warnings --- .../java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt index 1068f2d..9a83679 100644 --- a/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt +++ b/app/src/main/java/io/nekohasekai/sfa/ui/main/DashboardFragment.kt @@ -138,9 +138,11 @@ class DashboardFragment : Fragment(R.layout.fragment_dashboard) { builder.setPositiveButton(R.string.ok) { _, _ -> loopShowDeprecatedNotes(notes) } - builder.setNeutralButton(R.string.service_error_deprecated_warning_documentation) { _, _ -> - requireContext().launchCustomTab(note.migrationLink) - loopShowDeprecatedNotes(notes) + if (!note.migrationLink.isNullOrBlank()) { + builder.setNeutralButton(R.string.service_error_deprecated_warning_documentation) { _, _ -> + requireContext().launchCustomTab(note.migrationLink) + loopShowDeprecatedNotes(notes) + } } builder.show() } From a69a17c33fdffb96cdc07b007d091b731d66e776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 12 Feb 2025 20:59:01 +0800 Subject: [PATCH 4/4] Bump version --- version.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.properties b/version.properties index b056faa..0f23408 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ -VERSION_CODE=478 -VERSION_NAME=1.11.3 -GO_VERSION=go1.23.5 +VERSION_CODE=484 +VERSION_NAME=1.12.0-alpha.11 +GO_VERSION=go1.24.0