mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-11-10 17:47:07 +08:00
make sure that fingerprint is shown in acme respose
This commit is contained in:
parent
4ee6f98ed1
commit
dfe694161b
2 changed files with 10 additions and 9 deletions
|
@ -329,12 +329,12 @@ module.exports = (db, server) => {
|
|||
);
|
||||
|
||||
server.get(
|
||||
'/certs/:certs',
|
||||
'/certs/:cert',
|
||||
tools.asyncifyJson(async (req, res, next) => {
|
||||
res.charSet('utf-8');
|
||||
|
||||
const schema = Joi.object().keys({
|
||||
certs: Joi.string().hex().lowercase().length(24).required(),
|
||||
cert: Joi.string().hex().lowercase().length(24).required(),
|
||||
sess: sessSchema,
|
||||
ip: sessIPSchema
|
||||
});
|
||||
|
@ -357,11 +357,11 @@ module.exports = (db, server) => {
|
|||
// permissions check
|
||||
req.validate(roles.can(req.role).readAny('certs'));
|
||||
|
||||
let certs = new ObjectId(result.value.certs);
|
||||
let cert = new ObjectId(result.value.certs);
|
||||
|
||||
let response;
|
||||
try {
|
||||
response = await certHandler.get({ _id: certs }, false);
|
||||
response = await certHandler.get({ _id: cert }, false);
|
||||
} catch (err) {
|
||||
switch (err.code) {
|
||||
case 'InputValidationError':
|
||||
|
|
|
@ -377,14 +377,14 @@ class CertHandler {
|
|||
ev: CERT_CREATED,
|
||||
cert: r.value._id.toString(),
|
||||
servername,
|
||||
fingerprint: certData.fingerprint
|
||||
fingerprint: certData.fingerprint || certData.fp
|
||||
});
|
||||
} else if (r.lastErrorObject.updatedExisting) {
|
||||
await publish(this.redis, {
|
||||
ev: CERT_UPDATED,
|
||||
cert: r.value._id.toString(),
|
||||
servername,
|
||||
fingerprint: certData.fingerprint
|
||||
fingerprint: certData.fingerprint || certData.fp
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -396,7 +396,7 @@ class CertHandler {
|
|||
id: r.value._id.toString(),
|
||||
servername,
|
||||
description: certData.description,
|
||||
fingerprint: certData.fingerprint,
|
||||
fingerprint: certData.fingerprint || certData.fp,
|
||||
expires: certData.expires && certData.expires.toISOString(),
|
||||
altNames: certData.altNames,
|
||||
acme: certData.acme
|
||||
|
@ -410,10 +410,11 @@ class CertHandler {
|
|||
id: certData._id.toString(),
|
||||
servername: certData.servername,
|
||||
description: certData.description,
|
||||
fingerprint: certData.fingerprint,
|
||||
fingerprint: certData.fingerprint || certData.fp,
|
||||
expires: certData.expires,
|
||||
altNames: certData.altNames,
|
||||
acme: !!certData.acme,
|
||||
hasCert: (!!certData.privateKe && certData.cert) || false,
|
||||
created: certData.created
|
||||
};
|
||||
|
||||
|
@ -477,7 +478,7 @@ class CertHandler {
|
|||
ev: CERT_DELETED,
|
||||
cert: r.value._id,
|
||||
servername: r.value.servername,
|
||||
fingerprint: r.value.fingerprint
|
||||
fingerprint: r.value.fingerprint || r.value.fp
|
||||
});
|
||||
} catch (err) {
|
||||
// ignore?
|
||||
|
|
Loading…
Reference in a new issue