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.

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