diff --git a/calendar/test.ics b/calendar/test.ics new file mode 100644 index 0000000..141219b --- /dev/null +++ b/calendar/test.ics @@ -0,0 +1,46 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//sebbo.net//ical-generator//EN +NAME:test +X-WR-CALNAME:test +BEGIN:VEVENT +UID:881z@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T111355Z +DTSTART:20240930T113000Z +DTEND:20240930T123000Z +SUMMARY:work other work +END:VEVENT +BEGIN:VEVENT +UID:lhyi@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T111355Z +DTSTART:20241003T190000Z +DTEND:20241003T200000Z +SUMMARY:work progodessey +END:VEVENT +BEGIN:VEVENT +UID:5l54@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T111355Z +DTSTART:20241009T173000Z +DTEND:20241009T183000Z +SUMMARY:work do +END:VEVENT +BEGIN:VEVENT +UID:cp96@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T111355Z +DTSTART:20241001T183000Z +DTEND:20241001T193000Z +SUMMARY:Other work calmerge +END:VEVENT +BEGIN:VEVENT +UID:jxsj@Ryan-jr +SEQUENCE:0 +DTSTAMP:20241107T111355Z +DTSTART:20241010T173000Z +DTEND:20241010T183000Z +SUMMARY:Other work to do +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/calendar/test.json b/calendar/test.json new file mode 100644 index 0000000..c7e9f3e --- /dev/null +++ b/calendar/test.json @@ -0,0 +1,15 @@ +{ + "linkGroupName": "test", + "calendars": [ + { + "prefix": "work", + "override": false, + "url": "https://calendar.google.com/calendar/ical/b4c66eb4bb2cc15257d071bab3f935385778b042112ea1aaedada47f3f1a6e3a%40group.calendar.google.com/public/basic.ics" + }, + { + "prefix": "Other work", + "override": false, + "url": "https://calendar.google.com/calendar/ical/774518759e4e2dd42aab0c511b02397bb216f3b67dc425d76bae07d1eff529d6%40group.calendar.google.com/public/basic.ics" + } + ] +} \ No newline at end of file diff --git a/server.js b/server.js index dbdfd68..d97f043 100644 --- a/server.js +++ b/server.js @@ -18,10 +18,8 @@ fs.mkdirSync(MERGED_CALENDARS_DIR, { recursive: true }); app.get('/script.js', (req, res) => res.sendFile('script.js', { root: '.' })); app.get('/', (req, res) => res.sendFile('index.html', { root: '.' })); -// Function to sanitize the linkGroupName for use as a filename -function sanitizeFilename(filename) { - return filename.replace(/[<>:"/\\|?* ]/g, '_'); // Replace invalid characters with underscores -} +// Utility to sanitize filenames +const sanitizeFilename = (filename) => filename.replace(/[<>:"/\\|?* ]/g, '_'); // Merge calendars endpoint app.post('/merge', async (req, res) => {