Add icon
field to instance endpoint (#30205)
This commit is contained in:
parent
376088f6da
commit
4a968cb7a9
6 changed files with 60 additions and 47 deletions
|
@ -7,10 +7,11 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
has_one :account, serializer: REST::AccountSerializer
|
||||
end
|
||||
|
||||
include InstanceHelper
|
||||
include RoutingHelper
|
||||
|
||||
attributes :domain, :title, :version, :source_url, :description,
|
||||
:usage, :thumbnail, :languages, :configuration,
|
||||
:usage, :thumbnail, :icon, :languages, :configuration,
|
||||
:registrations, :api_versions
|
||||
|
||||
has_one :contact, serializer: ContactSerializer
|
||||
|
@ -33,6 +34,18 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
end
|
||||
end
|
||||
|
||||
def icon
|
||||
SiteUpload::ANDROID_ICON_SIZES.map do |size|
|
||||
src = app_icon_path(size.to_i)
|
||||
src = URI.join(root_url, src).to_s if src.present?
|
||||
|
||||
{
|
||||
src: src || frontend_asset_url("icons/android-chrome-#{size}x#{size}.png"),
|
||||
size: "#{size}x#{size}",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def usage
|
||||
{
|
||||
users: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue