diff options
Diffstat (limited to 'src/routes/feeds/activity-notifications/+server.ts')
| -rw-r--r-- | src/routes/feeds/activity-notifications/+server.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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[] = []) => `<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" @@ -41,7 +45,7 @@ const render = (posts: Notification[] = []) => `<?xml version="1.0" encoding="UT return `<item> <guid isPermaLink="false">${notification.id}</guid> -<title>${title}</title> +<title>${htmlEncode(title)}</title> <link>${link}</link> <author>${notification.user.name}</author> <media:thumbnail url="${notification.user.avatar.large}" /> |