Add media upload endpoint.
This commit is contained in:
parent
3184939055
commit
641c24cdd4
4 changed files with 29 additions and 0 deletions
|
|
@ -199,6 +199,15 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
render conn, AccountView, "relationships.json", %{user: user, targets: targets}
|
||||
end
|
||||
|
||||
def upload(%{assigns: %{user: user}} = conn, %{"file" => file}) do
|
||||
with {:ok, object} <- ActivityPub.upload(file) do
|
||||
data = object.data
|
||||
|> Map.put("id", object.id)
|
||||
|
||||
render conn, StatusView, "attachment.json", %{attachment: data}
|
||||
end
|
||||
end
|
||||
|
||||
def empty_array(conn, _) do
|
||||
Logger.debug("Unimplemented, returning an empty array")
|
||||
json(conn, [])
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ defmodule Pleroma.Web.Router do
|
|||
post "/statuses/:id/unfavourite", MastodonAPIController, :unfav_status
|
||||
|
||||
get "/notifications", MastodonAPIController, :notifications
|
||||
|
||||
post "/media", MastodonAPIController, :upload
|
||||
end
|
||||
|
||||
scope "/api/v1", Pleroma.Web.MastodonAPI do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue