# frozen_string_literal: true require_relative "boot" require_relative "../lib/custom_static_middleware" 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(ActionDispatch::Static, CustomStaticMiddleware, { /^i\.furry\.cool/ => "/furry.cool/images", /^i\.maidboye\.cafe/ => "/maidboye.cafe/images", %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", }) end end