mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-21 20:56:08 +03:00
add uninstall xray
fix text issue
This commit is contained in:
parent
34f4addd91
commit
0c146f176d
@ -357,29 +357,16 @@ namespace ProxySU_Core.Models.Developers
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
|
||||
RunCmd("yes | bash caddy_install.sh");
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
}
|
||||
|
||||
//if (CmdType == CmdType.Apt)
|
||||
//{
|
||||
// RunCmd("sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
|
||||
// RunCmd("curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("sudo apt install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Dnf)
|
||||
//{
|
||||
// RunCmd("echo y | dnf install 'dnf-command(copr)'");
|
||||
// RunCmd("echo y | dnf copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("dnf install caddy");
|
||||
//}
|
||||
//else if (CmdType == CmdType.Yum)
|
||||
//{
|
||||
// RunCmd("echo y | echo y | yum install yum-plugin-copr");
|
||||
// RunCmd("echo y | echo y | yum copr enable @caddy/caddy");
|
||||
// RunCmd(GetUpdateCmd());
|
||||
// RunCmd("yum install caddy");
|
||||
//}
|
||||
protected void UninstallCaddy()
|
||||
{
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
|
||||
RunCmd("yes | bash caddy_install.sh uninstall");
|
||||
RunCmd("rm -rf caddy_install.sh");
|
||||
RunCmd("rm -rf /usr/share/caddy");
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
ConfigureFirewall();
|
||||
WriteOutput("防火墙配置完成");
|
||||
|
||||
WriteOutput("同步系统和本地世间...");
|
||||
WriteOutput("同步系统和本地时间...");
|
||||
SyncTimeDiff();
|
||||
WriteOutput("时间同步完成");
|
||||
|
||||
@ -96,10 +96,25 @@ namespace ProxySU_Core.Models.Developers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("安装终止," + ex.Message);
|
||||
var errorLog = "安装终止," + ex.Message;
|
||||
WriteOutput(errorLog);
|
||||
MessageBox.Show(errorLog);
|
||||
}
|
||||
}
|
||||
|
||||
public void Uninstall()
|
||||
{
|
||||
EnsureRootAuth();
|
||||
WriteOutput("卸载Caddy");
|
||||
UninstallCaddy();
|
||||
WriteOutput("卸载Xray");
|
||||
UninstallXray();
|
||||
WriteOutput("卸载证书");
|
||||
UninstallAcme();
|
||||
|
||||
WriteOutput("************ 卸载完成 ************");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新xray内核
|
||||
/// </summary>
|
||||
@ -286,12 +301,24 @@ namespace ProxySU_Core.Models.Developers
|
||||
|
||||
}
|
||||
|
||||
private void UninstallXray()
|
||||
{
|
||||
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
|
||||
}
|
||||
|
||||
private void UninstallAcme()
|
||||
{
|
||||
RunCmd("acme.sh --uninstall");
|
||||
RunCmd("rm -r ~/.acme.sh");
|
||||
}
|
||||
|
||||
private void InstallXrayWithCert()
|
||||
{
|
||||
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
|
||||
|
||||
if (!FileExists("/usr/local/bin/xray"))
|
||||
{
|
||||
WriteOutput("Xray-Core安装失败,请联系开发者");
|
||||
throw new Exception("Xray-Core安装失败,请联系开发者");
|
||||
}
|
||||
|
||||
@ -333,6 +360,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("安装 acme.sh 失败,请联系开发者!");
|
||||
throw new Exception("安装 acme.sh 失败,请联系开发者!");
|
||||
}
|
||||
|
||||
@ -357,6 +385,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("申请证书失败,请联系开发者!");
|
||||
throw new Exception("申请证书失败,请联系开发者!");
|
||||
}
|
||||
|
||||
@ -370,6 +399,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteOutput("安装证书失败,请联系开发者!");
|
||||
throw new Exception("安装证书失败,请联系开发者!");
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,11 @@
|
||||
"network": "tcp",
|
||||
"security": "xtls",
|
||||
"xtlsSettings": {
|
||||
"alpn": [ "h2", "http/1.1" ],
|
||||
"allowInsecure": false,
|
||||
"minVersion": "1.2",
|
||||
"alpn": [
|
||||
"http/1.1"
|
||||
],
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
|
||||
|
@ -23,7 +23,11 @@ namespace ProxySU_Core.ViewModels
|
||||
public string UUID
|
||||
{
|
||||
get => settings.UUID;
|
||||
set => settings.UUID = value;
|
||||
set
|
||||
{
|
||||
settings.UUID = value;
|
||||
Notify("UUID");
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain
|
||||
|
@ -254,7 +254,7 @@
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="VLESS-WebSocket-TLS">
|
||||
Header="VMESS-WebSocket-TLS">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="地址(address)" Width="120" />
|
||||
|
@ -107,10 +107,10 @@
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="{DynamicResource Connect}" FontSize="12" Height="24" Click="Connect" />
|
||||
<Button Content="{DynamicResource Edit}" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" />
|
||||
<Button Content="控制台" FontSize="12" Height="24" Click="Connect" />
|
||||
<Button Content="查看配置" FontSize="12" Height="24" Margin="10,0,0,0" Click="ShowClientInfo" />
|
||||
<Button Content="{DynamicResource Delete}" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" BorderBrush="IndianRed" Background="IndianRed" />
|
||||
<Button Content="编辑" FontSize="12" Height="24" Margin="10,0,0,0" Click="EditHost" />
|
||||
<Button Content="删除" FontSize="12" Height="24" Margin="10,0,0,0" Click="DeleteHost" BorderBrush="IndianRed" Background="IndianRed" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
|
@ -8,7 +8,7 @@
|
||||
xmlns:local="clr-namespace:ProxySU_Core.Views"
|
||||
xmlns:converters="clr-namespace:ProxySU_Core.Converters"
|
||||
mc:Ignorable="d"
|
||||
Title="编辑主机信息" Height="800" Width="710">
|
||||
Title="编辑主机信息" Height="600" Width="980">
|
||||
|
||||
<Window.Resources>
|
||||
<converters:LoginSecretTypeConverter x:Key="LoginSecretTypeConverter" />
|
||||
@ -16,15 +16,19 @@
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="320" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="5"/>
|
||||
<RowDefinition Height="400" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="0" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0" Margin="10">
|
||||
<StackPanel Grid.Column="0" Grid.Row="0" Margin="10">
|
||||
<GroupBox
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}"
|
||||
Header="{StaticResource ConnectionGroupName}">
|
||||
@ -127,7 +131,7 @@
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox
|
||||
Margin="20,0,0,0"
|
||||
Margin="0,10,0,0"
|
||||
Header="{DynamicResource ProxyGroupName}"
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}">
|
||||
<StackPanel Margin="10">
|
||||
@ -207,14 +211,15 @@
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
|
||||
<GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" />
|
||||
<GridSplitter Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="10">
|
||||
<GroupBox
|
||||
Padding="10"
|
||||
Style="{StaticResource MaterialDesignHeaderedContentControl}"
|
||||
Header="选择方式">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0" Margin="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<StackPanel>
|
||||
<CheckBox Content="VLESS OVER TCP with XTLS"
|
||||
Style="{StaticResource MahApps.Styles.CheckBox}"
|
||||
@ -253,10 +258,14 @@
|
||||
<Label Content="Torjan协议,不支持CDN" Margin="20,0,0,0" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="120,0,0,0">
|
||||
<StackPanel Margin="60,0,0,0">
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
|
||||
<Label Content="UUID" Width="80" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding Path=Settings.UUID}" Width="200" />
|
||||
<Button Style="{StaticResource MahApps.Styles.Button.Flat}"
|
||||
Margin="5,0,0,0"
|
||||
Click="RandomUuid"
|
||||
Content="随机" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||
@ -287,7 +296,7 @@
|
||||
<Label Content="VMESS-TCP-Path" Width="120" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding Path=Settings.VMESS_TCP_Path}"
|
||||
IsEnabled="{Binding Checked_VMESS_TCP}"
|
||||
Width="200" />
|
||||
Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.VMESS_WS_Path_Visibility}">
|
||||
@ -298,21 +307,22 @@
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Visibility="{Binding Settings.Trojan_TCP_Pwd_Visibility}">
|
||||
<Label Content="Trojan密码" Width="120" VerticalAlignment="Center" />
|
||||
<Label Content="Trojan密码" Width="80" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding Path=Settings.TrojanPassword}"
|
||||
IsEnabled="{Binding Checked_Trojan_TCP}"
|
||||
Width="200" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<Button Content="保存"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Width="120"
|
||||
Height="32"
|
||||
Click="Save" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="保存"
|
||||
Grid.Row="3"
|
||||
Width="120" Height="32"
|
||||
Click="Save"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,20,0"></Button>
|
||||
</Grid>
|
||||
</metro:MetroWindow>
|
||||
|
@ -48,5 +48,10 @@ namespace ProxySU_Core.Views
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
public void RandomUuid(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.UUID = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,13 @@
|
||||
Height="26"
|
||||
IsEnabled="{Binding HasConnected}"
|
||||
Width="120"/>
|
||||
|
||||
<Button Content="卸载代理"
|
||||
Margin="10,0,0,0"
|
||||
Click="UninstallXray"
|
||||
Height="26"
|
||||
Width="120"
|
||||
IsEnabled="{Binding HasConnected}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
@ -54,7 +61,7 @@
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,10,0"/>
|
||||
|
||||
<Button Content="生成证书"
|
||||
<Button Content="申请证书"
|
||||
Margin="0,0,0,0"
|
||||
Height="26"
|
||||
Width="120"
|
||||
|
@ -44,7 +44,6 @@ namespace ProxySU_Core
|
||||
_vm = new Terminal(record.Host);
|
||||
DataContext = _vm;
|
||||
|
||||
WriteOutput("Connect ...");
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
try
|
||||
@ -105,10 +104,19 @@ namespace ProxySU_Core
|
||||
|
||||
private void OpenConnect(Host host)
|
||||
{
|
||||
|
||||
WriteOutput("正在登陆服务器 ...");
|
||||
var conneInfo = CreateConnectionInfo(host);
|
||||
_sshClient = new SshClient(conneInfo);
|
||||
_sshClient.Connect();
|
||||
WriteOutput("Connected");
|
||||
try
|
||||
{
|
||||
_sshClient.Connect();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WriteOutput(ex.Message);
|
||||
}
|
||||
WriteOutput("登陆服务器成功!");
|
||||
|
||||
_vm.HasConnected = true;
|
||||
project = new XrayProject(_sshClient, Record.Settings, WriteOutput);
|
||||
@ -159,6 +167,14 @@ namespace ProxySU_Core
|
||||
});
|
||||
}
|
||||
|
||||
private void UninstallXray(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
project.Uninstall();
|
||||
});
|
||||
}
|
||||
|
||||
private void UploadCert(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var fileDialog = new OpenFileDialog();
|
||||
|
Loading…
Reference in New Issue
Block a user