caldav-adapter 6.1.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/common/tags.js CHANGED
@@ -1,3 +1,4 @@
1
+ const { isEmail } = require('validator');
1
2
  const { buildTag, href, response, status } = require('./x-build');
2
3
  const winston = require('./winston');
3
4
 
@@ -255,7 +256,24 @@ module.exports = function (options) {
255
256
  }
256
257
  },
257
258
  'calendar-user-address-set': {
258
- doc: 'https://tools.ietf.org/html/rfc6638#section-2.4.1'
259
+ doc: 'https://tools.ietf.org/html/rfc6638#section-2.4.1',
260
+ async resp({ ctx }) {
261
+ if (isEmail(ctx.state.user.principalName))
262
+ return {
263
+ [buildTag(cal, 'calendar-user-address-set')]: href(
264
+ `mailto:${ctx.state.user.principalName}`
265
+ )
266
+ };
267
+ if (isEmail(ctx.state.user.email))
268
+ return {
269
+ [buildTag(cal, 'calendar-user-address-set')]: href(
270
+ `mailto:${ctx.state.user.email}`
271
+ )
272
+ };
273
+ return {
274
+ [buildTag(cal, 'calendar-user-address-set')]: ''
275
+ };
276
+ }
259
277
  },
260
278
  'default-alarm-vevent-date': {
261
279
  doc: 'https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "caldav-adapter",
3
3
  "description": "CalDAV server for Node.js and Koa. Modernized and maintained for Forward Email.",
4
- "version": "6.1.0",
4
+ "version": "7.0.1",
5
5
  "author": "Sanders DeNardi and Forward Email LLC",
6
6
  "contributors": [
7
7
  "Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
@@ -14,6 +14,7 @@
14
14
  "moment": "^2.30.1",
15
15
  "path-to-regexp": "^6.2.1",
16
16
  "raw-body": "^2.5.2",
17
+ "validator": "^13.12.0",
17
18
  "winston": "^3.11.0",
18
19
  "xmlbuilder2": "^3.1.1",
19
20
  "xpath": "0.0.34"
@@ -1,4 +1,5 @@
1
- const { notFound, preconditionFail } = require('../../../common/x-build');
1
+ const { notFound } = require('../../../common/x-build');
2
+ // const { notFound, preconditionFail } = require('../../../common/x-build');
2
3
  const { setMissingMethod } = require('../../../common/response');
3
4
  const winston = require('../../../common/winston');
4
5
 
@@ -46,12 +47,14 @@ module.exports = function (options) {
46
47
  log.debug(`existing event${existing ? '' : ' not'} found`);
47
48
 
48
49
  if (existing) {
50
+ /*
49
51
  if (ctx.get('if-none-match') === '*') {
50
52
  log.warn('if-none-match: * header present, precondition failed');
51
53
  ctx.status = 412;
52
54
  ctx.body = preconditionFail(ctx.url, 'no-uid-conflict');
53
55
  return;
54
56
  }
57
+ */
55
58
 
56
59
  const updateObject = await options.data.updateEvent(ctx, {
57
60
  eventId: ctx.state.params.eventId,