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.

35 lines
1.8 KiB

  1. RSS::Builder.build do |doc|
  2. doc.title(display_name(@account))
  3. doc.description(I18n.t('rss.descriptions.account', acct: @account.local_username_and_domain))
  4. doc.link(params[:tag].present? ? short_account_tag_url(@account, params[:tag]) : short_account_url(@account))
  5. doc.image(full_asset_url(@account.avatar.url(:original)), display_name(@account), params[:tag].present? ? short_account_tag_url(@account, params[:tag]) : short_account_url(@account))
  6. doc.last_build_date(@statuses.first.created_at) if @statuses.any?
  7. doc.icon(full_asset_url(@account.avatar.url(:original)))
  8. doc.generator("Mastodon v#{Mastodon::Version}")
  9. @statuses.each do |status|
  10. doc.item do |item|
  11. item.link(ActivityPub::TagManager.instance.url_for(status))
  12. item.pub_date(status.created_at)
  13. item.description(rss_status_content_format(status))
  14. if status.ordered_media_attachments.first&.audio?
  15. media = status.ordered_media_attachments.first
  16. item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size)
  17. end
  18. status.ordered_media_attachments.each do |media_attachment|
  19. item.media_content(full_asset_url(media_attachment.file.url(:original, false)), media_attachment.file.content_type, media_attachment.file.size) do |media_content|
  20. media_content.medium(media_attachment.gifv? ? 'image' : media_attachment.type.to_s)
  21. media_content.rating(status.sensitive? ? 'adult' : 'nonadult')
  22. media_content.description(media_attachment.description) if media_attachment.description.present?
  23. media_content.thumbnail(media_attachment.thumbnail.url(:original, false)) if media_attachment.thumbnail?
  24. end
  25. end
  26. status.tags.each do |tag|
  27. item.category(tag.display_name)
  28. end
  29. end
  30. end
  31. end