超时设置文件名优化
This commit is contained in:
@@ -184,7 +184,8 @@ class AcmeService:
|
|||||||
# 写入临时凭据文件(certbot-dns-alicloud 需要 INI 格式)
|
# 写入临时凭据文件(certbot-dns-alicloud 需要 INI 格式)
|
||||||
creds_content = (
|
creds_content = (
|
||||||
f"dns_alicloud_access_key = {creds.get('access_key', '')}\n"
|
f"dns_alicloud_access_key = {creds.get('access_key', '')}\n"
|
||||||
f"dns_alicloud_access_key_secret = {creds.get('access_secret', '')}\n"
|
f"dns_alicloud_secret_key = {creds.get('access_secret', '')}\n"
|
||||||
|
f"dns_alicloud_region = {creds.get('region', 'cn-hangzhou')}\n"
|
||||||
)
|
)
|
||||||
creds_file = tempfile.NamedTemporaryFile(
|
creds_file = tempfile.NamedTemporaryFile(
|
||||||
mode="w", suffix=".ini", prefix="certbot-dns-", delete=False
|
mode="w", suffix=".ini", prefix="certbot-dns-", delete=False
|
||||||
@@ -192,8 +193,14 @@ class AcmeService:
|
|||||||
creds_file.write(creds_content)
|
creds_file.write(creds_content)
|
||||||
creds_file.close()
|
creds_file.close()
|
||||||
|
|
||||||
|
# 用当前 Python 环境对应的 certbot,避免调到系统装的
|
||||||
|
import sys
|
||||||
|
certbot_bin = str(Path(sys.prefix) / "bin" / "certbot")
|
||||||
|
if not Path(certbot_bin).exists():
|
||||||
|
certbot_bin = "certbot" # fallback
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"certbot", "certonly",
|
certbot_bin, "certonly",
|
||||||
"--non-interactive",
|
"--non-interactive",
|
||||||
"--agree-tos",
|
"--agree-tos",
|
||||||
"--email", self.config.email,
|
"--email", self.config.email,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import axios from 'axios'
|
|||||||
|
|
||||||
const api = axios.create({
|
const api = axios.create({
|
||||||
baseURL: '/admin/api',
|
baseURL: '/admin/api',
|
||||||
timeout: 10000,
|
timeout: 180000,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 请求拦截器:自动添加 token
|
// 请求拦截器:自动添加 token
|
||||||
|
|||||||
@@ -111,11 +111,13 @@ const handleDelete = async (d) => {
|
|||||||
const copyDeployCmd = async (d) => {
|
const copyDeployCmd = async (d) => {
|
||||||
// 根据服务器平台生成不同的部署命令
|
// 根据服务器平台生成不同的部署命令
|
||||||
const baseUrl = window.location.origin
|
const baseUrl = window.location.origin
|
||||||
|
const safeName = d.domain.replace(/^\*\./, '') // 泛域名去掉 *.
|
||||||
|
const encodedDomain = encodeURIComponent(d.domain)
|
||||||
let cmd
|
let cmd
|
||||||
if (d.platform === 'windows') {
|
if (d.platform === 'windows') {
|
||||||
cmd = `Invoke-WebRequest "${baseUrl}/api/script/${d.domain}?server=${d.server_name}" -OutFile C:\\scripts\\deploy-cert.ps1`
|
cmd = `Invoke-WebRequest "${baseUrl}/api/script/${encodedDomain}?server=${d.server_name}" -OutFile C:\\scripts\\deploy-cert-${safeName}.ps1`
|
||||||
} else {
|
} else {
|
||||||
cmd = `curl -fsSL "${baseUrl}/api/script/${d.domain}?server=${d.server_name}" -o /usr/local/bin/deploy-cert.sh && chmod +x /usr/local/bin/deploy-cert.sh`
|
cmd = `curl -fsSL "${baseUrl}/api/script/${encodedDomain}?server=${d.server_name}" -o /usr/local/bin/deploy-cert-${safeName}.sh && chmod +x /usr/local/bin/deploy-cert-${safeName}.sh`
|
||||||
}
|
}
|
||||||
await navigator.clipboard.writeText(cmd)
|
await navigator.clipboard.writeText(cmd)
|
||||||
showCopied.value = true
|
showCopied.value = true
|
||||||
|
|||||||
Reference in New Issue
Block a user