dsh-free-search 0.9.45 → 0.9.46

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 (3) hide show
  1. package/README.md +4 -4
  2. package/lib/client.js +20 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -619,7 +619,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
619
619
 
620
620
  #### 离线自检断言(tools/)
621
621
 
622
- 仓库自带 **60 个**零依赖断言脚本(合计 **877 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
622
+ 仓库自带 **60 个**零依赖断言脚本(合计 **878 项**),**不需要 API key、不联网、不需要测试框架**,Node ≥ 20 即可跑。一次跑全部:`npm test`。
623
623
 
624
624
  | 脚本 | 覆盖 | 运行(项数) |
625
625
  |---|---|---|
@@ -681,7 +681,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
681
681
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless 出口判定:403 + VPN/proxy 文案才算拒绝、普通 403 与 401/429/500 不算、冷却初始未触发 | `node tools/assert-firecrawl-keyless.mjs`(5) |
682
682
  | `assert-fetch-charset.mjs` | 抓取编码(#88):`charset=gbk` / `gb2312` 按声明解码、无声明时嗅探 `<meta charset>` 与 http-equiv 形式、默认 UTF-8、未知 label 兜底 UTF-8 不抛错 | `node tools/assert-fetch-charset.mjs`(6) |
683
683
  | `assert-fetch-abort.mjs` | 抓取中断(#87):压缩响应中途断连必须 reject(不再永久 pending)、明文断连同样 reject、abort 能打断停滞的 gzip 流、complete 响应与重定向仍正常 | `node tools/assert-fetch-abort.mjs`(6) |
684
- | `assert-bridge-access.mjs` | 桥接 Host 围栏(#84):loopback 放行、remote peer 打 loopback Host 拒绝、`--trusted-host`(无端口匹配任意端口 / 带端口精确匹配)、`--public-url`、绑定地址、跨站与异源拒绝、connection 鉴权委托与 fail-closed | `node tools/assert-bridge-access.mjs`(13) |
684
+ | `assert-bridge-access.mjs` | 桥接 Host 围栏(#84):loopback 放行、remote peer 打 loopback Host 拒绝、`--trusted-host`(无端口匹配任意端口 / 带端口精确匹配)、`--public-url`、绑定地址、跨站与异源拒绝、connection 鉴权委托与 fail-closed、设置客户端按 `document.baseURI` 解析子路径 | `node tools/assert-bridge-access.mjs`(14) |
685
685
  | `assert-provider-takeover.mjs` | provider 接管:旧属性 API 与 rc.2 的 `config.*` ref 两套兼容、`settings.mutate(web)` 单批写入、显式指定的 provider 不被抢占、`fetchProviderTakeover: false` 时保留显式 `http`、describe 噪声不误报、嵌套 config 变化与 web 重建分别成行、关闭 DSH 搜索开关后重新接管(`deepseek-search-api` / `deepseek-official` 均视为官方默认)、打开 DeepSeek 开关(`deepseek-fetch-api`)时让路、apply 重入/重复注册不再中断、重复日志去重 | `node tools/assert-provider-takeover.mjs`(20) |
686
686
 
687
687
  任何一个失败会以非 0 退出码结束并列出失败项;把某个旧版本文件路径作为参数传进去,可以看到修复前必红(用来证明断言不是空转)。改动发布相关逻辑后建议先跑一遍再发版。
@@ -1321,7 +1321,7 @@ Restart `dsh web` after switching to apply changes.
1321
1321
 
1322
1322
  #### Offline self-check assertions (`tools/`)
1323
1323
 
1324
- **Sixty** zero-dependency assertion scripts ship with the repo (**877 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
1324
+ **Sixty** zero-dependency assertion scripts ship with the repo (**878 assertions** total): **no API keys, no network, no test framework**, Node ≥ 20. Run everything with `npm test`.
1325
1325
 
1326
1326
  | Script | Covers | Run (count) |
1327
1327
  |---|---|---|
@@ -1381,7 +1381,7 @@ Restart `dsh web` after switching to apply changes.
1381
1381
  | `assert-firecrawl-keyless.mjs` | Firecrawl keyless egress refusal: only a 403 with the VPN/proxy wording counts, plain 403 and 401/429/500 do not, and the cooldown starts inactive | `node tools/assert-firecrawl-keyless.mjs` (5) |
1382
1382
  | `assert-fetch-charset.mjs` | fetch encoding (#88): `charset=gbk` / `gb2312` decoded as declared, `<meta charset>` and the http-equiv form sniffed when the header omits it, UTF-8 by default, and an unknown label falls back to UTF-8 instead of throwing | `node tools/assert-fetch-charset.mjs` (6) |
1383
1383
  | `assert-fetch-abort.mjs` | fetch interruption (#87): a compressed response cut mid-body rejects instead of hanging forever, identity truncation rejects too, abort breaks a stalled gzip stream, and complete responses plus redirects still work | `node tools/assert-fetch-abort.mjs` (6) |
1384
- | `assert-bridge-access.mjs` | bridge Host fence (#84): loopback allowed, a remote peer behind a loopback Host refused, `--trusted-host` (port-less matches any port, explicit port matches exactly), `--public-url`, the bind address, cross-site and foreign-Origin refused, connection-auth delegation and fail-closed behavior | `node tools/assert-bridge-access.mjs` (13) |
1384
+ | `assert-bridge-access.mjs` | bridge Host fence (#84): loopback allowed, a remote peer behind a loopback Host refused, `--trusted-host` (port-less matches any port, explicit port matches exactly), `--public-url`, the bind address, cross-site and foreign-Origin refused, connection-auth delegation, fail-closed behavior, and settings-client subpath resolution via `document.baseURI` | `node tools/assert-bridge-access.mjs` (14) |
1385
1385
  | `assert-provider-takeover.mjs` | provider takeover: both the legacy property API and the rc.2 `config.*` refs, a single batched `settings.mutate(web)`, explicit foreign providers left untouched, an explicit `http` kept when `fetchProviderTakeover` is off, describe()-triggered events ignored when nothing changed, nested config changes and web rebuilds reported separately, re-takeover after DSH's search switch is turned off (both `deepseek-search-api` and `deepseek-official` count as the factory default), stepping aside for the explicit `deepseek-fetch-api` switch, apply re-entry / duplicate registrations tolerated, and repeated logs deduplicated | `node tools/assert-provider-takeover.mjs` (20) |
1386
1386
 
1387
1387
  Any failure exits non-zero with the failing items listed. Passing the path of an older file shows the pre-fix failures (proving the assertions are not vacuous). Worth running before a release.
package/lib/client.js CHANGED
@@ -301,7 +301,14 @@ window.__ModuleLoader__.load({
301
301
  }
302
302
  //#endregion
303
303
 
304
- const BRIDGE_PREFIX = "/api/dsh-free-search-settings";
304
+ const BRIDGE_PATH = "api/dsh-free-search-settings";
305
+ const bridgeUrl = (endpoint) => {
306
+ try {
307
+ return new URL(`${BRIDGE_PATH}/${endpoint}`, document.baseURI).toString();
308
+ } catch {
309
+ return `/${BRIDGE_PATH}/${endpoint}`;
310
+ }
311
+ };
305
312
  // rc.1: the settings namespace is the profile composition entry id (the
306
313
  // `web-search-free` row declared by cordis.patch.yml), not the old `free-search`
307
314
  // section name. Keep in sync with FREE_SEARCH_NS in lib/index.js.
@@ -712,7 +719,7 @@ window.__ModuleLoader__.load({
712
719
  "cache_search",
713
720
  "domain_search",
714
721
  ];
715
- const PLUGIN_VERSION = "0.9.45";
722
+ const PLUGIN_VERSION = "0.9.46";
716
723
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
717
724
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
718
725
  const NAV_ITEMS = [
@@ -850,7 +857,7 @@ window.__ModuleLoader__.load({
850
857
  };
851
858
 
852
859
  async function bridgeRestoreProvider() {
853
- const response = await fetch(`${BRIDGE_PREFIX}/restore-provider`, {
860
+ const response = await fetch(bridgeUrl("restore-provider"), {
854
861
  method: "POST",
855
862
  headers: { "content-type": "application/json" },
856
863
  body: "{}",
@@ -859,7 +866,7 @@ window.__ModuleLoader__.load({
859
866
  }
860
867
 
861
868
  async function bridgeCheckUpdate() {
862
- const response = await fetch(`${BRIDGE_PREFIX}/check-update`, {
869
+ const response = await fetch(bridgeUrl("check-update"), {
863
870
  method: "POST",
864
871
  headers: { "content-type": "application/json" },
865
872
  body: "{}",
@@ -869,7 +876,7 @@ window.__ModuleLoader__.load({
869
876
 
870
877
  // 诊断文本由服务端拼好,客户端只负责显示。
871
878
  async function bridgeDoctor() {
872
- const response = await fetch(`${BRIDGE_PREFIX}/doctor`, {
879
+ const response = await fetch(bridgeUrl("doctor"), {
873
880
  method: "POST",
874
881
  headers: { "content-type": "application/json" },
875
882
  body: "{}",
@@ -878,7 +885,7 @@ window.__ModuleLoader__.load({
878
885
  }
879
886
 
880
887
  async function bridgeDescribe() {
881
- const response = await fetch(`${BRIDGE_PREFIX}/describe`, {
888
+ const response = await fetch(bridgeUrl("describe"), {
882
889
  method: "POST",
883
890
  headers: { "content-type": "application/json" },
884
891
  body: "{}",
@@ -887,7 +894,7 @@ window.__ModuleLoader__.load({
887
894
  }
888
895
 
889
896
  async function bridgeMutate(payload) {
890
- const response = await fetch(`${BRIDGE_PREFIX}/mutate`, {
897
+ const response = await fetch(bridgeUrl("mutate"), {
891
898
  method: "POST",
892
899
  headers: { "content-type": "application/json" },
893
900
  body: JSON.stringify(payload),
@@ -896,7 +903,7 @@ window.__ModuleLoader__.load({
896
903
  }
897
904
 
898
905
  async function bridgeRawSearch(payload) {
899
- const response = await fetch(`${BRIDGE_PREFIX}/raw-search`, {
906
+ const response = await fetch(bridgeUrl("raw-search"), {
900
907
  method: "POST",
901
908
  headers: { "content-type": "application/json" },
902
909
  body: JSON.stringify(payload),
@@ -905,7 +912,7 @@ window.__ModuleLoader__.load({
905
912
  }
906
913
 
907
914
  async function bridgeCredentialsStatus() {
908
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-status`, {
915
+ const response = await fetch(bridgeUrl("credentials-status"), {
909
916
  method: "POST",
910
917
  headers: { "content-type": "application/json" },
911
918
  body: "{}",
@@ -914,7 +921,7 @@ window.__ModuleLoader__.load({
914
921
  }
915
922
 
916
923
  async function bridgeCredentialsSet(key, value) {
917
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-set`, {
924
+ const response = await fetch(bridgeUrl("credentials-set"), {
918
925
  method: "POST",
919
926
  headers: { "content-type": "application/json" },
920
927
  body: JSON.stringify({ key, value }),
@@ -923,7 +930,7 @@ window.__ModuleLoader__.load({
923
930
  }
924
931
 
925
932
  async function bridgeCredentialsUnset(key) {
926
- const response = await fetch(`${BRIDGE_PREFIX}/credentials-unset`, {
933
+ const response = await fetch(bridgeUrl("credentials-unset"), {
927
934
  method: "POST",
928
935
  headers: { "content-type": "application/json" },
929
936
  body: JSON.stringify({ key }),
@@ -1452,7 +1459,7 @@ window.__ModuleLoader__.load({
1452
1459
  setFailed(false);
1453
1460
  setSaveError("");
1454
1461
  try {
1455
- const response = await fetch(`${BRIDGE_PREFIX}/update`, {
1462
+ const response = await fetch(bridgeUrl("update"), {
1456
1463
  method: "POST",
1457
1464
  headers: { "content-type": "application/json" },
1458
1465
  body: "{}",
@@ -3216,7 +3223,7 @@ react_jsx_runtime.jsx("div", {
3216
3223
  // 挂插件页 slot:侧栏 插件 → 已安装 → free-search → 行配置页。
3217
3224
  // rc.1 废弃了旧版设置页的插件配置 slot,只保留 plugins.row.config;
3218
3225
  // key 规则见 ui-plugin-manager 的 rowConfigKey:<包名>#<patch 里声明的行 id>。
3219
- // 配置读写走自建 bridge(/api/dsh-free-search-settings),不依赖 dsh-web-ui。
3226
+ // 配置读写走自建 bridge(按页面 base 解析 api/dsh-free-search-settings),不依赖 dsh-web-ui。
3220
3227
  ctx.slots.inject("plugins.row.config", () =>
3221
3228
  ctx.slots.register(
3222
3229
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.9.45",
3
+ "version": "0.9.46",
4
4
  "description": "Free web search for DeepSeek Harness: 39 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/You.com keyless; Zhihu global/site via MCP and Perplexity/SerpBase/DeepSeek (official + native tools/search)/Baidu/Kimi/Aliyun/Doubao/Google CSE/Metaso/Yandex/Yuanbao with key; OpenAI/Gemini/Claude model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + editable zh/en language pools + multi mode (parallel full language-pool merge) + multi_search cross-source tool + failure-aware fallback (quota/auth cooldown, transient retry, fallbackOn) + time filtering + platform search + domain blocklist (blockedDomains) + web_fetch, with web settings UI, plus a standalone stdio MCP server.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",