mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
MRF: add describe() for gathering and describing the MRF configuration
This commit is contained in:
parent
943da97d6b
commit
694bc43123
1 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue