camoufox-js 0.11.2 → 0.11.4

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/addons.js CHANGED
@@ -69,6 +69,11 @@ export async function maybeDownloadAddons(addons, addonsList = []) {
69
69
  }
70
70
  catch (e) {
71
71
  console.error(`Failed to download and extract ${addonName}: ${e}`);
72
+ // Clean up the empty directory created before the download attempt.
73
+ // Without this, the next retry sees the directory and treats it as
74
+ // a successfully downloaded addon, then crashes with "manifest.json
75
+ // is missing" in confirmPaths.
76
+ fs.rmSync(addonPath, { recursive: true, force: true });
72
77
  }
73
78
  }
74
79
  }
package/dist/utils.js CHANGED
@@ -74,8 +74,7 @@ function loadProperties(filePath) {
74
74
  return acc;
75
75
  }, {});
76
76
  }
77
- function validateConfig(configMap, path) {
78
- const propertyTypes = loadProperties(path);
77
+ function validateConfig(configMap, propertyTypes) {
79
78
  for (const [key, value] of Object.entries(configMap)) {
80
79
  const expectedType = propertyTypes[key];
81
80
  if (!expectedType) {
@@ -370,11 +369,16 @@ export async function launchOptions({ config, os, block_images, block_webrtc, bl
370
369
  // a per-launch audio:seed the AudioFingerprintManager defaults to 0, so every
371
370
  // spoofed context returns identical audio samples — a "same machine behind
372
371
  // many identities" tell on CreepJS. setInto is "set only if unset", so a
373
- // caller-supplied seed wins (the JS equivalent of setdefault).
372
+ // caller-supplied seed wins (the JS equivalent of setdefault). audio:seed and
373
+ // canvas:seed only exist since Camoufox 2.0, and the library supports older
374
+ // builds, so seed only what the installed browser's schema knows.
374
375
  const randint = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
375
- setInto(config, "fonts:spacing_seed", randint(1, 4_294_967_295));
376
- setInto(config, "audio:seed", randint(1, 4_294_967_295));
377
- setInto(config, "canvas:seed", randint(1, 4_294_967_295));
376
+ const knownProperties = loadProperties(executable_path);
377
+ for (const seed of ["fonts:spacing_seed", "audio:seed", "canvas:seed"]) {
378
+ if (seed in knownProperties) {
379
+ setInto(config, seed, randint(1, 4_294_967_295));
380
+ }
381
+ }
378
382
  const targetOS = getTargetOS(config);
379
383
  // Set a random window.history.length
380
384
  setInto(config, "window.history.length", Math.floor(Math.random() * 5) + 1);
@@ -489,7 +493,7 @@ export async function launchOptions({ config, os, block_images, block_webrtc, bl
489
493
  console.debug(config);
490
494
  }
491
495
  // Validate the config
492
- validateConfig(config, executable_path);
496
+ validateConfig(config, knownProperties);
493
497
  //Prepare environment variables to pass to Camoufox
494
498
  const env_vars = {
495
499
  ...getEnvVars(config, targetOS),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camoufox-js",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": "dist/__main__.js",
@@ -23,11 +23,11 @@
23
23
  "license": "MPL-2.0",
24
24
  "description": "Experimental JS port of Camoufox for Python.",
25
25
  "dependencies": {
26
- "adm-zip": "^0.5.16",
27
- "better-sqlite3": "^12.10.0",
26
+ "adm-zip": "^0.6.0",
27
+ "better-sqlite3": "^13.0.1",
28
28
  "cli-progress": "^3.12.0",
29
29
  "commander": "^14.0.0",
30
- "fingerprint-generator": "^2.1.66",
30
+ "fingerprint-generator": "^2.1.86",
31
31
  "glob": "^13.0.0",
32
32
  "impit": "^0.14.1",
33
33
  "language-tags": "^2.0.1",