diff --git a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs index cebf2d3f..b1e917b6 100644 --- a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs @@ -99,7 +99,12 @@ public static class CoreConfigHandler var nodes = await AppManager.Instance.GetProfileItemsByIndexIds(ids); foreach (var node in nodes) { - await FillNodeContext(context, node, false); + var actNode = await FillNodeContext(context, node, true); + if (node.IndexId == actNode.IndexId) + { + continue; + } + context.ServerTestItemMap[node.IndexId] = actNode.IndexId; } if (coreType == ECoreType.sing_box) { diff --git a/v2rayN/ServiceLib/Models/CoreConfigContext.cs b/v2rayN/ServiceLib/Models/CoreConfigContext.cs index 9551d39d..8c998e41 100644 --- a/v2rayN/ServiceLib/Models/CoreConfigContext.cs +++ b/v2rayN/ServiceLib/Models/CoreConfigContext.cs @@ -10,6 +10,9 @@ public record CoreConfigContext public Config AppConfig { get; init; } = new(); public FullConfigTemplateItem? FullConfigTemplate { get; init; } = new(); + // Test ServerTestItem Map + public Dictionary ServerTestItemMap { get; init; } = new(); + // TUN Compatibility public bool IsTunEnabled { get; init; } = false; public HashSet ProtectDomainList { get; init; } = new(); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs index c0ce7154..1fb409be 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs @@ -122,8 +122,9 @@ public partial class CoreConfigSingboxService(CoreConfigContext context) { continue; } - var item = context.AllProxiesMap.GetValueOrDefault(it.IndexId); - if (item is null || item.IsComplex() || !item.IsValid()) + var actIndexId = context.ServerTestItemMap.GetValueOrDefault(it.IndexId, it.IndexId); + var item = context.AllProxiesMap.GetValueOrDefault(actIndexId); + if (item is null || item.ConfigType is EConfigType.Custom || !item.IsValid()) { continue; } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index 3ad71592..49dcdf19 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -120,8 +120,9 @@ public partial class CoreConfigV2rayService(CoreConfigContext context) { continue; } - var item = context.AllProxiesMap.GetValueOrDefault(it.IndexId); - if (item is null || item.IsComplex() || !item.IsValid()) + var actIndexId = context.ServerTestItemMap.GetValueOrDefault(it.IndexId, it.IndexId); + var item = context.AllProxiesMap.GetValueOrDefault(actIndexId); + if (item is null || item.ConfigType is EConfigType.Custom || !item.IsValid()) { continue; }