1 defmodule Pleroma.Web.ActivityPub.ActivityPubController do
2 use Pleroma.Web, :controller
3 alias Pleroma.{User, Repo, Object}
4 alias Pleroma.Web.ActivityPub.{ObjectView, UserView}
5 alias Pleroma.Web.ActivityPub.ActivityPub
7 def user(conn, %{"nickname" => nickname}) do
8 with %User{} = user <- User.get_cached_by_nickname(nickname),
9 {:ok, user} <- Pleroma.Web.WebFinger.ensure_keys_present(user) do
10 json(conn, UserView.render("user.json", %{user: user}))
14 def object(conn, %{"uuid" => uuid}) do
15 with ap_id <- o_status_url(conn, :object, uuid),
16 %Object{} = object <- Object.get_cached_by_ap_id(ap_id) do
17 json(conn, ObjectView.render("object.json", %{object: object}))
21 # TODO: Move signature failure halt into plug
22 def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
23 {:ok, activity} = ActivityPub.insert(params, false)