diff options
| author | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-13 21:57:39 +0000 | 
|---|---|---|
| committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-08-13 22:09:02 +0000 | 
| commit | f305e97eeb1ee036d78e2f75f468b1e165d04356 (patch) | |
| tree | c7da9962c8d9676726dbbfc7214548dead34ee19 /lib | |
| parent | c574b7a1fcc0556b5fd86d48283a2885c05ebc69 (diff) | |
| download | pleroma-f305e97eeb1ee036d78e2f75f468b1e165d04356.tar.gz pleroma-f305e97eeb1ee036d78e2f75f468b1e165d04356.zip | |
nodeinfo: use MRF.describe() instead of hardcoded MRF transparency stuff
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 54 | 
1 files changed, 4 insertions, 50 deletions
| diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 54f89e65c..ee14cfd6b 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -34,64 +34,18 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do    def raw_nodeinfo do      stats = Stats.get_stats() -    exclusions = Config.get([:instance, :mrf_transparency_exclusions]) - -    mrf_simple = -      Config.get(:mrf_simple) -      |> Enum.map(fn {k, v} -> {k, Enum.reject(v, fn v -> v in exclusions end)} end) -      |> Enum.into(%{}) - -    # This horror is needed to convert regex sigils to strings -    mrf_keyword = -      Config.get(:mrf_keyword, []) -      |> Enum.map(fn {key, value} -> -        {key, -         Enum.map(value, fn -           {pattern, replacement} -> -             %{ -               "pattern" => -                 if not is_binary(pattern) do -                   inspect(pattern) -                 else -                   pattern -                 end, -               "replacement" => replacement -             } - -           pattern -> -             if not is_binary(pattern) do -               inspect(pattern) -             else -               pattern -             end -         end)} -      end) -      |> Enum.into(%{}) - -    mrf_policies = -      MRF.get_policies() -      |> Enum.map(fn policy -> to_string(policy) |> String.split(".") |> List.last() end) -      quarantined = Config.get([:instance, :quarantined_instances], [])      staff_accounts =        User.all_superusers()        |> Enum.map(fn u -> u.ap_id end) -    mrf_user_allowlist = -      Config.get([:mrf_user_allowlist], []) -      |> Enum.into(%{}, fn {k, v} -> {k, length(v)} end) -      federation_response =        if Config.get([:instance, :mrf_transparency]) do -        %{ -          mrf_policies: mrf_policies, -          mrf_simple: mrf_simple, -          mrf_keyword: mrf_keyword, -          mrf_user_allowlist: mrf_user_allowlist, -          quarantined_instances: quarantined, -          exclusions: length(exclusions) > 0 -        } +        {:ok, data} = MRF.describe() + +        data +        |> Map.merge(%{quarantined_instances: quarantined})        else          %{}        end | 
