caldav-adapter 7.1.0 → 7.2.0
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/package.json +1 -1
- package/routes/calendar/calendar.js +19 -6
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": "7.
|
|
4
|
+
"version": "7.2.0",
|
|
5
5
|
"author": "Sanders DeNardi and Forward Email LLC",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Sanders DeNardi <sedenardi@gmail.com> (http://www.sandersdenardi.com/)",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { notFound } = require('../../common/x-build');
|
|
2
2
|
const { setMultistatusResponse, setOptions } = require('../../common/response');
|
|
3
3
|
const winston = require('../../common/winston');
|
|
4
|
+
const routeMkCalendar = require('../principal/mkcalendar');
|
|
4
5
|
const routerUserPropfind = require('./user/propfind');
|
|
5
6
|
// const routerUserProppatch = require('./user/proppatch');
|
|
6
7
|
const routerCalPropfind = require('./calendar/propfind');
|
|
@@ -22,7 +23,8 @@ module.exports = function (options) {
|
|
|
22
23
|
get: routerCalGet(options),
|
|
23
24
|
// proppatch: routerCalProppatch(opts),
|
|
24
25
|
put: routerCalPut(options),
|
|
25
|
-
delete: routerCalDelete(options)
|
|
26
|
+
delete: routerCalDelete(options),
|
|
27
|
+
mkcalendar: routeMkCalendar(options)
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
return async function (ctx) {
|
|
@@ -46,7 +48,7 @@ module.exports = function (options) {
|
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
if (!calendar) {
|
|
51
|
+
if (!calendar && method !== 'mkcalendar') {
|
|
50
52
|
log.warn(`calendar not found: ${calendarId}`);
|
|
51
53
|
ctx.body = notFound(ctx.url);
|
|
52
54
|
return;
|
|
@@ -58,9 +60,13 @@ module.exports = function (options) {
|
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
if (typeof calMethods[method].exec === 'function') {
|
|
64
|
+
ctx.body = await calMethods[method].exec(ctx, calendar);
|
|
65
|
+
} else if (typeof calMethods[method] === 'function') {
|
|
66
|
+
ctx.body = await calMethods[method](ctx, calendar);
|
|
67
|
+
} else {
|
|
68
|
+
log.warn(`method handler not found: ${method}`);
|
|
69
|
+
ctx.body = notFound(ctx.url);
|
|
64
70
|
}
|
|
65
71
|
} else {
|
|
66
72
|
if (method === 'options') {
|
|
@@ -74,7 +80,14 @@ module.exports = function (options) {
|
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
|
|
83
|
+
if (typeof userMethods[method].exec === 'function') {
|
|
84
|
+
ctx.body = await userMethods[method].exec(ctx);
|
|
85
|
+
} else if (typeof userMethods[method] === 'function') {
|
|
86
|
+
ctx.body = await userMethods[method](ctx);
|
|
87
|
+
} else {
|
|
88
|
+
log.warn(`method handler not found: ${method}`);
|
|
89
|
+
ctx.body = notFound(ctx.url);
|
|
90
|
+
}
|
|
78
91
|
}
|
|
79
92
|
};
|
|
80
93
|
};
|