caldav-adapter 7.0.6 → 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/.github/workflows/ci.yml
CHANGED
|
@@ -13,9 +13,9 @@ jobs:
|
|
|
13
13
|
- 18
|
|
14
14
|
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
17
|
- name: Setup node
|
|
18
|
-
uses: actions/setup-node@
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
19
|
with:
|
|
20
20
|
node-version: ${{ matrix.node_version }}
|
|
21
21
|
- name: Install dependencies
|
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.0
|
|
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,38 +1,34 @@
|
|
|
1
|
-
const { notFound } = require('../../../common/x-build');
|
|
2
1
|
const { setMissingMethod } = require('../../../common/response');
|
|
3
|
-
const winston = require('../../../common/winston');
|
|
4
2
|
|
|
5
3
|
/* https://tools.ietf.org/html/rfc2518#section-8.6 */
|
|
6
4
|
module.exports = function (options) {
|
|
7
|
-
const log = winston({ ...options, label: 'calendar/delete' });
|
|
8
5
|
const exec = async function (ctx, calendar) {
|
|
9
6
|
if (calendar.readonly) {
|
|
10
7
|
setMissingMethod(ctx);
|
|
11
8
|
return;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
//
|
|
12
|
+
// if event id not specified this indicates we're deleting
|
|
13
|
+
// an entire calendar so we need to delete all events for it as well in this logic
|
|
14
|
+
//
|
|
15
|
+
if (ctx.state.params.eventId) {
|
|
16
|
+
await options.data.deleteEvent(ctx, {
|
|
17
|
+
eventId: ctx.state.params.eventId,
|
|
18
|
+
principalId: ctx.state.params.principalId,
|
|
19
|
+
calendarId: ctx.state.params.calendarId,
|
|
20
|
+
user: ctx.state.user,
|
|
21
|
+
calendar
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
await options.data.deleteCalendar(ctx, {
|
|
25
|
+
principalId: ctx.state.params.principalId,
|
|
26
|
+
calendarId: ctx.state.params.calendarId,
|
|
27
|
+
user: ctx.state.user,
|
|
28
|
+
calendar
|
|
29
|
+
});
|
|
18
30
|
}
|
|
19
31
|
|
|
20
|
-
const existing = await options.data.getEvent(ctx, {
|
|
21
|
-
eventId: ctx.state.params.eventId,
|
|
22
|
-
principalId: ctx.state.params.principalId,
|
|
23
|
-
calendarId: ctx.state.params.calendarId,
|
|
24
|
-
user: ctx.state.user,
|
|
25
|
-
fullData: false
|
|
26
|
-
});
|
|
27
|
-
log.debug(`existing event${existing ? '' : ' not'} found`);
|
|
28
|
-
|
|
29
|
-
await options.data.deleteEvent(ctx, {
|
|
30
|
-
eventId: ctx.state.params.eventId,
|
|
31
|
-
principalId: ctx.state.params.principalId,
|
|
32
|
-
calendarId: ctx.state.params.calendarId,
|
|
33
|
-
user: ctx.state.user
|
|
34
|
-
});
|
|
35
|
-
|
|
36
32
|
ctx.status = 200;
|
|
37
33
|
ctx.body = '';
|
|
38
34
|
};
|
|
@@ -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
|
};
|