Update
This commit is contained in:
parent
2b5b658809
commit
8402909bb5
1 changed files with 0 additions and 37 deletions
|
@ -140,41 +140,4 @@ defmodule NullaWeb.InboxController do
|
||||||
{:error, reason}
|
{:error, reason}
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue