dsh-preview-market 0.1.8 → 0.1.10
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/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/catalog/plugins/439436269-ctrl__dsh-preview-snip.json +3 -3
- package/catalog.json +3 -3
- package/lib/client.js +32 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.10
|
|
4
|
+
|
|
5
|
+
- Fix the **Update** button doing nothing for an installed preview plugin: it now calls `/dsh-market/update` instead of `/dsh-market/install` (which rejects an already-installed package).
|
|
6
|
+
- Compare versions numerically: the card offers Update only when the catalog version is newer than the installed one. An installed version equal to or newer than the catalog shows "Up to date" and the button is disabled, so a stale page no longer offers a downgrade.
|
|
7
|
+
- After an update, the notice says the client needs a page refresh; the market itself is not restarted.
|
|
8
|
+
|
|
9
|
+
## 0.1.9
|
|
10
|
+
|
|
11
|
+
- Catalog follows dsh-preview-snip@0.3.0: desktop sidebar-browser capture.
|
|
12
|
+
|
|
3
13
|
## 0.1.8
|
|
4
14
|
|
|
5
15
|
- Catalog follows `dsh-preview-snip@0.2.1` (image-only quick snip, segmented action group, hot-reload CSS fix).
|
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ A preview-header tool: drag a rectangle over an image/PDF to attach a PNG, or qu
|
|
|
70
70
|
|
|
71
71
|

|
|
72
72
|
|
|
73
|
-
## Catalog (0.1.
|
|
73
|
+
## Catalog (0.1.10)
|
|
74
74
|
|
|
75
75
|
Every plugin is **one file** under [`catalog/plugins/`](catalog/plugins/), named `<owner>__<repo>.json`. A third-party submission adds exactly one file plus the regenerated `catalog.json` snapshot — no market code change. The Host loads, validates and merges all files at startup; the format and PR steps are in [`catalog/README.md`](catalog/README.md).
|
|
76
76
|
|
|
@@ -128,4 +128,4 @@ The client bundle is `lib/client.js` (classic `__ModuleLoader__.load` factory, n
|
|
|
128
128
|
|
|
129
129
|
## Status
|
|
130
130
|
|
|
131
|
-
`0.1.
|
|
131
|
+
`0.1.10` — top-level Settings → Preview market section with Discover / Installed tabs, plus the Settings → Plugins tab. The catalog is one file per plugin under `catalog/plugins/` (preview plugins and tool entries such as the preview snip), so third-party entries are a one-file PR. Enable/disable goes through dsh-market. One-click install requires the package in the connected dsh-market registry; otherwise use the copyable command. Configuration stays in each child plugin's own Settings → Plugins page.
|
package/README.zh.md
CHANGED
|
@@ -70,7 +70,7 @@ STL 在浏览器解析;视口给出尺寸、体积、表面积和水密性,
|
|
|
70
70
|
|
|
71
71
|

|
|
72
72
|
|
|
73
|
-
## 目录(0.1.
|
|
73
|
+
## 目录(0.1.10)
|
|
74
74
|
|
|
75
75
|
每个插件是 [`catalog/plugins/`](catalog/plugins/) 下的**一个文件**,命名为 `<owner>__<repo>.json`。三方收录只需新增一个文件 + 重新生成 `catalog.json`,不用改市场代码;Host 启动时读取、校验并合并全部文件。字段与 PR 步骤见 [`catalog/README.md`](catalog/README.md)。
|
|
76
76
|
|
|
@@ -102,4 +102,4 @@ node --test test/*.test.js
|
|
|
102
102
|
|
|
103
103
|
## 状态
|
|
104
104
|
|
|
105
|
-
`0.1.
|
|
105
|
+
`0.1.10` — 顶层「设置 → 预览市场」+ 发现/已安装两个 tab,同时保留「设置 → 插件」里的入口。目录改为 `catalog/plugins/` 下一插件一文件,支持预览插件和 `kind: "tool"` 的增强工具(如预览圈选),三方收录只需一个文件 PR。启用/停用走 dsh-market;一键安装要求对应包已进入所连接 dsh-market 的 registry,否则用可复制命令。配置仍在各子插件自己的 设置 → 插件 页面。
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"capability": "snip",
|
|
5
5
|
"kind": "tool",
|
|
6
6
|
"repo": "https://github.com/439436269-ctrl/dsh-preview-snip",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.3.0",
|
|
8
8
|
"minDsh": "0.2.0-rc.2",
|
|
9
9
|
"requires": [],
|
|
10
10
|
"description": {
|
|
11
|
-
"zh": "图片/PDF/视频/3D
|
|
12
|
-
"en": "Snip any preview
|
|
11
|
+
"zh": "图片/PDF/视频/3D/文本等预览的圈选与标注;桌面侧栏网页预览也支持圈选。",
|
|
12
|
+
"en": "Snip/annotate any preview and the desktop sidebar browser; image-only quick snip plus the annotation editor."
|
|
13
13
|
}
|
|
14
14
|
}
|
package/catalog.json
CHANGED
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"capability": "snip",
|
|
104
104
|
"kind": "tool",
|
|
105
105
|
"repo": "https://github.com/439436269-ctrl/dsh-preview-snip",
|
|
106
|
-
"version": "0.
|
|
106
|
+
"version": "0.3.0",
|
|
107
107
|
"minDsh": "0.2.0-rc.2",
|
|
108
108
|
"requires": [],
|
|
109
109
|
"description": {
|
|
110
|
-
"zh": "图片/PDF/视频/3D
|
|
111
|
-
"en": "Snip any preview
|
|
110
|
+
"zh": "图片/PDF/视频/3D/文本等预览的圈选与标注;桌面侧栏网页预览也支持圈选。",
|
|
111
|
+
"en": "Snip/annotate any preview and the desktop sidebar browser; image-only quick snip plus the annotation editor."
|
|
112
112
|
},
|
|
113
113
|
"extensions": [],
|
|
114
114
|
"formats": {}
|
package/lib/client.js
CHANGED
|
@@ -29,6 +29,7 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
available: "可安装",
|
|
30
30
|
install: "安装",
|
|
31
31
|
update: "更新",
|
|
32
|
+
refreshHint: "刷新页面后生效",
|
|
32
33
|
copy: "复制安装命令",
|
|
33
34
|
copied: "命令已复制",
|
|
34
35
|
manual: "请在终端执行:",
|
|
@@ -71,6 +72,7 @@ window.__ModuleLoader__.load({
|
|
|
71
72
|
available: "Available",
|
|
72
73
|
install: "Install",
|
|
73
74
|
update: "Update",
|
|
75
|
+
refreshHint: "refresh the page to apply",
|
|
74
76
|
copy: "Copy install command",
|
|
75
77
|
copied: "Command copied",
|
|
76
78
|
manual: "Run in a terminal:",
|
|
@@ -129,10 +131,26 @@ window.__ModuleLoader__.load({
|
|
|
129
131
|
return `dsh plugin --profile ${profile || "desktop"} add ${item.name}@${item.version}`;
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
/** Numeric semver comparison; pre-release suffixes compare after the core. */
|
|
135
|
+
function compareVersions(a, b) {
|
|
136
|
+
const part = (value) => String(value).split(/[.+-]/).slice(0, 4).map((entry) => {
|
|
137
|
+
const number = Number.parseInt(entry, 10);
|
|
138
|
+
return Number.isNaN(number) ? 0 : number;
|
|
139
|
+
});
|
|
140
|
+
const left = part(a);
|
|
141
|
+
const right = part(b);
|
|
142
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
143
|
+
const difference = (left[index] ?? 0) - (right[index] ?? 0);
|
|
144
|
+
if (difference !== 0) return difference > 0 ? 1 : -1;
|
|
145
|
+
}
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
132
149
|
/** A single catalog card. */
|
|
133
150
|
function Card({ item, installed, profile, dshmarket, enabled, busy, onInstall, onCopy, onToggle, onConfig, t }) {
|
|
134
151
|
const current = installed !== undefined ? installed.version : "";
|
|
135
|
-
const newer = current !== "" && current
|
|
152
|
+
const newer = current !== "" && compareVersions(item.version, current) > 0;
|
|
153
|
+
const upToDate = current !== "" && !newer;
|
|
136
154
|
const formats = item.formats !== undefined
|
|
137
155
|
? Object.values(item.formats).flat().slice(0, 10)
|
|
138
156
|
: (item.extensions ?? []).slice(0, 10);
|
|
@@ -169,7 +187,7 @@ window.__ModuleLoader__.load({
|
|
|
169
187
|
{
|
|
170
188
|
type: "button",
|
|
171
189
|
className: "dsh-pm-button dsh-pm-primary",
|
|
172
|
-
disabled: busy === item.name,
|
|
190
|
+
disabled: busy === item.name || upToDate,
|
|
173
191
|
onClick: () => onInstall(item)
|
|
174
192
|
},
|
|
175
193
|
busy === item.name ? "…" : current === "" ? t("install") : newer ? t("update") : t("noUpdate")
|
|
@@ -276,23 +294,29 @@ window.__ModuleLoader__.load({
|
|
|
276
294
|
setNotice("");
|
|
277
295
|
try {
|
|
278
296
|
if (!state.dshmarket) throw new Error("dsh-market is not available");
|
|
279
|
-
const
|
|
297
|
+
const installedNow = installedByName.has(item.name);
|
|
298
|
+
const response = await fetch(installedNow ? "/dsh-market/update" : "/dsh-market/install", {
|
|
280
299
|
method: "POST",
|
|
281
300
|
headers: { "content-type": "application/json" },
|
|
282
|
-
body: JSON.stringify(
|
|
301
|
+
body: JSON.stringify(installedNow
|
|
302
|
+
? { name: item.name, force: true, confirmAgentsRunning: true }
|
|
303
|
+
: { url: item.repo, version: item.version })
|
|
283
304
|
});
|
|
284
305
|
const body = await response.json().catch(() => null);
|
|
285
306
|
if (!response.ok || body === null || body.ok !== true) {
|
|
286
307
|
throw new Error(body !== null && typeof body.error === "string" ? body.error : `HTTP ${response.status}`);
|
|
287
308
|
}
|
|
288
|
-
setNotice(`${t("installed")}: ${item.name}`);
|
|
309
|
+
setNotice(installedNow ? `${t("installed")}: ${item.name} · ${t("refreshHint")}` : `${t("installed")}: ${item.name}`);
|
|
289
310
|
await load();
|
|
290
|
-
} catch {
|
|
291
|
-
|
|
311
|
+
} catch (error) {
|
|
312
|
+
const detail = error instanceof Error ? error.message : "";
|
|
313
|
+
setNotice(detail !== "" && detail !== "dsh-market is not available"
|
|
314
|
+
? detail
|
|
315
|
+
: `${t("manual")} ${installCommand(item, state.profile)}`);
|
|
292
316
|
} finally {
|
|
293
317
|
setBusy("");
|
|
294
318
|
}
|
|
295
|
-
}, [state.dshmarket, state.profile, load, t]);
|
|
319
|
+
}, [state.dshmarket, state.profile, load, t, installedByName]);
|
|
296
320
|
|
|
297
321
|
const copy = React.useCallback(async (item) => {
|
|
298
322
|
const command = installCommand(item, state.profile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-preview-market",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Vertical preview market for DeepSeek Harness: discover, install and configure preview plugins (media, Blender, STL, ...) from one panel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|