application.rb 3.4 KB

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