web-console 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +15 -2
- data/README.markdown +3 -3
- data/lib/web_console/injector.rb +3 -3
- data/lib/web_console/interceptor.rb +1 -2
- data/lib/web_console/middleware.rb +4 -4
- data/lib/web_console/permissions.rb +1 -1
- data/lib/web_console/railtie.rb +5 -1
- data/lib/web_console/request.rb +8 -0
- data/lib/web_console/source_location.rb +5 -8
- data/lib/web_console/tasks/templates.rake +4 -10
- data/lib/web_console/templates/_inner_console_markup.html.erb +1 -1
- data/lib/web_console/templates/console.js.erb +2 -2
- data/lib/web_console/testing/fake_middleware.rb +8 -4
- data/lib/web_console/version.rb +1 -1
- data/lib/web_console.rb +5 -1
- metadata +8 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5e2379a6ac6902c6af18a03b2810ca1ab45bcfc617c53c11c6f3bd022749c2f
|
|
4
|
+
data.tar.gz: 957be1853d8dafe74e81cc908b14db345cead523a55d97448f633fa837dc8858
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0031f168892a96281774af7c311cfc74f112f87828cc0feb2a2c753de0caab3c8ed0e2eb230117eb6f95c032af57c2a539d052fd4909accca20f127a8bd0c5e
|
|
7
|
+
data.tar.gz: 975f64e855276c791a07913ae582f205a5d1cc19c96c54979a186d7a8a5f20bd6cfa5848030c44406836e2e1ba68d9f26fc9418eaebea53f7aba5242c1b256cd
|
data/CHANGELOG.markdown
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## main (unreleased)
|
|
4
|
+
|
|
5
|
+
# 4.3.0
|
|
6
|
+
|
|
7
|
+
* [#342](https://github.com/rails/web-console/pull/342) Always permit IPv4-mapped IPv6 loopback addresses ([@zunda]).
|
|
8
|
+
* Fixed Rails 8.2.0.alpha support
|
|
9
|
+
* Drop Rails 7.2 support
|
|
10
|
+
* Drop Ruby 3.1 support
|
|
11
|
+
|
|
12
|
+
# 4.2.1
|
|
13
|
+
|
|
14
|
+
* Support to Rails 7.1
|
|
15
|
+
* Support to Rack 3.0
|
|
4
16
|
|
|
5
17
|
## 4.2.0
|
|
6
18
|
|
|
7
19
|
* [#308](https://github.com/rails/web-console/pull/308) Fix web-console inline templates rendering ([@voxik])
|
|
8
|
-
* [#306](https://github.com/rails/web-console/pull/306) Support Ruby 3.0 and above ([@
|
|
20
|
+
* [#306](https://github.com/rails/web-console/pull/306) Support Ruby 3.0 and above ([@ryanwood])
|
|
9
21
|
|
|
10
22
|
## 4.1.0
|
|
11
23
|
|
|
@@ -186,3 +198,4 @@ go to 3.1.0 instead.
|
|
|
186
198
|
[@p8]: https://github.com/p8
|
|
187
199
|
[@voxik]: https://github.com/voxik
|
|
188
200
|
[@ryanwood]: https://github.com/ryanwood
|
|
201
|
+
[@zunda]: https://github.com/zunda
|
data/README.markdown
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align=right>
|
|
2
|
-
<strong>Current version: 4.1
|
|
2
|
+
<strong>Current version: 4.2.1</strong> | Documentation for:
|
|
3
3
|
<a href=https://github.com/rails/web-console/tree/v1.0.4>v1.0.4</a>
|
|
4
4
|
<a href=https://github.com/rails/web-console/tree/v2.2.1>v2.2.1</a>
|
|
5
5
|
<a href=https://github.com/rails/web-console/tree/v3.7.0>v3.7.0</a>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
|
-
# Web Console [](https://github.com/rails/web-console/actions/workflows/ci.yml)
|
|
9
9
|
|
|
10
10
|
_Web Console_ is a debugging tool for your Ruby on Rails applications.
|
|
11
11
|
|
|
@@ -186,7 +186,7 @@ Make sure your configuration lives in `config/environments/development.rb`.
|
|
|
186
186
|
[Hailey Somerville]: https://github.com/haileys
|
|
187
187
|
[John Mair]: https://github.com/banister
|
|
188
188
|
[Charles Oliver Nutter]: https://github.com/headius
|
|
189
|
-
[templates]: https://github.com/rails/web-console/tree/
|
|
189
|
+
[templates]: https://github.com/rails/web-console/tree/main/lib/web_console/templates
|
|
190
190
|
[rvt]: https://github.com/gsamokovarov/rvt
|
|
191
191
|
[contributors]: https://github.com/rails/web-console/graphs/contributors
|
|
192
192
|
[Passenger on Nginx]: https://www.phusionpassenger.com/library/config/nginx/reference/#passengerstickysessions
|
data/lib/web_console/injector.rb
CHANGED
|
@@ -13,10 +13,10 @@ module WebConsole
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def inject(content)
|
|
16
|
-
# Set
|
|
16
|
+
# Set content-length header to the size of the current body
|
|
17
17
|
# + the extra content. Otherwise the response will be truncated.
|
|
18
|
-
if @headers[
|
|
19
|
-
@headers[
|
|
18
|
+
if @headers[Rack::CONTENT_LENGTH]
|
|
19
|
+
@headers[Rack::CONTENT_LENGTH] = (@body.bytesize + content.bytesize).to_s
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
[
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
module WebConsole
|
|
2
2
|
module Interceptor
|
|
3
|
-
def self.call(request,
|
|
3
|
+
def self.call(request, error)
|
|
4
4
|
backtrace_cleaner = request.get_header("action_dispatch.backtrace_cleaner")
|
|
5
|
-
error = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).exception
|
|
6
5
|
|
|
7
6
|
# Get the original exception if ExceptionWrapper decides to follow it.
|
|
8
7
|
Thread.current[:__web_console_exception] = error
|
|
@@ -28,8 +28,8 @@ module WebConsole
|
|
|
28
28
|
status, headers, body = call_app(env)
|
|
29
29
|
|
|
30
30
|
if (session = Session.from(Thread.current)) && acceptable_content_type?(headers)
|
|
31
|
-
headers["
|
|
32
|
-
headers["
|
|
31
|
+
headers["x-web-console-session-id"] = session.id
|
|
32
|
+
headers["x-web-console-mount-point"] = mount_point
|
|
33
33
|
|
|
34
34
|
template = Template.new(env, session)
|
|
35
35
|
body, headers = Injector.new(body, headers).inject(template.render("index"))
|
|
@@ -52,12 +52,12 @@ module WebConsole
|
|
|
52
52
|
private
|
|
53
53
|
|
|
54
54
|
def acceptable_content_type?(headers)
|
|
55
|
-
headers[
|
|
55
|
+
headers[Rack::CONTENT_TYPE].to_s.include?("html")
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def json_response(opts = {})
|
|
59
59
|
status = opts.fetch(:status, 200)
|
|
60
|
-
headers = {
|
|
60
|
+
headers = { Rack::CONTENT_TYPE => "application/json; charset = utf-8" }
|
|
61
61
|
body = yield.to_json
|
|
62
62
|
|
|
63
63
|
[ status, headers, [ body ] ]
|
|
@@ -5,7 +5,7 @@ require "ipaddr"
|
|
|
5
5
|
module WebConsole
|
|
6
6
|
class Permissions
|
|
7
7
|
# IPv4 and IPv6 localhost should be always allowed.
|
|
8
|
-
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 )
|
|
8
|
+
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 ::ffff:127.0.0.0/104 )
|
|
9
9
|
|
|
10
10
|
def initialize(networks = nil)
|
|
11
11
|
@networks = normalize_networks(networks).map(&method(:coerce_network_to_ipaddr)).uniq
|
data/lib/web_console/railtie.rb
CHANGED
|
@@ -51,6 +51,10 @@ module WebConsole
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
initializer "web_console.deprecator" do |app|
|
|
55
|
+
app.deprecators[:web_console] = WebConsole.deprecator if app.respond_to?(:deprecators)
|
|
56
|
+
end
|
|
57
|
+
|
|
54
58
|
initializer "web_console.permissions" do
|
|
55
59
|
permissions = web_console_permissions
|
|
56
60
|
Request.permissions = Permissions.new(permissions)
|
|
@@ -63,7 +67,7 @@ module WebConsole
|
|
|
63
67
|
when config.web_console.allowed_ips
|
|
64
68
|
config.web_console.allowed_ips
|
|
65
69
|
when config.web_console.whitelisted_ips
|
|
66
|
-
|
|
70
|
+
WebConsole.deprecator.warn(<<-MSG.squish)
|
|
67
71
|
The config.web_console.whitelisted_ips is deprecated and will be ignored in future release of web_console.
|
|
68
72
|
Please use config.web_console.allowed_ips instead.
|
|
69
73
|
MSG
|
data/lib/web_console/request.rb
CHANGED
|
@@ -28,11 +28,19 @@ module WebConsole
|
|
|
28
28
|
@proxies = proxies
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# Used by rails <= 8.1
|
|
31
32
|
def filter_proxies(ips)
|
|
32
33
|
ips.reject do |ip|
|
|
33
34
|
@proxies.include?(ip)
|
|
34
35
|
end
|
|
35
36
|
end
|
|
37
|
+
|
|
38
|
+
# Used by rails > 8.1.
|
|
39
|
+
def first_non_proxy(ips)
|
|
40
|
+
ips.find do |ip|
|
|
41
|
+
!@proxies.include?(ip)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
36
44
|
end
|
|
37
45
|
end
|
|
38
46
|
end
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
module WebConsole
|
|
4
|
+
class SourceLocation
|
|
5
|
+
def initialize(binding)
|
|
6
|
+
@binding = binding
|
|
7
|
+
end
|
|
7
8
|
|
|
8
|
-
if RUBY_VERSION >= "2.6"
|
|
9
9
|
def path() @binding.source_location.first end
|
|
10
10
|
def lineno() @binding.source_location.last end
|
|
11
|
-
else
|
|
12
|
-
def path() @binding.eval("__FILE__") end
|
|
13
|
-
def lineno() @binding.eval("__LINE__") end
|
|
14
11
|
end
|
|
15
12
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "net/http"
|
|
4
|
+
|
|
3
5
|
namespace :templates do
|
|
4
6
|
desc "Run tests for templates"
|
|
5
7
|
task test: [ :daemonize, :npm, :rackup, :wait, :mocha, :kill, :exit ]
|
|
@@ -10,7 +12,6 @@ namespace :templates do
|
|
|
10
12
|
runner = URI.parse("http://#{ENV['IP'] || '127.0.0.1'}:#{ENV['PORT'] || 29292}/html/test_runner.html")
|
|
11
13
|
rackup = "rackup --host #{runner.host} --port #{runner.port}"
|
|
12
14
|
result = nil
|
|
13
|
-
browser = "phantomjs"
|
|
14
15
|
|
|
15
16
|
def need_to_wait?(uri)
|
|
16
17
|
Net::HTTP.start(uri.host, uri.port) { |http| http.get(uri.path) }
|
|
@@ -22,17 +23,10 @@ namespace :templates do
|
|
|
22
23
|
rackup += " -D --pid #{pid}"
|
|
23
24
|
end
|
|
24
25
|
|
|
25
|
-
task npm
|
|
26
|
+
task :npm do
|
|
26
27
|
Dir.chdir(workdir) { system "npm install --silent" }
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
task :phantomjs do
|
|
30
|
-
unless system("which #{browser} >/dev/null")
|
|
31
|
-
browser = "./node_modules/.bin/phantomjs"
|
|
32
|
-
Dir.chdir(workdir) { system("test -f #{browser} || npm install --silent phantomjs-prebuilt") }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
30
|
task :rackup do
|
|
37
31
|
Dir.chdir(workdir) { system rackup }
|
|
38
32
|
end
|
|
@@ -43,7 +37,7 @@ namespace :templates do
|
|
|
43
37
|
end
|
|
44
38
|
|
|
45
39
|
task :mocha do
|
|
46
|
-
Dir.chdir(workdir) { result = system("
|
|
40
|
+
Dir.chdir(workdir) { result = system("npx mocha-headless-chrome -f #{runner} -r dot") }
|
|
47
41
|
end
|
|
48
42
|
|
|
49
43
|
task :kill do
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class='resizer layer'></div>
|
|
2
2
|
<div class='console-outer layer'>
|
|
3
3
|
<div class='console-actions'>
|
|
4
|
-
<div class='close-button button' title='close'
|
|
4
|
+
<div class='close-button button' title='close'>×</div>
|
|
5
5
|
</div>
|
|
6
6
|
<div class='console-inner'></div>
|
|
7
7
|
</div>
|
|
@@ -935,8 +935,8 @@ REPLConsole.request = function request(method, url, params, callback) {
|
|
|
935
935
|
var xhr = new REPLConsole.XMLHttpRequest();
|
|
936
936
|
|
|
937
937
|
xhr.open(method, url, true);
|
|
938
|
-
xhr.setRequestHeader("
|
|
939
|
-
xhr.setRequestHeader("
|
|
938
|
+
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
|
|
939
|
+
xhr.setRequestHeader("x-requested-with", "XMLHttpRequest");
|
|
940
940
|
xhr.send(params);
|
|
941
941
|
|
|
942
942
|
xhr.onreadystatechange = function() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "action_view"
|
|
4
|
+
require "action_dispatch" # This is needed to use Mime::Type
|
|
4
5
|
require "web_console"
|
|
5
6
|
require "web_console/testing/helper"
|
|
6
7
|
|
|
@@ -9,7 +10,7 @@ module WebConsole
|
|
|
9
10
|
class FakeMiddleware
|
|
10
11
|
I18n.load_path.concat(Dir[Helper.gem_root.join("lib/web_console/locales/*.yml")])
|
|
11
12
|
|
|
12
|
-
DEFAULT_HEADERS = {
|
|
13
|
+
DEFAULT_HEADERS = { Rack::CONTENT_TYPE => "application/javascript" }
|
|
13
14
|
|
|
14
15
|
def initialize(opts)
|
|
15
16
|
@headers = opts.fetch(:headers, DEFAULT_HEADERS)
|
|
@@ -18,18 +19,21 @@ module WebConsole
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def call(env)
|
|
21
|
-
|
|
22
|
+
body = render(req_path(env))
|
|
23
|
+
@headers[Rack::CONTENT_LENGTH] = body.bytesize.to_s
|
|
24
|
+
|
|
25
|
+
[ 200, @headers, [ body ] ]
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def view
|
|
25
|
-
@view = View.
|
|
29
|
+
@view = View.with_empty_template_cache.with_view_paths(@view_path)
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
private
|
|
29
33
|
|
|
30
34
|
# extract target path from REQUEST_PATH
|
|
31
35
|
def req_path(env)
|
|
32
|
-
env["REQUEST_PATH"].match(@req_path_regex)[1]
|
|
36
|
+
File.basename(env["REQUEST_PATH"].match(@req_path_regex)[1], ".*")
|
|
33
37
|
end
|
|
34
38
|
|
|
35
39
|
def render(template)
|
data/lib/web_console/version.rb
CHANGED
data/lib/web_console.rb
CHANGED
|
@@ -26,7 +26,11 @@ module WebConsole
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def self.logger
|
|
29
|
-
Rails.logger || (@logger ||= ActiveSupport::Logger.new($stderr))
|
|
29
|
+
(defined?(Rails.logger) && Rails.logger) || (@logger ||= ActiveSupport::Logger.new($stderr))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.deprecator
|
|
33
|
+
@deprecator ||= ActiveSupport::Deprecation.new("5.0", "WebConsole")
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: web-console
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hailey Somerville
|
|
8
8
|
- Genadi Samokovarov
|
|
9
9
|
- Guillermo Iguaran
|
|
10
10
|
- Ryan Dao
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: railties
|
|
@@ -19,42 +18,28 @@ dependencies:
|
|
|
19
18
|
requirements:
|
|
20
19
|
- - ">="
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
21
|
+
version: 8.0.0
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - ">="
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
-
- !ruby/object:Gem::Dependency
|
|
31
|
-
name: activemodel
|
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
requirements:
|
|
34
|
-
- - ">="
|
|
35
|
-
- !ruby/object:Gem::Version
|
|
36
|
-
version: 6.0.0
|
|
37
|
-
type: :runtime
|
|
38
|
-
prerelease: false
|
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
41
|
-
- - ">="
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: 6.0.0
|
|
28
|
+
version: 8.0.0
|
|
44
29
|
- !ruby/object:Gem::Dependency
|
|
45
30
|
name: actionview
|
|
46
31
|
requirement: !ruby/object:Gem::Requirement
|
|
47
32
|
requirements:
|
|
48
33
|
- - ">="
|
|
49
34
|
- !ruby/object:Gem::Version
|
|
50
|
-
version:
|
|
35
|
+
version: 8.0.0
|
|
51
36
|
type: :runtime
|
|
52
37
|
prerelease: false
|
|
53
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
39
|
requirements:
|
|
55
40
|
- - ">="
|
|
56
41
|
- !ruby/object:Gem::Version
|
|
57
|
-
version:
|
|
42
|
+
version: 8.0.0
|
|
58
43
|
- !ruby/object:Gem::Dependency
|
|
59
44
|
name: bindex
|
|
60
45
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -69,7 +54,6 @@ dependencies:
|
|
|
69
54
|
- - ">="
|
|
70
55
|
- !ruby/object:Gem::Version
|
|
71
56
|
version: 0.4.0
|
|
72
|
-
description:
|
|
73
57
|
email:
|
|
74
58
|
- hailey@hailey.lol
|
|
75
59
|
- gsamokovarov@gmail.com
|
|
@@ -123,7 +107,6 @@ homepage: https://github.com/rails/web-console
|
|
|
123
107
|
licenses:
|
|
124
108
|
- MIT
|
|
125
109
|
metadata: {}
|
|
126
|
-
post_install_message:
|
|
127
110
|
rdoc_options: []
|
|
128
111
|
require_paths:
|
|
129
112
|
- lib
|
|
@@ -131,15 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
131
114
|
requirements:
|
|
132
115
|
- - ">="
|
|
133
116
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: '2
|
|
117
|
+
version: '3.2'
|
|
135
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
119
|
requirements:
|
|
137
120
|
- - ">="
|
|
138
121
|
- !ruby/object:Gem::Version
|
|
139
122
|
version: '0'
|
|
140
123
|
requirements: []
|
|
141
|
-
rubygems_version:
|
|
142
|
-
signing_key:
|
|
124
|
+
rubygems_version: 4.0.3
|
|
143
125
|
specification_version: 4
|
|
144
126
|
summary: A debugging tool for your Ruby on Rails applications.
|
|
145
127
|
test_files: []
|