grover 0.12.1 → 0.12.3

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: 7376874743ddb5f08d3fc68c02f84a72eb6cbe98c63306b2ce2a5f57d37867c9
4
+ data.tar.gz: 546007fe354d88c117f70469c8cf80ba88fd22415ebb350aa79512c64592be3f
5
5
  SHA512:
6
- metadata.gz: 280be92cb4f2fd14c94341d75b3564add657ec7acc496fe3cffd0b1d0d7bcde86ab492112fec7522fe6c666cc95045f8f5eaf06e5e6cd6d034abab443c8955ed
7
- data.tar.gz: 5a30bf3b21ea80eeb6b6f54c559f0fe7d0fd0559941028cebc71fd96fbd00dae24b2d67ecec29a413931cc0f883b4323282cc3308f69f370649720bd7a64639d
6
+ metadata.gz: 010bb2d49e78af9cfe56cc0480d803f217dd1f644d99d36640fad060e8a70a2be7b4d422057a761a5d0710347649dd44d3da9efde553b4ff23bff62838973af0
7
+ data.tar.gz: 5879e39b9d00a6b1c5904a4e71cdf00fc695caa29de7b85ca4dbcbf7ec857d87822c2be42ded362efd3ef2466f8c5db338182e8115cbe6b4b822a6114d5e50d8
@@ -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: Rack::Utils.escape(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.3'
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.3
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-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combine_pdf