Expose favicon URL in instance API

This commit is contained in:
Alex Gleason 2022-10-27 13:51:25 -05:00
parent 35f16d9c47
commit bddd4375bf
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 10 additions and 2 deletions

View file

@ -56,7 +56,10 @@ def render("show.json", _) do
},
stats: %{mau: Pleroma.User.active_user_count()},
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key),
oauth_consumer_strategies: Pleroma.Config.oauth_consumer_strategies()
oauth_consumer_strategies: Pleroma.Config.oauth_consumer_strategies(),
favicon:
URI.merge(Pleroma.Web.Endpoint.url(), Keyword.get(instance, :favicon))
|> to_string
},
configuration: configuration(),
soapbox: %{

View file

@ -19,6 +19,7 @@ test "get instance information", %{conn: conn} do
email = Pleroma.Config.get([:instance, :email])
thumbnail = Pleroma.Web.Endpoint.url() <> Pleroma.Config.get([:instance, :instance_thumbnail])
background = Pleroma.Web.Endpoint.url() <> Pleroma.Config.get([:instance, :background_image])
favicon = Pleroma.Web.Endpoint.url() <> Pleroma.Config.get([:instance, :favicon])
# Note: not checking for "max_toot_chars" since it's optional
assert %{
@ -44,7 +45,10 @@ test "get instance information", %{conn: conn} do
"background_image" => from_config_background,
"shout_limit" => _,
"description_limit" => _,
"rules" => _
"rules" => _,
"pleroma" => %{
"favicon" => from_config_favicon
}
} = result
assert result["version"] =~ "Pleroma"
@ -60,6 +64,7 @@ test "get instance information", %{conn: conn} do
assert email == from_config_email
assert thumbnail == from_config_thumbnail
assert background == from_config_background
assert favicon == from_config_favicon
end
test "get instance stats", %{conn: conn} do