X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Factivity_pub%2Factivity_pub_controller.ex;h=12f61f5f0760b1072d9de8d25b02d8164b736bb9;hb=4d55d7c95e8409f5018f3321d7e653b6349b9ba6;hp=47a8bf5ab4411e296d0358249008c3acbfb24860;hpb=b72a25f5b1ce18698b1b3aff6487157898dc7846;p=akkoma diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 47a8bf5ab..12f61f5f0 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do require Logger - action_fallback :errors + action_fallback(:errors) def user(conn, %{"nickname" => nickname}) do with %User{} = user <- User.get_cached_by_nickname(nickname), @@ -31,6 +31,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do with %User{} = user <- User.get_cached_by_nickname(nickname), {:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do {page, _} = Integer.parse(page) + conn |> put_resp_header("content-type", "application/activity+json") |> json(UserView.render("following.json", %{user: user, page: page})) @@ -50,6 +51,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do with %User{} = user <- User.get_cached_by_nickname(nickname), {:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do {page, _} = Integer.parse(page) + conn |> put_resp_header("content-type", "application/activity+json") |> json(UserView.render("followers.json", %{user: user, page: page})) @@ -74,7 +76,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do end end - def outbox(conn, %{"nickname" => nickname}) do outbox(conn, %{"nickname" => nickname, "max_id" => nil}) end + def outbox(conn, %{"nickname" => nickname}) do + outbox(conn, %{"nickname" => nickname, "max_id" => nil}) + end # TODO: Ensure that this inbox is a recipient of the message def inbox(%{assigns: %{valid_signature: true}} = conn, params) do @@ -84,7 +88,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do def inbox(conn, params) do headers = Enum.into(conn.req_headers, %{}) - if !(String.contains?(headers["signature"] || "", params["actor"])) do + + if !String.contains?(headers["signature"] || "", params["actor"]) do Logger.info("Signature not from author, relayed message, fetching from source") ActivityPub.fetch_object_from_id(params["object"]["id"]) else