The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

136 行
3.4 KiB

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