Do not autoplay videos, display play button instead. Use expiring links when using S3. Do not keep originals
for avatars/headers, resize avatars down to 120x120 instead of 300x300. Set cache headers on S3 stuff, also make it private (aka only accessible via expiring links to prevent hotlinking)
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
.account-grid-card
 | 
			
		||||
  .account-grid-card__header
 | 
			
		||||
    .avatar= image_tag account.avatar.url(:medium)
 | 
			
		||||
    .avatar= image_tag account.avatar.expiring_url(3600, :original)
 | 
			
		||||
    .name
 | 
			
		||||
      = link_to TagManager.instance.url_for(account) do
 | 
			
		||||
        %span.display_name= display_name(account)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
.card{ style: "background-image: url(#{@account.header.url(:medium)})" }
 | 
			
		||||
.card{ style: "background-image: url(#{@account.header.expiring_url(3600, :original)})" }
 | 
			
		||||
  - if user_signed_in? && current_account.id != @account.id
 | 
			
		||||
    .controls
 | 
			
		||||
      - if current_account.following?(@account)
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
      - else
 | 
			
		||||
        = link_to t('accounts.follow'), follow_account_path(@account), data: { method: :post }, class: 'button'
 | 
			
		||||
 | 
			
		||||
  .avatar= image_tag @account.avatar.url(:large)
 | 
			
		||||
  .avatar= image_tag @account.avatar.expiring_url(3600, :original)
 | 
			
		||||
  %h1.name
 | 
			
		||||
    = display_name(@account)
 | 
			
		||||
    %small= "@#{@account.username}"
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ Nokogiri::XML::Builder.new do |xml|
 | 
			
		||||
    title      xml, @account.display_name
 | 
			
		||||
    subtitle   xml, @account.note
 | 
			
		||||
    updated_at xml, stream_updated_at
 | 
			
		||||
    logo       xml, full_asset_url(@account.avatar.url(:medium, false))
 | 
			
		||||
    logo       xml, full_asset_url(@account.avatar.expiring_url(3600, :original))
 | 
			
		||||
 | 
			
		||||
    author(xml) do
 | 
			
		||||
      include_author xml, @account
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ attributes :id, :username, :acct, :display_name
 | 
			
		||||
 | 
			
		||||
node(:note)            { |account| Formatter.instance.simplified_format(account) }
 | 
			
		||||
node(:url)             { |account| TagManager.instance.url_for(account) }
 | 
			
		||||
node(:avatar)          { |account| full_asset_url(account.avatar.url(:large, false)) }
 | 
			
		||||
node(:header)          { |account| full_asset_url(account.header.url(:medium, false)) }
 | 
			
		||||
node(:avatar)          { |account| full_asset_url(account.avatar.expiring_url(3600, :original)) }
 | 
			
		||||
node(:header)          { |account| full_asset_url(account.header.expiring_url(3600, :original)) }
 | 
			
		||||
node(:followers_count) { |account| defined?(@followers_counts_map) ? (@followers_counts_map[account.id] || 0) : (account.try(:followers_count) || account.followers.count) }
 | 
			
		||||
node(:following_count) { |account| defined?(@following_counts_map) ? (@following_counts_map[account.id] || 0) : (account.try(:following_count) || account.following.count) }
 | 
			
		||||
node(:statuses_count)  { |account| defined?(@statuses_counts_map)  ? (@statuses_counts_map[account.id]  || 0) : (account.try(:statuses_count)  || account.statuses.count) }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
object @media
 | 
			
		||||
attribute :id, :type
 | 
			
		||||
node(:url) { |media| full_asset_url(media.file.url) }
 | 
			
		||||
node(:preview_url) { |media| full_asset_url(media.file.url(:small)) }
 | 
			
		||||
node(:url) { |media| full_asset_url(media.file.expiring_url(3600, :original)) }
 | 
			
		||||
node(:preview_url) { |media| full_asset_url(media.file.expiring_url(3600, :small)) }
 | 
			
		||||
node(:text_url) { |media| medium_url(media) }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
attributes :id, :remote_url, :type
 | 
			
		||||
 | 
			
		||||
node(:url)         { |media| full_asset_url(media.file.url) }
 | 
			
		||||
node(:preview_url) { |media| full_asset_url(media.file.url(:small)) }
 | 
			
		||||
node(:url)         { |media| full_asset_url(media.file.expiring_url(3600, :original)) }
 | 
			
		||||
node(:preview_url) { |media| full_asset_url(media.file.expiring_url(3600, :small)) }
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@
 | 
			
		||||
      - if (status.reblog? ? status.reblog : status).media_attachments.size > 0
 | 
			
		||||
        %ul.media-attachments
 | 
			
		||||
          - (status.reblog? ? status.reblog : status).media_attachments.each do |media|
 | 
			
		||||
            %li.transparent-background= link_to '', media.file.url, style: "background-image: url(#{media.file.url(:small)})", target: '_blank'
 | 
			
		||||
            %li.transparent-background= link_to '', media.file.expiring_url(3600, :original), style: "background-image: url(#{media.file.expiring_url(3600, :small)})", target: '_blank'
 | 
			
		||||
 | 
			
		||||
- if include_threads
 | 
			
		||||
  = render partial: 'status', collection: @descendants, as: :status, locals: { is_successor: true }
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
  %meta{ name: 'og:title', content: "#{@account.username} on #{Rails.configuration.x.local_domain}" }/
 | 
			
		||||
  %meta{ name: 'og:article:author', content: @account.username }/
 | 
			
		||||
  %meta{ name: 'og:description', content: @stream_entry.activity.content }/
 | 
			
		||||
  %meta{ name: 'og:image', content: @stream_entry.activity.is_a?(Status) && @stream_entry.activity.media_attachments.size > 0 ? full_asset_url(@stream_entry.activity.media_attachments.first.file.url(:small)) : full_asset_url(@account.avatar.url(:large)) }/
 | 
			
		||||
  %meta{ name: 'og:image', content: @stream_entry.activity.is_a?(Status) && @stream_entry.activity.media_attachments.size > 0 ? full_asset_url(@stream_entry.activity.media_attachments.first.file.expiring_url(3600, :small)) : full_asset_url(@account.avatar.expiring_url(3600, :original)) }/
 | 
			
		||||
 | 
			
		||||
.activity-stream.activity-stream-headless
 | 
			
		||||
  = render partial: @type, locals: { @type.to_sym => @stream_entry.activity, include_threads: true }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user