Merge branch 'feature/ap-c2s-whoami' into 'develop'
activitypub: c2s: add /api/ap/whoami endpoint for andstatus See merge request pleroma/pleroma!773
This commit is contained in:
commit
681ba1e52f
2 changed files with 9 additions and 0 deletions
|
@ -198,6 +198,14 @@ def relay(conn, _params) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def whoami(%{assigns: %{user: %User{} = user}} = conn, _params) do
|
||||||
|
conn
|
||||||
|
|> put_resp_header("content-type", "application/activity+json")
|
||||||
|
|> json(UserView.render("user.json", %{user: user}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def whoami(_conn, _params), do: {:error, :not_found}
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -454,6 +454,7 @@ defmodule Pleroma.Web.Router do
|
||||||
scope "/", Pleroma.Web.ActivityPub do
|
scope "/", Pleroma.Web.ActivityPub do
|
||||||
pipe_through([:activitypub_client])
|
pipe_through([:activitypub_client])
|
||||||
|
|
||||||
|
get("/api/ap/whoami", ActivityPubController, :whoami)
|
||||||
get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
|
get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
|
||||||
post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
|
post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue