dsh-free-search 0.4.23 → 0.4.24

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.
package/lib/client.js CHANGED
@@ -206,7 +206,7 @@ window.__ModuleLoader__.load({
206
206
  };
207
207
  const tt = (lang) => I18N[lang === "en" ? "en" : "zh"];
208
208
  // 当前插件版本(与 lib/index.js 的 PLUGIN_VERSION 保持一致)
209
- const PLUGIN_VERSION = "0.4.23";
209
+ const PLUGIN_VERSION = "0.4.24";
210
210
  const ENGINES = [
211
211
  { id: "ddg", label: "DuckDuckGo · HTML", badge: "FREE", link: "https://duckduckgo.com" },
212
212
  { id: "ddg-lite", label: "DuckDuckGo · Lite", badge: "FREE", link: "https://duckduckgo.com" },
package/lib/index.js CHANGED
@@ -48,7 +48,7 @@ const FREE_ENGINES = ["ddg", "ddg-lite", "bing", "searxng", "anysearch"];
48
48
  const ALL_ENGINES = ["ddg", "ddg-lite", "bing", "searxng", "anysearch", "exa", "tavily", "keenable", "perplexity", "deepseek-official"];
49
49
 
50
50
  // 当前插件版本(发布时与 package.json 同步)
51
- const PLUGIN_VERSION = "0.4.23";
51
+ const PLUGIN_VERSION = "0.4.24";
52
52
  // 检查更新的 npm registry 元数据地址(dsh-free-search 是 npmjs 上的公开包)
53
53
  const NPM_REGISTRY_URL = "https://registry.npmjs.org/dsh-free-search/latest";
54
54
  const PLUGIN_NPM_URL = "https://www.npmjs.com/package/dsh-free-search";
@@ -1677,15 +1677,37 @@ function apply(ctx, config) {
1677
1677
  };
1678
1678
 
1679
1679
  ctx.inject(["settings"], (sctx) => {
1680
- sctx.settings.installSection(ctx, FREE_SEARCH_NS, Config, config ?? {}, {
1681
- setSource: (source) => {
1682
- current = source;
1683
- },
1684
- onChange: () => {
1685
- // settings 变更时刷新系统提示词(显示最新引擎)
1686
- if (typeof refreshPrompt === "function") refreshPrompt();
1687
- },
1688
- });
1680
+ // alpha.2+(SettingsProvider 有 installSection 方法)与 rc.2(模块级 installSettingsSection)双兼容:
1681
+ // 特性检测优先用 alpha 方法;缺失时动态 import 旧 API 注册(rc.2 环境,不会触发 alpha 的缺失导出报错)。
1682
+ if (typeof sctx.settings.installSection === "function") {
1683
+ sctx.settings.installSection(ctx, FREE_SEARCH_NS, Config, config ?? {}, {
1684
+ setSource: (source) => {
1685
+ current = source;
1686
+ },
1687
+ onChange: () => {
1688
+ // settings 变更时刷新系统提示词(显示最新引擎)
1689
+ if (typeof refreshPrompt === "function") refreshPrompt();
1690
+ },
1691
+ });
1692
+ } else {
1693
+ void (async () => {
1694
+ const legacy = await import("@deepseek-ai/dsh-settings");
1695
+ if (typeof legacy.installSettingsSection === "function" && legacy.settingsNamespace) {
1696
+ const legacyNs = legacy.settingsNamespace(FREE_SEARCH_NS);
1697
+ legacy.installSettingsSection(ctx, legacyNs, Config, config ?? {}, {
1698
+ setSource: (source) => {
1699
+ current = source;
1700
+ },
1701
+ onChange: () => {
1702
+ if (typeof refreshPrompt === "function") refreshPrompt();
1703
+ },
1704
+ });
1705
+ } else {
1706
+ sctx.logger?.warn?.("free-search: dsh-settings 无可用注册 API(installSection/installSettingsSection 均缺失)");
1707
+ return;
1708
+ }
1709
+ })();
1710
+ }
1689
1711
  });
1690
1712
 
1691
1713
  ctx.inject(["webServer", "settings"], (sctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-search",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "description": "Free web search for DeepSeek Harness: 10 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable keyless) + time filtering + platform search + web_fetch, with web settings UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",