闭社主体 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.

80 lines
2.5 KiB

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/gif_transcoder'
  8. require_relative '../lib/paperclip/video_transcoder'
  9. Dotenv::Railtie.load
  10. module Mastodon
  11. class Application < Rails::Application
  12. # Settings in config/environments/* take precedence over those specified here.
  13. # Application configuration should go into files in config/initializers
  14. # -- all .rb files in that directory are automatically loaded.
  15. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  16. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  17. # config.time_zone = 'Central Time (US & Canada)'
  18. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  19. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  20. config.i18n.available_locales = [
  21. :en,
  22. :bg,
  23. :de,
  24. :eo,
  25. :es,
  26. :fi,
  27. :fr,
  28. :hr,
  29. :hu,
  30. :it,
  31. :ja,
  32. :nl,
  33. :no,
  34. :oc,
  35. :pt,
  36. :'pt-BR',
  37. :ru,
  38. :uk,
  39. 'zh-CN',
  40. :'zh-HK',
  41. :'zh-TW',
  42. ]
  43. config.i18n.default_locale = :en
  44. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  45. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  46. config.active_job.queue_adapter = :sidekiq
  47. config.middleware.insert_before 0, Rack::Cors do
  48. allow do
  49. origins '*'
  50. resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
  51. resource '/oauth/token', headers: :any, methods: [:post], credentials: false
  52. end
  53. end
  54. config.middleware.use Rack::Attack
  55. config.middleware.use Rack::Deflater
  56. config.browserify_rails.source_map_environments << 'development'
  57. config.browserify_rails.commandline_options = '--transform [ babelify --presets [ es2015 react ] ] --extension=".jsx"'
  58. config.browserify_rails.evaluate_node_modules = true
  59. config.to_prepare do
  60. Doorkeeper::AuthorizationsController.layout 'public'
  61. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  62. Doorkeeper::Application.send :include, ApplicationExtension
  63. end
  64. end
  65. end