dsh-lan-guard 0.4.1 → 0.4.4
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/CHANGELOG.md +96 -0
- package/README.md +5 -2
- package/README.zh.md +5 -2
- package/lib/index.js +26 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.4] — 2026-09-29(补偿 DSH `0.2.0-rc.1` 的会话裁剪回归)
|
|
4
|
+
|
|
5
|
+
**现象**(真机 iPhone 16 Pro Max / iOS 27,经代理的 3081):会话内容看得见,但**手指几乎拖不动、打开会话也不停在最新消息**。
|
|
6
|
+
|
|
7
|
+
**根因(真机 A/B)**:DSH `0.2.0-rc.1` 下,官方滚动层 `[data-conversation-scroll]` **内部**的 `EvIC1a_frame` 是 `overflow:hidden` 且高度被锁死(≈视口高),把 21083px 的会话内容裁掉,高度传不上去——该滚动层虽然「有溢出」,可滚范围却只有 **336px**:
|
|
8
|
+
|
|
9
|
+
| | `0.1.7-rc.2`(本机 10.0.0.20) | `0.2.0-rc.1`(lionm4 10.0.0.30) |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| 滚动层 client / scroll | 720 / 15925 | 668 / 1004 |
|
|
12
|
+
| 可滚范围 | 15205 | **336** |
|
|
13
|
+
| 最后一条消息 | 在屏内 | 在 21215px 处(屏外) |
|
|
14
|
+
|
|
15
|
+
把页面上本插件的内联改动全部清掉后该裁剪依旧存在 ⇒ **属 DSH 原生回归,不是注入造成的**;本插件的角色是补偿。
|
|
16
|
+
|
|
17
|
+
**修法**:`mobileScrollFix` 新增 `fixClip()`——对滚动层**内部**满足「`overflow:hidden/clip` 且内容溢出」的层**同时**设 `height:auto` 与 `overflow:visible`,并以「可滚范围是否真的变大」自检、无效则整体回退。两条缺一不可:
|
|
18
|
+
|
|
19
|
+
- `height:auto`:让该层长高到内容高度,高度才能回流到官方滚动层;
|
|
20
|
+
- `overflow:visible`:让该层不再是滚动容器。否则官方「回到底部」的槽(`EvIC1a_toBottomSlot`,`position:sticky; bottom:208px`)会以该层自己的底边为参照,按钮从 y≈514 掉到 y≈10683 而消失(这是只改 `height:auto` 时的实测副作用)。
|
|
21
|
+
|
|
22
|
+
只动滚动层内部那一层:不新建滚动容器、不改官方其余 UI。同一版还把 `touchPassThrough()` 与 `fixClip()` 都移到 `convScrolls()` 短路**之前**——此前「官方滚动层按尺寸可滚」(正是故障场景本身)会让放行逻辑永不执行,Runbook 期望的 `touch passthrough layers=N` 也永远打不出来。
|
|
23
|
+
|
|
24
|
+
**真机验收**(同一长会话,滚到中段):可滚范围 336 → **20675**;输入框在顶部/中段/靠底/到底四处均为 `[588,780]`(吸底);官方 ↓ 按钮四处均在 `[538,572]`(与 stock 的 `[514,548]` 同区);滚到底时最后一条消息 `[540,572]` 在视口内。`?lgdiag=1` 面板输出 `clip grow layers=1 max 336->20675` → `clip released -> max=20675`。
|
|
25
|
+
|
|
26
|
+
**已排除的误判**:用户报「输入框底下还能看到滚动的文字」。按 10px 密集采样输入框那一条(586→796),stock 与修复后的最上层元素/背景/透明度**逐点完全一致**(如 y=786 两者都是透明的会话正文)⇒ 属 DSH 自带样式,非本版引入。
|
|
27
|
+
|
|
28
|
+
## [0.4.3] — 2026-09-28(改用 dsh-mobile 式「高度链」修正,移除自建补丁)
|
|
29
|
+
|
|
30
|
+
### 方向修正 — 不再给内容层打 overflow 补丁
|
|
31
|
+
|
|
32
|
+
**对照实验(用户实测)**:3080 直连(本插件注入不生效)**能正常拖动**;3081 经代理(注入生效)**拖不动**;而 dsh-mobile 在**同一套官方 UI、同一台手机**上可用。
|
|
33
|
+
|
|
34
|
+
**dsh-mobile 的做法是移动端「高度链」**(`src/mobile-layout.ts`):
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
html, body, #root { height:100%; overflow:hidden }
|
|
38
|
+
.dshm-shell { height:100dvh } /* dvh,不是 vh */
|
|
39
|
+
.dshm-main { min-height:0 } /* flex/grid 子项允许收缩 */
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**根因**:官方外壳在窄屏 iOS 下高度链断裂——实测内容 1688 被裁在 844 的层里,而官方认定的滚动层 `[data-conversation-scroll]` 永远 754/754(内容没进它的流)。后果:手指拖不动、官方「回到底部」点了没反应、**打开会话也不会停在最新消息**。0.4.1/0.4.2 给内容层打 `overflow-y:auto !important` 是治标,并引发了白屏与抽屉遮罩两个副作用。
|
|
43
|
+
|
|
44
|
+
**0.4.3 的做法**(`mobileScrollFix`):
|
|
45
|
+
|
|
46
|
+
1. 给 `html/body/#root` 一个确定高度(`100%`,支持时 `100dvh`)并锁住页面滚动;
|
|
47
|
+
2. 沿「被裁且内容溢出」的那一层,给链上所有 flex/grid 容器补 `min-height:0`;
|
|
48
|
+
3. **立刻验证**官方认定的滚动层是否真的能滚:能 → 保留;**不能 → 全部撤销**,页面回到与官方逐字节一致(宁可不动,也不引入第二个滚动层);
|
|
49
|
+
4. 遮罩/对话框打开时同样先撤销(0.4.2 遮罩事故的教训)。
|
|
50
|
+
|
|
51
|
+
**移除**:自建「回到底部」按钮(官方按钮恢复工作,且打开会话会自动停在最新)、内容层 `overflow-y`/`touch-action` 补丁、`-webkit-overflow-scrolling`。
|
|
52
|
+
|
|
53
|
+
### 补充(同日真机诊断后)— 触摸放行
|
|
54
|
+
|
|
55
|
+
真机 `?lgdiag=1` 的决定性数据:`official scroll layer already works`——官方滚动层**是可滚的**,但手指拖不动。结论:**触摸被全屏视觉层吃掉**(`pI_x6G_overlayLayer` / `dsh-sc-layer` 这类 `position:absolute/fixed` 的全屏层,在 iOS 上 `pointer-events:auto` 会拦截触摸;桌面 Chrome 的滚轮走另一条路径,所以本地一直"能拖")。
|
|
56
|
+
|
|
57
|
+
新增 `touchPassThrough()`:只对**纯视觉容器**放行触摸(全屏覆盖、`pointer-events` 非 none、不含 button/input/textarea/select/[contenteditable]、文本 <40 字符),设 `pointer-events:none !important`;真正的交互层一律不碰。
|
|
58
|
+
|
|
59
|
+
### 兼容性声明 — DSH 0.2.0-rc.1
|
|
60
|
+
|
|
61
|
+
- `dsh.engines.dsh`、`peerDependencies['@deepseek-ai/dsh-client-connection']` 与 `peerDependencies['@deepseek-ai/dsh-host-webserver']` 的上界由 `<0.2.0` 放宽为 `<0.3.0`,`dsh.compatibility.dshReleases` 新增 `0.2.0-rc.1: compatible`。旧上界是一颗定时炸弹:profile 加载会拒绝范围不含运行版本的 bundle,而裸的 `<0.2.0` 恰好排除 DSH `0.2.0` 正式版——正式版发布当天本插件会被静默丢弃。
|
|
62
|
+
- 依据:本插件正以 link 方式运行在当前 DSH `0.2.0-rc.1` profile 中(无 skipping 警告);`dsh.client.inject` 涉及的宿主包(`dsh-client-ui-renderer`、`dsh-client-ui-layout`、`dsh-client-ui-settings(-general)`)与 peer 包(`dsh-client-connection`、`dsh-host-webserver`)在 `dsh-v0.1.7-rc.2` → `dsh-v0.2.0-rc.1` 之间仅有版本号改动,本插件用到的接口面(`webServer.register` / `tapIndex`、`connection.requestRejection`、`connection.authenticatedUrl`、`settings.section` seat)无一变化。仅声明,零代码。
|
|
63
|
+
|
|
64
|
+
### 升级
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
dsh plugin --profile web add dsh-lan-guard@latest
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
重启一次 dsh 生效。
|
|
71
|
+
|
|
72
|
+
## [0.4.2] — 2026-09-28(手机端补上「回到底部」按钮)
|
|
73
|
+
|
|
74
|
+
### 修复 — 手机上滚动到中间时没有回到底部的按钮
|
|
75
|
+
|
|
76
|
+
**症状**(2026-09-28 用户报告):0.4.1 之后手机已经能滚动、也能看到最新内容,但**滚到消息中间时右下角没有「回到底部」的下箭头**,只能手动往回滑。
|
|
77
|
+
|
|
78
|
+
**根因(官方源码 + 真机视口诊断)**:官方自带这个按钮(`chat.toBottom`),显示条件是「不在尾部」(`!scroll.followingTail`),而这个判断基于官方认定的滚动层。窄屏下官方布局(`dsh-client-ui-layout` 的 `pI_x6G_frame`)承担了实际滚动,而 conversation 的 `[data-conversation-scroll]` 层内容高度并没有跟着涨——实测 `convScroll 754/754`,同时 `pI_x6G_frame 844/1688`。两边不一致 → 官方永远以为还在尾部 → 按钮不出现。
|
|
79
|
+
|
|
80
|
+
**改动**(并入 `mobileScrollFix`,窄屏 + 移动端生效):网关侧自带一个「回到底部」按钮:
|
|
81
|
+
- 不依赖官方内部状态:每次滚动/尺寸变化后,找出**当前真正在滚动的容器**(滚动量最大且可见者),不在尾部时显示 36px 圆形浮动按钮,点击平滑滚到底;
|
|
82
|
+
- **自动避让**:一旦检测到官方按钮(`aria-label` 含「底部」或 `bottom`)出现,自己的按钮立即移除,不会出现两个;
|
|
83
|
+
- **自动避开输入框**:按输入框位置动态计算按钮的 `bottom`(键盘弹出、快捷回复展开时不会压住输入区)。
|
|
84
|
+
|
|
85
|
+
### 修复 — 打开左侧边栏被遮罩盖住(0.4.2 内的回归修复)
|
|
86
|
+
|
|
87
|
+
**症状**:0.4.2 的滚动矫正上线后,手机上打开左侧边栏会被一层灰雾盖住、点不动。
|
|
88
|
+
**根因(用户 A/B 实测确认)**:矫正给内容滚动层加了 `overflow-y:auto !important`(以及 `-webkit-overflow-scrolling:touch`),与官方抽屉打开时的滚动锁定/层级互相打架;把 `mobileScrollFix` 关掉即恢复正常。
|
|
89
|
+
**改动**:检测到全屏遮罩/对话框(`[aria-modal=true]` / `[role=dialog]` / `[data-conversation-overlay]`,或命中点上方有覆盖 ≥85% 视口的定位层)时,**完全撤销**自己加过的样式并隐藏自己的按钮,把页面还给官方;抽屉关闭后再应用。同时**去掉 `-webkit-overflow-scrolling`**(iOS 会为它强制合成层,正是层级错乱的来源)。
|
|
90
|
+
|
|
91
|
+
### 升级
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
dsh plugin --profile web add dsh-lan-guard@latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
重启一次 dsh 生效。
|
|
98
|
+
|
|
3
99
|
## [0.4.1] — 2026-09-28(修掉手机端「聊天区滑不动」)
|
|
4
100
|
|
|
5
101
|
### 修复 — 手机上会话内容可见但无法上下滑动
|
package/README.md
CHANGED
|
@@ -147,10 +147,11 @@ The plugin reads its config from its Cordis entry. **Every key has a usable defa
|
|
|
147
147
|
|
|
148
148
|
## Compatibility
|
|
149
149
|
|
|
150
|
-
Current version: plugin **`0.4.
|
|
150
|
+
Current version: plugin **`0.4.4`**; compensates a DSH `0.2.0-rc.1` layout regression in which an inner `overflow:hidden` layer clipped the session content, leaving the official scroller only 336px of range (verified on DeepSeek Harness **`0.2.0-rc.1`**, `0.1.7-rc.2`).
|
|
151
151
|
|
|
152
152
|
| Plugin | Verified DeepSeek Harness | What this version is |
|
|
153
153
|
| --- | --- | --- |
|
|
154
|
+
| **`0.4.4`** | **`0.2.0-rc.1`**, `0.1.7-rc.2` | iOS session scrolling on DSH `0.2.0-rc.1`: an inner `overflow:hidden` layer with a locked height clipped the conversation (measured on device: 21083px of content behind a 336px scroll range), so a session did not open at the newest message and barely dragged. `mobileScrollFix` now grows that inner layer and drops its scroll-container role, restoring 20675px — verified on device with the composer still pinned and the official "back to bottom" button back in place |
|
|
154
155
|
| **`0.4.0`** | **`0.1.7-rc.2`**, `0.1.7-rc.1` | Mobile long-connection self-healing: the proxy answers DSH's WebSocket heartbeat (measured: 6 s reap without it, 20 s+ survival with it); page patches adding a socket watchdog and mobile compatibility shims; a connection health check and relay counters on the "connection" tab |
|
|
155
156
|
| **`0.3.6`** | **`0.1.7-rc.2`**, `0.1.7-rc.1` | Adding a workspace from a remote device: the browser half shadows the official directory flow (the local browser keeps the OS dialog, a remote device gets an in-page browser and can unlock inside it); fixes the proxy dropping the plugin's admin cookie in both directions, which made `password_unlock` meaningless remotely; adds the missing "remote management rights" control; moves the "saved" confirmation to a top-right notification; reworks status-surface colours against measured contrast; fixes the picker's crushed breadcrumb/shortcut rows |
|
|
156
157
|
| **`0.3.5`** | **`0.1.7-rc.2`**, `0.1.7-rc.1` | Connection-level visibility: an `http://` request to the TLS port goes from "blank page + no log" to a 301 onto `https` with a log line; a deleted device record no longer locks that browser out (revoked/blocked still refuse); the removal-page copy follows |
|
|
@@ -163,7 +164,7 @@ Current version: plugin **`0.4.0`**; mobile long-connection self-healing — the
|
|
|
163
164
|
| `0.1.1` | `0.1.7-rc.1` | Documentation release: bilingual user READMEs |
|
|
164
165
|
| `0.1.0` | `0.1.7-rc.1` | First release: gated reverse proxy, self-signed HTTPS, device pairing, settings page, QR access |
|
|
165
166
|
|
|
166
|
-
- Declared range `>=0.1.7-rc.1 <0.
|
|
167
|
+
- Declared range `>=0.1.7-rc.1 <0.3.0` (`dsh.engines.dsh`); verified releases: `0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`. DSH versions not listed are **unverified** — verify them yourself before use. The upper bound was widened from `<0.2.0` in `0.4.3` because profile load refuses a bundle whose range excludes the running release, and a plain `<0.2.0` would exclude the `0.2.0` stable.
|
|
167
168
|
- Host/client interfaces this plugin uses: `webServer.register` / `webServer.tapIndex` (indexTaps), `connection.requestRejection`, `connection.authenticatedUrl`, the additive `settings.section` seat, `@deepseek-ai/schemastery`, and `profileContext` (for deriving the default data directory).
|
|
168
169
|
- **Breaking default change (from `0.3.2`)**: `listenHost` now defaults to `0.0.0.0` instead of `127.0.0.1`, so one restart after install is enough; `0.3.1` and earlier default to loopback only. The gate and self-signed TLS defaults are unchanged (with no password the gate still refuses every device). See the [CHANGELOG](CHANGELOG.md).
|
|
169
170
|
- **`0.4.0` verification status**: all three changes carry measurements, not just specs.
|
|
@@ -209,6 +210,8 @@ The official UI is reused with zero modifications and adapts on a phone viewport
|
|
|
209
210
|
|
|
210
211
|
**Fix (`mobileScrollFix`, on by default)**: the injected script only acts when narrow screen AND mobile UA AND the page cannot scroll AND it actually finds a layer clipping overflowing content; it then makes exactly those layers touch-scrollable (`overflow-y:auto`, `-webkit-overflow-scrolling:touch`, `touch-action:pan-y`). Healthy pages are never touched.
|
|
211
212
|
|
|
213
|
+
**"Back to bottom" button (from 0.4.2)**: on narrow screens the official button shows only when not at the tail, judged against the scroll layer the official code believes in — which is not the layer that actually scrolls, so it never appears. The gateway therefore ships an equivalent floating button (shown whenever the view is not at the bottom, smooth-scrolls on click, yields to the official button once that appears, and positions itself above the composer).
|
|
214
|
+
|
|
212
215
|
**Self-check**: append `?lgdiag=1` to the page URL for an on-screen report (`narrow / mobile / innerHeight / visualViewport / pageScrolls / clippingLayers / patched`). That report is exactly the data that located this bug.
|
|
213
216
|
|
|
214
217
|
|
package/README.zh.md
CHANGED
|
@@ -147,10 +147,11 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
147
147
|
|
|
148
148
|
## 兼容性
|
|
149
149
|
|
|
150
|
-
当前版本:插件 **`0.
|
|
150
|
+
当前版本:插件 **`0.4.4`**;补偿 DSH `0.2.0-rc.1` 的一处布局回归 —— 官方滚动层内部有一层 `overflow:hidden` 且高度锁死,把会话内容裁掉,官方滚动层只拿到 336px 的可滚范围(已在 DeepSeek Harness **`0.2.0-rc.1`**、`0.1.7-rc.2` 上验证)。
|
|
151
151
|
|
|
152
152
|
| 插件 | 已验证的 DeepSeek Harness | 这个版本是什么 |
|
|
153
153
|
| --- | --- | --- |
|
|
154
|
+
| **`0.4.4`** | **`0.2.0-rc.1`**、`0.1.7-rc.2` | 修好 DSH `0.2.0-rc.1` 上的 iOS 会话滚动:官方滚动层内部有一层 `overflow:hidden` 且高度锁死,把会话内容裁掉(真机实测:21083px 的内容只换来 336px 可滚范围),表现为打开会话不在最新、手指几乎拖不动。`mobileScrollFix` 现在让该层长高并脱离滚动容器身份,可滚范围恢复到 20675px;真机验收同时确认输入框仍吸底、官方「回到底部」按钮回到原位 |
|
|
154
155
|
| **`0.4.0`** | **`0.1.7-rc.2`**、`0.1.7-rc.1` | 手机长连接自愈:代理代答 DSH 的 WebSocket 心跳(实测把「停回心跳 6 秒被切断」变成「20 秒以上存活」);页面补丁加入断线看门狗与移动端兼容垫片;「连接与证书」新增连接体检与代理侧计数 |
|
|
155
156
|
| **`0.3.6`** | **`0.1.7-rc.2`**、`0.1.7-rc.1` | 远程也能添加工作区:浏览器侧遮蔽官方目录流程(本机仍走系统对话框,远程改用页面内目录浏览器,可在弹层内解锁);修掉代理双向丢弃插件管理 cookie 导致 `password_unlock` 对远程形同虚设;补上一直缺失的「远程设备管理权限」控件;「已保存」改为右上角提示;状态表面配色按实测重做;弹层两行被压扁重叠 |
|
|
156
157
|
| **`0.3.5`** | **`0.1.7-rc.2`**、`0.1.7-rc.1` | 连接层可见性:`http://` 访问 TLS 端口由「空白页 + 无日志」改为 301 跳 `https` 并记日志;删除设备记录后旧 cookie 不再把浏览器锁死(吊销/拉黑仍拒绝);移除页文案同步修正 |
|
|
@@ -163,7 +164,7 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
163
164
|
| `0.1.1` | `0.1.7-rc.1` | 文档版:中英双语用户 README |
|
|
164
165
|
| `0.1.0` | `0.1.7-rc.1` | 首个版本:门禁反向代理、自签 HTTPS、设备配对、设置页、扫码访问 |
|
|
165
166
|
|
|
166
|
-
- 声明范围 `>=0.1.7-rc.1 <0.
|
|
167
|
+
- 声明范围 `>=0.1.7-rc.1 <0.3.0`(`dsh.engines.dsh`);已验证版本:`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1`。未列入的 DSH 版本属**未验证**,请自行验证后再使用。上界在 `0.4.3` 从 `<0.2.0` 放宽:profile 加载会拒绝范围不含运行版本的 bundle,而裸的 `<0.2.0` 恰好排除 `0.2.0` 正式版。
|
|
167
168
|
- 本插件用到的宿主/客户端接口:`webServer.register` / `webServer.tapIndex`(indexTaps)、`connection.requestRejection`、`connection.authenticatedUrl`、追加型 `settings.section` seat、`@deepseek-ai/schemastery`,以及 `profileContext`(用于推导默认数据目录)。
|
|
168
169
|
- **破坏性默认值变更(`0.3.2` 起)**:`listenHost` 默认由 `127.0.0.1` 改为 `0.0.0.0`,装完重启一次即可用;`0.3.1` 及更早默认仅回环。门禁与自签 TLS 的默认值未变(未设密码仍拒绝所有设备)。详见 [CHANGELOG](CHANGELOG.md)。
|
|
169
170
|
- **`0.4.0` 的验证状态**:三处改动都做了实测,不只跑用例。
|
|
@@ -209,6 +210,8 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
209
210
|
|
|
210
211
|
**修复(`mobileScrollFix`,默认开)**:注入脚本**只在四条同时成立时**才动手——窄屏(≤1023px)、移动端 UA、**整页不可滚**、且**确实找到被裁剪且内容溢出的层**;然后只把那几层改成可触摸滚动(`overflow-y:auto`、`-webkit-overflow-scrolling:touch`、`touch-action:pan-y`)。能正常滚动的页面一律不碰。
|
|
211
212
|
|
|
213
|
+
**「回到底部」按钮(0.4.2 起)**:窄屏下官方按钮的显示条件是「不在尾部」,而它判断的是官方认定的滚动层,与实际滚动层不一致,于是永远不出现;网关侧因此自带一个等价的浮动按钮(不在尾部时显示、点击平滑到底、官方按钮出现即让位、位置按输入框动态计算)。
|
|
214
|
+
|
|
212
215
|
**自检**:在页面地址后加 `?lgdiag=1`,顶部会出现一屏诊断(`narrow / mobile / innerHeight / visualViewport / pageScrolls / clippingLayers / 是否已修`)。这一屏就是本次定位所用的数据,以后复现同类问题不必连 Mac 调试。
|
|
213
216
|
|
|
214
217
|
## 安全边界
|
package/lib/index.js
CHANGED
|
@@ -3188,8 +3188,33 @@ const MOBILE_SCROLL_MARKER = "/*dsh-lan-guard:mobile-scroll*/";
|
|
|
3188
3188
|
*
|
|
3189
3189
|
* @returns one inline `<script>` element.
|
|
3190
3190
|
*/
|
|
3191
|
+
/**
|
|
3192
|
+
* 窄屏高度链修正(2026-09-28 第三次修订,照抄 dsh-mobile 的做法)。
|
|
3193
|
+
*
|
|
3194
|
+
* 事实(真机 + 官方源码 + 竞品对照):
|
|
3195
|
+
*
|
|
3196
|
+
* - 官方外壳在窄屏 iOS 下把内容裁在 `pI_x6G_frame`(实测 clientH 844 /
|
|
3197
|
+
* scrollH 1688),而 conversation 认定的滚动层 `[data-conversation-scroll]`
|
|
3198
|
+
* 始终 754/754:内容根本没进它的流。结果:手指拖不动、官方「回到底部」
|
|
3199
|
+
* 按钮点了没反应、打开会话也不会自动停到最新消息。
|
|
3200
|
+
* - dsh-mobile 能做对,靠的是**高度链**而不是滚动补丁:
|
|
3201
|
+
* `html,body,#root{height:100%;overflow:hidden}` +
|
|
3202
|
+
* shell `height:100dvh` + 主区 `min-height:0`(flex 子项允许收缩)。
|
|
3203
|
+
*
|
|
3204
|
+
* 因此本脚本只做同一件事,并且**绝不改任何 overflow-y、绝不新建滚动容器、
|
|
3205
|
+
* 绝不加自己的按钮**:
|
|
3206
|
+
*
|
|
3207
|
+
* 1. 给 `html/body/#root` 一个确定高度(`100%`,支持时 `100dvh`)并锁住页面滚动;
|
|
3208
|
+
* 2. 沿着「被裁且内容溢出」的那一层,给链上所有 flex/grid 容器补 `min-height:0`;
|
|
3209
|
+
* 3. 立刻验证官方认定的滚动层是否真的能滚了:能 → 保留;不能 → **全部撤销**,
|
|
3210
|
+
* 页面回到与官方逐字节一致的状态(宁可不动,也不引入第二个滚动层)。
|
|
3211
|
+
*
|
|
3212
|
+
* 抽屉/遮罩打开时同样先撤销自己(0.4.2 的遮罩事故教训)。
|
|
3213
|
+
*
|
|
3214
|
+
* @returns one inline `<script>` element.
|
|
3215
|
+
*/
|
|
3191
3216
|
function mobileScrollFixScript() {
|
|
3192
|
-
return `<script>${MOBILE_SCROLL_MARKER}(function(){try{var diag=/[?&]lgdiag/.test(self.location.search);var out=[];function log(s){out.push(s);if(diag)draw()}function draw(){try{var p=document.getElementById("lgsc");if(!p){p=document.createElement("pre");p.id="lgsc";p.style.cssText="position:fixed;left:0;top:0;right:0;height:46%;z-index:2147483647;background:rgba(0,0,0,.92);color:#0f0;font:10px/1.3 monospace;padding:6px;margin:0;overflow:auto;white-space:pre-wrap;pointer-events:none";(document.body||document.documentElement).appendChild(p)}p.textContent="[lan-guard 手机滚动诊断]"+String.fromCharCode(10)+out.join(String.fromCharCode(10))}catch(e){}}function pageScrolls(){var d=document.documentElement,b=document.body;return (d&&d.scrollHeight>d.clientHeight+8)||(b&&b.scrollHeight>b.clientHeight+8)}function clipping(){var r=[];var all=document.querySelectorAll("div");var lim=Math.min(all.length,5000);for(var i=0;i<lim;i++){var el=all[i];var cs=getComputedStyle(el);if(cs.overflowY!=="hidden"&&cs.overflowY!=="clip")continue;if(el.clientHeight<150)continue;if(el.scrollHeight<=el.clientHeight+8)continue;r.push(el)}r.sort(function(a,b){return (b.scrollHeight-b.clientHeight)-(a.scrollHeight-a.clientHeight)});return r}function
|
|
3217
|
+
return `<script>${MOBILE_SCROLL_MARKER}(function(){try{var diag=/[?&]lgdiag/.test(self.location.search);var out=[];function log(s){out.push(s);if(diag)draw()}function draw(){try{var p=document.getElementById("lgsc");if(!p){p=document.createElement("pre");p.id="lgsc";p.style.cssText="position:fixed;left:0;top:0;right:0;height:46%;z-index:2147483647;background:rgba(0,0,0,.92);color:#0f0;font:10px/1.3 monospace;padding:6px;margin:0;overflow:auto;white-space:pre-wrap;pointer-events:none";(document.body||document.documentElement).appendChild(p)}p.textContent="[lan-guard 手机滚动诊断]"+String.fromCharCode(10)+out.join(String.fromCharCode(10))}catch(e){}}var touched=[];function set(el,prop,val){if(!el)return;try{el.style.setProperty(prop,val,"important");touched.push([el,prop])}catch(e){}}function undoAll(){for(var i=0;i<touched.length;i++){try{touched[i][0].style.removeProperty(touched[i][1])}catch(e){}}touched=[]}function conv(){try{return document.querySelector("[data-conversation-scroll]")}catch(e){return null}}function convScrolls(){var c=conv();return !!c&&c.scrollHeight>c.clientHeight+8}function pageScrolls(){var d=document.documentElement,b=document.body;return (d&&d.scrollHeight>d.clientHeight+8)||(b&&b.scrollHeight>b.clientHeight+8)}function clipping(){var r=[];var all=document.querySelectorAll("div");var lim=Math.min(all.length,5000);for(var i=0;i<lim;i++){var el=all[i];var cs=getComputedStyle(el);if(cs.overflowY!=="hidden"&&cs.overflowY!=="clip")continue;if(el.clientHeight<150)continue;if(el.scrollHeight<=el.clientHeight+8)continue;r.push(el)}r.sort(function(a,b){return (b.scrollHeight-b.clientHeight)-(a.scrollHeight-a.clientHeight)});return r}function overlayOpen(){try{if(document.querySelector("[aria-modal=true],[role=dialog],[data-conversation-overlay]"))return true;var el=document.elementFromPoint(Math.round(innerWidth*0.92),Math.round(innerHeight*0.45));while(el&&el!==document.body){var cs=getComputedStyle(el);if((cs.position==="fixed"||cs.position==="absolute")&&cs.pointerEvents!=="none"){var r=el.getBoundingClientRect();if(r.width>innerWidth*0.85&&r.height>innerHeight*0.7)return true}el=el.parentElement}}catch(e){}return false}function touchPassThrough(){var layers=document.querySelectorAll("div");var lim=Math.min(layers.length,5000);var n=0;for(var i=0;i<lim;i++){var el=layers[i];var cs=getComputedStyle(el);if(cs.position!=="fixed"&&cs.position!=="absolute")continue;if(cs.pointerEvents==="none")continue;var r=el.getBoundingClientRect();if(r.width<innerWidth*0.9||r.height<innerHeight*0.8)continue;if(el.querySelector("button,input,textarea,select,[contenteditable]"))continue;if((el.textContent||"").length>40)continue;el.style.setProperty("pointer-events","none","important");n++}log("touch passthrough layers="+n);return n}function fixClip(){var c=conv();if(!c)return false;var list=clipping();var before=c.scrollHeight-c.clientHeight;var n=0;for(var i=0;i<list.length;i++){if(!c.contains(list[i]))continue;set(list[i],"height","auto");set(list[i],"overflow","visible");n++}if(!n)return false;var after=c.scrollHeight-c.clientHeight;log("clip grow layers="+n+" max "+before+"->"+after);if(after<=before+8){undoAll();log("clip grow ineffective -> reverted");return false}return true}function fix(){if(convScrolls()){log("official scroll layer works; done");return true}var list=clipping();var clip=list[0];log("clipping="+list.length+(clip?(" first="+String(typeof clip.className==="string"?clip.className:"")+" "+clip.clientHeight+"/"+clip.scrollHeight):""));var root=document.getElementById("root");set(document.documentElement,"height","100%");set(document.body,"height","100%");set(document.body,"overflow","hidden");set(root,"height","100dvh");set(root,"min-height","0");set(root,"overflow","hidden");var n=clip,d=0;while(n&&n!==document.body&&d<8){var cs=getComputedStyle(n);if(cs.display.indexOf("flex")>=0||cs.display.indexOf("grid")>=0)set(n,"min-height","0");n=n.parentElement;d++}var ok=convScrolls();log("chainFix convScroll="+(conv()?(conv().clientHeight+"/"+conv().scrollHeight):"n/a")+" scrollable="+ok);if(!ok){undoAll();log("ineffective -> reverted (stock page)")}return ok}var done=false,tries=0;function run(){if(done)return;var narrow=self.matchMedia?self.matchMedia("(max-width: 1023px)").matches:false;var mobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent||"");log("narrow="+narrow+" mobile="+mobile+" innerH="+innerHeight+" vv="+(self.visualViewport?self.visualViewport.height:"-")+" pageScrolls="+pageScrolls());if(!narrow||!mobile){done=true;return}if(overlayOpen()){undoAll();log("overlay/dialog open -> reverted");return}touchPassThrough();if(fixClip()){log("clip released -> max="+(conv().scrollHeight-conv().clientHeight));done=true;return}if(convScrolls()){log("official scroll layer already works");done=true;return}if(fix())done=true}run();var t=setInterval(function(){tries++;run();if(done||tries>30)clearInterval(t)},1500);}catch(e){}})()<\/script>`;
|
|
3193
3218
|
}
|
|
3194
3219
|
/**
|
|
3195
3220
|
* Insert the narrow-screen scroll correction.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-lan-guard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "DSH web plugin: expose the official desktop Web UI to the local network through a gated reverse proxy, without touching DSH's own loopback binding.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
30
|
-
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.
|
|
31
|
-
"@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.
|
|
30
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.3.0",
|
|
31
|
+
"@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.3.0",
|
|
32
32
|
"@deepseek-ai/schemastery": "^3.18.4"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dsh": {
|
|
52
52
|
"manifestVersion": 1,
|
|
53
53
|
"engines": {
|
|
54
|
-
"dsh": ">=0.1.7-rc.1 <0.
|
|
54
|
+
"dsh": ">=0.1.7-rc.1 <0.3.0"
|
|
55
55
|
},
|
|
56
56
|
"bundle": {
|
|
57
57
|
"patch": "./cordis.patch.yml"
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
"compatibility": {
|
|
69
69
|
"dshReleases": {
|
|
70
70
|
"0.1.7-rc.2": "compatible",
|
|
71
|
-
"0.1.7-rc.1": "compatible"
|
|
71
|
+
"0.1.7-rc.1": "compatible",
|
|
72
|
+
"0.2.0-rc.1": "compatible"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
},
|