# frozen_string_literal: true require_relative "boot" require_relative "../lib/middleware/custom_static" require_relative "../lib/middleware/dev_host" require_relative "../lib/middleware/silence_good_job_logging" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) require_relative "default_config" require_relative "local_config" module Websites class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults(7.1) # 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]) # 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") # config.autoload_paths += Dir[Rails.root.join(Rails.root.join("config/routes/**/"))] config.action_controller.action_on_unpermitted_parameters = :raise config.action_dispatch.default_headers.clear config.active_job.queue_adapter = :good_job config.good_job.poll_interval = 10 config.good_job.enable_cron = true config.middleware.insert_before(0, Middleware::DevHost) if Rails.env.development? config.middleware.insert_before(Rails::Rack::Logger, Middleware::SilenceGoodJobLogging) config.middleware.insert_before(ActionDispatch::Static, Middleware::CustomStatic, { /^i\.furry\.cool/ => "/furry.cool/images", /^i\.maid\.gay/ => "/maid.gay/images", %r{^maid\.gay/images} => "/maid.gay", %r{^maid\.gay/screenshots} => "/maid.gay", /^assets\.maid\.gay/ => "/maid.gay/assets", /^i\.oceanic\.ws/ => "/oceanic.ws/images", %r{^yiff\.rest/Blep\.png$} => "/yiff.rest", %r{^yiff\.rocks/mascots} => "/yiff.rocks", %r{^yiff\.media/images} => "/yiff.media", # Favicons %r{^balls\.butts-are\.cool/favicon\.ico} => "/butts-are.cool/custom/balls", %r{^cocks\.butts-are\.cool/favicon\.ico} => "/butts-are.cool/custom/cocks", %r{^knots\.butts-are\.cool/favicon\.ico} => "/butts-are.cool/custom/knots", %r{^sheaths\.butts-are\.cool/favicon\.ico} => "/butts-are.cool/custom/sheaths", %r{^(.*\.)?butts-are\.cool/favicon\.ico} => "/butts-are.cool", %r{^(.*\.)?e621\.ws/favicon\.ico} => "/e621.ws", %r{^(.*\.)?furry\.cool/favicon\.ico} => "/furry.cool", %r{^(.*\.)?maid\.gay/favicon\.ico} => "/maid.gay", %r{^(.*\.)?oceanic\.ws/favicon\.ico} => "/oceanic.ws", %r{^(.*\.)?yiff\.media/favicon\.ico} => "/yiff.media", %r{^(.*\.)?yiff\.rest/favicon\.ico} => "/yiff.media", %r{^(.*\.)?yiff\.rocks/favicon\.ico} => "/yiff.media", }) end end