@browserless/goto 13.0.7 → 13.0.8
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.
- package/package.json +5 -5
- package/src/engine.bin +0 -0
- package/src/index.js +20 -11
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/goto",
|
|
3
3
|
"description": "Navigate to web pages with built-in ad blocking, device emulation, and optimized loading for faster automation.",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=gotopage-options",
|
|
5
|
-
"version": "13.0.
|
|
5
|
+
"version": "13.0.8",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"puppeteer"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@browserless/devices": "
|
|
34
|
-
"@duckduckgo/autoconsent": "~14.
|
|
33
|
+
"@browserless/devices": "13.0.0",
|
|
34
|
+
"@duckduckgo/autoconsent": "~14.89.0",
|
|
35
35
|
"@ghostery/adblocker-puppeteer": "~2.17.0",
|
|
36
36
|
"debug-logfmt": "~1.4.10",
|
|
37
37
|
"got": "~11.8.6",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tough-cookie": "~6.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@browserless/test": "13.0.
|
|
45
|
+
"@browserless/test": "13.0.8",
|
|
46
46
|
"ava": "5",
|
|
47
47
|
"p-wait-for": "3"
|
|
48
48
|
},
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"timeout": "2m",
|
|
67
67
|
"workerThreads": false
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "57f681c2424f491469ba44a7b5d8a52829047ef1"
|
|
70
70
|
}
|
package/src/engine.bin
CHANGED
|
Binary file
|
package/src/index.js
CHANGED
|
@@ -251,7 +251,7 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
251
251
|
authenticate,
|
|
252
252
|
click,
|
|
253
253
|
colorScheme,
|
|
254
|
-
headers = {},
|
|
254
|
+
headers: rawHeaders = {},
|
|
255
255
|
html,
|
|
256
256
|
javascript = true,
|
|
257
257
|
mediaType,
|
|
@@ -362,13 +362,13 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
const device = getDevice({
|
|
365
|
-
headers,
|
|
365
|
+
headers: rawHeaders,
|
|
366
366
|
device: args.device ?? defaultDevice,
|
|
367
367
|
viewport: args.viewport
|
|
368
368
|
})
|
|
369
369
|
|
|
370
|
-
if (device.userAgent && !
|
|
371
|
-
|
|
370
|
+
if (device.userAgent && !rawHeaders['user-agent']) {
|
|
371
|
+
rawHeaders['user-agent'] = device.userAgent
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
if (!isEmpty(device.viewport) && !shallowEqualObjects(defaultViewport, device.viewport)) {
|
|
@@ -381,6 +381,15 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
381
381
|
)
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
+
// sec-fetch-* headers are per-request metadata the browser computes
|
|
385
|
+
// automatically (same-origin vs cross-site, navigation vs subresource, etc.).
|
|
386
|
+
// setExtraHTTPHeaders would stamp a single static value on every request,
|
|
387
|
+
// overriding Chrome's correct per-request values for cross-origin sub-resources.
|
|
388
|
+
const headers = {}
|
|
389
|
+
for (const key of Object.keys(rawHeaders)) {
|
|
390
|
+
if (!key.startsWith('sec-fetch-')) headers[key] = rawHeaders[key]
|
|
391
|
+
}
|
|
392
|
+
|
|
384
393
|
const headersKeys = Object.keys(headers)
|
|
385
394
|
|
|
386
395
|
if (headersKeys.length > 0) {
|
|
@@ -409,21 +418,21 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
409
418
|
}
|
|
410
419
|
|
|
411
420
|
if (cookie) {
|
|
412
|
-
const
|
|
413
|
-
const
|
|
421
|
+
const httpHeaders = {}
|
|
422
|
+
const httpHeadersKeys = []
|
|
414
423
|
|
|
415
424
|
for (const key of headersKeys) {
|
|
416
425
|
if (key === 'cookie') continue
|
|
417
|
-
|
|
418
|
-
|
|
426
|
+
httpHeaders[key] = headers[key]
|
|
427
|
+
httpHeadersKeys.push(key)
|
|
419
428
|
}
|
|
420
429
|
|
|
421
|
-
if (
|
|
430
|
+
if (httpHeadersKeys.length > 0) {
|
|
422
431
|
prePromises.push(
|
|
423
432
|
run({
|
|
424
|
-
fn: page.setExtraHTTPHeaders(
|
|
433
|
+
fn: page.setExtraHTTPHeaders(httpHeaders),
|
|
425
434
|
timeout: actionTimeout,
|
|
426
|
-
debug: { headers:
|
|
435
|
+
debug: { headers: httpHeadersKeys }
|
|
427
436
|
})
|
|
428
437
|
)
|
|
429
438
|
}
|