@skrillex1224/playwright-toolkit 3.0.12 → 3.0.14

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/index.cjs CHANGED
@@ -5312,6 +5312,9 @@ var DEFAULT_CLOAK_HUMANIZE_OPTIONS = Object.freeze({
5312
5312
  var DEFAULT_CLOAK_GOTO_OPTIONS = Object.freeze({
5313
5313
  waitUntil: "commit"
5314
5314
  });
5315
+ var DEFAULT_CLOAK_FINGERPRINT_PLATFORM = "linux";
5316
+ var CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX = "--fingerprint-platform=";
5317
+ var SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
5315
5318
  var cachedCloakModulePromise = null;
5316
5319
  var hasOwn = (target, key) => Object.prototype.hasOwnProperty.call(target, key);
5317
5320
  var loadCloakModule = async () => {
@@ -5341,6 +5344,17 @@ var normalizeStringArray = (value) => {
5341
5344
  }
5342
5345
  return value.map((item) => String(item || "").trim()).filter(Boolean);
5343
5346
  };
5347
+ var resolveCloakFingerprintPlatformArg = (fingerprintPlatform = "", args = []) => {
5348
+ const normalizedFingerprintPlatform = String(fingerprintPlatform || "").trim().toLowerCase();
5349
+ if (SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS.has(normalizedFingerprintPlatform)) {
5350
+ return `${CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX}${normalizedFingerprintPlatform}`;
5351
+ }
5352
+ const existingArg = normalizeStringArray(args).find((value) => value.startsWith(CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX));
5353
+ if (existingArg) {
5354
+ return existingArg;
5355
+ }
5356
+ return `${CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX}${DEFAULT_CLOAK_FINGERPRINT_PLATFORM}`;
5357
+ };
5344
5358
  var resolveCloakProxy = (proxyConfiguration = {}) => {
5345
5359
  const config = normalizeObject2(proxyConfiguration);
5346
5360
  const proxyUrl = String(config.proxy_url || "").trim();
@@ -5476,6 +5490,7 @@ var CloakLaunch = {
5476
5490
  runInHeadfulMode = false,
5477
5491
  isRunningOnApify = false,
5478
5492
  launcher = null,
5493
+ fingerprintPlatform = "",
5479
5494
  cloakOptions = {},
5480
5495
  humanizeOptions = DEFAULT_CLOAK_HUMANIZE_OPTIONS,
5481
5496
  crawlerBaseOptions = {},
@@ -5489,7 +5504,8 @@ var CloakLaunch = {
5489
5504
  const activeBrowsers = /* @__PURE__ */ new Set();
5490
5505
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
5491
5506
  const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5492
- const extraArgs = normalizeStringArray(normalizedCloakOptions.args);
5507
+ const fingerprintPlatformArg = resolveCloakFingerprintPlatformArg(fingerprintPlatform, normalizedCloakOptions.args);
5508
+ const extraArgs = normalizeStringArray(normalizedCloakOptions.args).filter((value) => !value.startsWith(CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX));
5493
5509
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
5494
5510
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
5495
5511
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
@@ -5499,7 +5515,7 @@ var CloakLaunch = {
5499
5515
  ...normalizedCloakOptions,
5500
5516
  headless,
5501
5517
  proxy,
5502
- args: [...defaultArgs, ...extraArgs]
5518
+ args: [...defaultArgs, ...extraArgs, fingerprintPlatformArg]
5503
5519
  };
5504
5520
  const launchOptions = await buildCloakLaunchOptions(mergedCloakOptions);
5505
5521
  const fingerprintArg = extractFingerprintArg(launchOptions);