Merge branch 'hotfix/preload-tests-nodeinfo' into 'develop'

nodeinfo: Fix MRF transparency

See merge request pleroma/pleroma!2689
This commit is contained in:
Haelwenn 2020-06-26 03:48:25 +00:00
commit 7c7a6509b9

View file

@ -6,30 +6,19 @@ defmodule Pleroma.Web.Nodeinfo.Nodeinfo do
alias Pleroma.Config alias Pleroma.Config
alias Pleroma.Stats alias Pleroma.Stats
alias Pleroma.User alias Pleroma.User
alias Pleroma.Web.ActivityPub.MRF
alias Pleroma.Web.Federator.Publisher alias Pleroma.Web.Federator.Publisher
alias Pleroma.Web.MastodonAPI.InstanceView
# returns a nodeinfo 2.0 map, since 2.1 just adds a repository field # returns a nodeinfo 2.0 map, since 2.1 just adds a repository field
# under software. # under software.
def get_nodeinfo("2.0") do def get_nodeinfo("2.0") do
stats = Stats.get_stats() stats = Stats.get_stats()
quarantined = Config.get([:instance, :quarantined_instances], [])
staff_accounts = staff_accounts =
User.all_superusers() User.all_superusers()
|> Enum.map(fn u -> u.ap_id end) |> Enum.map(fn u -> u.ap_id end)
federation_response = federation = InstanceView.federation()
if Config.get([:instance, :mrf_transparency]) do
{:ok, data} = MRF.describe()
data
|> Map.merge(%{quarantined_instances: quarantined})
else
%{}
end
|> Map.put(:enabled, Config.get([:instance, :federating]))
features = features =
[ [
@ -86,7 +75,7 @@ def get_nodeinfo("2.0") do
enabled: false enabled: false
}, },
staffAccounts: staff_accounts, staffAccounts: staff_accounts,
federation: federation_response, federation: federation,
pollLimits: Config.get([:instance, :poll_limits]), pollLimits: Config.get([:instance, :poll_limits]),
postFormats: Config.get([:instance, :allowed_post_formats]), postFormats: Config.get([:instance, :allowed_post_formats]),
uploadLimits: %{ uploadLimits: %{