From 0e2d6cac8acfd29210a119b193b6f65e8327f348 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Wed, 2 Oct 2024 02:13:03 +0300 Subject: [PATCH] save merged calendar to file --- server.js | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/server.js b/server.js index 4435fd4..3c00c71 100644 --- a/server.js +++ b/server.js @@ -54,24 +54,6 @@ app.post('/merge', async (req, res) => { }); }); - // Merge calendars - Object.keys(cal1).forEach((key) => { - let event = cal1[key]; - mergedCal.push({ - start: event.start, - end: event.end, - summary: `${cal1Prefix} ${event.summary}`, - }); - }); - - Object.keys(cal2).forEach((key) => { - let event = cal2[key]; - mergedCal.push({ - start: event.start, - end: event.end, - summary: `${cal2Prefix} ${event.summary}`, - }); - }); // Save merged calendar to file const filename = `merged-${Date.now()}.ics`; @@ -91,6 +73,7 @@ END:VEVENT icalString += `END:VCALENDAR`; fs.writeFileSync(filename, icalString); + // Generate a unique URL for the merged calendar const mergedCalendarUrl = `${req.protocol}://${req.get('host')}/${filename}`;