forked from AkkomaGang/akkoma
Only handle subscription requests for now.
This commit is contained in:
parent
8fb73c28bb
commit
c585f9e26c
3 changed files with 4 additions and 4 deletions
|
@ -52,7 +52,7 @@ def publish(topic, user, activity) 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"],
|
||||||
|
|
|
@ -9,7 +9,7 @@ test "websub subscription request", %{conn: conn} 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"
|
||||||
|
|
|
@ -52,7 +52,7 @@ test "an incoming subscription request" 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 @@ test "an incoming subscription request for an existing subscription" 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"
|
||||||
|
|
Loading…
Reference in a new issue