deckide 3.5.39 → 3.5.41
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/utils/agent-browser.js +53 -12
- package/package.json +1 -1
|
@@ -554,6 +554,13 @@ export class AgentBrowserService {
|
|
|
554
554
|
// GPU を browser プロセス内で動かし、GPU サンドボックスを外して回避する。
|
|
555
555
|
'--in-process-gpu',
|
|
556
556
|
'--disable-gpu-sandbox',
|
|
557
|
+
// GPU レスのサーバでも WebGL を「本物のソフトウェアレンダラ(SwiftShader/ANGLE)」として
|
|
558
|
+
// 実際に動かす。Chrome >=130 は自動 SwiftShader フォールバックを廃止したため
|
|
559
|
+
// --enable-unsafe-swiftshader が必須。WebGL が全く無いと実Chromeとして不自然で
|
|
560
|
+
// ボット判定(Cloudflare Turnstile 等)の信号になる。実機検証で WebGL 復活+無クラッシュを確認済み。
|
|
561
|
+
'--use-gl=angle',
|
|
562
|
+
'--use-angle=swiftshader',
|
|
563
|
+
'--enable-unsafe-swiftshader',
|
|
557
564
|
// ボット判定(Cloudflare の Managed Challenge 等)で誤検知されにくくする。
|
|
558
565
|
// navigator.webdriver を立てる自動化フラグを無効化する。残りの偽装は CDP 側。
|
|
559
566
|
'--disable-blink-features=AutomationControlled',
|
|
@@ -846,9 +853,13 @@ export class AgentBrowserService {
|
|
|
846
853
|
}
|
|
847
854
|
const major = (userAgent.match(/Chrome\/(\d+)/) || [])[1] || '120';
|
|
848
855
|
if (userAgent) {
|
|
856
|
+
// acceptLanguage は q 値を付けない素のカンマ区切りにする。q 値を含めると
|
|
857
|
+
// Chrome がさらに q を付与して "ja;q=0.9;q=0.9" のような実ブラウザが出さない
|
|
858
|
+
// 不正なヘッダになり、それ自体がボット信号になる。
|
|
859
|
+
const fullVersion = (userAgent.match(/Chrome\/([\d.]+)/) || [])[1] || `${major}.0.0.0`;
|
|
849
860
|
await cdp.send('Emulation.setUserAgentOverride', {
|
|
850
861
|
userAgent,
|
|
851
|
-
acceptLanguage: 'ja-JP,ja
|
|
862
|
+
acceptLanguage: 'ja-JP,ja,en-US,en',
|
|
852
863
|
platform: 'Linux x86_64',
|
|
853
864
|
userAgentMetadata: {
|
|
854
865
|
brands: [
|
|
@@ -856,20 +867,31 @@ export class AgentBrowserService {
|
|
|
856
867
|
{ brand: 'Chromium', version: major },
|
|
857
868
|
{ brand: 'Google Chrome', version: major },
|
|
858
869
|
],
|
|
859
|
-
|
|
870
|
+
fullVersionList: [
|
|
871
|
+
{ brand: 'Not_A Brand', version: '24.0.0.0' },
|
|
872
|
+
{ brand: 'Chromium', version: fullVersion },
|
|
873
|
+
{ brand: 'Google Chrome', version: fullVersion },
|
|
874
|
+
],
|
|
860
875
|
platform: 'Linux',
|
|
861
876
|
platformVersion: '',
|
|
862
877
|
architecture: 'x86',
|
|
878
|
+
bitness: '64',
|
|
879
|
+
wow64: false,
|
|
863
880
|
model: '',
|
|
864
881
|
mobile: false,
|
|
865
882
|
},
|
|
866
883
|
});
|
|
867
884
|
}
|
|
885
|
+
// 反検知は「正直で整合の取れた実Chrome」に寄せるのが正攻法。
|
|
886
|
+
// navigator.languages を Accept-Language と一致させる程度に留め、
|
|
887
|
+
// plugins や WebGL ベンダの「偽装」はしない(偽装は逆に不整合の検知信号になる)。
|
|
888
|
+
// navigator.webdriver は起動フラグ --disable-blink-features=AutomationControlled で
|
|
889
|
+
// 既に false 化されているが、保険として undefined を維持する。WebGL は実フラグ
|
|
890
|
+
// (--use-angle=swiftshader 等) で実際に動作するので、レンダラは正直に SwiftShader を返す。
|
|
868
891
|
const stealthSource = `
|
|
869
892
|
Object.defineProperty(navigator, 'webdriver', { get: () => undefined });
|
|
870
893
|
if (!window.chrome) { window.chrome = { runtime: {} }; }
|
|
871
894
|
Object.defineProperty(navigator, 'languages', { get: () => ['ja-JP', 'ja', 'en-US', 'en'] });
|
|
872
|
-
Object.defineProperty(navigator, 'plugins', { get: () => [1, 2, 3, 4, 5] });
|
|
873
895
|
try {
|
|
874
896
|
const _q = window.navigator.permissions && window.navigator.permissions.query;
|
|
875
897
|
if (_q) {
|
|
@@ -879,14 +901,6 @@ export class AgentBrowserService {
|
|
|
879
901
|
: _q(p);
|
|
880
902
|
}
|
|
881
903
|
} catch (e) { /* ignore */ }
|
|
882
|
-
try {
|
|
883
|
-
const getParam = WebGLRenderingContext.prototype.getParameter;
|
|
884
|
-
WebGLRenderingContext.prototype.getParameter = function (p) {
|
|
885
|
-
if (p === 37445) return 'Intel Inc.';
|
|
886
|
-
if (p === 37446) return 'Intel Iris OpenGL Engine';
|
|
887
|
-
return getParam.call(this, p);
|
|
888
|
-
};
|
|
889
|
-
} catch (e) { /* ignore */ }
|
|
890
904
|
`;
|
|
891
905
|
await cdp.send('Page.addScriptToEvaluateOnNewDocument', { source: stealthSource });
|
|
892
906
|
}
|
|
@@ -1369,7 +1383,34 @@ function getWindowsVirtualKeyCode(key) {
|
|
|
1369
1383
|
return 111 + Number(functionKey[1]);
|
|
1370
1384
|
}
|
|
1371
1385
|
if (key.length === 1) {
|
|
1372
|
-
|
|
1386
|
+
// 英字・数字は ASCII コードがそのまま VK コードと一致する。
|
|
1387
|
+
if (/[a-zA-Z0-9]/.test(key)) {
|
|
1388
|
+
return key.toUpperCase().charCodeAt(0);
|
|
1389
|
+
}
|
|
1390
|
+
// 記号は charCodeAt だと VK コードと衝突する(例: '.' は ASCII 46 = VK_DELETE
|
|
1391
|
+
// で、Delete キー扱いになり文字が消える)。US 配列の OEM コードに明示マップする。
|
|
1392
|
+
// shift 併用の記号(! @ # ... > など)も対応する物理キーの VK にマップ。
|
|
1393
|
+
const symbolToVk = {
|
|
1394
|
+
')': 48, '!': 49, '@': 50, '#': 51, '$': 52,
|
|
1395
|
+
'%': 53, '^': 54, '&': 55, '*': 56, '(': 57,
|
|
1396
|
+
';': 186, ':': 186,
|
|
1397
|
+
'=': 187, '+': 187,
|
|
1398
|
+
',': 188, '<': 188,
|
|
1399
|
+
'-': 189, '_': 189,
|
|
1400
|
+
'.': 190, '>': 190,
|
|
1401
|
+
'/': 191, '?': 191,
|
|
1402
|
+
'`': 192, '~': 192,
|
|
1403
|
+
'[': 219, '{': 219,
|
|
1404
|
+
'\\': 220, '|': 220,
|
|
1405
|
+
']': 221, '}': 221,
|
|
1406
|
+
"'": 222, '"': 222,
|
|
1407
|
+
};
|
|
1408
|
+
if (key in symbolToVk) {
|
|
1409
|
+
return symbolToVk[key];
|
|
1410
|
+
}
|
|
1411
|
+
// 不明な1文字は 0 を返す。text は別途渡しているので文字入力自体は成立し、
|
|
1412
|
+
// 特殊キーとして誤解釈されることもない。
|
|
1413
|
+
return 0;
|
|
1373
1414
|
}
|
|
1374
1415
|
return 0;
|
|
1375
1416
|
}
|