mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 12:40:25 +08:00
feat: 证书支持关闭自动续签
This commit is contained in:
@@ -119,6 +119,9 @@ func (r *certRepo) Update(req *request.CertUpdate) error {
|
||||
if err == nil && req.Type == "upload" {
|
||||
req.Domains = info.DNSNames
|
||||
}
|
||||
if req.Type == "upload" && req.AutoRenew {
|
||||
return errors.New("upload certificate cannot be set to auto renew")
|
||||
}
|
||||
|
||||
return r.db.Model(&biz.Cert{}).Where("id = ?", req.ID).Select("*").Updates(&biz.Cert{
|
||||
ID: req.ID,
|
||||
|
||||
@@ -117,18 +117,9 @@ const columns: any = [
|
||||
ellipsis: { tooltip: true },
|
||||
render(row: any) {
|
||||
if (row.account_id == 0) {
|
||||
return h(NTag, null, { default: () => '无' })
|
||||
return '无'
|
||||
}
|
||||
return h(NFlex, null, {
|
||||
default: () => [
|
||||
h(NTag, null, {
|
||||
default: () =>
|
||||
row.account_id == 0
|
||||
? '无'
|
||||
: accounts.value?.find((item: any) => item.value === row.account_id)?.label
|
||||
})
|
||||
]
|
||||
})
|
||||
return accounts.value?.find((item: any) => item.value === row.account_id)?.label
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -178,8 +169,8 @@ const columns: any = [
|
||||
return h(NSwitch, {
|
||||
size: 'small',
|
||||
rubberBand: false,
|
||||
value: row.auto_renew
|
||||
//onUpdateValue: () => handleAutoRenewUpdate(row)
|
||||
value: row.auto_renew,
|
||||
onUpdateValue: () => handleAutoRenewUpdate(row)
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -338,7 +329,7 @@ const { loading, data, page, total, pageSize, pageCount, refresh } = usePaginati
|
||||
}
|
||||
)
|
||||
|
||||
const handleUpdateCert = async () => {
|
||||
const handleUpdateCert = () => {
|
||||
useRequest(cert.certUpdate(updateCert.value, updateModel.value)).onSuccess(() => {
|
||||
refresh()
|
||||
updateModal.value = false
|
||||
@@ -354,6 +345,32 @@ const handleUpdateCert = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
const handleAutoRenewUpdate = (row: any) => {
|
||||
updateModel.value.domains = row.domains
|
||||
updateModel.value.type = row.type
|
||||
updateModel.value.dns_id = row.dns_id == 0 ? null : row.dns_id
|
||||
updateModel.value.account_id = row.account_id == 0 ? null : row.account_id
|
||||
updateModel.value.website_id = row.website_id == 0 ? null : row.website_id
|
||||
updateModel.value.auto_renew = !row.auto_renew
|
||||
updateModel.value.cert = row.cert
|
||||
updateModel.value.key = row.key
|
||||
useRequest(cert.certUpdate(row.id, updateModel.value))
|
||||
.onSuccess(() => {
|
||||
refresh()
|
||||
window.$message.success('更新成功')
|
||||
})
|
||||
.onComplete(() => {
|
||||
updateModel.value.domains = []
|
||||
updateModel.value.type = 'P256'
|
||||
updateModel.value.dns_id = null
|
||||
updateModel.value.account_id = null
|
||||
updateModel.value.website_id = null
|
||||
updateModel.value.auto_renew = true
|
||||
updateModel.value.cert = ''
|
||||
updateModel.value.key = ''
|
||||
})
|
||||
}
|
||||
|
||||
const handleDeployCert = async () => {
|
||||
const promises = deployModel.value.websites.map((website: any) =>
|
||||
useRequest(cert.deploy(deployModel.value.id, website)).onSuccess(() => {
|
||||
|
||||
Reference in New Issue
Block a user