Only handle subscription requests for now.

This commit is contained in:
Roger Braun 2017-04-22 13:48:10 +02:00
parent 8fb73c28bb
commit c585f9e26c
3 changed files with 4 additions and 4 deletions

View file

@ -52,7 +52,7 @@ defmodule Pleroma.Web.Websub do
end) end)
end end
def incoming_subscription_request(user, params) do def incoming_subscription_request(user, %{"hub.mode" => "subscribe"} = params) do
with {:ok, topic} <- valid_topic(params, user), with {:ok, topic} <- valid_topic(params, user),
{:ok, lease_time} <- lease_time(params), {:ok, lease_time} <- lease_time(params),
secret <- params["hub.secret"], secret <- params["hub.secret"],

View file

@ -9,7 +9,7 @@ defmodule Pleroma.Web.Websub.WebsubControllerTest do
data = %{ data = %{
"hub.callback": "http://example.org/sub", "hub.callback": "http://example.org/sub",
"hub.mode": "subscription", "hub.mode": "subscribe",
"hub.topic": Pleroma.Web.OStatus.feed_path(user), "hub.topic": Pleroma.Web.OStatus.feed_path(user),
"hub.secret": "a random secret", "hub.secret": "a random secret",
"hub.lease_seconds": "100" "hub.lease_seconds": "100"

View file

@ -52,7 +52,7 @@ defmodule Pleroma.Web.WebsubTest do
data = %{ data = %{
"hub.callback" => "http://example.org/sub", "hub.callback" => "http://example.org/sub",
"hub.mode" => "subscription", "hub.mode" => "subscribe",
"hub.topic" => Pleroma.Web.OStatus.feed_path(user), "hub.topic" => Pleroma.Web.OStatus.feed_path(user),
"hub.secret" => "a random secret", "hub.secret" => "a random secret",
"hub.lease_seconds" => "100" "hub.lease_seconds" => "100"
@ -72,7 +72,7 @@ defmodule Pleroma.Web.WebsubTest do
data = %{ data = %{
"hub.callback" => sub.callback, "hub.callback" => sub.callback,
"hub.mode" => "subscription", "hub.mode" => "subscribe",
"hub.topic" => Pleroma.Web.OStatus.feed_path(user), "hub.topic" => Pleroma.Web.OStatus.feed_path(user),
"hub.secret" => "a random secret", "hub.secret" => "a random secret",
"hub.lease_seconds" => "100" "hub.lease_seconds" => "100"