mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
chore: 1
This commit is contained in:
@@ -155,6 +155,8 @@ export class GoEdgeAccess extends BaseAccess {
|
|||||||
|
|
||||||
async doCertReplace(req: { certId: number, cert: CertInfo }) {
|
async doCertReplace(req: { certId: number, cert: CertInfo }) {
|
||||||
|
|
||||||
|
let sslCert:any = {}
|
||||||
|
try {
|
||||||
const res = await this.doRequest({
|
const res = await this.doRequest({
|
||||||
url: `/SSLCertService/findEnabledSSLCertConfig`,
|
url: `/SSLCertService/findEnabledSSLCertConfig`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -163,7 +165,10 @@ export class GoEdgeAccess extends BaseAccess {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const sslCertJSON = this.ctx.utils.hash.base64Decode(res.sslCertJSON) || "{}";
|
const sslCertJSON = this.ctx.utils.hash.base64Decode(res.sslCertJSON) || "{}";
|
||||||
const sslCert = JSON.parse(sslCertJSON) ;
|
sslCert = JSON.parse(sslCertJSON);
|
||||||
|
} catch (error) {
|
||||||
|
this.ctx.logger.error("获取原来的证书详情失败", error);
|
||||||
|
}
|
||||||
|
|
||||||
const certReader = new CertReader(req.cert);
|
const certReader = new CertReader(req.cert);
|
||||||
const dnsNames = certReader.getAllDomains()
|
const dnsNames = certReader.getAllDomains()
|
||||||
@@ -176,7 +181,7 @@ export class GoEdgeAccess extends BaseAccess {
|
|||||||
sslCertId: req.certId,
|
sslCertId: req.certId,
|
||||||
certData: this.ctx.utils.hash.base64(req.cert.crt),
|
certData: this.ctx.utils.hash.base64(req.cert.crt),
|
||||||
keyData: this.ctx.utils.hash.base64(req.cert.key),
|
keyData: this.ctx.utils.hash.base64(req.cert.key),
|
||||||
isOn: sslCert.isOn,
|
isOn: sslCert.isOn ?? true,
|
||||||
name: sslCert.name || certReader.buildCertName(),
|
name: sslCert.name || certReader.buildCertName(),
|
||||||
description: sslCert.description || "upload by certd",
|
description: sslCert.description || "upload by certd",
|
||||||
serverName: sslCert.serverName,
|
serverName: sslCert.serverName,
|
||||||
|
|||||||
Reference in New Issue
Block a user