dsh-union-search 0.19.2-rc.2 → 0.19.2

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 +84 -44
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -85,63 +85,82 @@ const STAR_FOOT_COPY = {
85
85
  zh: {
86
86
  ask: "觉得好用?",
87
87
  star: "去 GitHub 点个 Star",
88
- issue: "反馈建议 / 提 issue"
88
+ issue: "反馈建议 / 提 issue",
89
+ support: "我已支持"
89
90
  },
90
91
  en: {
91
92
  ask: "Finding it useful?",
92
93
  star: "Star on GitHub",
93
- issue: "Feedback / open an issue"
94
+ issue: "Feedback / open an issue",
95
+ support: "Supported, thanks"
94
96
  },
95
97
  ja: {
96
98
  ask: "お役に立っていますか?",
97
99
  star: "GitHub でスター",
98
- issue: "ご意見・不具合報告"
100
+ issue: "ご意見・不具合報告",
101
+ support: "サポートしました"
99
102
  },
100
103
  ko: {
101
104
  ask: "유용한가요?",
102
105
  star: "GitHub 에서 스타",
103
- issue: "피드백 / 이슈 열기"
106
+ issue: "피드백 / 이슈 열기",
107
+ support: "지원했습니다"
104
108
  },
105
109
  fr: {
106
110
  ask: "Utile ?",
107
111
  star: "Une étoile sur GitHub",
108
- issue: "Retour / ouvrir un ticket"
112
+ issue: "Retour / ouvrir un ticket",
113
+ support: "Déjà soutenu"
109
114
  },
110
115
  de: {
111
116
  ask: "Hilfreich?",
112
117
  star: "Stern auf GitHub",
113
- issue: "Feedback / Issue öffnen"
118
+ issue: "Feedback / Issue öffnen",
119
+ support: "Unterstützt, danke"
114
120
  },
115
121
  it: {
116
122
  ask: "Ti è utile?",
117
123
  star: "Stella su GitHub",
118
- issue: "Feedback / apri una issue"
124
+ issue: "Feedback / apri una issue",
125
+ support: "Ho già supportato"
119
126
  },
120
127
  ru: {
121
128
  ask: "Полезно?",
122
129
  star: "Звезда на GitHub",
123
- issue: "Отзыв / открыть issue"
130
+ issue: "Отзыв / открыть issue",
131
+ support: "Уже поддержал"
124
132
  },
125
133
  es: {
126
134
  ask: "¿Te resulta útil?",
127
135
  star: "Danos una estrella",
128
- issue: "Sugerencias / abrir issue"
136
+ issue: "Sugerencias / abrir issue",
137
+ support: "Ya lo apoyé"
129
138
  },
130
139
  pt: {
131
140
  ask: "Achou útil?",
132
141
  star: "Dê uma estrela no GitHub",
133
- issue: "Feedback / abrir uma issue"
142
+ issue: "Feedback / abrir uma issue",
143
+ support: "Já apoiei"
134
144
  }
135
145
  };
136
146
  const STAR_FOOT_STYLE_ID = "dsh-star-foot-style";
137
147
  const STAR_FOOT_STYLE = [
138
- ".dsh-star-foot{display:flex;align-items:center;gap:6px;flex-wrap:wrap;",
148
+ ".dsh-star-foot{display:flex;flex-direction:column;align-items:flex-start;gap:2px;",
139
149
  "font-size:12px;line-height:1.6;color:inherit;opacity:.72;margin-top:10px}",
140
150
  ".dsh-star-foot:hover{opacity:1}",
151
+ ".dsh-star-foot-line{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}",
141
152
  ".dsh-star-foot .dsh-star-ver{opacity:.6;font-variant-numeric:tabular-nums}",
142
153
  ".dsh-star-foot .dsh-star-dot{opacity:.4}",
143
154
  ".dsh-star-foot a{color:inherit;text-decoration:none}",
144
- ".dsh-star-foot a:hover{text-decoration:underline}"
155
+ ".dsh-star-foot a:hover{text-decoration:underline}",
156
+ ".dsh-star-foot .dsh-star-support{appearance:none;border:0;background:none;padding:0;",
157
+ "margin:0;font:inherit;line-height:inherit;color:inherit;cursor:pointer;opacity:.72;",
158
+ "text-decoration:underline;text-underline-offset:2px}",
159
+ ".dsh-star-foot .dsh-star-support:hover{opacity:1}",
160
+ ".dsh-star-foot-collapsed{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
161
+ "font-size:12px;line-height:1.6;color:inherit;opacity:.72;margin-top:10px}",
162
+ ".dsh-star-foot-collapsed a{color:inherit;text-decoration:none}",
163
+ ".dsh-star-foot-collapsed a:hover{text-decoration:underline}"
145
164
  ].join("");
146
165
  /** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
147
166
  function starLang() {
@@ -149,23 +168,30 @@ function starLang() {
149
168
  for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
150
169
  return "en";
151
170
  }
152
- /** 关闭态新键(v2)。**必须换键**:≤2.0.25 把「点 ★」误写成了关闭,旧键里的 1 是误判产物。 */
153
- const STAR_DISMISS_KEY = "dsh.star." + STAR_NS + ".v2.dismissed";
154
- /** 旧键(脏数据源):读到即清掉,**不迁值**——迁过来等于把旧 bug 固化。 */
171
+ /** v3 确认键:只有按「我已支持」才写。 */
172
+ const STAR_SUPPORT_KEY = "dsh.star." + STAR_NS + ".v3.supported";
173
+ /** 两个作废旧键:读到即清、不迁值。 */
174
+ const STAR_DISMISS_KEY_V2 = "dsh.star." + STAR_NS + ".v2.dismissed";
155
175
  const STAR_DISMISS_KEY_V1 = "dsh.star." + STAR_NS + ".dismissed";
156
- /** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
157
- function starDismissed() {
176
+ /** 是否已确认支持过。隐私模式读失败按未确认处理(只影响本次会话)。 */
177
+ function starSupported() {
158
178
  try {
159
- if (localStorage.getItem(STAR_DISMISS_KEY_V1) !== null) localStorage.removeItem(STAR_DISMISS_KEY_V1);
160
- return localStorage.getItem(STAR_DISMISS_KEY) === "1";
179
+ return localStorage.getItem(STAR_SUPPORT_KEY) === "1";
161
180
  } catch {
162
181
  return false;
163
182
  }
164
183
  }
165
- /** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
166
- function starDismiss() {
184
+ /** 加载即清两个旧键(v2 误点自动收敛的脏数据),不迁值。 */
185
+ function cleanLegacyStarKeys() {
186
+ try {
187
+ if (localStorage.getItem(STAR_DISMISS_KEY_V2) !== null) localStorage.removeItem(STAR_DISMISS_KEY_V2);
188
+ if (localStorage.getItem(STAR_DISMISS_KEY_V1) !== null) localStorage.removeItem(STAR_DISMISS_KEY_V1);
189
+ } catch {}
190
+ }
191
+ /** 记住「我已支持」。隐私模式写失败不报错:本次收敛、刷新复活。 */
192
+ function starSupport() {
167
193
  try {
168
- localStorage.setItem(STAR_DISMISS_KEY, "1");
194
+ localStorage.setItem(STAR_SUPPORT_KEY, "1");
169
195
  } catch {}
170
196
  }
171
197
  /** 一次性注入页脚样式。 */
@@ -196,37 +222,51 @@ function footDot(d) {
196
222
  dot.textContent = "·";
197
223
  return dot;
198
224
  }
225
+ /** 收敛态:仓库地址(中性链接)+ 独立 💬 issue;星号话术与按钮都不再出现。 */
226
+ function collapsedFoot(neutral, d, issuesUrl) {
227
+ const box = d.createElement("div");
228
+ box.className = "dsh-star-foot-collapsed";
229
+ neutral.className = "dsh-star-row";
230
+ box.appendChild(neutral);
231
+ box.appendChild(footItem(d, "a", "💬 " + (STAR_FOOT_COPY[starLang()] ?? STAR_FOOT_COPY.en).issue, issuesUrl));
232
+ return box;
233
+ }
199
234
  /**
200
- * S 档:一行页脚;非 S 档或已关掉过话术时返回 null(走裸链接原路径)。
201
- * 点过任一链接 → 记关闭 + 换回中性一行,链接本身照常跳转(不 preventDefault)。
235
+ * S 档:两行页脚;非 S 档返回 null(走裸链接原路径)。
236
+ * 已确认支持 → 收敛态;⭐ / 💬 仅跳转不收敛;只有「我已支持」按钮写新键并收敛。
202
237
  */
203
238
  function extendedStarRow(neutral, d) {
204
- if (starDismissed()) return null;
205
- injectFootStyle(d);
239
+ cleanLegacyStarKeys();
206
240
  const copy = STAR_FOOT_COPY[starLang()] ?? STAR_FOOT_COPY.en;
207
241
  const issuesUrl = REPO_URL.replace(/\/+$/, "") + "/issues/new";
242
+ if (starSupported()) return collapsedFoot(neutral, d, issuesUrl);
243
+ injectFootStyle(d);
208
244
  const row = d.createElement("div");
209
245
  row.className = "dsh-star-foot";
246
+ const line1 = d.createElement("div");
247
+ line1.className = "dsh-star-foot-line";
210
248
  const ver = d.createElement("span");
211
249
  ver.className = "dsh-star-ver";
212
- ver.textContent = "v0.19.2-rc.2";
213
- row.appendChild(ver);
214
- row.appendChild(footDot(d));
215
- row.appendChild(footItem(d, "span", copy.ask));
216
- const star = footItem(d, "a", "⭐ " + copy.star, REPO_URL);
217
- const issue = footItem(d, "a", "💬 " + copy.issue, issuesUrl);
218
- row.appendChild(star);
219
- row.appendChild(footDot(d));
220
- row.appendChild(issue);
221
- const collapse = () => {
222
- starDismiss();
223
- if (row.parentNode) {
224
- neutral.className = "dsh-star-row";
225
- row.parentNode.replaceChild(neutral, row);
226
- }
227
- };
228
- star.addEventListener("click", collapse);
229
- issue.addEventListener("click", collapse);
250
+ ver.textContent = "v0.19.2";
251
+ line1.appendChild(ver);
252
+ line1.appendChild(footDot(d));
253
+ line1.appendChild(footItem(d, "span", copy.ask));
254
+ line1.appendChild(footItem(d, "a", "⭐ " + copy.star, REPO_URL));
255
+ line1.appendChild(footDot(d));
256
+ const support = d.createElement("button");
257
+ support.type = "button";
258
+ support.className = "dsh-star-support";
259
+ support.textContent = copy.support;
260
+ support.addEventListener("click", function() {
261
+ starSupport();
262
+ if (row.parentNode) row.parentNode.replaceChild(collapsedFoot(neutral, d, issuesUrl), row);
263
+ });
264
+ line1.appendChild(support);
265
+ const line2 = d.createElement("div");
266
+ line2.className = "dsh-star-foot-line";
267
+ line2.appendChild(footItem(d, "a", "💬 " + copy.issue, issuesUrl));
268
+ row.appendChild(line1);
269
+ row.appendChild(line2);
230
270
  return row;
231
271
  }
232
272
  /** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-union-search",
3
- "version": "0.19.2-rc.2",
3
+ "version": "0.19.2",
4
4
  "description": "Union web search for DeepSeek Harness (renamed from dsh-free-search): free keyless engines + many professional paid search APIs — 28 engines (Bing/DuckDuckGo/AnySearch/SearXNG multi-instance union/Exa/Tavily/Keenable/Firecrawl/Parallel keyless; Zhihu global/site via MCP and Perplexity/SerpBase/Serply/DeepSeek official/You.com/Baidu/Kimi/Aliyun/Doubao/Zhipu/Bocha/Metaso with key; OpenAI/Gemini/Claude/Grok model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + multi mode (parallel top-3 merge) + multi_search cross-source tool + failure-aware fallback + block system built-in search toggle + experimental free advance_fetch (no API key, no billing; host-twin GitHub-Flavored Markdown conversion + CSS selector/fields structured extraction) + time filtering + platform search + web_fetch, with web settings UI.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",