mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Perf UI
This commit is contained in:
parent
c14a0e33b7
commit
640edb5eb2
13 changed files with 176 additions and 77 deletions
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
18
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -87,6 +87,24 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Certificate not set 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string CertNotSet {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CertNotSet", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Certificate set 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string CertSet {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CertSet", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Please check the Configuration settings first. 的本地化字符串。
|
/// 查找类似 Please check the Configuration settings first. 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1615,4 +1615,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1618,4 +1618,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1615,4 +1615,10 @@
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>请设置有效的域名</value>
|
<value>请设置有效的域名</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>证书未设置</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>证书已设置</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -1615,4 +1615,10 @@ Do not use the "Fetch Certificate" button when "Allow Insecure" is enabled.</val
|
||||||
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
<data name="ServerNameMustBeValidDomain" xml:space="preserve">
|
||||||
<value>Please set a valid domain</value>
|
<value>Please set a valid domain</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CertNotSet" xml:space="preserve">
|
||||||
|
<value>Certificate not set</value>
|
||||||
|
</data>
|
||||||
|
<data name="CertSet" xml:space="preserve">
|
||||||
|
<value>Certificate set</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -2,6 +2,8 @@ namespace ServiceLib.ViewModels;
|
||||||
|
|
||||||
public class AddServerViewModel : MyReactiveObject
|
public class AddServerViewModel : MyReactiveObject
|
||||||
{
|
{
|
||||||
|
private string _certError = string.Empty;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ProfileItem SelectedSource { get; set; }
|
public ProfileItem SelectedSource { get; set; }
|
||||||
|
|
||||||
|
|
@ -11,6 +13,9 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string Cert { get; set; }
|
public string Cert { get; set; }
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public string CertTip { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> FetchCertCmd { get; }
|
public ReactiveCommand<Unit, Unit> FetchCertCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> FetchCertChainCmd { get; }
|
public ReactiveCommand<Unit, Unit> FetchCertChainCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
@ -33,6 +38,9 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
await SaveServerAsync();
|
await SaveServerAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.WhenAnyValue(x => x.Cert)
|
||||||
|
.Subscribe(_ => UpdateCertTip());
|
||||||
|
|
||||||
if (profileItem.IndexId.IsNullOrEmpty())
|
if (profileItem.IndexId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.Network = Global.DefaultNetwork;
|
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()
|
private async Task FetchCert()
|
||||||
{
|
{
|
||||||
if (SelectedSource.StreamSecurity != Global.StreamSecurity)
|
if (SelectedSource.StreamSecurity != Global.StreamSecurity)
|
||||||
|
|
@ -122,7 +137,9 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
if (!Utils.IsDomain(serverName))
|
if (!Utils.IsDomain(serverName))
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain);
|
_certError = ResUI.ServerNameMustBeValidDomain;
|
||||||
|
UpdateCertTip();
|
||||||
|
_certError = string.Empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SelectedSource.Port > 0)
|
if (SelectedSource.Port > 0)
|
||||||
|
|
@ -150,7 +167,9 @@ public class AddServerViewModel : MyReactiveObject
|
||||||
}
|
}
|
||||||
if (!Utils.IsDomain(serverName))
|
if (!Utils.IsDomain(serverName))
|
||||||
{
|
{
|
||||||
NoticeManager.Instance.Enqueue(ResUI.ServerNameMustBeValidDomain);
|
_certError = ResUI.ServerNameMustBeValidDomain;
|
||||||
|
UpdateCertTip();
|
||||||
|
_certError = string.Empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SelectedSource.Port > 0)
|
if (SelectedSource.Port > 0)
|
||||||
|
|
|
||||||
|
|
@ -775,11 +775,19 @@
|
||||||
Margin="{StaticResource Margin4}"
|
Margin="{StaticResource Margin4}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{x:Static resx:ResUI.TbCertPinning}" />
|
Text="{x:Static resx:ResUI.TbCertPinning}" />
|
||||||
<Button
|
<StackPanel
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{StaticResource MarginLr8}"
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
x:Name="labCertPinning"
|
||||||
|
Margin="{StaticResource Margin8}"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<Button
|
||||||
|
Margin="{StaticResource MarginLr4}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
Classes="IconButton">
|
Classes="IconButton">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<PathIcon Data="{StaticResource SemiIconMore}">
|
<PathIcon Data="{StaticResource SemiIconMore}">
|
||||||
|
|
@ -819,6 +827,7 @@
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</Button.Flyout>
|
</Button.Flyout>
|
||||||
</Button>
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="gridRealityMore"
|
x:Name="gridRealityMore"
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.SelectedValue).DisposeWith(disposables);
|
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.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.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);
|
this.Bind(ViewModel, vm => vm.Cert, v => v.txtCert.Text).DisposeWith(disposables);
|
||||||
//reality
|
//reality
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI2.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI2.Text).DisposeWith(disposables);
|
||||||
|
|
|
||||||
|
|
@ -1004,11 +1004,19 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbCertPinning}" />
|
Text="{x:Static resx:ResUI.TbCertPinning}" />
|
||||||
|
<StackPanel
|
||||||
<materialDesign:PopupBox
|
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<TextBlock
|
||||||
|
x:Name="labCertPinning"
|
||||||
|
Margin="{StaticResource Margin4}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}" />
|
||||||
|
<materialDesign:PopupBox
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
StaysOpen="True"
|
StaysOpen="True"
|
||||||
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|
@ -1043,6 +1051,7 @@
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>
|
</materialDesign:PopupBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ public partial class AddServerWindow
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.AllowInsecure, v => v.cmbAllowInsecure.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.Fingerprint, v => v.cmbFingerprint.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Alpn, v => v.cmbAlpn.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.Alpn, v => v.cmbAlpn.Text).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);
|
this.Bind(ViewModel, vm => vm.Cert, v => v.txtCert.Text).DisposeWith(disposables);
|
||||||
//reality
|
//reality
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI2.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.Sni, v => v.txtSNI2.Text).DisposeWith(disposables);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue