超时设置文件名优化

This commit is contained in:
2026-07-18 20:42:26 +08:00
parent 521ad3b635
commit 1fd21ae128
3 changed files with 14 additions and 5 deletions
+9 -2
View File
@@ -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,
+1 -1
View File
@@ -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
+4 -2
View File
@@ -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