From 341cdb5dbe75eefa0b6d73fd72b781167065d616 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 31 Oct 2024 19:30:18 +0800 Subject: [PATCH] Add migrate2ProfileCustom --- .../kotlin/com/v2ray/ang/util/MigrateManager.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/MigrateManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/MigrateManager.kt index fb9a6524..9f2bdca3 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/MigrateManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/MigrateManager.kt @@ -53,6 +53,8 @@ object MigrateManager { EConfigType.WIREGUARD.name.lowercase() -> migrate2ProfileWireguard(configOld) EConfigType.HYSTERIA2.name.lowercase() -> migrate2ProfileHysteria2(configOld) + EConfigType.CUSTOM.name.lowercase() -> migrate2ProfileCustom(configOld) + else -> null } } @@ -161,6 +163,18 @@ object MigrateManager { return config } + private fun migrate2ProfileCustom(configOld: ServerConfig): ProfileItem? { + val config = ProfileItem.create(EConfigType.CUSTOM) + + val outbound = configOld.getProxyOutbound() ?: return null + config.remarks = configOld.remarks + config.server = outbound.getServerAddress() + config.serverPort = outbound.getServerPort().toString() + + return config + } + + private fun decodeServerConfigOld(guid: String): ServerConfig? { if (guid.isBlank()) { return null