dsh-free-search 0.9.48 → 0.9.49

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 (2) hide show
  1. package/lib/client.js +263 -358
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -301,13 +301,13 @@ window.__ModuleLoader__.load({
301
301
  }
302
302
  //#endregion
303
303
 
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
- }
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
311
  };
312
312
  // rc.1: the settings namespace is the profile composition entry id (the
313
313
  // `web-search-free` row declared by cordis.patch.yml), not the old `free-search`
@@ -361,6 +361,9 @@ window.__ModuleLoader__.load({
361
361
  allowlistMode: "只使用勾选的引擎",
362
362
  allowlistHint: "开启后只有勾选的引擎可用,新版本新增的引擎默认不启用。",
363
363
  fallbackPriority: "全局回退优先级",
364
+ engineSettings: "设置",
365
+ explicitEnginesLabel: "仅手动选择",
366
+ explicitEnginesHint: "这些引擎不会进入自动回退,只在明确选择时运行。",
364
367
  fallbackPriorityHint: "从上到下为回退顺序。首选引擎仍先尝试;Auto 保留语言/时间路由,但自定义后同一分组内及后续回退按此顺序。禁用引擎不会执行,但会保留当前位置。",
365
368
  fallbackPriorityReset: "恢复默认顺序",
366
369
  zhPoolLabel: "中文查询池",
@@ -474,10 +477,10 @@ window.__ModuleLoader__.load({
474
477
  yuanbaoModeHybrid: "混合结果",
475
478
  yuanbaoModeHint: "自然结果最通用;权威/多模态适合天气、股价、汇率等时效信息。",
476
479
  yuanbaoSiteLabel: "限定站点(可选)",
477
- yuanbaoSiteHint: "只搜某个域名时填写,例如 qq.com;留空搜索全网。",
478
- deepseekToolsKeyLabel: "DeepSeek 搜索 API key(可选)",
479
- deepseekToolsKeyHint: "留空复用现有 DeepSeek API key;自定义网关可以单独填。",
480
- deepseekToolsUrlLabel: "DeepSeek 搜索端点(可选)",
480
+ yuanbaoSiteHint: "只搜某个域名时填写,例如 qq.com;留空搜索全网。",
481
+ deepseekToolsKeyLabel: "DeepSeek 搜索 API key(可选)",
482
+ deepseekToolsKeyHint: "留空复用现有 DeepSeek API key;自定义网关可以单独填。",
483
+ deepseekToolsUrlLabel: "DeepSeek 搜索端点(可选)",
481
484
  deepseekToolsUrlHint: "留空使用 https://api.deepseek.com/v1/tools/search;可填完整 URL 或 base。自定义网关若走 /v1/search(如 wkbd2api),直接填完整地址。",
482
485
  restoreOfficial: "恢复官方搜索",
483
486
  restoreOfficialHint: "把 web.searchProvider 改回 deepseek-official、web.fetchProvider 改回 http。停用或卸载本插件前建议先点一次,避免宿主报 configured web provider \"ddg\" is not registered。",
@@ -560,6 +563,9 @@ window.__ModuleLoader__.load({
560
563
  allowlistMode: "Use only the checked engines",
561
564
  allowlistHint: "When on, only the checked engines are usable; engines added in later versions stay off.",
562
565
  fallbackPriority: "Global fallback priority",
566
+ engineSettings: "Settings",
567
+ explicitEnginesLabel: "Explicit only",
568
+ explicitEnginesHint: "These engines never join automatic fallback; they run only when selected explicitly.",
563
569
  fallbackPriorityHint: "Top to bottom is the fallback order. The preferred engine is still tried first. Auto keeps language/time routing, while customized priority orders engines within a route group and the remaining fallback chain. Disabled engines keep their position but are skipped.",
564
570
  fallbackPriorityReset: "Reset default order",
565
571
  zhPoolLabel: "Chinese query pool",
@@ -673,10 +679,10 @@ window.__ModuleLoader__.load({
673
679
  yuanbaoModeHybrid: "Hybrid results",
674
680
  yuanbaoModeHint: "Natural is the general default; authoritative/multimodal suits weather, stocks, FX and other timely facts.",
675
681
  yuanbaoSiteLabel: "Restrict to site (optional)",
676
- yuanbaoSiteHint: "Only search one domain, e.g. qq.com; leave empty for the whole web.",
677
- deepseekToolsKeyLabel: "DeepSeek search API key (optional)",
678
- deepseekToolsKeyHint: "Leave empty to reuse the existing DeepSeek API key; set a separate key for custom gateways.",
679
- deepseekToolsUrlLabel: "DeepSeek search endpoint (optional)",
682
+ yuanbaoSiteHint: "Only search one domain, e.g. qq.com; leave empty for the whole web.",
683
+ deepseekToolsKeyLabel: "DeepSeek search API key (optional)",
684
+ deepseekToolsKeyHint: "Leave empty to reuse the existing DeepSeek API key; set a separate key for custom gateways.",
685
+ deepseekToolsUrlLabel: "DeepSeek search endpoint (optional)",
680
686
  deepseekToolsUrlHint: "Leave empty for https://api.deepseek.com/v1/tools/search; a full URL or base works. For a custom gateway using /v1/search (e.g. wkbd2api), enter the full URL.",
681
687
  restoreOfficial: "Restore official search",
682
688
  restoreOfficialHint: "Sets web.searchProvider back to deepseek-official and web.fetchProvider back to http. Run this before disabling or uninstalling the plugin, otherwise the host reports configured web provider \"ddg\" is not registered.",
@@ -727,7 +733,7 @@ window.__ModuleLoader__.load({
727
733
  "cache_search",
728
734
  "domain_search",
729
735
  ];
730
- const PLUGIN_VERSION = "0.9.48";
736
+ const PLUGIN_VERSION = "0.9.49";
731
737
  const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
732
738
  // 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
733
739
  const NAV_ITEMS = [
@@ -864,6 +870,22 @@ window.__ModuleLoader__.load({
864
870
  return { domains, stats };
865
871
  };
866
872
 
873
+ async function bridgeRead(endpoint, body = "{}") {
874
+ const request = () =>
875
+ fetch(bridgeUrl(endpoint), {
876
+ method: "POST",
877
+ headers: { "content-type": "application/json" },
878
+ body,
879
+ signal: AbortSignal.timeout(15000),
880
+ });
881
+ try {
882
+ return await request();
883
+ } catch (error) {
884
+ await new Promise((resolve) => setTimeout(resolve, 800));
885
+ return request();
886
+ }
887
+ }
888
+
867
889
  async function bridgeRestoreProvider() {
868
890
  const response = await fetch(bridgeUrl("restore-provider"), {
869
891
  method: "POST",
@@ -893,11 +915,7 @@ window.__ModuleLoader__.load({
893
915
  }
894
916
 
895
917
  async function bridgeDescribe() {
896
- const response = await fetch(bridgeUrl("describe"), {
897
- method: "POST",
898
- headers: { "content-type": "application/json" },
899
- body: "{}",
900
- });
918
+ const response = await bridgeRead("describe");
901
919
  return response.json();
902
920
  }
903
921
 
@@ -920,11 +938,7 @@ window.__ModuleLoader__.load({
920
938
  }
921
939
 
922
940
  async function bridgeCredentialsStatus() {
923
- const response = await fetch(bridgeUrl("credentials-status"), {
924
- method: "POST",
925
- headers: { "content-type": "application/json" },
926
- body: "{}",
927
- });
941
+ const response = await bridgeRead("credentials-status");
928
942
  return response.json();
929
943
  }
930
944
 
@@ -947,6 +961,32 @@ window.__ModuleLoader__.load({
947
961
  }
948
962
 
949
963
  // 插件页行配置的摘要文案(bundle 页每行显示;不触发 bridge 读取)
964
+ function panelLabel() {
965
+ const primary = typeof navigator === "undefined" ? "zh" : String((navigator.languages && navigator.languages[0]) || navigator.language || "zh").toLowerCase();
966
+ return primary.startsWith("en") ? "Free Search" : "免费搜索";
967
+ }
968
+
969
+ function FreeSearchPage() {
970
+ return react_jsx_runtime.jsx("div", {
971
+ style: { height: "100%", minHeight: 0, overflowY: "auto", boxSizing: "border-box", padding: "16px 150px 24px 24px" },
972
+ children: react_jsx_runtime.jsx(FreeSearchCard, { page: true }),
973
+ });
974
+ }
975
+
976
+ function FreeSearchPanelIcon() {
977
+ return react_jsx_runtime.jsx("svg", {
978
+ width: 18,
979
+ height: 18,
980
+ viewBox: "0 0 24 24",
981
+ fill: "none",
982
+ "aria-hidden": "true",
983
+ children: [
984
+ react_jsx_runtime.jsx("circle", { cx: "11", cy: "11", r: "6.5", stroke: "currentColor", strokeWidth: "1.8" }),
985
+ react_jsx_runtime.jsx("path", { d: "m16 16 4.2 4.2", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }),
986
+ ],
987
+ });
988
+ }
989
+
950
990
  function summaryText() {
951
991
  const primary = typeof navigator === "undefined" ? "zh" : String((navigator.languages && navigator.languages[0]) || navigator.language || "zh").toLowerCase();
952
992
  return primary.startsWith("en")
@@ -989,6 +1029,7 @@ window.__ModuleLoader__.load({
989
1029
  const [allowedEngines, setAllowedEngines] = react.useState([]);
990
1030
  const [fallbackOrder, setFallbackOrder] = react.useState(DEFAULT_FALLBACK_ORDER);
991
1031
  const [dragIndex, setDragIndex] = react.useState(null);
1032
+ const [expandedEngine, setExpandedEngine] = react.useState("");
992
1033
  const [poolDrag, setPoolDrag] = react.useState(null);
993
1034
  const [zhPool, setZhPool] = react.useState(DEFAULT_ZH_POOL);
994
1035
  const [enPool, setEnPool] = react.useState(DEFAULT_EN_POOL);
@@ -1108,6 +1149,9 @@ window.__ModuleLoader__.load({
1108
1149
  serply: [serplyKey, setSerplyKey],
1109
1150
  outcrawl: [outcrawlKey, setOutcrawlKey],
1110
1151
  google: [googleKey, setGoogleKey],
1152
+ metaso: [metasoKey, setMetasoKey],
1153
+ yandex: [yandexKey, setYandexKey],
1154
+ yuanbao: [yuanbaoKey, setYuanbaoKey],
1111
1155
  you: [youcomKey, setYoucomKey],
1112
1156
  baidu: [baiduKey, setBaiduKey],
1113
1157
  kimi: [kimiKey, setKimiKey],
@@ -1144,6 +1188,137 @@ window.__ModuleLoader__.load({
1144
1188
  });
1145
1189
  };
1146
1190
 
1191
+ const ENGINE_SETTINGS_IDS = ["google", "deepseek-tools", "metaso", "yandex", "yuanbao"];
1192
+ const engineHasSettings = (id) => ENGINE_SETTINGS_IDS.includes(id);
1193
+ const markEngineDirty = () => {
1194
+ setDirty(true);
1195
+ setFailed(false);
1196
+ setSaveError("");
1197
+ };
1198
+ const renderEngineKeyInput = (id) => {
1199
+ const k = KEY_INPUTS[id];
1200
+ if (!k) return null;
1201
+ return react_jsx_runtime.jsx("input", {
1202
+ className: "dshfs-priorityKey",
1203
+ type: "password",
1204
+ placeholder: "API key",
1205
+ value: k[0],
1206
+ disabled: !ready || saving,
1207
+ onDragStart: (e) => { e.preventDefault(); e.stopPropagation(); },
1208
+ onChange: (e) => { k[1](e.target.value); markEngineDirty(); },
1209
+ });
1210
+ };
1211
+ const engineSettingField = (label, value, setter, options = {}) =>
1212
+ react_jsx_runtime.jsx("div", {
1213
+ className: "dshfs-engineSetting",
1214
+ children: [
1215
+ react_jsx_runtime.jsx("div", { className: "dshfs-label", children: label }),
1216
+ react_jsx_runtime.jsx("input", {
1217
+ className: "dshfs-input",
1218
+ type: options.type ?? "text",
1219
+ value,
1220
+ spellCheck: false,
1221
+ placeholder: options.placeholder ?? "",
1222
+ disabled: !ready || saving,
1223
+ onChange: (e) => { setter(e.target.value); markEngineDirty(); },
1224
+ }),
1225
+ options.hint
1226
+ ? react_jsx_runtime.jsx("p", { className: "dshfs-hint", children: options.hint })
1227
+ : null,
1228
+ ],
1229
+ });
1230
+ const engineSettingSelect = (label, value, setter, choices, hint) =>
1231
+ react_jsx_runtime.jsx("div", {
1232
+ className: "dshfs-engineSetting",
1233
+ children: [
1234
+ react_jsx_runtime.jsx("div", { className: "dshfs-label", children: label }),
1235
+ react_jsx_runtime.jsx("select", {
1236
+ className: "dshfs-select",
1237
+ value,
1238
+ style: { colorScheme: selectColorScheme },
1239
+ disabled: !ready || saving,
1240
+ onChange: (e) => { setter(e.target.value); markEngineDirty(); },
1241
+ children: choices.map((choice) =>
1242
+ react_jsx_runtime.jsx("option", { value: choice[0], children: choice[1] }, choice[0])
1243
+ ),
1244
+ }),
1245
+ hint ? react_jsx_runtime.jsx("p", { className: "dshfs-hint", children: hint }) : null,
1246
+ ],
1247
+ });
1248
+ const renderEngineSettings = (id) => {
1249
+ let fields = [];
1250
+ if (id === "google") {
1251
+ fields = [engineSettingField(t.googleCseIdLabel, googleCx, setGoogleCx, {
1252
+ placeholder: "0123456789:abcdef",
1253
+ hint: t.googleCseIdHint,
1254
+ })];
1255
+ } else if (id === "deepseek-tools") {
1256
+ fields = [
1257
+ engineSettingField(t.deepseekToolsKeyLabel, deepseekToolsKey, setDeepseekToolsKey, {
1258
+ type: "password",
1259
+ placeholder: "API key",
1260
+ hint: t.deepseekToolsKeyHint,
1261
+ }),
1262
+ engineSettingField(t.deepseekToolsUrlLabel, deepseekToolsUrl, setDeepseekToolsUrl, {
1263
+ placeholder: "https://api.deepseek.com/v1/tools/search",
1264
+ hint: t.deepseekToolsUrlHint,
1265
+ }),
1266
+ ];
1267
+ } else if (id === "metaso") {
1268
+ fields = [engineSettingSelect(t.metasoScopeLabel, metasoScope, setMetasoScope, [
1269
+ ["webpage", t.metasoScopeWebpage],
1270
+ ["document", t.metasoScopeDocument],
1271
+ ["scholar", t.metasoScopeScholar],
1272
+ ], t.metasoScopeHint)];
1273
+ } else if (id === "yandex") {
1274
+ fields = [
1275
+ engineSettingField(t.yandexFolderLabel, yandexFolder, setYandexFolder, {
1276
+ placeholder: "b1g...",
1277
+ hint: t.yandexFolderHint,
1278
+ }),
1279
+ engineSettingSelect(t.yandexSearchTypeLabel, yandexType, setYandexType, [
1280
+ ["auto", t.yandexSearchTypeAuto],
1281
+ ["ru", t.yandexSearchTypeRu],
1282
+ ["tr", t.yandexSearchTypeTr],
1283
+ ["com", t.yandexSearchTypeCom],
1284
+ ["kk", t.yandexSearchTypeKk],
1285
+ ["be", t.yandexSearchTypeBe],
1286
+ ["uz", t.yandexSearchTypeUz],
1287
+ ], t.yandexSearchTypeHint),
1288
+ ];
1289
+ } else if (id === "yuanbao") {
1290
+ fields = [
1291
+ engineSettingSelect(t.yuanbaoModeLabel, yuanbaoMode, setYuanbaoMode, [
1292
+ ["0", t.yuanbaoModeNatural],
1293
+ ["1", t.yuanbaoModeVr],
1294
+ ["2", t.yuanbaoModeHybrid],
1295
+ ], t.yuanbaoModeHint),
1296
+ engineSettingField(t.yuanbaoSiteLabel, yuanbaoSite, setYuanbaoSite, {
1297
+ placeholder: "qq.com",
1298
+ hint: t.yuanbaoSiteHint,
1299
+ }),
1300
+ ];
1301
+ }
1302
+ return fields.length === 0
1303
+ ? null
1304
+ : react_jsx_runtime.jsx("div", {
1305
+ className: "dshfs-engineSettings",
1306
+ style: { flexBasis: "100%", display: "grid", gap: "8px", paddingTop: "8px" },
1307
+ children: fields,
1308
+ });
1309
+ };
1310
+ const renderEngineSettingsButton = (id) => {
1311
+ if (!engineHasSettings(id)) return null;
1312
+ return react_jsx_runtime.jsx("button", {
1313
+ type: "button",
1314
+ className: "dshfs-btn dshfs-engineSettingsBtn",
1315
+ disabled: !ready || saving,
1316
+ onMouseDown: (e) => e.stopPropagation(),
1317
+ onDragStart: (e) => { e.preventDefault(); e.stopPropagation(); },
1318
+ onClick: () => setExpandedEngine((prev) => (prev === id ? "" : id)),
1319
+ children: expandedEngine === id ? t.engineSettings + " ▴" : t.engineSettings,
1320
+ });
1321
+ };
1147
1322
  const load = react.useCallback(async () => {
1148
1323
  try {
1149
1324
  const result = await bridgeDescribe();
@@ -1258,7 +1433,7 @@ window.__ModuleLoader__.load({
1258
1433
  if (path === "googleCseApiKey") configured.google = true;
1259
1434
  if (path === "metasoApiKey") configured.metaso = true;
1260
1435
  if (path === "yandexApiKey") configured.yandex = true;
1261
- if (path === "yuanbaoApiKey") configured.yuanbao = true;
1436
+ if (path === "yuanbaoApiKey") configured.yuanbao = true;
1262
1437
  if (path === "deepseekToolsApiKey") configured.deepseek = true;
1263
1438
  }
1264
1439
  }
@@ -1315,7 +1490,7 @@ window.__ModuleLoader__.load({
1315
1490
  ["firecrawlApiKey", firecrawlKey],
1316
1491
  ["parallelApiKey", parallelKey],
1317
1492
  ["perplexityApiKey", perplexityKey],
1318
- ["deepseekApiKey", deepseekKey],
1493
+ ["deepseekApiKey", deepseekKey],
1319
1494
  ["deepseekToolsApiKey", deepseekToolsKey],
1320
1495
  ["serpbaseApiKey", serpbaseKey],
1321
1496
  ["serplyApiKey", serplyKey],
@@ -1374,7 +1549,7 @@ window.__ModuleLoader__.load({
1374
1549
  ops.push({ op: "set", path: ["yandexFolderId"], value: yandexFolder.trim() });
1375
1550
  ops.push({ op: "set", path: ["yandexSearchType"], value: ["ru", "tr", "com", "kk", "be", "uz"].includes(yandexType) ? yandexType : "auto" });
1376
1551
  ops.push({ op: "set", path: ["yuanbaoMode"], value: yuanbaoMode === "1" || yuanbaoMode === "2" ? Number(yuanbaoMode) : 0 });
1377
- ops.push({ op: "set", path: ["yuanbaoSite"], value: yuanbaoSite.trim() });
1552
+ ops.push({ op: "set", path: ["yuanbaoSite"], value: yuanbaoSite.trim() });
1378
1553
  ops.push({ op: "set", path: ["deepseekToolsBaseUrl"], value: deepseekToolsUrl.trim() });
1379
1554
  ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
1380
1555
  ops.push({
@@ -1553,7 +1728,7 @@ window.__ModuleLoader__.load({
1553
1728
  return () => window.removeEventListener("resize", place);
1554
1729
  }, [open, state.status]);
1555
1730
 
1556
- // 分区链接:地址栏里出现 #/panel/plugins/dsh-free-search/<分区>(或任意 …/<分区>)就滚过去。
1731
+ // 分区链接:地址栏里出现 #/panel/plugins/dsh-free-search/web-search-free/<分区>(或任意 …/<分区>)就滚过去。
1557
1732
  // 本插件**只读不写** URL —— 地址栏的唯一写者是 dsh-url-router,写这里会跟它抢。
1558
1733
  react.useEffect(() => {
1559
1734
  if (!pageMode) return undefined;
@@ -2128,316 +2303,6 @@ react_jsx_runtime.jsx("div", {
2128
2303
  }),
2129
2304
  ],
2130
2305
  }),
2131
- react_jsx_runtime.jsx("div", {
2132
- className: "dshfs-field",
2133
- children: [
2134
- react_jsx_runtime.jsx("div", {
2135
- className: "dshfs-label",
2136
- children: t.googleCseIdLabel,
2137
- }),
2138
- react_jsx_runtime.jsx("input", {
2139
- className: "dshfs-input",
2140
- type: "text",
2141
- value: googleCx,
2142
- spellCheck: false,
2143
- placeholder: "0123456789:abcdef",
2144
- disabled: !ready || saving,
2145
- onChange: (e) => {
2146
- setGoogleCx(e.target.value);
2147
- setDirty(true);
2148
- setFailed(false);
2149
- setSaveError("");
2150
- },
2151
- }),
2152
- react_jsx_runtime.jsx("p", {
2153
- className: "dshfs-hint",
2154
- children: t.googleCseIdHint,
2155
- }),
2156
- ],
2157
- }),
2158
- react_jsx_runtime.jsx("div", {
2159
- className: "dshfs-field",
2160
- children: [
2161
- react_jsx_runtime.jsx("div", {
2162
- className: "dshfs-label",
2163
- children: t.metasoKeyLabel,
2164
- }),
2165
- react_jsx_runtime.jsx("input", {
2166
- className: "dshfs-input",
2167
- type: "password",
2168
- value: metasoKey,
2169
- spellCheck: false,
2170
- placeholder: "API key",
2171
- disabled: !ready || saving,
2172
- onChange: (e) => {
2173
- setMetasoKey(e.target.value);
2174
- setDirty(true);
2175
- setFailed(false);
2176
- setSaveError("");
2177
- },
2178
- }),
2179
- react_jsx_runtime.jsx("p", {
2180
- className: "dshfs-hint",
2181
- children: t.metasoKeyHint,
2182
- }),
2183
- ],
2184
- }),
2185
- react_jsx_runtime.jsx("div", {
2186
- className: "dshfs-field",
2187
- children: [
2188
- react_jsx_runtime.jsx("div", {
2189
- className: "dshfs-label",
2190
- children: t.metasoScopeLabel,
2191
- }),
2192
- react_jsx_runtime.jsx("select", {
2193
- className: "dshfs-select",
2194
- value: metasoScope,
2195
- style: { colorScheme: selectColorScheme },
2196
- disabled: !ready || saving,
2197
- onChange: (e) => {
2198
- setMetasoScope(e.target.value === "document" || e.target.value === "scholar" ? e.target.value : "webpage");
2199
- setDirty(true);
2200
- setFailed(false);
2201
- setSaveError("");
2202
- },
2203
- children: [
2204
- react_jsx_runtime.jsx("option", { value: "webpage", children: t.metasoScopeWebpage }),
2205
- react_jsx_runtime.jsx("option", { value: "document", children: t.metasoScopeDocument }),
2206
- react_jsx_runtime.jsx("option", { value: "scholar", children: t.metasoScopeScholar }),
2207
- ],
2208
- }),
2209
- react_jsx_runtime.jsx("p", {
2210
- className: "dshfs-hint",
2211
- children: t.metasoScopeHint,
2212
- }),
2213
- ],
2214
- }),
2215
- react_jsx_runtime.jsx("div", {
2216
- className: "dshfs-field",
2217
- children: [
2218
- react_jsx_runtime.jsx("div", {
2219
- className: "dshfs-label",
2220
- children: t.yandexKeyLabel,
2221
- }),
2222
- react_jsx_runtime.jsx("input", {
2223
- className: "dshfs-input",
2224
- type: "password",
2225
- value: yandexKey,
2226
- spellCheck: false,
2227
- placeholder: "API key",
2228
- disabled: !ready || saving,
2229
- onChange: (e) => {
2230
- setYandexKey(e.target.value);
2231
- setDirty(true);
2232
- setFailed(false);
2233
- setSaveError("");
2234
- },
2235
- }),
2236
- react_jsx_runtime.jsx("p", {
2237
- className: "dshfs-hint",
2238
- children: t.yandexKeyHint,
2239
- }),
2240
- ],
2241
- }),
2242
- react_jsx_runtime.jsx("div", {
2243
- className: "dshfs-field",
2244
- children: [
2245
- react_jsx_runtime.jsx("div", {
2246
- className: "dshfs-label",
2247
- children: t.yandexFolderLabel,
2248
- }),
2249
- react_jsx_runtime.jsx("input", {
2250
- className: "dshfs-input",
2251
- type: "text",
2252
- value: yandexFolder,
2253
- spellCheck: false,
2254
- placeholder: "b1g...",
2255
- disabled: !ready || saving,
2256
- onChange: (e) => {
2257
- setYandexFolder(e.target.value);
2258
- setDirty(true);
2259
- setFailed(false);
2260
- setSaveError("");
2261
- },
2262
- }),
2263
- react_jsx_runtime.jsx("p", {
2264
- className: "dshfs-hint",
2265
- children: t.yandexFolderHint,
2266
- }),
2267
- ],
2268
- }),
2269
- react_jsx_runtime.jsx("div", {
2270
- className: "dshfs-field",
2271
- children: [
2272
- react_jsx_runtime.jsx("div", {
2273
- className: "dshfs-label",
2274
- children: t.yandexSearchTypeLabel,
2275
- }),
2276
- react_jsx_runtime.jsx("select", {
2277
- className: "dshfs-select",
2278
- value: yandexType,
2279
- style: { colorScheme: selectColorScheme },
2280
- disabled: !ready || saving,
2281
- onChange: (e) => {
2282
- setYandexType(["ru", "tr", "com", "kk", "be", "uz"].includes(e.target.value) ? e.target.value : "auto");
2283
- setDirty(true);
2284
- setFailed(false);
2285
- setSaveError("");
2286
- },
2287
- children: [
2288
- react_jsx_runtime.jsx("option", { value: "auto", children: t.yandexSearchTypeAuto }),
2289
- react_jsx_runtime.jsx("option", { value: "ru", children: t.yandexSearchTypeRu }),
2290
- react_jsx_runtime.jsx("option", { value: "tr", children: t.yandexSearchTypeTr }),
2291
- react_jsx_runtime.jsx("option", { value: "com", children: t.yandexSearchTypeCom }),
2292
- react_jsx_runtime.jsx("option", { value: "kk", children: t.yandexSearchTypeKk }),
2293
- react_jsx_runtime.jsx("option", { value: "be", children: t.yandexSearchTypeBe }),
2294
- react_jsx_runtime.jsx("option", { value: "uz", children: t.yandexSearchTypeUz }),
2295
- ],
2296
- }),
2297
- react_jsx_runtime.jsx("p", {
2298
- className: "dshfs-hint",
2299
- children: t.yandexSearchTypeHint,
2300
- }),
2301
- ],
2302
- }),
2303
- react_jsx_runtime.jsx("div", {
2304
- className: "dshfs-field",
2305
- children: [
2306
- react_jsx_runtime.jsx("div", {
2307
- className: "dshfs-label",
2308
- children: t.yuanbaoKeyLabel,
2309
- }),
2310
- react_jsx_runtime.jsx("input", {
2311
- className: "dshfs-input",
2312
- type: "password",
2313
- value: yuanbaoKey,
2314
- spellCheck: false,
2315
- placeholder: "API key",
2316
- disabled: !ready || saving,
2317
- onChange: (e) => {
2318
- setYuanbaoKey(e.target.value);
2319
- setDirty(true);
2320
- setFailed(false);
2321
- setSaveError("");
2322
- },
2323
- }),
2324
- react_jsx_runtime.jsx("p", {
2325
- className: "dshfs-hint",
2326
- children: t.yuanbaoKeyHint,
2327
- }),
2328
- ],
2329
- }),
2330
- react_jsx_runtime.jsx("div", {
2331
- className: "dshfs-field",
2332
- children: [
2333
- react_jsx_runtime.jsx("div", {
2334
- className: "dshfs-label",
2335
- children: t.yuanbaoModeLabel,
2336
- }),
2337
- react_jsx_runtime.jsx("select", {
2338
- className: "dshfs-select",
2339
- value: yuanbaoMode,
2340
- style: { colorScheme: selectColorScheme },
2341
- disabled: !ready || saving,
2342
- onChange: (e) => {
2343
- setYuanbaoMode(e.target.value === "1" || e.target.value === "2" ? e.target.value : "0");
2344
- setDirty(true);
2345
- setFailed(false);
2346
- setSaveError("");
2347
- },
2348
- children: [
2349
- react_jsx_runtime.jsx("option", { value: "0", children: t.yuanbaoModeNatural }),
2350
- react_jsx_runtime.jsx("option", { value: "1", children: t.yuanbaoModeVr }),
2351
- react_jsx_runtime.jsx("option", { value: "2", children: t.yuanbaoModeHybrid }),
2352
- ],
2353
- }),
2354
- react_jsx_runtime.jsx("p", {
2355
- className: "dshfs-hint",
2356
- children: t.yuanbaoModeHint,
2357
- }),
2358
- ],
2359
- }),
2360
- react_jsx_runtime.jsx("div", {
2361
- className: "dshfs-field",
2362
- children: [
2363
- react_jsx_runtime.jsx("div", {
2364
- className: "dshfs-label",
2365
- children: t.yuanbaoSiteLabel,
2366
- }),
2367
- react_jsx_runtime.jsx("input", {
2368
- className: "dshfs-input",
2369
- type: "text",
2370
- value: yuanbaoSite,
2371
- spellCheck: false,
2372
- placeholder: "qq.com",
2373
- disabled: !ready || saving,
2374
- onChange: (e) => {
2375
- setYuanbaoSite(e.target.value);
2376
- setDirty(true);
2377
- setFailed(false);
2378
- setSaveError("");
2379
- },
2380
- }),
2381
- react_jsx_runtime.jsx("p", {
2382
- className: "dshfs-hint",
2383
- children: t.yuanbaoSiteHint,
2384
- }),
2385
- ],
2386
- }),
2387
- react_jsx_runtime.jsx("div", {
2388
- className: "dshfs-field",
2389
- children: [
2390
- react_jsx_runtime.jsx("div", {
2391
- className: "dshfs-label",
2392
- children: t.deepseekToolsKeyLabel,
2393
- }),
2394
- react_jsx_runtime.jsx("input", {
2395
- className: "dshfs-input",
2396
- type: "password",
2397
- value: deepseekToolsKey,
2398
- spellCheck: false,
2399
- placeholder: "API key",
2400
- disabled: !ready || saving,
2401
- onChange: (e) => {
2402
- setDeepseekToolsKey(e.target.value);
2403
- setDirty(true);
2404
- setFailed(false);
2405
- setSaveError("");
2406
- },
2407
- }),
2408
- react_jsx_runtime.jsx("p", {
2409
- className: "dshfs-hint",
2410
- children: t.deepseekToolsKeyHint,
2411
- }),
2412
- ],
2413
- }),
2414
- react_jsx_runtime.jsx("div", {
2415
- className: "dshfs-field",
2416
- children: [
2417
- react_jsx_runtime.jsx("div", {
2418
- className: "dshfs-label",
2419
- children: t.deepseekToolsUrlLabel,
2420
- }),
2421
- react_jsx_runtime.jsx("input", {
2422
- className: "dshfs-input",
2423
- type: "text",
2424
- value: deepseekToolsUrl,
2425
- spellCheck: false,
2426
- placeholder: "https://api.deepseek.com/v1/tools/search",
2427
- disabled: !ready || saving,
2428
- onChange: (e) => {
2429
- setDeepseekToolsUrl(e.target.value);
2430
- setDirty(true);
2431
- setFailed(false);
2432
- setSaveError("");
2433
- },
2434
- }),
2435
- react_jsx_runtime.jsx("p", {
2436
- className: "dshfs-hint",
2437
- children: t.deepseekToolsUrlHint,
2438
- }),
2439
- ],
2440
- }),
2441
2306
  react_jsx_runtime.jsx("div", {
2442
2307
  className: "dshfs-field",
2443
2308
  id: "dshfs-anchor-fallback",
@@ -2455,6 +2320,7 @@ react_jsx_runtime.jsx("div", {
2455
2320
  const isDisabled = engineDisabled(engineId);
2456
2321
  return react_jsx_runtime.jsx("div", {
2457
2322
  className: "dshfs-priorityRow" + (isDisabled ? " dshfs-priorityRowDisabled" : "") + (dragIndex === index ? " dshfs-priorityRowDragging" : ""),
2323
+ style: { flexWrap: "wrap" },
2458
2324
  draggable: ready && !saving,
2459
2325
  onDragStart: (e) => {
2460
2326
  setDragIndex(index);
@@ -2480,24 +2346,8 @@ react_jsx_runtime.jsx("div", {
2480
2346
  children: `${engine.label} (${engine.badge})${isDisabled ? " · " + t.priorityDisabled : ""}`,
2481
2347
  }),
2482
2348
  renderKeyStatus(engineId),
2483
- (() => {
2484
- const k = KEY_INPUTS[engineId];
2485
- if (!k) return null;
2486
- return react_jsx_runtime.jsx("input", {
2487
- className: "dshfs-priorityKey",
2488
- type: "password",
2489
- placeholder: "API key",
2490
- value: k[0],
2491
- disabled: !ready || saving,
2492
- onDragStart: (e) => { e.preventDefault(); e.stopPropagation(); },
2493
- onChange: (e) => {
2494
- k[1](e.target.value);
2495
- setDirty(true);
2496
- setFailed(false);
2497
- setSaveError("");
2498
- },
2499
- });
2500
- })(),
2349
+ renderEngineKeyInput(engineId),
2350
+ renderEngineSettingsButton(engineId),
2501
2351
  react_jsx_runtime.jsx("span", {
2502
2352
  className: "dshfs-priorityActions",
2503
2353
  children: [
@@ -2509,6 +2359,7 @@ react_jsx_runtime.jsx("div", {
2509
2359
  }, "handle"),
2510
2360
  ],
2511
2361
  }),
2362
+ expandedEngine === engineId ? renderEngineSettings(engineId) : null,
2512
2363
  ],
2513
2364
  }, engineId);
2514
2365
  }),
@@ -2533,6 +2384,40 @@ react_jsx_runtime.jsx("div", {
2533
2384
  }),
2534
2385
  ],
2535
2386
  }),
2387
+ react_jsx_runtime.jsx("div", {
2388
+ className: "dshfs-field",
2389
+ children: [
2390
+ react_jsx_runtime.jsx("div", {
2391
+ className: "dshfs-label",
2392
+ children: t.explicitEnginesLabel,
2393
+ }),
2394
+ react_jsx_runtime.jsx("p", {
2395
+ className: "dshfs-hint",
2396
+ children: t.explicitEnginesHint,
2397
+ }),
2398
+ react_jsx_runtime.jsx("div", {
2399
+ className: "dshfs-priorityList",
2400
+ children: ["metaso", "yandex", "yuanbao"].map((engineId) => {
2401
+ const engine = ENGINES.find((item) => item.id === engineId);
2402
+ if (!engine) return null;
2403
+ return react_jsx_runtime.jsx("div", {
2404
+ className: "dshfs-priorityRow",
2405
+ style: { flexWrap: "wrap" },
2406
+ children: [
2407
+ react_jsx_runtime.jsx("span", {
2408
+ className: "dshfs-priorityName",
2409
+ children: `${engine.label} (${engine.badge})`,
2410
+ }),
2411
+ renderKeyStatus(engineId),
2412
+ renderEngineKeyInput(engineId),
2413
+ renderEngineSettingsButton(engineId),
2414
+ expandedEngine === engineId ? renderEngineSettings(engineId) : null,
2415
+ ],
2416
+ }, engineId);
2417
+ }),
2418
+ }),
2419
+ ],
2420
+ }),
2536
2421
  react_jsx_runtime.jsx("div", {
2537
2422
  className: "dshfs-field",
2538
2423
  children: [
@@ -3291,6 +3176,26 @@ react_jsx_runtime.jsx("div", {
3291
3176
  // rc.1 废弃了旧版设置页的插件配置 slot,只保留 plugins.row.config;
3292
3177
  // key 规则见 ui-plugin-manager 的 rowConfigKey:<包名>#<patch 里声明的行 id>。
3293
3178
  // 配置读写走自建 bridge(按页面 base 解析 api/dsh-free-search-settings),不依赖 dsh-web-ui。
3179
+ ctx.slots.inject("sidebar.panellist", () =>
3180
+ ctx.slots.register(
3181
+ {
3182
+ name: "sidebar.panellist",
3183
+ id: "dsh-free-search",
3184
+ order: 30,
3185
+ label: () => panelLabel(),
3186
+ },
3187
+ FreeSearchPanelIcon
3188
+ )
3189
+ );
3190
+ ctx.slots.inject("main", () =>
3191
+ ctx.slots.register(
3192
+ {
3193
+ name: "main",
3194
+ key: "dsh-free-search",
3195
+ },
3196
+ FreeSearchPage
3197
+ )
3198
+ );
3294
3199
  ctx.slots.inject("plugins.row.config", () =>
3295
3200
  ctx.slots.register(
3296
3201
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.9.48",
3
+ "version": "0.9.49",
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",