From 78a6e2f7b1d8b46f98bf27562cc6a646871fda5c Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 23 Oct 2023 16:52:02 -0700 Subject: fix(feeds): html encode title --- src/routes/feeds/activity-notifications/+server.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/routes/feeds') diff --git a/src/routes/feeds/activity-notifications/+server.ts b/src/routes/feeds/activity-notifications/+server.ts index 06c55ace..dd4ee0b4 100644 --- a/src/routes/feeds/activity-notifications/+server.ts +++ b/src/routes/feeds/activity-notifications/+server.ts @@ -1,5 +1,9 @@ import { notifications, type Notification } from '$lib/AniList/notifications'; +const htmlEncode = (input: string) => { + return input.replace(/[\u00A0-\u9999<>&]/g, (i) => '&#' + i.charCodeAt(0) + ';'); +}; + const render = (posts: Notification[] = []) => ` ` ${notification.id} -${title} +${htmlEncode(title)} ${link} ${notification.user.name} -- cgit v1.2.3