Skip to content
Snippets Groups Projects

Add support for remote favicons

Merged Haelwenn requested to merge features/favicons into develop
Files
6
@@ -113,6 +113,15 @@ defp do_render("show.json", %{user: user} = opts) do
bio = HTML.filter_tags(user.bio, User.html_filter_policy(opts[:for]))
relationship = render("relationship.json", %{user: opts[:for], target: user})
favicon =
user
|> Map.get(:ap_id, "")
|> URI.parse()
|> URI.merge("/")
|> to_string()
|> Pleroma.Instances.get_cached_favicon()
|> MediaProxy.url()
%{
id: to_string(user.id),
username: username_from_nickname(user.nickname),
@@ -153,7 +162,8 @@ defp do_render("show.json", %{user: user} = opts) 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])
Loading