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.

84 lines
2.6 KiB

8 years ago
8 years ago
8 years ago
7 years ago
7 years ago
8 years ago
  1. require_relative 'boot'
  2. require 'rails/all'
  3. # Require the gems listed in Gemfile, including any gems
  4. # you've limited to :test, :development, or :production.
  5. Bundler.require(*Rails.groups)
  6. require_relative '../app/lib/exceptions'
  7. require_relative '../lib/paperclip/gif_transcoder'
  8. require_relative '../lib/paperclip/video_transcoder'
  9. require_relative '../lib/mastodon/version'
  10. Dotenv::Railtie.load
  11. module Mastodon
  12. class Application < Rails::Application
  13. # Settings in config/environments/* take precedence over those specified here.
  14. # Application configuration should go into files in config/initializers
  15. # -- all .rb files in that directory are automatically loaded.
  16. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  17. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  18. # config.time_zone = 'Central Time (US & Canada)'
  19. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  20. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  21. config.i18n.available_locales = [
  22. :en,
  23. :bg,
  24. :de,
  25. :eo,
  26. :es,
  27. :fi,
  28. :fr,
  29. :hr,
  30. :id,
  31. :hu,
  32. :id,
  33. :io,
  34. :it,
  35. :ja,
  36. :nl,
  37. :no,
  38. :oc,
  39. :pl,
  40. :pt,
  41. :'pt-BR',
  42. :ru,
  43. :uk,
  44. :'zh-CN',
  45. :'zh-HK',
  46. :'zh-TW',
  47. ]
  48. config.i18n.default_locale = :en
  49. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  50. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  51. config.active_job.queue_adapter = :sidekiq
  52. config.middleware.insert_before 0, Rack::Cors do
  53. allow do
  54. origins '*'
  55. resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
  56. resource '/oauth/token', headers: :any, methods: [:post], credentials: false
  57. end
  58. end
  59. config.middleware.use Rack::Attack
  60. config.middleware.use Rack::Deflater
  61. config.browserify_rails.commandline_options = '--transform [ babelify --presets [ es2015 react ] --plugins [ transform-decorators-legacy ] ] --extension=".jsx"'
  62. config.browserify_rails.evaluate_node_modules = true
  63. config.to_prepare do
  64. Doorkeeper::AuthorizationsController.layout 'public'
  65. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  66. Doorkeeper::Application.send :include, ApplicationExtension
  67. end
  68. end
  69. end