about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-04 13:02:43 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-04 13:02:43 +0100
commitf763e844e8e703891ada1bc44047e4e043007c68 (patch)
tree58918dd2d85a943a4a97960a3fdfc8348970542c
parent24e692b0cf1e6b2c3f1f209bebb39f0f9a97eb20 (diff)
Do not use expiring links after all
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/stream_entries_helper.rb2
-rw-r--r--app/views/accounts/_grid_card.html.haml2
-rw-r--r--app/views/accounts/_header.html.haml4
-rw-r--r--app/views/accounts/show.atom.ruby2
-rw-r--r--app/views/api/v1/accounts/show.rabl4
-rw-r--r--app/views/api/v1/media/create.rabl4
-rw-r--r--app/views/api/v1/statuses/_media.rabl4
-rw-r--r--app/views/stream_entries/_status.html.haml2
-rw-r--r--app/views/stream_entries/show.html.haml2
-rw-r--r--config/initializers/paperclip.rb1
11 files changed, 13 insertions, 18 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 762a972ec..be82ff2fe 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb
index 6a8e67040..0aa7008be 100644
--- a/app/helpers/stream_entries_helper.rb
+++ b/app/helpers/stream_entries_helper.rb
@@ -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)
diff --git a/app/views/accounts/_grid_card.html.haml b/app/views/accounts/_grid_card.html.haml
index d0f1ae3d4..dfd7a9f5e 100644
--- a/app/views/accounts/_grid_card.html.haml
+++ b/app/views/accounts/_grid_card.html.haml
@@ -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)
diff --git a/app/views/accounts/_header.html.haml b/app/views/accounts/_header.html.haml
index 7c483e790..c132a6896 100644
--- a/app/views/accounts/_header.html.haml
+++ b/app/views/accounts/_header.html.haml
@@ -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}"
diff --git a/app/views/accounts/show.atom.ruby b/app/views/accounts/show.atom.ruby
index 2fcaecdce..b2903d189 100644
--- a/app/views/accounts/show.atom.ruby
+++ b/app/views/accounts/show.atom.ruby
@@ -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
diff --git a/app/views/api/v1/accounts/show.rabl b/app/views/api/v1/accounts/show.rabl
index cd267eb00..22cb87f6c 100644
--- a/app/views/api/v1/accounts/show.rabl
+++ b/app/views/api/v1/accounts/show.rabl
@@ -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) }
diff --git a/app/views/api/v1/media/create.rabl b/app/views/api/v1/media/create.rabl
index ba1a0c378..0b42e6e3d 100644
--- a/app/views/api/v1/media/create.rabl
+++ b/app/views/api/v1/media/create.rabl
@@ -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) }
diff --git a/app/views/api/v1/statuses/_media.rabl b/app/views/api/v1/statuses/_media.rabl
index 83b986d51..af635dfec 100644
--- a/app/views/api/v1/statuses/_media.rabl
+++ b/app/views/api/v1/statuses/_media.rabl
@@ -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)) }
diff --git a/app/views/stream_entries/_status.html.haml b/app/views/stream_entries/_status.html.haml
index 8d6507623..8169b8178 100644
--- a/app/views/stream_entries/_status.html.haml
+++ b/app/views/stream_entries/_status.html.haml
@@ -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 }
diff --git a/app/views/stream_entries/show.html.haml b/app/views/stream_entries/show.html.haml
index 9a134ab16..1bacaf32b 100644
--- a/app/views/stream_entries/show.html.haml
+++ b/app/views/stream_entries/show.html.haml
@@ -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 }
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index 704f7fe73..61bb52480 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -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'