闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.6 KiB

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