dsh-free-search 0.9.78 → 0.9.80
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/README.md +7 -4
- package/lib/client.js +313 -119
- package/lib/mcp_server.js +52 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -642,7 +642,7 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
642
642
|
|
|
643
643
|
#### 离线自检断言(tools/)
|
|
644
644
|
|
|
645
|
-
仓库自带 **
|
|
645
|
+
仓库自带 **98 个**零依赖断言脚本(合计 **1249 项**)
|
|
646
646
|
|
|
647
647
|
| 脚本 | 覆盖 | 运行(项数) |
|
|
648
648
|
|---|---|---|
|
|
@@ -681,19 +681,22 @@ npx -y -p dsh-free-search dsh-free-search-mcp
|
|
|
681
681
|
| `assert-engine-settings-ids.mjs` | 设置按钮可达性(#153 回归):`ENGINE_SETTINGS_IDS` 必须包含所有写了 `renderEngineSettings` 分支的引擎,按钮仍由该列表控制 | `node tools/assert-engine-settings-ids.mjs`(3) |
|
|
682
682
|
| `assert-serper.mjs` | Serper.dev 引擎(#157):端点常量、`X-API-KEY` 鉴权(非 Bearer)、`num` 上限 100、`tbs` 时间语法(含绝对日期 `cd_min`)、`organic` 映射、401/403/429 错误分类、缺 key 快速失败、catalog 与 MCP/设置页接线 | `node tools/assert-serper.mjs`(10) |
|
|
683
683
|
| `assert-tavily-endpoint.mjs` | Tavily 兼容端点(#153):留空 = 官方地址、base 自动补 `/search`、query/hash 被剥离、非 http(s) 拒绝、key 只走 Authorization 头、401 点名端点、配置与设置页接线 | `node tools/assert-tavily-endpoint.mjs`(8) |
|
|
684
|
+
| `assert-hint-card.mjs` | 字段说明悬停卡:长说明不再占正文、卡片经 portal 挂到 body(否则被卡片 `overflow:clip` 裁掉)、Esc 关闭、聚焦打开/失焦关闭、悬停有延迟、触屏可点、卡片不越出视口、深浅色都覆盖、标签文字在图标按钮外(否则被压成一字一行)、点图标不连带切换复选框 | `node tools/assert-hint-card.mjs`(14) |
|
|
685
|
+
| `assert-control-chrome.mjs` | 字段标题与复选框外观:标题字号/字重要高于正文、复选框由样式绘制(`appearance:none` + CSS 勾)、不确定态有独立横线、聚焦有描边、深浅色都覆盖、分组自动换行、全选不拉满整行、工具行复选框不再固定 150px | `node tools/assert-control-chrome.mjs`(9) |
|
|
684
686
|
| `assert-checkbox-labels.mjs` | 复选框不再重复标签:左侧栏入口 / 斜杠命令 / 免 key 优先三项各只出现一次标签、标签位于复选框同一行、其它输入类字段仍保留独立标题 | `node tools/assert-checkbox-labels.mjs`(5) |
|
|
685
687
|
| `assert-dropdown.mjs` | 自绘下拉:设置页不再有原生 `<select>`、11 处全部走同一个组件、保留 `onChange({ target })` 契约与 listbox 语义、键盘(↑↓/Home/End/Enter/Esc/Tab)可用、浮层限高滚动、深浅色都有样式 | `node tools/assert-dropdown.mjs`(6) |
|
|
686
688
|
| `assert-engine-setting-fields.mjs` | 引擎设置字段签名:每个 `engineSettingField` 调用都按 `(id, label, value, setter, options)` 传参、没有把 label 当 id、Tavily 端点字段接线正确 | `node tools/assert-engine-setting-fields.mjs`(3) |
|
|
687
689
|
| `assert-fallback-row-layout.mjs` | 回退优先级行对齐:没有高级设置的引擎也渲染不可见占位按钮、占位不参与交互、设置按钮列固定宽度、key 输入框不再撑满剩余空间 | `node tools/assert-fallback-row-layout.mjs`(4) |
|
|
688
|
-
| `assert-settings-order.mjs` | 设置页顺序:提示词段在三个全局开关之前、开关彼此相邻且保持原顺序、提示词是最后一个带分区的段、右侧目录顺序与页面一致 | `node tools/assert-settings-order.mjs`(
|
|
690
|
+
| `assert-settings-order.mjs` | 设置页顺序:提示词段在三个全局开关之前、开关彼此相邻且保持原顺序、提示词是最后一个带分区的段、右侧目录顺序与页面一致 | `node tools/assert-settings-order.mjs`(5) |
|
|
689
691
|
| `assert-header-description.mjs` | 卡片标题区只显示插件名(去掉副标题那一行);摘要文案仍保留给插件列表行使用;废弃样式已清 | `node tools/assert-header-description.mjs`(4) |
|
|
692
|
+
| `assert-mobile-layout.mjs` | 移动端布局(≤560px):桌面 150px 分区留白由 `dshfs-page` 类承载而非内联样式、移动端只覆盖该类 padding、移动端块不含已删除的 `.dshfs-description` / `.dshfs-select` 规则、分区 Tab 在文档流内不依赖宿主头部高度 | `node tools/assert-mobile-layout.mjs`(8) |
|
|
690
693
|
| `assert-multikey-layout.mjs` | 多 key 输入的行高(#154 回归):输入框是裸 textarea 不带提示段落、格式说明只在 placeholder / title、双语提示仍完整、废弃样式已删 | `node tools/assert-multikey-layout.mjs`(4) |
|
|
691
694
|
| `assert-multikey-ui.mjs` | 多 key 输入(#154):后端支持换行/逗号/分号分隔、设置页为 textarea 而非单行密码框、提示写明格式与轮换顺序 | `node tools/assert-multikey-ui.mjs`(4) |
|
|
692
695
|
| `assert-pool-policy.mjs` | 按次计费引擎入池(#152):7 个引擎全覆盖、策略归一化(含大小写与非法值)、`off` 保持现状、`auto`/`multi` 放行、Auto 可把按次计费引擎排到首位、`off` 写进池也不生效、策略进入缓存键 | `node tools/assert-pool-policy.mjs`(9) |
|
|
693
696
|
| `assert-pool-prompt.mjs` | 入池策略与提示词一致(#152):`off` 保留「只在显式选择时运行」、`auto` 改写为「最多一个、计费一次」、`multi` 改写为「每个引擎各计费一次」、Multi 池只在 `multi` 档列出按次计费引擎、中文文案同步 | `node tools/assert-pool-prompt.mjs`(5) |
|
|
694
697
|
| `assert-fetch-ssrf-wiring.mjs` | #156 回归:`lib/index.js` 必须以 provider 自己的选项名 `allowedCidrs` 传白名单(写成 `allowFakeIpCidrs` 会被静默丢弃)、白名单能到达 `validateUrl`、错拼的键回退为空列表 | `node tools/assert-fetch-ssrf-wiring.mjs`(3) |
|
|
695
698
|
| `assert-rail-keys.mjs` | 侧栏目录的渲染 key:每项圆点与文字两个子元素都必须带稳定 key,避免 React 在每次渲染时报 unique key 警告 | `node tools/assert-rail-keys.mjs`(3) |
|
|
696
|
-
| `assert-mcp-response-cap.mjs` | #147 MCP stdio
|
|
699
|
+
| `assert-mcp-response-cap.mjs` | #147 MCP stdio 单条响应上限:字符/字节/整行三重上限默认值与环境覆盖、0 关闭、多字节文本不超 64KB 行、**JSON 转义后的整行不超 64KB**(引号/换行/反斜杠密集三种形状)、不重复叠加截断提示、不切在代理对中间、handler 对结果与错误统一截断、web_fetch 先按上限收缩、research 文档按剩余预算均分 | `node tools/assert-mcp-response-cap.mjs`(18) |
|
|
697
700
|
| `assert-fetch-ssrf.mjs` | 抓取 SSRF 防护:公网/私网/保留地址判定、DNS 解析到私网拒绝、localhost 与 IP 字面量拒绝、`http://` 与 `https://` 放行而其他协议与带凭据 URL 拒绝、http 目标解析到私网同样拒绝、fake-ip 网段默认拒绝且仅按配置放行、IPv6 ULA 显式放行、放行后仍拒绝回环/IPv4 私网/链路本地、provider 接线与设置项 | `node tools/assert-fetch-ssrf.mjs`(10) |
|
|
698
701
|
| `assert-fetch-http.mjs` | 明文 http 目标(#143):直连层按协议选 transport、http 重定向可跟随、provider 不再在入口拒绝 http 而交给 tier 链、全层失败报直连原因而不再报 only https、非 http(s) 协议仍拒、`agentForUrl` 为 http 目标选明文隧道 agent、经 `CONNECT` 隧道抓取 http 页面 | `node tools/assert-fetch-http.mjs`(7) |
|
|
699
702
|
| `assert-mcp.mjs` | MCP stdio 面:initialize 协议协商、tools/list 的 JSON Schema、tools/call 文本结果、工具错误与 JSON-RPC 错误区分、必填参数校验、显式付费引擎与新 provider、advanced/multi/domain/platform/video/research/weather 新工具、bin/files 打包 | `node tools/assert-mcp.mjs`(10) |
|
|
@@ -1412,7 +1415,7 @@ Restart `dsh web` after switching to apply changes.
|
|
|
1412
1415
|
|
|
1413
1416
|
#### Offline self-check assertions (`tools/`)
|
|
1414
1417
|
|
|
1415
|
-
**Ninety-
|
|
1418
|
+
**Ninety-eight** zero-dependency assertion scripts ship with the repo (**1249 assertions** total)
|
|
1416
1419
|
|
|
1417
1420
|
| Script | Covers | Run (count) |
|
|
1418
1421
|
|---|---|---|
|
package/lib/client.js
CHANGED
|
@@ -148,6 +148,7 @@ window.__ModuleLoader__.load({
|
|
|
148
148
|
const css = [
|
|
149
149
|
".dshfs-card{font-family:-apple-system, \"SF Pro Text\", \"PingFang SC\", \"Segoe UI\", system-ui, sans-serif;border:1px solid rgba(0,0,0,.06);background:rgba(255,255,255,.72);backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);border-radius:14px;min-width:0;list-style:none;transition:all 180ms cubic-bezier(.4,0,.2,1);overflow:hidden;overflow:clip;margin-bottom:12px;box-shadow:0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.06);color:#1d1d1f}",
|
|
150
150
|
"@media (prefers-color-scheme: dark){.dshfs-card{background:rgba(30,30,32,.7);border:1px solid rgba(255,255,255,.08);color:#f5f5f7;box-shadow:0 1px 2px rgba(0,0,0,.2), 0 10px 30px rgba(0,0,0,.3)}}",
|
|
151
|
+
".dshfs-page{height:100%;min-height:0;overflow-y:auto;box-sizing:border-box;padding:16px 150px 24px 24px}",
|
|
151
152
|
".dshfs-cardOpen{}",
|
|
152
153
|
".dshfs-header{width:100%;color:inherit;cursor:pointer;text-align:left;font:inherit;background:0 0;border:0;align-items:center;gap:12px;padding:16px 20px;display:flex;transition:background 180ms cubic-bezier(.4,0,.2,1)}",
|
|
153
154
|
".dshfs-header:hover:not(:disabled){background:rgba(0,0,0,.03)}",
|
|
@@ -165,6 +166,7 @@ window.__ModuleLoader__.load({
|
|
|
165
166
|
".dshfs-body{flex-direction:column;gap:20px;padding:0 20px 20px;display:flex;animation:dshfsFadeIn 240ms cubic-bezier(.4,0,.2,1) forwards}",
|
|
166
167
|
"@media (prefers-reduced-motion: reduce){.dshfs-body{animation:none}}",
|
|
167
168
|
".dshfs-rail{display:none;position:fixed;top:50%;transform:translateY(-50%);flex-direction:column;gap:2px;max-height:70vh;overflow:auto;z-index:5;padding:2px}",
|
|
169
|
+
".dshfs-mobileNav{display:none}",
|
|
168
170
|
".dshfs-railItem{display:flex;align-items:center;gap:6px;padding:3px 2px;border:0;background:none;font:inherit;font-size:12px;line-height:1.5;color:inherit;opacity:.42;text-align:left;cursor:pointer;transition:opacity 120ms;text-decoration:none}",
|
|
169
171
|
".dshfs-railItem:hover{opacity:.85}",
|
|
170
172
|
".dshfs-railItemActive{opacity:.95;font-weight:600}",
|
|
@@ -177,7 +179,7 @@ window.__ModuleLoader__.load({
|
|
|
177
179
|
".dshfs-footerRight{display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
|
|
178
180
|
".dshfs-star{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:6px;padding:8px 10px;border-radius:8px;border:1px solid rgba(0,0,0,.08);background:rgba(255,196,0,.06);color:inherit;text-decoration:none;font-size:12px;line-height:1.4}",
|
|
179
181
|
".dshfs-star:hover{background:rgba(255,196,0,.14)}",
|
|
180
|
-
".dshfs-check{display:inline-flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;user-select:none}",
|
|
182
|
+
".dshfs-check{display:inline-flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;user-select:none;padding:2px 0}",
|
|
181
183
|
".dshfs-starIcon{font-size:14px;line-height:1}",
|
|
182
184
|
".dshfs-starCta{margin-left:auto;color:#8a6d00;font-weight:600}",
|
|
183
185
|
"@media (prefers-color-scheme: dark){.dshfs-star{border-color:rgba(255,255,255,.12);background:rgba(255,196,0,.08)}.dshfs-starCta{color:#e8c15a}}",
|
|
@@ -186,13 +188,15 @@ window.__ModuleLoader__.load({
|
|
|
186
188
|
".dshfs-testOk{color:#34c759;font-size:13px;line-height:1.5}",
|
|
187
189
|
"@media (prefers-color-scheme: dark){.dshfs-testOk{color:#30d158}}",
|
|
188
190
|
".dshfs-resultRow{display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-width:0;margin-top:-4px}",
|
|
189
|
-
".dshfs-field{flex-direction:column;gap:
|
|
191
|
+
".dshfs-field{flex-direction:column;gap:10px;min-width:0;display:flex}",
|
|
190
192
|
|
|
191
|
-
|
|
193
|
+
// 字段标题要和正文拉开层级:原来 14px / 500 和控件里的文字几乎一样重,
|
|
194
|
+
// 读起来像一句说明而不是这块设置的标题。
|
|
195
|
+
".dshfs-label{color:inherit;font-size:15px;font-weight:600;letter-spacing:-.01em;line-height:1.25;display:flex;align-items:center;gap:8px}",
|
|
192
196
|
".dshfs-rowHead{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}",
|
|
193
197
|
".dshfs-segment{display:flex;flex-direction:column;gap:8px;min-width:0;padding:10px 12px;border:1px solid rgba(0,0,0,.08);border-radius:12px;background:rgba(0,0,0,.015)}",
|
|
194
|
-
".dshfs-toolRow{display:flex;align-items:center;gap:
|
|
195
|
-
".dshfs-toolRow .dshfs-platform{flex:none;width:
|
|
198
|
+
".dshfs-toolRow{display:flex;align-items:center;gap:8px;min-width:0}",
|
|
199
|
+
".dshfs-toolRow .dshfs-platform{flex:none;width:auto;min-width:118px}",
|
|
196
200
|
".dshfs-toolLine{flex:1;min-width:0;padding:5px 10px;border:1px solid rgba(0,0,0,.08);border-radius:8px;background:rgba(0,0,0,.02);font-size:12px;line-height:1.45;color:#6e6e73}",
|
|
197
201
|
"@media (prefers-color-scheme: dark){.dshfs-toolLine{border-color:rgba(255,255,255,.09);background:rgba(255,255,255,.03);color:#a1a1a6}}",
|
|
198
202
|
".dshfs-pagerBtn.is-active{background:rgba(0,113,227,.12);border-color:rgba(0,113,227,.35);color:#0071e3}",
|
|
@@ -204,15 +208,13 @@ window.__ModuleLoader__.load({
|
|
|
204
208
|
"@media (prefers-color-scheme: dark){.dshfs-pagerBtn{border-color:rgba(255,255,255,.12);background:rgba(255,255,255,.05)}.dshfs-pagerBtn:hover:not(:disabled){background:rgba(255,255,255,.09)}}",
|
|
205
209
|
".dshfs-pagerCount{color:#6e6e73;font-size:13px;font-variant-numeric:tabular-nums;min-width:44px;text-align:center}",
|
|
206
210
|
"@media (prefers-color-scheme: dark){.dshfs-pagerCount{color:#a1a1a6}}",
|
|
207
|
-
".dshfs-
|
|
208
|
-
"@media (prefers-color-scheme: dark){.dshfs-
|
|
209
|
-
".dshfs-
|
|
210
|
-
"@media (prefers-color-scheme: dark){.dshfs-
|
|
211
|
-
".dshfs-
|
|
212
|
-
"@media (prefers-color-scheme: dark){.dshfs-
|
|
213
|
-
".dshfs-
|
|
214
|
-
"@media (prefers-color-scheme: dark){.dshfs-select:focus-visible, .dshfs-input:focus-visible{border-color:#0a84ff;box-shadow:0 0 0 3px rgba(10,132,255,.25);background:#1c1c1e}}",
|
|
215
|
-
".dshfs-input:disabled, .dshfs-select:disabled{opacity:.5;cursor:default}",
|
|
211
|
+
".dshfs-input{border:1px solid rgba(0,0,0,.1);font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:rgba(0,0,0,.03);border-radius:10px;padding:0 12px;height:38px;font-size:14px;transition:all 160ms cubic-bezier(.4,0,.2,1);width:100%;box-sizing:border-box}",
|
|
212
|
+
"@media (prefers-color-scheme: dark){.dshfs-input{border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.05)}}",
|
|
213
|
+
".dshfs-input:hover:not(:disabled){border-color:rgba(0,0,0,.2);background:rgba(0,0,0,.05)}",
|
|
214
|
+
"@media (prefers-color-scheme: dark){.dshfs-input:hover:not(:disabled){border-color:rgba(255,255,255,.2);background:rgba(255,255,255,.08)}}",
|
|
215
|
+
".dshfs-input:focus-visible{outline:none;border-color:#0071e3;box-shadow:0 0 0 3px rgba(0,113,227,.25);background:#ffffff}",
|
|
216
|
+
"@media (prefers-color-scheme: dark){.dshfs-input:focus-visible{border-color:#0a84ff;box-shadow:0 0 0 3px rgba(10,132,255,.25);background:#1c1c1e}}",
|
|
217
|
+
".dshfs-input:disabled{opacity:.5;cursor:default}",
|
|
216
218
|
/* 自绘下拉:按钮 + 浮层,替代原生 select 的系统弹层 */
|
|
217
219
|
".dshfs-dd{position:relative;width:100%;min-width:0}",
|
|
218
220
|
".dshfs-ddButton{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;height:38px;padding:0 12px;font:inherit;font-size:14px;color:inherit;text-align:left;cursor:pointer;border:1px solid rgba(0,0,0,.1);border-radius:10px;background:rgba(0,0,0,.03);transition:all 160ms cubic-bezier(.4,0,.2,1)}",
|
|
@@ -228,9 +230,6 @@ window.__ModuleLoader__.load({
|
|
|
228
230
|
".dshfs-ddOptionCurrent{font-weight:600}",
|
|
229
231
|
".dshfs-ddOption:disabled{opacity:.42;cursor:default}",
|
|
230
232
|
"@media (prefers-color-scheme: dark){.dshfs-ddButton{border-color:rgba(255,255,255,.1);background:rgba(255,255,255,.05)}.dshfs-ddButton:hover:not(:disabled){border-color:rgba(255,255,255,.2);background:rgba(255,255,255,.08)}.dshfs-ddButton:focus-visible,.dshfs-ddOpen>.dshfs-ddButton{border-color:#0a84ff;box-shadow:0 0 0 3px rgba(10,132,255,.25);background:#1c1c1e}.dshfs-ddArrow{border-top-color:#a1a1a6}.dshfs-ddPanel{border-color:rgba(255,255,255,.12);background:#1e1f24;box-shadow:0 12px 32px rgba(0,0,0,.5)}.dshfs-ddOption{color:#f5f5f7}.dshfs-ddOptionActive{background:rgba(10,132,255,.22)}}",
|
|
231
|
-
".dshfs-select{color-scheme:light dark}",
|
|
232
|
-
".dshfs-select option, .dshfs-select optgroup{background-color:#ffffff;color:#1d1d1f}",
|
|
233
|
-
"@media (prefers-color-scheme: dark){.dshfs-select{color-scheme:dark}.dshfs-select option, .dshfs-select optgroup{background-color:#1e1f24;color:#f5f5f7}}",
|
|
234
233
|
".dshfs-textarea{border:1px solid rgba(0,0,0,.1);font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:rgba(0,0,0,.03);border-radius:10px;padding:8px 12px;min-height:96px;height:auto;font-size:14px;line-height:1.5;transition:all 160ms cubic-bezier(.4,0,.2,1);width:100%;box-sizing:border-box;resize:vertical;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,\"Liberation Mono\",monospace}",
|
|
235
234
|
"@media (prefers-color-scheme: dark){.dshfs-textarea{border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.05)}}",
|
|
236
235
|
".dshfs-textarea:hover:not(:disabled){border-color:rgba(0,0,0,.2);background:rgba(0,0,0,.05)}",
|
|
@@ -240,16 +239,39 @@ window.__ModuleLoader__.load({
|
|
|
240
239
|
".dshfs-textarea:disabled{opacity:.5;cursor:default}",
|
|
241
240
|
".dshfs-ttl{width:100px}",
|
|
242
241
|
".dshfs-fieldRow{display:flex;align-items:center;gap:12px;flex-wrap:wrap}",
|
|
243
|
-
".dshfs-keyStorage{width:auto;min-width:200px}",
|
|
244
242
|
".dshfs-hint{color:#6e6e73;margin:0;font-size:13px;line-height:1.4}",
|
|
243
|
+
// 悬停卡片触发器:贴在标题末尾的 ⓘ 小按钮,不占行高。
|
|
244
|
+
".dshfs-hintHost{display:inline-flex;align-items:center;gap:6px;min-width:0;vertical-align:middle}",
|
|
245
|
+
".dshfs-hintText{min-width:0}",
|
|
246
|
+
".dshfs-hintBtn{display:inline-flex;align-items:center;justify-content:center;flex:none;width:15px;height:15px;padding:0;font:inherit;color:#8e8e93;cursor:help;border:1px solid rgba(0,0,0,.2);border-radius:50%;background:transparent;transition:color 140ms,border-color 140ms,background 140ms}",
|
|
247
|
+
".dshfs-hintIcon{display:inline-flex;align-items:center;justify-content:center;line-height:0}",
|
|
248
|
+
".dshfs-hintBtn:hover{color:#0071e3;border-color:rgba(0,113,227,.5);background:rgba(0,113,227,.08)}",
|
|
249
|
+
".dshfs-hintBtn:focus-visible{outline:none;color:#0071e3;border-color:#0071e3;box-shadow:0 0 0 3px rgba(0,113,227,.25)}",
|
|
250
|
+
".dshfs-hintPanel{position:fixed;z-index:90;width:max-content;max-width:320px;padding:10px 12px;font:inherit;font-size:12px;line-height:1.6;color:#1d1d1f;text-align:left;white-space:pre-wrap;overflow-wrap:break-word;border:1px solid rgba(0,0,0,.1);border-radius:10px;background:#ffffff;box-shadow:0 10px 30px rgba(0,0,0,.16);animation:dshfsHintIn 120ms cubic-bezier(.4,0,.2,1) forwards}",
|
|
251
|
+
"@keyframes dshfsHintIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}",
|
|
252
|
+
"@media (prefers-color-scheme: dark){.dshfs-hintBtn{color:#a1a1a6;border-color:rgba(255,255,255,.22)}.dshfs-hintBtn:hover{color:#0a84ff;border-color:rgba(10,132,255,.55);background:rgba(10,132,255,.12)}.dshfs-hintPanel{color:#f5f5f7;border-color:rgba(255,255,255,.12);background:#1e1f24;box-shadow:0 10px 30px rgba(0,0,0,.5)}}",
|
|
253
|
+
"@media (prefers-reduced-motion: reduce){.dshfs-hintPanel{animation:none}}",
|
|
245
254
|
".dshfs-warn{color:#b25000}",
|
|
246
255
|
"@media (prefers-color-scheme: dark){.dshfs-warn{color:#ffb340}}",
|
|
247
256
|
"@media (prefers-color-scheme: dark){.dshfs-hint{color:#a1a1a6}}",
|
|
248
|
-
".dshfs-platforms{display:flex;gap:
|
|
257
|
+
".dshfs-platforms{display:flex;gap:8px;flex-wrap:wrap;align-items:center}",
|
|
258
|
+
// 三个全局开关同处一行;窄屏自动折行。
|
|
259
|
+
".dshfs-toggles{display:flex;gap:8px;flex-wrap:wrap;align-items:center}",
|
|
249
260
|
".dshfs-fallbackAdd{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
".dshfs-platform
|
|
261
|
+
// 复选框做成可点的胶囊:原生 checkbox 的方块+系统蓝勾在不同平台差异很大,
|
|
262
|
+
// 一排 6-40 个排在一起显得杂。这里统一成 16px 圆角小方块+胶囊容器。
|
|
263
|
+
".dshfs-platform{display:inline-flex;align-items:center;gap:7px;color:inherit;font-size:13px;line-height:1;cursor:pointer;padding:6px 11px 6px 9px;border:1px solid rgba(0,0,0,.09);border-radius:999px;background:rgba(0,0,0,.02);transition:background 140ms,border-color 140ms}",
|
|
264
|
+
".dshfs-platform:hover{background:rgba(0,0,0,.05);border-color:rgba(0,0,0,.16)}",
|
|
265
|
+
".dshfs-platform input,.dshfs-check input{-webkit-appearance:none;appearance:none;flex:none;width:16px;height:16px;margin:0;border-radius:5px;border:1.5px solid rgba(0,0,0,.24);background:#fff;cursor:pointer;position:relative;transition:background 140ms,border-color 140ms}",
|
|
266
|
+
".dshfs-platform input:hover,.dshfs-check input:hover{border-color:rgba(0,0,0,.42)}",
|
|
267
|
+
".dshfs-platform input:checked,.dshfs-check input:checked{background:#0071e3;border-color:#0071e3}",
|
|
268
|
+
".dshfs-platform input:checked::after,.dshfs-check input:checked::after{content:'';position:absolute;left:4.5px;top:1px;width:4.5px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}",
|
|
269
|
+
".dshfs-platform input:indeterminate,.dshfs-check input:indeterminate{background:#0071e3;border-color:#0071e3}",
|
|
270
|
+
".dshfs-platform input:indeterminate::after,.dshfs-check input:indeterminate::after{content:'';position:absolute;left:4px;top:6px;width:8px;height:2px;border-radius:1px;background:#fff}",
|
|
271
|
+
".dshfs-platform input:disabled,.dshfs-check input:disabled{opacity:.45;cursor:default}",
|
|
272
|
+
".dshfs-platform input:focus-visible,.dshfs-check input:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(0,113,227,.3)}",
|
|
273
|
+
// 「全选」在同一列里要贴左,不要被 flex column 拉满整行。
|
|
274
|
+
".dshfs-selectAll{align-self:flex-start}",
|
|
253
275
|
".dshfs-priorityList{display:flex;flex-direction:column;gap:6px}",
|
|
254
276
|
".dshfs-priorityRow{display:flex;align-items:center;gap:8px;padding:6px 8px;border:1px solid rgba(0,0,0,.08);border-radius:10px;background:rgba(0,0,0,.02);box-sizing:border-box;min-height:42px}",
|
|
255
277
|
"@media (prefers-color-scheme: dark){.dshfs-priorityRow{border-color:rgba(255,255,255,.09);background:rgba(255,255,255,.035)}}",
|
|
@@ -279,7 +301,7 @@ window.__ModuleLoader__.load({
|
|
|
279
301
|
"@media (prefers-color-scheme: dark){.dshfs-presetBtn{border-color:rgba(255,255,255,.22)}.dshfs-presetBtn.is-active{background:rgba(255,255,255,.16);border-color:rgba(255,255,255,.35)}}",
|
|
280
302
|
".dshfs-priorityRow[draggable='true']{cursor:grab}",
|
|
281
303
|
".dshfs-priorityRowDragging{opacity:.45;border-style:dashed}",
|
|
282
|
-
"@media (prefers-color-scheme: dark){.dshfs-platform input{
|
|
304
|
+
"@media (prefers-color-scheme: dark){.dshfs-platform{border-color:rgba(255,255,255,.12);background:rgba(255,255,255,.04)}.dshfs-platform:hover{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.2)}.dshfs-platform input,.dshfs-check input{border-color:rgba(255,255,255,.28);background:rgba(255,255,255,.08)}.dshfs-platform input:hover,.dshfs-check input:hover{border-color:rgba(255,255,255,.45)}.dshfs-platform input:checked,.dshfs-check input:checked,.dshfs-platform input:indeterminate,.dshfs-check input:indeterminate{background:#0a84ff;border-color:#0a84ff}}",
|
|
283
305
|
".dshfs-link{color:#0071e3;font-size:13px;text-decoration:none;align-self:flex-start;padding:2px 0;font-weight:500}",
|
|
284
306
|
".dshfs-link:hover{text-decoration:underline}",
|
|
285
307
|
"@media (prefers-color-scheme: dark){.dshfs-link{color:#0a84ff}}",
|
|
@@ -320,7 +342,53 @@ window.__ModuleLoader__.load({
|
|
|
320
342
|
".dshfs-updatePill:disabled{opacity:.5;cursor:default}",
|
|
321
343
|
".dshfs-updateIcon{flex:none;display:block}",
|
|
322
344
|
".dshfs-version{color:#6e6e73;font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}",
|
|
323
|
-
"@media (prefers-color-scheme: dark){.dshfs-version{color:#a1a1a6}}"
|
|
345
|
+
"@media (prefers-color-scheme: dark){.dshfs-version{color:#a1a1a6}}",
|
|
346
|
+
// Mobile layout (<=560px). The desktop page wrapper owns the 150px section-rail gutter;
|
|
347
|
+
// on a phone that leaves the card only ~220px wide. The mobile tab bar lives in the card
|
|
348
|
+
// body (document flow, no fixed host-header offset), and rows that cannot fit side by side
|
|
349
|
+
// stack instead of squeezing labels into one-character columns.
|
|
350
|
+
"@media (max-width: 560px){",
|
|
351
|
+
".dshfs-page{padding:16px 12px calc(16px + env(safe-area-inset-bottom))}",
|
|
352
|
+
".dshfs-card{border-radius:12px;margin-bottom:10px}",
|
|
353
|
+
".dshfs-header{padding:14px 16px;gap:10px}",
|
|
354
|
+
".dshfs-name{font-size:16px}",
|
|
355
|
+
".dshfs-body{padding:0 16px 16px;gap:16px}",
|
|
356
|
+
".dshfs-mobileNav{display:flex;align-items:center;gap:6px;margin:0 -16px 2px;padding:8px 16px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;background:rgba(255,255,255,.92);border-bottom:1px solid rgba(0,0,0,.08)}",
|
|
357
|
+
".dshfs-mobileNavItem{flex:none;white-space:nowrap;padding:6px 10px;border-radius:999px;border:1px solid rgba(0,0,0,.06);background:rgba(0,0,0,.04);color:inherit;font-size:12px;line-height:1.2;text-decoration:none;opacity:.62}",
|
|
358
|
+
".dshfs-mobileNavItemActive{opacity:1;font-weight:600;color:#0071e3;background:rgba(0,113,227,.12);border-color:rgba(0,113,227,.28)}",
|
|
359
|
+
".dshfs-segment{padding:10px;border-radius:10px}",
|
|
360
|
+
".dshfs-rowHead{flex-wrap:wrap;align-items:flex-start;gap:8px}",
|
|
361
|
+
".dshfs-rowHead>.dshfs-label{flex:1 1 100%;min-width:0}",
|
|
362
|
+
".dshfs-pager{flex-wrap:wrap;gap:6px}",
|
|
363
|
+
".dshfs-pagerBtn{min-width:32px;height:32px;padding:0 8px;font-size:14px}",
|
|
364
|
+
".dshfs-pagerCount{min-width:52px}",
|
|
365
|
+
".dshfs-toolRow{flex-wrap:wrap}",
|
|
366
|
+
".dshfs-toolRow .dshfs-platform{flex:1 1 100%;width:100%}",
|
|
367
|
+
".dshfs-toolLine{flex:1 1 100%;font-size:12px}",
|
|
368
|
+
".dshfs-fieldRow{align-items:stretch}",
|
|
369
|
+
".dshfs-ttl{width:100%}",
|
|
370
|
+
".dshfs-priorityRow{flex-wrap:wrap;padding:8px}",
|
|
371
|
+
".dshfs-priorityName{flex:1 1 auto;min-width:0;white-space:normal;overflow:visible;text-overflow:clip;line-height:1.35}",
|
|
372
|
+
".dshfs-priorityKey{flex:1 1 100%;max-width:none;width:100%;height:auto;min-height:34px;padding:4px 8px;line-height:1.35}",
|
|
373
|
+
".dshfs-priorityActions{margin-left:auto}",
|
|
374
|
+
".dshfs-engineSettingsBtn{width:auto;min-width:56px}",
|
|
375
|
+
".dshfs-textarea{min-height:120px}",
|
|
376
|
+
".dshfs-doctor{max-width:100%;overflow:auto;white-space:pre-wrap;word-break:break-word;font-size:11px}",
|
|
377
|
+
".dshfs-star{align-items:flex-start}",
|
|
378
|
+
".dshfs-starCta{margin-left:0;flex-basis:100%;text-align:right}",
|
|
379
|
+
".dshfs-footer{flex-direction:column;align-items:stretch;gap:8px;margin:4px -16px -16px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:rgba(250,250,252,.97)}",
|
|
380
|
+
".dshfs-footerLeft{width:100%;gap:8px;flex-wrap:nowrap;overflow-x:auto}",
|
|
381
|
+
".dshfs-footerRight{display:flex;flex-wrap:nowrap;width:100%;gap:6px;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}",
|
|
382
|
+
".dshfs-footerRight .dshfs-btn{flex:0 0 auto;width:auto;min-width:64px;padding:0 12px;height:36px;font-size:13px}",
|
|
383
|
+
".dshfs-footerRight .dshfs-save,.dshfs-footerRight .dshfs-discard{order:-1}",
|
|
384
|
+
".dshfs-footerRight .dshfs-save{min-width:88px}",
|
|
385
|
+
"}",
|
|
386
|
+
"@media (max-width: 560px) and (prefers-color-scheme: dark){",
|
|
387
|
+
".dshfs-footer{background:rgba(30,30,32,.97)}",
|
|
388
|
+
".dshfs-mobileNav{background:rgba(30,30,32,.94);border-bottom-color:rgba(255,255,255,.1)}",
|
|
389
|
+
".dshfs-mobileNavItem{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.1)}",
|
|
390
|
+
".dshfs-mobileNavItemActive{color:#0a84ff;background:rgba(10,132,255,.18);border-color:rgba(10,132,255,.35)}",
|
|
391
|
+
"}"
|
|
324
392
|
].join("");
|
|
325
393
|
const tagId = "dsh-free-search/card.css";
|
|
326
394
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
@@ -854,7 +922,7 @@ window.__ModuleLoader__.load({
|
|
|
854
922
|
"cache_search",
|
|
855
923
|
"domain_search",
|
|
856
924
|
];
|
|
857
|
-
const PLUGIN_VERSION = "0.9.
|
|
925
|
+
const PLUGIN_VERSION = "0.9.80";
|
|
858
926
|
const PLUGIN_REPO_URL = "https://github.com/DDDMUC/dsh-free-search";
|
|
859
927
|
// 右侧浮动目录(#85):条目顺序即页面顺序,anchor 是页面里对应 field 的 id。
|
|
860
928
|
const NAV_ITEMS = [
|
|
@@ -1156,7 +1224,7 @@ window.__ModuleLoader__.load({
|
|
|
1156
1224
|
|
|
1157
1225
|
function FreeSearchPage() {
|
|
1158
1226
|
return react_jsx_runtime.jsx("div", {
|
|
1159
|
-
|
|
1227
|
+
className: "dshfs-page",
|
|
1160
1228
|
children: react_jsx_runtime.jsx(FreeSearchCard, { page: true }),
|
|
1161
1229
|
});
|
|
1162
1230
|
}
|
|
@@ -1288,32 +1356,162 @@ window.__ModuleLoader__.load({
|
|
|
1288
1356
|
});
|
|
1289
1357
|
}
|
|
1290
1358
|
|
|
1359
|
+
// 字段说明动辄两三行,会把设置页撑得很高。这里把它收进一张悬停卡片:
|
|
1360
|
+
// 鼠标停在标题上、或键盘聚焦到 ⓘ 时弹出,离开 / 失焦 / Esc 关闭。
|
|
1361
|
+
// 卡片必须 portal 到 body —— .dshfs-card 上有 overflow:clip,留在卡片内会被裁掉。
|
|
1362
|
+
let hintCardSeq = 0;
|
|
1363
|
+
function HintCard({ text, children }) {
|
|
1364
|
+
const id = react.useMemo(() => "dshfs-hintcard-" + (hintCardSeq += 1), []);
|
|
1365
|
+
const [open, setOpen] = react.useState(false);
|
|
1366
|
+
const [pos, setPos] = react.useState(null);
|
|
1367
|
+
const hostRef = react.useRef(null);
|
|
1368
|
+
const panelRef = react.useRef(null);
|
|
1369
|
+
const openTimer = react.useRef(null);
|
|
1370
|
+
const closeTimer = react.useRef(null);
|
|
1371
|
+
const lastPointer = react.useRef("mouse");
|
|
1372
|
+
|
|
1373
|
+
const clear = (timer) => {
|
|
1374
|
+
if (timer.current !== null) {
|
|
1375
|
+
clearTimeout(timer.current);
|
|
1376
|
+
timer.current = null;
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
const openNow = () => {
|
|
1380
|
+
clear(closeTimer);
|
|
1381
|
+
clear(openTimer);
|
|
1382
|
+
setOpen(true);
|
|
1383
|
+
};
|
|
1384
|
+
const scheduleOpen = () => {
|
|
1385
|
+
clear(closeTimer);
|
|
1386
|
+
if (open) return;
|
|
1387
|
+
clear(openTimer);
|
|
1388
|
+
openTimer.current = setTimeout(() => {
|
|
1389
|
+
openTimer.current = null;
|
|
1390
|
+
setOpen(true);
|
|
1391
|
+
}, 150);
|
|
1392
|
+
};
|
|
1393
|
+
const scheduleClose = () => {
|
|
1394
|
+
clear(openTimer);
|
|
1395
|
+
clear(closeTimer);
|
|
1396
|
+
closeTimer.current = setTimeout(() => {
|
|
1397
|
+
closeTimer.current = null;
|
|
1398
|
+
setOpen(false);
|
|
1399
|
+
}, 120);
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1402
|
+
react.useEffect(() => () => {
|
|
1403
|
+
clear(openTimer);
|
|
1404
|
+
clear(closeTimer);
|
|
1405
|
+
}, []);
|
|
1406
|
+
|
|
1407
|
+
// 打开后把卡片摆到触发器下方;下方放不下就翻到上方,并且不越出视口。
|
|
1408
|
+
react.useLayoutEffect(() => {
|
|
1409
|
+
if (!open) {
|
|
1410
|
+
setPos(null);
|
|
1411
|
+
return undefined;
|
|
1412
|
+
}
|
|
1413
|
+
const place = () => {
|
|
1414
|
+
const host = hostRef.current;
|
|
1415
|
+
if (!host) return;
|
|
1416
|
+
const rect = host.getBoundingClientRect();
|
|
1417
|
+
const panel = panelRef.current;
|
|
1418
|
+
const width = panel ? panel.getBoundingClientRect().width : 300;
|
|
1419
|
+
const height = panel ? panel.getBoundingClientRect().height : 0;
|
|
1420
|
+
const margin = 10;
|
|
1421
|
+
let left = rect.left;
|
|
1422
|
+
if (left + width > window.innerWidth - margin) left = window.innerWidth - width - margin;
|
|
1423
|
+
if (left < margin) left = margin;
|
|
1424
|
+
let top = rect.bottom + 6;
|
|
1425
|
+
if (height > 0 && top + height > window.innerHeight - margin) top = rect.top - height - 6;
|
|
1426
|
+
if (top < margin) top = margin;
|
|
1427
|
+
setPos({ left: Math.round(left), top: Math.round(top) });
|
|
1428
|
+
};
|
|
1429
|
+
place();
|
|
1430
|
+
window.addEventListener("resize", place);
|
|
1431
|
+
window.addEventListener("scroll", place, true);
|
|
1432
|
+
return () => {
|
|
1433
|
+
window.removeEventListener("resize", place);
|
|
1434
|
+
window.removeEventListener("scroll", place, true);
|
|
1435
|
+
};
|
|
1436
|
+
}, [open]);
|
|
1437
|
+
|
|
1438
|
+
react.useEffect(() => {
|
|
1439
|
+
if (!open) return undefined;
|
|
1440
|
+
const onKeyDown = (event) => {
|
|
1441
|
+
if (event.key === "Escape") setOpen(false);
|
|
1442
|
+
};
|
|
1443
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
1444
|
+
return () => document.removeEventListener("keydown", onKeyDown, true);
|
|
1445
|
+
}, [open]);
|
|
1446
|
+
|
|
1447
|
+
// 文字和按钮必须是兄弟节点:按钮只有 15px 宽(只放图标),
|
|
1448
|
+
// 把标签文字塞进按钮里会被压成一字一行。
|
|
1449
|
+
const trigger = react_jsx_runtime.jsx("button", {
|
|
1450
|
+
type: "button",
|
|
1451
|
+
className: "dshfs-hintBtn",
|
|
1452
|
+
"aria-describedby": open ? id : undefined,
|
|
1453
|
+
"aria-expanded": open,
|
|
1454
|
+
onPointerDown: (event) => {
|
|
1455
|
+
lastPointer.current = event.pointerType || "mouse";
|
|
1456
|
+
},
|
|
1457
|
+
// 这个按钮常常嵌在 <label> 里(复选框行),不阻止默认行为就会连带切换复选框。
|
|
1458
|
+
onClick: (event) => {
|
|
1459
|
+
event.preventDefault();
|
|
1460
|
+
event.stopPropagation();
|
|
1461
|
+
if (lastPointer.current === "touch" || event.detail === 0) setOpen((value) => !value);
|
|
1462
|
+
},
|
|
1463
|
+
onFocus: openNow,
|
|
1464
|
+
onBlur: scheduleClose,
|
|
1465
|
+
children: react_jsx_runtime.jsx("span", {
|
|
1466
|
+
className: "dshfs-hintIcon",
|
|
1467
|
+
"aria-hidden": "true",
|
|
1468
|
+
children: react_jsx_runtime.jsxs("svg", {
|
|
1469
|
+
viewBox: "0 0 10 10",
|
|
1470
|
+
width: 10,
|
|
1471
|
+
height: 10,
|
|
1472
|
+
children: [
|
|
1473
|
+
react_jsx_runtime.jsx("circle", { cx: 5, cy: 2.4, r: 1.05, fill: "currentColor" }),
|
|
1474
|
+
react_jsx_runtime.jsx("rect", { x: 4.05, y: 4.2, width: 1.9, height: 4.3, rx: 0.95, fill: "currentColor" }),
|
|
1475
|
+
],
|
|
1476
|
+
}),
|
|
1477
|
+
}),
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
return react_jsx_runtime.jsxs("span", {
|
|
1481
|
+
className: "dshfs-hintHost",
|
|
1482
|
+
ref: hostRef,
|
|
1483
|
+
onPointerEnter: (event) => {
|
|
1484
|
+
if (event.pointerType === "mouse") scheduleOpen();
|
|
1485
|
+
},
|
|
1486
|
+
onPointerLeave: (event) => {
|
|
1487
|
+
if (event.pointerType === "mouse") scheduleClose();
|
|
1488
|
+
},
|
|
1489
|
+
children: [
|
|
1490
|
+
children ? react_jsx_runtime.jsx("span", { className: "dshfs-hintText", children }) : null,
|
|
1491
|
+
trigger,
|
|
1492
|
+
open && typeof document !== "undefined"
|
|
1493
|
+
? react_dom.createPortal(
|
|
1494
|
+
react_jsx_runtime.jsx("div", {
|
|
1495
|
+
className: "dshfs-hintPanel",
|
|
1496
|
+
id,
|
|
1497
|
+
role: "tooltip",
|
|
1498
|
+
ref: panelRef,
|
|
1499
|
+
style: pos ? { left: pos.left + "px", top: pos.top + "px" } : { visibility: "hidden" },
|
|
1500
|
+
children: text,
|
|
1501
|
+
}),
|
|
1502
|
+
document.body
|
|
1503
|
+
)
|
|
1504
|
+
: null,
|
|
1505
|
+
],
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1291
1509
|
function FreeSearchSummary() {
|
|
1292
1510
|
const active = react.useSyncExternalStore(subscribeUiLocale, getUiLocale, getUiLocale);
|
|
1293
1511
|
return tt(active).description;
|
|
1294
1512
|
}
|
|
1295
1513
|
|
|
1296
1514
|
function FreeSearchCard(props) {
|
|
1297
|
-
// 检测应用主题深浅(读 body 的 --dsw-alias-bg-base 变量亮度),用于锁定原生下拉配色
|
|
1298
|
-
const isDarkScheme = react.useMemo(() => {
|
|
1299
|
-
try {
|
|
1300
|
-
const root = document.body || document.documentElement;
|
|
1301
|
-
const bg = getComputedStyle(root).getPropertyValue("--dsw-alias-bg-base").trim();
|
|
1302
|
-
const m = bg.match(/(\d+)\s*[, ]\s*(\d+)\s*[, ]\s*(\d+)/);
|
|
1303
|
-
if (m) {
|
|
1304
|
-
const l = 0.299 * Number(m[1]) + 0.587 * Number(m[2]) + 0.114 * Number(m[3]);
|
|
1305
|
-
return l < 128;
|
|
1306
|
-
}
|
|
1307
|
-
if (/^#([0-9a-f]{3,8})/i.test(bg)) {
|
|
1308
|
-
const hex = bg.slice(1);
|
|
1309
|
-
const h = hex.length <= 4 ? hex.replace(/./g, (c) => c + c) : hex;
|
|
1310
|
-
const r = parseInt(h.slice(0, 2), 16), g = parseInt(h.slice(2, 4), 16), b = parseInt(h.slice(4, 6), 16);
|
|
1311
|
-
return 0.299 * r + 0.587 * g + 0.114 * b < 128;
|
|
1312
|
-
}
|
|
1313
|
-
} catch {}
|
|
1314
|
-
return typeof matchMedia === "function" ? matchMedia("(prefers-color-scheme: dark)").matches : false;
|
|
1315
|
-
}, []);
|
|
1316
|
-
const selectColorScheme = isDarkScheme ? "dark" : "light";
|
|
1317
1515
|
// 插件页(0.1.6-alpha.2+ 的 plugins.row.config)以 page 模式复用本卡片:
|
|
1318
1516
|
// 页面自带标题/面包屑,卡片固定展开、表头不再可折叠。
|
|
1319
1517
|
const pageMode = !!(props && props.page);
|
|
@@ -2594,6 +2792,22 @@ window.__ModuleLoader__.load({
|
|
|
2594
2792
|
className: "dshfs-body",
|
|
2595
2793
|
ref: bodyRef,
|
|
2596
2794
|
children: [
|
|
2795
|
+
// Mobile-only section tabs. Kept in normal document flow so the page does not
|
|
2796
|
+
// depend on the host header's exact height (the desktop rail remains portaled).
|
|
2797
|
+
pageMode
|
|
2798
|
+
? react_jsx_runtime.jsx("nav", {
|
|
2799
|
+
className: "dshfs-mobileNav",
|
|
2800
|
+
"aria-label": t.navLabel,
|
|
2801
|
+
children: NAV_ITEMS.map((item) =>
|
|
2802
|
+
react_jsx_runtime.jsx("a", {
|
|
2803
|
+
className: "dshfs-mobileNavItem" + (railActive === item.id ? " dshfs-mobileNavItemActive" : ""),
|
|
2804
|
+
href: `#/panel/dsh-free-search/${item.id}`,
|
|
2805
|
+
onClick: () => goToSection(item.id),
|
|
2806
|
+
children: navLabels[item.id],
|
|
2807
|
+
}, item.id)
|
|
2808
|
+
),
|
|
2809
|
+
})
|
|
2810
|
+
: null,
|
|
2597
2811
|
react_jsx_runtime.jsxs("label", {
|
|
2598
2812
|
className: "dshfs-field",
|
|
2599
2813
|
children: [
|
|
@@ -2987,7 +3201,7 @@ react_jsx_runtime.jsxs("div", {
|
|
|
2987
3201
|
children: [
|
|
2988
3202
|
react_jsx_runtime.jsx("div", {
|
|
2989
3203
|
className: "dshfs-label",
|
|
2990
|
-
children: t.blockedDomainsLabel,
|
|
3204
|
+
children: react_jsx_runtime.jsx(HintCard, { text: t.blockedDomainsHint, children: t.blockedDomainsLabel }),
|
|
2991
3205
|
}),
|
|
2992
3206
|
react_jsx_runtime.jsx("textarea", {
|
|
2993
3207
|
className: "dshfs-textarea",
|
|
@@ -3003,10 +3217,6 @@ react_jsx_runtime.jsxs("div", {
|
|
|
3003
3217
|
setSaveError("");
|
|
3004
3218
|
},
|
|
3005
3219
|
}),
|
|
3006
|
-
react_jsx_runtime.jsx("p", {
|
|
3007
|
-
className: "dshfs-hint",
|
|
3008
|
-
children: t.blockedDomainsHint,
|
|
3009
|
-
}),
|
|
3010
3220
|
(() => {
|
|
3011
3221
|
// 轻量提示:从不阻断保存,只告诉用户哪些行被自动处理了
|
|
3012
3222
|
const { stats } = parseBlockedDomains(blockedDomains);
|
|
@@ -3484,82 +3694,66 @@ react_jsx_runtime.jsxs("div", {
|
|
|
3484
3694
|
renderPromptSegment(promptSegments[2]),
|
|
3485
3695
|
],
|
|
3486
3696
|
}),
|
|
3697
|
+
// 三个全局开关是一组,同处一行;窄屏由 CSS 自动换行。
|
|
3487
3698
|
react_jsx_runtime.jsxs("div", {
|
|
3488
3699
|
className: "dshfs-field",
|
|
3489
3700
|
children: [
|
|
3490
|
-
react_jsx_runtime.jsxs("
|
|
3491
|
-
className: "dshfs-
|
|
3701
|
+
react_jsx_runtime.jsxs("div", {
|
|
3702
|
+
className: "dshfs-toggles",
|
|
3492
3703
|
children: [
|
|
3493
|
-
react_jsx_runtime.
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3704
|
+
react_jsx_runtime.jsxs("label", {
|
|
3705
|
+
className: "dshfs-platform",
|
|
3706
|
+
children: [
|
|
3707
|
+
react_jsx_runtime.jsx("input", {
|
|
3708
|
+
type: "checkbox",
|
|
3709
|
+
checked: sidebarEntry,
|
|
3710
|
+
disabled: !ready || saving,
|
|
3711
|
+
onChange: (e) => {
|
|
3712
|
+
setSidebarEntry(e.target.checked);
|
|
3713
|
+
setDirty(true);
|
|
3714
|
+
setFailed(false);
|
|
3715
|
+
setSaveError("");
|
|
3716
|
+
},
|
|
3717
|
+
}),
|
|
3718
|
+
react_jsx_runtime.jsx(HintCard, { text: t.sidebarEntryHint, children: t.sidebarEntryLabel }),
|
|
3719
|
+
],
|
|
3503
3720
|
}),
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
type: "checkbox",
|
|
3521
|
-
checked: slashCommands,
|
|
3522
|
-
disabled: !ready || saving,
|
|
3523
|
-
onChange: (e) => {
|
|
3524
|
-
setSlashCommands(e.target.checked);
|
|
3525
|
-
setDirty(true);
|
|
3526
|
-
setFailed(false);
|
|
3527
|
-
setSaveError("");
|
|
3528
|
-
},
|
|
3721
|
+
react_jsx_runtime.jsxs("label", {
|
|
3722
|
+
className: "dshfs-platform",
|
|
3723
|
+
children: [
|
|
3724
|
+
react_jsx_runtime.jsx("input", {
|
|
3725
|
+
type: "checkbox",
|
|
3726
|
+
checked: slashCommands,
|
|
3727
|
+
disabled: !ready || saving,
|
|
3728
|
+
onChange: (e) => {
|
|
3729
|
+
setSlashCommands(e.target.checked);
|
|
3730
|
+
setDirty(true);
|
|
3731
|
+
setFailed(false);
|
|
3732
|
+
setSaveError("");
|
|
3733
|
+
},
|
|
3734
|
+
}),
|
|
3735
|
+
react_jsx_runtime.jsx(HintCard, { text: t.slashCommandsHint, children: t.slashCommandsLabel }),
|
|
3736
|
+
],
|
|
3529
3737
|
}),
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
type: "checkbox",
|
|
3547
|
-
checked: keylessFirst,
|
|
3548
|
-
disabled: !ready || saving,
|
|
3549
|
-
onChange: (e) => {
|
|
3550
|
-
setKeylessFirst(e.target.checked);
|
|
3551
|
-
setDirty(true);
|
|
3552
|
-
setFailed(false);
|
|
3553
|
-
setSaveError("");
|
|
3554
|
-
},
|
|
3738
|
+
react_jsx_runtime.jsxs("label", {
|
|
3739
|
+
className: "dshfs-platform",
|
|
3740
|
+
children: [
|
|
3741
|
+
react_jsx_runtime.jsx("input", {
|
|
3742
|
+
type: "checkbox",
|
|
3743
|
+
checked: keylessFirst,
|
|
3744
|
+
disabled: !ready || saving,
|
|
3745
|
+
onChange: (e) => {
|
|
3746
|
+
setKeylessFirst(e.target.checked);
|
|
3747
|
+
setDirty(true);
|
|
3748
|
+
setFailed(false);
|
|
3749
|
+
setSaveError("");
|
|
3750
|
+
},
|
|
3751
|
+
}),
|
|
3752
|
+
react_jsx_runtime.jsx(HintCard, { text: t.keylessFirstHint, children: t.keylessFirstLabel }),
|
|
3753
|
+
],
|
|
3555
3754
|
}),
|
|
3556
|
-
t.keylessFirstLabel,
|
|
3557
3755
|
],
|
|
3558
3756
|
}),
|
|
3559
|
-
react_jsx_runtime.jsx("p", {
|
|
3560
|
-
className: "dshfs-hint",
|
|
3561
|
-
children: t.keylessFirstHint,
|
|
3562
|
-
}),
|
|
3563
3757
|
],
|
|
3564
3758
|
}),
|
|
3565
3759
|
react_jsx_runtime.jsxs("div", {
|
|
@@ -3711,7 +3905,7 @@ react_jsx_runtime.jsxs("div", {
|
|
|
3711
3905
|
children: t.resetDefault,
|
|
3712
3906
|
}),
|
|
3713
3907
|
react_jsx_runtime.jsx("button", {
|
|
3714
|
-
className: "dshfs-btn",
|
|
3908
|
+
className: "dshfs-btn dshfs-discard",
|
|
3715
3909
|
type: "button",
|
|
3716
3910
|
onClick: discard,
|
|
3717
3911
|
disabled: saving || !dirty,
|
package/lib/mcp_server.js
CHANGED
|
@@ -248,6 +248,52 @@ export function responseCapBytes() {
|
|
|
248
248
|
return Math.floor(raw);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// #147(补充):正文字节预算管不住真正发出去的那一行。stdout 上发的是一行 JSON,
|
|
252
|
+
// 正文里的 `"` 会变成 `\"`、换行变成 `\n`、反斜杠变成 `\\`,字节数最多接近翻倍,
|
|
253
|
+
// 48 KB 引号密集的正文序列化后能到 72 KB。所以再加一道「整行」上限。
|
|
254
|
+
export function responseCapLine() {
|
|
255
|
+
const raw = Number(env("MCP_MAX_RESPONSE_LINE_BYTES", String(64 * 1024)));
|
|
256
|
+
if (!Number.isFinite(raw) || raw < 0) return 64 * 1024;
|
|
257
|
+
return Math.floor(raw);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const truncationNote = (cap, bytes) =>
|
|
261
|
+
`\n\n[truncated${cap > 0 ? ` to ${cap} characters` : ""}${cap > 0 && bytes > 0 ? " / " : ""}${bytes > 0 ? `${bytes} bytes` : ""}; raise MCP_MAX_RESPONSE_CHARS / MCP_MAX_RESPONSE_BYTES to allow more]`;
|
|
262
|
+
|
|
263
|
+
const existingNote = /\n\n\[truncated[^\]]*\]\s*$/;
|
|
264
|
+
|
|
265
|
+
const lineNote = (cap) =>
|
|
266
|
+
`\n\n[truncated to fit the ${cap}-byte MCP stdio line; raise MCP_MAX_RESPONSE_LINE_BYTES to allow more]`;
|
|
267
|
+
|
|
268
|
+
// 把已经按字符/字节截过的正文,再收口到「信封 + JSON 转义后的正文」不越过整行上限。
|
|
269
|
+
// 用二分法找最长可行前缀,序列化次数是 log2(长度),对 48 KB 正文也就十几次。
|
|
270
|
+
export function fitResponseLine(text, envelope) {
|
|
271
|
+
const capped = clipResponse(text);
|
|
272
|
+
const cap = responseCapLine();
|
|
273
|
+
if (cap === 0) return capped;
|
|
274
|
+
const lineBytes = (body) => Buffer.byteLength(JSON.stringify(envelope(body)), "utf8");
|
|
275
|
+
if (lineBytes(capped) <= cap) return capped;
|
|
276
|
+
|
|
277
|
+
const note = lineNote(cap);
|
|
278
|
+
if (lineBytes(note) > cap) {
|
|
279
|
+
// 上限小到连提示语都放不下:只保留提示,并且绝不越界。
|
|
280
|
+
return note.slice(0, Math.max(0, cap - 2));
|
|
281
|
+
}
|
|
282
|
+
// 先剥掉上一轮截断留下的提示语,避免两条提示叠在一起。
|
|
283
|
+
const body = capped.replace(existingNote, "");
|
|
284
|
+
let low = 0;
|
|
285
|
+
let high = body.length;
|
|
286
|
+
while (low < high) {
|
|
287
|
+
const mid = Math.ceil((low + high) / 2);
|
|
288
|
+
if (lineBytes(body.slice(0, mid) + note) <= cap) low = mid;
|
|
289
|
+
else high = mid - 1;
|
|
290
|
+
}
|
|
291
|
+
// 不要切在代理对中间,否则会留下孤立的高位代理(JSON 里会变成乱码)。
|
|
292
|
+
const lastCode = low > 0 ? body.charCodeAt(low - 1) : 0;
|
|
293
|
+
if (lastCode >= 0xd800 && lastCode <= 0xdbff) low -= 1;
|
|
294
|
+
return body.slice(0, low) + note;
|
|
295
|
+
}
|
|
296
|
+
|
|
251
297
|
// research 的文档预算:把剩余字符额度平均分给 n 篇文档,留出标题/分隔符余量。
|
|
252
298
|
// 上限仍是原来的 8000 字符/篇;cap=0 时保持原行为。
|
|
253
299
|
export function perDocumentBudget(count) {
|
|
@@ -267,7 +313,7 @@ export function clipResponse(text) {
|
|
|
267
313
|
const tooLong = (candidate) =>
|
|
268
314
|
(cap > 0 && candidate.length > cap) || (bytes > 0 && Buffer.byteLength(candidate, "utf8") > bytes);
|
|
269
315
|
if (!tooLong(value)) return value;
|
|
270
|
-
const note =
|
|
316
|
+
const note = truncationNote(cap, bytes);
|
|
271
317
|
// 极端小的上限下,提示语本身就可能超限:只保留提示,绝不越过上限。
|
|
272
318
|
if (cap > 0 && note.length >= cap) return note.slice(0, cap);
|
|
273
319
|
if (bytes > 0 && Buffer.byteLength(note, "utf8") >= bytes) {
|
|
@@ -781,15 +827,14 @@ export function createMcpHandler({
|
|
|
781
827
|
if (method === "tools/list") return { jsonrpc: "2.0", id, result: { tools: TOOLS } };
|
|
782
828
|
if (method === "tools/call") {
|
|
783
829
|
const name = String(params?.name ?? "");
|
|
830
|
+
// 信封里除了正文什么都不带,其余字段固定,序列化成本可忽略。
|
|
831
|
+
const envelope = (text) => ({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text }], isError: false } });
|
|
832
|
+
const errorEnvelope = (text) => ({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text }], isError: true } });
|
|
784
833
|
try {
|
|
785
834
|
const text = await handleTool(name, params?.arguments ?? {});
|
|
786
|
-
return
|
|
835
|
+
return envelope(fitResponseLine(text, envelope));
|
|
787
836
|
} catch (error) {
|
|
788
|
-
return
|
|
789
|
-
jsonrpc: "2.0",
|
|
790
|
-
id,
|
|
791
|
-
result: { content: [{ type: "text", text: clipResponse(error?.message ?? String(error)) }], isError: true },
|
|
792
|
-
};
|
|
837
|
+
return errorEnvelope(fitResponseLine(error?.message ?? String(error), errorEnvelope));
|
|
793
838
|
}
|
|
794
839
|
}
|
|
795
840
|
if (method.startsWith("notifications/")) return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-free-search",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.80",
|
|
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",
|