grover 0.8.3 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grover.rb +19 -2
- data/lib/grover/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b14e29e5c34afb7a6e620c20bca6137757df229f8cfa6b34b7e5f21d7051bb83
|
4
|
+
data.tar.gz: 32d534d05af4fa9558bf152a42d564749f2dd839c5c1d4d9b6e0c757aee2ad08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b74b31f57bbb032f3022dd7638f1693adc4b9bc8a0474e7f9f8f8d8697d600b03b391690c28ed01672e5adbe323572541690543713c3490fa631bae1f8b50e6d
|
7
|
+
data.tar.gz: e2f91373d7f61d97374c4de1229984747a466b0bb771305b32113fc553b9fc1e9bd762c12d7b8972eca0db6ec001d3672d17bd840ce5487701f1c9df9687afa0
|
data/lib/grover.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'grover/version'
|
4
4
|
|
5
5
|
require 'grover/utils'
|
6
|
-
require 'active_support_ext/object/deep_dup'
|
6
|
+
require 'active_support_ext/object/deep_dup' unless defined?(ActiveSupport)
|
7
7
|
|
8
8
|
require 'grover/html_preprocessor'
|
9
9
|
require 'grover/middleware'
|
@@ -47,10 +47,23 @@ class Grover
|
|
47
47
|
launchParams.args = launchParams.args.concat(args);
|
48
48
|
}
|
49
49
|
|
50
|
+
// Set executable path if given
|
51
|
+
const executablePath = options.executablePath; delete options.executablePath;
|
52
|
+
if (executablePath) {
|
53
|
+
launchParams.executablePath = executablePath;
|
54
|
+
}
|
55
|
+
|
50
56
|
// Launch the browser and create a page
|
51
57
|
browser = await puppeteer.launch(launchParams);
|
52
58
|
const page = await browser.newPage();
|
53
59
|
|
60
|
+
// Basic auth
|
61
|
+
const username = options.username; delete options.username
|
62
|
+
const password = options.password; delete options.password
|
63
|
+
if (username != undefined && password != undefined) {
|
64
|
+
await page.authenticate({ username, password });
|
65
|
+
}
|
66
|
+
|
54
67
|
// Set caching flag (if provided)
|
55
68
|
const cache = options.cache; delete options.cache;
|
56
69
|
if (cache != undefined) {
|
@@ -92,7 +105,11 @@ class Grover
|
|
92
105
|
// If specified, emulate the media type
|
93
106
|
const emulateMedia = options.emulateMedia; delete options.emulateMedia;
|
94
107
|
if (emulateMedia != undefined) {
|
95
|
-
|
108
|
+
if (typeof page.emulateMediaType == 'function') {
|
109
|
+
await page.emulateMediaType(emulateMedia);
|
110
|
+
} else {
|
111
|
+
await page.emulateMedia(emulateMedia);
|
112
|
+
}
|
96
113
|
}
|
97
114
|
|
98
115
|
// If we're running puppeteer in headless mode, return the converted PDF
|
data/lib/grover/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Bromwich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: combine_pdf
|