forked from AkkomaGang/akkoma
Add custom emoji to Mastodon UI initial state.
This commit is contained in:
parent
3d1360c4d6
commit
8de890a0d9
1 changed files with 8 additions and 3 deletions
|
@ -113,8 +113,8 @@ def masto_instance(conn, _params) do
|
||||||
json(conn, response)
|
json(conn, response)
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_emojis(conn, _params) do
|
defp mastodonized_emoji do
|
||||||
mastodon_emoji = Pleroma.Formatter.get_custom_emoji()
|
Pleroma.Formatter.get_custom_emoji()
|
||||||
|> Enum.map(fn {shortcode, relative_url} ->
|
|> Enum.map(fn {shortcode, relative_url} ->
|
||||||
url = to_string URI.merge(Web.base_url(), relative_url)
|
url = to_string URI.merge(Web.base_url(), relative_url)
|
||||||
%{
|
%{
|
||||||
|
@ -123,6 +123,10 @@ def custom_emojis(conn, _params) do
|
||||||
"url" => url
|
"url" => url
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
def custom_emojis(conn, _params) do
|
||||||
|
mastodon_emoji = mastodonized_emoji()
|
||||||
json conn, mastodon_emoji
|
json conn, mastodon_emoji
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -473,6 +477,7 @@ def index(%{assigns: %{user: user}} = conn, _params) do
|
||||||
|> get_session(:oauth_token)
|
|> get_session(:oauth_token)
|
||||||
|
|
||||||
if user && token do
|
if user && token do
|
||||||
|
mastodon_emoji = mastodonized_emoji()
|
||||||
accounts = Map.put(%{}, user.id, AccountView.render("account.json", %{user: user}))
|
accounts = Map.put(%{}, user.id, AccountView.render("account.json", %{user: user}))
|
||||||
initial_state = %{
|
initial_state = %{
|
||||||
meta: %{
|
meta: %{
|
||||||
|
@ -540,7 +545,7 @@ def index(%{assigns: %{user: user}} = conn, _params) do
|
||||||
},
|
},
|
||||||
push_subscription: nil,
|
push_subscription: nil,
|
||||||
accounts: accounts,
|
accounts: accounts,
|
||||||
custom_emojis: %{}
|
custom_emojis: mastodon_emoji
|
||||||
} |> Poison.encode!
|
} |> Poison.encode!
|
||||||
conn
|
conn
|
||||||
|> put_layout(false)
|
|> put_layout(false)
|
||||||
|
|
Loading…
Reference in a new issue