grover 1.2.3 → 1.2.4

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: 3bf608ae368489f3130cc1af42bffa5026d9d14c1a7aa1ca1534dbd085fe6c0c
4
- data.tar.gz: 8dc8da4dd66e8b08a64514dc6497e5afb1179cd3c657a40597abb29f7573c9fd
3
+ metadata.gz: 5802a16dce1cb3dea2a458c546aa944244348700a620bc7f457922929eddf4ac
4
+ data.tar.gz: 91106f24cc30484d869cb19d35bf2a850851cee760cb1cb5ad1ce33a5d0a3db3
5
5
  SHA512:
6
- metadata.gz: a508fe62248fd9404e3240128f258d7b5d9d1dbcf3f747181366a50e0025fd4f46f52cade1d70083558b77d3cbb519fe16ed7cb1a00c914f2a014d3ecb3a74a3
7
- data.tar.gz: 29799af91ca664634ba205fed874f8f4fb2a19b6930780f68d5a8eae43337b1cefa5c5af5b104c294b026be7e71347b990e873935d9c9a1a34c61eb5f0c335ae
6
+ metadata.gz: 913c5292ae47d73bdd0e2298dbec7b0e89673371a486dcb82433f7a8e722414d50268fbcef5f724acef609f7bfe9c022c1527d150415d56b3434cfed309ce2b1
7
+ data.tar.gz: 5e2bb65db4893f6530a7eaed7b992078e639ee50e41a6e4234fc34c2d49666a47136772555d9993fb38b05f27e4cd5eff5ee60a82030d6640da818c1201f545b
@@ -92,6 +92,12 @@ const _processPage = (async (convertAction, uriOrHtml, options) => {
92
92
  launchParams.args = launchParams.args.concat(args);
93
93
  }
94
94
 
95
+ // Set browser type if given
96
+ const browserType = options.browser; delete options.browser;
97
+ if (browserType) {
98
+ launchParams.browser = browserType;
99
+ }
100
+
95
101
  // Set executable path if given
96
102
  const executablePath = options.executablePath; delete options.executablePath;
97
103
  if (executablePath) {
@@ -114,7 +120,11 @@ const _processPage = (async (convertAction, uriOrHtml, options) => {
114
120
  // Setting cookies
115
121
  const cookies = options.cookies; delete options.cookies
116
122
  if (Array.isArray(cookies)) {
117
- await page.setCookie(...cookies);
123
+ if (typeof browser.setCookie === 'function') {
124
+ await browser.setCookie(...cookies);
125
+ } else if (typeof page.setCookie === 'function') {
126
+ await page.setCookie(...cookies);
127
+ }
118
128
  }
119
129
 
120
130
  // Set caching flag (if provided)
@@ -8,6 +8,13 @@ class Grover
8
8
  # @see https://github.com/pdfkit/pdfkit
9
9
  #
10
10
  class Middleware # rubocop:disable Metrics/ClassLength
11
+ PDF_REGEX = /\.pdf$/i
12
+ private_constant :PDF_REGEX
13
+ PNG_REGEX = /\.png$/i
14
+ private_constant :PNG_REGEX
15
+ JPEG_REGEX = /\.jpe?g$/i
16
+ private_constant :JPEG_REGEX
17
+
11
18
  def initialize(app, *args)
12
19
  @app = app
13
20
  @pdf_request = false
@@ -40,10 +47,6 @@ class Grover
40
47
 
41
48
  private
42
49
 
43
- PDF_REGEX = /\.pdf$/i
44
- PNG_REGEX = /\.png$/i
45
- JPEG_REGEX = /\.jpe?g$/i
46
-
47
50
  attr_reader :pdf_request, :png_request, :jpeg_request
48
51
 
49
52
  def check_file_uri_configuration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Grover
4
- VERSION = '1.2.3'
4
+ VERSION = '1.2.4'
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.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bromwich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-31 00:00:00.000000000 Z
11
+ date: 2025-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri