Fix (#7946)
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

https://github.com/2dust/v2rayN/pull/7937
This commit is contained in:
DHR60 2025-09-13 11:13:09 +08:00 committed by GitHub
parent ec627bdb82
commit cb182125f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,11 +72,6 @@ public partial class CoreConfigSingboxService
} }
var hostsDomains = new List<string>(); var hostsDomains = new List<string>();
var systemHostsMap = Utils.GetSystemHosts();
foreach (var kvp in systemHostsMap)
{
hostsDomains.Add(kvp.Key);
}
var dnsItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box); var dnsItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box);
if (dnsItem == null || dnsItem.Enabled == false) if (dnsItem == null || dnsItem.Enabled == false)
{ {
@ -89,12 +84,23 @@ public partial class CoreConfigSingboxService
hostsDomains.Add(kvp.Key); hostsDomains.Add(kvp.Key);
} }
} }
if (simpleDNSItem.UseSystemHosts == true)
{
var systemHostsMap = Utils.GetSystemHosts();
foreach (var kvp in systemHostsMap)
{
hostsDomains.Add(kvp.Key);
} }
}
}
if (hostsDomains.Count > 0)
{
singboxConfig.route.rules.Add(new() singboxConfig.route.rules.Add(new()
{ {
action = "resolve", action = "resolve",
domain = hostsDomains, domain = hostsDomains,
}); });
}
singboxConfig.route.rules.Add(new() singboxConfig.route.rules.Add(new()
{ {