support for google 'secret address'
This commit is contained in:
parent
744434c41a
commit
052835beda
5
index.js
5
index.js
|
@ -6,11 +6,14 @@ async function handleRequest(request) {
|
||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
const prefix = 'https://calendar.google.com/calendar/ical';
|
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;
|
let requestPath = new URL(request.url).pathname;
|
||||||
if (requestPath.endsWith('/')) {
|
if (requestPath.endsWith('/')) {
|
||||||
requestPath = requestPath.substring(0, requestPath.length - 1);
|
requestPath = requestPath.substring(0, requestPath.length - 1);
|
||||||
}
|
}
|
||||||
|
if (requestPath.search('/private-') >= 0) {
|
||||||
|
postscript = '/basic.ics';
|
||||||
|
}
|
||||||
const googleCal = `${prefix}${requestPath}${postscript}`;
|
const googleCal = `${prefix}${requestPath}${postscript}`;
|
||||||
response = await fetch(googleCal);
|
response = await fetch(googleCal);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user