diff --git a/.gitignore b/.gitignore index 6c6bd27..707a362 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ Android-APP/gradlew.bat # "bun run build:android-bundle" + copy; see Android-APP/AGENTS.md BUILD section. Android-APP/app/src/main/assets/server_bundle/server.cjs /Android-APP/design/previews + +# Fork: captcha worker bundle is a build artifact -- regenerated by +# scripts/build-fork-worker.ts (prebuild hook), never committed. +src/proxy/captcha-worker-entry.bundle.js diff --git a/README.md b/README.md index 2123733..0240d5c 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,13 @@ bun run dev # 开发模式启动面板 架构与实现细节见 [`src/`](src/) 下各源码文件内的注释。 +## Privacy + +This fork adds **no telemetry, no analytics, and no outbound reporting** of +any kind. Nothing about your usage, device, or configuration leaves your +machine. (Inherited from upstream: the proxy is fully local; debug/dump logs +auto-redact API keys, JWTs, and proxy keys.) + ## License MIT diff --git a/package.json b/package.json index ead62ba..166bb6b 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "bun run src/index.ts", "start": "bun run src/index.ts", "test": "bun test", + "prebuild": "bun run scripts/build-fork-worker.ts", "build": "bun build --compile --define \"require.resolve=undefined\" src/index.ts --outfile zcode-proxy.exe", "build:linux-x64": "bun build --compile --target bun-linux-x64 --define \"require.resolve=undefined\" src/index.ts --outfile zcode-proxy-linux-x64", "build:linux-arm64": "bun build --compile --target bun-linux-arm64 --define \"require.resolve=undefined\" src/index.ts --outfile zcode-proxy-linux-arm64", diff --git a/scripts/build-fork-worker.ts b/scripts/build-fork-worker.ts new file mode 100644 index 0000000..0bc31a9 --- /dev/null +++ b/scripts/build-fork-worker.ts @@ -0,0 +1,24 @@ +/** + * Build script -- fork patch: bundle the captcha worker entry into a + * self-contained ESM file so it can be embedded as a `with { type: "file" }` + * asset in the compiled single-file binary. Raw .ts assets are NOT parsed by + * Bun at extraction (they'd be evaluated as plain JS and fail on type + * annotations), so the worker must be pre-bundled to plain JS. + * + * Run before `bun build --compile`: bun run scripts/build-fork-worker.ts + * Output: src/proxy/captcha-worker-entry.bundle.mjs (gitignored build input) + */ +import { build } from "bun"; + +const result = await build({ + entrypoints: ["./src/proxy/captcha-worker-entry.ts"], + outdir: "./src/proxy", + target: "bun", + format: "esm", + naming: { entry: "[dir]/[name].bundle.[ext]" }, + minify: false, + external: [], +}); + +for (const log of result.logs) console.log(String(log)); +console.log(`captcha worker bundled: ${result.outputs.map((o) => o.path).join(", ")}`); diff --git a/src/proxy/captcha-happy.ts b/src/proxy/captcha-happy.ts index 91ca102..38aba7f 100644 --- a/src/proxy/captcha-happy.ts +++ b/src/proxy/captcha-happy.ts @@ -1,6 +1,6 @@ -// @ts-nocheck — ported from the proven Node happy-dom solver (solve-happy-lib.js) +// @ts-nocheck -- ported from the proven Node happy-dom solver (solve-happy-lib.js) /** - * captcha-happy.ts — in-process happy-dom Aliyun captcha solver. + * captcha-happy.ts -- in-process happy-dom Aliyun captcha solver. * * Ported from the production-proven standalone happy-dom solver to run * INSIDE the Bun process so the release binary stays self-contained: @@ -23,15 +23,20 @@ import os from "node:os"; import path from "node:path"; import { Worker } from "node:worker_threads"; -// ── Blocking fetch for sync XHR (self-contained builds) ──────────────────── +// -- Blocking fetch for sync XHR (self-contained builds) -------------------- // happy-dom implements sync XHR by spawning `process.argv[0] -e