This commit is contained in:
DHR60
2026-08-22 02:17:09 +00:00
committed by GitHub
parent c66c55b05e
commit 26a86f9bd2
4 changed files with 12 additions and 14 deletions

View File

@@ -1797,21 +1797,18 @@ public static class ConfigHandler
{
ECoreType.Xray => V2rayFmt.ResolveToCustom(strData, subRemarks),
ECoreType.sing_box => SingboxFmt.ResolveToCustom(strData, subRemarks),
_ => null
_ => null,
};
if (lstProfiles is not null)
if ((lstProfiles?.Count ?? 0) == 0)
{
if (lstProfiles.Count == 0)
{
return -1;
}
return -1;
}
var count = await AddBatchCustomServers(config, lstProfiles, subid, isSub);
if (count > 0)
{
return count;
}
var count = await AddBatchCustomServers(config, lstProfiles, subid, isSub);
if (count > 0)
{
return count;
}
return await SaveCustomRawFileServer(config, strData, subid, isSub, subItem, customCoreType);

View File

@@ -34,9 +34,9 @@ public class SingboxFmt : BaseFmt
if (!isOutbound)
{
var fullProfile = ResolveFull(jsonObject, subRemarks);
profileList.Add(fullProfile);
if (fullProfile is not null)
{
profileList.Add(fullProfile);
return profileList;
}
}

View File

@@ -34,9 +34,9 @@ public class V2rayFmt : BaseFmt
if (!isOutbound)
{
var fullProfile = ResolveFull(jsonObject, subRemarks);
profileList.Add(fullProfile);
if (fullProfile is not null)
{
profileList.Add(fullProfile);
return profileList;
}
}

View File

@@ -125,7 +125,8 @@ public partial class CoreConfigSingboxService
fullConfigTemplateNode["outbounds"] = customOutboundsNode;
// Process endpoints
if (fullConfigTemplateNode["endpoints"] is JsonArray { Count: > 0 } coreConfigEndpointsNode)
var coreConfigEndpointsNode = coreConfigNode?["endpoints"] as JsonArray ?? [];
if (coreConfigEndpointsNode is { Count: > 0 })
{
var customEndpointsNode = fullConfigTemplateNode["endpoints"] as JsonArray ?? [];
foreach (var endpoint in coreConfigEndpointsNode)