logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

links_only.ex (782B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.HTML.Scrubber.LinksOnly do
  5. @moduledoc """
  6. An HTML scrubbing policy which limits to links only.
  7. """
  8. @valid_schemes Pleroma.Config.get([:uri_schemes, :valid_schemes], [])
  9. require FastSanitize.Sanitizer.Meta
  10. alias FastSanitize.Sanitizer.Meta
  11. Meta.strip_comments()
  12. # links
  13. Meta.allow_tag_with_uri_attributes(:a, ["href"], @valid_schemes)
  14. Meta.allow_tag_with_this_attribute_values(:a, "rel", [
  15. "tag",
  16. "nofollow",
  17. "noopener",
  18. "noreferrer",
  19. "me",
  20. "ugc"
  21. ])
  22. Meta.allow_tag_with_these_attributes(:a, ["name", "title"])
  23. Meta.strip_everything_not_covered()
  24. end