闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.1 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. require_relative 'boot'
  2. require 'rails/all'
  3. require_relative '../app/lib/exceptions'
  4. # Require the gems listed in Gemfile, including any gems
  5. # you've limited to :test, :development, or :production.
  6. Bundler.require(*Rails.groups)
  7. Dotenv::Railtie.load
  8. module Mastodon
  9. class Application < Rails::Application
  10. # Settings in config/environments/* take precedence over those specified here.
  11. # Application configuration should go into files in config/initializers
  12. # -- all .rb files in that directory are automatically loaded.
  13. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  14. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  15. # config.time_zone = 'Central Time (US & Canada)'
  16. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  17. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  18. config.i18n.available_locales = [:en, :de, :es, :pt, :fr, :hu, :uk]
  19. config.i18n.default_locale = :en
  20. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  21. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  22. config.active_job.queue_adapter = :sidekiq
  23. config.middleware.insert_before 0, Rack::Cors do
  24. allow do
  25. origins '*'
  26. resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :options], credentials: false
  27. resource '/oauth/token', headers: :any, methods: [:post], credentials: false
  28. end
  29. end
  30. config.middleware.use Rack::Attack
  31. config.middleware.use Rack::Deflater
  32. config.browserify_rails.commandline_options = '--transform [ babelify --presets [ es2015 react ] ] --extension=".jsx"'
  33. config.to_prepare do
  34. Doorkeeper::AuthorizationsController.layout 'public'
  35. end
  36. config.action_dispatch.default_headers = {
  37. 'Server' => 'Mastodon',
  38. 'X-Frame-Options' => 'DENY',
  39. 'X-Content-Type-Options' => 'nosniff',
  40. 'X-XSS-Protection' => '1; mode=block',
  41. }
  42. end
  43. end