Sha256: f61c80f276e5f2b79ef31f36290f5bcf7fb648cd08b7b0f0e6cbcb7a06046b88

Contents?: true

Size: 818 Bytes

Versions: 22

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

class Rails::ApplicationController < ActionController::Base # :nodoc:
  self.view_paths = File.expand_path("templates", __dir__)
  layout "application"

  before_action :disable_content_security_policy_nonce!

  content_security_policy do |policy|
    policy.script_src :self, :unsafe_inline
    policy.style_src :self, :unsafe_inline
  end

  private
    def require_local!
      unless local_request?
        render html: "<p>For security purposes, this information is only available to local requests.</p>".html_safe, status: :forbidden
      end
    end

    def local_request?
      Rails.application.config.consider_all_requests_local || request.local?
    end

    def disable_content_security_policy_nonce!
      request.content_security_policy_nonce_generator = nil
    end
end

Version data entries

22 entries across 20 versions & 2 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.3.1/lib/rails/application_controller.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.2.3/lib/rails/application_controller.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/railties-7.0.3.1/lib/rails/application_controller.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/railties-7.0.2.3/lib/rails/application_controller.rb
railties-7.0.4.3 lib/rails/application_controller.rb
railties-7.0.4.2 lib/rails/application_controller.rb
railties-7.0.4.1 lib/rails/application_controller.rb
railties-7.0.4 lib/rails/application_controller.rb
railties-7.0.3.1 lib/rails/application_controller.rb
railties-7.0.3 lib/rails/application_controller.rb
railties-7.0.2.4 lib/rails/application_controller.rb
railties-7.0.2.3 lib/rails/application_controller.rb
railties-7.0.2.2 lib/rails/application_controller.rb
railties-7.0.2.1 lib/rails/application_controller.rb
railties-7.0.2 lib/rails/application_controller.rb
railties-7.0.1 lib/rails/application_controller.rb
railties-7.0.0 lib/rails/application_controller.rb
railties-7.0.0.rc3 lib/rails/application_controller.rb
railties-7.0.0.rc2 lib/rails/application_controller.rb
railties-7.0.0.rc1 lib/rails/application_controller.rb