From 255f46d7ab124d86a71e994deffca5f4f438b49b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 9 Sep 2018 23:29:00 +0000 Subject: html: new module providing a configurable markup scrubbing policy --- lib/pleroma/html.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/pleroma/html.ex (limited to 'lib') diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex new file mode 100644 index 000000000..0ec73a91d --- /dev/null +++ b/lib/pleroma/html.ex @@ -0,0 +1,14 @@ +defmodule Pleroma.HTML do + alias HtmlSanitizeEx.Scrubber + + @markup Application.get_env(:pleroma, :markup) + + def filter_tags(html) do + scrubber = Keyword.get(@markup, :scrub_policy) + html |> Scrubber.scrub(scrubber) + end + + def strip_tags(html) do + html |> Scrubber.scrub(Scrubber.StripTags) + end +end -- cgit v1.2.3