From 640edb5eb2af7f50cb5c3c578469b4e568816e08 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sun, 2 Nov 2025 12:38:21 +0800 Subject: [PATCH] Perf UI --- v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 ++++ v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.fr.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.hu.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.ru.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 ++ v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 ++ .../ViewModels/AddServerViewModel.cs | 23 ++++- .../Views/AddServerWindow.axaml | 87 ++++++++++--------- .../Views/AddServerWindow.axaml.cs | 1 + v2rayN/v2rayN/Views/AddServerWindow.xaml | 81 +++++++++-------- v2rayN/v2rayN/Views/AddServerWindow.xaml.cs | 1 + 13 files changed, 176 insertions(+), 77 deletions(-) diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 0b0bed41..ea649da5 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -87,6 +87,24 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Certificate not set 的本地化字符串。 + /// + public static string CertNotSet { + get { + return ResourceManager.GetString("CertNotSet", resourceCulture); + } + } + + /// + /// 查找类似 Certificate set 的本地化字符串。 + /// + public static string CertSet { + get { + return ResourceManager.GetString("CertSet", resourceCulture); + } + } + /// /// 查找类似 Please check the Configuration settings first. 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index b2c1b834..64d74cd9 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.fr.resx b/v2rayN/ServiceLib/Resx/ResUI.fr.resx index cd12ae56..88a724fb 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fr.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fr.resx @@ -1615,4 +1615,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index e85d739a..ce57a3ba 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index fce7c365..03bd9660 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 935808e9..dd7604fc 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index a0c63318..87443803 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1615,4 +1615,10 @@ 请设置有效的域名 + + 证书未设置 + + + 证书已设置 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index a16f0ea9..c12f023b 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1615,4 +1615,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled. Please set a valid domain + + Certificate not set + + + Certificate set + \ No newline at end of file diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index 9b7a0ae0..121bf5da 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -2,6 +2,8 @@ namespace ServiceLib.ViewModels; public class AddServerViewModel : MyReactiveObject { + private string _certError = string.Empty; + [Reactive] public ProfileItem SelectedSource { get; set; } @@ -11,6 +13,9 @@ public class AddServerViewModel : MyReactiveObject [Reactive] public string Cert { get; set; } + [Reactive] + public string CertTip { get; set; } + public ReactiveCommand FetchCertCmd { get; } public ReactiveCommand FetchCertChainCmd { get; } public ReactiveCommand SaveCmd { get; } @@ -33,6 +38,9 @@ public class AddServerViewModel : MyReactiveObject await SaveServerAsync(); }); + this.WhenAnyValue(x => x.Cert) + .Subscribe(_ => UpdateCertTip()); + if (profileItem.IndexId.IsNullOrEmpty()) { profileItem.Network = Global.DefaultNetwork; @@ -104,6 +112,13 @@ public class AddServerViewModel : MyReactiveObject } } + private void UpdateCertTip() + { + CertTip = _certError.IsNullOrEmpty() + ? (Cert.IsNullOrEmpty() ? ResUI.CertNotSet : ResUI.CertSet) + : _certError; + } + private async Task FetchCert() { if (SelectedSource.StreamSecurity != Global.StreamSecurity) @@ -122,7 +137,9 @@ public class AddServerViewModel : MyReactiveObject } if (!Utils.IsDomain(serverName)) { - NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain); + _certError = ResUI.ServerNameMustBeValidDomain; + UpdateCertTip(); + _certError = string.Empty; return; } if (SelectedSource.Port > 0) @@ -150,7 +167,9 @@ public class AddServerViewModel : MyReactiveObject } if (!Utils.IsDomain(serverName)) { - NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain); + _certError = ResUI.ServerNameMustBeValidDomain; + UpdateCertTip(); + _certError = string.Empty; return; } if (SelectedSource.Port > 0) diff --git a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml index 721db784..f01da56d 100644 --- a/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/AddServerWindow.axaml @@ -775,50 +775,59 @@ Margin="{StaticResource Margin4}" VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbCertPinning}" /> - + + + + this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Fingerprint, v => v.cmbFingerprint.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Alpn, v => v.cmbAlpn.SelectedValue).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.CertTip, v => v.labCertPinning.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Cert, v => v.txtCert.Text).DisposeWith(disposables); //reality this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI2.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml b/v2rayN/v2rayN/Views/AddServerWindow.xaml index 3aaff846..699e4911 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml @@ -1004,45 +1004,54 @@ VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.TbCertPinning}" /> - - - - - -