From 8226953f1df81513ff9faa364c2a841c68adff0b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 5 Sep 2018 23:06:55 +0200 Subject: [PATCH 1/4] [Pleroma.Web.Nodeinfo.NodeinfoController]: Transparency on MRF Simple --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 9c4827426..184b81c25 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -26,6 +26,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do chat = Application.get_env(:pleroma, :chat) gopher = Application.get_env(:pleroma, :gopher) stats = Stats.get_stats() + mrf_simple = Application.get_env(:pleroma, :mrf_simple) staff_accounts = User.moderator_user_query() @@ -64,7 +65,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do }, staffAccounts: staff_accounts, chat: Keyword.get(chat, :enabled), - gopher: Keyword.get(gopher, :enabled) + gopher: Keyword.get(gopher, :enabled), + mrf_simple: Enum.into(mrf_simple, %{}) } } From 56d31db13043dd9215991adf7a4319f51e42086f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 1 Oct 2018 11:51:12 +0200 Subject: [PATCH 2/4] Pleroma.Web.Nodeinfo.NodeinfoController: Further transparency, breaks API of previous one --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 184b81c25..3b495ad86 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -28,6 +28,13 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do stats = Stats.get_stats() mrf_simple = Application.get_env(:pleroma, :mrf_simple) + mrf_policies = + if(is_list(instance.rewrite_policy)) do + instance.rewrite_policy + else + [instance.rewrite_policy] + end + staff_accounts = User.moderator_user_query() |> Repo.all() @@ -66,7 +73,11 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do staffAccounts: staff_accounts, chat: Keyword.get(chat, :enabled), gopher: Keyword.get(gopher, :enabled), - mrf_simple: Enum.into(mrf_simple, %{}) + federation: %{ + mrf_policies: mrf_policies, + mrf_simple: mrf_simple, + quarantined_instances: instance.quarantined_instances + } } } From 28651df478bd8a69f66c4e613076324bb154969d Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 4 Oct 2018 13:37:17 +0200 Subject: [PATCH 3/4] MRF Transparency --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 3b495ad86..1f1b0282c 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -28,11 +28,23 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do stats = Stats.get_stats() mrf_simple = Application.get_env(:pleroma, :mrf_simple) + mrf_policies = Keyword.get(instance, :rewrite_policy) + mrf_policies = - if(is_list(instance.rewrite_policy)) do - instance.rewrite_policy + if(is_list(mrf_policies)) do + mrf_policies + |> Enum.map(fn policy -> to_string(policy) |> String.split(".") |> List.last() end) else - [instance.rewrite_policy] + [to_string(mrf_policies) |> String.split(".") |> List.last()] + end + + quarantined = Keyword.get(instance, :quarantined_instances) + + quarantined = + if is_list(quarantined) do + quarantined + else + [] end staff_accounts = @@ -76,7 +88,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do federation: %{ mrf_policies: mrf_policies, mrf_simple: mrf_simple, - quarantined_instances: instance.quarantined_instances + quarantined_instances: quarantined } } } From f2efc8dcfbede6df655b3e85af6327802118c185 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 5 Oct 2018 22:32:53 +0200 Subject: [PATCH 4/4] nodeinfo_controller: Fix JSON rendering This is the last noedinfo difference from my own branch --- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 1f1b0282c..860468506 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -26,7 +26,10 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do chat = Application.get_env(:pleroma, :chat) gopher = Application.get_env(:pleroma, :gopher) stats = Stats.get_stats() - mrf_simple = Application.get_env(:pleroma, :mrf_simple) + + mrf_simple = + Application.get_env(:pleroma, :mrf_simple) + |> Enum.into(%{}) mrf_policies = Keyword.get(instance, :rewrite_policy)