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