mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 17:54:22 +00:00
Add mastodon API endpoint for custom emoji.
This commit is contained in:
parent
ed1eb5deea
commit
c6210183e1
|
@ -125,6 +125,5 @@ defmodule Pleroma.Formatter do
|
|||
|
||||
def get_custom_emoji() do
|
||||
@emoji
|
||||
|> Enum.into %{}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,6 +61,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
json(conn, response)
|
||||
end
|
||||
|
||||
def custom_emojis(conn, _params) do
|
||||
mastodon_emoji = Pleroma.Formatter.get_custom_emoji()
|
||||
|> Enum.map(fn {shortcode, relative_url} ->
|
||||
url = to_string URI.merge(Web.base_url(), relative_url)
|
||||
%{
|
||||
"shortcode" => shortcode,
|
||||
"static_url" => url,
|
||||
"url" => url
|
||||
}
|
||||
end)
|
||||
json conn, mastodon_emoji
|
||||
end
|
||||
|
||||
defp add_link_headers(conn, method, activities) do
|
||||
last = List.last(activities)
|
||||
first = List.first(activities)
|
||||
|
|
|
@ -91,6 +91,7 @@ defmodule Pleroma.Web.Router do
|
|||
pipe_through :api
|
||||
get "/instance", MastodonAPIController, :masto_instance
|
||||
post "/apps", MastodonAPIController, :create_app
|
||||
get "/custom_emojis", MastodonAPIController, :custom_emojis
|
||||
|
||||
get "/timelines/public", MastodonAPIController, :public_timeline
|
||||
get "/timelines/tag/:tag", MastodonAPIController, :hashtag_timeline
|
||||
|
|
|
@ -71,6 +71,6 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
end
|
||||
|
||||
def emoji(conn, _params) do
|
||||
json conn, Formatter.get_custom_emoji()
|
||||
json conn, Enum.into(Formatter.get_custom_emoji(), %{})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue