web-console 4.2.0 → 4.2.1
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 +7 -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/railtie.rb +5 -1
- data/lib/web_console/source_location.rb +12 -10
- data/lib/web_console/tasks/templates.rake +4 -10
- 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 +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed1dcd754f3147bcefa20043ba34ea374d9acac479d68e3eae7b89b3ee68994d
|
4
|
+
data.tar.gz: 7556b35cf5abd8d6438931b7d4cce3dd082483617cfeca28545d7a1bb5c83d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 757a0810bb51d57678f588d7f70ac3734c0a32740aa357acab67edc880701588bf703ca6e90e0e228b3ea8a6d009bd32b8b5e0d3cfb7f0569d784c69028d2c08
|
7
|
+
data.tar.gz: 7ffb4ff41a124ca94852bc043dc4e745ee43e112c4e986e83ad9296f2d97cad17f83ce05b3f9917c5b68f74741aa674ec0bd052e97b588cd822cfbdd2a315e7b
|
data/CHANGELOG.markdown
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
##
|
3
|
+
## main (unreleased)
|
4
|
+
|
5
|
+
# 4.2.1
|
6
|
+
|
7
|
+
* Support to Rails 7.1
|
8
|
+
* Support to Rack 3.0
|
4
9
|
|
5
10
|
## 4.2.0
|
6
11
|
|
7
12
|
* [#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 ([@
|
13
|
+
* [#306](https://github.com/rails/web-console/pull/306) Support Ruby 3.0 and above ([@ryanwood])
|
9
14
|
|
10
15
|
## 4.1.0
|
11
16
|
|
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 ] ]
|
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
|
@@ -1,15 +1,17 @@
|
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
if RUBY_VERSION >= "2.6"
|
10
|
+
def path() @binding.source_location.first end
|
11
|
+
def lineno() @binding.source_location.last end
|
12
|
+
else
|
13
|
+
def path() @binding.eval("__FILE__") end
|
14
|
+
def lineno() @binding.eval("__LINE__") end
|
15
|
+
end
|
14
16
|
end
|
15
17
|
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
|
@@ -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,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
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:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 0.4.0
|
72
|
-
description:
|
72
|
+
description:
|
73
73
|
email:
|
74
74
|
- hailey@hailey.lol
|
75
75
|
- gsamokovarov@gmail.com
|
@@ -123,7 +123,7 @@ homepage: https://github.com/rails/web-console
|
|
123
123
|
licenses:
|
124
124
|
- MIT
|
125
125
|
metadata: {}
|
126
|
-
post_install_message:
|
126
|
+
post_install_message:
|
127
127
|
rdoc_options: []
|
128
128
|
require_paths:
|
129
129
|
- lib
|
@@ -138,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
rubygems_version: 3.
|
142
|
-
signing_key:
|
141
|
+
rubygems_version: 3.4.10
|
142
|
+
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: A debugging tool for your Ruby on Rails applications.
|
145
145
|
test_files: []
|