diff --git a/lib/nulla_web/controllers/inbox_controller.ex b/lib/nulla_web/controllers/inbox_controller.ex index 052f7d7..a787c55 100644 --- a/lib/nulla_web/controllers/inbox_controller.ex +++ b/lib/nulla_web/controllers/inbox_controller.ex @@ -140,41 +140,4 @@ defmodule NullaWeb.InboxController do {:error, reason} end end - - def inbox(conn, %{ - "id" => accept_id, - "type" => "Accept", - "actor" => actor_uri, - "object" => object - }) do - with {:ok, remote_actor_json} <- Utils.fetch_remote_actor(actor_uri), - :ok <- HTTPSignature.verify(conn, remote_actor_json), - {:ok, remote_actor} <- get_or_create_actor(remote_actor_json), - {:ok, follow_activity} <- decode_follow_activity(object), - {:ok, local_actor} <- Actor.get_actor(ap_id: follow_activity["object"]), - {:ok, _relation} <- Relation.mark_follow_accepted(local_actor.id, remote_actor.id) do - send_resp(conn, 200, "") - else - error -> - IO.inspect(error, label: "Accept error") - json(conn, %{"error" => "Failed to process Accept"}) - end - end - - defp decode_follow_activity(object) when is_map(object), do: {:ok, object} - defp decode_follow_activity(object) when is_binary(object), do: Jason.decode(object) - - def inbox(conn, %{ - "id" => accept_id, - "type" => "Undo", - "actor" => actor_uri, - "object" => object - }) do - send_resp(conn, 200, "") - end - - def inbox(conn, params) do - IO.inspect(params) - send_resp(conn, 400, "") - end end