]> cat aescling's git repositories - mastodon.git/commitdiff
Do not use expiring links after all
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 4 Dec 2016 12:02:43 +0000 (13:02 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 4 Dec 2016 12:02:43 +0000 (13:02 +0100)
app/helpers/application_helper.rb
app/helpers/stream_entries_helper.rb
app/views/accounts/_grid_card.html.haml
app/views/accounts/_header.html.haml
app/views/accounts/show.atom.ruby
app/views/api/v1/accounts/show.rabl
app/views/api/v1/media/create.rabl
app/views/api/v1/statuses/_media.rabl
app/views/stream_entries/_status.html.haml
app/views/stream_entries/show.html.haml
config/initializers/paperclip.rb

index 762a972ec254de061fc0d93fe8df4c40c7355506..be82ff2fe38a62f88aecf2afefcfc2657c884b8a 100644 (file)
@@ -4,8 +4,4 @@ module ApplicationHelper
   def active_nav_class(path)
     current_page?(path) ? 'active' : ''
   end
-
-  def s3_expiry
-    Time.zone.now.beginning_of_day.since 25.hours
-  end
 end
index 6a8e67040f3e4d4097eb985cc8786ce235f76752..0aa7008be5969a0d2ca4219a4fdaae1a3d3e5c0c 100644 (file)
@@ -6,7 +6,7 @@ module StreamEntriesHelper
   end
 
   def avatar_for_status_url(status)
-    status.reblog? ? status.reblog.account.avatar.expiring_url(s3_expiry, :original) : status.account.avatar.expiring_url(s3_expiry, :original)
+    status.reblog? ? status.reblog.account.avatar.url( :original) : status.account.avatar.url( :original)
   end
 
   def entry_classes(status, is_predecessor, is_successor, include_threads)
index d0f1ae3d4e792f92adb9e89fa4be11205fe222b8..dfd7a9f5e47a329bf28340b98869914ca75c3a1d 100644 (file)
@@ -1,6 +1,6 @@
 .account-grid-card
   .account-grid-card__header
-    .avatar= image_tag account.avatar.expiring_url(s3_expiry, :original)
+    .avatar= image_tag account.avatar.url( :original)
     .name
       = link_to TagManager.instance.url_for(account) do
         %span.display_name= display_name(account)
index 7c483e7905dc2660bc0ac26cb58ec9306657c940..c132a6896c28ad81d07e6846a6509438553f7eef 100644 (file)
@@ -1,4 +1,4 @@
-.card{ style: "background-image: url(#{@account.header.expiring_url(s3_expiry, :original)})" }
+.card{ style: "background-image: url(#{@account.header.url( :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.expiring_url(s3_expiry, :original)
+  .avatar= image_tag @account.avatar.url( :original)
   %h1.name
     = display_name(@account)
     %small= "@#{@account.username}"
index 2fcaecdcea96dab2e3dd3d830b33117137738cd5..b2903d189b57fa53094f4ac2ccdcec761de2fda6 100644 (file)
@@ -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.expiring_url(s3_expiry, :original))
+    logo       xml, full_asset_url(@account.avatar.url( :original))
 
     author(xml) do
       include_author xml, @account
index cd267eb00cbc2c5126c434818d3def81e17a7c24..22cb87f6ca5fd0f81cb7fce24380dddd9dca3516 100644 (file)
@@ -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.expiring_url(s3_expiry, :original)) }
-node(:header)          { |account| full_asset_url(account.header.expiring_url(s3_expiry, :original)) }
+node(:avatar)          { |account| full_asset_url(account.avatar.url( :original)) }
+node(:header)          { |account| full_asset_url(account.header.url( :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) }
index ba1a0c3781100ccba7e2e3f29a9bb7629ef2366c..0b42e6e3d0f5fcdd5d6912b87ff996b6f6204f18 100644 (file)
@@ -1,5 +1,5 @@
 object @media
 attribute :id, :type
-node(:url) { |media| full_asset_url(media.file.expiring_url(s3_expiry, :original)) }
-node(:preview_url) { |media| full_asset_url(media.file.expiring_url(s3_expiry, :small)) }
+node(:url) { |media| full_asset_url(media.file.url( :original)) }
+node(:preview_url) { |media| full_asset_url(media.file.url( :small)) }
 node(:text_url) { |media| medium_url(media) }
index 83b986d51d4fc933f83df7bd7bbc5cb8a8b10233..af635dfecb8d605e68e817845ef90f2aeb7417e8 100644 (file)
@@ -1,4 +1,4 @@
 attributes :id, :remote_url, :type
 
-node(:url)         { |media| full_asset_url(media.file.expiring_url(s3_expiry, :original)) }
-node(:preview_url) { |media| full_asset_url(media.file.expiring_url(s3_expiry, :small)) }
+node(:url)         { |media| full_asset_url(media.file.url( :original)) }
+node(:preview_url) { |media| full_asset_url(media.file.url( :small)) }
index 8d650762307b53c511f49e1715f731e602ed9339..8169b81786e559be0323276b4405a03cee6fa41d 100644 (file)
@@ -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.expiring_url(s3_expiry, :original), style: "background-image: url(#{media.file.expiring_url(s3_expiry, :small)})", target: '_blank'
+            %li.transparent-background= link_to '', media.file.url( :original), style: "background-image: url(#{media.file.url( :small)})", target: '_blank'
 
 - if include_threads
   = render partial: 'status', collection: @descendants, as: :status, locals: { is_successor: true }
index 9a134ab167aeb33af54081a060a775fde802f577..1bacaf32b28e4233b5c4b4e26173c3bc7b219231 100644 (file)
@@ -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.expiring_url(s3_expiry, :small)) : full_asset_url(@account.avatar.expiring_url(s3_expiry, :original)) }/
+  %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( :original)) }/
 
 .activity-stream.activity-stream-headless
   = render partial: @type, locals: { @type.to_sym => @stream_entry.activity, include_threads: true }
index 704f7fe73754061f6660e7115e6df86541a4f9df..61bb52480dbe10f241110c0bca2384fcfa4911ee 100644 (file)
@@ -7,7 +7,6 @@ if ENV['S3_ENABLED'] == 'true'
   Paperclip::Attachment.default_options[:s3_host_name]   = "s3-#{ENV.fetch('S3_REGION')}.amazonaws.com"
   Paperclip::Attachment.default_options[:path]           = '/:class/:attachment/:id_partition/:style/:filename'
   Paperclip::Attachment.default_options[:s3_headers]     = { 'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate }
-  Paperclip::Attachment.default_options[:s3_permissions] = :private
 
   unless ENV['S3_CLOUDFRONT_HOST'].blank?
     Paperclip::Attachment.default_options[:url]           = ':s3_alias_url'