From 052835beda4f4936e7c6b84538b5b95cca90c248 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 14 Apr 2020 14:09:10 -0700 Subject: [PATCH] support for google 'secret address' --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 880c48f..664258f 100644 --- a/index.js +++ b/index.js @@ -6,11 +6,14 @@ async function handleRequest(request) { let response; try { const prefix = 'https://calendar.google.com/calendar/ical'; - const postscript = '/public/basic.ics'; + let postscript = '/public/basic.ics'; let requestPath = new URL(request.url).pathname; if (requestPath.endsWith('/')) { requestPath = requestPath.substring(0, requestPath.length - 1); } + if (requestPath.search('/private-') >= 0) { + postscript = '/basic.ics'; + } const googleCal = `${prefix}${requestPath}${postscript}`; response = await fetch(googleCal); } catch (err) {