web-console 4.0.2 → 4.2.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 +33 -6
- data/MIT-LICENSE +1 -1
- data/README.markdown +7 -6
- data/lib/web_console/evaluator.rb +6 -1
- data/lib/web_console/injector.rb +5 -3
- data/lib/web_console/permissions.rb +1 -1
- data/lib/web_console/railtie.rb +16 -1
- data/lib/web_console/template.rb +1 -1
- data/lib/web_console/templates/console.js.erb +17 -4
- data/lib/web_console/templates/layouts/inlined_string.erb +1 -1
- data/lib/web_console/templates/layouts/javascript.erb +1 -1
- data/lib/web_console/templates/style.css.erb +1 -1
- data/lib/web_console/version.rb +1 -1
- data/lib/web_console/view.rb +1 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a491428cda19f89cf20ad5ef83558e948feecb7acb7f46b453c5644ad419131b
|
4
|
+
data.tar.gz: 3e3d2902466fc03684b00591b294df2c19af06db31e43f58f1f9e8de14cb731f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d949e602f1056bda92b2e7e13e030a78bd856befeb52ccd89c57c27a5341bab30830e27969f3fd9bf8e3d5e4467de381cb788cd9d5809ad6f5d662b2a00b3993
|
7
|
+
data.tar.gz: a17229c83c77f2fdc2b06ca4d25674391e9318490da932de015d0d8ebc59bf652ccb010577eea9d95c357fcd703ba6b5fb8f2afc8343ad79306e80834f52d77d
|
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 4.2.0
|
6
|
+
|
7
|
+
* [#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 ([@ruanwood])
|
9
|
+
|
10
|
+
## 4.1.0
|
11
|
+
|
12
|
+
* [#304](https://github.com/rails/web-console/pull/304) Add support for Rails 6.1 ([@stephannv])
|
13
|
+
* [#298](https://github.com/rails/web-console/pull/298) Prevent deprecation warnings by removing template formats ([@mikelkew])
|
14
|
+
* [#297](https://github.com/rails/web-console/pull/297) Use MutationObserver instead of Mutation Events ([@mikelkew])
|
15
|
+
* [#296](https://github.com/rails/web-console/pull/296) Add CSP nonce to injected scripts and styles ([@mikelkew])
|
16
|
+
|
17
|
+
## 4.0.4
|
18
|
+
|
19
|
+
* [fb483743](https://github.com/rails/web-console/commit/fb483743a6a2a4168cdc0b2e03f48fc393991b73) Fix a crash on webrick with Rack 2.2.3 ([@gsamokovarov])
|
20
|
+
|
21
|
+
## 4.0.3
|
22
|
+
|
23
|
+
* [#291](https://github.com/rails/web-console/pull/291) Deprecate config.web_console.whitelisted_ips ([@JuanitoFatas])
|
24
|
+
* [#290](https://github.com/rails/web-console/pull/290) Fix Content-Length for rack >= 2.1.0 ([@p8])
|
25
|
+
|
5
26
|
## 4.0.2
|
6
27
|
|
7
28
|
* [#285](https://github.com/rails/web-console/pull/285) Increase timeout on paste ([@celvro])
|
@@ -12,12 +33,12 @@
|
|
12
33
|
|
13
34
|
## 4.0.0
|
14
35
|
|
15
|
-
* [
|
16
|
-
* [
|
17
|
-
* [
|
18
|
-
* [
|
19
|
-
* [
|
20
|
-
* [
|
36
|
+
* [61ce65b5](https://github.com/rails/web-console/commit/61ce65b599f56809de1bd8da6590a80acbd92017) Move to config.web_console.permissions ([@gsamokovarov])
|
37
|
+
* [96127ac1](https://github.com/rails/web-console/commit/96127aac143e1e653fffdc4bb65e1ce0b5ff342d) Introduce Binding#console as an alternative interface ([@gsamokovarov])
|
38
|
+
* [d4591ca5](https://github.com/rails/web-console/commit/d4591ca5396ed15a08818f3da11134852a485b27) Introduce Rails 6 support ([@gsamokovarov])
|
39
|
+
* [f97d8a88](https://github.com/rails/web-console/commit/f97d8a889a38366485e5c5e8985995c19bf61d13) Introduce Ruby 2.6 support ([@gsamokovarov])
|
40
|
+
* [d6deacd9](https://github.com/rails/web-console/commit/d6deacd9d5fcaabf3e3051d6985b53f924f86956) Drop Rails 5 support ([@gsamokovarov])
|
41
|
+
* [90fda878](https://github.com/rails/web-console/commit/90fda8789d402f05647c18f8cdf8e5c3d01692dd) Drop Ruby 2.4 support ([@gsamokovarov])
|
21
42
|
* [#265](https://github.com/rails/web-console/pull/265) Add support for nested exceptions ([@yuki24])
|
22
43
|
|
23
44
|
## 3.7.0
|
@@ -136,6 +157,8 @@ go to 3.1.0 instead.
|
|
136
157
|
* [#84](https://github.com/rails/web-console/pull/84) Allow Rails 5 as dependency in gemspec ([@jonatack])
|
137
158
|
* [#69](https://github.com/rails/web-console/pull/69) Introduce middleware for request dispatch and console rendering ([@gsamokovarov])
|
138
159
|
|
160
|
+
[@stephannv]: https://github.com/stephannv
|
161
|
+
[@mikelkew]: https://github.com/mikelkew
|
139
162
|
[@jonatack]: https://github.com/jonatack
|
140
163
|
[@ryandao]: https://github.com/ryandao
|
141
164
|
[@jeffnv]: https://github.com/jeffnv
|
@@ -159,3 +182,7 @@ go to 3.1.0 instead.
|
|
159
182
|
[@yuki24]: https://github.com/yuki24
|
160
183
|
[@patorash]: https://github.com/patorash
|
161
184
|
[@celvro]: https://github.com/celvro
|
185
|
+
[@JuanitoFatas]: https://github.com/JuanitoFatas
|
186
|
+
[@p8]: https://github.com/p8
|
187
|
+
[@voxik]: https://github.com/voxik
|
188
|
+
[@ryanwood]: https://github.com/ryanwood
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2014-2016
|
1
|
+
Copyright 2014-2016 Hailey Somerville, Genadi Samokovarov, Guillermo Iguaran and Ryan Dao
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.markdown
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<p align=right>
|
2
|
-
Documentation for:
|
2
|
+
<strong>Current version: 4.1.0</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
|
+
<a href=https://github.com/rails/web-console/tree/v3.7.0>v3.7.0</a>
|
5
6
|
</p>
|
6
7
|
|
7
8
|
# Web Console [](https://travis-ci.org/rails/web-console)
|
@@ -66,7 +67,7 @@ By default, only requests coming from IPv4 and IPv6 localhosts are allowed.
|
|
66
67
|
`config.web_console.permissions` lets you control which IP's have access to
|
67
68
|
the console.
|
68
69
|
|
69
|
-
You can
|
70
|
+
You can allow single IP's or whole networks. Say you want to share your
|
70
71
|
console with `192.168.0.100`:
|
71
72
|
|
72
73
|
```ruby
|
@@ -75,7 +76,7 @@ class Application < Rails::Application
|
|
75
76
|
end
|
76
77
|
```
|
77
78
|
|
78
|
-
If you want to
|
79
|
+
If you want to allow the whole private network:
|
79
80
|
|
80
81
|
```ruby
|
81
82
|
Rails.application.configure do
|
@@ -174,15 +175,15 @@ Make sure your configuration lives in `config/environments/development.rb`.
|
|
174
175
|
|
175
176
|
## Credits
|
176
177
|
|
177
|
-
* Shoutout to [
|
178
|
+
* Shoutout to [Hailey Somerville] for [better_errors].
|
178
179
|
* Kudos to [John Mair] for [binding_of_caller] and [debug_inspector].
|
179
180
|
* Thanks to [Charles Oliver Nutter] for all the _JRuby_ feedback.
|
180
181
|
* Hugs and kisses to all of our [contributors]!
|
181
182
|
|
182
|
-
[better_errors]: https://github.com/
|
183
|
+
[better_errors]: https://github.com/BetterErrors/better_errors
|
183
184
|
[debug_inspector]: https://github.com/banister/debug_inspector
|
184
185
|
[binding_of_caller]: https://github.com/banister/binding_of_caller
|
185
|
-
[
|
186
|
+
[Hailey Somerville]: https://github.com/haileys
|
186
187
|
[John Mair]: https://github.com/banister
|
187
188
|
[Charles Oliver Nutter]: https://github.com/headius
|
188
189
|
[templates]: https://github.com/rails/web-console/tree/master/lib/web_console/templates
|
@@ -19,7 +19,12 @@ module WebConsole
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def eval(input)
|
22
|
-
|
22
|
+
# Binding#source_location is available since Ruby 2.6.
|
23
|
+
if @binding.respond_to? :source_location
|
24
|
+
"=> #{@binding.eval(input, *@binding.source_location).inspect}\n"
|
25
|
+
else
|
26
|
+
"=> #{@binding.eval(input).inspect}\n"
|
27
|
+
end
|
23
28
|
rescue Exception => exc
|
24
29
|
format_exception(exc)
|
25
30
|
end
|
data/lib/web_console/injector.rb
CHANGED
@@ -13,9 +13,11 @@ module WebConsole
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def inject(content)
|
16
|
-
#
|
17
|
-
# the
|
18
|
-
@headers
|
16
|
+
# Set Content-Length header to the size of the current body
|
17
|
+
# + the extra content. Otherwise the response will be truncated.
|
18
|
+
if @headers["Content-Length"]
|
19
|
+
@headers["Content-Length"] = (@body.bytesize + content.bytesize).to_s
|
20
|
+
end
|
19
21
|
|
20
22
|
[
|
21
23
|
if position = @body.rindex("</body>")
|
data/lib/web_console/railtie.rb
CHANGED
@@ -52,10 +52,25 @@ module WebConsole
|
|
52
52
|
end
|
53
53
|
|
54
54
|
initializer "web_console.permissions" do
|
55
|
-
permissions =
|
55
|
+
permissions = web_console_permissions
|
56
56
|
Request.permissions = Permissions.new(permissions)
|
57
57
|
end
|
58
58
|
|
59
|
+
def web_console_permissions
|
60
|
+
case
|
61
|
+
when config.web_console.permissions
|
62
|
+
config.web_console.permissions
|
63
|
+
when config.web_console.allowed_ips
|
64
|
+
config.web_console.allowed_ips
|
65
|
+
when config.web_console.whitelisted_ips
|
66
|
+
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
67
|
+
The config.web_console.whitelisted_ips is deprecated and will be ignored in future release of web_console.
|
68
|
+
Please use config.web_console.allowed_ips instead.
|
69
|
+
MSG
|
70
|
+
config.web_console.whitelisted_ips
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
59
74
|
initializer "web_console.whiny_requests" do
|
60
75
|
if config.web_console.key?(:whiny_requests)
|
61
76
|
Middleware.whiny_requests = config.web_console.whiny_requests
|
data/lib/web_console/template.rb
CHANGED
@@ -17,7 +17,7 @@ module WebConsole
|
|
17
17
|
|
18
18
|
# Render a template (inferred from +template_paths+) as a plain string.
|
19
19
|
def render(template)
|
20
|
-
view = View.
|
20
|
+
view = View.with_empty_template_cache.with_view_paths(template_paths, instance_values)
|
21
21
|
view.render(template: template, layout: false)
|
22
22
|
end
|
23
23
|
end
|
@@ -251,12 +251,14 @@ Autocomplete.prototype.removeView = function() {
|
|
251
251
|
}
|
252
252
|
|
253
253
|
// HTML strings for dynamic elements.
|
254
|
-
var consoleInnerHtml = <%= render_inlined_string '_inner_console_markup
|
255
|
-
var promptBoxHtml = <%= render_inlined_string '_prompt_box_markup
|
254
|
+
var consoleInnerHtml = <%= render_inlined_string '_inner_console_markup' %>;
|
255
|
+
var promptBoxHtml = <%= render_inlined_string '_prompt_box_markup' %>;
|
256
256
|
// CSS
|
257
|
-
var consoleStyleCss = <%= render_inlined_string 'style
|
257
|
+
var consoleStyleCss = <%= render_inlined_string 'style' %>;
|
258
258
|
// Insert a style element with the unique ID
|
259
259
|
var styleElementId = 'sr02459pvbvrmhco';
|
260
|
+
// Nonce to use for CSP
|
261
|
+
var styleElementNonce = '<%= @nonce %>';
|
260
262
|
|
261
263
|
// REPLConsole Constructor
|
262
264
|
function REPLConsole(config) {
|
@@ -416,6 +418,14 @@ REPLConsole.prototype.install = function(container) {
|
|
416
418
|
}
|
417
419
|
}
|
418
420
|
|
421
|
+
var observer = new MutationObserver(function(mutationsList) {
|
422
|
+
for (let mutation of mutationsList) {
|
423
|
+
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
|
424
|
+
shiftConsoleActions();
|
425
|
+
}
|
426
|
+
}
|
427
|
+
});
|
428
|
+
|
419
429
|
// Initialize
|
420
430
|
this.container = container;
|
421
431
|
this.outer = consoleOuter;
|
@@ -427,7 +437,7 @@ REPLConsole.prototype.install = function(container) {
|
|
427
437
|
|
428
438
|
findChild(container, 'resizer').addEventListener('mousedown', resizeContainer);
|
429
439
|
findChild(consoleActions, 'close-button').addEventListener('click', closeContainer);
|
430
|
-
|
440
|
+
observer.observe(consoleOuter, { childList: true, subtree: true });
|
431
441
|
|
432
442
|
REPLConsole.currentSession = this;
|
433
443
|
};
|
@@ -441,6 +451,9 @@ REPLConsole.prototype.insertCss = function() {
|
|
441
451
|
style.type = 'text/css';
|
442
452
|
style.innerHTML = consoleStyleCss;
|
443
453
|
style.id = styleElementId;
|
454
|
+
if (styleElementNonce.length > 0) {
|
455
|
+
style.nonce = styleElementNonce;
|
456
|
+
}
|
444
457
|
document.getElementsByTagName('head')[0].appendChild(style);
|
445
458
|
};
|
446
459
|
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
`<%= j yield %>`
|
data/lib/web_console/version.rb
CHANGED
data/lib/web_console/view.rb
CHANGED
@@ -22,6 +22,7 @@ module WebConsole
|
|
22
22
|
# leaking globals, unless you explicitly want to.
|
23
23
|
def render_javascript(template)
|
24
24
|
assign(template: template)
|
25
|
+
assign(nonce: @env["action_dispatch.content_security_policy_nonce"])
|
25
26
|
render(template: template, layout: "layouts/javascript")
|
26
27
|
end
|
27
28
|
|
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.0
|
4
|
+
version: 4.2.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:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-11-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -69,9 +69,9 @@ 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
|
76
76
|
- guilleiguaran@gmail.com
|
77
77
|
- daoduyducduong@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.1.6
|
142
|
+
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: A debugging tool for your Ruby on Rails applications.
|
145
145
|
test_files: []
|