Fix ConfigBuilder

This commit is contained in:
arm64v8a 2023-05-16 09:35:45 +09:00
parent 29a5914e8b
commit b65333b1c6

View File

@ -336,13 +336,6 @@ fun buildConfig(
bypassDNSBeans += proxyEntity.requireBean() bypassDNSBeans += proxyEntity.requireBean()
} }
if (needGlobal) {
globalOutbounds[proxyEntity.id]?.let {
if (index == 0) chainTagOut = it // single, duplicate chain
return@forEachIndexed
}
}
// last profile set as "proxy" // last profile set as "proxy"
if (chainId == 0L && index == 0) { if (chainId == 0L && index == 0) {
tagOut = TAG_PROXY tagOut = TAG_PROXY
@ -353,10 +346,6 @@ fun buildConfig(
tagOut = selectorName(bean.displayName()) tagOut = selectorName(bean.displayName())
} }
// now tagOut is determined
if (needGlobal) {
globalOutbounds[proxyEntity.id] = tagOut
}
// chain rules // chain rules
if (index > 0) { if (index > 0) {
@ -374,6 +363,15 @@ fun buildConfig(
chainTagOut = tagOut 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 // Chain outbound
if (proxyEntity.needExternal()) { if (proxyEntity.needExternal()) {
val localPort = mkPort() val localPort = mkPort()
@ -465,8 +463,8 @@ fun buildConfig(
} }
if (Plugins.isUsingMatsuriExe(pluginId)) { if (Plugins.isUsingMatsuriExe(pluginId)) {
needExternal = false needExternal = false
} else if (bean is HysteriaBean) { } else if (pluginId.isNotBlank()) {
throw Exception("not supported hysteria-plugin (SagerNet)") throw Exception("You are using an unsupported $pluginId, please download the correct plugin.")
} }
} }
if (needExternal) { if (needExternal) {