grover 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18d371bdb009b39ba004d06f24c35ddb4f51a0cd253082481d04b1c1dac45b57
4
- data.tar.gz: f20bfd80f394ef4c3c7e98128a6d0d5615387af7c1c6733f867ee24ead91c9e5
3
+ metadata.gz: eca69ef126018fb963db3b2ee4e17a4773971e1bd941c40deb461a656b06a0f7
4
+ data.tar.gz: dee3ebaaf0803fed402a3a5406c3584b431c1addddc1547582e31cbb2f47b6d7
5
5
  SHA512:
6
- metadata.gz: 280be92cb4f2fd14c94341d75b3564add657ec7acc496fe3cffd0b1d0d7bcde86ab492112fec7522fe6c666cc95045f8f5eaf06e5e6cd6d034abab443c8955ed
7
- data.tar.gz: 5a30bf3b21ea80eeb6b6f54c559f0fe7d0fd0559941028cebc71fd96fbd00dae24b2d67ecec29a413931cc0f883b4323282cc3308f69f370649720bd7a64639d
6
+ metadata.gz: 18f211457a4a08cc875ab3ce744d34b2c2cb8a0d31ff351b6cddec27433443e33f666d9693d6520112ac6f66c262c8e521e098e57245ab8b9691b03957f27c54
7
+ data.tar.gz: 13b8f5759db9786e3a98a3fbc9e2c2564b2d21c3a6f95d3d24e056b34c19325c1b647b7f2fa80b9138634808ad0472f9746c5f6a2be04afe95ad7284e3cb3438
@@ -17,13 +17,13 @@ class Grover
17
17
 
18
18
  def self.translate_relative_paths(html, root_url)
19
19
  # Try out this regexp using rubular http://rubular.com/r/hiAxBNX7KE
20
- html.gsub(%r{(href|src)=(['"])/([^/"']([^\"']*|[^"']*))?['"]}, "\\1=\\2#{root_url}\\3\\2")
20
+ html.gsub(%r{(href|src)=(['"])/([^/"']([^"']*|[^"']*))?['"]}, "\\1=\\2#{root_url}\\3\\2")
21
21
  end
22
22
  private_class_method :translate_relative_paths
23
23
 
24
24
  def self.translate_relative_protocols(body, protocol)
25
25
  # Try out this regexp using rubular http://rubular.com/r/0Ohk0wFYxV
26
- body.gsub(%r{(href|src)=(['"])//([^\"']*|[^"']*)['"]}, "\\1=\\2#{protocol}://\\3\\2")
26
+ body.gsub(%r{(href|src)=(['"])//([^"']*|[^"']*)['"]}, "\\1=\\2#{protocol}://\\3\\2")
27
27
  end
28
28
  private_class_method :translate_relative_protocols
29
29
  end
@@ -107,6 +107,13 @@ const _processPage = (async (convertAction, urlOrHtml, options) => {
107
107
  await page.evaluate(executeScript);
108
108
  }
109
109
 
110
+ // If specified, wait for selector
111
+ const waitForSelector = options.waitForSelector; delete options.waitForSelector;
112
+ const waitForSelectorOptions = options.waitForSelectorOptions; delete options.waitForSelectorOptions;
113
+ if (waitForSelector !== undefined) {
114
+ await page.waitForSelector(waitForSelector, waitForSelectorOptions)
115
+ }
116
+
110
117
  // If we're running puppeteer in headless mode, return the converted PDF
111
118
  if (debug === undefined || (typeof debug === 'object' && (debug.headless === undefined || debug.headless))) {
112
119
  return await page[convertAction](options);
@@ -97,9 +97,15 @@ class Grover
97
97
  def create_grover_for_response(response)
98
98
  body = response.respond_to?(:body) ? response.body : response.join
99
99
  body = body.join if body.is_a?(Array)
100
-
101
100
  body = HTMLPreprocessor.process body, root_url, protocol
102
- Grover.new(body, display_url: request_url)
101
+
102
+ options = { display_url: request_url }
103
+ cookies = Rack::Utils.parse_cookies(env).map do |name, value|
104
+ { name: name, value: value, domain: env['HTTP_HOST'] }
105
+ end
106
+ options[:cookies] = cookies if cookies.any?
107
+
108
+ Grover.new(body, options)
103
109
  end
104
110
 
105
111
  def add_cover_content(grover)
@@ -22,7 +22,7 @@ class Grover
22
22
 
23
23
  result['data'].pack('C*')
24
24
  ensure
25
- cleanup_process
25
+ cleanup_process if stdin
26
26
  end
27
27
 
28
28
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '0.12.1'
4
+ VERSION = '0.12.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf