2023-07-12 03:47:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-17 11:56:23 -04:00
|
|
|
require_relative 'boot'
|
2016-02-20 16:53:20 -05:00
|
|
|
|
2021-09-13 12:59:56 -04:00
|
|
|
require 'rails'
|
|
|
|
|
|
|
|
require 'active_record/railtie'
|
2023-10-03 09:24:12 -04:00
|
|
|
# require 'active_storage/engine'
|
2021-09-13 12:59:56 -04:00
|
|
|
require 'action_controller/railtie'
|
|
|
|
require 'action_view/railtie'
|
|
|
|
require 'action_mailer/railtie'
|
|
|
|
require 'active_job/railtie'
|
2023-10-03 09:24:12 -04:00
|
|
|
# require 'action_cable/engine'
|
|
|
|
# require 'action_mailbox/engine'
|
|
|
|
# require 'action_text/engine'
|
|
|
|
# require 'rails/test_unit/railtie'
|
2021-09-13 12:59:56 -04:00
|
|
|
|
|
|
|
# Used to be implicitly required in action_mailbox/engine
|
|
|
|
require 'mail'
|
2016-02-20 16:53:20 -05:00
|
|
|
|
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
|
|
|
Bundler.require(*Rails.groups)
|
|
|
|
|
2021-03-18 21:42:43 -04:00
|
|
|
require_relative '../lib/exceptions'
|
|
|
|
require_relative '../lib/sanitize_ext/sanitize_config'
|
2020-07-01 13:05:21 -04:00
|
|
|
require_relative '../lib/redis/namespace_extensions'
|
2020-03-26 10:09:16 -04:00
|
|
|
require_relative '../lib/paperclip/url_generator_extensions'
|
2020-03-08 18:56:18 -04:00
|
|
|
require_relative '../lib/paperclip/attachment_extensions'
|
2018-02-20 21:40:12 -05:00
|
|
|
require_relative '../lib/paperclip/lazy_thumbnail'
|
2017-03-04 16:17:10 -05:00
|
|
|
require_relative '../lib/paperclip/gif_transcoder'
|
2023-07-06 09:05:05 -04:00
|
|
|
require_relative '../lib/paperclip/media_type_spoof_detector_extensions'
|
2021-05-05 13:44:01 -04:00
|
|
|
require_relative '../lib/paperclip/transcoder'
|
2019-06-20 04:52:36 -04:00
|
|
|
require_relative '../lib/paperclip/type_corrector'
|
2020-06-30 17:58:02 -04:00
|
|
|
require_relative '../lib/paperclip/response_with_limit_adapter'
|
2021-05-05 13:44:01 -04:00
|
|
|
require_relative '../lib/terrapin/multi_pipe_extensions'
|
2017-10-08 11:34:34 -04:00
|
|
|
require_relative '../lib/mastodon/snowflake'
|
2017-04-20 21:30:59 -04:00
|
|
|
require_relative '../lib/mastodon/version'
|
2022-04-28 11:47:34 -04:00
|
|
|
require_relative '../lib/mastodon/rack_middleware'
|
2023-03-15 21:55:54 -04:00
|
|
|
require_relative '../lib/public_file_server_middleware'
|
2023-11-29 05:10:21 -05:00
|
|
|
require_relative '../lib/devise/strategies/two_factor_ldap_authenticatable'
|
|
|
|
require_relative '../lib/devise/strategies/two_factor_pam_authenticatable'
|
2023-08-14 11:46:16 -04:00
|
|
|
require_relative '../lib/chewy/settings_extensions'
|
|
|
|
require_relative '../lib/chewy/index_extensions'
|
2022-05-18 17:29:14 -04:00
|
|
|
require_relative '../lib/chewy/strategy/mastodon'
|
2023-04-03 09:05:39 -04:00
|
|
|
require_relative '../lib/chewy/strategy/bypass_with_warning'
|
2020-11-06 05:56:31 -05:00
|
|
|
require_relative '../lib/webpacker/manifest_extensions'
|
|
|
|
require_relative '../lib/webpacker/helper_extensions'
|
2021-02-10 20:11:30 -05:00
|
|
|
require_relative '../lib/rails/engine_extensions'
|
2021-03-18 21:43:13 -04:00
|
|
|
require_relative '../lib/active_record/database_tasks_extensions'
|
2021-04-11 21:35:58 -04:00
|
|
|
require_relative '../lib/active_record/batches'
|
2022-07-04 20:41:40 -04:00
|
|
|
require_relative '../lib/simple_navigation/item_extensions'
|
2023-08-18 02:18:40 -04:00
|
|
|
require_relative '../lib/http_extensions'
|
2017-03-04 16:17:10 -05:00
|
|
|
|
2016-02-22 12:10:30 -05:00
|
|
|
Dotenv::Railtie.load
|
|
|
|
|
2018-03-19 15:08:56 -04:00
|
|
|
Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true'
|
|
|
|
|
2017-05-22 09:01:02 -04:00
|
|
|
require_relative '../lib/mastodon/redis_config'
|
|
|
|
|
2016-02-20 16:53:20 -05:00
|
|
|
module Mastodon
|
|
|
|
class Application < Rails::Application
|
2018-01-19 14:56:47 -05:00
|
|
|
# Initialize configuration defaults for originally generated Rails version.
|
2023-07-13 03:36:07 -04:00
|
|
|
config.load_defaults 7.0
|
|
|
|
|
2024-01-05 16:57:47 -05:00
|
|
|
config.active_record.marshalling_format_version = 7.1
|
|
|
|
|
2023-10-25 09:56:09 -04:00
|
|
|
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
|
|
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
|
|
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
|
|
# config.autoload_lib(ignore: %w(assets tasks templates generators))
|
|
|
|
# TODO: We should enable this eventually, but for now there are many things
|
|
|
|
# in the wrong path from the perspective of zeitwerk.
|
2018-01-19 14:56:47 -05:00
|
|
|
|
2023-10-25 09:56:09 -04:00
|
|
|
# Configuration for the application, engines, and railties goes here.
|
|
|
|
#
|
|
|
|
# These settings can be overridden in specific environments using the files
|
|
|
|
# in config/environments, which are processed later.
|
|
|
|
#
|
|
|
|
# config.time_zone = "Central Time (US & Canada)"
|
|
|
|
# config.eager_load_paths << Rails.root.join("extras")
|
2016-02-20 16:53:20 -05:00
|
|
|
|
2016-10-14 17:10:07 -04:00
|
|
|
# config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
|
|
|
|
# config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
2016-03-07 06:42:33 -05:00
|
|
|
|
2016-03-24 21:50:48 -04:00
|
|
|
config.active_job.queue_adapter = :sidekiq
|
2023-07-21 15:12:57 -04:00
|
|
|
|
2022-11-09 20:31:09 -05:00
|
|
|
config.action_mailer.deliver_later_queue_name = 'mailers'
|
2023-10-23 13:58:29 -04:00
|
|
|
config.action_mailer.preview_paths << Rails.root.join('spec', 'mailers', 'previews')
|
2016-03-24 21:50:48 -04:00
|
|
|
|
2023-03-15 21:55:54 -04:00
|
|
|
# We use our own middleware for this
|
|
|
|
config.public_file_server.enabled = false
|
|
|
|
|
2023-11-07 05:44:15 -05:00
|
|
|
config.middleware.use PublicFileServerMiddleware if Rails.env.local? || ENV['RAILS_SERVE_STATIC_FILES'] == 'true'
|
2016-03-19 09:57:30 -04:00
|
|
|
config.middleware.use Rack::Attack
|
2022-04-28 11:47:34 -04:00
|
|
|
config.middleware.use Mastodon::RackMiddleware
|
2016-08-24 11:56:44 -04:00
|
|
|
|
2023-10-23 13:58:29 -04:00
|
|
|
initializer :deprecator do |app|
|
|
|
|
app.deprecators[:mastodon] = ActiveSupport::Deprecation.new('4.3', 'mastodon/mastodon')
|
|
|
|
end
|
|
|
|
|
2016-10-02 17:46:25 -04:00
|
|
|
config.to_prepare do
|
2017-08-04 22:24:58 -04:00
|
|
|
Doorkeeper::AuthorizationsController.layout 'modal'
|
2017-01-27 21:56:10 -05:00
|
|
|
Doorkeeper::AuthorizedApplicationsController.layout 'admin'
|
2023-07-12 04:02:32 -04:00
|
|
|
Doorkeeper::Application.include ApplicationExtension
|
|
|
|
Doorkeeper::AccessToken.include AccessTokenExtension
|
|
|
|
Devise::FailureApp.include AbstractController::Callbacks
|
|
|
|
Devise::FailureApp.include Localized
|
2016-10-02 17:46:25 -04:00
|
|
|
end
|
2016-02-20 16:53:20 -05:00
|
|
|
end
|
|
|
|
end
|