summaryrefslogtreecommitdiff
path: root/priv/scrubbers/links_only.ex
diff options
context:
space:
mode:
Diffstat (limited to 'priv/scrubbers/links_only.ex')
-rw-r--r--priv/scrubbers/links_only.ex27
1 files changed, 27 insertions, 0 deletions
diff --git a/priv/scrubbers/links_only.ex b/priv/scrubbers/links_only.ex
new file mode 100644
index 000000000..b30a00589
--- /dev/null
+++ b/priv/scrubbers/links_only.ex
@@ -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