Handle mastodon's headers correctly
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
3006dc228d
commit
0bd52b7bee
@ -13,9 +13,10 @@ defmodule MobilizonWeb.ActivityPubController do
|
|||||||
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
|
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
|
||||||
case get_req_header(conn, "accept") do
|
case get_req_header(conn, "accept") do
|
||||||
["application/activity+json"] ->
|
["application/activity+json"] ->
|
||||||
conn
|
conn |> render_ap_actor(actor)
|
||||||
|> put_resp_header("content-type", "application/activity+json")
|
|
||||||
|> json(ActorView.render("actor.json", %{actor: actor}))
|
["application/activity+json, application/ld+json"] ->
|
||||||
|
conn |> render_ap_actor(actor)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
conn
|
conn
|
||||||
@ -27,6 +28,12 @@ defmodule MobilizonWeb.ActivityPubController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp render_ap_actor(conn, %Actor{} = actor) do
|
||||||
|
conn
|
||||||
|
|> put_resp_header("content-type", "application/activity+json")
|
||||||
|
|> json(ActorView.render("actor.json", %{actor: actor}))
|
||||||
|
end
|
||||||
|
|
||||||
def event(conn, %{"uuid" => uuid}) do
|
def event(conn, %{"uuid" => uuid}) do
|
||||||
with %Event{} = event <- Events.get_event_full_by_uuid(uuid),
|
with %Event{} = event <- Events.get_event_full_by_uuid(uuid),
|
||||||
true <- event.public do
|
true <- event.public do
|
||||||
|
Loading…
Reference in New Issue
Block a user