Disable proxy pool by default; add managed proxy lifecycle and Turnstile fixes.

Keep proxy_pool_enabled/managed off for direct registration, while shipping
SSO OAuth CPA export, visible Turnstile click handling, and proxy harvest tooling.
This commit is contained in:
chaos committed 2026-07-13 07:16:11 +08:00
1 parent 1ed18236b9
commit a4dbe948b2
118 files changed
+5351 -318

No files matched your search

+29 -66
View File
@@ -1,11 +1,32 @@
// Turnstile Patch - 隐藏自动化标识,加速 Turnstile 验证
// 在 document_start 阶段执行,确保在页面脚本之前生效
// Turnstile Patch - 仅做指纹修补,不自动狂点。
// xAI 资料页是 managed/invisible Turnstile:iframe 0x0,token 会自动生成;
// 每 500ms 点 checkbox 反而会打断校验。
(function () {
"use strict";
// 1. 隐藏 navigator.webdriver 标识
// Chrome 自动化模式下 navigator.webdriver = true,Turnstile 会检测此属性
// 0. 伪造 MouseEvent screen 坐标
try {
function _rnd(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var _sx = _rnd(800, 1400);
var _sy = _rnd(300, 800);
Object.defineProperty(MouseEvent.prototype, "screenX", {
configurable: true,
get: function () {
return _sx + (this.clientX || 0);
},
});
Object.defineProperty(MouseEvent.prototype, "screenY", {
configurable: true,
get: function () {
return _sy + (this.clientY || 0);
},
});
} catch (e) {}
// 1. 隐藏 navigator.webdriver
try {
Object.defineProperty(navigator, "webdriver", {
get: function () {
@@ -15,7 +36,7 @@
});
} catch (e) {}
// 2. 移除 Chrome 自动化相关的 Runtime 属性
// 2. 清理 chrome.runtime 自动化痕迹
try {
if (window.chrome && window.chrome.runtime) {
delete window.chrome.runtime.onConnect;
@@ -23,7 +44,7 @@
}
} catch (e) {}
// 3. 覆盖 permissions.query,隐藏 notifications 权限异常
// 3. permissions.query
try {
var origQuery = navigator.permissions.query.bind(navigator.permissions);
navigator.permissions.query = function (params) {
@@ -34,7 +55,7 @@
};
} catch (e) {}
// 4. 修补 plugin 数量,模拟正常浏览器
// 4. plugins
try {
Object.defineProperty(navigator, "plugins", {
get: function () {
@@ -44,7 +65,7 @@
});
} catch (e) {}
// 5. 修补 languages 属性
// 5. languages
try {
Object.defineProperty(navigator, "languages", {
get: function () {
@@ -53,62 +74,4 @@
configurable: true,
});
} catch (e) {}
// 6. 页面加载完成后,自动监控并点击 Turnstile 复选框
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", autoClickTurnstile);
} else {
autoClickTurnstile();
}
function autoClickTurnstile() {
// 定时检查 Turnstile iframe 是否出现
var checkCount = 0;
var maxChecks = 100; // 最多检查 100 次(约 50 秒)
var timer = setInterval(function () {
checkCount++;
if (checkCount > maxChecks) {
clearInterval(timer);
return;
}
try {
// 查找 Turnstile iframe
var iframes = document.querySelectorAll(
'iframe[src*="challenges.cloudflare.com"], iframe[src*="turnstile"]'
);
for (var i = 0; i < iframes.length; i++) {
var iframe = iframes[i];
try {
// 尝试访问 iframe 内部的 checkbox
var body = iframe.contentDocument || iframe.contentWindow.document;
var checkbox = body.querySelector(
'input[type="checkbox"], .mark, #cf-chl-widget-nomu1_resp'
);
if (checkbox && !checkbox.checked) {
checkbox.click();
}
} catch (e) {
// 跨域限制,尝试通过 postMessage 触发
try {
iframe.contentWindow.postMessage(
{ type: "turnstile-auto-click" },
"*"
);
} catch (e2) {}
}
}
// 也尝试直接操作 Turnstile API
if (
window.turnstile &&
typeof window.turnstile.getResponse === "function"
) {
var resp = window.turnstile.getResponse();
if (resp && resp.length > 0) {
clearInterval(timer); // 已获得 token,停止检查
}
}
} catch (e) {}
}, 500);
}
})();