about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/initializers/chewy.rb6
-rw-r--r--config/initializers/paperclip.rb22
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/routes.rb4
4 files changed, 29 insertions, 4 deletions
diff --git a/config/initializers/chewy.rb b/config/initializers/chewy.rb
index 9ff0dccc1..18d2f18c1 100644
--- a/config/initializers/chewy.rb
+++ b/config/initializers/chewy.rb
@@ -23,3 +23,9 @@ module Chewy
     end
   end
 end
+
+# ElasticSearch uses Faraday internally. Faraday interprets the
+# http_proxy env variable by default which leads to issues when
+# Mastodon is run with hidden services enabled, because
+# ElasticSearch is *not* supposed to be accessed through a proxy
+Faraday.ignore_env_proxy = true
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index 8909678d6..0dd7f8cf8 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -10,9 +10,25 @@ Paperclip.interpolates :filename do |attachment, style|
   end
 end
 
+Paperclip.interpolates :prefix_path do |attachment, style|
+  if attachment.storage_schema_version >= 1 && attachment.instance.respond_to?(:local?) && !attachment.instance.local?
+    'cache' + File::SEPARATOR
+  else
+    ''
+  end
+end
+
+Paperclip.interpolates :prefix_url do |attachment, style|
+  if attachment.storage_schema_version >= 1 && attachment.instance.respond_to?(:local?) && !attachment.instance.local?
+    'cache/'
+  else
+    ''
+  end
+end
+
 Paperclip::Attachment.default_options.merge!(
   use_timestamp: false,
-  path: ':class/:attachment/:id_partition/:style/:filename',
+  path: ':prefix_url:class/:attachment/:id_partition/:style/:filename',
   storage: :fog
 )
 
@@ -91,7 +107,7 @@ else
   Paperclip::Attachment.default_options.merge!(
     storage: :filesystem,
     use_timestamp: true,
-    path: File.join(ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')), ':class', ':attachment', ':id_partition', ':style', ':filename'),
-    url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + '/:class/:attachment/:id_partition/:style/:filename',
+    path: File.join(ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')), ':prefix_path:class', ':attachment', ':id_partition', ':style', ':filename'),
+    url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + '/:prefix_url:class/:attachment/:id_partition/:style/:filename',
   )
 end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5a4302606..edb7bb684 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -648,6 +648,7 @@ en:
     add_new: Create alias
     created_msg: Successfully created a new alias. You can now initiate the move from the old account.
     deleted_msg: Successfully remove the alias. Moving from that account to this one will no longer be possible.
+    empty: You have no aliases.
     hint_html: If you want to move from another account to this one, here you can create an alias, which is required before you can proceed with moving followers from the old account to this one. This action by itself is <strong>harmless and reversible</strong>. <strong>The account migration is initiated from the old account</strong>.
     remove: Unlink alias
   appearance:
diff --git a/config/routes.rb b/config/routes.rb
index 450d3222f..2ebe12f5c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -100,7 +100,9 @@ Rails.application.routes.draw do
   get '/settings', to: redirect('/settings/profile')
 
   namespace :settings do
-    resource :profile, only: [:show, :update]
+    resource :profile, only: [:show, :update] do
+      resources :pictures, only: :destroy
+    end
 
     get :preferences, to: redirect('/settings/preferences/appearance')