application.rb 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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-AR',
  49. :es,
  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-Latn',
  91. :sr,
  92. :sv,
  93. :ta,
  94. :te,
  95. :th,
  96. :tr,
  97. :uk,
  98. :ur,
  99. :'zh-CN',
  100. :'zh-HK',
  101. :'zh-TW',
  102. ]
  103. config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
  104. unless config.i18n.available_locales.include?(config.i18n.default_locale)
  105. config.i18n.default_locale = :en
  106. end
  107. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  108. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  109. config.active_job.queue_adapter = :sidekiq
  110. config.middleware.use Rack::Attack
  111. config.middleware.use Rack::Deflater
  112. config.to_prepare do
  113. Doorkeeper::AuthorizationsController.layout 'modal'
  114. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  115. Doorkeeper::Application.send :include, ApplicationExtension
  116. Devise::FailureApp.send :include, AbstractController::Callbacks
  117. Devise::FailureApp.send :include, HttpAcceptLanguage::EasyAccess
  118. Devise::FailureApp.send :include, Localized
  119. end
  120. end
  121. end