Add CLAUDE.md and enhance proxy browser fingerprint headers

Introduces CLAUDE.md with detailed project, architecture, and contribution guidelines. Improves generateBrowserFingerprint in proxyManager.ts by adding comprehensive headers to better mimic real browsers and bypass DeepL bot detection. Minor cleanup in testHelpers.ts. package-lock.json updated for peer dependencies.
This commit is contained in:
xixu-me committed 2025-11-07 16:02:04 +08:00
1 parent fd48d1f3ac
commit 1e858212c1
4 files changed
+224 -11

No files matched your search

+9 -4
View File
@@ -68,18 +68,23 @@ export async function selectProxy(env: Env): Promise<ProxyEndpoint | null> {
/**
* Generate realistic browser fingerprint headers
* Creates randomized headers to mimic real browser requests
* Creates randomized headers to mimic real browser requests and prevent 503 errors
* Enhanced with comprehensive headers to bypass DeepL's bot detection
* @returns Record<string, string> - Object containing HTTP headers
*/
export function generateBrowserFingerprint(): Record<string, string> {
return {
"User-Agent": USER_AGENTS[Math.floor(Math.random() * USER_AGENTS.length)],
Accept: "*/*",
"Accept-Language":
ACCEPT_LANGUAGES[Math.floor(Math.random() * ACCEPT_LANGUAGES.length)],
Accept: "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Encoding": "gzip, deflate, br, zstd",
Origin: "https://www.deepl.com",
Referer: "https://www.deepl.com/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
DNT: "1",
Connection: "keep-alive",
"Upgrade-Insecure-Requests": "1",
};
}