diff --git a/ProxySuper.Core/Models/Hosts/Host.cs b/ProxySuper.Core/Models/Hosts/Host.cs index af9c61e..26a11a3 100644 --- a/ProxySuper.Core/Models/Hosts/Host.cs +++ b/ProxySuper.Core/Models/Hosts/Host.cs @@ -1,8 +1,12 @@ -using System; +using Microsoft.Win32; +using MvvmCross.Commands; +using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; namespace ProxySuper.Core.Models.Hosts { @@ -30,5 +34,25 @@ namespace ProxySuper.Core.Models.Hosts public LocalProxy Proxy { get; set; } public LoginSecretType SecretType { get; set; } + + public IMvxCommand UploadPrivateKeyCommand => new MvxCommand(UploadPrivateKey); + + private void UploadPrivateKey() + { + var fileDialog = new OpenFileDialog(); + fileDialog.FileOk += OnFileOk; + fileDialog.ShowDialog(); + } + + private void OnFileOk(object sender, CancelEventArgs e) + { + var file = sender as OpenFileDialog; + PrivateKeyPath = file.FileName; + + Task.Delay(300).ContinueWith((t) => + { + MessageBox.Show("上传成功", "提示"); + }); + } } } diff --git a/ProxySuper.Core/Models/Record.cs b/ProxySuper.Core/Models/Record.cs index a1feec8..f4a6a67 100644 --- a/ProxySuper.Core/Models/Record.cs +++ b/ProxySuper.Core/Models/Record.cs @@ -1,4 +1,5 @@ -using MvvmCross; +using Microsoft.Win32; +using MvvmCross; using MvvmCross.Commands; using MvvmCross.Navigation; using MvvmCross.ViewModels; @@ -10,6 +11,7 @@ using ProxySuper.Core.Services; using ProxySuper.Core.ViewModels; using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; using System.Text; @@ -79,7 +81,6 @@ namespace ProxySuper.Core.Models } } - public string GetShareLink() { if (Type == ProjectType.Xray) @@ -105,5 +106,6 @@ namespace ProxySuper.Core.Models return string.Empty; } + } } diff --git a/ProxySuper.Core/Services/ProjectBase.cs b/ProxySuper.Core/Services/ProjectBase.cs index 71ba5db..3e525b3 100644 --- a/ProxySuper.Core/Services/ProjectBase.cs +++ b/ProxySuper.Core/Services/ProjectBase.cs @@ -646,12 +646,12 @@ namespace ProxySuper.Core.Services // 申请证书 if (OnlyIpv6) { - var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --listen-v6"; + var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --listen-v6 --pre-hook \"service caddy stop\" --post-hook \"service caddy start\""; result = RunCmd(cmd); } else { - var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain}"; + var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Parameters.Domain} --pre-hook \"service caddy stop\" --post-hook \"service caddy start\""; result = RunCmd(cmd); } diff --git a/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs index 442d1b6..e0e69e2 100644 --- a/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs +++ b/ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs @@ -1,4 +1,5 @@ -using MvvmCross.Commands; +using Microsoft.Win32; +using MvvmCross.Commands; using MvvmCross.Navigation; using MvvmCross.ViewModels; using ProxySuper.Core.Models; @@ -7,6 +8,7 @@ using ProxySuper.Core.Models.Projects; using ProxySuper.Core.Services; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/ProxySuper.WPF/Controls/HostControl.xaml b/ProxySuper.WPF/Controls/HostControl.xaml index b92cfe6..0a5397f 100644 --- a/ProxySuper.WPF/Controls/HostControl.xaml +++ b/ProxySuper.WPF/Controls/HostControl.xaml @@ -34,6 +34,7 @@ + @@ -55,20 +56,26 @@ Text="{Binding Host.Address}" VerticalContentAlignment="Center" /> -