dsh-free-search 0.9.81 → 0.9.82
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 +40 -1
- package/lib/fetch_provider.js +30 -3
- package/lib/index.js +6 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -570,6 +570,9 @@ window.__ModuleLoader__.load({
|
|
|
570
570
|
fetchForceHint: "DSH 的「DeepSeek 搜索 API」开关会把 web.fetchProvider 写成 deepseek-fetch-api,即使关掉搜索开关,抓取也会一直走官方计费接口。勾选此项后,保存即把抓取改回 fs-quality-fetch,忽略上一项的判据。",
|
|
571
571
|
browserFetchLabel: "用本机浏览器渲染",
|
|
572
572
|
browserFetchHint: "直连失败时用系统 Chrome/Edge 无头加载页面,能过 JS 挑战;没有浏览器时自动跳过。",
|
|
573
|
+
browserPathLabel: "浏览器路径",
|
|
574
|
+
browserPathPlaceholder: "留空=自动探测(Edge / Chrome 的常见安装位置)",
|
|
575
|
+
browserPathHint: "填写后只用这一个可执行文件,不再自动探测;文件不存在时跳过这一层,不会改用其它浏览器。适用于便携版、Brave / Vivaldi 等非常规安装位置。Firefox 不支持 `--headless=new --dump-dom`,填了也不会生效。",
|
|
573
576
|
fakeIpCidrsLabel: "额外允许的网段(fake-ip 透明代理)",
|
|
574
577
|
fakeIpCidrsHint: "一行一个 CIDR。Clash/mihomo TUN 的 fake-ip 通常是 198.18.0.0/15;只豁免这里列出的保留段;回环、IPv4 私网、链路本地和云元数据仍会被拦截,IPv6 ULA(fc00::/7)只有显式列出时才放行。",
|
|
575
578
|
fetchPreferLabel: "抓取质量链顺序",
|
|
@@ -817,6 +820,9 @@ window.__ModuleLoader__.load({
|
|
|
817
820
|
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.",
|
|
818
821
|
browserFetchLabel: "Render with the local browser",
|
|
819
822
|
browserFetchHint: "When direct fetch fails, load the page in headless Chrome/Edge to pass JS challenges; skipped when no browser is installed.",
|
|
823
|
+
browserPathLabel: "Browser path",
|
|
824
|
+
browserPathPlaceholder: "Empty = auto-detect (the usual Edge / Chrome install locations)",
|
|
825
|
+
browserPathHint: "When set, only this executable is used and auto-detection stops; if the file is missing, T1.5 is skipped rather than run with another browser. Use it for portable builds or unusual locations such as Brave / Vivaldi. Firefox does not support `--headless=new --dump-dom`, so pointing at it has no effect.",
|
|
820
826
|
fakeIpCidrsLabel: "Extra allowed networks (fake-ip proxy)",
|
|
821
827
|
fakeIpCidrsHint: "One CIDR per line. Clash/mihomo TUN fake-ip commonly uses 198.18.0.0/15; only the ranges listed here are exempted. Loopback, RFC1918, link-local and cloud metadata stay blocked.",
|
|
822
828
|
fetchPreferLabel: "Fetch quality-chain order",
|
|
@@ -922,7 +928,7 @@ window.__ModuleLoader__.load({
|
|
|
922
928
|
"cache_search",
|
|
923
929
|
"domain_search",
|
|
924
930
|
];
|
|
925
|
-
const PLUGIN_VERSION = "0.9.
|
|
931
|
+
const PLUGIN_VERSION = "0.9.82";
|
|
926
932
|
const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
|
|
927
933
|
// 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
|
|
928
934
|
const NAV_ITEMS = [
|
|
@@ -1542,6 +1548,7 @@ window.__ModuleLoader__.load({
|
|
|
1542
1548
|
const [fetchProviderTakeover, setFetchProviderTakeover] = react.useState(true);
|
|
1543
1549
|
const [fetchProviderForce, setFetchProviderForce] = react.useState(false);
|
|
1544
1550
|
const [browserFetch, setBrowserFetch] = react.useState(true);
|
|
1551
|
+
const [browserPath, setBrowserPath] = react.useState("");
|
|
1545
1552
|
const [allowFakeIpCidrs, setAllowFakeIpCidrs] = react.useState("");
|
|
1546
1553
|
const [fetchPrefer, setFetchPrefer] = react.useState("exa");
|
|
1547
1554
|
const [deepseekFetchUrl, setDeepseekFetchUrl] = react.useState("");
|
|
@@ -1925,6 +1932,7 @@ window.__ModuleLoader__.load({
|
|
|
1925
1932
|
setFetchProviderTakeover(v.fetchProviderTakeover !== false);
|
|
1926
1933
|
setFetchProviderForce(v.fetchProviderForce === true);
|
|
1927
1934
|
setBrowserFetch(v.browserFetch !== false);
|
|
1935
|
+
setBrowserPath(String(v.browserPath ?? ""));
|
|
1928
1936
|
setAllowFakeIpCidrs((Array.isArray(v.allowFakeIpCidrs) ? v.allowFakeIpCidrs : []).join("\n"));
|
|
1929
1937
|
setFetchPrefer(v.fetchPrefer === "firecrawl" ? "firecrawl" : "exa");
|
|
1930
1938
|
setDeepseekFetchUrl(v.deepseekFetchBaseUrl ?? "");
|
|
@@ -2175,6 +2183,7 @@ window.__ModuleLoader__.load({
|
|
|
2175
2183
|
value: Number.isFinite(Number(snippetBudgetChars)) ? Math.max(0, Math.floor(Number(snippetBudgetChars))) : 0,
|
|
2176
2184
|
});
|
|
2177
2185
|
ops.push({ op: "set", path: ["browserFetch"], value: browserFetch });
|
|
2186
|
+
ops.push({ op: "set", path: ["browserPath"], value: String(browserPath ?? "").trim() });
|
|
2178
2187
|
ops.push({ op: "set", path: ["deepseekFetchBaseUrl"], value: deepseekFetchUrl.trim() });
|
|
2179
2188
|
ops.push({
|
|
2180
2189
|
op: "set",
|
|
@@ -3387,6 +3396,36 @@ react_jsx_runtime.jsxs("div", {
|
|
|
3387
3396
|
className: "dshfs-hint",
|
|
3388
3397
|
children: t.browserFetchHint,
|
|
3389
3398
|
}),
|
|
3399
|
+
// #160:浏览器路径只在启用 T1.5 时才有意义。
|
|
3400
|
+
browserFetch
|
|
3401
|
+
? react_jsx_runtime.jsxs("div", {
|
|
3402
|
+
className: "dshfs-field",
|
|
3403
|
+
children: [
|
|
3404
|
+
react_jsx_runtime.jsx("div", {
|
|
3405
|
+
className: "dshfs-label",
|
|
3406
|
+
children: t.browserPathLabel,
|
|
3407
|
+
}),
|
|
3408
|
+
react_jsx_runtime.jsx("input", {
|
|
3409
|
+
className: "dshfs-input",
|
|
3410
|
+
type: "text",
|
|
3411
|
+
placeholder: t.browserPathPlaceholder,
|
|
3412
|
+
value: browserPath,
|
|
3413
|
+
spellCheck: false,
|
|
3414
|
+
disabled: !ready || saving,
|
|
3415
|
+
onChange: (e) => {
|
|
3416
|
+
setBrowserPath(e.target.value);
|
|
3417
|
+
setDirty(true);
|
|
3418
|
+
setFailed(false);
|
|
3419
|
+
setSaveError("");
|
|
3420
|
+
},
|
|
3421
|
+
}),
|
|
3422
|
+
react_jsx_runtime.jsx("p", {
|
|
3423
|
+
className: "dshfs-hint",
|
|
3424
|
+
children: t.browserPathHint,
|
|
3425
|
+
}),
|
|
3426
|
+
],
|
|
3427
|
+
})
|
|
3428
|
+
: null,
|
|
3390
3429
|
],
|
|
3391
3430
|
}),
|
|
3392
3431
|
react_jsx_runtime.jsxs("div", {
|
package/lib/fetch_provider.js
CHANGED
|
@@ -37,10 +37,25 @@ const BROWSER_CANDIDATES = [
|
|
|
37
37
|
"/usr/bin/microsoft-edge",
|
|
38
38
|
"/usr/bin/microsoft-edge-stable",
|
|
39
39
|
];
|
|
40
|
+
// #160:自定义浏览器路径。空 = 自动探测候选表;填了就只认这一个,
|
|
41
|
+
// 找不到时**不回落**候选表 —— 用户以为自己指定了 A 却悄悄跑成 B,
|
|
42
|
+
// 比直接跳过这一层更难排查。
|
|
43
|
+
let cachedBrowserKey;
|
|
40
44
|
let cachedBrowserPath; // undefined = 未检测;null = 无浏览器
|
|
41
|
-
function findSystemBrowser() {
|
|
42
|
-
|
|
45
|
+
function findSystemBrowser(customPath = "") {
|
|
46
|
+
const custom = String(customPath ?? "").trim();
|
|
47
|
+
const cacheKey = custom;
|
|
48
|
+
if (cachedBrowserKey === cacheKey && cachedBrowserPath !== undefined) return cachedBrowserPath;
|
|
49
|
+
cachedBrowserKey = cacheKey;
|
|
43
50
|
cachedBrowserPath = null;
|
|
51
|
+
if (custom) {
|
|
52
|
+
try {
|
|
53
|
+
if (existsSync(custom)) cachedBrowserPath = custom;
|
|
54
|
+
} catch {
|
|
55
|
+
// 路径不可读:当作没有
|
|
56
|
+
}
|
|
57
|
+
return cachedBrowserPath;
|
|
58
|
+
}
|
|
44
59
|
for (const p of BROWSER_CANDIDATES) {
|
|
45
60
|
try {
|
|
46
61
|
if (existsSync(p)) {
|
|
@@ -54,6 +69,17 @@ function findSystemBrowser() {
|
|
|
54
69
|
return cachedBrowserPath;
|
|
55
70
|
}
|
|
56
71
|
|
|
72
|
+
/** 测试用:清掉探测缓存。 */
|
|
73
|
+
export function resetBrowserCache() {
|
|
74
|
+
cachedBrowserKey = undefined;
|
|
75
|
+
cachedBrowserPath = undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 测试用/诊断用:当前会选中的浏览器路径(未命中为 null)。 */
|
|
79
|
+
export function detectBrowser(customPath = "") {
|
|
80
|
+
return findSystemBrowser(customPath);
|
|
81
|
+
}
|
|
82
|
+
|
|
57
83
|
function browserDumpDom(browserPath, url, { timeoutMs = 25000, signal, proxy = "" } = {}) {
|
|
58
84
|
return new Promise((resolve) => {
|
|
59
85
|
// 独立 user-data-dir:避免与用户正在运行的浏览器实例抢同一 profile(共享 profile 时无输出/立即退出)
|
|
@@ -355,6 +381,7 @@ export function createFetchProvider({
|
|
|
355
381
|
logger,
|
|
356
382
|
acceptLanguage = () => "en-US,en;q=0.9",
|
|
357
383
|
browserEnabled = () => true,
|
|
384
|
+
browserPath: browserPathSetting = () => "",
|
|
358
385
|
prefer = () => "exa",
|
|
359
386
|
allowedCidrs = () => [],
|
|
360
387
|
validateUrl = assertPublicUrl,
|
|
@@ -417,7 +444,7 @@ export function createFetchProvider({
|
|
|
417
444
|
} catch (e) { errors.push(`direct: ${e.message}`); }
|
|
418
445
|
|
|
419
446
|
// T1.5:系统浏览器无头渲染(执行 JS 过挑战,抓直连拿不到的页面;无浏览器或设置里关掉时跳过)
|
|
420
|
-
const browserPath = findSystemBrowser();
|
|
447
|
+
const browserPath = findSystemBrowser(browserPathSetting());
|
|
421
448
|
if (browserEnabled() && browserPath) {
|
|
422
449
|
try {
|
|
423
450
|
const html = await browserDumpDom(browserPath, url, {
|
package/lib/index.js
CHANGED
|
@@ -1282,6 +1282,10 @@ const Config = z.object({
|
|
|
1282
1282
|
fetchProviderForce: z.boolean().default(false).volatile(),
|
|
1283
1283
|
// T1.5 headless browser rendering (default on, matching 0.9.x behaviour).
|
|
1284
1284
|
browserFetch: z.boolean().default(true).volatile(),
|
|
1285
|
+
// #160: custom browser executable. Empty = probe the built-in candidate list;
|
|
1286
|
+
// set = use exactly this path, and skip T1.5 entirely when it is missing
|
|
1287
|
+
// (falling back to another browser would hide a bad path).
|
|
1288
|
+
browserPath: z.string().default("").volatile(),
|
|
1285
1289
|
// Opt-in reserved ranges for transparent-proxy fake-ip DNS (Clash/mihomo
|
|
1286
1290
|
// commonly use 198.18.0.0/15). Loopback / RFC1918 / link-local stay blocked.
|
|
1287
1291
|
allowFakeIpCidrs: z.array(z.string()).default([]).volatile(),
|
|
@@ -2529,6 +2533,8 @@ function apply(ctx, config) {
|
|
|
2529
2533
|
// #92:web_fetch 栈与 searchOnce 分开结算,这里按当前请求结算,而不是复用上一次请求留下的值。
|
|
2530
2534
|
acceptLanguage: () => acceptLanguageFor(current()),
|
|
2531
2535
|
browserEnabled: () => current().browserFetch !== false,
|
|
2536
|
+
// #160:自定义浏览器路径(空 = 自动探测候选表)。
|
|
2537
|
+
browserPath: () => current().browserPath ?? "",
|
|
2532
2538
|
prefer: () => (current().fetchPrefer === "firecrawl" ? "firecrawl" : "exa"),
|
|
2533
2539
|
allowedCidrs: () => current().allowFakeIpCidrs ?? [],
|
|
2534
2540
|
// #124:自定义 DeepSeek 兼容抓取端点;key 留空时依次复用工具 key、搜索 key。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-free-search",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.82",
|
|
4
4
|
"description": "Free web search for DeepSeek Harness: 42 engines (Bing/DuckDuckGo/AnySearch/SearXNG/Exa/Tavily/Keenable/Firecrawl/Parallel/Brave/Zhipu/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/SpecStream 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",
|