docs: install from the git address or a tarball, and say why the npm source cannot work

Gitea's npm registry returns a fixed field set, so the dsh field never reaches the installer's registry preflight and the install is refused with 'declares no dsh.bundle'. The tarball and the git address carry the real package.json, so they are the routes that work.
This commit is contained in:
pyh
2026-09-30 12:03:03 +08:00
parent dbf6138df2
commit b9445cbf4d
+14 -25
View File
@@ -48,41 +48,30 @@ DSH 原本只能归档会话——归档只是把会话从列表里移开,日
## 安装 ## 安装
在 DSH 的 **插件 → 添加插件** 里三选一。 在 DSH 的 **插件 → 添加插件** 里填下面任意一种。
### 1. npm 包(推荐) ### 1. Git 仓库地址(推荐)
安装源选 **自定义地址**,填本插件的注册表:
```text
https://gitea.iwake.top/api/packages/dsh-plugin/npm/
```
包名填:
```text
@dsh-plugin/session-delete
```
包是公开的,不需要凭据。若你的环境需要认证,把令牌写进本机 `~/.npmrc`:
```bash
npm config set @dsh-plugin:registry=https://gitea.iwake.top/api/packages/dsh-plugin/npm/
npm config set //gitea.iwake.top/api/packages/dsh-plugin/npm/:_authToken=<token>
```
### 2. Git 仓库地址
```text ```text
https://gitea.iwake.top/dsh-plugin/session-delete.git#v1.0.1 https://gitea.iwake.top/dsh-plugin/session-delete.git#v1.0.1
``` ```
`#` 后面可以跟标签或提交,用来锁定版本。仓库是公开的,不需要凭据。 `#` 后面可以跟标签或提交,用来锁定版本;不写则取默认分支。仓库是公开的,不需要凭据。
### 3. 本地 tgz ### 2. 本地 tgz
把 [session-delete-1.0.1.tgz](https://gitea.iwake.top/api/packages/dsh-plugin/npm/@dsh-plugin%2Fsession-delete/-/1.0.1/session-delete-1.0.1.tgz) 下载到运行 DSH 的机器上,在安装界面里填它的绝对路径。 把 [session-delete-1.0.1.tgz](https://gitea.iwake.top/api/packages/dsh-plugin/npm/@dsh-plugin%2Fsession-delete/-/1.0.1/session-delete-1.0.1.tgz) 下载到运行 DSH 的机器上,在安装界面里填它的绝对路径。
### 关于「npm 源」这种方式
本插件也发布在自建 Gitea 的 npm 仓库里(`https://gitea.iwake.top/api/packages/dsh-plugin/npm/`,包名 `@dsh-plugin/session-delete`),但**目前不能用它安装**:Gitea 返回包清单时只保留 `name`、`version`、`description`、`author`、`homepage`、`license`、`repository`、`readme`、`dist`、`maintainers` 这些字段,插件需要的 `dsh`(即 `dsh.bundle.patch`)会被丢掉;而 DSH 的安装预检要求清单里声明 `dsh.bundle`,于是会报:
```text
这个包没有声明组合包,无法作为插件安装:@dsh-plugin/session-delete declares no dsh.bundle
```
git 地址与 tgz 这两条路没有这个问题——它们是先把包取到本地、再读它自己的 `package.json`,字段完整。如果将来把它发到保留自定义字段的注册表(npmjs 等),npm 源那条路才走得通。
安装或升级后:**宿主半变更需要重启 DSH**(完全退出再打开,仅关闭窗口不一定退出进程);只改浏览器半时刷新页面即可。 安装或升级后:**宿主半变更需要重启 DSH**(完全退出再打开,仅关闭窗口不一定退出进程);只改浏览器半时刷新页面即可。
## 兼容性 ## 兼容性