diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs index 4e24d8e2..d06df2f0 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs @@ -15,6 +15,26 @@ public partial class CoreConfigSingboxService(Config config) var ret = new RetResult(); try { + if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain) + { + ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem); + if (profileGroupItem == null || profileGroupItem.ChildItems.IsNullOrEmpty()) + { + ret.Msg = ResUI.CheckServerSettings; + return ret; + } + if (node.ConfigType is EConfigType.PolicyGroup) + { + var childProfiles = (await Task.WhenAll( + Utils.String2List(profileGroupItem.ChildItems) + .Where(p => !p.IsNullOrEmpty()) + .Select(AppManager.Instance.GetProfileItem) + )).Where(p => p != null).ToList(); + return await GenerateClientMultipleLoadConfig(childProfiles); + } + // TODO proxy chain + } + if (node == null || node.Port <= 0) { diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index 24b41109..970b0a33 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -15,6 +15,26 @@ public partial class CoreConfigV2rayService(Config config) var ret = new RetResult(); try { + if (node?.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain) + { + ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem); + if (profileGroupItem == null || profileGroupItem.ChildItems.IsNullOrEmpty()) + { + ret.Msg = ResUI.CheckServerSettings; + return ret; + } + if (node.ConfigType is EConfigType.PolicyGroup) + { + var childProfiles = (await Task.WhenAll( + Utils.String2List(profileGroupItem.ChildItems) + .Where(p => !p.IsNullOrEmpty()) + .Select(AppManager.Instance.GetProfileItem) + )).Where(p => p != null).ToList(); + return await GenerateClientMultipleLoadConfig(childProfiles, profileGroupItem.MultipleLoad); + } + // TODO proxy chain + } + if (node == null || node.Port <= 0) {