mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 16:40:29 +00:00
put_resp_header("content-type", "application/activity+json") -> put_resp_content_type("application/activity+json")
This commit is contained in:
parent
73bcbf4fa3
commit
6062017493
1 changed files with 17 additions and 17 deletions
|
@ -41,7 +41,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
{:ok, user} <- User.ensure_keys_present(user) do
|
{:ok, user} <- User.ensure_keys_present(user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("user.json", %{user: user}))
|
|> json(UserView.render("user.json", %{user: user}))
|
||||||
else
|
else
|
||||||
nil -> {:error, :not_found}
|
nil -> {:error, :not_found}
|
||||||
|
@ -53,7 +53,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
|
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
|
||||||
{_, true} <- {:public?, Visibility.is_public?(object)} do
|
{_, true} <- {:public?, Visibility.is_public?(object)} do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(ObjectView.render("object.json", %{object: object}))
|
|> json(ObjectView.render("object.json", %{object: object}))
|
||||||
else
|
else
|
||||||
{:public?, false} ->
|
{:public?, false} ->
|
||||||
|
@ -69,7 +69,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
{page, _} = Integer.parse(page)
|
{page, _} = Integer.parse(page)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(ObjectView.render("likes.json", ap_id, likes, page))
|
|> json(ObjectView.render("likes.json", ap_id, likes, page))
|
||||||
else
|
else
|
||||||
{:public?, false} ->
|
{:public?, false} ->
|
||||||
|
@ -83,7 +83,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
{_, true} <- {:public?, Visibility.is_public?(object)},
|
{_, true} <- {:public?, Visibility.is_public?(object)},
|
||||||
likes <- Utils.get_object_likes(object) do
|
likes <- Utils.get_object_likes(object) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(ObjectView.render("likes.json", ap_id, likes))
|
|> json(ObjectView.render("likes.json", ap_id, likes))
|
||||||
else
|
else
|
||||||
{:public?, false} ->
|
{:public?, false} ->
|
||||||
|
@ -96,7 +96,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
%Activity{} = activity <- Activity.normalize(ap_id),
|
%Activity{} = activity <- Activity.normalize(ap_id),
|
||||||
{_, true} <- {:public?, Visibility.is_public?(activity)} do
|
{_, true} <- {:public?, Visibility.is_public?(activity)} do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(ObjectView.render("object.json", %{object: activity}))
|
|> json(ObjectView.render("object.json", %{object: activity}))
|
||||||
else
|
else
|
||||||
{:public?, false} ->
|
{:public?, false} ->
|
||||||
|
@ -107,7 +107,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
# GET /relay/following
|
# GET /relay/following
|
||||||
def following(%{assigns: %{relay: true}} = conn, _params) do
|
def following(%{assigns: %{relay: true}} = conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("following.json", %{user: Relay.get_actor()}))
|
|> json(UserView.render("following.json", %{user: Relay.get_actor()}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -119,12 +119,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
{page, _} = Integer.parse(page)
|
{page, _} = Integer.parse(page)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("following.json", %{user: user, page: page, for: for_user}))
|
|> json(UserView.render("following.json", %{user: user, page: page, for: for_user}))
|
||||||
else
|
else
|
||||||
{:show_follows, _} ->
|
{:show_follows, _} ->
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> send_resp(403, "")
|
|> send_resp(403, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -133,7 +133,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
{user, for_user} <- ensure_user_keys_present_and_maybe_refresh_for_user(user, for_user) do
|
{user, for_user} <- ensure_user_keys_present_and_maybe_refresh_for_user(user, for_user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("following.json", %{user: user, for: for_user}))
|
|> json(UserView.render("following.json", %{user: user, for: for_user}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -141,7 +141,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
# GET /relay/followers
|
# GET /relay/followers
|
||||||
def followers(%{assigns: %{relay: true}} = conn, _params) do
|
def followers(%{assigns: %{relay: true}} = conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("followers.json", %{user: Relay.get_actor()}))
|
|> json(UserView.render("followers.json", %{user: Relay.get_actor()}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,12 +153,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
{page, _} = Integer.parse(page)
|
{page, _} = Integer.parse(page)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("followers.json", %{user: user, page: page, for: for_user}))
|
|> json(UserView.render("followers.json", %{user: user, page: page, for: for_user}))
|
||||||
else
|
else
|
||||||
{:show_followers, _} ->
|
{:show_followers, _} ->
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> send_resp(403, "")
|
|> send_resp(403, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -167,7 +167,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
{user, for_user} <- ensure_user_keys_present_and_maybe_refresh_for_user(user, for_user) do
|
{user, for_user} <- ensure_user_keys_present_and_maybe_refresh_for_user(user, for_user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("followers.json", %{user: user, for: for_user}))
|
|> json(UserView.render("followers.json", %{user: user, for: for_user}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -176,7 +176,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
with %User{} = user <- User.get_cached_by_nickname(nickname),
|
||||||
{:ok, user} <- User.ensure_keys_present(user) do
|
{:ok, user} <- User.ensure_keys_present(user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("outbox.json", %{user: user, max_id: params["max_id"]}))
|
|> json(UserView.render("outbox.json", %{user: user, max_id: params["max_id"]}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -224,7 +224,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
defp represent_service_actor(%User{} = user, conn) do
|
defp represent_service_actor(%User{} = user, conn) do
|
||||||
with {:ok, user} <- User.ensure_keys_present(user) do
|
with {:ok, user} <- User.ensure_keys_present(user) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("user.json", %{user: user}))
|
|> json(UserView.render("user.json", %{user: user}))
|
||||||
else
|
else
|
||||||
nil -> {:error, :not_found}
|
nil -> {:error, :not_found}
|
||||||
|
@ -245,7 +245,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
|
|
||||||
def whoami(%{assigns: %{user: %User{} = user}} = conn, _params) do
|
def whoami(%{assigns: %{user: %User{} = user}} = conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("user.json", %{user: user}))
|
|> json(UserView.render("user.json", %{user: user}))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|
||||||
def read_inbox(%{assigns: %{user: user}} = conn, %{"nickname" => nickname} = params) do
|
def read_inbox(%{assigns: %{user: user}} = conn, %{"nickname" => nickname} = params) do
|
||||||
if nickname == user.nickname do
|
if nickname == user.nickname do
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> json(UserView.render("inbox.json", %{user: user, max_id: params["max_id"]}))
|
|> json(UserView.render("inbox.json", %{user: user, max_id: params["max_id"]}))
|
||||||
else
|
else
|
||||||
err =
|
err =
|
||||||
|
|
Loading…
Reference in a new issue