@xbrowser/cli 1.24.3 → 1.25.1

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.
@@ -5,7 +5,7 @@ import {
5
5
  landingOffset,
6
6
  rand,
7
7
  typingDelay
8
- } from "./chunk-GYB5BOSP.js";
8
+ } from "./chunk-R3F4K2SB.js";
9
9
  import {
10
10
  connectToCDP,
11
11
  launchChrome
@@ -4896,7 +4896,7 @@ async function launch(options = {}) {
4896
4896
  const bv = await conn.send("Browser.getVersion");
4897
4897
  const m = bv.product.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)/);
4898
4898
  if (m && !options.stealthConfig?.uaChProfile) {
4899
- const { deriveUaChProfileForBinary } = await import("./stealth-JOXGV34D.js");
4899
+ const { deriveUaChProfileForBinary } = await import("./stealth-MHJNBJY7.js");
4900
4900
  stealthOpts = { stealthConfig: { uaChProfile: deriveUaChProfileForBinary(m[0], m[1]) } };
4901
4901
  }
4902
4902
  } catch {
@@ -5,7 +5,7 @@ import {
5
5
  landingOffset,
6
6
  rand,
7
7
  typingDelay
8
- } from "./chunk-GYB5BOSP.js";
8
+ } from "./chunk-R3F4K2SB.js";
9
9
  import {
10
10
  connectToCDP,
11
11
  launchChrome
@@ -4001,7 +4001,7 @@ async function launch(options = {}) {
4001
4001
  const bv = await conn.send("Browser.getVersion");
4002
4002
  const m = bv.product.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)/);
4003
4003
  if (m && !options.stealthConfig?.uaChProfile) {
4004
- const { deriveUaChProfileForBinary } = await import("./stealth-JOXGV34D.js");
4004
+ const { deriveUaChProfileForBinary } = await import("./stealth-MHJNBJY7.js");
4005
4005
  stealthOpts = { stealthConfig: { uaChProfile: deriveUaChProfileForBinary(m[0], m[1]) } };
4006
4006
  }
4007
4007
  } catch {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRuleEngine,
3
3
  launch
4
- } from "./chunk-BH3GIMWE.js";
4
+ } from "./chunk-ZGHLHBXX.js";
5
5
  import {
6
6
  errMsg
7
7
  } from "./chunk-GDKLH7ZY.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  launch
3
- } from "./chunk-UR3R5LWF.js";
3
+ } from "./chunk-DP6VI3UL.js";
4
4
  import {
5
5
  errMsg
6
6
  } from "./chunk-GDKLH7ZY.js";
@@ -270,6 +270,25 @@ function buildStealthInitScript(config = DEFAULT_STEALTH_CONFIG) {
270
270
  // —— 真实浏览器失焦/后台时 hasFocus=false
271
271
  // S172: 原型层覆写——实例赋值可被 Document.prototype.hasFocus.call(document) 逃逸
272
272
  ' Document.prototype.hasFocus=function(){return document.visibilityState==="visible";};',
273
+ // 4a. 渲染层声明一致性(2026-09-13 实测双模式四差异,修 dpr/color-gamut 两项):
274
+ // headless 默认 devicePixelRatio=1 / color-gamut=srgb,而真实 Mac Chrome 是
275
+ // 2 / p3 —— 声明(UA 说是 Mac)与渲染参数对不上即 headless 铁证。
276
+ // UA 含 "Macintosh" 时对齐 Retina 声明(dpr=2、p3);Windows/Linux 保持
277
+ // 1 / srgb(与主流真机一致)。login-bridge 扩展侧 L0 已有同款,此处对齐 driver 侧。
278
+ " try{",
279
+ ' var _uaIsMac=navigator.userAgent.indexOf("Macintosh")>=0;',
280
+ " if(_uaIsMac){",
281
+ ' Object.defineProperty(window,"devicePixelRatio",{get:function(){return 2;},configurable:true});',
282
+ " var _mq=window.matchMedia.bind(window);",
283
+ " window.matchMedia=function(q){",
284
+ " var m=_mq(q);",
285
+ ' if(typeof q==="string"&&q.indexOf("color-gamut")>=0&&q.indexOf("p3")>=0){',
286
+ ' Object.defineProperty(m,"matches",{get:function(){return true;},configurable:true});',
287
+ " }",
288
+ " return m;",
289
+ " };",
290
+ " }",
291
+ " }catch(e){}",
273
292
  // 4. Canvas/WebGL fingerprint: per-session stable noise (d20).
274
293
  // Headless software raster differs subtly from Chrome GPU raster —
275
294
  // toDataURL hashes fingerprint the rasterizer. Inject a stable