X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fwebsub%2Fwebsub.ex;h=47a01849df74bc8b5bec01ff4b66954f9e8cb752;hb=611ca385dea3d611a97579000311cc42684305e6;hp=db1577a9373a71044263266a0b9443254dad2d94;hpb=6dfa62800ad6cdcef9e73ecdabe45363c574a528;p=akkoma diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex index db1577a93..47a01849d 100644 --- a/lib/pleroma/web/websub/websub.ex +++ b/lib/pleroma/web/websub/websub.ex @@ -38,7 +38,15 @@ defmodule Pleroma.Web.Websub do end end - def publish(topic, user, activity) do + @supported_activities [ + "Create", + "Follow", + "Like", + "Announce", + "Undo", + "Delete" + ] + def publish(topic, user, %{data: %{"type" => type}} = activity) when type in @supported_activities do # TODO: Only send to still valid subscriptions. query = from sub in WebsubServerSubscription, where: sub.topic == ^topic and sub.state == "active" @@ -58,6 +66,7 @@ defmodule Pleroma.Web.Websub do Pleroma.Web.Federator.enqueue(:publish_single_websub, data) end) end + def publish(_,_,_), do: "" def sign(secret, doc) do :crypto.hmac(:sha, secret, to_string(doc)) |> Base.encode16 |> String.downcase