diff --git a/src/ST.Client.Desktop.Mac/Services/Implementation/MacDesktopPlatformServiceImpl.cs b/src/ST.Client.Desktop.Mac/Services/Implementation/MacDesktopPlatformServiceImpl.cs index 0f2409860..cdb8f9b20 100644 --- a/src/ST.Client.Desktop.Mac/Services/Implementation/MacDesktopPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Mac/Services/Implementation/MacDesktopPlatformServiceImpl.cs @@ -27,11 +27,10 @@ namespace System.Application.Services.Implementation Threading.Tasks.Task.Run(async () => { var file = new FileInfo(Path.Combine(IOPath.AppDataDirectory, $@"sudoShell.js")); - int index = 0; if (file.Exists) file.Delete(); var vm = new UI.ViewModels.PasswordWindowViewModel(); - vm.SetTitle = AppResources.MacSudoPasswordTips; + vm.Title = AppResources.MacSudoPasswordTips; await IShowWindowService.Instance.ShowDialog(CustomWindow.Password, vm, string.Empty, ResizeModeCompat.CanResize); var scriptContent = new Text.StringBuilder(); scriptContent.AppendLine($"#!/bin/bash -e"); diff --git a/src/ST.Client.Desktop/UI/ViewModels/Windows/LocalAuthPage/PasswordWindowViewModel.cs b/src/ST.Client.Desktop/UI/ViewModels/Windows/LocalAuthPage/PasswordWindowViewModel.cs index 7f861d2bc..7b0089a4a 100644 --- a/src/ST.Client.Desktop/UI/ViewModels/Windows/LocalAuthPage/PasswordWindowViewModel.cs +++ b/src/ST.Client.Desktop/UI/ViewModels/Windows/LocalAuthPage/PasswordWindowViewModel.cs @@ -21,14 +21,7 @@ namespace System.Application.UI.ViewModels { get => _Password; set => this.RaiseAndSetIfChanged(ref _Password, value); - } - public string? SetTitle - { - get => Title; - set { - Title = value??""; - } - } + } string? ITextBoxWindowViewModel.Value { get => Password; set => Password = value; } diff --git a/src/ST.Client/Services/Implementation/HttpProxyServiceImpl.cs b/src/ST.Client/Services/Implementation/HttpProxyServiceImpl.cs index 9405d47d1..e4135f2d3 100644 --- a/src/ST.Client/Services/Implementation/HttpProxyServiceImpl.cs +++ b/src/ST.Client/Services/Implementation/HttpProxyServiceImpl.cs @@ -337,7 +337,9 @@ namespace System.Application.Services.Implementation Toast.Show(SR.CreateCertificateFaild); return false; } + var filePath = Path.Combine(IOPath.AppDataDirectory, $@"{CertificateName}.Certificate.cer"); + try { proxyServer.CertificateManager.RootCertificate.SaveCerCertificateFile(filePath); proxyServer.CertificateManager.TrustRootCertificate(); @@ -347,6 +349,10 @@ namespace System.Application.Services.Implementation { //安装证书 IPlatformService.Instance.AdminShell($"security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain {filePath}"); + } + } + catch (Exception e) { + Log.Error("CerError", e,"证书安装失败"); } return IsCertificateInstalled(proxyServer.CertificateManager.RootCertificate); }