expose bubble instances via nodeinfo (#136)

Reviewed-on: AkkomaGang/akkoma#136
This commit is contained in:
floatingghost 2022-08-02 09:11:22 +00:00
parent 55b86e45ec
commit c3eea8dc7d
3 changed files with 23 additions and 2 deletions

View file

@ -70,7 +70,8 @@ def get_nodeinfo("2.0") do
features: features, features: features,
restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]), restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]),
skipThreadContainment: Config.get([:instance, :skip_thread_containment], false), skipThreadContainment: Config.get([:instance, :skip_thread_containment], false),
privilegedStaff: Config.get([:instance, :privileged_staff]) privilegedStaff: Config.get([:instance, :privileged_staff]),
localBubbleInstances: Config.get([:instance, :local_bubble], [])
} }
} }
end end

View file

@ -88,7 +88,8 @@ def raw_nodeinfo do
mailerEnabled: Config.get([Pleroma.Emails.Mailer, :enabled], false), mailerEnabled: Config.get([Pleroma.Emails.Mailer, :enabled], false),
features: features, features: features,
restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]), restrictedNicknames: Config.get([Pleroma.User, :restricted_nicknames]),
skipThreadContainment: Config.get([:instance, :skip_thread_containment], false) skipThreadContainment: Config.get([:instance, :skip_thread_containment], false),
localBubbleInstances: Config.get([:instance, :local_bubble], [])
} }
} }
end end

View file

@ -188,6 +188,25 @@ test "shows extra information in the quarantined_info field for relevant entries
end end
end end
test "Bubble instances", %{conn: conn} do
clear_config([:instance, :local_bubble], [])
response =
conn
|> get("/nodeinfo/2.1.json")
|> json_response(:ok)
assert response["metadata"]["localBubbleInstances"] == []
clear_config([:instance, :local_bubble], ["example.com"])
response =
conn
|> get("/nodeinfo/2.1.json")
|> json_response(:ok)
assert response["metadata"]["localBubbleInstances"] == ["example.com"]
end
describe "MRF SimplePolicy" do describe "MRF SimplePolicy" do
setup do setup do
clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.SimplePolicy]) clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.SimplePolicy])