Skip to content

Commit 14d2351

Browse files
committed
v1.37.0
1 parent 6fd546a commit 14d2351

9 files changed

+428
-15
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
},
88
"extends": ["nodemailer", "prettier"],
99
"parserOptions": {
10-
"ecmaVersion": 2018
10+
"ecmaVersion": 2020
1111
}
1212
}

docs/api/openapi.yml

+13
Original file line numberDiff line numberDiff line change
@@ -4831,6 +4831,19 @@ components:
48314831
description: Attachments for the message
48324832
verificationResults:
48334833
$ref: '#/components/schemas/VerificationResults'
4834+
bimi:
4835+
type: object
4836+
description: BIMI logo info. If logo validation failed in any way, then this property is not set
4837+
properties:
4838+
certified:
4839+
type: boolean
4840+
description: If true, then this logo is from a VMC file
4841+
url:
4842+
type: string
4843+
description: URL of the resource the logo was retrieved from
4844+
image:
4845+
type: string
4846+
description: Data URL for the SVG image
48344847
contentType:
48354848
$ref: '#/components/schemas/ContentType'
48364849
metaData:

indexes.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,14 @@ indexes:
698698
key:
699699
metadata.subject: 1
700700

701+
- collection: bimi
702+
index:
703+
name: by_type
704+
unique: true
705+
key:
706+
type: 1
707+
url: 1
708+
701709
- collection: webhooks
702710
index:
703711
name: by_type

lib/api/messages.js

+17
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,23 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
939939
}
940940

941941
if (messageData.verificationResults) {
942+
if (messageData.verificationResults.bimi) {
943+
try {
944+
let bimiData = await db.database.collection('bimi').findOne({ _id: messageData.verificationResults.bimi });
945+
if (bimiData?.content && !bimiData?.error) {
946+
response.bimi = {
947+
certified: bimiData.type === 'authority',
948+
url: bimiData.url,
949+
image: `data:image/svg+xml;base64,${bimiData.content.toString('base64')}`
950+
};
951+
}
952+
} catch (err) {
953+
log.error('BIMI', 'message=%s error=%s', messageData._id, err.message);
954+
}
955+
956+
delete messageData.verificationResults.bimi;
957+
}
958+
942959
response.verificationResults = messageData.verificationResults;
943960
}
944961

0 commit comments

Comments
 (0)