camoufox-js 0.11.5 → 0.12.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/__main__.js +2 -2
- package/dist/locale.js +22 -2
- package/dist/pkgman.js +1 -1
- package/package.json +4 -4
package/dist/__main__.js
CHANGED
|
@@ -72,9 +72,9 @@ program.command("fetch").action(async () => {
|
|
|
72
72
|
const updater = await CamoufoxUpdate.create();
|
|
73
73
|
await updater.update();
|
|
74
74
|
if (ALLOW_GEOIP) {
|
|
75
|
-
downloadMMDB();
|
|
75
|
+
await downloadMMDB();
|
|
76
76
|
}
|
|
77
|
-
maybeDownloadAddons(DefaultAddons);
|
|
77
|
+
await maybeDownloadAddons(DefaultAddons);
|
|
78
78
|
});
|
|
79
79
|
program.command("remove").action(async () => {
|
|
80
80
|
const updater = await CamoufoxUpdate.create();
|
package/dist/locale.js
CHANGED
|
@@ -154,8 +154,28 @@ export async function downloadMMDB() {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
const assetUrl = await new MaxMindDownloader(MMDB_REPO).getAsset();
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
// Download into a temporary file and only move it into place once the
|
|
158
|
+
// download finished. Writing straight to MMDB_FILE leaves an empty or
|
|
159
|
+
// truncated database behind when the download fails, and getGeolocation()
|
|
160
|
+
// only checks that the file exists - so every later run would pick up the
|
|
161
|
+
// corrupt file and fail until it is removed by hand.
|
|
162
|
+
const tempFile = `${MMDB_FILE}.${process.pid}.download`;
|
|
163
|
+
const fileStream = fs.createWriteStream(tempFile);
|
|
164
|
+
try {
|
|
165
|
+
await webdl(assetUrl, "Downloading GeoIP database", true, fileStream);
|
|
166
|
+
// Flush and close before renaming, otherwise the database can be opened
|
|
167
|
+
// while the last chunks are still buffered.
|
|
168
|
+
await new Promise((resolve, reject) => fileStream.close((err) => (err ? reject(err) : resolve())));
|
|
169
|
+
fs.renameSync(tempFile, MMDB_FILE);
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
// Close before removing: Windows can't unlink a file with an open handle.
|
|
173
|
+
if (!fileStream.closed) {
|
|
174
|
+
await new Promise((resolve) => fileStream.close(() => resolve()));
|
|
175
|
+
}
|
|
176
|
+
fs.rmSync(tempFile, { force: true });
|
|
177
|
+
throw e;
|
|
178
|
+
}
|
|
159
179
|
}
|
|
160
180
|
export function removeMMDB() {
|
|
161
181
|
if (!fs.existsSync(MMDB_FILE)) {
|
package/dist/pkgman.js
CHANGED
|
@@ -388,7 +388,7 @@ export async function unzip(zipFile, extractPath, desc, bar = true) {
|
|
|
388
388
|
if (bar) {
|
|
389
389
|
console.log(`Extracting ${entry.entryName}`);
|
|
390
390
|
}
|
|
391
|
-
zip.extractEntryTo(entry, extractPath,
|
|
391
|
+
zip.extractEntryTo(entry, extractPath, true, true);
|
|
392
392
|
}
|
|
393
393
|
if (bar) {
|
|
394
394
|
console.log("Extraction complete.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camoufox-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"bin": "dist/__main__.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"language-tags": "^2.0.1",
|
|
34
34
|
"maxmind": "^5.0.0",
|
|
35
35
|
"pretty-bytes": "^7.1.0",
|
|
36
|
-
"ua-parser-js": "^2.0.
|
|
36
|
+
"ua-parser-js": "^2.0.10",
|
|
37
37
|
"xml2js": "^0.6.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"@types/language-tags": "^1.0.4",
|
|
45
45
|
"@types/node": "^24.0.0",
|
|
46
46
|
"@types/xml2js": "^0.4.14",
|
|
47
|
-
"playwright-core": "
|
|
47
|
+
"playwright-core": "<1.61.0",
|
|
48
48
|
"rimraf": "^6.0.1",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"playwright-core": "
|
|
53
|
+
"playwright-core": "<1.61.0"
|
|
54
54
|
},
|
|
55
55
|
"devEngines": {
|
|
56
56
|
"packageManager": {
|