@browserless.io/browserless 2.17.0-beta-2 → 2.18.0
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/CHANGELOG.md +21 -2
- package/build/browsers/browsers.cdp.js +4 -1
- package/build/http.d.ts +41 -41
- package/build/http.js +41 -41
- package/build/routes/chrome/http/content.post.body.json +9 -9
- package/build/routes/chrome/http/pdf.post.body.json +9 -9
- package/build/routes/chrome/http/scrape.post.body.json +9 -9
- package/build/routes/chrome/http/scrape.post.response.json +1 -1
- package/build/routes/chrome/http/screenshot.post.body.json +9 -9
- package/build/routes/chromium/http/content.post.body.json +9 -9
- package/build/routes/chromium/http/pdf.post.body.json +9 -9
- package/build/routes/chromium/http/scrape.post.body.json +9 -9
- package/build/routes/chromium/http/scrape.post.response.json +1 -1
- package/build/routes/chromium/http/screenshot.post.body.json +9 -9
- package/build/shared/utils/function/handler.js +3 -2
- package/package.json +8 -8
- package/scripts/build-open-api.js +4 -3
- package/src/browsers/browsers.cdp.ts +4 -1
- package/src/http.ts +41 -41
- package/src/shared/utils/function/handler.ts +3 -3
- package/static/docs/swagger.json +16 -16
- package/static/docs/swagger.min.json +15 -15
- package/static/function/client.js +34 -4
- package/static/function/index.html +34 -4
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
"type": "string"
|
|
324
324
|
},
|
|
325
325
|
"partitionKey": {
|
|
326
|
-
"description": "Cookie partition key.
|
|
326
|
+
"description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
|
|
327
327
|
"type": "string"
|
|
328
328
|
}
|
|
329
329
|
},
|
|
@@ -485,14 +485,14 @@
|
|
|
485
485
|
"length": {
|
|
486
486
|
"type": "number"
|
|
487
487
|
},
|
|
488
|
-
"__@toStringTag@
|
|
488
|
+
"__@toStringTag@264678": {
|
|
489
489
|
"type": "string",
|
|
490
490
|
"const": "Uint8Array"
|
|
491
491
|
}
|
|
492
492
|
},
|
|
493
493
|
"required": [
|
|
494
494
|
"BYTES_PER_ELEMENT",
|
|
495
|
-
"__@toStringTag@
|
|
495
|
+
"__@toStringTag@264678",
|
|
496
496
|
"buffer",
|
|
497
497
|
"byteLength",
|
|
498
498
|
"byteOffset",
|
|
@@ -527,13 +527,13 @@
|
|
|
527
527
|
"byteLength": {
|
|
528
528
|
"type": "number"
|
|
529
529
|
},
|
|
530
|
-
"__@toStringTag@
|
|
530
|
+
"__@toStringTag@264678": {
|
|
531
531
|
"type": "string"
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
"additionalProperties": false,
|
|
535
535
|
"required": [
|
|
536
|
-
"__@toStringTag@
|
|
536
|
+
"__@toStringTag@264678",
|
|
537
537
|
"byteLength"
|
|
538
538
|
]
|
|
539
539
|
},
|
|
@@ -543,18 +543,18 @@
|
|
|
543
543
|
"byteLength": {
|
|
544
544
|
"type": "number"
|
|
545
545
|
},
|
|
546
|
-
"__@species@
|
|
546
|
+
"__@species@264716": {
|
|
547
547
|
"$ref": "#/definitions/SharedArrayBuffer"
|
|
548
548
|
},
|
|
549
|
-
"__@toStringTag@
|
|
549
|
+
"__@toStringTag@264678": {
|
|
550
550
|
"type": "string",
|
|
551
551
|
"const": "SharedArrayBuffer"
|
|
552
552
|
}
|
|
553
553
|
},
|
|
554
554
|
"additionalProperties": false,
|
|
555
555
|
"required": [
|
|
556
|
-
"__@species@
|
|
557
|
-
"__@toStringTag@
|
|
556
|
+
"__@species@264716",
|
|
557
|
+
"__@toStringTag@264678",
|
|
558
558
|
"byteLength"
|
|
559
559
|
]
|
|
560
560
|
},
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
"type": "string"
|
|
248
248
|
},
|
|
249
249
|
"partitionKey": {
|
|
250
|
-
"description": "Cookie partition key.
|
|
250
|
+
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
|
|
251
251
|
"type": "string"
|
|
252
252
|
},
|
|
253
253
|
"partitionKeyOpaque": {
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
"type": "string"
|
|
321
321
|
},
|
|
322
322
|
"partitionKey": {
|
|
323
|
-
"description": "Cookie partition key.
|
|
323
|
+
"description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n(https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey).",
|
|
324
324
|
"type": "string"
|
|
325
325
|
}
|
|
326
326
|
},
|
|
@@ -528,14 +528,14 @@
|
|
|
528
528
|
"length": {
|
|
529
529
|
"type": "number"
|
|
530
530
|
},
|
|
531
|
-
"__@toStringTag@
|
|
531
|
+
"__@toStringTag@252509": {
|
|
532
532
|
"type": "string",
|
|
533
533
|
"const": "Uint8Array"
|
|
534
534
|
}
|
|
535
535
|
},
|
|
536
536
|
"required": [
|
|
537
537
|
"BYTES_PER_ELEMENT",
|
|
538
|
-
"__@toStringTag@
|
|
538
|
+
"__@toStringTag@252509",
|
|
539
539
|
"buffer",
|
|
540
540
|
"byteLength",
|
|
541
541
|
"byteOffset",
|
|
@@ -570,13 +570,13 @@
|
|
|
570
570
|
"byteLength": {
|
|
571
571
|
"type": "number"
|
|
572
572
|
},
|
|
573
|
-
"__@toStringTag@
|
|
573
|
+
"__@toStringTag@252509": {
|
|
574
574
|
"type": "string"
|
|
575
575
|
}
|
|
576
576
|
},
|
|
577
577
|
"additionalProperties": false,
|
|
578
578
|
"required": [
|
|
579
|
-
"__@toStringTag@
|
|
579
|
+
"__@toStringTag@252509",
|
|
580
580
|
"byteLength"
|
|
581
581
|
]
|
|
582
582
|
},
|
|
@@ -586,18 +586,18 @@
|
|
|
586
586
|
"byteLength": {
|
|
587
587
|
"type": "number"
|
|
588
588
|
},
|
|
589
|
-
"__@species@
|
|
589
|
+
"__@species@252547": {
|
|
590
590
|
"$ref": "#/definitions/SharedArrayBuffer"
|
|
591
591
|
},
|
|
592
|
-
"__@toStringTag@
|
|
592
|
+
"__@toStringTag@252509": {
|
|
593
593
|
"type": "string",
|
|
594
594
|
"const": "SharedArrayBuffer"
|
|
595
595
|
}
|
|
596
596
|
},
|
|
597
597
|
"additionalProperties": false,
|
|
598
598
|
"required": [
|
|
599
|
-
"__@species@
|
|
600
|
-
"__@toStringTag@
|
|
599
|
+
"__@species@252547",
|
|
600
|
+
"__@toStringTag@252509",
|
|
601
601
|
"byteLength"
|
|
602
602
|
]
|
|
603
603
|
},
|
|
@@ -3,9 +3,10 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
export default (config, logger, options = {}) => async (req, browser) => {
|
|
5
5
|
const isJson = req.headers['content-type']?.includes('json');
|
|
6
|
+
const functionPath = HTTPRoutes.function.replace('?(/)', '');
|
|
6
7
|
const functionAssetLocation = path.join(config.getStatic(), 'function');
|
|
7
|
-
const functionRequestPath = makeExternalURL(config.getExternalAddress(),
|
|
8
|
-
const functionIndexHTML = makeExternalURL(config.getExternalAddress(),
|
|
8
|
+
const functionRequestPath = makeExternalURL(config.getExternalAddress(), functionPath);
|
|
9
|
+
const functionIndexHTML = makeExternalURL(config.getExternalAddress(), functionPath, '/index.html');
|
|
9
10
|
const { code: rawCode, context: rawContext } = isJson
|
|
10
11
|
? req.body
|
|
11
12
|
: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserless.io/browserless",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"license": "SSPL",
|
|
5
5
|
"description": "The browserless platform",
|
|
6
6
|
"author": "browserless.io",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"debug": "^4.3.6",
|
|
52
52
|
"del": "^7.0.0",
|
|
53
53
|
"enjoi": "^9.0.1",
|
|
54
|
-
"file-type": "^19.4.
|
|
54
|
+
"file-type": "^19.4.1",
|
|
55
55
|
"get-port": "^7.1.0",
|
|
56
56
|
"gradient-string": "^2.0.0",
|
|
57
57
|
"http-proxy": "^1.18.1",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"playwright-1.42": "npm:playwright-core@1.42.1",
|
|
62
62
|
"playwright-1.43": "npm:playwright-core@1.43.1",
|
|
63
63
|
"playwright-1.44": "npm:playwright-core@1.44.1",
|
|
64
|
-
"playwright-core": "^1.46.
|
|
65
|
-
"puppeteer-core": "^23.
|
|
64
|
+
"playwright-core": "^1.46.1",
|
|
65
|
+
"puppeteer-core": "^23.1.1",
|
|
66
66
|
"puppeteer-extra": "^3.3.6",
|
|
67
67
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
68
68
|
"queue": "^7.0.0",
|
|
69
|
-
"systeminformation": "^5.23.
|
|
69
|
+
"systeminformation": "^5.23.5",
|
|
70
70
|
"tar-fs": "^3.0.6"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/http-proxy": "^1.17.15",
|
|
77
77
|
"@types/micromatch": "^4.0.9",
|
|
78
78
|
"@types/mocha": "^10.0.7",
|
|
79
|
-
"@types/node": "^22.
|
|
79
|
+
"@types/node": "^22.5.0",
|
|
80
80
|
"@types/sinon": "^17.0.3",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
82
82
|
"@typescript-eslint/parser": "^7.18.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"chai": "^5.1.1",
|
|
85
85
|
"cross-env": "^7.0.3",
|
|
86
86
|
"env-cmd": "^10.1.0",
|
|
87
|
-
"esbuild": "^0.23.
|
|
87
|
+
"esbuild": "^0.23.1",
|
|
88
88
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
89
89
|
"eslint": "^8.57.0",
|
|
90
90
|
"eslint-plugin-typescript-sort-keys": "^3.2.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"sinon": "^18.0.0",
|
|
98
98
|
"ts-node": "^10.9.2",
|
|
99
99
|
"typescript": "^5.5.4",
|
|
100
|
-
"typescript-json-schema": "^0.
|
|
100
|
+
"typescript-json-schema": "^0.65.1"
|
|
101
101
|
},
|
|
102
102
|
"playwrightVersions": {
|
|
103
103
|
"default": "playwright-core",
|
|
@@ -109,9 +109,10 @@ const buildOpenAPI = async (
|
|
|
109
109
|
const query = routeModule.replace('.js', '.query.json');
|
|
110
110
|
const response = routeModule.replace('.js', '.response.json');
|
|
111
111
|
const isWebSocket = routeModule.includes('/ws/') || name.endsWith('ws');
|
|
112
|
-
const path =
|
|
113
|
-
? route.path.join(' ')
|
|
114
|
-
|
|
112
|
+
const path = (
|
|
113
|
+
Array.isArray(route.path) ? route.path.join(' ') : route.path
|
|
114
|
+
).replace(/\?\(\/\)/g, '');
|
|
115
|
+
|
|
115
116
|
const {
|
|
116
117
|
tags,
|
|
117
118
|
description,
|
|
@@ -195,7 +195,10 @@ export class ChromiumCDP extends EventEmitter {
|
|
|
195
195
|
|
|
196
196
|
// Bypass the host we bind to so things like /function can work with proxies
|
|
197
197
|
if (options.args?.some((arg) => arg.includes('--proxy-server'))) {
|
|
198
|
-
const bypassList = [
|
|
198
|
+
const bypassList = [
|
|
199
|
+
this.config.getHost(),
|
|
200
|
+
new URL(this.config.getExternalAddress()).hostname,
|
|
201
|
+
];
|
|
199
202
|
options.args.push(`--proxy-bypass-list=${bypassList.join(',')}`);
|
|
200
203
|
}
|
|
201
204
|
|
package/src/http.ts
CHANGED
|
@@ -82,54 +82,54 @@ export enum Methods {
|
|
|
82
82
|
export enum WebsocketRoutes {
|
|
83
83
|
'/' = '?(/)',
|
|
84
84
|
browser = '/devtools/browser/*',
|
|
85
|
-
chrome = '/chrome',
|
|
86
|
-
chromePlaywright = '/chrome/playwright',
|
|
87
|
-
chromium = '/chromium',
|
|
88
|
-
chromiumPlaywright = '/chromium/playwright',
|
|
89
|
-
firefoxPlaywright = '/firefox/playwright',
|
|
85
|
+
chrome = '/chrome?(/)',
|
|
86
|
+
chromePlaywright = '/chrome/playwright?(/)',
|
|
87
|
+
chromium = '/chromium?(/)',
|
|
88
|
+
chromiumPlaywright = '/chromium/playwright?(/)',
|
|
89
|
+
firefoxPlaywright = '/firefox/playwright?(/)',
|
|
90
90
|
page = '/devtools/page/*',
|
|
91
|
-
playwrightChrome = '/playwright/chrome',
|
|
92
|
-
playwrightChromium = '/playwright/chromium',
|
|
93
|
-
playwrightFirefox = '/playwright/firefox',
|
|
94
|
-
playwrightWebkit = '/playwright/webkit',
|
|
95
|
-
webkitPlaywright = '/webkit/playwright',
|
|
91
|
+
playwrightChrome = '/playwright/chrome?(/)',
|
|
92
|
+
playwrightChromium = '/playwright/chromium?(/)',
|
|
93
|
+
playwrightFirefox = '/playwright/firefox?(/)',
|
|
94
|
+
playwrightWebkit = '/playwright/webkit?(/)',
|
|
95
|
+
webkitPlaywright = '/webkit/playwright?(/)',
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export enum HTTPRoutes {
|
|
99
|
-
chromeContent = '/chrome/content',
|
|
100
|
-
chromeDownload = '/chrome/download',
|
|
101
|
-
chromeFunction = '/chrome/function',
|
|
102
|
-
chromePdf = '/chrome/pdf',
|
|
103
|
-
chromePerformance = '/chrome/performance',
|
|
104
|
-
chromeScrape = '/chrome/scrape',
|
|
105
|
-
chromeScreenshot = '/chrome/screenshot',
|
|
106
|
-
chromiumContent = '/chromium/content',
|
|
107
|
-
chromiumDownload = '/chromium/download',
|
|
108
|
-
chromiumFunction = '/chromium/function',
|
|
109
|
-
chromiumPdf = '/chromium/pdf',
|
|
110
|
-
chromiumPerformance = '/chromium/performance',
|
|
111
|
-
chromiumScrape = '/chromium/scrape',
|
|
112
|
-
chromiumScreenshot = '/chromium/screenshot',
|
|
113
|
-
content = '/content',
|
|
114
|
-
download = '/download',
|
|
115
|
-
function = '/function',
|
|
116
|
-
jsonList = '/json/list',
|
|
117
|
-
jsonNew = '/json/new',
|
|
118
|
-
jsonProtocol = '/json/protocol',
|
|
119
|
-
jsonVersion = '/json/version',
|
|
120
|
-
pdf = '/pdf',
|
|
121
|
-
performance = '/performance',
|
|
122
|
-
scrape = '/scrape',
|
|
123
|
-
screenshot = '/screenshot',
|
|
99
|
+
chromeContent = '/chrome/content?(/)',
|
|
100
|
+
chromeDownload = '/chrome/download?(/)',
|
|
101
|
+
chromeFunction = '/chrome/function?(/)',
|
|
102
|
+
chromePdf = '/chrome/pdf?(/)',
|
|
103
|
+
chromePerformance = '/chrome/performance?(/)',
|
|
104
|
+
chromeScrape = '/chrome/scrape?(/)',
|
|
105
|
+
chromeScreenshot = '/chrome/screenshot?(/)',
|
|
106
|
+
chromiumContent = '/chromium/content?(/)',
|
|
107
|
+
chromiumDownload = '/chromium/download?(/)',
|
|
108
|
+
chromiumFunction = '/chromium/function?(/)',
|
|
109
|
+
chromiumPdf = '/chromium/pdf?(/)',
|
|
110
|
+
chromiumPerformance = '/chromium/performance?(/)',
|
|
111
|
+
chromiumScrape = '/chromium/scrape?(/)',
|
|
112
|
+
chromiumScreenshot = '/chromium/screenshot?(/)',
|
|
113
|
+
content = '/content?(/)',
|
|
114
|
+
download = '/download?(/)',
|
|
115
|
+
function = '/function?(/)',
|
|
116
|
+
jsonList = '/json/list?(/)',
|
|
117
|
+
jsonNew = '/json/new?(/)',
|
|
118
|
+
jsonProtocol = '/json/protocol?(/)',
|
|
119
|
+
jsonVersion = '/json/version?(/)',
|
|
120
|
+
pdf = '/pdf?(/)',
|
|
121
|
+
performance = '/performance?(/)',
|
|
122
|
+
scrape = '/scrape?(/)',
|
|
123
|
+
screenshot = '/screenshot?(/)',
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export enum HTTPManagementRoutes {
|
|
127
|
-
active = '/active',
|
|
128
|
-
config = '/config',
|
|
129
|
-
metrics = '/metrics',
|
|
130
|
-
metricsTotal = '/metrics/total',
|
|
131
|
-
pressure = '/pressure',
|
|
132
|
-
sessions = '/sessions',
|
|
127
|
+
active = '/active?(/)',
|
|
128
|
+
config = '/config?(/)',
|
|
129
|
+
metrics = '/metrics?(/)',
|
|
130
|
+
metricsTotal = '/metrics/total?(/)',
|
|
131
|
+
pressure = '/pressure?(/)',
|
|
132
|
+
sessions = '/sessions?(/)',
|
|
133
133
|
static = '/',
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -41,15 +41,15 @@ export default (config: Config, logger: Logger, options: HandlerOptions = {}) =>
|
|
|
41
41
|
browser: BrowserInstance,
|
|
42
42
|
): Promise<{ contentType: string; page: Page; payload: unknown }> => {
|
|
43
43
|
const isJson = req.headers['content-type']?.includes('json');
|
|
44
|
-
|
|
44
|
+
const functionPath = HTTPRoutes.function.replace('?(/)', '');
|
|
45
45
|
const functionAssetLocation = path.join(config.getStatic(), 'function');
|
|
46
46
|
const functionRequestPath = makeExternalURL(
|
|
47
47
|
config.getExternalAddress(),
|
|
48
|
-
|
|
48
|
+
functionPath,
|
|
49
49
|
);
|
|
50
50
|
const functionIndexHTML = makeExternalURL(
|
|
51
51
|
config.getExternalAddress(),
|
|
52
|
-
|
|
52
|
+
functionPath,
|
|
53
53
|
'/index.html',
|
|
54
54
|
);
|
|
55
55
|
|