1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 05:06:08 +03:00
This commit is contained in:
autumn 2021-08-18 17:34:32 +08:00
parent 389f80f655
commit 69b29fce21
58 changed files with 1793 additions and 155 deletions

View File

@ -88,27 +88,33 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Helpers\Utils.cs" /> <Compile Include="Helpers\Utils.cs" />
<Compile Include="Services\BrookProject.cs" /> <Compile Include="Services\BrookProject.cs" />
<Compile Include="Services\BrookService.cs" />
<Compile Include="Services\NaiveProxyProject.cs" /> <Compile Include="Services\NaiveProxyProject.cs" />
<Compile Include="Services\NaiveProxyService.cs" />
<Compile Include="Services\ProjectBase.cs" /> <Compile Include="Services\ProjectBase.cs" />
<Compile Include="Services\ServiceBase.cs" /> <Compile Include="Services\ServiceBase.cs" />
<Compile Include="Services\ShareLink.cs" /> <Compile Include="Services\ShareLink.cs" />
<Compile Include="Services\TrojanGoConfigBuilder.cs" /> <Compile Include="Services\TrojanGoConfigBuilder.cs" />
<Compile Include="Services\TrojanGoProject.cs" /> <Compile Include="Services\TrojanGoProject.cs" />
<Compile Include="Services\TrojanGoService.cs" />
<Compile Include="Services\XrayConfigBuilder.cs" /> <Compile Include="Services\XrayConfigBuilder.cs" />
<Compile Include="Services\XrayProject.cs" /> <Compile Include="Services\XrayProject.cs" />
<Compile Include="Services\XrayService.cs" /> <Compile Include="Services\XrayService.cs" />
<Compile Include="ViewModels\BrookConfigViewModel.cs" /> <Compile Include="ViewModels\BrookConfigViewModel.cs" />
<Compile Include="ViewModels\BrookEditorViewModel.cs" /> <Compile Include="ViewModels\BrookEditorViewModel.cs" />
<Compile Include="ViewModels\BrookInstallerViewModel.cs" /> <Compile Include="ViewModels\BrookInstallerViewModel.cs" />
<Compile Include="ViewModels\BrookInstallViewModel.cs" />
<Compile Include="ViewModels\EnableRootViewModel.cs" /> <Compile Include="ViewModels\EnableRootViewModel.cs" />
<Compile Include="ViewModels\HomeViewModel.cs" /> <Compile Include="ViewModels\HomeViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyConfigViewModel.cs" /> <Compile Include="ViewModels\NaiveProxyConfigViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyEditorViewModel.cs" /> <Compile Include="ViewModels\NaiveProxyEditorViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyInstallerViewModel.cs" /> <Compile Include="ViewModels\NaiveProxyInstallerViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyInstallViewModel.cs" />
<Compile Include="ViewModels\ShareLinkViewModel.cs" /> <Compile Include="ViewModels\ShareLinkViewModel.cs" />
<Compile Include="ViewModels\TrojanGoConfigViewModel.cs" /> <Compile Include="ViewModels\TrojanGoConfigViewModel.cs" />
<Compile Include="ViewModels\TrojanGoEditorViewModel.cs" /> <Compile Include="ViewModels\TrojanGoEditorViewModel.cs" />
<Compile Include="ViewModels\TrojanGoInstallerViewModel.cs" /> <Compile Include="ViewModels\TrojanGoInstallerViewModel.cs" />
<Compile Include="ViewModels\TrojanGoInstallViewModel.cs" />
<Compile Include="ViewModels\XrayConfigViewModel.cs" /> <Compile Include="ViewModels\XrayConfigViewModel.cs" />
<Compile Include="ViewModels\XrayEditorViewModel.cs" /> <Compile Include="ViewModels\XrayEditorViewModel.cs" />
<Compile Include="ViewModels\XrayInstallerViewModel.cs" /> <Compile Include="ViewModels\XrayInstallerViewModel.cs" />

View File

@ -0,0 +1,165 @@
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class BrookService : ServiceBase<BrookSettings>
{
private string brookServiceTemp = @"
[Unit]
Description=brook service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=##run_cmd##
[Install]
WantedBy=multi-user.target";
public BrookService(Host host, BrookSettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "安装Brook";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 40;
Progress.Desc = "配置防火墙";
ConfigFirewalld();
Progress.Percentage = 50;
Progress.Step = "检测网络环境";
EnsureNetwork();
Progress.Percentage = 60;
if (Settings.BrookType == BrookType.wssserver)
{
Progress.Desc = "检测域名是否绑定本机IP";
ValidateDomain();
Progress.Percentage = 80;
}
Progress.Step = "安装Brook服务";
InstallBrook();
Progress.Percentage = 100;
Progress.Step = "安装Brook成功";
Progress.Desc = "安装Brook成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void InstallBrook()
{
Progress.Desc = "执行Brook安装文件";
string url = "https://github.com/txthinking/brook/releases/latest/download/brook_linux_amd64";
if (ArchType == ArchType.arm)
{
url = url.Replace("brook_linux_amd64", "brook_linux_arm7");
}
RunCmd($"curl -L {url} -o /usr/bin/brook");
RunCmd("chmod +x /usr/bin/brook");
Progress.Desc = "设置Brook服务";
var brookService = brookServiceTemp.Replace("##run_cmd##", GetRunBrookCommand());
RunCmd("rm -rf /etc/systemd/system/brook.service");
RunCmd("touch /etc/systemd/system/brook.service");
RunCmd($"echo \"{brookService}\" > /etc/systemd/system/brook.service");
RunCmd("sudo chmod 777 /etc/systemd/system/brook.service");
Progress.Desc = "启动Brook服务";
RunCmd("systemctl enable brook");
RunCmd("systemctl restart brook");
}
private string GetRunBrookCommand()
{
var runBrookCmd = string.Empty;
if (Settings.BrookType == BrookType.server)
{
return $"/usr/bin/brook server --listen :{Settings.Port} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.wsserver)
{
return $"/usr/bin/brook wsserver --listen :{Settings.Port} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.wssserver)
{
return $"/usr/bin/brook wssserver --domain {Settings.Domain} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.socks5)
{
var ip = IsOnlyIPv6 ? IPv6 : IPv4;
return $"/usr/bin/brook socks5 --socks5 {ip}:{Settings.Port}";
}
return runBrookCmd;
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "卸载Brook";
Progress.Percentage = 0;
Progress.Desc = "停止Brook服务";
RunCmd("systemctl stop brook");
RunCmd("systemctl disable brook");
Progress.Percentage = 30;
Progress.Desc = "删除Brook相关文件";
RunCmd("rm -rf /etc/systemd/system/brook.service");
RunCmd("rm -rf /usr/bin/brook");
Progress.Percentage = 80;
Progress.Desc = "重置防火墙设置";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
}
}

View File

@ -0,0 +1,271 @@
using Microsoft.Win32;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class NaiveProxyService : ServiceBase<NaiveProxySettings>
{
public NaiveProxyService(Host host, NaiveProxySettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
var index = 1;
Progress.Step = $"{index++}. 检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 安装系统必要工具";
InstallSystemTools();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 检测域名是否绑定到本机";
ValidateDomain();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 安装NaiveProxy";
InstallNaiveProxy();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 优化网络参数";
ConfigNetwork();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Percentage = 100;
Progress.Step = "NaiveProxy安装成功";
Progress.Desc = "NaiveProxy安装成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "卸载NaiveProxy";
Progress.Percentage = 0;
Progress.Desc = "正在卸载...";
RunCmd("rm -rf caddy_install.sh");
Progress.Percentage = 10;
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
Progress.Percentage = 20;
RunCmd("yes | bash caddy_install.sh uninstall");
Progress.Percentage = 80;
RunCmd("rm -rf caddy_install.sh");
Progress.Percentage = 100;
Progress.Step = "卸载NaiveProxy成功";
Progress.Desc = "卸载NaiveProxy成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新配置";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 30;
UploadCaddySettings();
Progress.Percentage = 100;
Progress.Step = "更新配置成功";
Progress.Desc = "更新配置成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
#region
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 700;
}
Progress.Desc = "上传Caddy配置文件";
UploadCaddySettings();
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallNaiveProxy()
{
Progress.Desc = "下载NaiveProxy安装文件";
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash");
Progress.Desc = "设置NaiveProxy开机启动";
RunCmd("systemctl enable caddy");
Progress.Desc = "上传配置文件";
UploadCaddySettings(false);
}
private void ConfigNetwork()
{
RunCmd(@"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'");
RunCmd(@"sysctl -p");
}
private void UploadCaddySettings(bool useCustomWeb = false)
{
Progress.Desc = "生成配置文件";
var caddyStr = BuildConfig(useCustomWeb);
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
Progress.Desc = "上传配置文件";
WriteToFile(caddyStr, "/etc/caddy/Caddyfile");
Progress.Desc = "重启Caddy服务";
RunCmd("systemctl restart caddy");
}
private string BuildConfig(bool useCustomWeb = false)
{
var jsonStr = File.ReadAllText("Templates/NaiveProxy/naive_server.caddyfile");
jsonStr = jsonStr.Replace("##port##", Settings.Port.ToString());
jsonStr = jsonStr.Replace("##domain##", Settings.Domain);
jsonStr = jsonStr.Replace("##basicauth##", $"basic_auth {Settings.UserName} {Settings.Password}");
if (!useCustomWeb && !string.IsNullOrEmpty(Settings.MaskDomain))
{
var prefix = "http://";
if (Settings.MaskDomain.StartsWith("https://"))
{
prefix = "https://";
}
var domain = Settings.MaskDomain
.TrimStart("http://".ToCharArray())
.TrimStart("https://".ToCharArray());
jsonStr = jsonStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
}
else
{
jsonStr = jsonStr.Replace("##reverse_proxy##", "");
jsonStr = jsonStr.Replace("#file_server", "file_server");
}
return jsonStr;
}
#endregion
}
}

View File

@ -277,15 +277,41 @@ namespace ProxySuper.Core.Services
RunCmd($"chmod 755 {dirPath}"); RunCmd($"chmod 755 {dirPath}");
} }
protected void UploadFile(Stream stream, string path)
{
using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
{
sftp.Connect();
sftp.UploadFile(stream, path, true);
sftp.Disconnect();
}
}
public bool IsRootUser() public void EnsureRootUser()
{ {
// 禁止一些可能产生的干扰信息 // 禁止一些可能产生的干扰信息
RunCmd(@"sed -i 's/echo/#echo/g' ~/.bashrc"); RunCmd(@"sed -i 's/echo/#echo/g' ~/.bashrc");
RunCmd(@"sed -i 's/echo/#echo/g' ~/.profile"); RunCmd(@"sed -i 's/echo/#echo/g' ~/.profile");
var result = RunCmd("id -u"); var result = RunCmd("id -u");
return result.Equals("0\n"); if (!result.Equals("0\n"))
{
throw new Exception("ProxySU需要使用Root用户进行安装");
}
}
public void UninstallCaddy()
{
Progress.Desc = "关闭Caddy服务";
RunCmd("systemctl stop caddy");
RunCmd("systemctl disable caddy");
Progress.Desc = "彻底删除Caddy文件";
RunCmd("rm -rf /etc/systemd/system/caddy.service");
RunCmd("rm -rf /usr/bin/caddy");
RunCmd("rm -rf /usr/share/caddy");
RunCmd("rm -rf /etc/caddy");
} }
public void EnsureSystemEnv() public void EnsureSystemEnv()
@ -343,6 +369,11 @@ namespace ProxySuper.Core.Services
OpenPort(Settings.FreePorts.ToArray()); OpenPort(Settings.FreePorts.ToArray());
} }
public void ResetFirewalld()
{
ClosePort(Settings.FreePorts.ToArray());
}
public void EnsureNetwork() public void EnsureNetwork()
{ {
string cmd; string cmd;

View File

@ -0,0 +1,369 @@
using Microsoft.Win32;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class TrojanGoService : ServiceBase<TrojanGoSettings>
{
public TrojanGoService(Host host, TrojanGoSettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "安装TrojanGo";
Progress.Desc = "安装TrojanGo";
EnsureRootUser();
if (FileExists("/usr/local/bin/trojan-go"))
{
var btnResult = MessageBox.Show("已经安装Trojan-Go是否需要重装", "提示", MessageBoxButton.YesNo);
if (btnResult == MessageBoxResult.No)
{
MessageBox.Show("安装终止", "提示");
return;
}
}
var index = 1;
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 10;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 检测域名是否解析到本机";
ValidateDomain();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 安装Caddy服务";
InstallCaddy();
Progress.Percentage = 70;
Progress.Step = $"{index++}. 安装TrojanGo";
InstallTrojanGo();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Caddy配置文件";
UploadCaddySettings();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Percentage = 100;
Progress.Step = "安装成功";
Progress.Desc = "安装成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "卸载Trojgan-Go";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "停止Trojan—Go服务";
RunCmd("systemctl stop trojan-go");
Progress.Percentage = 40;
Progress.Desc = "卸载Caddy";
UninstallCaddy();
Progress.Percentage = 60;
Progress.Desc = "卸载Trojan-Go";
RunCmd("rm -rf /usr/local/bin/trojan-go");
RunCmd("rm -rf /usr/local/etc/trojan-go");
Progress.Percentage = 90;
Progress.Desc = "删除 acme.sh";
RunCmd("acme.sh --uninstall");
RunCmd("rm -r ~/.acme.sh");
Progress.Percentage = 100;
Progress.Step = "卸载Trojan-Go成功";
Progress.Desc = "卸载Trojan-Go成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Progress.Step = "更新配置文件";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 30;
Progress.Desc = "更新配置文件";
UploadTrojanGoSettings();
Progress.Percentage = 100;
Progress.Step = "更新配置成功";
Progress.Desc = "更新配置成功";
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
public void UploadCert()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadCert;
fileDialog.ShowDialog();
}
public void ApplyForCert()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "续签证书";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "安装TLS证书";
InstallCert(
dirPath: "/usr/local/etc/trojan-go",
certName: "trojan-go.crt",
keyName: "trojan-go.key");
Progress.Percentage = 90;
Progress.Desc = "重启Trojan-go服务";
RunCmd("systemctl restart trojan-go");
Progress.Percentage = 100;
Progress.Step = "续签证书成功";
Progress.Desc = "续签证书成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
#region
private void DoUploadCert(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Percentage = 0;
Progress.Step = "上传自有证书";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
RunCmd($"mv /usr/local/etc/trojan-go/ssl /usr/local/etc/trojan-go/{oldFileName}");
RunCmd("mkdir /usr/local/etc/trojan-go/ssl");
UploadFile(stream, "/usr/local/etc/trojan-go/ssl/ssl.zip");
RunCmd("unzip /usr/local/etc/trojan-go/ssl/ssl.zip -d /usr/local/etc/trojan-go/ssl");
}
var crtFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var keyFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (crtFiles.Length > 0 && keyFiles.Length > 0)
{
RunCmd($"mv {crtFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.crt");
RunCmd($"mv {keyFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.key");
}
else
{
Progress.Step = "上传失败";
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
return;
}
Progress.Desc = "重启trojan-go服务";
RunCmd("systemctl restart trojan-go");
Progress.Percentage = 100;
Progress.Desc = "上传证书完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 700;
}
Progress.Desc = "上传Caddy配置文件";
UploadCaddySettings();
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void UploadCaddySettings(bool useCustomWeb = false)
{
var config = TrojanGoConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(config));
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
UploadFile(stream, "/etc/caddy/Caddyfile");
RunCmd("systemctl restart caddy");
}
private void InstallTrojanGo()
{
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh yes | bash");
var success = FileExists("/usr/local/bin/trojan-go");
if (success == false)
{
throw new Exception("trojan-go 安装失败,请联系开发者!");
}
Progress.Desc = "设置Trojan-Go权限";
RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/trojan-go.service");
RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/trojan-go.service");
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/trojan-go.service");
RunCmd($"systemctl daemon-reload");
Progress.Desc = "启用Trojan-Go开机启动";
RunCmd("systemctl enable trojan-go");
RunCmd("systemctl start trojan-go");
Progress.Desc = "Trojan-Go 安装完成";
Progress.Desc = "安装TLS证书";
InstallCert(
dirPath: "/usr/local/etc/trojan-go",
certName: "trojan-go.crt",
keyName: "trojan-go.key");
Progress.Desc = "上传Trojan-Go配置文件";
UploadTrojanGoSettings();
}
private void UploadTrojanGoSettings()
{
// 上传配置
Progress.Desc = "生成配置文件";
var settings = TrojanGoConfigBuilder.BuildTrojanGoConfig(Settings);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(settings));
Progress.Desc = "正在上传配置文件";
UploadFile(stream, "/usr/local/etc/trojan-go/config.json");
Progress.Desc = "重启Trojan-Go服务器";
RunCmd("systemctl restart trojan-go");
}
#endregion
}
}

View File

@ -1,8 +1,10 @@
using ProxySuper.Core.Helpers; using Microsoft.Win32;
using ProxySuper.Core.Helpers;
using ProxySuper.Core.Models.Hosts; using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects; using ProxySuper.Core.Models.Projects;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -19,61 +21,338 @@ namespace ProxySuper.Core.Services
public void Install() public void Install()
{ {
Task.Run(() => Task.Factory.StartNew(() =>
{ {
int index = 1; try
if (!IsRootUser())
{ {
MessageBox.Show("ProxySU需要使用Root用户进行安装"); int index = 1;
return; EnsureRootUser();
if (FileExists("/usr/local/bin/xray"))
{
var btnResult = MessageBox.Show("已经安装Xray是否需要重装", "提示", MessageBoxButton.YesNo);
if (btnResult == MessageBoxResult.No)
{
MessageBox.Show("安装终止", "提示");
return;
}
}
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 5;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 15;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
if (Settings.IsIPAddress)
{
Progress.Desc = ("检查域名是否解析正确");
ValidateDomain();
}
Progress.Percentage = 25;
Progress.Step = $"{index}. 同步系统和本地时间";
SyncTimeDiff();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 安装Caddy服务器";
InstallCaddy();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 安装Xray-Core";
InstallXray();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Web服务器配置";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Percentage = 100;
Progress.Step = "安装成功";
Progress.Desc = "安装成功";
} }
catch (Exception ex)
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 5;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 15;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
if (Settings.IsIPAddress)
{ {
Progress.Desc = ("检查域名是否解析正确"); MessageBox.Show(ex.Message);
ValidateDomain();
} }
Progress.Percentage = 25;
Progress.Step = $"{index}. 同步系统和本地时间";
SyncTimeDiff();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 安装Caddy服务器";
InstallCaddy();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 安装Xray-Core";
InstallXray();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Web服务器配置";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Percentage = 100;
Progress.Desc = ("安装Xray完成");
}); });
} }
public void InstallXray() public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新Xray配置";
Progress.Percentage = 0;
EnsureRootUser();
var index = 0;
Progress.Desc = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = $"{index++}. 配置防火墙";
RunCmd("systemctl stop xray");
RunCmd("systemctl stop caddy");
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Desc = $"{index++}. 上传Xray配置文件";
var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
WriteToFile(configJson, "/usr/local/etc/xray/config.json");
Progress.Percentage = 70;
Progress.Desc = $"{index++}. 上传Caddy配置文件";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Desc = $"{index++}. 重启xray服务";
RunCmd("systemctl restart caddy");
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = ("更新配置成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateXrayCore()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新Xray-Core";
Progress.Percentage = 0;
EnsureRootUser();
Progress.Percentage = 20;
Progress.Desc = "下载最新版本Xray-Core";
EnsureSystemEnv();
Progress.Percentage = 40;
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "更新Xray-Core成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
var index = 1;
Progress.Percentage = 0;
Progress.Step = $"{index++}. 检测系统环境";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 卸载Caddy服务";
UninstallCaddy();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 卸载Xray服务";
UninstallXray();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 卸载Acme证书申请服务";
UninstallAcme();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 重置防火墙端口";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Step = "卸载完成";
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadCert()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadCert;
fileDialog.ShowDialog();
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
public void ApplyForCert()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "续签证书";
InstallCert(
dirPath: "/usr/local/etc/xray/ssl",
certName: "xray_ssl.crt",
keyName: "xray_ssl.key");
Progress.Percentage = 90;
Progress.Desc = "重启服务";
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "续签证书成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
#region
private void DoUploadCert(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Percentage = 0;
Progress.Step = "上传自有证书";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
RunCmd($"mv /usr/local/etc/xray/ssl /usr/local/etc/xray/{oldFileName}");
RunCmd("mkdir /usr/local/etc/xray/ssl");
UploadFile(stream, "/usr/local/etc/xray/ssl/ssl.zip");
RunCmd("unzip /usr/local/etc/xray/ssl/ssl.zip -d /usr/local/etc/xray/ssl");
}
var crtFiles = RunCmd("find /usr/local/etc/xray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var keyFiles = RunCmd("find /usr/local/etc/xray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (crtFiles.Length > 0 && keyFiles.Length > 0)
{
RunCmd($"mv {crtFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.crt");
RunCmd($"mv {keyFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.key");
}
else
{
Progress.Step = "上传失败";
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
return;
}
Progress.Desc = "重启Xray服务";
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "上传证书完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Desc = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
}
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 80;
Progress.Desc = "上传Web配置文件";
UploadCaddyFile(useCustomWeb: true);
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallXray()
{ {
Progress.Desc = ("开始安装Xray-Core"); Progress.Desc = ("开始安装Xray-Core");
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");
@ -123,5 +402,27 @@ namespace ProxySuper.Core.Services
WriteToFile(configJson, "/etc/caddy/Caddyfile"); WriteToFile(configJson, "/etc/caddy/Caddyfile");
RunCmd("systemctl restart caddy"); RunCmd("systemctl restart caddy");
} }
private void UninstallXray()
{
Progress.Desc = "关闭Xray服务";
RunCmd("systemctl stop xray");
RunCmd("systemctl disable xray");
Progress.Desc = "卸载Xray";
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
}
private void UninstallAcme()
{
Progress.Desc = "卸载 acme.sh";
RunCmd("acme.sh --uninstall");
Progress.Desc = "删除 acme.sh 相关文件";
RunCmd("rm -rf ~/.acme.sh");
}
#endregion
} }
} }

View File

@ -0,0 +1,51 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class BrookInstallViewModel : MvxViewModel<Record>
{
Host _host;
BrookSettings _settings;
BrookService _service;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.BrookSettings;
}
public override Task Initialize()
{
_service = new BrookService(_host, _settings);
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_service.Disconnect();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress => _service.Progress;
public string Logs => _service.Progress.Logs;
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
}
}

View File

@ -225,15 +225,15 @@ namespace ProxySuper.Core.ViewModels
} }
if (record.Type == ProjectType.TrojanGo) if (record.Type == ProjectType.TrojanGo)
{ {
await _navigationService.Navigate<TrojanGoInstallerViewModel, Record>(record); await _navigationService.Navigate<TrojanGoInstallViewModel, Record>(record);
} }
if (record.Type == ProjectType.NaiveProxy) if (record.Type == ProjectType.NaiveProxy)
{ {
await _navigationService.Navigate<NaiveProxyInstallerViewModel, Record>(record); await _navigationService.Navigate<NaiveProxyInstallViewModel, Record>(record);
} }
if (record.Type == ProjectType.Brook) if (record.Type == ProjectType.Brook)
{ {
await _navigationService.Navigate<BrookInstallerViewModel, Record>(record); await _navigationService.Navigate<BrookInstallViewModel, Record>(record);
} }
} }
} }

View File

@ -0,0 +1,61 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class NaiveProxyInstallViewModel : MvxViewModel<Record>
{
Host _host;
NaiveProxySettings _settings;
NaiveProxyService _service;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.NaiveProxySettings;
}
public override Task Initialize()
{
_service = new NaiveProxyService(_host, _settings);
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_service.Disconnect();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress => _service.Progress;
public string Logs => _service.Progress.Logs;
#region Commands
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
public IMvxCommand UpdateSettingsCommand => new MvxCommand(_service.UpdateSettings);
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
#endregion
}
}

View File

@ -0,0 +1,71 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class TrojanGoInstallViewModel : MvxViewModel<Record>
{
Host _host;
TrojanGoSettings _settings;
TrojanGoService _trojanGoService;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.TrojanGoSettings;
}
public override Task Initialize()
{
_trojanGoService = new TrojanGoService(_host, _settings);
_trojanGoService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_trojanGoService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
_trojanGoService.Connect();
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_trojanGoService.Disconnect();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress
{
get => _trojanGoService.Progress;
}
public string Logs
{
get => _trojanGoService.Progress.Logs;
}
#region Command
public IMvxCommand InstallCommand => new MvxCommand(_trojanGoService.Install);
public IMvxCommand UpdateSettingsCommand => new MvxCommand(_trojanGoService.UpdateSettings);
public IMvxCommand UninstallCommand => new MvxCommand(_trojanGoService.Uninstall);
public IMvxCommand UploadCertCommand => new MvxCommand(_trojanGoService.UploadCert);
public IMvxCommand UploadWebCommand => new MvxCommand(_trojanGoService.UploadWeb);
public IMvxCommand ApplyForCertCommand => new MvxCommand(_trojanGoService.ApplyForCert);
#endregion
}
}

View File

@ -26,7 +26,9 @@ namespace ProxySuper.Core.ViewModels
public XraySettings Settings { get; set; } public XraySettings Settings { get; set; }
public IMvxCommand SaveCommand => new MvxCommand(() => Save()); public IMvxCommand SaveCommand => new MvxCommand(Save);
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
public IMvxNavigationService NavigationService { get; } public IMvxNavigationService NavigationService { get; }
@ -47,6 +49,18 @@ namespace ProxySuper.Core.ViewModels
XraySettings = Settings, XraySettings = Settings,
}); });
} }
public void SaveAndInstall()
{
var record = new Record()
{
Id = Id,
Host = Host,
XraySettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<XrayInstallViewModel, Record>(record);
}
} }
public partial class XrayEditorViewModel public partial class XrayEditorViewModel

View File

@ -20,8 +20,6 @@ namespace ProxySuper.Core.ViewModels
XrayService _xrayService; XrayService _xrayService;
MvxInteraction _refreshLogInteraction = new MvxInteraction();
public override void ViewDestroy(bool viewFinishing = true) public override void ViewDestroy(bool viewFinishing = true)
{ {
_xrayService.Disconnect(); _xrayService.Disconnect();
@ -38,11 +36,7 @@ namespace ProxySuper.Core.ViewModels
{ {
_xrayService = new XrayService(_host, _settings); _xrayService = new XrayService(_host, _settings);
_xrayService.Progress.StepUpdate = () => RaisePropertyChanged("Progress"); _xrayService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_xrayService.Progress.LogsUpdate = () => _xrayService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
{
RaisePropertyChanged("Logs");
_refreshLogInteraction.Raise();
};
_xrayService.Connect(); _xrayService.Connect();
return base.Initialize(); return base.Initialize();
@ -58,11 +52,24 @@ namespace ProxySuper.Core.ViewModels
get => _xrayService.Progress.Logs; get => _xrayService.Progress.Logs;
} }
public IMvxInteraction LogsInteraction
{
get => _refreshLogInteraction; #region Command
}
public IMvxCommand InstallCommand => new MvxCommand(_xrayService.Install); public IMvxCommand InstallCommand => new MvxCommand(_xrayService.Install);
public IMvxCommand UpdateSettingsCommand => new MvxCommand(_xrayService.UpdateSettings);
public IMvxCommand UpdateXrayCoreCommand => new MvxCommand(_xrayService.UpdateXrayCore);
public IMvxCommand UninstallCommand => new MvxCommand(_xrayService.Uninstall);
public IMvxCommand UploadCertCommand => new MvxCommand(_xrayService.UploadCert);
public IMvxCommand UploadWebCommand => new MvxCommand(_xrayService.UploadWeb);
public IMvxCommand ApplyForCertCommand => new MvxCommand(_xrayService.ApplyForCert);
#endregion
} }
} }

View File

@ -37,7 +37,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -42,7 +42,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -42,7 +42,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -42,7 +42,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -42,7 +42,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="" IsReadOnly="True" Width="300" /> <TextBox Text="" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -37,7 +37,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -37,7 +37,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -37,7 +37,7 @@
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<Label Content="伪装域名(host)" Width="140" /> <Label Content="域名(host)" Width="140" />
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" /> <TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="300" />
</StackPanel> </StackPanel>

View File

@ -117,52 +117,61 @@
<Compile Include="MainWindow.xaml.cs"> <Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon> <DependentUpon>MainWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\BrookConfigView.xaml.cs"> <Compile Include="Views\Brook\BrookConfigView.xaml.cs">
<DependentUpon>BrookConfigView.xaml</DependentUpon> <DependentUpon>BrookConfigView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\BrookEditorView.xaml.cs"> <Compile Include="Views\Brook\BrookEditorView.xaml.cs">
<DependentUpon>BrookEditorView.xaml</DependentUpon> <DependentUpon>BrookEditorView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\BrookInstallerView.xaml.cs"> <Compile Include="Views\Brook\BrookInstallerView.xaml.cs">
<DependentUpon>BrookInstallerView.xaml</DependentUpon> <DependentUpon>BrookInstallerView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\Brook\BrookInstallView.xaml.cs">
<DependentUpon>BrookInstallView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\EnableRootView.xaml.cs"> <Compile Include="Views\EnableRootView.xaml.cs">
<DependentUpon>EnableRootView.xaml</DependentUpon> <DependentUpon>EnableRootView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\HomeView.xaml.cs"> <Compile Include="Views\HomeView.xaml.cs">
<DependentUpon>HomeView.xaml</DependentUpon> <DependentUpon>HomeView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\NaiveProxyConfigView.xaml.cs"> <Compile Include="Views\NaiveProxy\NaiveProxyConfigView.xaml.cs">
<DependentUpon>NaiveProxyConfigView.xaml</DependentUpon> <DependentUpon>NaiveProxyConfigView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\NaiveProxyEditorView.xaml.cs"> <Compile Include="Views\NaiveProxy\NaiveProxyEditorView.xaml.cs">
<DependentUpon>NaiveProxyEditorView.xaml</DependentUpon> <DependentUpon>NaiveProxyEditorView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\NaiveProxyInstallerView.xaml.cs"> <Compile Include="Views\NaiveProxy\NaiveProxyInstallerView.xaml.cs">
<DependentUpon>NaiveProxyInstallerView.xaml</DependentUpon> <DependentUpon>NaiveProxyInstallerView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\NaiveProxy\NaiveProxyInstallView.xaml.cs">
<DependentUpon>NaiveProxyInstallView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ShareLinkView.xaml.cs"> <Compile Include="Views\ShareLinkView.xaml.cs">
<DependentUpon>ShareLinkView.xaml</DependentUpon> <DependentUpon>ShareLinkView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\TrojanGoConfigView.xaml.cs"> <Compile Include="Views\TrojanGo\TrojanGoConfigView.xaml.cs">
<DependentUpon>TrojanGoConfigView.xaml</DependentUpon> <DependentUpon>TrojanGoConfigView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\TrojanGoEditorView.xaml.cs"> <Compile Include="Views\TrojanGo\TrojanGoEditorView.xaml.cs">
<DependentUpon>TrojanGoEditorView.xaml</DependentUpon> <DependentUpon>TrojanGoEditorView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\TrojanGoInstallerView.xaml.cs"> <Compile Include="Views\TrojanGo\TrojanGoInstallerView.xaml.cs">
<DependentUpon>TrojanGoInstallerView.xaml</DependentUpon> <DependentUpon>TrojanGoInstallerView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\XrayEditorView.xaml.cs"> <Compile Include="Views\TrojanGo\TrojanGoInstallView.xaml.cs">
<DependentUpon>TrojanGoInstallView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Xray\XrayEditorView.xaml.cs">
<DependentUpon>XrayEditorView.xaml</DependentUpon> <DependentUpon>XrayEditorView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\XrayConfigView.xaml.cs"> <Compile Include="Views\Xray\XrayConfigView.xaml.cs">
<DependentUpon>XrayConfigView.xaml</DependentUpon> <DependentUpon>XrayConfigView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\XrayInstallerView.xaml.cs"> <Compile Include="Views\Xray\XrayInstallerView.xaml.cs">
<DependentUpon>XrayInstallerView.xaml</DependentUpon> <DependentUpon>XrayInstallerView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\XrayInstallView.xaml.cs"> <Compile Include="Views\Xray\XrayInstallView.xaml.cs">
<DependentUpon>XrayInstallView.xaml</DependentUpon> <DependentUpon>XrayInstallView.xaml</DependentUpon>
</Compile> </Compile>
<Page Include="Controls\HostControl.xaml"> <Page Include="Controls\HostControl.xaml">
@ -226,15 +235,19 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page> </Page>
<Page Include="Views\BrookConfigView.xaml"> <Page Include="Views\Brook\BrookConfigView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\BrookEditorView.xaml"> <Page Include="Views\Brook\BrookEditorView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\BrookInstallerView.xaml"> <Page Include="Views\Brook\BrookInstallerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Brook\BrookInstallView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
@ -265,15 +278,19 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page> </Page>
<Page Include="Views\NaiveProxyConfigView.xaml"> <Page Include="Views\NaiveProxy\NaiveProxyConfigView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\NaiveProxyEditorView.xaml"> <Page Include="Views\NaiveProxy\NaiveProxyEditorView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\NaiveProxyInstallerView.xaml"> <Page Include="Views\NaiveProxy\NaiveProxyInstallerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\NaiveProxy\NaiveProxyInstallView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
@ -281,31 +298,35 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\TrojanGoConfigView.xaml"> <Page Include="Views\TrojanGo\TrojanGoConfigView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\TrojanGoEditorView.xaml"> <Page Include="Views\TrojanGo\TrojanGoEditorView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\TrojanGoInstallerView.xaml"> <Page Include="Views\TrojanGo\TrojanGoInstallerView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\XrayEditorView.xaml"> <Page Include="Views\TrojanGo\TrojanGoInstallView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\XrayConfigView.xaml"> <Page Include="Views\Xray\XrayEditorView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\XrayInstallerView.xaml"> <Page Include="Views\Xray\XrayConfigView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\XrayInstallView.xaml"> <Page Include="Views\Xray\XrayInstallerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Xray\XrayInstallView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>

View File

@ -5,6 +5,7 @@
<!--common--> <!--common-->
<sys:String x:Key="Random">Random</sys:String> <sys:String x:Key="Random">Random</sys:String>
<sys:String x:Key="Save">Save</sys:String> <sys:String x:Key="Save">Save</sys:String>
<sys:String x:Key="SaveAndInstall">Save And Install</sys:String>
<sys:String x:Key="SaveAs">SaveAs</sys:String> <sys:String x:Key="SaveAs">SaveAs</sys:String>
<sys:String x:Key="Install">Install</sys:String> <sys:String x:Key="Install">Install</sys:String>
<sys:String x:Key="Settings">Settings</sys:String> <sys:String x:Key="Settings">Settings</sys:String>
@ -74,7 +75,7 @@
<sys:String x:Key="TrojanDesc" xml:space="preserve">Trojan over TCP with TLS&#x0a;Trojan</sys:String> <sys:String x:Key="TrojanDesc" xml:space="preserve">Trojan over TCP with TLS&#x0a;Trojan</sys:String>
<sys:String x:Key="XrayDomain">Domain/IP</sys:String> <sys:String x:Key="XrayDomain">Domain/IP</sys:String>
<sys:String x:Key="XrayMarkDomain">GuiseHost</sys:String> <sys:String x:Key="XrayMarkDomain">Redir Url</sys:String>
<sys:String x:Key="XrayUUID">UUID</sys:String> <sys:String x:Key="XrayUUID">UUID</sys:String>
<sys:String x:Key="MultiUser">Multi User</sys:String> <sys:String x:Key="MultiUser">Multi User</sys:String>
<sys:String x:Key="MultiUserHelp">Multi Id split with ","</sys:String> <sys:String x:Key="MultiUserHelp">Multi Id split with ","</sys:String>

View File

@ -5,6 +5,7 @@
<!--common--> <!--common-->
<sys:String x:Key="Random">隨機</sys:String> <sys:String x:Key="Random">隨機</sys:String>
<sys:String x:Key="Save">保存</sys:String> <sys:String x:Key="Save">保存</sys:String>
<sys:String x:Key="SaveAndInstall">保存并安裝</sys:String>
<sys:String x:Key="SaveAs">另存為</sys:String> <sys:String x:Key="SaveAs">另存為</sys:String>
<sys:String x:Key="Install">安裝</sys:String> <sys:String x:Key="Install">安裝</sys:String>
<sys:String x:Key="Settings">配置</sys:String> <sys:String x:Key="Settings">配置</sys:String>
@ -73,7 +74,7 @@
<sys:String x:Key="XrayDomain">域名/IP</sys:String> <sys:String x:Key="XrayDomain">域名/IP</sys:String>
<sys:String x:Key="XrayMarkDomain">偽裝域名</sys:String> <sys:String x:Key="XrayMarkDomain">偽裝網址</sys:String>
<sys:String x:Key="XrayUUID">UUID</sys:String> <sys:String x:Key="XrayUUID">UUID</sys:String>
<sys:String x:Key="MultiUser">多用戶</sys:String> <sys:String x:Key="MultiUser">多用戶</sys:String>
<sys:String x:Key="MultiUserHelp">多個UUID用“,”分隔</sys:String> <sys:String x:Key="MultiUserHelp">多個UUID用“,”分隔</sys:String>

View File

@ -5,6 +5,7 @@
<!--common--> <!--common-->
<sys:String x:Key="Random">随机</sys:String> <sys:String x:Key="Random">随机</sys:String>
<sys:String x:Key="Save">保存</sys:String> <sys:String x:Key="Save">保存</sys:String>
<sys:String x:Key="SaveAndInstall">保存并安装</sys:String>
<sys:String x:Key="SaveAs">另存为</sys:String> <sys:String x:Key="SaveAs">另存为</sys:String>
<sys:String x:Key="Install">安装</sys:String> <sys:String x:Key="Install">安装</sys:String>
<sys:String x:Key="Settings">配置</sys:String> <sys:String x:Key="Settings">配置</sys:String>
@ -74,7 +75,7 @@
<sys:String x:Key="XrayDomain">域名/IP</sys:String> <sys:String x:Key="XrayDomain">域名/IP</sys:String>
<sys:String x:Key="XrayMarkDomain">伪装域名</sys:String> <sys:String x:Key="XrayMarkDomain">伪装网址</sys:String>
<sys:String x:Key="XrayUUID">UUID</sys:String> <sys:String x:Key="XrayUUID">UUID</sys:String>
<sys:String x:Key="MultiUser">多用户</sys:String> <sys:String x:Key="MultiUser">多用户</sys:String>
<sys:String x:Key="MultiUserHelp">多个UUID用“,”分隔</sys:String> <sys:String x:Key="MultiUserHelp">多个UUID用“,”分隔</sys:String>

View File

@ -0,0 +1,29 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.Brook.BrookInstallView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySuper.WPF.Views.Brook"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="TrojanGoInstallView" Height="600" Width="1000">
<StackPanel>
<ctrl:ProgressControl />
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerInstall}"
Command="{Binding Path=InstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUninstall}"
Command="{Binding Path=UninstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
</StackPanel>
</views:MvxWindow>

View File

@ -0,0 +1,28 @@
using MvvmCross.Platforms.Wpf.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProxySuper.WPF.Views.Brook
{
/// <summary>
/// BrookInstallView.xaml 的交互逻辑
/// </summary>
public partial class BrookInstallView : MvxWindow
{
public BrookInstallView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,51 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.NaiveProxy.NaiveProxyInstallView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySuper.WPF.Views.NaiveProxy"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="TrojanGoInstallView" Height="600" Width="1000">
<StackPanel>
<ctrl:ProgressControl />
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerInstall}"
Command="{Binding Path=InstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateSettings}"
Command="{Binding Path=UpdateSettingsCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUninstall}"
Command="{Binding Path=UninstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,15,0,0">
<Label Content="{DynamicResource Settings}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerUploadWeb}"
Command="{Binding Path=UploadWebCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Margin="20,10,0,0" Orientation="Horizontal">
<Label Content="说明" FontWeight="Bold" FontSize="14" VerticalAlignment="Top" />
<StackPanel Margin="10,0,0,0">
<Label Content="1.【更新配置】 修改NaiveProxy参数后只需使用此功能即可不需要重新安装。" FontSize="14" />
<Label Content="2.【上传伪装网站】 将根目录包含 (index.html) 的文件夹,打包为.zip文件。" FontSize="14" />
</StackPanel>
</StackPanel>
</StackPanel>
</views:MvxWindow>

View File

@ -0,0 +1,28 @@
using MvvmCross.Platforms.Wpf.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProxySuper.WPF.Views.NaiveProxy
{
/// <summary>
/// NaiveProxyInstallViewModel.xaml 的交互逻辑
/// </summary>
public partial class NaiveProxyInstallView : MvxWindow
{
public NaiveProxyInstallView()
{
InitializeComponent();
}
}
}

View File

@ -10,6 +10,13 @@
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
Title="ShareLinkView" Height="450" Width="800"> Title="ShareLinkView" Height="450" Width="800">
<Grid> <Grid>
<TextBox IsReadOnly="True" Margin="10" Text="{Binding ShareLinks,Mode=OneTime}" TextWrapping="WrapWithOverflow" Height="400" /> <TextBox IsReadOnly="True"
Margin="20"
Text="{Binding ShareLinks,Mode=OneTime}"
TextWrapping="NoWrap"
FontFamily="微软雅黑"
Height="360"
FontSize="14"
VerticalContentAlignment="Top" />
</Grid> </Grid>
</views:MvxWindow> </views:MvxWindow>

View File

@ -0,0 +1,63 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.TrojanGo.TrojanGoInstallView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySuper.WPF.Views.TrojanGo"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="TrojanGoInstallView" Height="600" Width="1000">
<StackPanel>
<ctrl:ProgressControl />
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerInstall}"
Command="{Binding Path=InstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateSettings}"
Command="{Binding Path=UpdateSettingsCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUninstall}"
Command="{Binding Path=UninstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,15,0,0">
<Label Content="{DynamicResource Settings}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerUploadCert}"
Command="{Binding Path=UploadCertCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerInstallCert}"
Command="{Binding Path=ApplyForCertCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUploadWeb}"
Command="{Binding Path=UploadWebCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Margin="20,10,0,0" Orientation="Horizontal">
<Label Content="说明" FontWeight="Bold" FontSize="14" VerticalAlignment="Top" />
<StackPanel Margin="10,0,0,0">
<Label Content="1.【更新配置】 修改Trojan-go参数后只需使用此功能即可不需要重新安装。" FontSize="14" />
<Label Content="2.【上传自有证书】 将 (.crt和.key) 文件打包成.zip文件名称随意后缀名不能变。" FontSize="14" />
<Label Content="3.【手动续签证书】 ProxySU会在证书到期时间自动续期此功能可手动提前续期。" FontSize="14" />
<Label Content="4.【上传伪装网站】 将根目录包含 (index.html) 的文件夹,打包为.zip文件。" FontSize="14" />
</StackPanel>
</StackPanel>
</StackPanel>
</views:MvxWindow>

View File

@ -0,0 +1,28 @@
using MvvmCross.Platforms.Wpf.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProxySuper.WPF.Views.TrojanGo
{
/// <summary>
/// TrojanGoInstallView.xaml 的交互逻辑
/// </summary>
public partial class TrojanGoInstallView : MvxWindow
{
public TrojanGoInstallView()
{
InitializeComponent();
}
}
}

View File

@ -25,14 +25,14 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Background="#EEE"></StackPanel> <StackPanel Grid.Column="1" Background="#EEE"></StackPanel>
<StackPanel Grid.Column="2"> <StackPanel Grid.Column="2">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="500" /> <RowDefinition Height="500" />
<RowDefinition Height="80" /> <RowDefinition Height="80" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer Name="scroll" <ScrollViewer Name="scroll"
Padding="10" Padding="10"
Height="500" Height="500"
@ -45,13 +45,20 @@
<Border Grid.Row="1" <Border Grid.Row="1"
BorderBrush="#eee" BorderBrush="#eee"
BorderThickness="0,1,0,0"> BorderThickness="0,1,0,0">
<Button Content="{DynamicResource Save}" <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
Command="{Binding SaveCommand}" <Button Content="{DynamicResource Save}"
HorizontalAlignment="Right" Command="{Binding SaveCommand}"
VerticalAlignment="Center" HorizontalAlignment="Right"
Height="30" VerticalAlignment="Center"
Width="100" Padding="10,5" />
Margin="40,0" />
<Button Content="{DynamicResource SaveAndInstall}"
Command="{Binding SaveAndInstallCommand}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Padding="10,5"
Margin="20,0,40,0" />
</StackPanel>
</Border> </Border>
</Grid> </Grid>
</StackPanel> </StackPanel>

View File

@ -14,10 +14,5 @@ namespace ProxySuper.WPF.Views
{ {
InitializeComponent(); InitializeComponent();
} }
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
}
} }
} }

View File

@ -0,0 +1,69 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.XrayInstallView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="XrayInstallView" Height="600" Width="1000">
<StackPanel>
<ctrl:ProgressControl />
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerInstall}"
Command="{Binding Path=InstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateSettings}"
Command="{Binding Path=UpdateSettingsCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateCore}"
Command="{Binding Path=UpdateXrayCoreCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUninstall}"
Command="{Binding Path=UninstallCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,15,0,0">
<Label Content="{DynamicResource Settings}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerUploadCert}"
Command="{Binding Path=UploadCertCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerInstallCert}"
Command="{Binding Path=ApplyForCertCommand}"
Padding="10,3"
Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUploadWeb}"
Command="{Binding Path=UploadWebCommand}"
Padding="10,3"
Margin="10,0,0,0" />
</StackPanel>
<StackPanel Margin="20,10,0,0" Orientation="Horizontal">
<Label Content="说明" FontWeight="Bold" FontSize="14" VerticalAlignment="Top" />
<StackPanel Margin="10,0,0,0">
<Label Content="1.【更新配置】 修改Xray参数后只需使用此功能即可不需要重新安装。" FontSize="14" />
<Label Content="2.【更新内核】 官方Xray修补漏洞或新功能可用此更新Xray内核。" FontSize="14" />
<Label Content="3.【上传自有证书】 将 (.crt和.key) 文件打包成.zip文件名称随意后缀名不能变。" FontSize="14" />
<Label Content="4.【手动续签证书】 ProxySU会在证书到期时间自动续期此功能可手动提前续期。" FontSize="14" />
<Label Content="5.【上传伪装网站】 将根目录包含 (index.html) 的文件夹,打包为.zip文件。" FontSize="14" />
</StackPanel>
</StackPanel>
</StackPanel>
</views:MvxWindow>

View File

@ -1,38 +0,0 @@
<views:MvxWindow x:Class="ProxySuper.WPF.Views.XrayInstallView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
mc:Ignorable="d"
Title="XrayInstallView" Height="700" Width="1000">
<StackPanel>
<ctrl:ProgressControl />
<StackPanel Orientation="Horizontal" Margin="20,10,0,0">
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
<Button Command="{Binding Path=InstallCommand}" Content="{DynamicResource XrayInstallerInstall}" Padding="10,3" Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateSettings}" Padding="10,3" Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUpdateCore}" Padding="10,3" Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUninstall}" Padding="10,3" Margin="10,0,0,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,20,0,0">
<Label Content="{DynamicResource Settings}" FontWeight="Bold" FontSize="14" />
<Button Content="{DynamicResource XrayInstallerUploadCert}" Padding="10,3" Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerInstallCert}" Padding="10,3" Margin="10,0,0,0" />
<Button Content="{DynamicResource XrayInstallerUploadWeb}" Padding="10,3" Margin="10,0,0,0" />
</StackPanel>
<StackPanel Margin="20,10,0,0">
<Label Content="说明:" FontWeight="Bold" FontSize="14" />
<Label Content="【更新配置】 修改Xray参数后只需使用此功能即可不需要重新安装。" FontSize="14" />
<Label Content="【更新内核】 官方Xray修补漏洞或新功能可用此更新Xray内核。" FontSize="14" />
<Label Content="【上传自有证书】 将 (.crt和.key) 文件打包成.zip文件名称随意后缀名不能变。" FontSize="14" />
<Label Content="【手动续签证书】 ProxySU会在证书到期时间自动续期此功能可手动提前续期。" FontSize="14" />
<Label Content="【上传伪装网站】 将根目录包含 (index.html) 的文件夹,打包为.zip文件。" FontSize="14" />
</StackPanel>
</StackPanel>
</views:MvxWindow>