diff --git a/ProxySU_Core/ViewModels/Developers/Project.cs b/ProxySU_Core/ViewModels/Developers/Project.cs
index ed785e8..73057f8 100644
--- a/ProxySU_Core/ViewModels/Developers/Project.cs
+++ b/ProxySU_Core/ViewModels/Developers/Project.cs
@@ -347,28 +347,32 @@ namespace ProxySU_Core.ViewModels.Developers
///
protected void InstallCaddy()
{
- 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("sudo apt update");
- RunCmd("sudo apt install caddy");
- }
- else if (CmdType == CmdType.Dnf)
- {
- RunCmd("dnf install 'dnf-command(copr)'");
- RunCmd("dnf copr enable @caddy/caddy");
- RunCmd(GetUpdateCmd());
- RunCmd("dnf install caddy");
- }
- else if (CmdType == CmdType.Yum)
- {
- RunCmd("y | yum install yum-plugin-copr");
- RunCmd("yum copr enable @caddy/caddy");
- RunCmd(GetUpdateCmd());
- RunCmd("yum install caddy");
- }
+ 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");
+
+ //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");
+ //}
}
@@ -526,15 +530,15 @@ namespace ProxySU_Core.ViewModels.Developers
{
if (CmdType == CmdType.Apt)
{
- return "apt-get update ";
+ return "echo y | apt-get update ";
}
else if (CmdType == CmdType.Dnf)
{
- return "dnf clean all;dnf makecache";
+ return "echo y | dnf update ";
}
else if (CmdType == CmdType.Yum)
{
- return "yum clean all;yum makecache";
+ return "echo y | yum update ";
}
throw new Exception("未识别的系统");
diff --git a/ProxySU_Core/ViewModels/Developers/XrayProject.cs b/ProxySU_Core/ViewModels/Developers/XrayProject.cs
index cd0cf31..802bc3e 100644
--- a/ProxySU_Core/ViewModels/Developers/XrayProject.cs
+++ b/ProxySU_Core/ViewModels/Developers/XrayProject.cs
@@ -35,16 +35,32 @@ namespace ProxySU_Core.ViewModels.Developers
EnsureSystemEnv();
this.InstallCertToXray();
RunCmd("systemctl restart xray");
+ WriteOutput("安装证书完成");
}
public void UploadWeb(Stream stream)
{
EnsureRootAuth();
EnsureSystemEnv();
+ if (!FileExists("/usr/share/caddy"))
+ {
+ RunCmd("mkdir /usr/share/caddy");
+ }
RunCmd("rm -rf /usr/share/caddy/*");
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");
+ RunCmd("systemctl restart caddy");
+ WriteOutput("上传网站模板完成");
+ }
+
+ public void ReinstallCaddy()
+ {
+ EnsureRootAuth();
+ EnsureSystemEnv();
+ InstallCaddy();
+ UploadCaddyFile();
+ WriteOutput("重装Caddy完成");
}
@@ -157,7 +173,7 @@ namespace ProxySU_Core.ViewModels.Developers
RunCmd(GetInstallCmd("socat"));
// 解决搬瓦工CentOS缺少问题
- RunCmd("y | " + GetInstallCmd("automake autoconf libtool"));
+ RunCmd("echo y | " + GetInstallCmd("automake autoconf libtool"));
// 安装Acme
var result = RunCmd($"curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m {GetRandomEmail()}");
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml b/ProxySU_Core/Views/TerminalWindow.xaml
index a1fcfbd..89d9b7c 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml
+++ b/ProxySU_Core/Views/TerminalWindow.xaml
@@ -46,6 +46,13 @@
Width="120"
IsEnabled="{Binding HasConnected}"
Click="UploadWeb"/>
+
+
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml.cs b/ProxySU_Core/Views/TerminalWindow.xaml.cs
index 7646166..4e50820 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml.cs
+++ b/ProxySU_Core/Views/TerminalWindow.xaml.cs
@@ -146,6 +146,14 @@ namespace ProxySU_Core
fileDialog.ShowDialog();
}
+ private void ReinstallCaddy(object sender, RoutedEventArgs e)
+ {
+ Task.Factory.StartNew(() =>
+ {
+ project.ReinstallCaddy();
+ });
+ }
+
private void OnFileOk(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>