Merge branch 'master' into mastodon-site-api
This commit is contained in:
commit
e245115f47
109 changed files with 1572 additions and 358 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: "*"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,6 +11,7 @@ defaults: &defaults
|
|||
favourite: false
|
||||
mention: false
|
||||
follow_request: true
|
||||
digest: true
|
||||
interactions:
|
||||
must_be_follower: false
|
||||
must_be_following: false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue