Merge branch 'features/favicons' into 'develop'

Add support for remote favicons

See merge request pleroma/pleroma!2261
This commit is contained in:
lain 2020-07-09 13:09:31 +00:00
commit f4469dc741
13 changed files with 440 additions and 2 deletions

View file

@ -204,6 +204,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
%{}
end
favicon =
if Pleroma.Config.get([:instances_favicons, :enabled]) do
user
|> Map.get(:ap_id, "")
|> URI.parse()
|> URI.merge("/")
|> Pleroma.Instances.Instance.get_or_update_favicon()
|> MediaProxy.url()
else
nil
end
%{
id: to_string(user.id),
username: username_from_nickname(user.nickname),
@ -245,7 +257,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
hide_favorites: user.hide_favorites,
relationship: relationship,
skip_thread_containment: user.skip_thread_containment,
background_image: image_url(user.background) |> MediaProxy.url()
background_image: image_url(user.background) |> MediaProxy.url(),
favicon: favicon
}
}
|> maybe_put_role(user, opts[:for])