@skrillex1224/playwright-toolkit 3.0.6 → 3.0.7
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 +52 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +52 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5318,6 +5318,49 @@ var normalizeStringArray = (value) => {
|
|
|
5318
5318
|
}
|
|
5319
5319
|
return value.map((item) => String(item || "").trim()).filter(Boolean);
|
|
5320
5320
|
};
|
|
5321
|
+
var hashStableSeed = (value = "") => {
|
|
5322
|
+
const raw = String(value || "").trim();
|
|
5323
|
+
if (!raw) return "";
|
|
5324
|
+
let hash = 2166136261;
|
|
5325
|
+
for (let index = 0; index < raw.length; index += 1) {
|
|
5326
|
+
hash ^= raw.charCodeAt(index);
|
|
5327
|
+
hash = Math.imul(hash, 16777619);
|
|
5328
|
+
}
|
|
5329
|
+
const normalized = hash >>> 0 || 1;
|
|
5330
|
+
return String(normalized);
|
|
5331
|
+
};
|
|
5332
|
+
var extractProxySeedSource = (proxyConfiguration = {}) => {
|
|
5333
|
+
const config = normalizeObject2(proxyConfiguration);
|
|
5334
|
+
return String(config.proxy_url || "").trim();
|
|
5335
|
+
};
|
|
5336
|
+
var resolveCloakRuntimeHints = (runtimeState = {}, proxyConfiguration = {}, cloakOptions = {}) => {
|
|
5337
|
+
const normalizedCloakOptions = normalizeObject2(cloakOptions);
|
|
5338
|
+
const browserProfileCore = RuntimeEnv.getBrowserProfileCore(runtimeState);
|
|
5339
|
+
const baseConfig = DefaultAntiCheat.getBaseConfig();
|
|
5340
|
+
const locale = String(
|
|
5341
|
+
normalizedCloakOptions.locale || browserProfileCore?.locale || baseConfig.locale || ""
|
|
5342
|
+
).trim();
|
|
5343
|
+
const timezone = String(
|
|
5344
|
+
normalizedCloakOptions.timezone || normalizedCloakOptions.timezoneId || browserProfileCore?.timezone_id || baseConfig.timezoneId || ""
|
|
5345
|
+
).trim();
|
|
5346
|
+
const explicitArgs = normalizeStringArray(normalizedCloakOptions.args);
|
|
5347
|
+
const hasExplicitFingerprint = explicitArgs.some((arg) => arg.startsWith("--fingerprint="));
|
|
5348
|
+
const fingerprintSeedSource = String(
|
|
5349
|
+
runtimeState?.envId || browserProfileCore?.schema_version && JSON.stringify({
|
|
5350
|
+
envId: runtimeState?.envId || "",
|
|
5351
|
+
timezone: browserProfileCore?.timezone_id || "",
|
|
5352
|
+
locale: browserProfileCore?.locale || "",
|
|
5353
|
+
browserMajorVersion: browserProfileCore?.browser_major_version || "",
|
|
5354
|
+
device: browserProfileCore?.device || ""
|
|
5355
|
+
}) || extractProxySeedSource(proxyConfiguration)
|
|
5356
|
+
).trim();
|
|
5357
|
+
return {
|
|
5358
|
+
locale,
|
|
5359
|
+
timezone,
|
|
5360
|
+
fingerprintSeed: hasExplicitFingerprint ? "" : hashStableSeed(fingerprintSeedSource),
|
|
5361
|
+
hasExplicitFingerprint
|
|
5362
|
+
};
|
|
5363
|
+
};
|
|
5321
5364
|
var resolveCloakProxy = (proxyConfiguration = {}) => {
|
|
5322
5365
|
const config = normalizeObject2(proxyConfiguration);
|
|
5323
5366
|
const proxyUrl = String(config.proxy_url || "").trim();
|
|
@@ -5453,6 +5496,7 @@ var CloakLaunch = {
|
|
|
5453
5496
|
runInHeadfulMode = false,
|
|
5454
5497
|
isRunningOnApify = false,
|
|
5455
5498
|
launcher = null,
|
|
5499
|
+
runtimeState = null,
|
|
5456
5500
|
cloakOptions = {},
|
|
5457
5501
|
humanizeOptions = DEFAULT_CLOAK_HUMANIZE_OPTIONS,
|
|
5458
5502
|
crawlerBaseOptions = {},
|
|
@@ -5467,6 +5511,7 @@ var CloakLaunch = {
|
|
|
5467
5511
|
const patchedBrowsers = /* @__PURE__ */ new WeakSet();
|
|
5468
5512
|
const defaultArgs = isRunningOnApify ? ["--no-sandbox", "--disable-setuid-sandbox"] : [];
|
|
5469
5513
|
const extraArgs = normalizeStringArray(normalizedCloakOptions.args);
|
|
5514
|
+
const runtimeHints = resolveCloakRuntimeHints(runtimeState, proxyConfiguration, normalizedCloakOptions);
|
|
5470
5515
|
const hasExplicitProxy = hasOwn(normalizedCloakOptions, "proxy");
|
|
5471
5516
|
const proxyLaunchState = hasExplicitProxy ? resolveLaunchTraffic({ proxyConfiguration, debugMode, useMeter: false }) : resolveLaunchTraffic({ proxyConfiguration, debugMode });
|
|
5472
5517
|
const proxy = hasExplicitProxy ? normalizedCloakOptions.proxy : proxyLaunchState.launchProxy;
|
|
@@ -5476,7 +5521,13 @@ var CloakLaunch = {
|
|
|
5476
5521
|
...normalizedCloakOptions,
|
|
5477
5522
|
headless,
|
|
5478
5523
|
proxy,
|
|
5479
|
-
|
|
5524
|
+
...runtimeHints.locale ? { locale: runtimeHints.locale } : {},
|
|
5525
|
+
...runtimeHints.timezone ? { timezone: runtimeHints.timezone } : {},
|
|
5526
|
+
args: [
|
|
5527
|
+
...defaultArgs,
|
|
5528
|
+
...extraArgs,
|
|
5529
|
+
...runtimeHints.fingerprintSeed ? [`--fingerprint=${runtimeHints.fingerprintSeed}`] : []
|
|
5530
|
+
]
|
|
5480
5531
|
};
|
|
5481
5532
|
const launchOptions = await buildCloakLaunchOptions(mergedCloakOptions);
|
|
5482
5533
|
const fingerprintArg = extractFingerprintArg(launchOptions);
|