mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-20 22:12:05 +00:00
dompurify notifications
This commit is contained in:
parent
e083ca8764
commit
cb5b46d7c9
1 changed files with 3 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import DOMPurify from "dompurify";
|
||||||
|
|
||||||
import { proxiedFetch } from "@/backend/helpers/fetch";
|
import { proxiedFetch } from "@/backend/helpers/fetch";
|
||||||
|
|
||||||
const DEFAULT_FEEDS = ["/notifications.xml"];
|
const DEFAULT_FEEDS = ["/notifications.xml"];
|
||||||
|
|
@ -138,7 +140,7 @@ export const getCategoryLabel = (category: string) => {
|
||||||
};
|
};
|
||||||
export function formatNotificationDescription(description: string): string {
|
export function formatNotificationDescription(description: string): string {
|
||||||
return (
|
return (
|
||||||
description
|
DOMPurify.sanitize(description)
|
||||||
// First, normalize multiple consecutive line breaks to single line breaks
|
// First, normalize multiple consecutive line breaks to single line breaks
|
||||||
.replace(/\n{3,}/g, "\n\n")
|
.replace(/\n{3,}/g, "\n\n")
|
||||||
// Handle bullet points before paragraph breaks
|
// Handle bullet points before paragraph breaks
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue