From 185c5e4bfbc72d8b2ebe8515f1c7877ca72a7b29 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sat, 4 Oct 2025 16:17:39 +0800 Subject: [PATCH] Fix (#8057) --- v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 11 +------ v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 5 +-- v2rayN/ServiceLib/Resx/ResUI.hu.resx | 5 +-- v2rayN/ServiceLib/Resx/ResUI.resx | 5 +-- v2rayN/ServiceLib/Resx/ResUI.ru.resx | 5 +-- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 5 +-- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 5 +-- .../V2ray/CoreConfigV2rayService.cs | 2 +- .../V2ray/V2rayConfigTemplateService.cs | 32 +++++++++++++++++-- .../Views/DNSSettingWindow.axaml | 7 ---- v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 7 ---- 11 files changed, 38 insertions(+), 51 deletions(-) diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 19ca4f0d..eddaa0a7 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2932,16 +2932,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 The sing-box DoH resolution server can be overwritten 的本地化字符串。 - /// - public static string TbSBDoHOverride { - get { - return ResourceManager.GetString("TbSBDoHOverride", resourceCulture); - } - } - - /// - /// 查找类似 Fallback DNS Resolution, Require IP 的本地化字符串。 + /// 查找类似 Resolve DNS server domains, requires IP 的本地化字符串。 /// public static string TbSBFallbackDNSResolve { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 7be84774..14b1ff6f 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1429,7 +1429,7 @@ Bootstrap DNS (sing-box) - Fallback DNS Resolution, Require IP + Resolve DNS server domains, requires IP xray Freedom Resolution Strategy @@ -1443,9 +1443,6 @@ Add Common DNS Hosts - - The sing-box DoH resolution server can be overwritten - FakeIP diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index a4701f0b..fb8c6a11 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -1429,7 +1429,7 @@ Bootstrap DNS (sing-box) - Fallback DNS Resolution, Require IP + Resolve DNS server domains, requires IP xray Freedom Resolution Strategy @@ -1443,9 +1443,6 @@ Add Common DNS Hosts - - The sing-box DoH resolution server can be overwritten - FakeIP diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 94e03415..5b145da3 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1429,7 +1429,7 @@ Bootstrap DNS (sing-box) - Fallback DNS Resolution, Require IP + Resolve DNS server domains, requires IP xray Freedom Resolution Strategy @@ -1443,9 +1443,6 @@ Add Common DNS Hosts - - The sing-box DoH resolution server can be overwritten - FakeIP diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index c72c83cf..27c2d0a3 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1429,7 +1429,7 @@ Bootstrap DNS (sing-box) - Fallback DNS Resolution, Require IP + Resolve DNS server domains, requires IP Стратегия резолвинга Freedom (Xray) @@ -1443,9 +1443,6 @@ Добавить стандартные записи hosts (DNS) - - Сервер DoH-резолвера sing-box можно переопределить - FakeIP diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 0d5092d0..a269c0a5 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1426,7 +1426,7 @@ Bootstrap DNS (sing-box) - 回退 DNS 解析,需指定为 IP + 解析 DNS 服务器域名,需指定为 IP xray freedom 解析策略 @@ -1440,9 +1440,6 @@ 添加常用 DNS Hosts - - 开启后可覆盖 sing-box DoH 解析服务器 - FakeIP diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 4ad280b0..81a01cfc 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1426,7 +1426,7 @@ Bootstrap DNS (sing-box) - Fallback DNS Resolution, Require IP + Resolve DNS server domains, requires IP xray Freedom Resolution Strategy @@ -1440,9 +1440,6 @@ Add Common DNS Hosts - - The sing-box DoH resolution server can be overwritten - FakeIP diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs index b6148580..24b41109 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/CoreConfigV2rayService.cs @@ -186,7 +186,7 @@ public partial class CoreConfigV2rayService(Config config) ret.Success = true; - ret.Data = await ApplyFullConfigTemplate(v2rayConfig, true); + ret.Data = await ApplyFullConfigTemplate(v2rayConfig); return ret; } catch (Exception ex) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs index 5d1f7d63..459e77de 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayConfigTemplateService.cs @@ -4,7 +4,7 @@ namespace ServiceLib.Services.CoreConfig; public partial class CoreConfigV2rayService { - private async Task ApplyFullConfigTemplate(V2rayConfig v2rayConfig, bool handleBalancerAndRules = false) + private async Task ApplyFullConfigTemplate(V2rayConfig v2rayConfig) { var fullConfigTemplate = await AppManager.Instance.GetFullConfigTemplateItem(ECoreType.Xray); if (fullConfigTemplate == null || !fullConfigTemplate.Enabled || fullConfigTemplate.Config.IsNullOrEmpty()) @@ -19,7 +19,7 @@ public partial class CoreConfigV2rayService } // Handle balancer and rules modifications (for multiple load scenarios) - if (handleBalancerAndRules && v2rayConfig.routing?.balancers?.Count > 0) + if (v2rayConfig.routing?.balancers?.Count > 0) { var balancer = v2rayConfig.routing.balancers.First(); @@ -60,6 +60,34 @@ public partial class CoreConfigV2rayService } } + if (v2rayConfig.observatory != null) + { + if (fullConfigTemplateNode["observatory"] == null) + { + fullConfigTemplateNode["observatory"] = JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.observatory)); + } + else + { + var subjectSelector = v2rayConfig.observatory.subjectSelector; + subjectSelector.AddRange(fullConfigTemplateNode["observatory"]?["subjectSelector"]?.AsArray()?.Select(x => x?.GetValue()) ?? []); + fullConfigTemplateNode["observatory"]["subjectSelector"] = JsonNode.Parse(JsonUtils.Serialize(subjectSelector.Distinct().ToList())); + } + } + + if (v2rayConfig.burstObservatory != null) + { + if (fullConfigTemplateNode["burstObservatory"] == null) + { + fullConfigTemplateNode["burstObservatory"] = JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.burstObservatory)); + } + else + { + var subjectSelector = v2rayConfig.burstObservatory.subjectSelector; + subjectSelector.AddRange(fullConfigTemplateNode["burstObservatory"]?["subjectSelector"]?.AsArray()?.Select(x => x?.GetValue()) ?? []); + fullConfigTemplateNode["burstObservatory"]["subjectSelector"] = JsonNode.Parse(JsonUtils.Serialize(subjectSelector.Distinct().ToList())); + } + } + // Handle outbounds - append instead of override var customOutboundsNode = fullConfigTemplateNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray(); foreach (var outbound in v2rayConfig.outbounds) diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml index b5e0a015..adaaedb0 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml @@ -173,13 +173,6 @@ Grid.Column="1" Margin="{StaticResource Margin4}" HorizontalAlignment="Left" /> - diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml index 37e2e535..cb719494 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml @@ -210,13 +210,6 @@ Grid.Column="1" Margin="{StaticResource Margin8}" HorizontalAlignment="Left" /> -