fix(build): 🐛 aaa

This commit is contained in:
Jesse Wierzbinski 2024-05-02 14:44:49 -10:00
parent c251853194
commit 5ef7564ee8
No known key found for this signature in database
3 changed files with 6 additions and 2 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -81,6 +81,7 @@
"dompurify": "^3.1.2", "dompurify": "^3.1.2",
"drizzle-orm": "^0.30.7", "drizzle-orm": "^0.30.7",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"happy-dom": "14.5.0",
"html-to-text": "^9.0.5", "html-to-text": "^9.0.5",
"ioredis": "^5.3.2", "ioredis": "^5.3.2",
"ip-matching": "^2.1.2", "ip-matching": "^2.1.2",

View file

@ -1,12 +1,15 @@
import { config } from "config-manager"; import { config } from "config-manager";
import DOMPurify from "dompurify"; import DOMPurify from "dompurify";
import { JSDOM } from "jsdom"; import { Window } from "happy-dom";
const window = new Window();
export const sanitizeHtml = async ( export const sanitizeHtml = async (
html: string, html: string,
extraConfig?: DOMPurify.Config, extraConfig?: DOMPurify.Config,
) => { ) => {
const sanitizedHtml = DOMPurify(new JSDOM().window).sanitize(html, { // @ts-expect-error Types clash but it works i swear
const sanitizedHtml = DOMPurify(window).sanitize(html, {
ALLOWED_TAGS: [ ALLOWED_TAGS: [
"a", "a",
"p", "p",