dshmarket 1.32.0 → 1.34.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.
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/UPDATE-API-V1.md +115 -0
- package/client/client.js +257 -60
- package/client/client.js.map +1 -1
- package/lib/check.js +28 -5
- package/lib/routes.js +282 -6
- package/lib/types/update-api-v1.d.ts +66 -0
- package/lib/update-api-v1.js +207 -0
- package/package.json +6 -1
- package/src/check.ts +32 -6
- package/src/client/CommentsModal.tsx +116 -0
- package/src/client/Market.module.css +20 -0
- package/src/client/MarketSection.tsx +20 -0
- package/src/client/comments.ts +41 -0
- package/src/client/locales.ts +69 -55
- package/src/routes.ts +286 -6
- package/src/update-api-v1.ts +266 -0
package/README.md
CHANGED
|
@@ -31,12 +31,14 @@ its own dsh: it may be older than the one `npm` would give you (#139).
|
|
|
31
31
|
|
|
32
32
|
## What you get
|
|
33
33
|
|
|
34
|
-
- **Browse & search** the full community catalog (
|
|
34
|
+
- **Browse & search** the full community catalog (2300+ plugins, growing daily) — category filters, star counts, top/new sorting, bilingual descriptions that follow your UI language
|
|
35
35
|
- **Screenshots** — AppStore-style screenshots, auto-carousel when there's more than one, click to preview full-size: author-curated shots show right on the card (zero extra requests); plugins without curated shots fall back to automatic README extraction once you open the install dialog. Images load from GitHub hosting only
|
|
36
|
+
- **Comments** — every card opens the plugin's discussion thread in place. It is the same thread its pages on [dshmarket.com](https://dshmarket.com) and the [catalog](https://awesome-dsh-plugin.com) show, so a plugin has one conversation rather than three. Backed by GitHub Discussions through giscus: it loads when you open it, needs a GitHub account only to post, and the note above it says plainly that opening it contacts giscus.app and GitHub
|
|
36
37
|
- **Themes** — a dedicated tab for community themes and skins: install → active immediately, switch with one click (themes are mutually exclusive, your choice survives restarts), uninstall to revert
|
|
37
38
|
- **One-click install** — confirm the source, watch live progress; most plugins go live after a page refresh, no restart
|
|
38
39
|
- **Backup & restore** — export your profile's plugin list and configuration as readable JSON, import it on another machine, store it on WebDAV with daily auto-backup, or sync through a private GitHub Gist; restores **merge** (plugins installed after the backup are kept), validate before writing, and roll back on failure
|
|
39
40
|
- **Updates** — per-plugin update checks (npm version or pinned commit vs HEAD), one-click update, or update everything at once; the market updates itself the same way
|
|
41
|
+
- **Public update API** — plugin-owned settings pages can use the versioned, capability-gated [update API v1](UPDATE-API-V1.md) (beta) instead of copying package-manager logic or depending on private Market UI responses
|
|
40
42
|
- **Uninstall** — two-step confirm; plugins installed this session are removed live
|
|
41
43
|
- **Hot disable / enable** — toggles write `- id: …` + `disabled: true|false` into the profile's `cordis.patch.yml` (the official patch layer, mechanism ported from [dsh-plugin-hub](https://github.com/Noob-stupid/dsh-plugin-hub)): DSH's HMR re-composes within ~1s, no restart, and the loader re-applies the choice on every boot; hand-edited patch rows show as badges, host-infrastructure plugins are protected from toggling, and a malformed patch file is never made worse
|
|
42
44
|
- **Restart when needed** — changes that cannot hot-load show a one-click restart beside the pending-change banner; the action is restricted to same-origin loopback requests
|
package/README.zh.md
CHANGED
|
@@ -29,12 +29,14 @@ dsh plugin --profile web add dshmarket
|
|
|
29
29
|
|
|
30
30
|
## 你会得到
|
|
31
31
|
|
|
32
|
-
- **逛与搜**——完整社区目录(
|
|
32
|
+
- **逛与搜**——完整社区目录(2300+ 插件,每天在涨),分类筛选、star 数、最热/最新排序,中英描述跟随界面语言
|
|
33
33
|
- **截图展示**——App Store 式截图,多图自动轮播,点开还能看大图;作者在 registry 里策展的截图列表卡片就直接显示(零额外请求),没有策展的插件则在打开安装弹窗时自动从 README 抽取;图片仅从 GitHub 图床加载
|
|
34
|
+
- **评论**——每张卡片都能就地打开该插件的讨论。它和插件在 [dshmarket.com](https://dshmarket.com) 与[目录站](https://awesome-dsh-plugin.com)上的页面共用同一条讨论,一个插件只有一处对话,而不是三处。底层是 GitHub Discussions(经由 giscus):打开即加载,只有发表评论才需要 GitHub 账号;说明里也直说打开会连接 giscus.app 与 GitHub
|
|
34
35
|
- **主题**——独立主题页:装完立即生效,点一下切换(主题互斥、选择跨重启保留),卸载即恢复
|
|
35
36
|
- **一键安装**——确认来源,实时进度;多数插件刷新页面即可用,无需重启
|
|
36
37
|
- **备份与恢复**——把 profile 的插件清单与配置导出为可读 JSON,换机导入,存到 WebDAV 并每日自动备份,或通过私有 GitHub Gist 跨机器同步;恢复采用**合并**方式(备份之后新装的插件会保留),写入前校验、失败自动回滚
|
|
37
38
|
- **更新**——逐插件检测(npm 版本或锁定 commit 对比 HEAD),一键更新或全部更新;市场自己也走同一通道升级
|
|
39
|
+
- **公共更新接口**——插件自己的设置页可调用带版本号、能力探测和回滚状态的[更新 API v1](UPDATE-API-V1.md)(beta),无需复制包管理逻辑,也不依赖市场 UI 的私有响应字段
|
|
38
40
|
- **卸载**——两步确认防误触;本次会话装的插件即点即卸
|
|
39
41
|
- **热禁用 / 启用**——开关会往 profile 的 `cordis.patch.yml`(官方补丁层,机制移植自 [dsh-plugin-hub](https://github.com/Noob-stupid/dsh-plugin-hub))写入 `- id: …` + `disabled: true|false`:DSH 的 HMR 约 1 秒内重新组合,无需重启,loader 每次启动都会重新应用这个选择;手工改过的补丁行会显示成徽标,宿主基础设施插件禁止开关,补丁文件格式不对时绝不会被写得更糟
|
|
40
42
|
- **按需重启**——无法热加载的变更会在待重启提示旁显示一键重启;操作仅接受本机同源请求
|
package/UPDATE-API-V1.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Public plugin update API v1
|
|
2
|
+
|
|
3
|
+
> **Status: beta.** The shape described here may still change between
|
|
4
|
+
> releases. `GET /dsh-market/api/v1/capabilities` reports
|
|
5
|
+
> `"stability": "beta"` while that is true, and `"stable"` once it stops
|
|
6
|
+
> moving — read that field rather than assuming from the `v1` in the path.
|
|
7
|
+
>
|
|
8
|
+
> Nothing here is going away; what is not yet promised is that field names
|
|
9
|
+
> and response shapes will survive untouched. If you ship against it now,
|
|
10
|
+
> say so in an issue: a shape somebody depends on is a much stronger reason
|
|
11
|
+
> not to move it, and it is how this reaches `stable`.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
`dshmarket` exposes a small, versioned, same-origin JSON API for plugin-owned
|
|
15
|
+
update surfaces. It lets a plugin show its own update button without spawning a
|
|
16
|
+
package manager, copying the Market installation algorithm, or binding to the
|
|
17
|
+
Market UI's private response fields.
|
|
18
|
+
|
|
19
|
+
All responses carry:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{ "schema": "dsh-market/update-api/v1" }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Clients must discover the API before enabling mutation controls:
|
|
26
|
+
|
|
27
|
+
```http
|
|
28
|
+
GET /dsh-market/api/v1/capabilities
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The response names the Market version, profile, runtime (`web` or `desktop`),
|
|
32
|
+
supported features, restart owner and endpoint paths. A client must hide its
|
|
33
|
+
restart button when `restart.supported` is false. Desktop and supervised hosts
|
|
34
|
+
normally delegate restart to their owning shell or operator.
|
|
35
|
+
|
|
36
|
+
## Check one installed package
|
|
37
|
+
|
|
38
|
+
```http
|
|
39
|
+
GET /dsh-market/api/v1/updates?name=dsh-mcp-connector&force=1
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The response includes the installed version, target version, source kind and
|
|
43
|
+
whether the target is a forward update. Omitting `force=1` allows the Market's
|
|
44
|
+
short update-check cache.
|
|
45
|
+
|
|
46
|
+
## Start and observe an update
|
|
47
|
+
|
|
48
|
+
Mutation requests require the same-origin protection used by the Market UI.
|
|
49
|
+
|
|
50
|
+
```http
|
|
51
|
+
POST /dsh-market/api/v1/updates
|
|
52
|
+
Content-Type: application/json
|
|
53
|
+
|
|
54
|
+
{ "packageName": "dsh-mcp-connector" }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
An accepted request returns HTTP `202` immediately with an `operationId`.
|
|
58
|
+
Passing `"force": true` opts this one operation out of the registry release-age
|
|
59
|
+
wait; clients should offer it only after the normal operation reports
|
|
60
|
+
`RELEASE_TOO_FRESH` or `VERSION_UNCHANGED`.
|
|
61
|
+
|
|
62
|
+
Poll the operation by id:
|
|
63
|
+
|
|
64
|
+
```http
|
|
65
|
+
GET /dsh-market/api/v1/operations?operationId=<id>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
States are `queued`, `running`, `succeeded`, `failed`, `cancelled` and
|
|
69
|
+
`rolled-back`. Running operations include structured package progress when
|
|
70
|
+
pnpm provides it. Terminal operations include:
|
|
71
|
+
|
|
72
|
+
- the before and actually installed versions;
|
|
73
|
+
- `refreshRequired` and `restartRequired` outcomes;
|
|
74
|
+
- a stable failure code, bounded user-facing message and retryability;
|
|
75
|
+
- whether a compatibility rollback is currently available.
|
|
76
|
+
|
|
77
|
+
Up to 50 operation records live in the current Host process. A boot id is
|
|
78
|
+
embedded in every operation id, so a client never mistakes a stale browser
|
|
79
|
+
record for a task belonging to the replacement process.
|
|
80
|
+
|
|
81
|
+
## Roll back
|
|
82
|
+
|
|
83
|
+
```http
|
|
84
|
+
POST /dsh-market/api/v1/rollback
|
|
85
|
+
Content-Type: application/json
|
|
86
|
+
|
|
87
|
+
{ "operationId": "<id>" }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Rollback is intentionally capability- and operation-scoped. It is available
|
|
91
|
+
only when the Market's compatibility verification retained a recovery point;
|
|
92
|
+
a later mutation may supersede it. The normalized result is written back to
|
|
93
|
+
the same operation record.
|
|
94
|
+
|
|
95
|
+
## Restart
|
|
96
|
+
|
|
97
|
+
```http
|
|
98
|
+
POST /dsh-market/api/v1/restart
|
|
99
|
+
Content-Type: application/json
|
|
100
|
+
|
|
101
|
+
{}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This preserves the Market's stricter restart guard: direct loopback,
|
|
105
|
+
same-origin, no forwarding headers, no package mutation in progress, and a Host
|
|
106
|
+
whose lifecycle is not owned by Desktop or a supervisor. Clients must feature
|
|
107
|
+
detect it; they must not invent an alternative process-control path.
|
|
108
|
+
|
|
109
|
+
## Compatibility policy
|
|
110
|
+
|
|
111
|
+
- New optional response fields may be added within v1.
|
|
112
|
+
- Existing v1 fields and meanings are not repurposed.
|
|
113
|
+
- A breaking change uses a new path and schema version.
|
|
114
|
+
- When discovery is unavailable, plugin UIs should fall back to opening the
|
|
115
|
+
Market rather than calling legacy `/dsh-market/*` mutation routes directly.
|