@hao0311/dsh-toolbox 0.5.4 → 0.5.5
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 +4 -0
- package/README.md +93 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# dsh-toolbox
|
|
2
2
|
|
|
3
|
-
> English
|
|
4
|
-
|
|
3
|
+
> 英文版在本文末尾([English](#english)),也可单独看 [README.en.md](README.en.md)。
|
|
5
4
|
DSH Web GUI 里的工具箱:左侧导航(手机上在抽屉里)多一行「工具箱」,点开是一个右侧抽屉
|
|
6
5
|
(手机端全屏,可随时退出、任务在后台继续)。
|
|
7
6
|
|
|
@@ -98,3 +97,95 @@ window.DSHToolbox.register({
|
|
|
98
97
|
- 直接请求 `/api/toolbox/net/info`,应返回 `{ ok: true, ip, host, ... }`。
|
|
99
98
|
- 本地验证脚本:`.cdp-verify/cdp-toolbox.js`(桌面/手机截图)、
|
|
100
99
|
`.cdp-verify/cdp-toolbox-func.js`(点按钮、跑体检/测速/监控、验证后台继续)。
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
# English
|
|
104
|
+
|
|
105
|
+
> Also available as a standalone file: [README.en.md](README.en.md).
|
|
106
|
+
|
|
107
|
+
A toolbox inside the DSH Web GUI: one more row in the left navigation (inside the drawer on phones) that opens a right-side drawer — full screen on phones, closable at any time, with measurements continuing in the background.
|
|
108
|
+
|
|
109
|
+
On desktop the main page **makes room**: the drawer takes width, the chat content shifts left instead of being covered. In narrow windows (content under ~640 px after shifting) the left navigation also collapses into an icon rail, and restores when the panel closes. The drawer width adapts between 424 px and 340 px.
|
|
110
|
+
|
|
111
|
+
## The friction this removes
|
|
112
|
+
|
|
113
|
+
- When the model says "the network is slow", you cannot tell whether it is the model, a proxy, or your Wi-Fi — so you guess.
|
|
114
|
+
- Verifying means opening a speed-test site and a packet tool in another tab, then pasting the conclusion back into the chat.
|
|
115
|
+
|
|
116
|
+
## After installing
|
|
117
|
+
|
|
118
|
+
- One sidebar row: connection type (LAN / Tailscale / public, Wi-Fi band, channel, rate, signal), one-click health check, speed test and quality monitor in a single drawer.
|
|
119
|
+
- Speed tests are server-timed with four concurrent streams; closing the drawer does not stop them, and the chart is there when you return.
|
|
120
|
+
- Results are summarised and copied into the conversation in one click, so the model no longer has to guess which hop is slow.
|
|
121
|
+
- On desktop the page makes room instead of being covered; on phones the drawer is full screen.
|
|
122
|
+
|
|
123
|
+
## Features
|
|
124
|
+
|
|
125
|
+
| Area | What it does |
|
|
126
|
+
|---|---|
|
|
127
|
+
| Connection | Refreshed on open: LAN / loopback / Tailscale / public, client IP, local address, public egress, Wi-Fi band, channel, rate and signal |
|
|
128
|
+
| One-click check | Opening the panel runs a **light** check (~1–2 s, small requests only); the button runs a **full** check (gateway ping, DNS, public egress) and grades it good / fair / poor with suggestions |
|
|
129
|
+
| Speed test | Quick 20 MB / standard 100 MB / extreme 500 MB / 30 s continuous / custom (download, upload, duration). Server-side timing, 4 concurrent streams, live chart — keeps running after you close the panel |
|
|
130
|
+
| Quality monitor | 30 s / 1 min / 3 min low-traffic sampling (a small request every 0.3 s) producing a latency chart, packet loss and stall spikes — for "it feels laggy", not for bandwidth |
|
|
131
|
+
| History | Checks, speed tests and monitors are stored locally (localStorage, last 40), and each speed test is compared with the previous one |
|
|
132
|
+
| Auto patrol | While the page is open, 3 light probes every 3/5/10 minutes; a red dot on the nav entry and an in-panel hint when the network degrades |
|
|
133
|
+
| Share / report | Builds a short summary (connection type, check result, speed, monitor, advice) with one-click copy |
|
|
134
|
+
|
|
135
|
+
## Implementation
|
|
136
|
+
|
|
137
|
+
- **Host `index.js`** registers `/api/toolbox/net/*` through `ctx.connection.fetch.register` (download stream, upload stream, info, diagnostics, server timing, status) and inlines `client.css` / `client.js` into `index.html` via the official `webserver/index-inject` hook. The host reads this file once at startup; CSS and JS are read on every page load, so UI changes need no restart.
|
|
138
|
+
- **Client `client.js`** is pure DOM injection — no React dependency, no layout changes to DSH. The measurement engine is decoupled from the panel: close the panel and the job keeps running; reopen it and you see live state. A dot on the nav row and a 2 px progress line at the top indicate a background job.
|
|
139
|
+
- **Auth**: routes live under `/api` and inherit the connection layer's Host/Origin + cookie checks.
|
|
140
|
+
|
|
141
|
+
## How measurement works
|
|
142
|
+
|
|
143
|
+
| Item | Method |
|
|
144
|
+
|---|---|
|
|
145
|
+
| Download | `GET /api/toolbox/net/download?mb=N` streams N × 1 MiB of random data; the client counts as it reads, and the number is **server-timed** |
|
|
146
|
+
| Upload | `POST /api/toolbox/net/upload`; the browser posts a random Blob, the server counts bytes and returns first-byte → last-byte duration |
|
|
147
|
+
| Latency / jitter / loss | Repeated small requests to `/api/toolbox/net/info`; timeouts count as loss |
|
|
148
|
+
|
|
149
|
+
> Running it on the same machine goes over loopback, where numbers inflate to GB/s levels — the panel labels that case as "local loopback".
|
|
150
|
+
|
|
151
|
+
## Install / update
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
dsh plugin --profile web add github:Hao0311/dsh-toolbox
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> npm hosts a **different, same-named** package `dsh-toolbox` (stock tracking + novel reader). `dsh plugin add dsh-toolbox` installs the wrong one; use the `github:` source above, or the scoped npm name `@hao0311/dsh-toolbox`.
|
|
158
|
+
|
|
159
|
+
For development, this directory ships a sync script that copies it into `~/.dsh/profiles/web/node_modules/dsh-toolbox/` and adds an `insert:` entry inside a marker block of `cordis.patch.yml` (idempotent):
|
|
160
|
+
|
|
161
|
+
```powershell
|
|
162
|
+
powershell -NoProfile -File D:\Workspaces\DSH\plugins\dsh-toolbox\install.ps1
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- **Only `client.js` / `client.css` changed**: run install.ps1 and reload the page — no DSH restart.
|
|
166
|
+
- **`index.js` changed**: restart DSH (plugins load at startup).
|
|
167
|
+
|
|
168
|
+
## Adding your own tool
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
window.DSHToolbox.register({
|
|
172
|
+
id: 'my-tool', // unique
|
|
173
|
+
title: 'My tool',
|
|
174
|
+
hint: 'one line', // optional
|
|
175
|
+
render(container) { // draw into a plain DOM node
|
|
176
|
+
container.textContent = 'hello';
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Registration order is the order shown under "more tools" at the bottom of the panel.
|
|
182
|
+
|
|
183
|
+
## Self-check
|
|
184
|
+
|
|
185
|
+
- Search the page source for `__DSH_TOOLBOX__` (the host-injected global reporting injected lines and route status).
|
|
186
|
+
- Request `/api/toolbox/net/info` directly; it should return `{ ok: true, ip, host, ... }`.
|
|
187
|
+
- Local verification scripts: `.cdp-verify/cdp-toolbox.js` (desktop/mobile screenshots) and `.cdp-verify/cdp-toolbox-func.js` (click through checks, speed test, monitor, background continuation).
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT
|