From cd37a9ae83737bc3348c5377f4b8283db1e85ef8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 6 Feb 2021 13:25:34 +1000 Subject: [PATCH] sanitize deck description HTML with html-sanitize Committing for reference; will roll back afterwards. This adds approximately 150k to the bundled .js file in release mode. html-sanitizer might be useful to replace our custom paste filtering code in the future, but for now I'm not sure it's worth the extra page load time over doing the filtering in Rust. --- ts/congrats/BUILD.bazel | 3 + ts/congrats/CongratsPage.svelte | 4 +- ts/graphs/BUILD.bazel | 2 + ts/lib/BUILD.bazel | 2 + ts/lib/html_sanitizer.ts | 11 +++ ts/licenses.json | 126 +++++++++++++++++++++++++++++ ts/package.json | 6 +- ts/rollup.config.js | 5 ++ ts/yarn.lock | 137 +++++++++++++++++++++++++++++++- 9 files changed, 292 insertions(+), 4 deletions(-) create mode 100644 ts/lib/html_sanitizer.ts diff --git a/ts/congrats/BUILD.bazel b/ts/congrats/BUILD.bazel index 8b2426a36..6c0565e0b 100644 --- a/ts/congrats/BUILD.bazel +++ b/ts/congrats/BUILD.bazel @@ -44,8 +44,11 @@ rollup_bundle( "bootstrap", "//ts/lib", "@npm//@rollup/plugin-commonjs", + "@npm//@rollup/plugin-json", "@npm//@rollup/plugin-node-resolve", + "@npm//rollup-plugin-ignore", "@npm//rollup-plugin-terser", + "@npm//sanitize-html", ], ) diff --git a/ts/congrats/CongratsPage.svelte b/ts/congrats/CongratsPage.svelte index 73d9b52a0..3f38ffbfb 100644 --- a/ts/congrats/CongratsPage.svelte +++ b/ts/congrats/CongratsPage.svelte @@ -1,5 +1,7 @@