@andy.ian/dsh-homing 2.5.0 → 2.5.1

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.
@@ -220,13 +220,15 @@ export const MOBILE_JS = String.raw`(() => {
220
220
  * 手机上没有那台电脑的屏幕,点了只会收到「已在其它设备打开」——纯噪音。
221
221
  * 这里把它(主按钮和小箭头都算)接到文件页 /files。
222
222
  *
223
- * 定位必须稳:页头里还有子智能体面板、更多菜单等 aria-haspopup 控件,而且
224
- * 它们排在分体按钮前面。「找第一个 aria-haspopup 的父容器」会认成子智能体
225
- * 那个容器,于是点分体按钮时判定不命中、补丁失效(手机端历史 bug)。
226
- * 所以:
223
+ * 定位:
227
224
  * 1. 优先用 DSH 的稳定标记 data-open-target="directory"(分体按钮容器);
228
- * 2. 老版本没有标记时退回结构判断 —— 同一容器里恰好两个按钮,一个带
229
- * aria-haspopup="menu"(小箭头),另一个是纯图标主按钮(里面是应用图标)。
225
+ * 2. 老版本没有标记时退回结构判断,但条件必须够严:
226
+ * 同容器恰好两个按钮,一个是纯图标主按钮且**里面是 <img> 应用图标**
227
+ * (分体按钮的真实特征),另一个是 aria-haspopup="menu" 的小箭头,
228
+ * 且整个容器在页头左上角。
229
+ * 2026-11-23 线上回归:新版 DSH 页头把「git 图标 + ⋯ 菜单」放在同一个
230
+ * 容器里(恰好两个按钮、后者 aria-haspopup=menu、前者纯 svg 图标),
231
+ * 只判断 svg 会把「⋯」劫持到文件页 —— 所以主按钮必须真是 <img> 图标。
230
232
  */
231
233
  const splitHost = (node) => {
232
234
  if (node === null || node === undefined || typeof node.closest !== 'function') return null
@@ -247,10 +249,13 @@ export const MOBILE_JS = String.raw`(() => {
247
249
  if (main === null || chevron === null) return null
248
250
  if (chevron.getAttribute('aria-haspopup') !== 'menu') return null
249
251
  if ((main.textContent || '').trim() !== '') return null
250
- if (main.querySelector('img, svg') === null) return null
252
+ // 分体按钮的主按钮是应用图标(<img>);git / ⋯ 这类页头按钮是 <svg>,不能混为一谈
253
+ if (main.querySelector('img') === null) return null
251
254
  const rect = chevron.getBoundingClientRect()
252
255
  if (rect.width === 0 || rect.height === 0) return null
253
- if (rect.top > 200) return null
256
+ if (rect.top > 120) return null
257
+ const hostRect = host.getBoundingClientRect()
258
+ if (hostRect.left > 160) return null
254
259
  return host
255
260
  }
256
261
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andy.ian/dsh-homing",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "type": "module",
5
5
  "description": "把本机 DSH 通过 SSH 反向隧道安全开放到手机浏览器:TLS 端到端(服务器只透传)、账号 + TOTP、局域网与公网双入口,随 DSH 启动。",
6
6
  "keywords": [