dsh-config-manager 0.4.2 → 0.4.3
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/README.md +14 -0
- package/lib/client.d.ts +5 -0
- package/lib/client.js +629 -566
- package/lib/core/access-mode.d.ts +25 -0
- package/lib/core/access-mode.js +28 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/routes/kit.d.ts +40 -1
- package/lib/routes/kit.js +43 -3
- package/lib/routes/request-trust.d.ts +28 -0
- package/lib/routes/request-trust.js +65 -0
- package/package.json +1 -1
- package/src/client/about/AboutPanel.tsx +7 -0
- package/src/client/common/access-mode.ts +21 -0
- package/src/client/home/HomePanel.tsx +31 -6
- package/src/client/locales/about.ts +6 -0
- package/src/client/locales/overview.ts +8 -0
- package/src/core/access-mode.ts +37 -0
- package/src/index.ts +6 -6
- package/src/routes/kit.ts +69 -3
- package/src/routes/request-trust.ts +97 -0
package/README.md
CHANGED
|
@@ -627,6 +627,20 @@ dsh-config-manager web # starts it and opens your browser (the termin
|
|
|
627
627
|
- **Safety:** loopback-only binding; a one-time token printed to your terminal is exchanged for an HttpOnly + SameSite=Strict session cookie; the page has no scripts and no external resources. `Ctrl+C` or the idle timeout (30 minutes by default) shuts it down.
|
|
628
628
|
- **Preconditions:** session relocation and restore need DSH stopped; with an unresolved SAFE MODE transaction or a leftover environment lock every write action is refused (the page says why). **Import** (writing a bundle back into this machine) stays on the GUI/CLI — structural sections need live DSH services.
|
|
629
629
|
|
|
630
|
+
### 🔒 Opening the panel from another machine (LAN / tunnel)
|
|
631
|
+
|
|
632
|
+
The panel's API is fenced: every `/api/dsh-config-manager/*` request is accepted only from **loopback** (`127.0.0.1` / `localhost`), or from an address and session the host itself already trusts.
|
|
633
|
+
|
|
634
|
+
```bash
|
|
635
|
+
# recommended: keep the host on loopback and tunnel in
|
|
636
|
+
ssh -L 3080:127.0.0.1:3080 you@server # then open http://localhost:3080
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
- **Why it is fenced:** these endpoints read and write local files, credentials-backed sync settings and snapshots. Loopback requests are let through; anything else is decided by the host itself (Host / bind address, same-origin, and a signed `dsh-auth` session cookie). The plugin never validates sessions on its own, so a proxy or tunnel in front of it still needs its own auth.
|
|
640
|
+
- **`dsh web --host <LAN address>`:** the page itself loads from another machine, but the panel then only works if the host trusts that address **and** the browser carries a signed `dsh-auth` session cookie. `--host` takes one concrete interface address — wildcard addresses such as `0.0.0.0` are rejected by the host. Behind a proxy, add the authority the browser uses with `--trusted-host <authority>` (repeatable, `host` or `host:port`); `--public-url` advertises a URL but grants no trust.
|
|
641
|
+
- **What you see when it is not allowed:** a single **“This page cannot read local data from its current address”** banner with the page's origin and the fix — not a generic “5 requests failed”, and no useless Retry button.
|
|
642
|
+
- **Not affected:** the CLI (`dsh-config-manager …`) and the agent tools (`config_backup`, `config_list_snapshots`, `config_sync_*`) never go through this fence.
|
|
643
|
+
|
|
630
644
|
### 🌐 Behind a proxy? (GitHub login / sync)
|
|
631
645
|
|
|
632
646
|
Node's built-in `fetch()` does **not** read `HTTP_PROXY` / `HTTPS_PROXY` by default, so on networks where GitHub is only reachable through a local proxy, "Sign in with GitHub" would previously fail with `请求 GitHub 设备码失败:fetch failed` even though your browser and `git` work fine.
|
package/lib/client.d.ts
CHANGED
|
@@ -5100,6 +5100,9 @@ declare const zh$4: {
|
|
|
5100
5100
|
readonly 'overview.activity.empty': '暂无操作记录';
|
|
5101
5101
|
readonly 'overview.activity.unavailable': '活动记录读取失败(这不是「没有记录」)';
|
|
5102
5102
|
readonly 'overview.loadFailed': '有 {count} 项数据读取失败:{message} —— 下面的指标可能不完整';
|
|
5103
|
+
readonly 'overview.accessMode.title': '当前访问方式不被允许读取本机数据。';
|
|
5104
|
+
readonly 'overview.accessMode.origin': '页面地址:{origin}。';
|
|
5105
|
+
readonly 'overview.accessMode.hint': '面板只接受本机回环访问,或宿主已信任的地址与已登录会话。改法:用 ssh -L 3080:127.0.0.1:3080 隧道后从 localhost 打开;或以 dsh web --host 127.0.0.1 启动后在本机访问;若本就在可信地址上,重新打开 dsh web 打印的访问链接(会话可能已过期)。';
|
|
5103
5106
|
readonly 'overview.empty.title': '开始保护你的配置';
|
|
5104
5107
|
readonly 'overview.empty.step1': '创建第一份备份';
|
|
5105
5108
|
readonly 'overview.empty.step2': '导出 ZIP 带走';
|
|
@@ -5455,6 +5458,8 @@ declare const zh$4: {
|
|
|
5455
5458
|
readonly 'about.cli.title': 'CLI 救援工具';
|
|
5456
5459
|
readonly 'about.cli.hint': 'GUI 运行在 DSH 内部——DSH 无法启动时,独立安装的 CLI(dsh-config-manager)是第一救援手段:列快照 / 离线恢复 / 一键重装 DSH,全程无需 DSH 运行。安装一次即可在任何机器上用:';
|
|
5457
5460
|
readonly 'about.cli.docs': 'CLI 使用文档';
|
|
5461
|
+
readonly 'about.access.title': '访问范围';
|
|
5462
|
+
readonly 'about.access.hint': '本面板只接受两种来源:本机回环地址(127.0.0.1 / localhost),或宿主已信任的地址与已登录的 dsh web 会话。用 dsh web --host <局域网地址> 启动后从别的机器打开时,页面能加载但读不到本机数据——改用 ssh -L 3080:127.0.0.1:3080 隧道从 localhost 打开即可。CLI 与 agent 工具不受此限制。';
|
|
5458
5463
|
readonly 'profiles.title': '档案';
|
|
5459
5464
|
readonly 'profiles.subtitle': '管理 DSH 自带的 profile($DSH_HOME/profiles/<name>):每个档案 = 一套插件组合(bundles)+ 依赖 + patch 层,用 dsh --profile <name> 启动。';
|
|
5460
5465
|
readonly 'profiles.loading': '加载档案中…';
|