packages/dsh-remote-web-ui
zhu1090093659/dsh-web手机/PC 远程操控 dsh web 工作区:扫码配对、令牌门控通道、SSE 实时同步,提供移动端与完整桌面 GUI 两种远程形态。
把本地 dsh 网页通过带登录门禁的中继转发到公网 *.ds.hn 子域名(也可自托管到自己的域名),支持可选的端到端加密(PBKDF2 到 AES-256-GCM)。
The dsh plugin half of dshn. It opens one outbound WebSocket
to the relay, claims a subdomain with the (subdomain, password) the user typed in
the setup dialog, and replays whatever the relay forwards against the local dsh
web server — HTTP over node:http, dsh's own /api/events.* downlink sockets
over a tunnelled ws client.
Two halves:
src/index.ts → lib/index.js): the tunnel client, the replay
engine, the reconnect/heartbeat loop, credential persistence, and the
/dshn/status · /dshn/configure · /dshn/disconnect routes.client.js, hand-authored factory format): a shell.overlay
pill that opens the setup dialog when unconfigured (subdomain + password),
or the live status + public URL when connected.trustedHosts patchThe agent rewrites each forwarded request's Host/Origin to the local loopback
authority before replaying it to dsh. dsh's /api browser-trust fence then
accepts it as a loopback, same-origin request — for any subdomain, with no
composition-time trusted-host entry. That is what lets the subdomain be chosen at
runtime in the dialog; access is gated by the relay's login instead of the fence.
Credentials (subdomain + password) are not configured here — the user sets
them in the dialog (POST /dshn/configure, loopback-only) and they persist to
DSHN_STATE. Only infrastructure is env-configured:
| env | meaning | default |
|---|---|---|
DSHN_RELAY_HOST | host the tunnel dials | relay.ds.hn |
DSHN_ORIGIN_CA | PEM cert to pin when dialing a direct grey-cloud origin | — |
DSHN_STATE | file the chosen credentials persist to | ~/.dshn-agent.json |
DSHN_LOCAL_PORT | local dsh port to replay against | the web server's port |
DSHN_ENABLED | 0 loads the plugin inert | 1 |