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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user