2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 13:47:15 +08:00

feat: 更准确的证书续签判断

This commit is contained in:
2025-03-30 04:19:30 +08:00
parent aff68bd1c1
commit 04ef3ce442
3 changed files with 8 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ func (r *certRepo) List(page, limit uint) ([]*types.CertList, int64, error) {
AutoRenew: cert.AutoRenew,
Cert: cert.Cert,
Key: cert.Key,
CertURL: cert.CertURL,
Script: cert.Script,
CreatedAt: cert.CreatedAt,
UpdatedAt: cert.UpdatedAt,
@@ -290,7 +291,11 @@ func (r *certRepo) Renew(id uint) (*acme.Certificate, error) {
ssl, err := client.RenewCertificate(context.Background(), cert.CertURL, cert.Domains, acme.KeyType(cert.Type))
if err != nil {
return nil, err
// 续签失败,尝试重签
ssl, err = client.ObtainCertificate(context.Background(), cert.Domains, acme.KeyType(cert.Type))
if err != nil {
return nil, err
}
}
cert.CertURL = ssl.URL

View File

@@ -12,6 +12,7 @@ type CertList struct {
AutoRenew bool `json:"auto_renew"`
Cert string `json:"cert"`
Key string `json:"key"`
CertURL string `json:"cert_url"`
Script string `json:"script"`
NotBefore time.Time `json:"not_before"`
NotAfter time.Time `json:"not_after"`

View File

@@ -219,7 +219,7 @@ const columns: any = [
}
)
: null,
row.cert != '' && row.key != '' && row.type != 'upload'
row.cert_url != '' && row.type != 'upload'
? h(
NButton,
{