1
0

application.rb 3.0 KB

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