Compare commits

..

6 commits

Author SHA1 Message Date
DHR60
891d8341ac
Merge 8e2348ed59 into b5800f7dfc 2026-02-09 02:49:06 +00:00
DHR60
8e2348ed59 Fix 2026-02-09 10:48:54 +08:00
DHR60
4eb5103a39 Remove EnableExInbound 2026-02-09 10:28:48 +08:00
DHR60
db13015bd4 Tun protect 2026-02-09 10:28:48 +08:00
DHR60
e9a6411698 Fix order 2026-02-09 10:17:42 +08:00
DHR60
6d35abe7ca Fix 2026-02-09 09:55:58 +08:00
3 changed files with 40 additions and 23 deletions

View file

@ -1233,28 +1233,19 @@ public static class ConfigHandler
/// <returns>A SOCKS profile item or null if not needed</returns> /// <returns>A SOCKS profile item or null if not needed</returns>
public static ProfileItem? GetPreSocksItem(Config config, ProfileItem node, ECoreType coreType) public static ProfileItem? GetPreSocksItem(Config config, ProfileItem node, ECoreType coreType)
{ {
if (node.ConfigType != EConfigType.Custom || !(node.PreSocksPort > 0))
{
return null;
}
ProfileItem? itemSocks = null; ProfileItem? itemSocks = null;
if (node.ConfigType != EConfigType.Custom && coreType != ECoreType.sing_box && config.TunModeItem.EnableTun) var preCoreType = AppManager.Instance.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
itemSocks = new ProfileItem()
{ {
itemSocks = new ProfileItem() CoreType = preCoreType,
{ ConfigType = EConfigType.SOCKS,
CoreType = ECoreType.sing_box, Address = Global.Loopback,
ConfigType = EConfigType.SOCKS, Port = node.PreSocksPort.Value,
Address = Global.Loopback, };
Port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks)
};
}
else if (node.ConfigType == EConfigType.Custom && node.PreSocksPort > 0)
{
var preCoreType = AppManager.Instance.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
itemSocks = new ProfileItem()
{
CoreType = preCoreType,
ConfigType = EConfigType.SOCKS,
Address = Global.Loopback,
Port = node.PreSocksPort.Value,
};
}
return itemSocks; return itemSocks;
} }

View file

@ -171,7 +171,8 @@ public static class CoreConfigHandler
var ruleOutboundNode = await AppManager.Instance.GetProfileItemViaRemarks(ruleItem.OutboundTag); var ruleOutboundNode = await AppManager.Instance.GetProfileItemViaRemarks(ruleItem.OutboundTag);
if (ruleOutboundNode != null) if (ruleOutboundNode != null)
{ {
await FillNodeContext(context, ruleOutboundNode); var ruleOutboundNodeAct = await FillNodeContext(context, ruleOutboundNode, false);
context.AllProxiesMap[$"remark:{ruleItem.OutboundTag}"] = ruleOutboundNodeAct;
} }
} }
} }

View file

@ -96,9 +96,34 @@ public class GroupProfileManager
return []; return [];
} }
var childProfileIds = Utils.String2List(extra.ChildItems) var childProfileIds = Utils.String2List(extra.ChildItems)
?.Where(p => !string.IsNullOrEmpty(p)) ?? []; ?.Where(p => !string.IsNullOrEmpty(p))
.ToList() ?? [];
if (childProfileIds.Count == 0)
{
return [];
}
var childProfiles = await AppManager.Instance.GetProfileItemsByIndexIds(childProfileIds); var childProfiles = await AppManager.Instance.GetProfileItemsByIndexIds(childProfileIds);
return childProfiles ?? []; if (childProfiles == null || childProfiles.Count == 0)
{
return [];
}
var profileMap = childProfiles
.Where(p => p != null && !p.IndexId.IsNullOrEmpty())
.GroupBy(p => p!.IndexId!)
.ToDictionary(g => g.Key, g => g.First());
var ordered = new List<ProfileItem>(childProfileIds.Count);
foreach (var id in childProfileIds)
{
if (id != null && profileMap.TryGetValue(id, out var item) && item != null)
{
ordered.Add(item);
}
}
return ordered;
} }
private static async Task<List<ProfileItem>> GetSubChildProfileItems(ProtocolExtraItem? extra) private static async Task<List<ProfileItem>> GetSubChildProfileItems(ProtocolExtraItem? extra)