@mrrisega/dsh-remote 0.3.0

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.
@@ -0,0 +1,81 @@
1
+ # dsh-remote-ui — dsh web 远程控制插件
2
+
3
+ Embeds the dsh-remote configuration UI into dsh web itself (the "everything is a
4
+ plugin" model):
5
+
6
+ - Entry point: the **Settings** page, via the official `settings.section`
7
+ extension point (`order: 30`, below "Agent presets").
8
+ - Inline configuration panel:
9
+ - Connection-mode tabs: **Cloud service** (SaaS) / **Self-hosted**
10
+ - Remote-control URL (from the relay `public-config` `app_url`, copyable)
11
+ - Account: phone + password login/save, registration (with SVG captcha);
12
+ signed-in state shows plan / upgrade / invite / feedback / **sign out**
13
+ - Bridge service: launchd status (pid), start/stop switch; shows device id and
14
+ autostart state — never exposes config paths or passwords
15
+ - **About dsh-remote** card (for newcomers: SaaS convenience, bandwidth costs,
16
+ self-hosting option)
17
+ - **User feedback** card (submodule of the commercial edition): submit
18
+ feedback (category + captcha anti-abuse) and track "my feedback" threads
19
+ with admin replies; satisfaction popup ~10 minutes after first use
20
+ - First-run hint: a red dot on the "Remote Control" entry (localStorage
21
+ `dsh-remote-seen-dot`).
22
+ - Config file: `~/.dsh-remote/.dsh-config.json` by default (0600), overridable
23
+ via the entry config `relayDir` or `DSH_RELAY_DIR`.
24
+
25
+ ## Architecture (dual-half plugin)
26
+
27
+ | Half | File | Responsibility |
28
+ |---|---|---|
29
+ | Node half (host plugin) | `lib/index.js` | Injects `webServer`; same-origin `/dsh-remote/*` routes: status / config / start / stop / captcha / register / login / remote-url / feedback proxy; relay requests bypass system proxies (6s timeout) |
30
+ | Browser half (client plugin) | `lib/client.js` | Hand-written `__ModuleLoader__.load({id, factory})` bundle (no build step); registers the `settings.section` entry + satisfaction popup; only requires `react` (seed module) |
31
+
32
+ The browser half needs no Vite/tsdown rebuild: `dsh-client-modules` reads
33
+ `exports["./client"]` at startup and serves it with index.html (restart
34
+ `dsh web` after changes).
35
+
36
+ ## Install / Uninstall
37
+
38
+ `npx @mrrisega/dsh-remote`(一键安装)会自动把插件装进 dsh web 默认 profile。
39
+ 也可以单独管理:
40
+
41
+ ```bash
42
+ # 单独安装/重装(把插件装进 dsh web 默认 profile)
43
+ npx @mrrisega/dsh-remote plugin
44
+
45
+ # 卸载
46
+ npx @mrrisega/dsh-remote plugin --uninstall
47
+ ```
48
+
49
+ What it does:
50
+
51
+ - `package.json` dependency: `"dsh-remote-ui": "link:<包目录>/packages/dsh-remote-ui"`
52
+ - `cordis.patch.yml` insert: `{ id: dsh-remote-ui, name: 'dsh-remote-ui', config: { relayDir: '~/.dsh-remote' } }`
53
+ - runs `pnpm install` (fallback `npm install`) in the profile
54
+
55
+ Restart `dsh web` afterwards. Manual alternative: edit the two files above and
56
+ restart.
57
+
58
+ > Note: a failing browser plugin blocks the whole web app from starting
59
+ > (framework constraint). Rollback = remove the patch entry and restart.
60
+
61
+ ## Development
62
+
63
+ ```sh
64
+ # node half: restart dsh web (profile uses link: dependency, source is live)
65
+ # browser half: edit lib/client.js, restart dsh web (no build)
66
+ dsh --profile web --port 3090 --no-open # verify on a separate port, 3080 untouched
67
+ ```
68
+
69
+ Verify: `/` `__DSH_BOOT__` contains `dsh-remote-ui`; `/plugins/dsh-remote-ui/client.js`
70
+ 200; `/dsh-remote/status` returns JSON; panel renders in headless Chrome.
71
+
72
+ ## Known limitations
73
+
74
+ - The entry uses the official Settings-page slot (`settings.section`, `order: 30`).
75
+ - First-run red dot relies on DOM fallback injection (MutationObserver matching
76
+ the nav cell class + "远程控制" text); if the hash/wording changes the dot
77
+ simply won't show — the panel itself is unaffected.
78
+ - Start/stop switches call launchctl (same bootstrap/bootout logic as
79
+ `dsh-setup.mjs`).
80
+ - Feedback API defaults to the account API base (`cfg.api_url`); self-hosted or
81
+ compatible implementations can override with `feedback_url` in the config.