diff options
author | Eugen <eugen@zeonfederated.com> | 2017-03-15 22:55:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 22:55:22 +0100 |
commit | e245115f47082ffba27205f508301d14e792c369 (patch) | |
tree | 21a77b788dace45b734da6e64f1b0705016192f0 /config | |
parent | 620f70e42c16c324459ca2da52c68f1def8683de (diff) | |
parent | c1124228e857b0e85f5bf927d2c41c7fadfdf955 (diff) |
Merge branch 'master' into mastodon-site-api
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 13 | ||||
-rw-r--r-- | config/environments/production.rb | 7 | ||||
-rw-r--r-- | config/initializers/paperclip.rb | 5 | ||||
-rw-r--r-- | config/initializers/rabl_init.rb | 2 | ||||
-rw-r--r-- | config/initializers/rack-attack.rb | 4 | ||||
-rw-r--r-- | config/locales/en.yml | 11 | ||||
-rw-r--r-- | config/locales/simple_form.en.yml | 1 | ||||
-rw-r--r-- | config/routes.rb | 7 | ||||
-rw-r--r-- | config/settings.yml | 1 |
9 files changed, 38 insertions, 13 deletions
diff --git a/config/application.rb b/config/application.rb index 8da5ade3c..cb009b24c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,12 +2,14 @@ require_relative 'boot' require 'rails/all' -require_relative '../app/lib/exceptions' - # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) +require_relative '../app/lib/exceptions' +require_relative '../lib/paperclip/gif_transcoder' +require_relative '../lib/paperclip/video_transcoder' + Dotenv::Railtie.load module Mastodon @@ -49,12 +51,5 @@ module Mastodon Doorkeeper::AuthorizedApplicationsController.layout 'admin' Doorkeeper::Application.send :include, ApplicationExtension end - - config.action_dispatch.default_headers = { - 'Server' => 'Mastodon', - 'X-Frame-Options' => 'DENY', - 'X-Content-Type-Options' => 'nosniff', - 'X-XSS-Protection' => '1; mode=block', - } end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 67ff63914..dc5dd4afd 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -109,4 +109,11 @@ Rails.application.configure do config.to_prepare do StatsD.backend = StatsD::Instrument::Backends::NullBackend.new if ENV['STATSD_ADDR'].blank? end + + config.action_dispatch.default_headers = { + 'Server' => 'Mastodon', + 'X-Frame-Options' => 'DENY', + 'X-Content-Type-Options' => 'nosniff', + 'X-XSS-Protection' => '1; mode=block', + } end diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 71a7b514e..580a3196e 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -2,6 +2,11 @@ Paperclip.options[:read_timeout] = 60 +Paperclip.interpolates :filename do |attachment, style| + return attachment.original_filename if style == :original + [basename(attachment, style), extension(attachment, style)].delete_if(&:empty?).join('.') +end + if ENV['S3_ENABLED'] == 'true' Aws.eager_autoload!(services: %w(S3)) diff --git a/config/initializers/rabl_init.rb b/config/initializers/rabl_init.rb index 325bf0c78..f7be0c607 100644 --- a/config/initializers/rabl_init.rb +++ b/config/initializers/rabl_init.rb @@ -1,6 +1,6 @@ Rabl.configure do |config| config.cache_all_output = false - config.cache_sources = !!Rails.env.production? + config.cache_sources = Rails.env.production? config.include_json_root = false config.view_paths = [Rails.root.join('app/views')] end diff --git a/config/initializers/rack-attack.rb b/config/initializers/rack-attack.rb index 3f0ee1d7a..70f7846d1 100644 --- a/config/initializers/rack-attack.rb +++ b/config/initializers/rack-attack.rb @@ -1,6 +1,6 @@ class Rack::Attack # Rate limits for the API - throttle('api', limit: 150, period: 5.minutes) do |req| + throttle('api', limit: 300, period: 5.minutes) do |req| req.ip if req.path.match(/\A\/api\/v/) end @@ -11,7 +11,7 @@ class Rack::Attack headers = { 'X-RateLimit-Limit' => match_data[:limit].to_s, 'X-RateLimit-Remaining' => '0', - 'X-RateLimit-Reset' => (now + (match_data[:period] - now.to_i % match_data[:period])).iso8601(6) + 'X-RateLimit-Reset' => (now + (match_data[:period] - now.to_i % match_data[:period])).iso8601(6), } [429, headers, [{ error: 'Throttled' }.to_json]] diff --git a/config/locales/en.yml b/config/locales/en.yml index 6da30acda..f11a689e4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,6 +29,8 @@ en: unfollow: Unfollow application_mailer: signature: Mastodon notifications from %{instance} + settings: 'Change e-mail preferences: %{link}' + view: 'View:' applications: invalid_url: The provided URL is invalid auth: @@ -83,6 +85,15 @@ en: reblog: body: 'Your status was boosted by %{name}:' subject: "%{name} boosted your status" + digest: + subject: + one: "1 new notification since your last visit 🐘" + other: "%{count} new notifications since your last visit 🐘" + body: 'Here is a brief summary of what you missed on %{instance} since your last visit on %{since}:' + mention: "%{name} mentioned you in:" + new_followers_summary: + one: You have acquired one new follower! Yay! + other: You have gotten %{count} new followers! Amazing! pagination: next: Next prev: Prev diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 4d1758f82..170af01cf 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -34,6 +34,7 @@ en: follow_request: Send e-mail when someone requests to follow you mention: Send e-mail when someone mentions you reblog: Send e-mail when someone reblogs your status + digest: Send digest e-mails 'no': 'No' required: mark: "*" diff --git a/config/routes.rb b/config/routes.rb index 4595b4ba3..1a2e3c19d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -127,6 +127,7 @@ Rails.application.routes.draw do resources :media, only: [:create] resources :apps, only: [:create] resources :blocks, only: [:index] + resources :mutes, only: [:index] resources :favourites, only: [:index] resources :reports, only: [:index, :create] resources :site, only: [:index] @@ -153,7 +154,6 @@ Rails.application.routes.draw do member do get :statuses - get 'statuses/media', to: 'accounts#media_statuses', as: :media_statuses get :followers get :following @@ -161,6 +161,8 @@ Rails.application.routes.draw do post :unfollow post :block post :unblock + post :mute + post :unmute end end end @@ -178,5 +180,8 @@ Rails.application.routes.draw do root 'home#index' + get '/:username', to: redirect('/users/%{username}') + get '/:username/:id', to: redirect('/users/%{username}/updates/%{id}') + match '*unmatched_route', via: :all, to: 'application#raise_not_found' end diff --git a/config/settings.yml b/config/settings.yml index 71ce12e63..6ae9217a4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -11,6 +11,7 @@ defaults: &defaults favourite: false mention: false follow_request: true + digest: true interactions: must_be_follower: false must_be_following: false |