闭社主体 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.

25 lines
1.3 KiB

  1. - if activity.is_a?(Status) && activity.non_sensitive_with_media?
  2. - activity.media_attachments.each do |media|
  3. - if media.image?
  4. = opengraph 'og:image', full_asset_url(media.file.url(:original))
  5. = opengraph 'og:image:type', media.file_content_type
  6. - unless media.file.meta.nil?
  7. = opengraph 'og:image:width', media.file.meta['original']['width']
  8. = opengraph 'og:image:height', media.file.meta['original']['height']
  9. - elsif media.video?
  10. = opengraph 'og:image', full_asset_url(media.file.url(:small))
  11. = opengraph 'og:image:type', 'image/png'
  12. - unless media.file.meta.nil?
  13. = opengraph 'og:image:width', media.file.meta['small']['width']
  14. = opengraph 'og:image:height', media.file.meta['small']['height']
  15. = opengraph 'og:video', full_asset_url(media.file.url(:original))
  16. = opengraph 'og:video:type', media.file_content_type
  17. - unless media.file.meta.nil?
  18. = opengraph 'og:video:width', media.file.meta['small']['width']
  19. = opengraph 'og:video:height', media.file.meta['small']['height']
  20. = opengraph 'twitter:card', 'summary_large_image'
  21. - else
  22. = opengraph 'og:image', full_asset_url(account.avatar.url(:original))
  23. = opengraph 'og:image:width', '120'
  24. = opengraph 'og:image:height','120'
  25. = opengraph 'twitter:card', 'summary'