@speedkit/cli 2.72.0 → 2.73.1
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 +15 -0
- package/README.md +1 -1
- package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +1 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +22 -8
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +1 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +13 -1
- package/oclif.manifest.json +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.73.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.73.0...v2.73.1) (2025-01-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **onboarding:** fallback to utf8 if unsupported charset is detected ([425cfb4](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/425cfb46862e5f1b7ed722fb9e603a98171f4398))
|
|
7
|
+
* **onboarding:** implement iconv-lite to get rid of charsetIssues ([1a0db84](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1a0db846c0461fc9faec25d041f8dc46f5b33252))
|
|
8
|
+
|
|
9
|
+
# [2.73.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.72.0...v2.73.0) (2025-01-08)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **customer-config:** add blacklist rule for kameleoon's graphical editor mode ([1bf310a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1bf310aba197e6f562c444a7ad590f28dbc47004))
|
|
15
|
+
|
|
1
16
|
# [2.72.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.71.0...v2.72.0) (2024-12-18)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CustomerDomainDocumentResponse = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const onboarding_model_1 = require("../onboarding-model");
|
|
5
6
|
const origin_response_1 = require("../browser/origin-response");
|
|
7
|
+
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
8
|
+
const SUPPORTED_CHARSETS = new Set(["ascii", "utf8", "utf16le", "latin1"]);
|
|
6
9
|
/**
|
|
7
10
|
* Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
|
|
8
11
|
* @implements {FetchRequestPausedEventHandler}
|
|
@@ -59,7 +62,11 @@ class CustomerDomainDocumentResponse {
|
|
|
59
62
|
if (!this.isHtmlContentHeader(event.responseHeaders)) {
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
62
|
-
|
|
65
|
+
const contentType = event.responseHeaders.find((headerRecord) => {
|
|
66
|
+
return headerRecord.name.toLowerCase() === "content-type";
|
|
67
|
+
})?.["value"] || "";
|
|
68
|
+
const charset = contentType.split("charset=")?.[1]?.trim() || "utf-8";
|
|
69
|
+
let text = await this.getHtmlContent(client, event, charset);
|
|
63
70
|
if (!this.isValidHtmlContent(text)) {
|
|
64
71
|
return;
|
|
65
72
|
}
|
|
@@ -75,6 +82,12 @@ class CustomerDomainDocumentResponse {
|
|
|
75
82
|
const content = this.removeContentSecurityPolicy
|
|
76
83
|
? this.removeContentSecurityMetaTag(text)
|
|
77
84
|
: text;
|
|
85
|
+
// replace origin contentTypeCharset with utf-8 as this is what it's converted to now
|
|
86
|
+
for (const header of headers) {
|
|
87
|
+
if (header.name.toLowerCase().includes("content-type")) {
|
|
88
|
+
header.value = header.value.replace(charset, "utf-8");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
78
91
|
return new origin_response_1.OriginResponse(content, headers, event.responseStatusCode);
|
|
79
92
|
}
|
|
80
93
|
isValidHtmlContent(text) {
|
|
@@ -92,18 +105,19 @@ class CustomerDomainDocumentResponse {
|
|
|
92
105
|
})?.["value"];
|
|
93
106
|
return contentType && contentType.includes("text/html");
|
|
94
107
|
}
|
|
95
|
-
async getHtmlContent(client, event) {
|
|
96
|
-
const contentType = event.responseHeaders.find((headerRecord) => {
|
|
97
|
-
return headerRecord.name.toLowerCase() === "content-type";
|
|
98
|
-
})?.["value"] || "";
|
|
99
|
-
let charset = contentType.split("charset=")?.[1] || "utf-8";
|
|
108
|
+
async getHtmlContent(client, event, charset) {
|
|
100
109
|
const { body, base64Encoded } = await client.send("Fetch.getResponseBody", {
|
|
101
110
|
requestId: event.requestId,
|
|
102
111
|
});
|
|
112
|
+
// create text from base64Encoded
|
|
103
113
|
if (base64Encoded) {
|
|
104
|
-
if
|
|
105
|
-
|
|
114
|
+
// make use of iconv if charset is not supported by node:buffer
|
|
115
|
+
if (!SUPPORTED_CHARSETS.has(charset)) {
|
|
116
|
+
return iconv_lite_1.default
|
|
117
|
+
.decode(Buffer.from(body, "base64"), charset.toLowerCase())
|
|
118
|
+
.toString();
|
|
106
119
|
}
|
|
120
|
+
// @ts-expect-error string is not valid
|
|
107
121
|
return Buffer.from(body, "base64").toString(charset);
|
|
108
122
|
}
|
|
109
123
|
return body;
|
|
@@ -13,6 +13,7 @@ export declare class VirtualOrestesApp {
|
|
|
13
13
|
private cli;
|
|
14
14
|
constructor(customerConfig: CustomerConfig, crawler: Crawler, documentHandler: DocumentHandlerServer, cache: Cache, cli: CliService);
|
|
15
15
|
fetchAssetResponse(event: Protocol.Fetch.RequestPausedEvent): Promise<Partial<Protocol.Fetch.FulfillRequestRequest> | AbortResponse>;
|
|
16
|
+
private getResponseText;
|
|
16
17
|
private returnErrorResponse;
|
|
17
18
|
private convertResponseHeadersToOrestesFormat;
|
|
18
19
|
private returnRedirect;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VirtualOrestesApp = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const baqend_response_1 = require("../browser/baqend-response");
|
|
5
6
|
const safe_1 = require("../../../helpers/safe");
|
|
6
7
|
const onboarding_model_1 = require("../onboarding-model");
|
|
8
|
+
const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
|
|
7
9
|
class VirtualOrestesApp {
|
|
8
10
|
customerConfig;
|
|
9
11
|
crawler;
|
|
@@ -44,7 +46,7 @@ class VirtualOrestesApp {
|
|
|
44
46
|
if (response.status > 300 && response.status < 400) {
|
|
45
47
|
return this.returnRedirect(customHeaders, response, event);
|
|
46
48
|
}
|
|
47
|
-
const responseContent = await
|
|
49
|
+
const responseContent = await this.getResponseText(response);
|
|
48
50
|
if (!this.isHtmlContentHeader(response.headers) ||
|
|
49
51
|
!this.isValidHtmlContent(responseContent)) {
|
|
50
52
|
const customResponse = new baqend_response_1.BaqendResponse(responseContent, response.headers.get("Content-Type") || null, customHeaders);
|
|
@@ -78,6 +80,16 @@ class VirtualOrestesApp {
|
|
|
78
80
|
this.cache.addEntry(event.request.url, baqendResponse);
|
|
79
81
|
return baqendResponse;
|
|
80
82
|
}
|
|
83
|
+
async getResponseText(response) {
|
|
84
|
+
const contentType = response.headers.get("content-type") || "";
|
|
85
|
+
const charset = contentType.split("charset=")?.[1]?.trim() || "utf-8";
|
|
86
|
+
if (charset.toLowerCase() !== "utf-8") {
|
|
87
|
+
return iconv_lite_1.default
|
|
88
|
+
.decode(Buffer.from(await response.arrayBuffer()), charset.toLowerCase())
|
|
89
|
+
.toString();
|
|
90
|
+
}
|
|
91
|
+
return await response.text();
|
|
92
|
+
}
|
|
81
93
|
returnErrorResponse(customResponse, customHeaders) {
|
|
82
94
|
const message = `Could not transform html: - ${customResponse.error}`;
|
|
83
95
|
this.cli.writeError(`[VirtualOrestes]: ${message}`);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speedkit/cli",
|
|
3
3
|
"description": "Speed Kit CLI",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.73.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Baqend.com",
|
|
7
7
|
"email": "info@baqend.com"
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
"@oclif/core": "^3.23",
|
|
71
71
|
"@oclif/plugin-autocomplete": "^3.0",
|
|
72
72
|
"@oclif/plugin-help": "^6.2.19",
|
|
73
|
-
"@oclif/plugin-not-found": "^3.2.
|
|
74
|
-
"@oclif/plugin-warn-if-update-available": "^3.1.
|
|
73
|
+
"@oclif/plugin-not-found": "^3.2.31",
|
|
74
|
+
"@oclif/plugin-warn-if-update-available": "^3.1.28",
|
|
75
75
|
"baqend": "^4.1.0",
|
|
76
76
|
"chalk": "^4.1.2",
|
|
77
77
|
"clipboardy-cjs": "^3.0.0",
|
|
78
78
|
"css-select": "5.1.0",
|
|
79
79
|
"deepmerge": "^4.3.1",
|
|
80
|
-
"diff": "^5.
|
|
80
|
+
"diff": "^5.2.0",
|
|
81
81
|
"dom-serializer": "2.0.0",
|
|
82
82
|
"domhandler": "5.0.3",
|
|
83
83
|
"domutils": "^3.1",
|
|
@@ -96,7 +96,8 @@
|
|
|
96
96
|
"strip-comments": "^2.0.1",
|
|
97
97
|
"uuid": "^9.0.1",
|
|
98
98
|
"esbuild": "^0.20.2",
|
|
99
|
-
"ts-node": "^10.9.2"
|
|
99
|
+
"ts-node": "^10.9.2",
|
|
100
|
+
"iconv-lite": "^0.6.3"
|
|
100
101
|
},
|
|
101
102
|
"devDependencies": {
|
|
102
103
|
"@commitlint/cli": "^17.8.1",
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
"@oclif/test": "^3",
|
|
107
108
|
"@types/chai": "^4.3.10",
|
|
108
109
|
"@types/fs-extra": "^9.0.13",
|
|
109
|
-
"@types/mocha": "^10.0",
|
|
110
|
+
"@types/mocha": "^10.0.10",
|
|
110
111
|
"@types/mock-fs": "^4.13.4",
|
|
111
112
|
"@types/node": "^20.12.7",
|
|
112
113
|
"@types/uuid": "^9.0.8",
|
|
@@ -121,7 +122,7 @@
|
|
|
121
122
|
"husky": "^8.0.3",
|
|
122
123
|
"lint-staged": "^14.0.1",
|
|
123
124
|
"memfs": "^4.8.0",
|
|
124
|
-
"mocha": "^10.
|
|
125
|
+
"mocha": "^10.8.2",
|
|
125
126
|
"mocha-junit-reporter": "^2.2.1",
|
|
126
127
|
"mock-fs": "^5.2.0",
|
|
127
128
|
"nock": "^13.5.6",
|