Compare commits

...

2 commits

Author SHA1 Message Date
DHR60
5851785156
Merge 2a7095aa1e into 29a5abf4d6 2025-09-12 03:36:08 +00:00
DHR60
2a7095aa1e Avoid duplicate tags 2025-09-12 11:35:47 +08:00
2 changed files with 29 additions and 14 deletions

View file

@ -338,6 +338,20 @@ public partial class CoreConfigSingboxService
var node = await AppManager.Instance.GetProfileItemViaRemarks(outboundTag);
if (node == null
|| (!Global.SingboxSupportConfigType.Contains(node.ConfigType)
&& node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain)))
{
return Global.ProxyTag;
}
var tag = Global.ProxyTag + node.IndexId.ToString();
if (singboxConfig.outbounds.Any(o => o.tag == tag)
|| (singboxConfig.endpoints != null && singboxConfig.endpoints.Any(e => e.tag == tag)))
{
return tag;
}
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
{
ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem);
@ -370,19 +384,13 @@ public partial class CoreConfigSingboxService
return Global.ProxyTag;
}
if (node == null
|| !Global.SingboxSupportConfigType.Contains(node.ConfigType))
{
return Global.ProxyTag;
}
var server = await GenServer(node);
if (server is null)
{
return Global.ProxyTag;
}
server.tag = Global.ProxyTag + node.IndexId.ToString();
server.tag = tag;
if (server is Endpoints4Sbox endpoint)
{
singboxConfig.endpoints ??= new();

View file

@ -126,6 +126,19 @@ public partial class CoreConfigV2rayService
var node = await AppManager.Instance.GetProfileItemViaRemarks(outboundTag);
if (node == null
|| (!Global.XraySupportConfigType.Contains(node.ConfigType)
&& node.ConfigType is not (EConfigType.PolicyGroup or EConfigType.ProxyChain)))
{
return Global.ProxyTag;
}
var tag = Global.ProxyTag + node.IndexId.ToString();
if (v2rayConfig.outbounds.Any(p => p.tag == tag))
{
return tag;
}
if (node.ConfigType is EConfigType.PolicyGroup or EConfigType.ProxyChain)
{
ProfileGroupItemManager.Instance.TryGet(node.IndexId, out var profileGroupItem);
@ -162,16 +175,10 @@ public partial class CoreConfigV2rayService
return Global.ProxyTag;
}
if (node == null
|| !Global.XraySupportConfigType.Contains(node.ConfigType))
{
return Global.ProxyTag;
}
var txtOutbound = EmbedUtils.GetEmbedText(Global.V2raySampleOutbound);
var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
await GenOutbound(node, outbound);
outbound.tag = Global.ProxyTag + node.IndexId.ToString();
outbound.tag = tag;
v2rayConfig.outbounds.Add(outbound);
return outbound.tag;