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.

91 lines
2.6 KiB

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 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/snowflake'
  10. require_relative '../lib/mastodon/version'
  11. Dotenv::Railtie.load
  12. require_relative '../lib/mastodon/redis_config'
  13. module Mastodon
  14. class Application < Rails::Application
  15. # Settings in config/environments/* take precedence over those specified here.
  16. # Application configuration should go into files in config/initializers
  17. # -- all .rb files in that directory are automatically loaded.
  18. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  19. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  20. # config.time_zone = 'Central Time (US & Canada)'
  21. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  22. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  23. config.i18n.available_locales = [
  24. :en,
  25. :ar,
  26. :bg,
  27. :ca,
  28. :de,
  29. :eo,
  30. :es,
  31. :fa,
  32. :fi,
  33. :fr,
  34. :he,
  35. :hr,
  36. :hu,
  37. :id,
  38. :io,
  39. :it,
  40. :ja,
  41. :ko,
  42. :nl,
  43. :no,
  44. :oc,
  45. :pl,
  46. :pt,
  47. :'pt-BR',
  48. :ru,
  49. :sv,
  50. :th,
  51. :tr,
  52. :uk,
  53. :'zh-CN',
  54. :'zh-HK',
  55. :'zh-TW',
  56. ]
  57. config.i18n.default_locale = :en
  58. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  59. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  60. config.active_job.queue_adapter = :sidekiq
  61. config.middleware.insert_before 0, Rack::Cors do
  62. allow do
  63. origins '*'
  64. resource '/@:username', headers: :any, methods: [:get], credentials: false
  65. resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :patch, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
  66. resource '/oauth/token', headers: :any, methods: [:post], credentials: false
  67. end
  68. end
  69. config.middleware.use Rack::Attack
  70. config.middleware.use Rack::Deflater
  71. config.to_prepare do
  72. Doorkeeper::AuthorizationsController.layout 'modal'
  73. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  74. Doorkeeper::Application.send :include, ApplicationExtension
  75. end
  76. end
  77. end