diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-13 21:26:24 +0000 |
---|---|---|
committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-14 01:50:26 +0000 |
commit | e13edc2d3b83bdb063a991edcf56721eef084f6d (patch) | |
tree | 63f2b7652f0bce754242e13ca59ce9e94acb7aa1 | |
parent | 29db8dc79945026d2024e2462f86b1795859c574 (diff) | |
download | pleroma-e13edc2d3b83bdb063a991edcf56721eef084f6d.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 |