Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: remove html renderer sanitizes

Steven67c1a46346b7
diff --git a/web/package.json b/web/package.json
index 4dd8d0981..b7bf58f7f 100644
--- a/web/package.json
+++ b/web/package.json
@@ -24,7 +24,6 @@
"clsx": "^2.1.1",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.13",
- "dompurify": "^3.1.7",
"fuse.js": "^7.0.0",
"highlight.js": "^11.10.0",
"i18next": "^23.16.3",
@@ -55,7 +54,6 @@
"@bufbuild/protobuf": "^2.2.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/d3": "^7.4.3",
- "@types/dompurify": "^3.0.5",
"@types/katex": "^0.16.7",
"@types/leaflet": "^1.9.14",
"@types/lodash-es": "^4.17.12",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index 329b03473..170ce57fd 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -53,9 +53,6 @@ importers:
dayjs:
specifier: ^1.11.13
version: 1.11.13
- dompurify:
- specifier: ^3.1.7
- version: 3.1.7
fuse.js:
specifier: ^7.0.0
version: 7.0.0
@@ -141,9 +138,6 @@ importers:
'@types/d3':
specifier: ^7.4.3
version: 7.4.3
- '@types/dompurify':
- specifier: ^3.0.5
- version: 3.0.5
'@types/katex':
specifier: ^0.16.7
version: 0.16.7
@@ -1294,9 +1288,6 @@ packages:
resolution: {integrity: sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==}
- '@types/[email protected]':
- resolution: {integrity: sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==}
-
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
@@ -1339,9 +1330,6 @@ packages:
resolution: {integrity: sha512-bsA9GdXV1wQsXyDjS5+A+czz8IAR3haH5DU+KctIoXbzobRL2NOiwF/+EbB7pofAyudMytLj4ihPtbmbJT8FWw==}
- '@types/[email protected]':
- resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
-
resolution: {integrity: sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==}
@@ -1896,9 +1884,6 @@ packages:
resolution: {integrity: sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==}
- resolution: {integrity: sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==}
-
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@@ -4513,10 +4498,6 @@ snapshots:
'@types/d3-transition': 3.0.9
'@types/d3-zoom': 3.0.8
- '@types/[email protected]':
- dependencies:
- '@types/trusted-types': 2.0.7
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -4556,8 +4537,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]': {}
-
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -5193,8 +5172,6 @@ snapshots:
-
diff --git a/web/src/components/MemoContent/CodeBlock.tsx b/web/src/components/MemoContent/CodeBlock.tsx
index af30dd72d..f64f1c107 100644
--- a/web/src/components/MemoContent/CodeBlock.tsx
+++ b/web/src/components/MemoContent/CodeBlock.tsx
@@ -1,6 +1,5 @@
import clsx from "clsx";
import copy from "copy-to-clipboard";
-import DOMPurify from "dompurify";
import hljs from "highlight.js";
import { CopyIcon } from "lucide-react";
import { useCallback, useMemo } from "react";
@@ -24,15 +23,11 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
// Users can set Markdown code blocks as `__html` to render HTML directly.
if (formatedLanguage === SpecialLanguage.HTML) {
- const purify = DOMPurify(window);
return (
<div
className="w-full overflow-auto !my-2"
dangerouslySetInnerHTML={{
- __html: purify.sanitize(content, {
- ALLOWED_TAGS: ["iframe"],
- ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling"],
- }),
+ __html: content,
}}
/>
);