-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMMM-CalDAV.js
More file actions
37 lines (35 loc) · 1.17 KB
/
MMM-CalDAV.js
File metadata and controls
37 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Module.register('MMM-CalDAV', {
defaults: {
updateInterval: 15 * 60 * 1000,
timeRangeStart: -365,
timeRangeEnd: 365,
servers: [],
},
start: function () {
const defaultServer = {
envPrefix: 'DEFAULT_',
serverUrl: 'https://INVALIDCALDAVSERVER.com',
authMethod: 'Basic',
defaultAccountType: 'caldav',
targets: [],
timeRangeStart: this.config.timeRangeStart,
timeRangeEnd: this.config.timeRangeEnd,
expand: true,
useMultiGet: true,
updateInterval: this.config.updateInterval,
credentials: {},
}
this.config.servers = this.config.servers.map((server) => {
if (server?.accountType === 'carddav') server.defaultAccountType = 'carddav'
if (!Array.isArray(server.targets)) {
server.targets = []
}
const targets = server.targets.map((target) => {
if (typeof target === 'string') target = { displayName: target }
return (typeof target === 'object' && target?.displayName) ? { ...{ icsName: target.displayName }, ...target } : {}
})
return { ...defaultServer, ...server, targets }
})
this.sendSocketNotification('REGISTER', this.config)
},
})