# frozen_string_literal: true require_relative "boot" require_relative "../lib/middleware/custom_static" require_relative "../lib/middleware/dev_host" 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.middleware.insert_before(0, Middleware::DevHost) if Rails.env.development? config.middleware.insert_before(ActionDispatch::Static, Middleware::CustomStatic, { /^i\.furry\.cool/ => "/furry.cool/images", /^i\.maidboye\.cafe/ => "/maidboye.cafe/images", %r{^maidboye\.cafe/images} => "/maidboye.cafe", %r{^maidboye\.cafe/screenshots} => "/maidboye.cafe", /^assets\.maidboye\.cafe/ => "/maidboye.cafe/assets", /^i\.oceanic\.ws/ => "/oceanic.ws/images", %r{^yiff\.rest/Blep\.png$} => "/yiff.rest", %r{^yiff\.rocks/mascots} => "/yiff.rocks", # 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{^(.*\.)?maidboye\.cafe/favicon\.ico} => "/maidboye.cafe", %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