From b65333b1c6f992978227c698c13022628a8ac5e5 Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Tue, 16 May 2023 09:35:45 +0900 Subject: [PATCH] Fix ConfigBuilder --- .../nekohasekai/sagernet/fmt/ConfigBuilder.kt | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt index 6935155..e3af583 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/ConfigBuilder.kt @@ -336,13 +336,6 @@ fun buildConfig( bypassDNSBeans += proxyEntity.requireBean() } - if (needGlobal) { - globalOutbounds[proxyEntity.id]?.let { - if (index == 0) chainTagOut = it // single, duplicate chain - return@forEachIndexed - } - } - // last profile set as "proxy" if (chainId == 0L && index == 0) { tagOut = TAG_PROXY @@ -353,10 +346,6 @@ fun buildConfig( tagOut = selectorName(bean.displayName()) } - // now tagOut is determined - if (needGlobal) { - globalOutbounds[proxyEntity.id] = tagOut - } // chain rules if (index > 0) { @@ -374,6 +363,15 @@ fun buildConfig( chainTagOut = tagOut } + // now tagOut is determined + if (needGlobal) { + globalOutbounds[proxyEntity.id]?.let { + if (index == 0) chainTagOut = it // single, duplicate chain + return@forEachIndexed + } + globalOutbounds[proxyEntity.id] = tagOut + } + // Chain outbound if (proxyEntity.needExternal()) { val localPort = mkPort() @@ -465,8 +463,8 @@ fun buildConfig( } if (Plugins.isUsingMatsuriExe(pluginId)) { needExternal = false - } else if (bean is HysteriaBean) { - throw Exception("not supported hysteria-plugin (SagerNet)") + } else if (pluginId.isNotBlank()) { + throw Exception("You are using an unsupported $pluginId, please download the correct plugin.") } } if (needExternal) {