From 35398241dea769bd7554eaca0a9045801c847340 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Tue, 27 Feb 2024 17:37:10 +0000 Subject: Update dependencies to latest versions --- src/lib/activitypub.ts | 5 ++++- src/lib/activitypub/templates.ts | 2 +- src/routes/frontend.ts | 14 +++++++++----- src/routes/group.ts | 7 ++++--- src/util/markdown.ts | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/lib/activitypub.ts b/src/lib/activitypub.ts index a06991d..19aee08 100644 --- a/src/lib/activitypub.ts +++ b/src/lib/activitypub.ts @@ -142,7 +142,10 @@ export const handlePollResponse = async (req: Request, res: Response) => { if (!event.attendees?.some((el) => el.id === attributedTo)) { const attendeeName = apActor.preferredUsername || apActor.name || attributedTo; - const newAttendee: Partial = { + const newAttendee: Pick< + IAttendee, + "name" | "status" | "id" | "number" | "visibility" + > = { name: attendeeName, status: "attending", id: attributedTo, diff --git a/src/lib/activitypub/templates.ts b/src/lib/activitypub/templates.ts index cab9ada..d0c8cc2 100644 --- a/src/lib/activitypub/templates.ts +++ b/src/lib/activitypub/templates.ts @@ -8,7 +8,7 @@ export const successfulRSVPResponse = ({ fullAttendee, }: { event: IEvent; - newAttendee: { id: string; name: string }; + newAttendee: { id?: string; name: string }; fullAttendee: { _id: string }; }) => `@${newAttendee.name} Thanks for RSVPing! You can remove yourself from the RSVP list by clicking here.`; diff --git a/src/routes/frontend.ts b/src/routes/frontend.ts index 5317819..51c207a 100644 --- a/src/routes/frontend.ts +++ b/src/routes/frontend.ts @@ -293,8 +293,11 @@ router.get("/:eventID", async (req: Request, res: Response) => { } let metadata = { title: event.name, - description: marked - .parse(event.description, { renderer: renderPlain() }) + description: ( + marked.parse(event.description, { + renderer: renderPlain(), + }) as string + ) .split(" ") .splice(0, 40) .join(" ") @@ -455,10 +458,11 @@ router.get("/group/:eventGroupID", async (req: Request, res: Response) => { const metadata = { title: eventGroup.name, - description: marked - .parse(eventGroup.description, { + description: ( + marked.parse(eventGroup.description, { renderer: renderPlain(), - }) + }) as string + ) .split(" ") .splice(0, 40) .join(" ") diff --git a/src/routes/group.ts b/src/routes/group.ts index 8afd766..1bbf501 100644 --- a/src/routes/group.ts +++ b/src/routes/group.ts @@ -269,10 +269,11 @@ router.post("/known/groups", async (req: Request, res: Response) => { return { id: group.id, name: group.name, - description: marked - .parse(group.description, { + description: ( + marked.parse(group.description, { renderer: renderPlain(), - }) + }) as string + ) .split(" ") .splice(0, 40) .join(" ") diff --git a/src/util/markdown.ts b/src/util/markdown.ts index bab50bd..666ed73 100644 --- a/src/util/markdown.ts +++ b/src/util/markdown.ts @@ -46,7 +46,7 @@ export const renderPlain = () => { }; export const markdownToSanitizedHTML = (markdown: string) => { - const html = marked.parse(markdown); + const html = marked.parse(markdown) as string; const window = new JSDOM("").window; const purify = DOMPurify(window); const clean = purify.sanitize(html); -- cgit v1.2.3