nw-builder 4.11.1 → 4.11.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw-builder",
3
- "version": "4.11.1",
3
+ "version": "4.11.3",
4
4
  "description": "Build NW.js desktop applications for MacOS, Windows and Linux.",
5
5
  "keywords": [
6
6
  "NW.js",
package/src/get/index.js CHANGED
@@ -93,6 +93,13 @@ async function get(options) {
93
93
 
94
94
  await decompress(nwFilePath, options.cacheDir);
95
95
 
96
+ await verify(
97
+ `${options.downloadUrl}/v${options.version}/SHASUMS256.txt`,
98
+ `${options.cacheDir}/shasum/${options.version}.txt`,
99
+ options.cacheDir,
100
+ options.ffmpeg,
101
+ );
102
+
96
103
  if (options.ffmpeg === true) {
97
104
 
98
105
  /**
@@ -126,12 +133,6 @@ async function get(options) {
126
133
 
127
134
  await decompress(ffmpegFilePath, options.cacheDir);
128
135
 
129
- await verify(
130
- `${options.downloadUrl}/v${options.version}/SHASUMS256.txt`,
131
- `${options.cacheDir}/shasum/${options.version}.txt`,
132
- options.cacheDir,
133
- );
134
-
135
136
  /**
136
137
  * Platform dependant file name of FFmpeg binary.
137
138
  * @type {string}
package/src/get/verify.js CHANGED
@@ -11,10 +11,11 @@ import util from '../util.js';
11
11
  * @param {string} shaUrl - URL to get the shasum text file from.
12
12
  * @param {string} shaOut - File path to shasum text file.
13
13
  * @param {string} cacheDir - File path to cache directory.
14
+ * @param {ffmpeg} ffmpeg - Toggle between community (true) and official (false) ffmpeg binary
14
15
  * @throws {Error}
15
16
  * @returns {Promise<boolean>} - Returns true if the checksums match.
16
17
  */
17
- export default async function verify(shaUrl, shaOut, cacheDir) {
18
+ export default async function verify(shaUrl, shaOut, cacheDir, ffmpeg) {
18
19
  const shaOutExists = await util.fileExists(shaOut);
19
20
 
20
21
  if (shaOutExists === false) {
@@ -38,7 +39,11 @@ export default async function verify(shaUrl, shaOut, cacheDir) {
38
39
  hash.update(fileBuffer);
39
40
  const generatedSha = hash.digest('hex');
40
41
  if (storedSha !== generatedSha) {
41
- throw new Error(`SHA256 checksums do not match. The file ${filePath} expected shasum is ${storedSha} but the actual shasum is ${generatedSha}.`);
42
+ if (filePath.includes('ffmpeg') && ffmpeg) {
43
+ console.warn(`The generated shasum for the community ffmpeg at ${filePath} is ${generatedSha}. The integrity of this file should be manually verified.`);
44
+ } else {
45
+ throw new Error(`SHA256 checksums do not match. The file ${filePath} expected shasum is ${storedSha} but the actual shasum is ${generatedSha}.`);
46
+ }
42
47
  }
43
48
  }
44
49
  }