grover 1.2.0 → 1.2.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: 50a8ec2a93d7be70d77b4aefd45f6a87296cbd0201f3fba5a2d962fce511f4b7
4
- data.tar.gz: 340a18b36da574c7cf57c897c3d767e890385279b681e345e2ba29cc5bf3430e
3
+ metadata.gz: fa11dd4c983b7d122791e035286bc18f9fdda40561f0102547b801aa4718013c
4
+ data.tar.gz: 77fb1776461acc88789f1405e4c3135b9857971116880239671f3302d4df0505
5
5
  SHA512:
6
- metadata.gz: 13124e1d70416020c29695bbf59f2618015def0d46d4d194c5ba514b4f4c48a2622adc6238c32254717601b50acaadc3beac5065fb19ffbdf864b5d8f4bda868
7
- data.tar.gz: dae49b29ab27b64b990f8f71f7571afb00e01c18a7a3b94571af2a1b74bd578248db4b712241e571674683052b196a8b4164095db449058a95d9e8f2509d9119
6
+ metadata.gz: d0e3ae26db5e6934bdb257c465001ac46f15404e201c1d5a431e96f03c36c4b27b1e10920337e0f67d4d012da55d9c651868b0497f20832ae191bb42eba29243
7
+ data.tar.gz: 5b9baa164d1fdb46b8a71dec29d68471622e9bd829742fee6975c19f2d2fc5b8a51b1f120f8ccebe7ee9ccfc1f38ed291881cb00998b7b72a90ae41bb0bd23d3
@@ -184,6 +184,12 @@ const _processPage = (async (convertAction, uriOrHtml, options) => {
184
184
  await page.setGeolocation(geolocation);
185
185
  }
186
186
 
187
+ // If specified, add script to evaluate before the page loads
188
+ const evaluateOnNewDocument = options.evaluateOnNewDocument; delete options.evaluateOnNewDocument;
189
+ if (evaluateOnNewDocument !== undefined) {
190
+ await page.evaluateOnNewDocument(evaluateOnNewDocument);
191
+ }
192
+
187
193
  const raiseOnRequestFailure = options.raiseOnRequestFailure; delete options.raiseOnRequestFailure;
188
194
  if (raiseOnRequestFailure) {
189
195
  page.on('requestfinished', (request) => {
@@ -40,9 +40,9 @@ class Grover
40
40
 
41
41
  private
42
42
 
43
- PDF_REGEX = /\.pdf$/i.freeze
44
- PNG_REGEX = /\.png$/i.freeze
45
- JPEG_REGEX = /\.jpe?g$/i.freeze
43
+ PDF_REGEX = /\.pdf$/i
44
+ PNG_REGEX = /\.png$/i
45
+ JPEG_REGEX = /\.jpe?g$/i
46
46
 
47
47
  attr_reader :pdf_request, :png_request, :jpeg_request
48
48
 
@@ -85,7 +85,7 @@ class Grover
85
85
  end
86
86
 
87
87
  def html_content?(headers)
88
- headers['Content-Type'] =~ %r{text/html|application/xhtml\+xml}
88
+ headers['content-type'] =~ %r{text/html|application/xhtml\+xml}
89
89
  end
90
90
 
91
91
  def update_response(response, headers)
@@ -155,11 +155,11 @@ class Grover
155
155
 
156
156
  def assign_headers(headers, body, content_type)
157
157
  # Do not cache results
158
- headers.delete 'ETag'
159
- headers.delete 'Cache-Control'
158
+ headers.delete 'etag'
159
+ headers.delete 'cache-control'
160
160
 
161
- headers['Content-Length'] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
162
- headers['Content-Type'] = content_type
161
+ headers['content-length'] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
162
+ headers['content-type'] = content_type
163
163
  end
164
164
 
165
165
  def configure_env_for_grover_request(env)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.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: 1.2.0
4
+ version: 1.2.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: 2024-11-19 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -59,10 +59,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 2.7.0
62
+ version: 3.0.0
63
63
  - - "<"
64
64
  - !ruby/object:Gem::Version
65
- version: 3.4.0
65
+ version: 3.5.0
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="