forked from potsda.mn/mobilizon
Handle mastodon's headers correctly
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
5361371d8a
commit
3f0cb8a183
|
@ -13,9 +13,10 @@ defmodule MobilizonWeb.ActivityPubController do
|
|||
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
|
||||
case get_req_header(conn, "accept") do
|
||||
["application/activity+json"] ->
|
||||
conn
|
||||
|> put_resp_header("content-type", "application/activity+json")
|
||||
|> json(ActorView.render("actor.json", %{actor: actor}))
|
||||
conn |> render_ap_actor(actor)
|
||||
|
||||
["application/activity+json, application/ld+json"] ->
|
||||
conn |> render_ap_actor(actor)
|
||||
|
||||
_ ->
|
||||
conn
|
||||
|
@ -27,6 +28,12 @@ defmodule MobilizonWeb.ActivityPubController do
|
|||
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
|
||||
with %Event{} = event <- Events.get_event_full_by_uuid(uuid),
|
||||
true <- event.public do
|
||||
|
|
Loading…
Reference in a new issue