html: new module providing a configurable markup scrubbing policy

This commit is contained in:
William Pitcock 2018-09-09 23:29:00 +00:00
commit 255f46d7ab
2 changed files with 17 additions and 0 deletions

14
lib/pleroma/html.ex Normal file
View file

@ -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