Hello community,

here is the log from the commit of package rubygem-web-console for 
openSUSE:Factory checked in at 2019-08-19 21:41:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-web-console (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-web-console.new.22127 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-web-console"

Mon Aug 19 21:41:13 2019 rev:18 rq:724312 version:4.0.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-web-console/rubygem-web-console.changes  
2018-09-20 11:41:50.756842928 +0200
+++ 
/work/SRC/openSUSE:Factory/.rubygem-web-console.new.22127/rubygem-web-console.changes
       2019-08-19 21:41:50.220285185 +0200
@@ -1,0 +2,23 @@
+Sat Aug 17 21:23:16 UTC 2019 - Manuel Schnitzer <[email protected]>
+
+- updated to version 4.0.1
+
+  * [#279](https://github.com/rails/web-console/pull/279) Fix initial 
config.web_console.permissions value ([@patorash])
+
+-------------------------------------------------------------------
+Sun May  5 09:48:16 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to version 4.0.0
+ see installed CHANGELOG.markdown
+
+  ## 4.0.0
+  
+  * 
[|61c](https://github.com/rails/web-console/commit/61ce65b599f56809de1bd8da6590a80acbd92017)
 Move to config.web_console.permissions ([@gsamokovarov])
+  * 
[|961](https://github.com/rails/web-console/commit/96127aac143e1e653fffdc4bb65e1ce0b5ff342d)
 Introduce Binding#console as an alternative interface ([@gsamokovarov])
+  * 
[|d45](https://github.com/rails/web-console/commit/d4591ca5396ed15a08818f3da11134852a485b27)
 Introduce Rails 6 support ([@gsamokovarov])
+  * 
[|f97](https://github.com/rails/web-console/commit/f97d8a889a38366485e5c5e8985995c19bf61d13)
 Introduce Ruby 2.6 support ([@gsamokovarov])
+  * 
[|d6d](https://github.com/rails/web-console/commit/d6deacd9d5fcaabf3e3051d6985b53f924f86956)
 Drop Rails 5 support ([@gsamokovarov])
+  * 
[|90f](https://github.com/rails/web-console/commit/90fda8789d402f05647c18f8cdf8e5c3d01692dd)
 Drop Ruby 2.4 support ([@gsamokovarov])
+  * [#265](https://github.com/rails/web-console/pull/265) Add support for 
nested exceptions ([@yuki24])
+
+-------------------------------------------------------------------

Old:
----
  web-console-3.7.0.gem

New:
----
  web-console-4.0.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-web-console.spec ++++++
--- /var/tmp/diff_new_pack.EdvOGx/_old  2019-08-19 21:41:51.180284996 +0200
+++ /var/tmp/diff_new_pack.EdvOGx/_new  2019-08-19 21:41:51.184284996 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-web-console
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -24,12 +24,12 @@
 #
 
 Name:           rubygem-web-console
-Version:        3.7.0
+Version:        4.0.1
 Release:        0
 %define mod_name web-console
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{ruby >= 2.2.2}
+BuildRequires:  %{ruby >= 2.5}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
 Url:            https://github.com/rails/web-console

++++++ web-console-3.7.0.gem -> web-console-4.0.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.markdown new/CHANGELOG.markdown
--- old/CHANGELOG.markdown      2018-09-02 21:44:49.000000000 +0200
+++ new/CHANGELOG.markdown      2019-08-17 09:10:47.000000000 +0200
@@ -2,6 +2,20 @@
 
 ## master (unreleased)
 
+## 4.0.1
+
+* [#279](https://github.com/rails/web-console/pull/279) Fix initial 
config.web_console.permissions value ([@patorash])
+
+## 4.0.0
+
+* 
[|61c](https://github.com/rails/web-console/commit/61ce65b599f56809de1bd8da6590a80acbd92017)
 Move to config.web_console.permissions ([@gsamokovarov])
+* 
[|961](https://github.com/rails/web-console/commit/96127aac143e1e653fffdc4bb65e1ce0b5ff342d)
 Introduce Binding#console as an alternative interface ([@gsamokovarov])
+* 
[|d45](https://github.com/rails/web-console/commit/d4591ca5396ed15a08818f3da11134852a485b27)
 Introduce Rails 6 support ([@gsamokovarov])
+* 
[|f97](https://github.com/rails/web-console/commit/f97d8a889a38366485e5c5e8985995c19bf61d13)
 Introduce Ruby 2.6 support ([@gsamokovarov])
+* 
[|d6d](https://github.com/rails/web-console/commit/d6deacd9d5fcaabf3e3051d6985b53f924f86956)
 Drop Rails 5 support ([@gsamokovarov])
+* 
[|90f](https://github.com/rails/web-console/commit/90fda8789d402f05647c18f8cdf8e5c3d01692dd)
 Drop Ruby 2.4 support ([@gsamokovarov])
+* [#265](https://github.com/rails/web-console/pull/265) Add support for nested 
exceptions ([@yuki24])
+
 ## 3.7.0
 
 * [#263](https://github.com/rails/web-console/pull/263) Show binding changes 
([@causztic])
@@ -138,3 +152,5 @@
 [@fl0l0u]: https://github.com/fl0l0u
 [@timomeh]: https://github.com/timomeh
 [@causztic]: https://github.com/causztic
+[@yuki24]: https://github.com/yuki24
+[@patorash]: https://github.com/patorash
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.markdown new/README.markdown
--- old/README.markdown 2018-09-02 21:44:49.000000000 +0200
+++ new/README.markdown 2019-08-17 09:10:47.000000000 +0200
@@ -16,7 +16,7 @@
 
 ## Installation
 
-Add the following to your `Gemfile`.
+Add the following to your `Gemfile`:
 
 ```ruby
 group :development do
@@ -27,8 +27,8 @@
 ## Usage
 
 The web console allows you to create an interactive Ruby session in your
-browser. Those sessions are launched automatically in case of an error, but
-they can also be launched manually in any page.
+browser. Those sessions are launched automatically in case of an error and can
+also be launched manually in any page.
 
 For example, calling `console` in a view will display a console in the current
 page in the context of the view binding.
@@ -56,30 +56,30 @@
 
 ## Configuration
 
-_Web Console_ allows you to execute arbitrary code on the server, so you
-should be very careful, who you give access to.
+_Web Console_ allows you to execute arbitrary code on the server. Therefore, be
+very careful who you give access to.
 
-### config.web_console.whitelisted_ips
+### config.web_console.permissions
 
 By default, only requests coming from IPv4 and IPv6 localhosts are allowed.
 
-`config.web_console.whitelisted_ips` lets you control which IP's have access to
+`config.web_console.permissions` lets you control which IP's have access to
 the console.
 
 You can whitelist single IP's or whole networks. Say you want to share your
-console with `192.168.0.100`. You can do this:
+console with `192.168.0.100`:
 
 ```ruby
 class Application < Rails::Application
-  config.web_console.whitelisted_ips = '192.168.0.100'
+  config.web_console.permissions = '192.168.0.100'
 end
 ```
 
-If you want to whitelist the whole private network, you can do:
+If you want to whitelist the whole private network:
 
 ```ruby
 Rails.application.configure do
-  config.web_console.whitelisted_ips = '192.168.0.0/16'
+  config.web_console.permissions = '192.168.0.0/16'
 end
 ```
 
@@ -88,8 +88,8 @@
 
 ### config.web_console.whiny_requests
 
-When a console cannot be shown for a given IP address or content type, a
-messages like the following is printed in the server logs:
+When a console cannot be shown for a given IP address or content type,
+messages such as the following is printed in the server logs:
 
 > Cannot render console from 192.168.1.133! Allowed networks:
 > 127.0.0.0/127.255.255.255, ::1
@@ -104,7 +104,7 @@
 
 ### config.web_console.template_paths
 
-If you want to style the console yourself, you can place `style.css` at a
+If you want to style the console yourself, then you can place `style.css` at a
 directory pointed by `config.web_console.template_paths`:
 
 ```ruby
@@ -119,8 +119,8 @@
 ### config.web_console.mount_point
 
 Usually the middleware of _Web Console_ is mounted at `/__web_console`.
-If you want to change the path for some reasons, you can specify it
-by `config.web_console.mount_point`:
+If there is a need to change the path, then you can specify it by
+`config.web_console.mount_point`:
 
 ```ruby
 Rails.application.configure do
@@ -132,7 +132,7 @@
 
 ### Where did /console go?
 
-The remote terminal emulator was extracted in its own gem that is no longer
+The remote terminal emulator was extracted in its own gem which is no longer
 bundled with _Web Console_.
 
 If you miss this feature, check out [rvt].
@@ -140,11 +140,11 @@
 ### Why do I constantly get unavailable session errors?
 
 All of _Web Console_ sessions are stored in memory. If you happen to run on a
-multi-process server (like Unicorn) you may get unavailable session errors
+multi-process server (like Unicorn), you may encounter unavailable session 
errors
 while the server is still running. This is because a request may hit a
 different worker (process) that doesn't have the desired session in memory.
 To avoid that, if you use such servers in development, configure them so they
-server requests only out of one process.
+serve requests only out of one process.
 
 #### Passenger
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/evaluator.rb 
new/lib/web_console/evaluator.rb
--- old/lib/web_console/evaluator.rb    2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/evaluator.rb    2019-08-17 09:10:47.000000000 +0200
@@ -8,9 +8,11 @@
   # return a string and will format exception output.
   class Evaluator
     # Cleanses exceptions raised inside #eval.
-    cattr_reader :cleaner
-    @@cleaner = ActiveSupport::BacktraceCleaner.new
-    @@cleaner.add_silencer { |line| line.start_with?(File.expand_path("..", 
__FILE__)) }
+    cattr_reader :cleaner, default: begin
+      cleaner = ActiveSupport::BacktraceCleaner.new
+      cleaner.add_silencer { |line| line.start_with?(File.expand_path("..", 
__FILE__)) }
+      cleaner
+    end
 
     def initialize(binding = TOPLEVEL_BINDING)
       @binding = binding
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/exception_mapper.rb 
new/lib/web_console/exception_mapper.rb
--- old/lib/web_console/exception_mapper.rb     2018-09-02 21:44:49.000000000 
+0200
+++ new/lib/web_console/exception_mapper.rb     2019-08-17 09:10:47.000000000 
+0200
@@ -2,9 +2,28 @@
 
 module WebConsole
   class ExceptionMapper
+    attr_reader :exc
+
+    def self.follow(exc)
+      mappers = [new(exc)]
+
+      while cause = (cause || exc).cause
+        mappers << new(cause)
+      end
+
+      mappers
+    end
+
+    def self.find_binding(mappers, exception_object_id)
+      mappers.detect do |exception_mapper|
+        exception_mapper.exc.object_id == exception_object_id.to_i
+      end || mappers.first
+    end
+
     def initialize(exception)
       @backtrace = exception.backtrace
       @bindings = exception.bindings
+      @exc = exception
     end
 
     def first
@@ -22,13 +41,15 @@
         line = line.to_i
 
         @bindings.find do |binding|
-          binding.eval("__FILE__") == file && binding.eval("__LINE__") == line
+          source_location = SourceLocation.new(binding)
+          source_location.path == file && source_location.lineno == line
         end
       end
 
       def guess_the_first_application_binding
         @bindings.find do |binding|
-          binding.eval("__FILE__").to_s.start_with?(Rails.root.to_s)
+          source_location = SourceLocation.new(binding)
+          source_location.path.to_s.start_with?(Rails.root.to_s)
         end
       end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/extensions.rb 
new/lib/web_console/extensions.rb
--- old/lib/web_console/extensions.rb   2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/extensions.rb   2019-08-17 09:10:47.000000000 +0200
@@ -8,8 +8,8 @@
   # If +binding+ isn't explicitly given it will default to the binding of the
   # previous frame. E.g. the one that invoked +console+.
   #
-  # Raises DoubleRenderError if a double +console+ invocation per request is
-  # detected.
+  # Raises +DoubleRenderError+ if a more than one +console+ invocation per
+  # request is detected.
   def console(binding = Bindex.current_bindings.second)
     raise WebConsole::DoubleRenderError if 
Thread.current[:__web_console_binding]
 
@@ -22,26 +22,13 @@
   end
 end
 
-module ActionDispatch
-  class DebugExceptions
-    def render_exception_with_web_console(request, exception)
-      render_exception_without_web_console(request, exception).tap do
-        backtrace_cleaner = 
request.get_header("action_dispatch.backtrace_cleaner")
-        error = ExceptionWrapper.new(backtrace_cleaner, exception).exception
-
-        # Get the original exception if ExceptionWrapper decides to follow it.
-        Thread.current[:__web_console_exception] = error
-
-        # ActionView::Template::Error bypass ExceptionWrapper original
-        # exception following. The backtrace in the view is generated from
-        # reaching out to original_exception in the view.
-        if error.is_a?(ActionView::Template::Error)
-          Thread.current[:__web_console_exception] = error.cause
-        end
-      end
-    end
-
-    alias_method :render_exception_without_web_console, :render_exception
-    alias_method :render_exception, :render_exception_with_web_console
+class Binding
+  # Instructs Web Console to render a console in the current binding, without
+  # the need to unroll the stack.
+  #
+  # Raises +DoubleRenderError+ if a more than one +console+ invocation per
+  # request is detected.
+  def console
+    Kernel.console(self)
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/interceptor.rb 
new/lib/web_console/interceptor.rb
--- old/lib/web_console/interceptor.rb  1970-01-01 01:00:00.000000000 +0100
+++ new/lib/web_console/interceptor.rb  2019-08-17 09:10:47.000000000 +0200
@@ -0,0 +1,18 @@
+module WebConsole
+  module Interceptor
+    def self.call(request, exception)
+      backtrace_cleaner = 
request.get_header("action_dispatch.backtrace_cleaner")
+      error = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, 
exception).exception
+
+      # Get the original exception if ExceptionWrapper decides to follow it.
+      Thread.current[:__web_console_exception] = error
+
+      # ActionView::Template::Error bypass ExceptionWrapper original
+      # exception following. The backtrace in the view is generated from
+      # reaching out to original_exception in the view.
+      if error.is_a?(ActionView::Template::Error)
+        Thread.current[:__web_console_exception] = error.cause
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/middleware.rb 
new/lib/web_console/middleware.rb
--- old/lib/web_console/middleware.rb   2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/middleware.rb   2019-08-17 09:10:47.000000000 +0200
@@ -6,11 +6,8 @@
   class Middleware
     TEMPLATES_PATH = File.expand_path("../templates", __FILE__)
 
-    cattr_accessor :mount_point
-    @@mount_point = "/__web_console"
-
-    cattr_accessor :whiny_requests
-    @@whiny_requests = true
+    cattr_accessor :mount_point, default: "/__web_console"
+    cattr_accessor :whiny_requests, default: true
 
     def initialize(app)
       @app = app
@@ -19,7 +16,7 @@
     def call(env)
       app_exception = catch :app_exception do
         request = create_regular_or_whiny_request(env)
-        return call_app(env) unless request.from_whitelisted_ip?
+        return call_app(env) unless request.permitted?
 
         if id = id_for_repl_session_update(request)
           return update_repl_session(id, request)
@@ -27,6 +24,7 @@
           return change_stack_trace(id, request)
         end
 
+
         status, headers, body = call_app(env)
 
         if (session = Session.from(Thread.current)) && 
acceptable_content_type?(headers)
@@ -54,7 +52,7 @@
     private
 
       def acceptable_content_type?(headers)
-        Mime::Type.parse(headers["Content-Type"].to_s).first == Mime[:html]
+        headers["Content-Type"].to_s.include?("html")
       end
 
       def json_response(opts = {})
@@ -66,7 +64,6 @@
       end
 
       def json_response_with_session(id, request, opts = {})
-        return respond_with_unacceptable_request unless request.acceptable?
         return respond_with_unavailable_session(id) unless session = 
Session.find(id)
 
         json_response(opts) { yield session }
@@ -113,7 +110,7 @@
 
       def change_stack_trace(id, request)
         json_response_with_session(id, request) do |session|
-          session.switch_binding_to(request.params[:frame_id])
+          session.switch_binding_to(request.params[:frame_id], 
request.params[:exception_object_id])
 
           { ok: true }
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/permissions.rb 
new/lib/web_console/permissions.rb
--- old/lib/web_console/permissions.rb  1970-01-01 01:00:00.000000000 +0100
+++ new/lib/web_console/permissions.rb  2019-08-17 09:10:47.000000000 +0200
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require "ipaddr"
+
+module WebConsole
+  class Permissions
+    # IPv4 and IPv6 localhost should be always whitelisted.
+    ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 )
+
+    def initialize(networks = nil)
+      @networks = 
normalize_networks(networks).map(&method(:coerce_network_to_ipaddr)).uniq
+    end
+
+    def include?(network)
+      @networks.any? { |permission| permission.include?(network.to_s) }
+    rescue IPAddr::InvalidAddressError
+      false
+    end
+
+    def to_s
+      @networks.map(&method(:human_readable_ipaddr)).join(", ")
+    end
+
+    private
+
+      def normalize_networks(networks)
+        Array(networks).concat(ALWAYS_PERMITTED_NETWORKS)
+      end
+
+      def coerce_network_to_ipaddr(network)
+        if network.is_a?(IPAddr)
+          network
+        else
+          IPAddr.new(network)
+        end
+      end
+
+      def human_readable_ipaddr(ipaddr)
+        ipaddr.to_range.to_s.split("..").uniq.join("/")
+      end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/railtie.rb 
new/lib/web_console/railtie.rb
--- old/lib/web_console/railtie.rb      2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/railtie.rb      2019-08-17 09:10:47.000000000 +0200
@@ -5,11 +5,12 @@
 module WebConsole
   class Railtie < ::Rails::Railtie
     config.web_console = ActiveSupport::OrderedOptions.new
-    config.web_console.whitelisted_ips = %w( 127.0.0.1 ::1 )
 
     initializer "web_console.initialize" do
       require "bindex"
       require "web_console/extensions"
+
+      ActionDispatch::DebugExceptions.register_interceptor(Interceptor)
     end
 
     initializer "web_console.development_only" do
@@ -50,10 +51,9 @@
       end
     end
 
-    initializer "web_console.whitelisted_ips" do
-      if whitelisted_ips = config.web_console.whitelisted_ips
-        Request.whitelisted_ips = Whitelist.new(whitelisted_ips)
-      end
+    initializer "web_console.permissions" do
+      permissions = config.web_console.permissions || 
config.web_console.whitelisted_ips
+      Request.permissions = Permissions.new(permissions)
     end
 
     initializer "web_console.whiny_requests" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/request.rb 
new/lib/web_console/request.rb
--- old/lib/web_console/request.rb      2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/request.rb      2019-08-17 09:10:47.000000000 +0200
@@ -1,35 +1,19 @@
 # frozen_string_literal: true
 
 module WebConsole
-  # Web Console tailored request object.
   class Request < ActionDispatch::Request
-    # Configurable set of whitelisted networks.
-    cattr_accessor :whitelisted_ips
-    @@whitelisted_ips = Whitelist.new
+    cattr_accessor :permissions, default: Permissions.new
 
-    # 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_whitelisted_ip?
-      whitelisted_ips.include?(strict_remote_ip)
+    def permitted?
+      permissions.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
+      GetSecureIp.new(self, permissions).to_s
     rescue ActionDispatch::RemoteIp::IpSpoofAttackError
       "[Spoofed]"
     end
 
-    # Returns whether the request is acceptable.
-    def acceptable?
-      xhr? && accepts.any? { |mime| Mime[:web_console_v2] == mime }
-    end
-
     private
 
       class GetSecureIp < ActionDispatch::RemoteIp::GetIp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/session.rb 
new/lib/web_console/session.rb
--- old/lib/web_console/session.rb      2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/session.rb      2019-08-17 09:10:47.000000000 +0200
@@ -11,8 +11,7 @@
   # error pages only, as currently, this is the only client that needs to do
   # that.
   class Session
-    cattr_reader :inmemory_storage
-    @@inmemory_storage = {}
+    cattr_reader :inmemory_storage, default: {}
 
     class << self
       # Finds a persisted session in memory by its id.
@@ -32,9 +31,9 @@
       # storage.
       def from(storage)
         if exc = storage[:__web_console_exception]
-          new(ExceptionMapper.new(exc))
+          new(ExceptionMapper.follow(exc))
         elsif binding = storage[:__web_console_binding]
-          new([binding])
+          new([[binding]])
         end
       end
     end
@@ -42,10 +41,11 @@
     # An unique identifier for every REPL.
     attr_reader :id
 
-    def initialize(bindings)
+    def initialize(exception_mappers)
       @id = SecureRandom.hex(16)
-      @bindings = bindings
-      @evaluator = Evaluator.new(@current_binding = bindings.first)
+
+      @exception_mappers = exception_mappers
+      @evaluator         = Evaluator.new(@current_binding = 
exception_mappers.first.first)
 
       store_into_memory
     end
@@ -60,8 +60,10 @@
     # Switches the current binding to the one at specified +index+.
     #
     # Returns nothing.
-    def switch_binding_to(index)
-      @evaluator = Evaluator.new(@current_binding = @bindings[index.to_i])
+    def switch_binding_to(index, exception_object_id)
+      bindings = ExceptionMapper.find_binding(@exception_mappers, 
exception_object_id)
+
+      @evaluator = Evaluator.new(@current_binding = bindings[index.to_i])
     end
 
     # Returns context of the current binding
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/source_location.rb 
new/lib/web_console/source_location.rb
--- old/lib/web_console/source_location.rb      1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/web_console/source_location.rb      2019-08-17 09:10:47.000000000 
+0200
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class SourceLocation
+  def initialize(binding)
+    @binding = binding
+  end
+
+  if RUBY_VERSION >= "2.6"
+    def path() @binding.source_location.first end
+    def lineno() @binding.source_location.last end
+  else
+    def path() @binding.eval("__FILE__") end
+    def lineno() @binding.eval("__LINE__") end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/template.rb 
new/lib/web_console/template.rb
--- old/lib/web_console/template.rb     2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/template.rb     2019-08-17 09:10:47.000000000 +0200
@@ -7,8 +7,7 @@
   # Rails error pages.
   class Template
     # Lets you customize the default templates folder location.
-    cattr_accessor :template_paths
-    @@template_paths = [ File.expand_path("../templates", __FILE__) ]
+    cattr_accessor :template_paths, default: [ 
File.expand_path("../templates", __FILE__) ]
 
     def initialize(env, session)
       @env = env
@@ -18,7 +17,7 @@
 
     # Render a template (inferred from +template_paths+) as a plain string.
     def render(template)
-      view = View.new(template_paths, instance_values)
+      view = View.new(ActionView::LookupContext.new(template_paths), 
instance_values)
       view.render(template: template, layout: false)
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/templates/console.js.erb 
new/lib/web_console/templates/console.js.erb
--- old/lib/web_console/templates/console.js.erb        2018-09-02 
21:44:49.000000000 +0200
+++ new/lib/web_console/templates/console.js.erb        2019-08-17 
09:10:47.000000000 +0200
@@ -380,8 +380,13 @@
     var clientHeightStart   = consoleOuter.clientHeight;
 
     var doDrag = function(e) {
-      container.style.height = (startHeight + startY - e.clientY) + 'px';
+      var height = startHeight + startY - e.clientY;
       consoleOuter.scrollTop = scrollTopStart + (clientHeightStart - 
consoleOuter.clientHeight);
+      if (height > document.documentElement.clientHeight) {
+        container.style.height = document.documentElement.clientHeight;
+      } else {
+        container.style.height = height + 'px';
+      }
       shiftConsoleActions();
     };
 
@@ -871,10 +876,14 @@
 };
 
 // Change the binding of the console.
-REPLConsole.prototype.switchBindingTo = function(frameId, callback) {
+REPLConsole.prototype.switchBindingTo = function(frameId, exceptionObjectId, 
callback) {
   var url = this.getSessionUrl('trace');
   var params = "frame_id=" + encodeURIComponent(frameId);
 
+  if (exceptionObjectId) {
+    params = params + "&exception_object_id=" + 
encodeURIComponent(exceptionObjectId);
+  }
+
   var _this = this;
   postRequest(url, params, function() {
     var text = "Context has changed to: " + callback();
@@ -915,7 +924,6 @@
   xhr.open(method, url, true);
   xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
-  xhr.setRequestHeader("Accept", "<%= Mime[:web_console_v2] %>");
   xhr.send(params);
 
   xhr.onreadystatechange = function() {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/templates/error_page.js.erb 
new/lib/web_console/templates/error_page.js.erb
--- old/lib/web_console/templates/error_page.js.erb     2018-09-02 
21:44:49.000000000 +0200
+++ new/lib/web_console/templates/error_page.js.erb     2019-08-17 
09:10:47.000000000 +0200
@@ -8,9 +8,10 @@
     e.preventDefault();
     var target = e.target;
     var frameId = target.dataset.frameId;
+    var exceptionObjectId = target.dataset.exceptionObjectId;
 
     // Change the binding of the console.
-    changeBinding(frameId, function() {
+    changeBinding(frameId, exceptionObjectId, function() {
       // Rails already handles toggling the select class
       selectedFrame = target;
       return target.innerHTML;
@@ -22,8 +23,8 @@
 }
 
 // Change the binding of the current session and prompt the user.
-function changeBinding(frameId, callback) {
-  REPLConsole.currentSession.switchBindingTo(frameId, callback);
+function changeBinding(frameId, exceptionObjectId, callback) {
+  REPLConsole.currentSession.switchBindingTo(frameId, exceptionObjectId, 
callback);
 }
 
 function changeSourceExtract(frameId) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/templates/style.css.erb 
new/lib/web_console/templates/style.css.erb
--- old/lib/web_console/templates/style.css.erb 2018-09-02 21:44:49.000000000 
+0200
+++ new/lib/web_console/templates/style.css.erb 2019-08-17 09:10:47.000000000 
+0200
@@ -1,34 +1,182 @@
-.console .pos-absolute { position: absolute; }
-.console .pos-fixed { position: fixed; }
-.console .pos-right { right: 0; }
-.console .border-box { box-sizing: border-box; }
-.console .layer { width: 100%; height: 100%; }
-.console .layer.console-outer { z-index: 1; }
-.console .layer.resizer { z-index: 2; }
-.console { position: fixed; left: 0; bottom: 0; width: 100%; height: 148px; 
padding: 0; margin: 0; background: none repeat scroll 0% 0% #333; z-index: 
9999; }
-.console .console-outer { overflow: auto; padding-top: 4px; }
-.console .console-inner { font-family: monospace; font-size: 11px; width: 
100%; height: 100%; overflow: none; background: #333; }
-.console .console-prompt-box { color: #FFF; }
-.console .console-message { color: #1AD027; margin: 0; border: 0; white-space: 
pre-wrap; background-color: #333; padding: 0; }
-.console .console-message.error-message { color: #FC9; }
-.console .console-message.notification-message { color: #99F; }
-.console .console-message.auto-complete { word-break: break-all; }
-.console .console-message.auto-complete .keyword { margin-right: 11px; }
-.console .console-message.auto-complete .keyword.selected { background: #FFF; 
color: #000; }
-.console .console-message.auto-complete .hidden { display: none; }
-.console .console-message.auto-complete .trimmed { display: none; }
-.console .console-hint { color: #096; }
-.console .console-focus .console-cursor { background: #FEFEFE; color: #333; 
font-weight: bold; }
-.console .resizer { background: #333; width: 100%; height: 4px; cursor: 
ns-resize; }
-.console .console-actions { padding-right: 3px; }
-.console .console-actions .button { float: left; }
-.console .button { cursor: pointer; border-radius: 1px; font-family: 
monospace; font-size: 13px; width: 14px; height: 14px; line-height: 14px; 
text-align: center; color: #CCC; }
-.console .button:hover { background: #666; color: #FFF; }
-.console .button.close-button:hover { background: #966; }
-.console .clipboard { height: 0px; padding: 0px; margin: 0px; width: 0px; 
margin-left: -1000px; }
-.console .console-prompt-label { display: inline; color: #FFF; background: 
none repeat scroll 0% 0% #333; border: 0; padding: 0; }
-.console .console-prompt-display { display: inline; color: #FFF; background: 
none repeat scroll 0% 0% #333; border: 0; padding: 0; }
-.console.full-screen { height: 100%; }
-.console.full-screen .console-outer { padding-top: 3px; }
-.console.full-screen .resizer { display: none; }
-.console.full-screen .close-button { display: none; }
+.console .pos-absolute {
+  position: absolute;
+}
+
+.console .pos-fixed {
+  position: fixed;
+}
+
+.console .pos-right {
+  right: 0;
+}
+
+.console .border-box {
+  box-sizing: border-box;
+}
+
+.console .layer {
+  width: 100%;
+  height: 100%;
+}
+
+.console .layer.console-outer {
+  z-index: 1;
+}
+
+.console .layer.resizer {
+  z-index: 2;
+}
+
+.console {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 148px;
+  padding: 0;
+  margin: 0;
+  background: none repeat scroll 0% 0% #333;
+  z-index: 9999;
+}
+
+.console .console-outer {
+  overflow: auto;
+  padding-top: 4px;
+}
+
+.console .console-inner {
+  font-family: monospace;
+  font-size: 11px;
+  width: 100%;
+  height: 100%;
+  overflow: none;
+  background: #333;
+}
+
+.console .console-prompt-box {
+  color: #fff;
+}
+
+.console .console-message {
+  color: #1ad027;
+  margin: 0;
+  border: 0;
+  white-space: pre-wrap;
+  background-color: #333;
+  padding: 0;
+}
+
+.console .console-message.error-message {
+  color: #fc9;
+}
+
+.console .console-message.notification-message {
+  color: #99f;
+}
+
+.console .console-message.auto-complete {
+  word-break: break-all;
+}
+
+.console .console-message.auto-complete .keyword {
+  margin-right: 11px;
+}
+
+.console .console-message.auto-complete .keyword.selected {
+  background: #fff;
+  color: #000;
+}
+
+.console .console-message.auto-complete .hidden {
+  display: none;
+}
+
+.console .console-message.auto-complete .trimmed {
+  display: none;
+}
+
+.console .console-hint {
+  color: #096;
+}
+
+.console .console-focus .console-cursor {
+  background: #fefefe;
+  color: #333;
+  font-weight: bold;
+}
+
+.console .resizer {
+  background: #333;
+  width: 100%;
+  height: 4px;
+  cursor: ns-resize;
+}
+
+.console .console-actions {
+  padding-right: 3px;
+}
+
+.console .console-actions .button {
+  float: left;
+}
+
+.console .button {
+  cursor: pointer;
+  border-radius: 1px;
+  font-family: monospace;
+  font-size: 13px;
+  width: 14px;
+  height: 14px;
+  line-height: 14px;
+  text-align: center;
+  color: #ccc;
+}
+
+.console .button:hover {
+  background: #666;
+  color: #fff;
+}
+
+.console .button.close-button:hover {
+  background: #966;
+}
+
+.console .clipboard {
+  height: 0px;
+  padding: 0px;
+  margin: 0px;
+  width: 0px;
+  margin-left: -1000px;
+}
+
+.console .console-prompt-label {
+  display: inline;
+  color: #fff;
+  background: none repeat scroll 0% 0% #333;
+  border: 0;
+  padding: 0;
+}
+
+.console .console-prompt-display {
+  display: inline;
+  color: #fff;
+  background: none repeat scroll 0% 0% #333;
+  border: 0;
+  padding: 0;
+}
+
+.console.full-screen {
+  height: 100%;
+}
+
+.console.full-screen .console-outer {
+  padding-top: 3px;
+}
+
+.console.full-screen .resizer {
+  display: none;
+}
+
+.console.full-screen .close-button {
+  display: none;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/testing/fake_middleware.rb 
new/lib/web_console/testing/fake_middleware.rb
--- old/lib/web_console/testing/fake_middleware.rb      2018-09-02 
21:44:49.000000000 +0200
+++ new/lib/web_console/testing/fake_middleware.rb      2019-08-17 
09:10:47.000000000 +0200
@@ -3,7 +3,6 @@
 require "action_view"
 require "web_console"
 require "web_console/testing/helper"
-Mime = { web_console_v2: "fake" }
 
 module WebConsole
   module Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/version.rb 
new/lib/web_console/version.rb
--- old/lib/web_console/version.rb      2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/version.rb      2019-08-17 09:10:47.000000000 +0200
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module WebConsole
-  VERSION = "3.7.0"
+  VERSION = "4.0.1"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/whiny_request.rb 
new/lib/web_console/whiny_request.rb
--- old/lib/web_console/whiny_request.rb        2018-09-02 21:44:49.000000000 
+0200
+++ new/lib/web_console/whiny_request.rb        2019-08-17 09:10:47.000000000 
+0200
@@ -3,13 +3,13 @@
 module WebConsole
   # Noisy wrapper around +Request+.
   #
-  # If any calls to +from_whitelisted_ip?+ and +acceptable_content_type?+
+  # If any calls to +permitted?+ and +acceptable_content_type?+
   # return false, an info log message will be displayed in users' logs.
   class WhinyRequest < SimpleDelegator
-    def from_whitelisted_ip?
-      whine_unless request.from_whitelisted_ip? do
+    def permitted?
+      whine_unless request.permitted? do
         "Cannot render console from #{request.strict_remote_ip}! " \
-          "Allowed networks: #{request.whitelisted_ips}"
+          "Allowed networks: #{request.permissions}"
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console/whitelist.rb 
new/lib/web_console/whitelist.rb
--- old/lib/web_console/whitelist.rb    2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console/whitelist.rb    1970-01-01 01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-# frozen_string_literal: true
-
-require "ipaddr"
-
-module WebConsole
-  # Whitelist of allowed networks that can access Web Console.
-  #
-  # Networks are represented by standard IPAddr and can be either IPv4 or IPv6
-  # networks.
-  class Whitelist
-    # IPv4 and IPv6 localhost should be always whitelisted.
-    ALWAYS_WHITELISTED_NETWORKS = %w( 127.0.0.0/8 ::1 )
-
-    def initialize(networks = nil)
-      @networks = 
normalize_networks(networks).map(&method(:coerce_network_to_ipaddr)).uniq
-    end
-
-    def include?(network)
-      @networks.any? { |whitelist| whitelist.include?(network.to_s) }
-    rescue IPAddr::InvalidAddressError
-      false
-    end
-
-    def to_s
-      @networks.map(&method(:human_readable_ipaddr)).join(", ")
-    end
-
-    private
-
-      def normalize_networks(networks)
-        Array(networks).concat(ALWAYS_WHITELISTED_NETWORKS)
-      end
-
-      def coerce_network_to_ipaddr(network)
-        if network.is_a?(IPAddr)
-          network
-        else
-          IPAddr.new(network)
-        end
-      end
-
-      def human_readable_ipaddr(ipaddr)
-        ipaddr.to_range.to_s.split("..").uniq.join("/")
-      end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/web_console.rb new/lib/web_console.rb
--- old/lib/web_console.rb      2018-09-02 21:44:49.000000000 +0200
+++ new/lib/web_console.rb      2019-08-17 09:10:47.000000000 +0200
@@ -11,12 +11,14 @@
   autoload :ExceptionMapper
   autoload :Session
   autoload :Injector
+  autoload :Interceptor
   autoload :Request
   autoload :WhinyRequest
-  autoload :Whitelist
+  autoload :Permissions
   autoload :Template
   autoload :Middleware
   autoload :Context
+  autoload :SourceLocation
 
   autoload_at "web_console/errors" do
     autoload :Error
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2018-09-02 21:44:49.000000000 +0200
+++ new/metadata        2019-08-17 09:10:47.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: web-console
 version: !ruby/object:Gem::Version
-  version: 3.7.0
+  version: 4.0.1
 platform: ruby
 authors:
 - Charlie Somerville
@@ -11,7 +11,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2018-09-02 00:00:00.000000000 Z
+date: 2019-08-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: railties
@@ -19,42 +19,42 @@
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
 - !ruby/object:Gem::Dependency
   name: activemodel
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
 - !ruby/object:Gem::Dependency
   name: actionview
   requirement: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - ">="
       - !ruby/object:Gem::Version
-        version: '5.0'
+        version: 6.0.0
 - !ruby/object:Gem::Dependency
   name: bindex
   requirement: !ruby/object:Gem::Requirement
@@ -91,11 +91,14 @@
 - lib/web_console/exception_mapper.rb
 - lib/web_console/extensions.rb
 - lib/web_console/injector.rb
+- lib/web_console/interceptor.rb
 - lib/web_console/locales/en.yml
 - lib/web_console/middleware.rb
+- lib/web_console/permissions.rb
 - lib/web_console/railtie.rb
 - lib/web_console/request.rb
 - lib/web_console/session.rb
+- lib/web_console/source_location.rb
 - lib/web_console/tasks/extensions.rake
 - lib/web_console/tasks/templates.rake
 - lib/web_console/template.rb
@@ -116,7 +119,6 @@
 - lib/web_console/version.rb
 - lib/web_console/view.rb
 - lib/web_console/whiny_request.rb
-- lib/web_console/whitelist.rb
 homepage: https://github.com/rails/web-console
 licenses:
 - MIT
@@ -129,15 +131,14 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: 2.2.2
+      version: '2.5'
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubyforge_project: 
-rubygems_version: 2.7.6
+rubygems_version: 3.0.3
 signing_key: 
 specification_version: 4
 summary: A debugging tool for your Ruby on Rails applications.


Reply via email to