1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00

4.0.2 update

This commit is contained in:
autumn 2021-06-17 18:54:07 +08:00
parent 316453c89b
commit 11021fac1a
8 changed files with 110 additions and 23 deletions

View File

@ -27,5 +27,10 @@ namespace ProxySuper.Core.Models.Projects
/// 类型
/// </summary>
ProjectType Type { get; set; }
/// <summary>
/// 邮箱
/// </summary>
string Email { get; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -26,5 +27,24 @@ namespace ProxySuper.Core.Models.Projects
public string Password { get; set; }
public string MaskDomain { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
return $"{UserName + Port.ToString()}@gmail.com";
}
}
}
}

View File

@ -14,6 +14,7 @@ namespace ProxySuper.Core.Models.Projects
{
Port = 443;
WebSocketPath = "/ws";
Password = Guid.NewGuid().ToString();
}
public List<int> FreePorts
@ -63,5 +64,25 @@ namespace ProxySuper.Core.Models.Projects
/// </summary>
public string WebSocketPath { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
var prefix = Password.Length > 7 ? Password.Substring(0, 7) : Password;
return $"{prefix}@gmail.com";
}
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -71,6 +72,24 @@ namespace ProxySuper.Core.Models.Projects
/// </summary>
public string MaskDomain { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
return $"{UUID.Substring(2, 6)}@gmail.com";
}
}
/// <summary>
/// 安装类型
/// </summary>

View File

@ -101,6 +101,8 @@ namespace ProxySuper.Core.Services
{
WriteOutput("安装 NaiveProxy");
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash");
// 允许开机启动
RunCmd("systemctl enable caddy");
UploadCaddyFile(false);
ConfigNetwork();
WriteOutput("NaiveProxy 安装完成");

View File

@ -70,7 +70,7 @@ namespace ProxySuper.Core.Services
// 确认安装命令
if (CmdType == CmdType.None)
{
cmd = RunCmd("command -v apt-get");
cmd = RunCmd("command -v apt");
if (!string.IsNullOrEmpty(cmd))
{
CmdType = CmdType.Apt;
@ -105,7 +105,7 @@ namespace ProxySuper.Core.Services
if (CmdType == CmdType.None || !hasSystemCtl)
{
throw new Exception("系统缺乏必要的安装组件如:apt-get||dnf||yum||Syetemd主机系统推荐使用CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本");
throw new Exception("系统缺乏必要的安装组件如:apt||dnf||yum||Syetemd主机系统推荐使用CentOS 7/8,Debian 8/9/10,Ubuntu 16.04及以上版本");
}
@ -157,6 +157,8 @@ namespace ProxySuper.Core.Services
/// </summary>
protected void ConfigureSoftware()
{
RunCmd(GetUpdateCmd());
string cmd = RunCmd("command -v sudo");
if (string.IsNullOrEmpty(cmd))
{
@ -188,17 +190,14 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("dnsutils"));
}
else if (CmdType == CmdType.Dnf)
{
RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("bind-utils"));
}
else if (CmdType == CmdType.Yum)
{
RunCmd(GetUpdateCmd());
RunCmd(GetInstallCmd("bind-utils"));
}
}
@ -397,25 +396,25 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
RunCmd("sudo apt -y install debian-keyring debian-archive-keyring apt-transport-https");
RunCmd("apt install -y debian-keyring debian-archive-keyring apt-transport-https");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -");
RunCmd("echo yes | curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list");
RunCmd("sudo apt -y update");
RunCmd("sudo apt -y install caddy");
RunCmd("sudo apt install -y caddy");
}
if (CmdType == CmdType.Dnf)
{
RunCmd("dnf -y install 'dnf-command(copr)'");
RunCmd("dnf -y copr enable @caddy/caddy");
RunCmd("dnf -y install caddy");
RunCmd("dnf install -y 'dnf-command(copr)'");
RunCmd("dnf copr enable @caddy/caddy");
RunCmd("dnf install -y caddy");
}
if (CmdType == CmdType.Yum)
{
RunCmd("yum -y install yum-plugin-copr");
RunCmd("yum -y copr enable @caddy/caddy");
RunCmd("yum -y install caddy");
RunCmd("yum install -y yum-plugin-copr");
RunCmd("yum copr enable @caddy/caddy");
RunCmd("yum install -y caddy");
}
RunCmd("systemctl enable caddy.service");
@ -468,7 +467,7 @@ namespace ProxySuper.Core.Services
if (string.IsNullOrEmpty(IPv6))
{
throw new Exception("未检测到可用的的IP地址");
throw new Exception("未检测到可用的的IP地址,请重试安装");
}
OnlyIpv6 = true;
@ -662,7 +661,8 @@ namespace ProxySuper.Core.Services
RunCmd(GetInstallCmd("automake autoconf libtool"));
// 安装Acme
var result = RunCmd($"curl https://get.acme.sh yes | sh");
var result = RunCmd($"curl https://get.acme.sh yes | sh -s email={Parameters.Email}");
if (result.Contains("Install success"))
{
WriteOutput("安装 acme.sh 成功");
@ -740,7 +740,7 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
return "apt-get update";
return "apt update";
}
else if (CmdType == CmdType.Dnf)
{
@ -763,15 +763,15 @@ namespace ProxySuper.Core.Services
{
if (CmdType == CmdType.Apt)
{
return "apt-get -y install " + soft;
return "apt install -y " + soft;
}
else if (CmdType == CmdType.Dnf)
{
return "dnf -y install " + soft;
return "dnf install -y " + soft;
}
else if (CmdType == CmdType.Yum)
{
return "yum -y install " + soft;
return "yum install -y " + soft;
}
throw new Exception("未识别的系统");

View File

@ -51,5 +51,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: AssemblyVersion("4.0.2.0")]
[assembly: AssemblyFileVersion("4.0.2.0")]

View File

@ -0,0 +1,20 @@
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target