You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
842 B

  1. # frozen_string_literal: true
  2. class ManifestSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. include ActionView::Helpers::TextHelper
  5. attributes :name, :short_name, :description,
  6. :icons, :theme_color, :background_color,
  7. :display, :start_url, :scope
  8. def name
  9. object.site_title
  10. end
  11. def short_name
  12. object.site_title
  13. end
  14. def description
  15. strip_tags(object.site_description.presence || I18n.t('about.about_mastodon_html'))
  16. end
  17. def icons
  18. [
  19. {
  20. src: '/android-chrome-192x192.png',
  21. sizes: '192x192',
  22. type: 'image/png',
  23. },
  24. ]
  25. end
  26. def theme_color
  27. '#282c37'
  28. end
  29. def background_color
  30. '#191b22'
  31. end
  32. def display
  33. 'standalone'
  34. end
  35. def start_url
  36. '/web/timelines/home'
  37. end
  38. def scope
  39. root_url
  40. end
  41. end