diff options
| author | Fuwn <[email protected]> | 2023-10-24 19:11:21 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-10-24 19:11:21 -0700 |
| commit | 7051fd67e98be0166d4f093f111dfa5dfa28bc0a (patch) | |
| tree | 61395da21f35395a88950428990f21ca9c12d261 /src/routes/feeds | |
| parent | feat: badge wall (diff) | |
| parent | chore(git): ignore data folder (diff) | |
| download | due.moe-7051fd67e98be0166d4f093f111dfa5dfa28bc0a.tar.xz due.moe-7051fd67e98be0166d4f093f111dfa5dfa28bc0a.zip | |
merge: main into badges
Diffstat (limited to 'src/routes/feeds')
| -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}" /> |