@bubblewrap/core 1.15.0 → 1.16.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/dist/lib/FetchUtils.js
CHANGED
|
@@ -20,6 +20,9 @@ const fs = require("fs");
|
|
|
20
20
|
const fetch_h2_1 = require("fetch-h2");
|
|
21
21
|
const node_fetch_1 = require("node-fetch");
|
|
22
22
|
const DEFAULT_FETCH_ENGINE = 'fetch-h2';
|
|
23
|
+
const userAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0';
|
|
24
|
+
const fetchh2Ctx = fetch_h2_1.context({ userAgent: userAgent, overwriteUserAgent: true });
|
|
25
|
+
const fetchh2 = fetchh2Ctx.fetch;
|
|
23
26
|
class FetchUtils {
|
|
24
27
|
constructor() {
|
|
25
28
|
this.fetchEngine = DEFAULT_FETCH_ENGINE;
|
|
@@ -29,10 +32,10 @@ class FetchUtils {
|
|
|
29
32
|
}
|
|
30
33
|
async fetch(input) {
|
|
31
34
|
if (this.fetchEngine == 'node-fetch') {
|
|
32
|
-
return await node_fetch_1.default(input, { redirect: 'follow' });
|
|
35
|
+
return await node_fetch_1.default(input, { redirect: 'follow', headers: { 'User-Agent': userAgent } });
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
35
|
-
return await
|
|
38
|
+
return await fetchh2(input, { redirect: 'follow' });
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
@@ -48,7 +51,7 @@ class FetchUtils {
|
|
|
48
51
|
readableStream = result.body;
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
|
-
result = await
|
|
54
|
+
result = await fetchh2(url, { redirect: 'follow' });
|
|
52
55
|
readableStream = await result.readable();
|
|
53
56
|
}
|
|
54
57
|
// Try to determine the file size via the `Content-Length` header. This may not be available
|
package/dist/lib/ImageHelper.js
CHANGED
|
@@ -105,7 +105,12 @@ class ImageHelper {
|
|
|
105
105
|
throw new Error(`This installation doesn't support image/svg. Please, ensure the optional
|
|
106
106
|
"svg2img" library is installed or use an alternative image format.`);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
try {
|
|
109
|
+
body = await svg2img_1.svg2img(iconUrl);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw new Error(`Problem reading ${iconUrl}: ${error.message}`);
|
|
113
|
+
}
|
|
109
114
|
}
|
|
110
115
|
return {
|
|
111
116
|
url: iconUrl,
|
|
@@ -95,8 +95,8 @@ class JdkHelper {
|
|
|
95
95
|
try {
|
|
96
96
|
const releaseFilePath = join(javaHome, 'release');
|
|
97
97
|
const file = await fs_1.promises.readFile(releaseFilePath, 'utf-8');
|
|
98
|
-
if (file.indexOf('JAVA_VERSION="
|
|
99
|
-
return Result_1.Result.error(new ValidatePathError_1.ValidatePathError('JDK version not supported. JDK version
|
|
98
|
+
if (file.indexOf('JAVA_VERSION="11.0') < 0) { // Checks if the jdk's version is 11 as needed
|
|
99
|
+
return Result_1.Result.error(new ValidatePathError_1.ValidatePathError('JDK version not supported. JDK version 11 is required.', 'PathIsNotSupported'));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblewrap/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Core Library to generate, build and sign TWA projects",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"svg2img": "^0.9.3"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8936e332adbbc33b3a5d398cce14947cd6c290d5"
|
|
60
60
|
}
|