dsh-plugin 2.2.2 → 2.2.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/client/client.js +317 -298
- package/client/client.js.map +1 -1
- package/package.json +1 -1
- package/src/client/data/hub.ts +27 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "A community plugin marketplace for DeepSeek Harness, built to the official plugin spec — browse, search and install 10000+ human-curated community plugins without leaving the app. · DeepSeek Harness 社区插件市场(遵循官方开发规范):10000+ 人工精选社区插件,每日更新。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/src/client/data/hub.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Hub 元数据仓库:自我更新检查与「关注我们」内容背后的 Cloudflare Worker 接口。
|
|
7
7
|
* 失败降级为 null —— 由调用方决定如何兜底(不显示徽标、占位文案),绝不抛错。
|
|
8
8
|
*/
|
|
9
|
-
import type { HubAboutInfo, HubUpdateInfo } from '../types.ts'
|
|
9
|
+
import type { HubAboutInfo, HubUpdateInfo, HubUpdateVersion } from '../types.ts'
|
|
10
10
|
import { HUB_ABOUT_URL, HUB_UPDATE_URL } from '../logic/constants.ts'
|
|
11
11
|
|
|
12
12
|
/** 版本接口是 Pages 静态文件,默认带 CDN 缓存(Cache-Control: public, max-age=43200,
|
|
@@ -18,7 +18,26 @@ function busted(url: string): string {
|
|
|
18
18
|
return `${url}${sep}_t=${Date.now()}`
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** 归一化接口下发的 recentVersions:只保留带版本号的条目,其余字段按类型补。
|
|
22
|
+
* 这条数据是「最新版还在 24.5h 门禁内时回退到更早的已过门槛版本」的唯一依据;
|
|
23
|
+
* 入口处漏传会让候选只剩最新版,整体变成 pending —— 用户就永远看不到更新入口。 */
|
|
24
|
+
function recentVersionsOf(value: unknown): HubUpdateVersion[] {
|
|
25
|
+
if (!Array.isArray(value)) return []
|
|
26
|
+
const list: HubUpdateVersion[] = []
|
|
27
|
+
for (const item of value) {
|
|
28
|
+
if (item === null || typeof item !== 'object') continue
|
|
29
|
+
const entry = item as { version?: unknown; publishedAt?: unknown; notes?: unknown }
|
|
30
|
+
if (typeof entry.version !== 'string' || entry.version === '') continue
|
|
31
|
+
list.push({
|
|
32
|
+
version: entry.version,
|
|
33
|
+
...(typeof entry.publishedAt === 'string' ? { publishedAt: entry.publishedAt } : {}),
|
|
34
|
+
...(entry.notes === undefined ? {} : { notes: entry.notes as HubUpdateVersion['notes'] }),
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
return list
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 版本控制中心:最新版本 + Markdown 变更记录 + 最近发版(门禁回退用);不可用返回 null。 */
|
|
22
41
|
export async function fetchHubUpdate(): Promise<HubUpdateInfo | null> {
|
|
23
42
|
try {
|
|
24
43
|
const res = await fetch(busted(HUB_UPDATE_URL), { cache: 'no-store' })
|
|
@@ -27,7 +46,12 @@ export async function fetchHubUpdate(): Promise<HubUpdateInfo | null> {
|
|
|
27
46
|
if (!data) return null
|
|
28
47
|
const version = typeof data.version === 'string' && data.version.length > 0 ? data.version : null
|
|
29
48
|
if (version === null) return null
|
|
30
|
-
return {
|
|
49
|
+
return {
|
|
50
|
+
version,
|
|
51
|
+
publishedAt: data.publishedAt ?? null,
|
|
52
|
+
notes: data.notes ?? null,
|
|
53
|
+
recentVersions: recentVersionsOf(data.recentVersions),
|
|
54
|
+
}
|
|
31
55
|
} catch {
|
|
32
56
|
return null
|
|
33
57
|
}
|