update deps
This commit is contained in:
parent
9876261789
commit
f44fa8bf7c
BIN
web/bun.lockb
BIN
web/bun.lockb
Binary file not shown.
@ -11,32 +11,32 @@
|
|||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.7.0",
|
"@astrojs/check": "^0.9.3",
|
||||||
"@astrojs/mdx": "^3.1.2",
|
"@astrojs/mdx": "^3.1.6",
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@astrojs/ts-plugin": "^1.8.0",
|
"@astrojs/ts-plugin": "^1.10.2",
|
||||||
"@photo-sphere-viewer/core": "^5.8.1",
|
"@photo-sphere-viewer/core": "^5.10.0",
|
||||||
"@photo-sphere-viewer/markers-plugin": "^5.8.1",
|
"@photo-sphere-viewer/markers-plugin": "^5.10.0",
|
||||||
"@photo-sphere-viewer/virtual-tour-plugin": "^5.8.1",
|
"@photo-sphere-viewer/virtual-tour-plugin": "^5.10.0",
|
||||||
"@unom/style": "git+https://git.unom.io/unom/style.git",
|
"@unom/style": "git+https://git.unom.io/unom/style.git",
|
||||||
"astro": "^4.11.3",
|
"astro": "^4.15.6",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.20",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"ical": "^0.8.0",
|
"ical": "^0.8.0",
|
||||||
"keen-slider": "^6.8.6",
|
"keen-slider": "^6.8.6",
|
||||||
"lucide-astro": "^0.399.0",
|
"lucide-astro": "^0.441.0",
|
||||||
"marked": "^13.0.1",
|
"marked": "^14.1.2",
|
||||||
"motion": "^10.18.0",
|
"motion": "^10.18.0",
|
||||||
"pannellum": "^2.5.6",
|
"pannellum": "^2.5.6",
|
||||||
"postcss": "^8.4.39",
|
"postcss": "^8.4.47",
|
||||||
"postcss-custom-media": "^10.0.7",
|
"postcss-custom-media": "^11.0.1",
|
||||||
"postcss-import": "^16.1.0",
|
"postcss-import": "^16.1.0",
|
||||||
"prettier-plugin-astro": "^0.14.0",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"tailwind-merge": "^2.3.0",
|
"tailwind-merge": "^2.5.2",
|
||||||
"tailwindcss": "^3.4.4",
|
"tailwindcss": "^3.4.4",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"typescript": "^5.5.3"
|
"typescript": "^5.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/ical": "^0.8.3",
|
"@types/ical": "^0.8.3",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import ICal from "ical";
|
import ICal from "ical";
|
||||||
|
|
||||||
const CALENDAR_ICAL_URL =
|
const CALENDAR_ICAL_URL =
|
||||||
"https://hub.vspace.one/remote.php/dav/public-calendars/f6MfGLnsGScRqd4Y?export";
|
"https://hub.vspace.one/remote.php/dav/public-calendars/f6MfGLnsGScRqd4Y?export";
|
||||||
//const CALENDAR_URL = "https://hub.vspace.one/apps/calendar/p/f6MfGLnsGScRqd4Y";
|
//const CALENDAR_URL = "https://hub.vspace.one/apps/calendar/p/f6MfGLnsGScRqd4Y";
|
||||||
|
|
||||||
// Only look at this much next occurences, to prevent infinite loop
|
// Only look at this much next occurences, to prevent infinite loop
|
||||||
@ -11,130 +11,126 @@ const DESIGNATOR_LINK = "Link";
|
|||||||
const DESIGNATOR_DOWNLOAD = "Download";
|
const DESIGNATOR_DOWNLOAD = "Download";
|
||||||
|
|
||||||
export async function getCalenderIcs() {
|
export async function getCalenderIcs() {
|
||||||
const response = await fetch(CALENDAR_ICAL_URL);
|
const response = await fetch(CALENDAR_ICAL_URL);
|
||||||
const data = await response.text();
|
const data = await response.text();
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Event = {
|
export type Event = {
|
||||||
title: string;
|
title: string;
|
||||||
start: Date;
|
start: Date | undefined;
|
||||||
end: Date;
|
end: Date | undefined;
|
||||||
location: string;
|
location: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
link: string | undefined;
|
link: string | undefined;
|
||||||
download: string | undefined;
|
download: string | undefined;
|
||||||
isRecurring: boolean;
|
isRecurring: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getEvents() {
|
export async function getEvents() {
|
||||||
// Fetch the calender ics
|
// Fetch the calender ics
|
||||||
const icsData = await getCalenderIcs();
|
const icsData = await getCalenderIcs();
|
||||||
|
|
||||||
const events = ICal.parseICS(icsData);
|
const events = ICal.parseICS(icsData);
|
||||||
|
|
||||||
// Filters are split up for readability
|
// Filters are split up for readability
|
||||||
const futureAndRecurringEvents = Object.values(events)
|
const futureAndRecurringEvents = Object.values(events)
|
||||||
// Only include events of type VEVENT
|
// Only include events of type VEVENT
|
||||||
.filter((e) => e.type === "VEVENT")
|
.filter((e) => e.type === "VEVENT")
|
||||||
// Exclude Past events that aren't recurring
|
// Exclude Past events that aren't recurring
|
||||||
.filter((e) => {
|
.filter((e) => {
|
||||||
const isFuture = Number(e.end) > Date.now();
|
const isFuture = Number(e.end) > Date.now();
|
||||||
const isRecurring = !!e.rrule;
|
const isRecurring = !!e.rrule;
|
||||||
|
|
||||||
return isFuture || isRecurring;
|
return isFuture || isRecurring;
|
||||||
})
|
})
|
||||||
// Get latest reccurance of reccuring events
|
// Get latest reccurance of reccuring events
|
||||||
.map((e) => {
|
.map((e) => {
|
||||||
const isRecurring = !!e.rrule;
|
const isRecurring = !!e.rrule;
|
||||||
|
|
||||||
if (!isRecurring || !e.rrule) return e;
|
if (!isRecurring || !e.rrule) return e;
|
||||||
|
|
||||||
else {
|
const latest = e.recurrences?.[e.recurrences.length - 1];
|
||||||
|
|
||||||
const latest = e.recurrences?.[e.recurrences.length - 1];
|
if (!latest) {
|
||||||
|
const duration =
|
||||||
|
e.end !== undefined && e.start !== undefined
|
||||||
|
? e.end.getTime() - e.start.getTime()
|
||||||
|
: 0;
|
||||||
|
const next = e.rrule.after(new Date(Date.now()), true);
|
||||||
|
|
||||||
if (!latest) {
|
if (!next) {
|
||||||
const duration = e.end !== undefined && e.start !== undefined ? e.end.getTime() - e.start.getTime() : 0;
|
return e;
|
||||||
const next = e.rrule.after(new Date(Date.now()), true);
|
}
|
||||||
|
|
||||||
if (!next) {
|
e.start = next;
|
||||||
return e;
|
e.end = new Date(next.getTime() + duration);
|
||||||
}
|
|
||||||
|
|
||||||
e.start = next;
|
return e;
|
||||||
e.end = new Date(next.getTime() + duration);
|
}
|
||||||
|
return latest;
|
||||||
|
})
|
||||||
|
.filter((e) => {
|
||||||
|
const isFuture = Number(e.end) > Date.now();
|
||||||
|
|
||||||
return e
|
return isFuture;
|
||||||
|
})
|
||||||
|
// Exclude cancelled events
|
||||||
|
.filter((e) => {
|
||||||
|
const isCancelled = e.status !== undefined && e.status === "CANCELLED";
|
||||||
|
|
||||||
} else {
|
// Only return events that aren't cancelled
|
||||||
return latest
|
return !isCancelled;
|
||||||
}
|
})
|
||||||
}
|
// Get designator values from descriptions and turn into event type
|
||||||
})
|
.map((e) => {
|
||||||
.filter((e) => {
|
let download: string | undefined = undefined;
|
||||||
const isFuture = Number(e.end) > Date.now();
|
let link: string | undefined = undefined;
|
||||||
|
let description = "";
|
||||||
|
|
||||||
return isFuture;
|
const isRecurring = !!e.rrule;
|
||||||
})
|
|
||||||
// Exclude cancelled events
|
|
||||||
.filter((e) => {
|
|
||||||
const isCancelled = e.status !== undefined && e.status === "CANCELLED";
|
|
||||||
|
|
||||||
// Only return events that aren't cancelled
|
if (e.description) {
|
||||||
return !isCancelled;
|
const lines = e.description.split("\n");
|
||||||
})
|
|
||||||
// Get designator values from descriptions and turn into event type
|
|
||||||
.map((e) => {
|
|
||||||
let download: string | undefined = undefined;
|
|
||||||
let link: string | undefined = undefined;
|
|
||||||
let description = "";
|
|
||||||
|
|
||||||
const isRecurring = !!e.rrule;
|
for (const line of lines) {
|
||||||
|
const designator = line.substring(0, line.search(":"));
|
||||||
|
|
||||||
// console.log(e.description);
|
switch (designator) {
|
||||||
|
case DESIGNATOR_DOWNLOAD:
|
||||||
|
download = line
|
||||||
|
.substring(DESIGNATOR_DOWNLOAD.length + 1, line.length)
|
||||||
|
.trim();
|
||||||
|
break;
|
||||||
|
case DESIGNATOR_LINK:
|
||||||
|
link = line
|
||||||
|
.substring(DESIGNATOR_LINK.length + 1, line.length)
|
||||||
|
.trim();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
description += `${line} `;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (e.description) {
|
description = description.trim();
|
||||||
const lines = e.description.split("\n");
|
|
||||||
|
|
||||||
for (let line of lines) {
|
const event: Event = {
|
||||||
const designator = line.substring(0, line.search(":"));
|
title: e.summary || "Kein Titel",
|
||||||
|
start: e.start,
|
||||||
|
end: e.end,
|
||||||
|
location: e.location || "Kein Standort",
|
||||||
|
description,
|
||||||
|
link,
|
||||||
|
download,
|
||||||
|
isRecurring,
|
||||||
|
};
|
||||||
|
|
||||||
switch (designator) {
|
return event;
|
||||||
case DESIGNATOR_DOWNLOAD:
|
})
|
||||||
download = line
|
// Sort the events
|
||||||
.substring(DESIGNATOR_DOWNLOAD.length + 1, line.length)
|
.sort((a, b) => (a.start?.getTime() || 0) - (b.start?.getTime() || 0));
|
||||||
.trim();
|
|
||||||
break;
|
|
||||||
case DESIGNATOR_LINK:
|
|
||||||
link = line
|
|
||||||
.substring(DESIGNATOR_LINK.length + 1, line.length)
|
|
||||||
.trim();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
description += line + " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
description = description.trim();
|
return futureAndRecurringEvents;
|
||||||
|
|
||||||
const event: Event = {
|
|
||||||
title: e.summary || "Kein Titel",
|
|
||||||
start: e.start!,
|
|
||||||
end: e.end!,
|
|
||||||
location: e.location || "Kein Standort",
|
|
||||||
description,
|
|
||||||
link,
|
|
||||||
download,
|
|
||||||
isRecurring,
|
|
||||||
};
|
|
||||||
|
|
||||||
return event;
|
|
||||||
})
|
|
||||||
// Sort the events
|
|
||||||
.sort((a, b) => a.start.getTime() - b.start.getTime());
|
|
||||||
|
|
||||||
return futureAndRecurringEvents;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user