+
+ def publish(actor, activity) do
+ remote_users = Pleroma.Web.Salmon.remote_users(activity)
+ {:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
+ Enum.each remote_users, fn(user) ->
+ if user.info["ap_enabled"] do
+ inbox = user.info["source_data"]["inbox"]
+ Logger.info("Federating #{activity.data["id"]} to #{inbox}")
+ host = URI.parse(inbox).host
+ signature = Pleroma.Web.HTTPSignatures.sign(actor, %{host: host})
+ @httpoison.post(inbox, Poison.encode!(data), [{"Content-Type", "application/activity+json"}, {"signature", signature}])
+ end
+ end
+ end