From 84f4d4b855eafa48ad3e06eafe610353843ab3b1 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Fri, 18 Oct 2024 15:33:21 +0300 Subject: [PATCH] Save merged calendar to file with unique identifier --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 1b14fba..ab28c12 100644 --- a/server.js +++ b/server.js @@ -29,7 +29,7 @@ app.post('/merge', async (req, res) => { } // Generate a unique identifier for this set of calendars const calendarId = crypto.randomBytes(16).toString('hex'); - + // Fetch calendar data from URLs const promises = calendars.map((calendar) => { return axios.get(calendar.url) @@ -73,8 +73,8 @@ app.post('/merge', async (req, res) => { }); - // Save merged calendar to file - const filename = `merged-${Date.now()}.ics`; + // Save merged calendar to file with unique identifier + const filename = `${calendarId}.ics`; let icalString = `BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN