html: new module providing a configurable markup scrubbing policy
This commit is contained in:
parent
3f64ba5fc8
commit
255f46d7ab
|
@ -76,6 +76,9 @@
|
||||||
quarantined_instances: [],
|
quarantined_instances: [],
|
||||||
managed_config: true
|
managed_config: true
|
||||||
|
|
||||||
|
config :pleroma, :markup,
|
||||||
|
scrub_policy: HtmlSanitizeEx.Scrubber.BasicHTML
|
||||||
|
|
||||||
config :pleroma, :fe,
|
config :pleroma, :fe,
|
||||||
theme: "pleroma-dark",
|
theme: "pleroma-dark",
|
||||||
logo: "/static/logo.png",
|
logo: "/static/logo.png",
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue