From e3b4632f04693ea6c39d22779ddf09ad6b5367ee Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 15 Sep 2020 11:38:40 +0800 Subject: [PATCH] Revert "Create proper shim for xss library" This reverts commit 30e91125356e3e034bd804d4725065e327280ad4. --- app/assets/javascripts/discourse-shims.js | 4 ---- app/assets/javascripts/pretty-text-bundle.js | 1 + app/assets/javascripts/pretty-text/addon/sanitizer.js | 2 +- app/assets/javascripts/pretty-text/addon/xss.js | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/pretty-text/addon/xss.js diff --git a/app/assets/javascripts/discourse-shims.js b/app/assets/javascripts/discourse-shims.js index 384fb92af2c..d6ccfbeea11 100644 --- a/app/assets/javascripts/discourse-shims.js +++ b/app/assets/javascripts/discourse-shims.js @@ -25,10 +25,6 @@ define("bootbox", ["exports"], function (__exports__) { __exports__.default = window.bootbox; }); -define("xss", ["exports"], function (__exports__) { - __exports__.default = window.filterXSS; -}); - define("mousetrap", ["exports"], function (__exports__) { __exports__.default = window.Mousetrap; }); diff --git a/app/assets/javascripts/pretty-text-bundle.js b/app/assets/javascripts/pretty-text-bundle.js index 2a3862f8d46..62dd6c1439c 100644 --- a/app/assets/javascripts/pretty-text-bundle.js +++ b/app/assets/javascripts/pretty-text-bundle.js @@ -6,6 +6,7 @@ //= require ./pretty-text/addon/emoji //= require ./pretty-text/addon/engines/discourse-markdown-it //= require xss.min +//= require ./pretty-text/addon/xss //= require ./pretty-text/addon/white-lister //= require ./pretty-text/addon/sanitizer //= require ./pretty-text/addon/oneboxer diff --git a/app/assets/javascripts/pretty-text/addon/sanitizer.js b/app/assets/javascripts/pretty-text/addon/sanitizer.js index aaf80055b5c..26eef201a13 100644 --- a/app/assets/javascripts/pretty-text/addon/sanitizer.js +++ b/app/assets/javascripts/pretty-text/addon/sanitizer.js @@ -1,4 +1,4 @@ -import xss from "xss"; +import xss from "pretty-text/xss"; function attr(name, value) { if (value) { diff --git a/app/assets/javascripts/pretty-text/addon/xss.js b/app/assets/javascripts/pretty-text/addon/xss.js new file mode 100644 index 00000000000..d2189b1211b --- /dev/null +++ b/app/assets/javascripts/pretty-text/addon/xss.js @@ -0,0 +1,2 @@ +// Shim for xss.js library +export default window.filterXSS;