1 defmodule Pleroma.Web.Federator do
5 @websub_verifier Application.get_env(:pleroma, :websub_verifier)
7 def handle(:publish, activity) do
8 Logger.debug("Running publish for #{activity.data["id"]}")
9 with actor when not is_nil(actor) <- User.get_cached_by_ap_id(activity.data["actor"]) do
10 Pleroma.Web.Websub.publish(Pleroma.Web.OStatus.feed_path(actor), actor, activity)
14 def handle(:verify_websub, websub) do
15 Logger.debug("Running websub verification for #{websub.id} (#{websub.topic}, #{websub.callback})")
16 @websub_verifier.verify(websub)
19 def handle(type, payload) do
20 Logger.debug("Unknown task: #{type}")
21 {:error, "Don't know what do do with this"}
24 def enqueue(type, payload) do
25 # for now, just run immediately in a new process.
26 if Mix.env == :test do
29 spawn(fn -> handle(type, payload) end)