packages/dsh-remote-web-ui
zhu1090093659/dsh-web手机/PC 远程操控 dsh web 工作区:扫码配对、令牌门控通道、SSE 实时同步,提供移动端与完整桌面 GUI 两种远程形态。
移动端访问网关:独立子进程反向代理 + 首次访问 PC 审批(管理 token 认证、DNS rebinding 防护)+ 局域网/VPN/公网自动识别与网络模式切换 + 扫码访问 + WebSocket 实时转发 + 窄屏 UI 适配(输入区重排、第三方插件弹窗适配、crypto.randomUUID polyfill)。
Mobile access plugin for DeepSeek Harness
Let phones and tablets reach the DeepSeek Harness Web GUI over LAN or VPN, with a built-in PC-side approval gate, automatic LAN / VPN / WAN detection, and network-mode switching.
For security, the DeepSeek Harness web server binds 127.0.0.1 only, and --host 0.0.0.0 is intentionally disallowed. This plugin works through the plugin runtime (webServer + subprocess): the PC starts a gateway proxy (0.0.0.0:<port>) with one click, phones scan a QR code to connect, and first access must be approved on the PC — keeping unauthorized devices out.
/api/events.mux and /api/events.host WebSocket channels — messages arrive live, no manual refresh--dsw-alias-*), adapting to light / dark themes and third-party skins (e.g. dsh-deep-whale)$DSH_HOME/dsh-mobile/state.json and survive restartsThis is a static cordis plugin package that loads automatically when DSH starts — the same installation model as official plugins (e.g. dsh-balance-plugin).
dsh plugin command# local directory install (development)
dsh plugin --profile web add dsh-mobile-access
# or install from GitHub (pinned to release v1.0.4)
dsh plugin --profile web add dsh-mobile-access@github:TongaiLinC/dsh-mobile-access#v1.0.4
Edit $DSH_HOME/profiles/web/package.json:
{
"dsh": { "profile": { "bundles": [ /* ... existing bundles ... */ "dsh-mobile-access" ] } },
"dependencies": {
// local development: link to the repo dir; production: use the GitHub address
"dsh-mobile-access": "github:TongaiLinC/dsh-mobile-access"
}
}
Then run pnpm install (or npm install) inside the profile directory and restart DSH. The plugin is active when the blue 「📱」 floating button appears at the bottom-right of the PC page.
✅ After a production install there is no need to redeploy on every restart (unlike the dynamic build); device and policy data stay in
$DSH_HOME/dsh-mobile/state.jsonand are shared with the dynamic build.
Run the content of dsh-mobile-access.js as code.host in a Web GUI session via cordis_define + cordis_run. The dynamic build is process-scoped and must be redeployed after each DSH restart; it suits fast iteration, while production use should prefer options 1/2.
3081, TCP inbound) through the firewallThis plugin is developed with DeepSeek Harness in Create mode:
deepseek-v4-flash (Max mode)deepseek-v4-pro (Max mode)Mobile adaptations are verified with Playwright in real browsers (iPhone / Android viewports).
Click the bottom-right 「📱」 button to open the "Mobile Access" panel:
0.0.0.0:3081; the port is configurable);http://<PC-LAN-IP>:3081 in the browser (copyable from the panel).LAN / VPN / direct WAN; tap it for a hint;| Status | Available actions |
|---|---|
| Pending | Approve / Reject |
| Approved | Revoke (keep record) / Revoke & forget (revoke + delete record, with confirmation) |
| Rejected / Revoked | Restore / Delete record |
dsh-mobile-access/ # this repo IS an installable DSH plugin package (npm layout)
├── package.json # package manifest: dsh.bundle.patch points at cordis.patch.yml
├── cordis.patch.yml # composition patch: inserts the plugin row into the profile
├── lib/index.js # Host plugin body (static cordis plugin, ESM)
├── dsh-mobile-access.js # dynamic source (code.host function body for in-session cordis_define)
├── README.md / README.en.md # bilingual readmes
└── CHANGELOG.md # version changelog
phone ──> http://<LAN-IP>:3081 (gateway proxy, 0.0.0.0)
│ gate decision (x-dshm-real-ip / x-dshm-forwarded-host trusted from loopback only)
│ unapproved device → 302 gate page; approved device → forwarded
▼
127.0.0.1:3080 main server (Host rewritten to 127.0.0.1 to pass the /api trust fence)
│ injects boot.js (PC panel / phone gate / mode popup / badge / QR)
▼
state persisted to $DSH_HOME/dsh-mobile/state.json
Key mechanisms:
webServer.tapIndex injects /dsh-mobile/api/boot.js into every GUI page (PC panel, phone gate, mode popup, QR code) and prepends a crypto.randomUUID polyfill into <head> (phones reach the GUI over http://<IP>, a non-secure context where several product UIs depend on that API and would crash without it);webServer.register serves the /dsh-mobile/api/* endpoints and the /dsh-mobile/gate.html gate page;subprocess spawns the node gateway proxy process, forwarding HTTP and WebSocket (including the 101 upgrade handshake);fs.Q: The phone can't open http://<IP>:3081?
Check: phone and PC on the same LAN; the gateway is running (visible in the panel); Windows firewall allows the port (Windows Security → Firewall → allow node.exe private-network inbound).
Q: The plugin is gone after a DSH restart?
The dynamic build is process-scoped and must be redeployed as described under Installation; device and policy data remain in $DSH_HOME/dsh-mobile/state.json.
Q: Some phone pages are blank / throw errors?
Force-refresh the page (to pull the latest boot.js). Most remaining issues come from the non-secure context missing crypto.randomUUID — the plugin ships a polyfill; if it still occurs, report the "boot version" shown at the bottom of the PC panel to the author.
Q: Can WAN connect directly? Yes, but using a VPN (Tailscale / ZeroTier) is strongly recommended; enable "Block direct WAN" in the PC panel to force VPN-only access.
Q: The phone can't connect after changing the gateway port? After saving the policy, restart the gateway (stop then start) and make sure the firewall allows the new port.
dsh-balance-plugin (DeepSeek balance monitoring and usage statistics: balance monitoring · official top-up entry · Miyu-style usage stats · third-party plugin management) renders its overlay inline in the input bar, which causes mobile issues such as truncated overlays, overlays covered by the sidebar/topbar, and overflowing detail tables — this plugin ships a complete adaptation suite (overlay stacking/position fixes, render-level verification, iOS overlay migration, horizontal table scrolling). No extra configuration needed after installation. See section 8.4 of the docs.
Full development and usage documentation lives on the docs site: "DSH Guide → Chapter 17 Mobile Access Plugin" — https://docs.tongai.vip/docs/dsh/zhinandaodu.html (17 chapters: installation, PC panel, phone flows, network-detection algorithms, gateway proxy, API reference, persistence, mobile UI adaptations, and more).
MIT