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

feat: 新增证书到期时间显示,close #836

This commit is contained in:
2025-07-07 17:18:35 +08:00
parent 135c5c844f
commit 5fa4219a31
3 changed files with 44 additions and 1 deletions

View File

@@ -223,6 +223,15 @@ func (r *websiteRepo) List(page, limit uint) ([]*biz.Website, int64, error) {
return nil, 0, err
}
// 取证书剩余有效时间
for _, website := range websites {
crt, _ := io.Read(filepath.Join(app.Root, "server/vhost/cert", website.Name+".pem"))
if decode, err := cert.ParseCert(crt); err == nil {
hours := decode.NotAfter.Sub(time.Now()).Hours()
website.CertExpire = fmt.Sprintf("%.2f", hours/24)
}
}
return websites, total, nil
}