diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-13 21:26:24 +0000 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-13 21:26:24 +0000 |
commit | 694bc43123a79293b02585bc457d08b0fbb1f103 (patch) | |
tree | d755f9fda26553ca1f3e8e6b5e64be1af4528dc5 | |
parent | 943da97d6b5ea1b9918d020e92916b8ede4811f6 (diff) | |
download | pleroma-694bc43123a79293b02585bc457d08b0fbb1f103.tar.gz |
MRF: add describe() for gathering and describing the MRF configuration
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf.ex | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index caa2a3231..d43a8760b 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -35,4 +35,20 @@ defmodule Pleroma.Web.ActivityPub.MRF do def subdomain_match?(domains, host) do Enum.any?(domains, fn domain -> Regex.match?(domain, host) end) end + + @callback describe() :: {:ok | :error, Map.t()} + + def describe(policies) do + policies + |> Enum.reduce({:ok, %{}}, fn + policy, {:ok, data} -> + {:ok, policy_data} = policy.describe() + {:ok, Map.merge(data, policy_data)} + + _, error -> + error + end) + end + + def describe(), do: get_policies() |> describe() end |