Remove support for multiple federation publisher modules
This also unravels some needless indirection.
This commit is contained in:
parent
ddc321a094
commit
1d816222e0
@ -192,9 +192,6 @@ config :pleroma, :instance,
|
|||||||
federating: true,
|
federating: true,
|
||||||
federation_incoming_replies_max_depth: 100,
|
federation_incoming_replies_max_depth: 100,
|
||||||
federation_reachability_timeout_days: 7,
|
federation_reachability_timeout_days: 7,
|
||||||
federation_publisher_modules: [
|
|
||||||
Pleroma.Web.ActivityPub.Publisher
|
|
||||||
],
|
|
||||||
allow_relay: true,
|
allow_relay: true,
|
||||||
public: true,
|
public: true,
|
||||||
quarantined_instances: [],
|
quarantined_instances: [],
|
||||||
|
@ -6,9 +6,9 @@ defmodule Pleroma.Web.Federator do
|
|||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Object.Containment
|
alias Pleroma.Object.Containment
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
alias Pleroma.Web.ActivityPub.Publisher
|
||||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
alias Pleroma.Web.ActivityPub.Utils
|
alias Pleroma.Web.ActivityPub.Utils
|
||||||
alias Pleroma.Web.Federator.Publisher
|
|
||||||
alias Pleroma.Workers.PublisherWorker
|
alias Pleroma.Workers.PublisherWorker
|
||||||
alias Pleroma.Workers.ReceiverWorker
|
alias Pleroma.Workers.ReceiverWorker
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.Web.Federator.Publisher do
|
defmodule Pleroma.Web.Federator.Publisher do
|
||||||
alias Pleroma.Activity
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Workers.PublisherWorker
|
alias Pleroma.Workers.PublisherWorker
|
||||||
|
|
||||||
@ -38,50 +36,6 @@ defmodule Pleroma.Web.Federator.Publisher do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
|
||||||
Relays an activity to all specified peers.
|
|
||||||
"""
|
|
||||||
@callback publish(User.t(), Activity.t()) :: :ok | {:error, any()}
|
|
||||||
|
|
||||||
@spec publish(User.t(), Activity.t()) :: :ok
|
|
||||||
def publish(%User{} = user, %Activity{} = activity) do
|
|
||||||
Config.get([:instance, :federation_publisher_modules])
|
|
||||||
|> Enum.each(fn module ->
|
|
||||||
if module.is_representable?(activity) do
|
|
||||||
Logger.debug("Publishing #{activity.data["id"]} using #{inspect(module)}")
|
|
||||||
module.publish(user, activity)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
|
||||||
Gathers links used by an outgoing federation module for WebFinger output.
|
|
||||||
"""
|
|
||||||
@callback gather_webfinger_links(User.t()) :: list()
|
|
||||||
|
|
||||||
@spec gather_webfinger_links(User.t()) :: list()
|
|
||||||
def gather_webfinger_links(%User{} = user) do
|
|
||||||
Config.get([:instance, :federation_publisher_modules])
|
|
||||||
|> Enum.reduce([], fn module, links ->
|
|
||||||
links ++ module.gather_webfinger_links(user)
|
|
||||||
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
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gathers a set of remote users given an IR envelope.
|
Gathers a set of remote users given an IR envelope.
|
||||||
"""
|
"""
|
||||||
|
@ -6,7 +6,7 @@ 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.Federator.Publisher
|
alias Pleroma.Web.ActivityPub.Publisher
|
||||||
alias Pleroma.Web.MastodonAPI.InstanceView
|
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
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
defmodule Pleroma.Web.WebFinger do
|
defmodule Pleroma.Web.WebFinger do
|
||||||
alias Pleroma.HTTP
|
alias Pleroma.HTTP
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
alias Pleroma.Web.ActivityPub.Publisher
|
||||||
alias Pleroma.Web.Endpoint
|
alias Pleroma.Web.Endpoint
|
||||||
alias Pleroma.Web.Federator.Publisher
|
|
||||||
alias Pleroma.Web.XML
|
alias Pleroma.Web.XML
|
||||||
alias Pleroma.XmlBuilder
|
alias Pleroma.XmlBuilder
|
||||||
require Jason
|
require Jason
|
||||||
|
Loading…
Reference in New Issue
Block a user