ObjectAgePolicy: Fix pattern matching on published
[akkoma] / priv / scrubbers / links_only.ex
1 defmodule Pleroma.HTML.Scrubber.LinksOnly do
2 @moduledoc """
3 An HTML scrubbing policy which limits to links only.
4 """
5
6 @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
7
8 require FastSanitize.Sanitizer.Meta
9 alias FastSanitize.Sanitizer.Meta
10
11 Meta.strip_comments()
12
13 # links
14 Meta.allow_tag_with_uri_attributes(:a, ["href"], @valid_schemes)
15
16 Meta.allow_tag_with_this_attribute_values(:a, "rel", [
17 "tag",
18 "nofollow",
19 "noopener",
20 "noreferrer",
21 "me",
22 "ugc"
23 ])
24
25 Meta.allow_tag_with_these_attributes(:a, ["name", "title"])
26 Meta.strip_everything_not_covered()
27 end