dsh-free-search 0.9.82 → 0.9.84

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.
Files changed (45) hide show
  1. package/README.md +8 -2
  2. package/bin/restore.js +82 -82
  3. package/lib/client.js +55 -6
  4. package/lib/engines/aliyun.js +2 -1
  5. package/lib/engines/anysearch.js +2 -1
  6. package/lib/engines/baidu.js +2 -1
  7. package/lib/engines/brave.js +2 -1
  8. package/lib/engines/claude.js +2 -1
  9. package/lib/engines/deepseek-official.js +2 -1
  10. package/lib/engines/deepseek-tools.js +2 -1
  11. package/lib/engines/degoog.js +2 -1
  12. package/lib/engines/doubao.js +2 -1
  13. package/lib/engines/exa.js +3 -2
  14. package/lib/engines/firecrawl.js +2 -1
  15. package/lib/engines/gemini.js +2 -1
  16. package/lib/engines/google.js +2 -1
  17. package/lib/engines/jina.js +2 -1
  18. package/lib/engines/keenable.js +3 -2
  19. package/lib/engines/kimi.js +2 -1
  20. package/lib/engines/metaso.js +2 -1
  21. package/lib/engines/openai.js +2 -1
  22. package/lib/engines/outcrawl.js +2 -1
  23. package/lib/engines/parallel.js +3 -2
  24. package/lib/engines/perplexity.js +2 -1
  25. package/lib/engines/searxng.js +2 -1
  26. package/lib/engines/serpbase.js +2 -1
  27. package/lib/engines/serper.js +2 -1
  28. package/lib/engines/serply.js +2 -1
  29. package/lib/engines/shared.js +2 -1
  30. package/lib/engines/specstream.js +2 -1
  31. package/lib/engines/tavily.js +2 -1
  32. package/lib/engines/tinyfish.js +2 -1
  33. package/lib/engines/yandex.js +2 -1
  34. package/lib/engines/you.js +2 -1
  35. package/lib/engines/yuanbao.js +2 -1
  36. package/lib/engines/zhipu.js +2 -1
  37. package/lib/fetch_provider.js +41 -2
  38. package/lib/fetch_upstream.js +1 -1
  39. package/lib/index.js +100 -15
  40. package/lib/platform_engines.js +13 -12
  41. package/lib/proxy_fetch.js +538 -0
  42. package/lib/research.js +2 -2
  43. package/lib/restore.js +234 -234
  44. package/lib/serp_engines.js +3 -2
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -652,7 +652,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
652
652
 
653
653
  #### 离线自检断言(tools/)
654
654
 
655
- 仓库自带 **99 个**零依赖断言脚本(合计 **1261 项**)
655
+ 仓库自带 **105 个**零依赖断言脚本(合计 **1329 项**)
656
656
 
657
657
  | 脚本 | 覆盖 | 运行(项数) |
658
658
  |---|---|---|
@@ -693,6 +693,12 @@ npx -y -p dsh-free-search dsh-free-search-mcp
693
693
  | `assert-tavily-endpoint.mjs` | Tavily 兼容端点(#153):留空 = 官方地址、base 自动补 `/search`、query/hash 被剥离、非 http(s) 拒绝、key 只走 Authorization 头、401 点名端点、配置与设置页接线 | `node tools/assert-tavily-endpoint.mjs`(8) |
694
694
  | `assert-hint-card.mjs` | 字段说明悬停卡:长说明不再占正文、卡片经 portal 挂到 body(否则被卡片 `overflow:clip` 裁掉)、Esc 关闭、聚焦打开/失焦关闭、悬停有延迟、触屏可点、卡片不越出视口、深浅色都覆盖、标签文字在图标按钮外(否则被压成一字一行)、点图标不连带切换复选框 | `node tools/assert-hint-card.mjs`(14) |
695
695
  | `assert-restore-cli.mjs` | 卸载后清理入口(#159):`restore` 子命令不依赖插件运行时、只删插件自己写进去的 `searchProvider: ddg` / `fetchProvider: fs-quality-fetch`、用户显式选的 provider 不动、只剩 id+name 的空行整行删除、注释/顺序/引号/CRLF 保留、写入前备份、重复运行无副作用、`--dry-run` 不写、`--profile` 只清指定 profile、参数不明时拒绝写入 | `node tools/assert-restore-cli.mjs`(12) |
696
+ | `assert-upgrade-version.mjs` | 一键升级以实际安装结果为准(#163):读回 profile 里真正落下的版本、与 registry 比较、冷却拦截单独报 `upgrade-blocked`、成功路径报 installed 而非 latest、读不到安装状态时不算成功、界面 toast 用 installed、被拦截时用告警色并保留原文案 | `node tools/assert-upgrade-version.mjs`(8) |
697
+ | `assert-search-proxy.mjs` | 搜索代理(#155)的规则层:http/https/socks5 地址解析、凭据百分号解码、无 scheme 视为 http、socks5h 交给代理解析、非法协议拒绝、`no_proxy` 优先于显式设置、空设置不接管环境变量代理、活动代理是配置层写入的模块状态、搜索路径不再直连全局 `fetch`、该设置只管引擎(天气/更新检查/抓取层保持平台 fetch)、界面中英双语文案、SOCKS5 由本仓库自己实现、重定向三档语义、abort/timeout 保持原生 error 名、HTTP/1.1 请求必须走我们自己的隧道 socket(`agent: false` 与 `https.request` 都会静默绕过代理)、新增依赖为零 | `node tools/assert-search-proxy.mjs`(18) |
698
+ | `assert-proxy-tunnel.mjs` | 代理隧道实测(#155):本地 CONNECT 代理与手写 SOCKS5 服务端,验证方法/路径/body/host 透传、Basic 凭据解码、每次请求一条隧道且响应后关闭、`follow`/`manual`/`error` 三档重定向语义、303 把 POST 降为 GET、gzip 解压、CONNECT 407 明确报错、代理接受 CONNECT 后立刻断开时不回落直连、不可达代理快速失败、`no_proxy` 绕过隧道、SOCKS5 无认证与用户名密码两档、认证被拒与断线报错 | `node tools/assert-proxy-tunnel.mjs`(17) |
699
+ | `assert-fetch-alpn.mjs` | #162:https 每一跳都声明 `ALPNProtocols: ["http/1.1"]`(只此一个,不带 h2——响应按 HTTP/1.1 解析)、http 目标不声明、按重定向目标的协议逐跳判断、browser 层被跳过时 errors 里写明原因、两个 HTML 返回点都经过瘦身 | `node tools/assert-fetch-alpn.mjs`(7) |
700
+ | `assert-fetch-html-slim.mjs` | #161:`slimHtml()` 去掉 style/script/noscript/template/注释、只清超长 base64 `data:`(短图标保留)、普通页面逐字节不变、幂等、大小写与跨行标签、构造一个 260 KB 内联 CSS 的页面后同样 200,000 字符预算下正文确实在 | `node tools/assert-fetch-html-slim.mjs`(9) |
701
+ | `assert-browser-path.mjs` | T1.5 浏览器路径(#160):留空仍走内置候选表、纯空格等同空值、自定义路径原样使用、路径不存在时不回落到其它浏览器、探测缓存随配置失效、provider 收到的是配置值而非硬编码、配置项默认空、设置页能完整读写、输入框只在 T1.5 开启时出现、中英文提示都写明不回落规则 | `node tools/assert-browser-path.mjs`(9) |
696
702
  | `assert-control-chrome.mjs` | 字段标题与复选框外观:标题字号/字重要高于正文、复选框由样式绘制(`appearance:none` + CSS 勾)、不确定态有独立横线、聚焦有描边、深浅色都覆盖、分组自动换行、全选不拉满整行、工具行复选框不再固定 150px | `node tools/assert-control-chrome.mjs`(9) |
697
703
  | `assert-checkbox-labels.mjs` | 复选框不再重复标签:左侧栏入口 / 斜杠命令 / 免 key 优先三项各只出现一次标签、标签位于复选框同一行、其它输入类字段仍保留独立标题 | `node tools/assert-checkbox-labels.mjs`(5) |
698
704
  | `assert-dropdown.mjs` | 自绘下拉:设置页不再有原生 `<select>`、11 处全部走同一个组件、保留 `onChange({ target })` 契约与 listbox 语义、键盘(↑↓/Home/End/Enter/Esc/Tab)可用、浮层限高滚动、深浅色都有样式 | `node tools/assert-dropdown.mjs`(6) |
@@ -1436,7 +1442,7 @@ Restart `dsh web` after switching to apply changes.
1436
1442
 
1437
1443
  #### Offline self-check assertions (`tools/`)
1438
1444
 
1439
- **Ninety-nine** zero-dependency assertion scripts ship with the repo (**1261 assertions** total)
1445
+ **One hundred and five** zero-dependency assertion scripts ship with the repo (**1329 assertions** total)
1440
1446
 
1441
1447
  | Script | Covers | Run (count) |
1442
1448
  |---|---|---|
package/bin/restore.js CHANGED
@@ -1,82 +1,82 @@
1
- #!/usr/bin/env node
2
- // #159: restore the web provider fields this plugin wrote into the profile patch.
3
- //
4
- // Runs without loading the plugin, so it also works after the plugin was
5
- // disabled or uninstalled - the exact state the residue is stuck in.
6
- //
7
- // npx dsh-free-search restore
8
- // npx dsh-free-search restore --profile web --dry-run
9
- import { cleanProfiles, describeResults, dshHomeDir } from "../lib/restore.js";
10
-
11
- const args = process.argv.slice(2);
12
-
13
- // Flags are parsed first: an unknown or bare invocation must never fall through
14
- // to a real write. Anything short of an explicit `restore` prints usage and exits.
15
- const HELP_FLAGS = new Set(["--help", "-h", "help", "--usage"]);
16
- if (args.length === 0 || args.some((arg) => HELP_FLAGS.has(arg))) {
17
- printUsage();
18
- process.exit(args.length === 0 ? 2 : 0);
19
- }
20
-
21
- const command = args[0];
22
- if (command !== "restore") {
23
- console.error(`unknown command "${command}"`);
24
- printUsage();
25
- process.exit(2);
26
- }
27
-
28
- const profileIndex = args.indexOf("--profile");
29
- const profile = profileIndex >= 0 ? args[profileIndex + 1] : undefined;
30
- if (profileIndex >= 0 && (profile === undefined || profile.startsWith("-"))) {
31
- console.error("--profile needs a profile name");
32
- process.exit(2);
33
- }
34
-
35
- const homeIndex = args.indexOf("--home");
36
- const home = homeIndex >= 0 ? args[homeIndex + 1] : dshHomeDir();
37
- if (homeIndex >= 0 && (home === undefined || home.startsWith("-"))) {
38
- console.error("--home needs a directory");
39
- process.exit(2);
40
- }
41
-
42
- // An unknown flag is a typo, not consent to overwrite a profile patch.
43
- const KNOWN_FLAGS = new Set(["restore", "--profile", "--home", "--dry-run"]);
44
- const valueFlags = new Set(["--profile", "--home"]);
45
- for (let i = 0; i < args.length; i += 1) {
46
- const arg = args[i];
47
- if (KNOWN_FLAGS.has(arg)) {
48
- if (valueFlags.has(arg)) i += 1;
49
- continue;
50
- }
51
- console.error(`unknown argument "${arg}"`);
52
- printUsage();
53
- process.exit(2);
54
- }
55
-
56
- const dryRun = args.includes("--dry-run");
57
-
58
- const results = cleanProfiles({ home, profile, dryRun });
59
- for (const line of describeResults(results)) console.log(line);
60
- if (results.some((result) => result.ok && result.changed) && !dryRun) {
61
- console.log("\nbackups were written next to each patch as *.bak-before-free-search-restore");
62
- console.log("restart dsh so the web service rebuilds with the restored providers");
63
- }
64
- if (dryRun && results.some((result) => result.ok && result.changed)) {
65
- console.log("\n(dry run: nothing was written)");
66
- }
67
- process.exit(results.every((result) => result.ok) ? 0 : 1);
68
-
69
- function printUsage() {
70
- console.log(`Usage:
71
- dsh-free-search restore [--profile <name>] [--home <dir>] [--dry-run]
72
-
73
- Removes the "searchProvider: ddg" / "fetchProvider: fs-quality-fetch" values
74
- this plugin wrote into a profile's cordis.patch.yml. Values you set yourself are
75
- left untouched, and a patch line surviving only because of them is dropped.
76
-
77
- --profile <name> clean one profile under <home>/profiles
78
- --home <dir> DSH home (defaults to $DSH_HOME or ~/.dsh)
79
- --dry-run report what would change without writing
80
-
81
- Nothing is written unless the word "restore" is the first argument.`);
82
- }
1
+ #!/usr/bin/env node
2
+ // #159: restore the web provider fields this plugin wrote into the profile patch.
3
+ //
4
+ // Runs without loading the plugin, so it also works after the plugin was
5
+ // disabled or uninstalled - the exact state the residue is stuck in.
6
+ //
7
+ // npx dsh-free-search restore
8
+ // npx dsh-free-search restore --profile web --dry-run
9
+ import { cleanProfiles, describeResults, dshHomeDir } from "../lib/restore.js";
10
+
11
+ const args = process.argv.slice(2);
12
+
13
+ // Flags are parsed first: an unknown or bare invocation must never fall through
14
+ // to a real write. Anything short of an explicit `restore` prints usage and exits.
15
+ const HELP_FLAGS = new Set(["--help", "-h", "help", "--usage"]);
16
+ if (args.length === 0 || args.some((arg) => HELP_FLAGS.has(arg))) {
17
+ printUsage();
18
+ process.exit(args.length === 0 ? 2 : 0);
19
+ }
20
+
21
+ const command = args[0];
22
+ if (command !== "restore") {
23
+ console.error(`unknown command "${command}"`);
24
+ printUsage();
25
+ process.exit(2);
26
+ }
27
+
28
+ const profileIndex = args.indexOf("--profile");
29
+ const profile = profileIndex >= 0 ? args[profileIndex + 1] : undefined;
30
+ if (profileIndex >= 0 && (profile === undefined || profile.startsWith("-"))) {
31
+ console.error("--profile needs a profile name");
32
+ process.exit(2);
33
+ }
34
+
35
+ const homeIndex = args.indexOf("--home");
36
+ const home = homeIndex >= 0 ? args[homeIndex + 1] : dshHomeDir();
37
+ if (homeIndex >= 0 && (home === undefined || home.startsWith("-"))) {
38
+ console.error("--home needs a directory");
39
+ process.exit(2);
40
+ }
41
+
42
+ // An unknown flag is a typo, not consent to overwrite a profile patch.
43
+ const KNOWN_FLAGS = new Set(["restore", "--profile", "--home", "--dry-run"]);
44
+ const valueFlags = new Set(["--profile", "--home"]);
45
+ for (let i = 0; i < args.length; i += 1) {
46
+ const arg = args[i];
47
+ if (KNOWN_FLAGS.has(arg)) {
48
+ if (valueFlags.has(arg)) i += 1;
49
+ continue;
50
+ }
51
+ console.error(`unknown argument "${arg}"`);
52
+ printUsage();
53
+ process.exit(2);
54
+ }
55
+
56
+ const dryRun = args.includes("--dry-run");
57
+
58
+ const results = cleanProfiles({ home, profile, dryRun });
59
+ for (const line of describeResults(results)) console.log(line);
60
+ if (results.some((result) => result.ok && result.changed) && !dryRun) {
61
+ console.log("\nbackups were written next to each patch as *.bak-before-free-search-restore");
62
+ console.log("restart dsh so the web service rebuilds with the restored providers");
63
+ }
64
+ if (dryRun && results.some((result) => result.ok && result.changed)) {
65
+ console.log("\n(dry run: nothing was written)");
66
+ }
67
+ process.exit(results.every((result) => result.ok) ? 0 : 1);
68
+
69
+ function printUsage() {
70
+ console.log(`Usage:
71
+ dsh-free-search restore [--profile <name>] [--home <dir>] [--dry-run]
72
+
73
+ Removes the "searchProvider: ddg" / "fetchProvider: fs-quality-fetch" values
74
+ this plugin wrote into a profile's cordis.patch.yml. Values you set yourself are
75
+ left untouched, and a patch line surviving only because of them is dropped.
76
+
77
+ --profile <name> clean one profile under <home>/profiles
78
+ --home <dir> DSH home (defaults to $DSH_HOME or ~/.dsh)
79
+ --dry-run report what would change without writing
80
+
81
+ Nothing is written unless the word "restore" is the first argument.`);
82
+ }
package/lib/client.js CHANGED
@@ -568,6 +568,9 @@ window.__ModuleLoader__.load({
568
568
  fetchTakeoverHint: "开启时:web.fetchProvider 未设置或仍是出厂默认 http 会接管为 fs-quality-fetch。如果你刻意 pin 了 http(例如只想用内置抓取),关掉此项。",
569
569
  fetchForceLabel: "强制接管 web_fetch",
570
570
  fetchForceHint: "DSH 的「DeepSeek 搜索 API」开关会把 web.fetchProvider 写成 deepseek-fetch-api,即使关掉搜索开关,抓取也会一直走官方计费接口。勾选此项后,保存即把抓取改回 fs-quality-fetch,忽略上一项的判据。",
571
+ searchProxyLabel: "搜索代理",
572
+ searchProxyPlaceholder: "http://127.0.0.1:7890 或 socks5://127.0.0.1:1080",
573
+ searchProxyHint: "只用于搜索引擎的请求。留空=交给系统 fetch(跟随代理环境变量)。支持 http / https / socks5,可带用户名密码。",
571
574
  browserFetchLabel: "用本机浏览器渲染",
572
575
  browserFetchHint: "直连失败时用系统 Chrome/Edge 无头加载页面,能过 JS 挑战;没有浏览器时自动跳过。",
573
576
  browserPathLabel: "浏览器路径",
@@ -818,6 +821,9 @@ window.__ModuleLoader__.load({
818
821
  fetchTakeoverHint: "On: when web.fetchProvider is unset or still the factory default http, it is taken over as fs-quality-fetch. Turn this off if you deliberately pinned http (e.g. you only want the built-in fetcher).",
819
822
  fetchForceLabel: "Force the web_fetch takeover",
820
823
  fetchForceHint: "DSH's DeepSeek search switch writes web.fetchProvider as deepseek-fetch-api, so fetches keep going through the paid official API even after the switch is turned off. With this on, saving sets fetch back to fs-quality-fetch and ignores the check above.",
824
+ searchProxyLabel: "Search proxy",
825
+ searchProxyPlaceholder: "http://127.0.0.1:7890 or socks5://127.0.0.1:1080",
826
+ searchProxyHint: "Search-engine requests only. Empty = leave it to the platform fetch (follows the proxy env vars). Supports http / https / socks5, optionally with credentials.",
821
827
  browserFetchLabel: "Render with the local browser",
822
828
  browserFetchHint: "When direct fetch fails, load the page in headless Chrome/Edge to pass JS challenges; skipped when no browser is installed.",
823
829
  browserPathLabel: "Browser path",
@@ -928,7 +934,7 @@ window.__ModuleLoader__.load({
928
934
  "cache_search",
929
935
  "domain_search",
930
936
  ];
931
- const PLUGIN_VERSION = "0.9.82";
937
+ const PLUGIN_VERSION = "0.9.84";
932
938
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
933
939
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
934
940
  const NAV_ITEMS = [
@@ -1549,6 +1555,7 @@ window.__ModuleLoader__.load({
1549
1555
  const [fetchProviderForce, setFetchProviderForce] = react.useState(false);
1550
1556
  const [browserFetch, setBrowserFetch] = react.useState(true);
1551
1557
  const [browserPath, setBrowserPath] = react.useState("");
1558
+ const [searchProxy, setSearchProxy] = react.useState("");
1552
1559
  const [allowFakeIpCidrs, setAllowFakeIpCidrs] = react.useState("");
1553
1560
  const [fetchPrefer, setFetchPrefer] = react.useState("exa");
1554
1561
  const [deepseekFetchUrl, setDeepseekFetchUrl] = react.useState("");
@@ -1933,6 +1940,7 @@ window.__ModuleLoader__.load({
1933
1940
  setFetchProviderForce(v.fetchProviderForce === true);
1934
1941
  setBrowserFetch(v.browserFetch !== false);
1935
1942
  setBrowserPath(String(v.browserPath ?? ""));
1943
+ setSearchProxy(String(v.searchProxy ?? ""));
1936
1944
  setAllowFakeIpCidrs((Array.isArray(v.allowFakeIpCidrs) ? v.allowFakeIpCidrs : []).join("\n"));
1937
1945
  setFetchPrefer(v.fetchPrefer === "firecrawl" ? "firecrawl" : "exa");
1938
1946
  setDeepseekFetchUrl(v.deepseekFetchBaseUrl ?? "");
@@ -2184,6 +2192,7 @@ window.__ModuleLoader__.load({
2184
2192
  });
2185
2193
  ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
2186
2194
  ops.push({ op: "set", path: ["browserPath"], value: String(browserPath ?? "").trim() });
2195
+ ops.push({ op: "set", path: ["searchProxy"], value: String(searchProxy ?? "").trim() });
2187
2196
  ops.push({ op: "set", path: ["deepseekFetchBaseUrl"], value: deepseekFetchUrl.trim() });
2188
2197
  ops.push({
2189
2198
  op: "set",
@@ -2290,9 +2299,20 @@ window.__ModuleLoader__.load({
2290
2299
  });
2291
2300
  const result = await response.json();
2292
2301
  if (result.ok) {
2293
- setUpdateInfo({ ok: true, hasUpdate: false, upgraded: true, message: result.value.message, latest: result.value.latest });
2302
+ setUpdateInfo({
2303
+ ok: true,
2304
+ hasUpdate: false,
2305
+ upgraded: true,
2306
+ message: result.value.message,
2307
+ // #163: report the version that actually landed, not the registry's latest.
2308
+ installed: result.value.installed ?? result.value.latest,
2309
+ });
2294
2310
  } else {
2295
- setUpdateInfo({ ok: false, upgradeFailed: result.message ?? "upgrade failed" });
2311
+ setUpdateInfo({
2312
+ ok: false,
2313
+ upgradeFailed: result.message ?? "upgrade failed",
2314
+ blocked: result.code === "upgrade-blocked",
2315
+ });
2296
2316
  }
2297
2317
  } catch {
2298
2318
  setUpdateInfo({ ok: false, upgradeFailed: "request failed" });
@@ -3372,6 +3392,33 @@ react_jsx_runtime.jsxs("div", {
3372
3392
  }),
3373
3393
  ],
3374
3394
  }),
3395
+ react_jsx_runtime.jsxs("div", {
3396
+ className: "dshfs-field",
3397
+ children: [
3398
+ // 长说明进悬停卡片:文本框只留标签,与同段其它开关一致。
3399
+ react_jsx_runtime.jsx("div", {
3400
+ className: "dshfs-label",
3401
+ children: react_jsx_runtime.jsx(HintCard, {
3402
+ text: t.searchProxyHint,
3403
+ children: t.searchProxyLabel,
3404
+ }),
3405
+ }),
3406
+ react_jsx_runtime.jsx("input", {
3407
+ className: "dshfs-input",
3408
+ type: "text",
3409
+ placeholder: t.searchProxyPlaceholder,
3410
+ value: searchProxy,
3411
+ spellCheck: false,
3412
+ disabled: !ready || saving,
3413
+ onChange: (e) => {
3414
+ setSearchProxy(e.target.value);
3415
+ setDirty(true);
3416
+ setFailed(false);
3417
+ setSaveError("");
3418
+ },
3419
+ }),
3420
+ ],
3421
+ }),
3375
3422
  react_jsx_runtime.jsxs("div", {
3376
3423
  className: "dshfs-field",
3377
3424
  children: [
@@ -3891,7 +3938,7 @@ react_jsx_runtime.jsxs("div", {
3891
3938
  ? updateInfo.upgraded
3892
3939
  ? react_jsx_runtime.jsx("span", {
3893
3940
  className: "dshfs-updateOk",
3894
- children: t.upgradeDone(updateInfo.latest),
3941
+ children: t.upgradeDone(updateInfo.installed ?? updateInfo.latest),
3895
3942
  })
3896
3943
  : updateInfo.hasUpdate
3897
3944
  ? updateInfo.installable
@@ -3906,8 +3953,10 @@ react_jsx_runtime.jsxs("div", {
3906
3953
  })
3907
3954
  : updateInfo && !updateInfo.ok
3908
3955
  ? react_jsx_runtime.jsx("span", {
3909
- className: "dshfs-failed",
3910
- children: updateInfo.upgradeFailed ? t.upgradeFailed(updateInfo.upgradeFailed) : t.updateCheckFailed,
3956
+ className: updateInfo.blocked ? "dshfs-warn" : "dshfs-failed",
3957
+ children: updateInfo.upgradeFailed
3958
+ ? (updateInfo.blocked ? updateInfo.upgradeFailed : t.upgradeFailed(updateInfo.upgradeFailed))
3959
+ : t.updateCheckFailed,
3911
3960
  })
3912
3961
  : null,
3913
3962
 
@@ -1,6 +1,7 @@
1
1
  // Aliyun Bailian search engine.
2
2
  import { TINYFISH_URL, JINA_URL, DOUBAO_SEARCH_URL, snippetCap, stripTags, uniqueSources } from "./shared.js";
3
3
  import { TIME_ENGINES } from "../engine_meta.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  export async function searchAliyun(query, maxResults, apiKey, timeRange, signal) {
6
7
  if (!apiKey) throw new Error("Aliyun search requires DASHSCOPE_API_KEY");
@@ -23,7 +24,7 @@ export async function searchAliyun(query, maxResults, apiKey, timeRange, signal)
23
24
  signal?.addEventListener("abort", onAbort);
24
25
  let response;
25
26
  try {
26
- response = await fetch("https://dashscope.aliyuncs.com/api/v1/mcps/EnhancedSearch/mcp", {
27
+ response = await proxyFetch("https://dashscope.aliyuncs.com/api/v1/mcps/EnhancedSearch/mcp", {
27
28
  method: "POST",
28
29
  redirect: "error",
29
30
  headers: {
@@ -1,5 +1,6 @@
1
1
  // AnySearch AI engine (anonymous tier, optional key).
2
2
  import { uniqueSources, fetchHtmlWithRetry, stripTags, decodeEntities, approximateTimeRange, SEARXNG_INSTANCES, SEARXNG_TIME, ANYSEARCH_URL, EXA_MCP_URL, extractDdgUrl, MARKET_TO_LANG, LANG_PROFILES, BING_URL, DDG_HTML_URL, DDG_LITE_URL, activeAcceptLanguage, USER_AGENT, searchLanguage, configLanguage, activeOutputLanguage, looksRelevant } from "./shared.js";
3
+ import { proxyFetch } from "../proxy_fetch.js";
3
4
 
4
5
  let ignoredAnysearchKey = "";
5
6
 
@@ -28,7 +29,7 @@ export async function searchAnysearch(query, maxResults, signal, apiKey) {
28
29
  const doFetch = async (key) => {
29
30
  const headers = { "content-type": "application/json" };
30
31
  if (key) headers.authorization = `Bearer ${key}`;
31
- return await fetch(ANYSEARCH_URL, {
32
+ return await proxyFetch(ANYSEARCH_URL, {
32
33
  method: "POST",
33
34
  headers,
34
35
  body: JSON.stringify({ query, max_results: maxResults ?? 5 }),
@@ -3,6 +3,7 @@
3
3
  // chat/completions endpoint has a separate 100/day quota and accepts the same
4
4
  // body plus stream:false, returning the same references shape.
5
5
  import { uniqueSources } from "./shared.js";
6
+ import { proxyFetch } from "../proxy_fetch.js";
6
7
 
7
8
  const BAIDU_WEB_URL = "https://qianfan.baidubce.com/v2/ai_search/web_search";
8
9
  const BAIDU_CHAT_URL = "https://qianfan.baidubce.com/v2/ai_search/chat/completions";
@@ -25,7 +26,7 @@ async function postBaidu(url, body, apiKey, signal) {
25
26
  const onAbort = () => controller.abort();
26
27
  signal?.addEventListener("abort", onAbort);
27
28
  try {
28
- return await fetch(url, {
29
+ return await proxyFetch(url, {
29
30
  method: "POST",
30
31
  redirect: "error",
31
32
  headers: {
@@ -3,6 +3,7 @@
3
3
  // free allowance and there is no keyless tier, so a missing key skips the engine
4
4
  // (EngineSkip at the call site) instead of failing the whole search.
5
5
  import { stripTags, uniqueSources } from "./shared.js";
6
+ import { proxyFetch } from "../proxy_fetch.js";
6
7
 
7
8
  export const BRAVE_URL = "https://api.search.brave.com/res/v1/web/search";
8
9
  // Per-request budget: the fallback chain must not stall on an unreachable egress.
@@ -85,7 +86,7 @@ export async function searchBrave(query, maxResults, apiKey, timeRange, signal)
85
86
  const freshness = braveFreshness(timeRange);
86
87
  if (freshness !== undefined) params.set("freshness", freshness);
87
88
 
88
- const response = await fetch(`${BRAVE_URL}?${params.toString()}`, {
89
+ const response = await proxyFetch(`${BRAVE_URL}?${params.toString()}`, {
89
90
  method: "GET",
90
91
  redirect: "error",
91
92
  headers: {
@@ -1,6 +1,7 @@
1
1
  // Claude server-side web_search engine.
2
2
  import { stripTags, uniqueSources } from "./shared.js";
3
3
  import { stripTrackingParams } from "../url_norm.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  const CLAUDE_DEFAULT_MODEL = "claude-sonnet-5-5";
6
7
 
@@ -16,7 +17,7 @@ function claudeMessagesUrl(baseUrl) {
16
17
  export async function searchClaude(query, maxResults, apiKey, options, signal) {
17
18
  if (!apiKey) throw new Error("Claude search requires ANTHROPIC_API_KEY");
18
19
  const model = (typeof options?.claudeModel === "string" && options.claudeModel.trim()) || CLAUDE_DEFAULT_MODEL;
19
- const response = await fetch(claudeMessagesUrl(options?.claudeBaseUrl), {
20
+ const response = await proxyFetch(claudeMessagesUrl(options?.claudeBaseUrl), {
20
21
  method: "POST",
21
22
  redirect: "error",
22
23
  headers: {
@@ -1,11 +1,12 @@
1
1
  // DeepSeek official provider (Anthropic-compatible web_search tool).
2
2
  import { TAVILY_URL, FIRECRAWL_URL, isFirecrawlKeylessRefusal, markFirecrawlKeylessBlocked, PARALLEL_URL, PARALLEL_MCP_URL, PARALLEL_USER_AGENT, KEENABLE_URL, KEENABLE_MCP_URL, SERPBASE_URL, SERPLY_URL, OUTCRAWL_URL, YOUCOM_URL, YOUCOM_FREE_URL, YOUCOM_KEYS_LINK, isoDaysAgo, parseTimeRange, approximateTimeRange, uniqueSources } from "./shared.js";
3
3
  import { parseMcpResponseText } from "../mcp_adapter.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  export async function searchDeepSeekOfficial(query, maxResults, apiKey, signal) {
6
7
  if (!apiKey) throw new Error("DeepSeek search requires DEEPSEEK_API_KEY");
7
8
  // 内置 20s 超时(与外部 signal 组合):调用方不传 signal 时也不会永久卡住
8
- const response = await fetch("https://api.deepseek.com/anthropic/v1/messages", {
9
+ const response = await proxyFetch("https://api.deepseek.com/anthropic/v1/messages", {
9
10
  method: "POST",
10
11
  redirect: "error",
11
12
  headers: {
@@ -1,6 +1,7 @@
1
1
  // DeepSeek native /v1/tools/search engine.
2
2
  import { TAVILY_URL, FIRECRAWL_URL, isFirecrawlKeylessRefusal, markFirecrawlKeylessBlocked, PARALLEL_URL, PARALLEL_MCP_URL, PARALLEL_USER_AGENT, KEENABLE_URL, KEENABLE_MCP_URL, SERPBASE_URL, SERPLY_URL, OUTCRAWL_URL, YOUCOM_URL, YOUCOM_FREE_URL, YOUCOM_KEYS_LINK, isoDaysAgo, parseTimeRange, approximateTimeRange, uniqueSources } from "./shared.js";
3
3
  import { parseMcpResponseText } from "../mcp_adapter.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  const DEEPSEEK_TOOLS_SEARCH_URL = "https://api.deepseek.com/v1/tools/search";
6
7
 
@@ -77,7 +78,7 @@ export async function searchDeepSeekTools(query, maxResults, apiKey, timeRange,
77
78
  // 超额取数:按请求计费,且缺 url 的行会被丢弃,多取一些补位成本为零
78
79
  const count = Math.min(50, Math.max(limit, Math.ceil(limit * 1.5)));
79
80
 
80
- const response = await fetch(deepseekToolsEndpoint(baseUrl), {
81
+ const response = await proxyFetch(deepseekToolsEndpoint(baseUrl), {
81
82
  method: "POST",
82
83
  redirect: "error",
83
84
  headers: {
@@ -1,5 +1,6 @@
1
1
  // Degoog self-hosted engine.
2
2
  import { uniqueSources, fetchHtmlWithRetry, stripTags, decodeEntities, approximateTimeRange, SEARXNG_INSTANCES, SEARXNG_TIME, ANYSEARCH_URL, EXA_MCP_URL, extractDdgUrl, MARKET_TO_LANG, LANG_PROFILES, BING_URL, DDG_HTML_URL, DDG_LITE_URL, activeAcceptLanguage, USER_AGENT, searchLanguage, configLanguage, activeOutputLanguage, looksRelevant } from "./shared.js";
3
+ import { proxyFetch } from "../proxy_fetch.js";
3
4
 
4
5
  const DEGOOG_TIME = { day: "day", week: "week", month: "month", year: "year" };
5
6
 
@@ -28,7 +29,7 @@ export async function searchDegoog(query, maxResults, options, signal) {
28
29
  const timer = setTimeout(() => ctrl.abort(), 10000);
29
30
  const onAbort = () => ctrl.abort();
30
31
  signal?.addEventListener("abort", onAbort);
31
- const response = await fetch(degoogSearchUrl(base, query, { timeRange: options?.timeRange, lang: options?.lang }), {
32
+ const response = await proxyFetch(degoogSearchUrl(base, query, { timeRange: options?.timeRange, lang: options?.lang }), {
32
33
  headers: {
33
34
  "user-agent": USER_AGENT,
34
35
  accept: "application/json",
@@ -1,6 +1,7 @@
1
1
  // Volcano Doubao (AskEcho) search engine.
2
2
  import { TINYFISH_URL, JINA_URL, DOUBAO_SEARCH_URL, snippetCap, stripTags, uniqueSources } from "./shared.js";
3
3
  import { TIME_ENGINES } from "../engine_meta.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  function doubaoTimeRange(timeRange) {
6
7
  if (!timeRange) return undefined;
@@ -41,7 +42,7 @@ export async function searchDoubao(query, maxResults, apiKey, timeRange, signal)
41
42
  const range = doubaoTimeRange(timeRange);
42
43
  if (range !== undefined) body.TimeRange = range;
43
44
 
44
- const response = await fetch(DOUBAO_SEARCH_URL, {
45
+ const response = await proxyFetch(DOUBAO_SEARCH_URL, {
45
46
  method: "POST",
46
47
  redirect: "error",
47
48
  headers: {
@@ -2,6 +2,7 @@
2
2
  import { TAVILY_URL, FIRECRAWL_URL, isFirecrawlKeylessRefusal, markFirecrawlKeylessBlocked, PARALLEL_URL, PARALLEL_MCP_URL, PARALLEL_USER_AGENT, KEENABLE_URL, KEENABLE_MCP_URL, SERPBASE_URL, SERPLY_URL, OUTCRAWL_URL, YOUCOM_URL, YOUCOM_FREE_URL, YOUCOM_KEYS_LINK, isoDaysAgo, parseTimeRange, approximateTimeRange, uniqueSources } from "./shared.js";
3
3
  import { parseMcpResponseText } from "../mcp_adapter.js";
4
4
  import { EXA_MCP_URL } from "./shared.js";
5
+ import { proxyFetch } from "../proxy_fetch.js";
5
6
 
6
7
  export async function searchExa(query, maxResults, apiKey, timeRange, signal) {
7
8
  if (!apiKey) throw new Error("Exa search requires EXA_API_KEY");
@@ -16,7 +17,7 @@ export async function searchExa(query, maxResults, apiKey, timeRange, signal) {
16
17
  if (timeRange.after) body.startPublishedDate = timeRange.after;
17
18
  else if (timeRange.days !== undefined) body.startPublishedDate = isoDaysAgo(timeRange.days);
18
19
  }
19
- const response = await fetch("https://api.exa.ai/search", {
20
+ const response = await proxyFetch("https://api.exa.ai/search", {
20
21
  method: "POST",
21
22
  redirect: "error",
22
23
  headers: {
@@ -63,7 +64,7 @@ export async function searchExaMCP(query, maxResults, signal) {
63
64
  signal?.addEventListener("abort", onAbort);
64
65
  let response;
65
66
  try {
66
- response = await fetch(EXA_MCP_URL, {
67
+ response = await proxyFetch(EXA_MCP_URL, {
67
68
  method: "POST",
68
69
  headers: { "content-type": "application/json", accept: "application/json, text/event-stream" },
69
70
  body: JSON.stringify({
@@ -1,6 +1,7 @@
1
1
  // Firecrawl engine.
2
2
  import { TAVILY_URL, FIRECRAWL_URL, isFirecrawlKeylessRefusal, markFirecrawlKeylessBlocked, PARALLEL_URL, PARALLEL_MCP_URL, PARALLEL_USER_AGENT, KEENABLE_URL, KEENABLE_MCP_URL, SERPBASE_URL, SERPLY_URL, OUTCRAWL_URL, YOUCOM_URL, YOUCOM_FREE_URL, YOUCOM_KEYS_LINK, isoDaysAgo, parseTimeRange, approximateTimeRange, uniqueSources } from "./shared.js";
3
3
  import { parseMcpResponseText } from "../mcp_adapter.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  const FIRECRAWL_TBS = { day: "qdr:d", week: "qdr:w", month: "qdr:m", year: "qdr:y" };
6
7
 
@@ -28,7 +29,7 @@ export async function searchFirecrawl(query, maxResults, apiKey, timeRange, sign
28
29
  if (FIRECRAWL_TBS[tr]) body.tbs = FIRECRAWL_TBS[tr];
29
30
  }
30
31
  }
31
- response = await fetch(FIRECRAWL_URL, {
32
+ response = await proxyFetch(FIRECRAWL_URL, {
32
33
  method: "POST",
33
34
  headers: {
34
35
  "content-type": "application/json",
@@ -1,6 +1,7 @@
1
1
  // Gemini Interactions web_search engine.
2
2
  import { stripTags, uniqueSources } from "./shared.js";
3
3
  import { stripTrackingParams } from "../url_norm.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  const GEMINI_DEFAULT_MODEL = "gemini-3.8-flash";
6
7
 
@@ -14,7 +15,7 @@ function geminiInteractionsUrl(baseUrl) {
14
15
  export async function searchGemini(query, maxResults, apiKey, options, signal) {
15
16
  if (!apiKey) throw new Error("Gemini search requires GEMINI_API_KEY");
16
17
  const model = (typeof options?.geminiModel === "string" && options.geminiModel.trim()) || GEMINI_DEFAULT_MODEL;
17
- const response = await fetch(geminiInteractionsUrl(options?.geminiBaseUrl), {
18
+ const response = await proxyFetch(geminiInteractionsUrl(options?.geminiBaseUrl), {
18
19
  method: "POST",
19
20
  redirect: "error",
20
21
  headers: {
@@ -2,6 +2,7 @@
2
2
  // Needs both an API key (GOOGLE_CSE_API_KEY / settings googleCseApiKey) and the
3
3
  // search engine ID (cx / config googleCseId). Free tier: 100 queries/day.
4
4
  import { uniqueSources } from "./shared.js";
5
+ import { proxyFetch } from "../proxy_fetch.js";
5
6
 
6
7
  const GOOGLE_CSE_URL = "https://www.googleapis.com/customsearch/v1";
7
8
  const MAX_RESULTS = 30;
@@ -75,7 +76,7 @@ export async function searchGoogle(query, maxResults, apiKey, cseId, timeRange,
75
76
 
76
77
  let response;
77
78
  try {
78
- response = await fetch(`${GOOGLE_CSE_URL}?${params}`, {
79
+ response = await proxyFetch(`${GOOGLE_CSE_URL}?${params}`, {
79
80
  signal: controller.signal,
80
81
  redirect: "error",
81
82
  });
@@ -1,11 +1,12 @@
1
1
  // Jina engine.
2
2
  import { TINYFISH_URL, JINA_URL, DOUBAO_SEARCH_URL, snippetCap, stripTags, uniqueSources } from "./shared.js";
3
3
  import { TIME_ENGINES } from "../engine_meta.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  export async function searchJina(query, maxResults, apiKey, signal) {
6
7
  if (!apiKey) throw new Error("Jina search requires JINA_API_KEY");
7
8
  const params = new URLSearchParams({ q: query });
8
- const response = await fetch(`${JINA_URL}?${params}`, {
9
+ const response = await proxyFetch(`${JINA_URL}?${params}`, {
9
10
  method: "GET",
10
11
  redirect: "error",
11
12
  headers: {
@@ -1,6 +1,7 @@
1
1
  // Keenable engine: REST with a key, keyless MCP otherwise.
2
2
  import { TAVILY_URL, FIRECRAWL_URL, isFirecrawlKeylessRefusal, markFirecrawlKeylessBlocked, PARALLEL_URL, PARALLEL_MCP_URL, PARALLEL_USER_AGENT, KEENABLE_URL, KEENABLE_MCP_URL, SERPBASE_URL, SERPLY_URL, OUTCRAWL_URL, YOUCOM_URL, YOUCOM_FREE_URL, YOUCOM_KEYS_LINK, isoDaysAgo, parseTimeRange, approximateTimeRange, uniqueSources, looksRelevant } from "./shared.js";
3
3
  import { parseMcpResponseText } from "../mcp_adapter.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  export function formatKeenableRelative(days) {
6
7
  if (days <= 0.5) return "12h";
@@ -45,7 +46,7 @@ export async function searchKeenableREST(query, maxResults, apiKey, timeRange, s
45
46
  if (timeRange.after) body.published_after = timeRange.after;
46
47
  else if (timeRange.days !== undefined) body.published_after = formatKeenableRelative(timeRange.days);
47
48
  }
48
- response = await fetch(KEENABLE_URL, {
49
+ response = await proxyFetch(KEENABLE_URL, {
49
50
  method: "POST",
50
51
  headers: { "x-api-key": apiKey, "content-type": "application/json", accept: "application/json" },
51
52
  body: JSON.stringify(body),
@@ -91,7 +92,7 @@ export async function searchKeenableMCP(query, maxResults, timeRange, signal) {
91
92
  if (timeRange.after) arguments_.published_after = timeRange.after;
92
93
  else if (timeRange.days !== undefined) arguments_.published_after = formatKeenableRelative(timeRange.days);
93
94
  }
94
- response = await fetch(KEENABLE_MCP_URL, {
95
+ response = await proxyFetch(KEENABLE_MCP_URL, {
95
96
  method: "POST",
96
97
  headers: { "content-type": "application/json", accept: "application/json, text/event-stream" },
97
98
  body: JSON.stringify({
@@ -1,6 +1,7 @@
1
1
  // Kimi (Moonshot) search engine.
2
2
  import { TINYFISH_URL, JINA_URL, DOUBAO_SEARCH_URL, snippetCap, stripTags, uniqueSources } from "./shared.js";
3
3
  import { TIME_ENGINES } from "../engine_meta.js";
4
+ import { proxyFetch } from "../proxy_fetch.js";
4
5
 
5
6
  export async function searchKimi(query, maxResults, apiKey, timeRange, signal) {
6
7
  if (!apiKey) throw new Error("Kimi search requires MOONSHOT_API_KEY");
@@ -17,7 +18,7 @@ export async function searchKimi(query, maxResults, apiKey, timeRange, signal) {
17
18
  signal?.addEventListener("abort", onAbort);
18
19
  let response;
19
20
  try {
20
- response = await fetch("https://api.moonshot.cn/v1/tools/search", {
21
+ response = await proxyFetch("https://api.moonshot.cn/v1/tools/search", {
21
22
  method: "POST",
22
23
  redirect: "error",
23
24
  headers: {