Skip to content

Commit

Permalink
feat: added support for calendar-user-address-set
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jul 17, 2024
1 parent a5071dc commit 289a955
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion common/tags.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { isEmail } = require('validator');
const { buildTag, href, response, status } = require('./x-build');
const winston = require('./winston');

Expand Down Expand Up @@ -255,7 +256,24 @@ module.exports = function (options) {
}
},
'calendar-user-address-set': {
doc: 'https://tools.ietf.org/html/rfc6638#section-2.4.1'
doc: 'https://tools.ietf.org/html/rfc6638#section-2.4.1',
async resp({ ctx }) {
if (isEmail(ctx.state.user.principalName))
return {
[buildTag(cal, 'calendar-user-address-set')]: href(
`mailto:${ctx.state.user.principalName}`
)
};
if (isEmail(ctx.state.user.email))
return {
[buildTag(cal, 'calendar-user-address-set')]: href(
`mailto:${ctx.state.user.email}`
)
};
return {
[buildTag(cal, 'calendar-user-address-set')]: ''
};
}
},
'default-alarm-vevent-date': {
doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"moment": "^2.30.1",
"path-to-regexp": "^6.2.1",
"raw-body": "^2.5.2",
"validator": "^13.12.0",
"winston": "^3.11.0",
"xmlbuilder2": "^3.1.1",
"xpath": "0.0.34"
Expand Down

0 comments on commit 289a955

Please sign in to comment.