grover 1.2.5 → 1.2.6
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/lib/grover/configuration.rb +2 -1
- data/lib/grover/js/processor.cjs +8 -0
- data/lib/grover/version.rb +1 -1
- data/lib/grover.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52cfb87c3efabd49ef2e83562f918ca7c8f5e0d51721ae52ca35ad9281b2b378
|
|
4
|
+
data.tar.gz: 6ecadfce0b7efb45a693df41f0065a0136ed315555b65c0580ace664b4f380c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f41aa2df2e2580e1102830315b0845a00cbe4184d2aee839e1161e11fcc22fa794209293ca50c5bb7c543404b79ae71251b7fb3131ae0e1350e8aa72374f0d77
|
|
7
|
+
data.tar.gz: e7df3f9cca33bf7dd1f18010dbfd01f85f8ac616601f337372ff968e5178a6f54a9429717dcd9a93bb01bcea79446d481374522112b373b96a06b731d243625c
|
data/lib/grover/configuration.rb
CHANGED
|
@@ -8,7 +8,7 @@ class Grover
|
|
|
8
8
|
attr_accessor :options, :meta_tag_prefix, :ignore_path, :ignore_request,
|
|
9
9
|
:root_url, :use_pdf_middleware, :use_png_middleware,
|
|
10
10
|
:use_jpeg_middleware, :js_runtime_bin,
|
|
11
|
-
:node_env_vars, :allow_file_uris
|
|
11
|
+
:node_env_vars, :allow_file_uris, :allow_local_network_access
|
|
12
12
|
|
|
13
13
|
def initialize # rubocop:disable Metrics/MethodLength
|
|
14
14
|
@options = {}
|
|
@@ -22,6 +22,7 @@ class Grover
|
|
|
22
22
|
@js_runtime_bin = ['node']
|
|
23
23
|
@node_env_vars = {}
|
|
24
24
|
@allow_file_uris = false
|
|
25
|
+
@allow_local_network_access = false
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
end
|
data/lib/grover/js/processor.cjs
CHANGED
|
@@ -200,6 +200,14 @@ const _processPage = (async (convertAction, uriOrHtml, options) => {
|
|
|
200
200
|
await page.evaluateOnNewDocument(evaluateOnNewDocument);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
// If specified (and enabled) and the browser is Chrome v132+ (supports the permission) allow local network access
|
|
204
|
+
const allowLocalNetworkAccess = options.allowLocalNetworkAccess; delete options.allowLocalNetworkAccess;
|
|
205
|
+
const browserVersion = await browser.version();
|
|
206
|
+
if (allowLocalNetworkAccess === true && Number.parseInt(browserVersion.match('^Chrome/(\\d+)')?.[1]) >= 132) {
|
|
207
|
+
const cdp = await page.createCDPSession();
|
|
208
|
+
await cdp.send('Browser.setPermission', { permission: { name: 'local-network-access' }, setting: 'granted' });
|
|
209
|
+
}
|
|
210
|
+
|
|
203
211
|
const raiseOnRequestFailure = options.raiseOnRequestFailure; delete options.raiseOnRequestFailure;
|
|
204
212
|
if (raiseOnRequestFailure) {
|
|
205
213
|
page.on('requestfinished', (request) => {
|
data/lib/grover/version.rb
CHANGED
data/lib/grover.rb
CHANGED
|
@@ -148,6 +148,7 @@ class Grover
|
|
|
148
148
|
normalized_options = Utils.normalize_object @options, excluding: ['extraHTTPHeaders']
|
|
149
149
|
normalized_options['path'] = path if path.is_a? ::String
|
|
150
150
|
normalized_options['allowFileUri'] = Grover.configuration.allow_file_uris == true
|
|
151
|
+
normalized_options['allowLocalNetworkAccess'] = Grover.configuration.allow_local_network_access == true
|
|
151
152
|
normalized_options
|
|
152
153
|
end
|
|
153
154
|
end
|