lib/web_console/request.rb in web-console-2.3.0 vs lib/web_console/request.rb in web-console-3.0.0

- old
+ new

@@ -3,28 +3,28 @@ class Request < ActionDispatch::Request # Configurable set of whitelisted networks. cattr_accessor :whitelisted_ips @@whitelisted_ips = Whitelist.new - # Define a vendor MIME type. We can call it using Mime::WEB_CONSOLE_V2 constant. + # Define a vendor MIME type. We can call it using Mime[:web_console_v2]. Mime::Type.register 'application/vnd.web-console.v2', :web_console_v2 # Returns whether a request came from a whitelisted IP. # # For a request to hit Web Console features, it needs to come from a white # listed IP. - def from_whitelited_ip? + def from_whitelisted_ip? whitelisted_ips.include?(strict_remote_ip) end # Determines the remote IP using our much stricter whitelist. def strict_remote_ip GetSecureIp.new(self, whitelisted_ips).to_s end # Returns whether the request is acceptable. def acceptable? - xhr? && accepts.any? { |mime| Mime::WEB_CONSOLE_V2 == mime } + xhr? && accepts.any? { |mime| Mime[:web_console_v2] == mime } end private class GetSecureIp < ActionDispatch::RemoteIp::GetIp