Skip to content

Commit

Permalink
fix acme.sh update cert issue
Browse files Browse the repository at this point in the history
  • Loading branch information
next-autumn committed May 26, 2021
1 parent 97ae49c commit b20be2a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 14 deletions.
26 changes: 25 additions & 1 deletion ProxySuper.Core/Models/Hosts/Host.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -30,5 +34,25 @@ public Host()
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("上传成功", "提示");
});
}
}
}
6 changes: 4 additions & 2 deletions ProxySuper.Core/Models/Record.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MvvmCross;
using Microsoft.Win32;
using MvvmCross;
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
Expand All @@ -10,6 +11,7 @@
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -79,7 +81,6 @@ public bool IsChecked
}
}


public string GetShareLink()
{
if (Type == ProjectType.Xray)
Expand All @@ -105,5 +106,6 @@ public string GetShareLink()

return string.Empty;
}

}
}
4 changes: 2 additions & 2 deletions ProxySuper.Core/Services/ProjectBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,12 @@ protected void InstallCert(string dirPath, string certName, string keyName)
// 申请证书
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);
}

Expand Down
4 changes: 3 additions & 1 deletion ProxySuper.Core/ViewModels/NaiveProxyEditorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MvvmCross.Commands;
using Microsoft.Win32;
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
Expand All @@ -7,6 +8,7 @@
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down
22 changes: 15 additions & 7 deletions ProxySuper.WPF/Controls/HostControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
Expand All @@ -55,20 +56,26 @@
Text="{Binding Host.Address}"
VerticalContentAlignment="Center" />

<Label Content="{DynamicResource HostUserName}" Grid.Row="2" Grid.Column="0" />
<Label Content="{DynamicResource HostPort}" Grid.Row="2" Grid.Column="0" />
<TextBox Grid.Row="2" Grid.Column="1"
Width="170"
Text="{Binding Host.UserName}"
Text="{Binding Host.Port}"
VerticalContentAlignment="Center" />

<Label Content="{DynamicResource HostPassword}" Grid.Row="3" Grid.Column="0" />
<Label Content="{DynamicResource HostUserName}" Grid.Row="3" Grid.Column="0" />
<TextBox Grid.Row="3" Grid.Column="1"
Width="170"
Text="{Binding Host.UserName}"
VerticalContentAlignment="Center" />

<Label Content="{DynamicResource HostPassword}" Grid.Row="4" Grid.Column="0" />
<TextBox Grid.Row="4" Grid.Column="1"
Width="170"
Text="{Binding Host.Password}"
VerticalContentAlignment="Center" />

<Label Content="{DynamicResource HostSecretType}" Grid.Row="4" Grid.Column="0" />
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center">
<Label Content="{DynamicResource HostSecretType}" Grid.Row="5" Grid.Column="0" />
<StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center">
<RadioButton GroupName="LoginSecretType"
Content="{DynamicResource HostSertTypePassword}"
IsChecked="{
Expand All @@ -86,11 +93,12 @@
}" />
</StackPanel>

<Label Content="{DynamicResource HostUploadSecretKey}" Grid.Row="5" Grid.Column="0" />
<Label Content="{DynamicResource HostUploadSecretKey}" Grid.Row="6" Grid.Column="0" />
<Button Height="24"
Width="100"
HorizontalAlignment="Left"
Grid.Row="5" Grid.Column="1"
Grid.Row="6" Grid.Column="1"
Command="{Binding Host.UploadPrivateKeyCommand}"
IsEnabled="{
Binding Host.SecretType,
Converter={StaticResource SecretTypeConverter},
Expand Down
4 changes: 3 additions & 1 deletion ProxySuper.WPF/Views/HomeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
Name="DataGrid"
ItemsSource="{Binding Records}"
VerticalContentAlignment="Bottom"
VerticalScrollBarVisibility="Auto"
MaxHeight="450"
IsReadOnly="True"
SelectionUnit="Cell"
BorderBrush="#eee"
Expand Down Expand Up @@ -70,7 +72,7 @@
</DataGridTextColumn>

<DataGridTextColumn Binding="{Binding Type}"
Width="200">
Width="120">
<DataGridTextColumn.Header>
<TextBlock Text="{DynamicResource MainDataGridColumnType}" />
</DataGridTextColumn.Header>
Expand Down

0 comments on commit b20be2a

Please sign in to comment.