修复列宽度/不显示过期时间的问题

This commit is contained in:
2026-07-20 10:47:08 +08:00
parent 1d8fe97a49
commit 6d9013e9fd
4 changed files with 40 additions and 13 deletions
+18
View File
@@ -267,6 +267,19 @@ class AcmeService:
cert_info = {} cert_info = {}
if success: if success:
cert_path = domain_dir / "fullchain.pem" cert_path = domain_dir / "fullchain.pem"
logger.info(f"证书路径: {cert_path}, 存在: {cert_path.exists()}")
# 如果自定义路径没有,尝试从 certbot live 目录复制
if not cert_path.exists():
import shutil
certbot_live = self.cert_dir / ".certbot-config" / "live" / store_dir
src = certbot_live / "fullchain.pem"
logger.info(f"尝试从 certbot live 复制: {src}, 存在: {src.exists()}")
if src.exists():
shutil.copy2(str(src), str(cert_path))
key_src = certbot_live / "privkey.pem"
if key_src.exists():
shutil.copy2(str(key_src), str(domain_dir / "private.key"))
if cert_path.exists(): if cert_path.exists():
try: try:
cert_data = cert_path.read_bytes() cert_data = cert_path.read_bytes()
@@ -287,9 +300,14 @@ class AcmeService:
"issuer": cert.issuer.rfc4514_string(), "issuer": cert.issuer.rfc4514_string(),
} }
msg = f"签发成功,过期时间: {not_after.strftime('%Y-%m-%d %H:%M:%S')}, SAN: {san}" msg = f"签发成功,过期时间: {not_after.strftime('%Y-%m-%d %H:%M:%S')}, SAN: {san}"
logger.info(msg)
return True, msg, cert_info, output return True, msg, cert_info, output
except Exception as e: except Exception as e:
logger.error(f"解析证书失败: {e}")
return True, f"签发成功但解析证书失败: {e}", cert_info, output return True, f"签发成功但解析证书失败: {e}", cert_info, output
else:
logger.error(f"证书文件不存在: {cert_path}")
return True, f"certbot 成功但未找到证书文件: {cert_path}", cert_info, output
return success, output, cert_info, output return success, output, cert_info, output
+4 -4
View File
@@ -7,17 +7,17 @@
<el-card> <el-card>
<el-table :data="configs" stripe style="width: 100%;"> <el-table :data="configs" stripe style="width: 100%;">
<el-table-column prop="name" label="名称" width="160"> <el-table-column prop="name" label="名称" min-width="140">
<template #default="{ row }"> <template #default="{ row }">
<span style="font-weight: 600;">{{ row.name }}</span> <span style="font-weight: 600;">{{ row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="acme_server" label="ACME 服务器" width="200"> <el-table-column prop="acme_server" label="ACME 服务器" min-width="160">
<template #default="{ row }"> <template #default="{ row }">
{{ row.acme_server.includes('staging') ? '测试' : '生产' }} {{ row.acme_server.includes('staging') ? '测试' : '生产' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="email" label="邮箱" width="180" /> <el-table-column prop="email" label="邮箱" min-width="160" />
<el-table-column prop="dns_provider" label="DNS 提商" width="120"> <el-table-column prop="dns_provider" label="DNS 提商" width="120">
<template #default="{ row }"> <template #default="{ row }">
<el-tag size="small">{{ row.dns_provider === 'aliyun' ? '阿里云' : row.dns_provider }}</el-tag> <el-tag size="small">{{ row.dns_provider === 'aliyun' ? '阿里云' : row.dns_provider }}</el-tag>
@@ -27,7 +27,7 @@
<el-table-column label="关联域名" width="100"> <el-table-column label="关联域名" width="100">
<template #default="{ row }">{{ row.domain_count }}</template> <template #default="{ row }">{{ row.domain_count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200" align="right"> <el-table-column label="操作" min-width="180" align="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button> <el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button>
<el-button type="warning" link size="small" :loading="renewingId === row.id" @click="autoRenew(row)">续签</el-button> <el-button type="warning" link size="small" :loading="renewingId === row.id" @click="autoRenew(row)">续签</el-button>
+14 -5
View File
@@ -7,7 +7,7 @@
<el-card> <el-card>
<el-table :data="domains" stripe style="width: 100%;"> <el-table :data="domains" stripe style="width: 100%;">
<el-table-column prop="domain" label="域名" width="240"> <el-table-column prop="domain" label="域名" min-width="180">
<template #default="{ row }"> <template #default="{ row }">
<span style="font-weight: 600;">{{ row.domain }}</span> <span style="font-weight: 600;">{{ row.domain }}</span>
</template> </template>
@@ -31,17 +31,17 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="过期时间" width="170"> <el-table-column label="过期时间" width="150">
<template #default="{ row }"> <template #default="{ row }">
<span :style="{ color: isExpiringSoon(row.expiry_date) ? '#f56c6c' : '#606266' }"> <span :style="{ color: isExpiringSoon(row.cert_not_after) ? '#f56c6c' : '#606266' }">
{{ row.expiry_date || '-' }} {{ row.cert_not_after ? formatDate(row.cert_not_after) : '-' }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="版本" width="70"> <el-table-column label="版本" width="70">
<template #default="{ row }">{{ row.version }}</template> <template #default="{ row }">{{ row.version }}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="300" align="right"> <el-table-column label="操作" min-width="280" align="right">
<template #default="{ row }"> <template #default="{ row }">
<div style="display: flex; align-items: center; gap: 4px; justify-content: flex-end;"> <div style="display: flex; align-items: center; gap: 4px; justify-content: flex-end;">
<el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button> <el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button>
@@ -201,6 +201,15 @@ const isExpiringSoon = (dateStr) => {
return diff < 30 return diff < 30
} }
const formatDate = (dateStr) => {
if (!dateStr) return '-'
const d = new Date(dateStr)
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
}
// ---- 域名表单 ---- // ---- 域名表单 ----
const openCreate = () => { const openCreate = () => {
isEdit.value = false isEdit.value = false
+4 -4
View File
@@ -7,7 +7,7 @@
<el-card> <el-card>
<el-table :data="servers" stripe style="width: 100%;"> <el-table :data="servers" stripe style="width: 100%;">
<el-table-column prop="name" label="名称" width="160"> <el-table-column prop="name" label="名称" min-width="140">
<template #default="{ row }"> <template #default="{ row }">
<span style="font-weight: 600;">{{ row.name }}</span> <span style="font-weight: 600;">{{ row.name }}</span>
</template> </template>
@@ -17,16 +17,16 @@
<el-tag :type="row.platform === 'linux' ? 'warning' : ''" size="small">{{ row.platform }}</el-tag> <el-tag :type="row.platform === 'linux' ? 'warning' : ''" size="small">{{ row.platform }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="ip" label="IP" width="140"> <el-table-column prop="ip" label="IP" min-width="140">
<template #default="{ row }">{{ row.ip || '-' }}</template> <template #default="{ row }">{{ row.ip || '-' }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="domain_count" label="域名数" width="80" /> <el-table-column prop="domain_count" label="域名数" width="80" />
<el-table-column label="Token" width="180"> <el-table-column label="Token" min-width="180">
<template #default="{ row }"> <template #default="{ row }">
<code style="background: #f5f7fa; padding: 2px 8px; border-radius: 4px; font-size: 12px;">{{ row.token.substring(0, 12) }}...</code> <code style="background: #f5f7fa; padding: 2px 8px; border-radius: 4px; font-size: 12px;">{{ row.token.substring(0, 12) }}...</code>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150" align="right"> <el-table-column label="操作" min-width="140" align="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button> <el-button type="primary" link size="small" @click="openEdit(row)">编辑</el-button>
<el-button type="danger" link size="small" @click="handleDelete(row)">删除</el-button> <el-button type="danger" link size="small" @click="handleDelete(row)">删除</el-button>