Merge remote-tracking branch 'origin/renovate/node-ical-0-x' into renovate/node-ical-0-x
This commit is contained in:
commit
5501757bd5
3 files changed
+15
-11
No files matched your search
@@ -38,7 +38,7 @@
|
||||
"@homarr/redis": "workspace:^0.1.0",
|
||||
"@homarr/translation": "workspace:^0.1.0",
|
||||
"@homarr/validation": "workspace:^0.1.0",
|
||||
"@immich/sdk": "^2.6.2",
|
||||
"@immich/sdk": "^2.6.3",
|
||||
"@jellyfin/sdk": "^0.13.0",
|
||||
"@octokit/auth-app": "^8.2.0",
|
||||
"ical.js": "^2.2.1",
|
||||
|
||||
@@ -68,15 +68,19 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr
|
||||
|
||||
return calendarEvents
|
||||
.map((event) => {
|
||||
// @ts-expect-error the typescript definitions for this package are wrong
|
||||
// @ts-expect-error the TypeScript definitions for this package are wrong
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
const icalData = ical.default.parseICS(event.data) as ical.CalendarResponse;
|
||||
const veventObject = Object.values(icalData).find((data) => data.type === "VEVENT");
|
||||
const veventObject = Object.values(icalData).find((data) => data?.type === "VEVENT");
|
||||
|
||||
if (!veventObject) {
|
||||
throw new Error(`Invalid event data object: ${JSON.stringify(event.data)}. Unable to process the calendar.`);
|
||||
}
|
||||
|
||||
if (!veventObject.end) {
|
||||
throw new Error(`Event had no end date: ${JSON.stringify(event.data)}. Unable to process the calendar.`);
|
||||
}
|
||||
|
||||
logger.debug(`Converting VEVENT event to ${event.etag} from Nextcloud: ${JSON.stringify(veventObject)}`);
|
||||
|
||||
const eventUrlWithoutHost = new URL(event.url).pathname;
|
||||
@@ -92,13 +96,13 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr
|
||||
const dateInMillis = utcStartDate.valueOf();
|
||||
|
||||
return {
|
||||
title: veventObject.summary,
|
||||
title: veventObject.summary as string,
|
||||
subTitle: null,
|
||||
description: veventObject.description,
|
||||
description: veventObject.description as string,
|
||||
startDate: utcStartDate,
|
||||
endDate,
|
||||
image: null,
|
||||
location: veventObject.location || null,
|
||||
location: (veventObject.location as string | undefined) ?? null,
|
||||
indicatorColor:
|
||||
"color" in veventObject && typeof veventObject.color === "string" ? veventObject.color : "#ff8600",
|
||||
links: [
|
||||
|
||||
Reference in new issue
Block a user