caldav-adapter 7.0.5 → 7.1.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.1.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
|
};
|
|
@@ -14,19 +14,18 @@ module.exports = function (options) {
|
|
|
14
14
|
fullData: true
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
if (ctx.accepts('
|
|
18
|
-
|
|
19
|
-
return response(ctx.url, status[200], [
|
|
20
|
-
{
|
|
21
|
-
'D:getetag': options.data.getETag(ctx, calendar)
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
'CAL:calendar-data': ics
|
|
25
|
-
}
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
17
|
+
if (ctx.accepts('text/calendar'))
|
|
18
|
+
return options.data.buildICS(ctx, events, calendar);
|
|
28
19
|
|
|
29
|
-
|
|
20
|
+
const ics = await options.data.buildICS(ctx, events, calendar);
|
|
21
|
+
return response(ctx.url, status[200], [
|
|
22
|
+
{
|
|
23
|
+
'D:getetag': options.data.getETag(ctx, calendar)
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
'CAL:calendar-data': ics
|
|
27
|
+
}
|
|
28
|
+
]);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
const event = await options.data.getEvent(ctx, {
|
|
@@ -42,21 +41,20 @@ module.exports = function (options) {
|
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
if (ctx.accepts('
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return options.data.buildICS(ctx, event, calendar);
|
|
44
|
+
if (ctx.accepts('text/calendar'))
|
|
45
|
+
return options.data.buildICS(ctx, event, calendar);
|
|
46
|
+
|
|
47
|
+
const ics = await options.data.buildICS(ctx, event, calendar);
|
|
48
|
+
return response(ctx.url, status[200], [
|
|
49
|
+
{
|
|
50
|
+
// TODO: should E-Tag here be of calendar or event?
|
|
51
|
+
// 'D:getetag': options.data.getETag(ctx, calendar)
|
|
52
|
+
'D:getetag': options.data.getETag(ctx, calendar)
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
'CAL:calendar-data': ics
|
|
56
|
+
}
|
|
57
|
+
]);
|
|
60
58
|
};
|
|
61
59
|
|
|
62
60
|
return {
|