Runtime configuration
[akkoma] / lib / pleroma / web / activity_pub / mrf / normalize_markup.ex
1 defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkup do
2 alias Pleroma.HTML
3
4 @behaviour Pleroma.Web.ActivityPub.MRF
5
6 def filter(%{"type" => activity_type} = object) when activity_type == "Create" do
7 scrub_policy = Pleroma.Config.get([:mrf_normalize_markup, :scrub_policy])
8
9 child = object["object"]
10
11 content =
12 child["content"]
13 |> HTML.filter_tags(scrub_policy)
14
15 child = Map.put(child, "content", content)
16
17 object = Map.put(object, "object", child)
18
19 {:ok, object}
20 end
21
22 def filter(object), do: {:ok, object}
23 end