Set user agent when requesting iCal
All checks were successful
Build Production Image / Build Production Image (push) Successful in 1m5s

This commit is contained in:
Tony Grosinger 2024-05-21 19:57:31 -07:00
parent 7192f527e9
commit 922a8d24dd

View File

@ -44,7 +44,13 @@ async function loadCalendar(): Promise<void> {
return;
}
const icalContents = await (await fetch(icalAddr)).text();
console.log("Refreshing iCal from Google Calendar")
// For some reason Google Calendar is sending different content based on who is requesting it.
const headers = new Headers();
headers.set('User-Agent', 'curl/7.54.1');
const icalContents = await (await fetch(icalAddr, { headers })).text();
const events = ical.parseICS(icalContents);
const thisMonth = dayjs().startOf('month');
const yesterday = dayjs().startOf('day').subtract(1, 'day');