闭社主体 forked from https://github.com/tootsuite/mastodon
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.

57 lines
962 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. :share_target
  9. def name
  10. object.site_title
  11. end
  12. def short_name
  13. object.site_title
  14. end
  15. def description
  16. strip_tags(object.site_description.presence || I18n.t('about.about_mastodon_html'))
  17. end
  18. def icons
  19. [
  20. {
  21. src: '/android-chrome-192x192.png',
  22. sizes: '192x192',
  23. type: 'image/png',
  24. },
  25. ]
  26. end
  27. def theme_color
  28. '#282c37'
  29. end
  30. def background_color
  31. '#191b22'
  32. end
  33. def display
  34. 'standalone'
  35. end
  36. def start_url
  37. '/web/timelines/home'
  38. end
  39. def scope
  40. root_url
  41. end
  42. def share_target
  43. { url_template: 'share?title={title}&text={text}&url={url}' }
  44. end
  45. end