Download src/proxy/captcha-solver.ts from bolikoto/zcode-api: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/bolikoto/zcode-api/resolve/main/src/proxy/captcha-solver.ts
- Command line
-
hf download hf://spaces/bolikoto/zcode-api/src/proxy/captcha-solver.ts
-
curl -L -o captcha-solver.ts https://huggingface.co/spaces/bolikoto/zcode-api/resolve/main/src/proxy/captcha-solver.ts
1.33 kB
| /** | |
| * Solver backend dispatch β fully in-process, self-contained. | |
| * | |
| * Backend (ZCODE_CAPTCHA_BACKEND): "happy" (default) β the happy-dom solver | |
| * in src/proxy/captcha-happy.ts. Runs inside the Bun process; bundled into | |
| * the single-file release binary by `bun build --compile`. No external | |
| * Node.js, no browser. (The historical jsdom and Node-daemon/playwright | |
| * backends have been removed.) | |
| */ | |
| const BACKEND = process.env.ZCODE_CAPTCHA_BACKEND?.trim().toLowerCase() || "happy"; | |
| let happyMod: typeof import("./captcha-happy.js") | null = null; | |
| export async function runCaptchaSolve(scene: string, region: string, prefix: string): Promise<string> { | |
| if (BACKEND !== "happy") { | |
| throw new Error(`captcha backend "${BACKEND}" is not available; use ZCODE_CAPTCHA_BACKEND=happy`); | |
| } | |
| if (!happyMod) happyMod = await import("./captcha-happy.js"); | |
| return happyMod.solveTraceless({ scene, region, prefix }); | |
| } | |
| /** In-process solving needs no worker pool management β kept for the pool API. */ | |
| export function setCaptchaSolverConcurrency(_n: number): void {} | |
| /** In-process solving needs no worker pool management β kept for the pool API. */ | |
| export function shutdownCaptchaSolver(): void {} | |
| export function captchaSolverConcurrency(): number { | |
| return Number(process.env.CAPTCHA_DAEMON_CONCURRENCY || 4); | |
| } | |