@skrillex1224/playwright-toolkit 3.0.13 → 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.js CHANGED
@@ -5284,6 +5284,9 @@ var DEFAULT_CLOAK_HUMANIZE_OPTIONS = Object.freeze({
5284
5284
  var DEFAULT_CLOAK_GOTO_OPTIONS = Object.freeze({
5285
5285
  waitUntil: "commit"
5286
5286
  });
5287
+ var DEFAULT_CLOAK_FINGERPRINT_PLATFORM = "linux";
5288
+ var CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX = "--fingerprint-platform=";
5289
+ var SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
5287
5290
  var cachedCloakModulePromise = null;
5288
5291
  var hasOwn = (target, key) => Object.prototype.hasOwnProperty.call(target, key);
5289
5292
  var loadCloakModule = async () => {
@@ -5313,6 +5316,17 @@ var normalizeStringArray = (value) => {
5313
5316
  }
5314
5317
  return value.map((item) => String(item || "").trim()).filter(Boolean);
5315
5318
  };
5319
+ var resolveCloakFingerprintPlatformArg = (fingerprintPlatform = "", args = []) => {
5320
+ const normalizedFingerprintPlatform = String(fingerprintPlatform || "").trim().toLowerCase();
5321
+ if (SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS.has(normalizedFingerprintPlatform)) {
5322
+ return `${CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX}${normalizedFingerprintPlatform}`;
5323
+ }
5324
+ const existingArg = normalizeStringArray(args).find((value) => value.startsWith(CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX));
5325
+ if (existingArg) {
5326
+ return existingArg;
5327
+ }
5328
+ return `${CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX}${DEFAULT_CLOAK_FINGERPRINT_PLATFORM}`;
5329
+ };
5316
5330
  var resolveCloakProxy = (proxyConfiguration = {}) => {
5317
5331
  const config = normalizeObject2(proxyConfiguration);
5318
5332
  const proxyUrl = String(config.proxy_url || "").trim();
@@ -5448,6 +5462,7 @@ var CloakLaunch = {
5448
5462
  runInHeadfulMode = false,
5449
5463
  isRunningOnApify = false,
5450
5464
  launcher = null,
5465
+ fingerprintPlatform = "",
5451
5466
  cloakOptions = {},
5452
5467
  humanizeOptions = DEFAULT_CLOAK_HUMANIZE_OPTIONS,
5453
5468
  crawlerBaseOptions = {},
@@ -5461,7 +5476,8 @@ var CloakLaunch = {
5461
5476
  const activeBrowsers = /* @__PURE__ */ new Set();
5462
5477
  const patchedBrowsers = /* @__PURE__ */ new WeakSet();
5463
5478
  const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
5464
- const extraArgs = normalizeStringArray(normalizedCloakOptions.args);
5479
+ const fingerprintPlatformArg = resolveCloakFingerprintPlatformArg(fingerprintPlatform, normalizedCloakOptions.args);
5480
+ const extraArgs = normalizeStringArray(normalizedCloakOptions.args).filter((value) => !value.startsWith(CLOAK_FINGERPRINT_PLATFORM_ARG_PREFIX));
5465
5481
  const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
5466
5482
  const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
5467
5483
  const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
@@ -5471,7 +5487,7 @@ var CloakLaunch = {
5471
5487
  ...normalizedCloakOptions,
5472
5488
  headless,
5473
5489
  proxy,
5474
- args: [...defaultArgs, ...extraArgs]
5490
+ args: [...defaultArgs, ...extraArgs, fingerprintPlatformArg]
5475
5491
  };
5476
5492
  const launchOptions = await buildCloakLaunchOptions(mergedCloakOptions);
5477
5493
  const fingerprintArg = extractFingerprintArg(launchOptions);