forked from AkkomaGang/akkoma
nodeinfo: gather supported protocol names from federation modules
This commit is contained in:
parent
28f7f4c6de
commit
44b182732e
5 changed files with 21 additions and 1 deletions
|
@ -147,4 +147,6 @@ def gather_webfinger_links(%User{} = user) do
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gather_nodeinfo_protocol_names, do: ["activitypub"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,4 +79,17 @@ def gather_webfinger_links(%User{} = user) do
|
||||||
links ++ module.gather_webfinger_links(user)
|
links ++ module.gather_webfinger_links(user)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Gathers nodeinfo protocol names supported by the federation module.
|
||||||
|
"""
|
||||||
|
@callback gather_nodeinfo_protocol_names() :: list()
|
||||||
|
|
||||||
|
@spec gather_nodeinfo_protocol_names() :: list()
|
||||||
|
def gather_nodeinfo_protocol_names do
|
||||||
|
Config.get([:instance, :federation_publisher_modules])
|
||||||
|
|> Enum.reduce([], fn module, links ->
|
||||||
|
links ++ module.gather_nodeinfo_protocol_names()
|
||||||
|
end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,7 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController do
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web
|
alias Pleroma.Web
|
||||||
alias Pleroma.Web.ActivityPub.MRF
|
alias Pleroma.Web.ActivityPub.MRF
|
||||||
|
alias Pleroma.Web.Federator.Publisher
|
||||||
|
|
||||||
plug(Pleroma.Web.FederatingPlug)
|
plug(Pleroma.Web.FederatingPlug)
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ def raw_nodeinfo do
|
||||||
name: Pleroma.Application.name() |> String.downcase(),
|
name: Pleroma.Application.name() |> String.downcase(),
|
||||||
version: Pleroma.Application.version()
|
version: Pleroma.Application.version()
|
||||||
},
|
},
|
||||||
protocols: ["ostatus", "activitypub"],
|
protocols: Publisher.gather_nodeinfo_protocol_names(),
|
||||||
services: %{
|
services: %{
|
||||||
inbound: [],
|
inbound: [],
|
||||||
outbound: []
|
outbound: []
|
||||||
|
|
|
@ -264,4 +264,6 @@ def gather_webfinger_links(%User{} = user) do
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gather_nodeinfo_protocol_names, do: []
|
||||||
end
|
end
|
||||||
|
|
|
@ -328,4 +328,6 @@ def gather_webfinger_links(%User{} = user) do
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gather_nodeinfo_protocol_names, do: ["ostatus"]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue