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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94bf9165b86ca61e991fe68ce0359174c5235d934d49f9b478e9bf85ab353426
4
- data.tar.gz: 4b085e432dec774fa5ee6e4e9b18c8f900a2918ae708e8195c57be8885a2673a
3
+ metadata.gz: 52cfb87c3efabd49ef2e83562f918ca7c8f5e0d51721ae52ca35ad9281b2b378
4
+ data.tar.gz: 6ecadfce0b7efb45a693df41f0065a0136ed315555b65c0580ace664b4f380c1
5
5
  SHA512:
6
- metadata.gz: c4d2b9dbcbb1c94d43d1d4a031c8f600b8d7aecf96dc6d482e23c9686fa14606edeb00f7496e9c0eb58f8cc6ca254a11b49656fc26f97651b6f56ff691a0f50e
7
- data.tar.gz: 12c61c0e916e79855c97d2877694284b831cd1e35933ce17557631e9628f6fded412776eedc9c92b489ef1c3c1d8a76bccd8dc0016339c71a0c18d31a04d4dfc
6
+ metadata.gz: f41aa2df2e2580e1102830315b0845a00cbe4184d2aee839e1161e11fcc22fa794209293ca50c5bb7c543404b79ae71251b7fb3131ae0e1350e8aa72374f0d77
7
+ data.tar.gz: e7df3f9cca33bf7dd1f18010dbfd01f85f8ac616601f337372ff968e5178a6f54a9429717dcd9a93bb01bcea79446d481374522112b373b96a06b731d243625c
@@ -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
@@ -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) => {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.2.5'
4
+ VERSION = '1.2.6'
5
5
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich