caldav-adapter 9.3.7 → 9.3.9
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
|
@@ -511,6 +511,71 @@ module.exports = function (options) {
|
|
|
511
511
|
},
|
|
512
512
|
'notification-URL': {
|
|
513
513
|
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-notifications.txt'
|
|
514
|
+
},
|
|
515
|
+
'push-transports': {
|
|
516
|
+
// https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-pubsubdiscovery.txt
|
|
517
|
+
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-pubsubdiscovery.txt',
|
|
518
|
+
async resp({ resource, calendar, ctx }) {
|
|
519
|
+
if (resource !== 'principal' && resource !== 'calendar') return;
|
|
520
|
+
if (typeof options.pushTopicProvider !== 'function') return;
|
|
521
|
+
let topic;
|
|
522
|
+
try {
|
|
523
|
+
topic = await options.pushTopicProvider({
|
|
524
|
+
resource,
|
|
525
|
+
calendar,
|
|
526
|
+
ctx
|
|
527
|
+
});
|
|
528
|
+
} catch (err) {
|
|
529
|
+
log.warn('pushTopicProvider threw', err);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (!topic) return;
|
|
534
|
+
const subscriptionURL =
|
|
535
|
+
(typeof options.pushSubscriptionURL === 'string' &&
|
|
536
|
+
options.pushSubscriptionURL) ||
|
|
537
|
+
'/apns';
|
|
538
|
+
const pushEnv =
|
|
539
|
+
(typeof options.pushEnv === 'string' && options.pushEnv) ||
|
|
540
|
+
'PRODUCTION';
|
|
541
|
+
const refreshInterval =
|
|
542
|
+
(typeof options.pushRefreshInterval === 'string' &&
|
|
543
|
+
options.pushRefreshInterval) ||
|
|
544
|
+
'3600';
|
|
545
|
+
return {
|
|
546
|
+
[buildTag(cs, 'push-transports')]: {
|
|
547
|
+
[buildTag(cs, 'transport')]: {
|
|
548
|
+
'@type': 'APSD',
|
|
549
|
+
[buildTag(cs, 'subscription-url')]: {
|
|
550
|
+
[buildTag(dav, 'href')]: subscriptionURL
|
|
551
|
+
},
|
|
552
|
+
[buildTag(cs, 'apsbundleid')]: topic,
|
|
553
|
+
[buildTag(cs, 'env')]: pushEnv,
|
|
554
|
+
[buildTag(cs, 'refresh-interval')]: refreshInterval
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
pushkey: {
|
|
561
|
+
// https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-pubsubdiscovery.txt
|
|
562
|
+
doc: 'https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-pubsubdiscovery.txt',
|
|
563
|
+
async resp({ resource, calendar }) {
|
|
564
|
+
if (resource !== 'calendar' || !calendar) return;
|
|
565
|
+
if (typeof options.pushTopicProvider !== 'function') return;
|
|
566
|
+
// pushkey is the opaque per-collection identifier iOS sends back
|
|
567
|
+
// in /apns POST so we can map device_token -> calendar.
|
|
568
|
+
const key =
|
|
569
|
+
calendar.calendarId ||
|
|
570
|
+
(calendar._id &&
|
|
571
|
+
calendar._id.toString &&
|
|
572
|
+
calendar._id.toString()) ||
|
|
573
|
+
'';
|
|
574
|
+
if (!key) return;
|
|
575
|
+
return {
|
|
576
|
+
[buildTag(cs, 'pushkey')]: key
|
|
577
|
+
};
|
|
578
|
+
}
|
|
514
579
|
}
|
|
515
580
|
},
|
|
516
581
|
[ical]: {
|
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": "9.3.
|
|
4
|
+
"version": "9.3.9",
|
|
5
5
|
"author": "Sanders DeNardi and Forward Email LLC",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
|
|
@@ -93,7 +93,7 @@ module.exports = function (options) {
|
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
if (!calendar && method !== 'mkcalendar') {
|
|
96
|
+
if (!calendar && method !== 'mkcalendar' && method !== 'put') {
|
|
97
97
|
log.warn(`calendar not found: ${calendarId}`);
|
|
98
98
|
setMissingMethod(ctx);
|
|
99
99
|
ctx.body = notFound(ctx.url);
|