HTML: Compile Scrubbers on boot
This makes it possible to configure their behavior on OTP releases.
This commit is contained in:
parent
af5fef1f22
commit
d6c89068f3
8 changed files with 231 additions and 214 deletions
27
priv/scrubbers/links_only.ex
Normal file
27
priv/scrubbers/links_only.ex
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
defmodule Pleroma.HTML.Scrubber.LinksOnly do
|
||||
@moduledoc """
|
||||
An HTML scrubbing policy which limits to links only.
|
||||
"""
|
||||
|
||||
@valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
|
||||
|
||||
require FastSanitize.Sanitizer.Meta
|
||||
alias FastSanitize.Sanitizer.Meta
|
||||
|
||||
Meta.strip_comments()
|
||||
|
||||
# links
|
||||
Meta.allow_tag_with_uri_attributes(:a, ["href"], @valid_schemes)
|
||||
|
||||
Meta.allow_tag_with_this_attribute_values(:a, "rel", [
|
||||
"tag",
|
||||
"nofollow",
|
||||
"noopener",
|
||||
"noreferrer",
|
||||
"me",
|
||||
"ugc"
|
||||
])
|
||||
|
||||
Meta.allow_tag_with_these_attributes(:a, ["name", "title"])
|
||||
Meta.strip_everything_not_covered()
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue