The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

109 regels
3.1 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 '../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.1
  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. if config.i18n.available_locales.include?(config.i18n.default_locale)
  69. config.i18n.fallbacks = [:en]
  70. else
  71. config.i18n.default_locale = :en
  72. end
  73. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  74. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  75. config.active_job.queue_adapter = :sidekiq
  76. config.middleware.insert_before 0, Rack::Cors do
  77. allow do
  78. origins '*'
  79. resource '/@:username', headers: :any, methods: [:get], credentials: false
  80. resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :patch, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
  81. resource '/oauth/token', headers: :any, methods: [:post], credentials: false
  82. end
  83. end
  84. config.middleware.use Rack::Attack
  85. config.middleware.use Rack::Deflater
  86. config.to_prepare do
  87. Doorkeeper::AuthorizationsController.layout 'modal'
  88. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  89. Doorkeeper::Application.send :include, ApplicationExtension
  90. end
  91. end
  92. end