mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
Update On Sun Nov 9 19:36:16 CET 2025
This commit is contained in:
@@ -2,8 +2,6 @@ namespace ServiceLib.ViewModels;
|
||||
|
||||
public class AddServerViewModel : MyReactiveObject
|
||||
{
|
||||
private string _certError = string.Empty;
|
||||
|
||||
[Reactive]
|
||||
public ProfileItem SelectedSource { get; set; }
|
||||
|
||||
@@ -112,11 +110,11 @@ public class AddServerViewModel : MyReactiveObject
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCertTip()
|
||||
private void UpdateCertTip(string? errorMessage = null)
|
||||
{
|
||||
CertTip = _certError.IsNullOrEmpty()
|
||||
CertTip = errorMessage.IsNullOrEmpty()
|
||||
? (Cert.IsNullOrEmpty() ? ResUI.CertNotSet : ResUI.CertSet)
|
||||
: _certError;
|
||||
: errorMessage;
|
||||
}
|
||||
|
||||
private async Task FetchCert()
|
||||
@@ -137,17 +135,16 @@ public class AddServerViewModel : MyReactiveObject
|
||||
}
|
||||
if (!Utils.IsDomain(serverName))
|
||||
{
|
||||
_certError = ResUI.ServerNameMustBeValidDomain;
|
||||
UpdateCertTip();
|
||||
_certError = string.Empty;
|
||||
UpdateCertTip(ResUI.ServerNameMustBeValidDomain);
|
||||
return;
|
||||
}
|
||||
if (SelectedSource.Port > 0)
|
||||
{
|
||||
domain += $":{SelectedSource.Port}";
|
||||
}
|
||||
(Cert, _certError) = await CertPemManager.Instance.GetCertPemAsync(domain, serverName);
|
||||
UpdateCertTip();
|
||||
string certError;
|
||||
(Cert, certError) = await CertPemManager.Instance.GetCertPemAsync(domain, serverName);
|
||||
UpdateCertTip(certError);
|
||||
}
|
||||
|
||||
private async Task FetchCertChain()
|
||||
@@ -168,17 +165,16 @@ public class AddServerViewModel : MyReactiveObject
|
||||
}
|
||||
if (!Utils.IsDomain(serverName))
|
||||
{
|
||||
_certError = ResUI.ServerNameMustBeValidDomain;
|
||||
UpdateCertTip();
|
||||
_certError = string.Empty;
|
||||
UpdateCertTip(ResUI.ServerNameMustBeValidDomain);
|
||||
return;
|
||||
}
|
||||
if (SelectedSource.Port > 0)
|
||||
{
|
||||
domain += $":{SelectedSource.Port}";
|
||||
}
|
||||
(var certs, _certError) = await CertPemManager.Instance.GetCertChainPemAsync(domain, serverName);
|
||||
UpdateCertTip();
|
||||
Cert = string.Join("\n", certs);
|
||||
string certError;
|
||||
(var certs, certError) = await CertPemManager.Instance.GetCertChainPemAsync(domain, serverName);
|
||||
Cert = CertPemManager.ConcatenatePemChain(certs);
|
||||
UpdateCertTip(certError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ public class MainWindowViewModel : MyReactiveObject
|
||||
[Reactive]
|
||||
public int TabMainSelectedIndex { get; set; }
|
||||
|
||||
[Reactive] public bool BlIsWindows { get; set; }
|
||||
|
||||
#endregion Menu
|
||||
|
||||
#region Init
|
||||
@@ -70,6 +72,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||
{
|
||||
_config = AppManager.Instance.Config;
|
||||
_updateView = updateView;
|
||||
BlIsWindows = Utils.IsWindows();
|
||||
|
||||
#region WhenAnyValue && ReactiveCommand
|
||||
|
||||
@@ -511,7 +514,7 @@ public class MainWindowViewModel : MyReactiveObject
|
||||
{
|
||||
ProcUtils.ProcessStart("xdg-open", path);
|
||||
}
|
||||
else if (Utils.IsOSX())
|
||||
else if (Utils.IsMacOS())
|
||||
{
|
||||
ProcUtils.ProcessStart("open", path);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
|
||||
[Reactive] public bool AutoHideStartup { get; set; }
|
||||
[Reactive] public bool Hide2TrayWhenClose { get; set; }
|
||||
[Reactive] public bool MacOSShowInDock { get; set; }
|
||||
[Reactive] public bool EnableDragDropSort { get; set; }
|
||||
[Reactive] public bool DoubleClick2Activate { get; set; }
|
||||
[Reactive] public int AutoUpdateInterval { get; set; }
|
||||
@@ -69,6 +70,15 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
|
||||
#endregion UI
|
||||
|
||||
#region UI visibility
|
||||
|
||||
[Reactive] public bool BlIsWindows { get; set; }
|
||||
[Reactive] public bool BlIsLinux { get; set; }
|
||||
[Reactive] public bool BlIsIsMacOS { get; set; }
|
||||
[Reactive] public bool BlIsNonWindows { get; set; }
|
||||
|
||||
#endregion UI visibility
|
||||
|
||||
#region System proxy
|
||||
|
||||
[Reactive] public bool notProxyLocalAddress { get; set; }
|
||||
@@ -108,6 +118,10 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
{
|
||||
_config = AppManager.Instance.Config;
|
||||
_updateView = updateView;
|
||||
BlIsWindows = Utils.IsWindows();
|
||||
BlIsLinux = Utils.IsLinux();
|
||||
BlIsIsMacOS = Utils.IsMacOS();
|
||||
BlIsNonWindows = Utils.IsNonWindows();
|
||||
|
||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
@@ -169,6 +183,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
EnableUpdateSubOnlyRemarksExist = _config.UiItem.EnableUpdateSubOnlyRemarksExist;
|
||||
AutoHideStartup = _config.UiItem.AutoHideStartup;
|
||||
Hide2TrayWhenClose = _config.UiItem.Hide2TrayWhenClose;
|
||||
MacOSShowInDock = _config.UiItem.MacOSShowInDock;
|
||||
EnableDragDropSort = _config.UiItem.EnableDragDropSort;
|
||||
DoubleClick2Activate = _config.UiItem.DoubleClick2Activate;
|
||||
AutoUpdateInterval = _config.GuiItem.AutoUpdateInterval;
|
||||
@@ -330,6 +345,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
_config.UiItem.EnableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
|
||||
_config.UiItem.AutoHideStartup = AutoHideStartup;
|
||||
_config.UiItem.Hide2TrayWhenClose = Hide2TrayWhenClose;
|
||||
_config.UiItem.MacOSShowInDock = MacOSShowInDock;
|
||||
_config.GuiItem.AutoUpdateInterval = AutoUpdateInterval;
|
||||
_config.UiItem.EnableDragDropSort = EnableDragDropSort;
|
||||
_config.UiItem.DoubleClick2Activate = DoubleClick2Activate;
|
||||
|
||||
@@ -504,7 +504,7 @@ public class StatusBarViewModel : MyReactiveObject
|
||||
{
|
||||
return AppManager.Instance.LinuxSudoPwd.IsNotEmpty();
|
||||
}
|
||||
else if (Utils.IsOSX())
|
||||
else if (Utils.IsMacOS())
|
||||
{
|
||||
return AppManager.Instance.LinuxSudoPwd.IsNotEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user