application.rb 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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/paperclip/type_corrector'
  11. require_relative '../lib/mastodon/snowflake'
  12. require_relative '../lib/mastodon/version'
  13. require_relative '../lib/devise/two_factor_ldap_authenticatable'
  14. require_relative '../lib/devise/two_factor_pam_authenticatable'
  15. require_relative '../lib/chewy/strategy/custom_sidekiq'
  16. Dotenv::Railtie.load
  17. Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true'
  18. require_relative '../lib/mastodon/redis_config'
  19. module Mastodon
  20. class Application < Rails::Application
  21. # Initialize configuration defaults for originally generated Rails version.
  22. config.load_defaults 5.2
  23. # Settings in config/environments/* take precedence over those specified here.
  24. # Application configuration should go into files in config/initializers
  25. # -- all .rb files in that directory are automatically loaded.
  26. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  27. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  28. # config.time_zone = 'Central Time (US & Canada)'
  29. # All translations from config/locales/*.rb,yml are auto loaded.
  30. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  31. config.i18n.available_locales = [
  32. :ar,
  33. :ast,
  34. :bg,
  35. :bn,
  36. :br,
  37. :ca,
  38. :co,
  39. :cs,
  40. :cy,
  41. :da,
  42. :de,
  43. :el,
  44. :en,
  45. :eo,
  46. :'es-AR',
  47. :es,
  48. :et,
  49. :eu,
  50. :fa,
  51. :fi,
  52. :fr,
  53. :ga,
  54. :gl,
  55. :he,
  56. :hi,
  57. :hr,
  58. :hu,
  59. :hy,
  60. :id,
  61. :io,
  62. :it,
  63. :ja,
  64. :ka,
  65. :kk,
  66. :ko,
  67. :lt,
  68. :lv,
  69. :mk,
  70. :ms,
  71. :nl,
  72. :nn,
  73. :no,
  74. :oc,
  75. :pl,
  76. :'pt-BR',
  77. :'pt-PT',
  78. :ro,
  79. :ru,
  80. :sk,
  81. :sl,
  82. :sq,
  83. :'sr-Latn',
  84. :sr,
  85. :sv,
  86. :ta,
  87. :te,
  88. :th,
  89. :tr,
  90. :uk,
  91. :'zh-CN',
  92. :'zh-HK',
  93. :'zh-TW',
  94. ]
  95. config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
  96. unless config.i18n.available_locales.include?(config.i18n.default_locale)
  97. config.i18n.default_locale = :en
  98. end
  99. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  100. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  101. config.active_job.queue_adapter = :sidekiq
  102. config.middleware.use Rack::Attack
  103. config.middleware.use Rack::Deflater
  104. config.to_prepare do
  105. Doorkeeper::AuthorizationsController.layout 'modal'
  106. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  107. Doorkeeper::Application.send :include, ApplicationExtension
  108. Devise::FailureApp.send :include, AbstractController::Callbacks
  109. Devise::FailureApp.send :include, HttpAcceptLanguage::EasyAccess
  110. Devise::FailureApp.send :include, Localized
  111. end
  112. end
  113. end