This commit is contained in:
Mirai Kumiko 2025-06-18 09:13:59 +02:00
parent 3a57d74357
commit df548a4943
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
12 changed files with 137 additions and 179 deletions

View file

@ -11,7 +11,7 @@ defmodule NullaWeb.InboxController do
conn,
%{"id" => follow_id, "type" => "Follow", "actor" => actor_uri, "object" => target_uri}
) do
with {:ok, target_actor} <- Utils.resolve_local_actor(target_uri),
with {:ok, local_actor} <- Utils.resolve_local_actor(target_uri),
{:ok, remote_actor_json} <- Utils.fetch_remote_actor(actor_uri),
:ok <- HTTPSignature.verify(conn, remote_actor_json),
remote_actor <-
@ -31,14 +31,15 @@ defmodule NullaWeb.InboxController do
accept_activity <-
Activity.create_activity(%{
type: "Accept",
actor: target_actor.id,
actor: local_actor.id,
object: follow_activity
}),
relation <- Relation.create_relation(%{
followed_by: true,
local_actor_id: target_actor.id,
remote_actor_id: remote_actor.id
}) do
_ <-
Relation.create_relation(%{
followed_by: true,
local_actor_id: local_actor.id,
remote_actor_id: remote_actor.id
}) do
conn
|> put_resp_content_type("application/activity+json")
|> send_resp(