dsh-anime-bundle 1.0.2 → 1.0.4

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 CHANGED
@@ -9,10 +9,11 @@
9
9
 
10
10
  - **模式总开关**:一键关掉 / 恢复整套二次元外观。关闭时记住当前组合,再开启按这份组合恢复;想换基准点「记住当前组合」。
11
11
  - **肥鱼娘人格**:打开后把人格段落注入系统提示词,关闭立刻回到正常模式;下一条消息生效,不用重启。设置页有自检,会读一遍组装后的提示词确认段落进去了。
12
- - **插件清单**:默认 8 个,可单独开关;显示版本、未安装、本地链接、可更新。
12
+ - **插件清单**:默认 9 个,可单独开关;显示版本、未安装、本地链接、可更新。
13
13
  - **添加 / 移除插件**:「添加插件」列出**已安装但不在清单里**的第三方插件,可加入外观或功能组;每行的 `×` 只把条目从清单移除,**不卸载、不改开关**;「恢复默认清单」一键还原。
14
14
  - **一键下载缺失**:按清单里的锁定版本把缺的插件装回来,并把原本开着的重新打开。
15
15
  - **检查更新 / 更新全部**:走 npm 仓库比对最新版;更新时按 DSH 官方路径「先卸载、再安装」(宿主 `installBundle` 只用于新增,已在 profile 里的包会被拒绝),安装失败自动把旧版本装回去。
16
+ - **插件本体更新**:设置页底部显示本插件当前版本,一键比对 npm 上的 `latest`,附 GitHub / npm 链接;主「检查更新」也会顺带查一次本体。不会在运行中替换自身,更新走「设置 → 插件」卸载后重装。
16
17
  - **自检**:提示词、状态文件、插件清单各查一遍,结果直接显示在页面上。
17
18
 
18
19
  ## 安装
@@ -42,14 +43,17 @@ dsh plugin --profile desktop add "link:<克隆下来的目录>"
42
43
  |---|---|---|
43
44
  | `dafy-whale-theme` 蓝色大肥鱼主题 | 外观 | 2.1.0 |
44
45
  | `dsh-whale-widget` 鲸鱼挂件 | 外观 | 0.4.2 |
45
- | `dsh-boot-suite` 开机动画套件 | 外观 | 2.16.2 |
46
+ | `dsh-boot-suite` 开机动画套件 | 外观 | 2.16.5 |
47
+ | `dsh-splash-animation` 开屏动画 | 外观 | GitHub(默认关闭) |
46
48
  | `@smalltailqwq/dsh-client-ui-skin-deep-whale-manager` 皮肤管理器 | 外观 | 0.1.8 |
47
49
  | `@smalltailqwq/dsh-client-ui-skin-maid-atelier` 深海女仆工坊 | 外观 | 0.1.9 |
48
50
  | `dsh-mnemon` 记忆 | 功能 | 0.5.39 |
49
51
  | `dsh-media-serve` 媒体服务 | 功能 | 0.2.4 |
50
52
  | `dsh-mcp-panel` MCP 面板 | 功能 | 0.6.29 |
51
53
 
52
- 这些**都不随本插件打包**,是安装时从 npm 单独拉取的第三方包。
54
+ 这些**都不随本插件打包**,安装时按清单单独拉取:npm 包用锁定版本,`dsh-splash-animation` 走 GitHub 仓库。
55
+ `dsh-splash-animation` 和「开机动画套件」的开场动画建议**二选一**,默认关闭,需要时在「大肥鱼模式」里单独打开。
56
+ 它不参与 npm 更新检查(不在 npm 上);更新时重新从 GitHub 安装即可。
53
57
 
54
58
  ## 增删规则
55
59
 
@@ -65,12 +69,27 @@ dsh plugin --profile desktop add "link:<克隆下来的目录>"
65
69
  > 文件名的 `dafy-mode` 是历史遗留标识(与内部路由 `/dafy-mode/*` 一起保留),为了从早期版本升级时不丢设置。
66
70
  > 包名、设置页显示名与它的含义无关。
67
71
 
72
+ ## 本体更新
73
+
74
+ 设置页底部「插件本体」显示的是**当前正在运行的** `package.json` 版本;点「检查本体更新」会去 npm 取
75
+ `dsh-anime-bundle@latest` 比对。有新版本时给出版本号、GitHub 与 npm 链接。
76
+
77
+ 本插件不会在运行中把自己卸载重装(那会先把提供这个页面的插件卸载掉)。更新请走官方路径:
78
+ **设置 → 插件 → 卸载 `dsh-anime-bundle` → 重新添加**,或命令行:
79
+
80
+ ```bash
81
+ dsh plugin --profile <profile> remove dsh-anime-bundle
82
+ dsh plugin --profile <profile> add dsh-anime-bundle@latest
83
+ ```
84
+
85
+ 上面的主「检查更新」也会顺带查一次本体,结果里会出现一条 `dsh-anime-bundle(本体)`。
86
+
68
87
  ## 它做了什么(安全说明)
69
88
 
70
89
  - 所有开关都走 DSH 官方的插件管理路径(`pluginManager.setBundleEnabled`),和「设置 → 插件」按钮等价。
71
90
  - 「一键下载缺失 / 更新全部」会让宿主用 pnpm 从 `registry.npmjs.org`(或你配置的镜像)安装清单里的包,
72
91
  安装内容完全由清单决定;不会执行清单以外的下载。
73
- - Host 侧只读写 `~/.dsh/dafy-mode.json`,不访问网络、不收集任何数据。
92
+ - Host 侧只读写 `~/.dsh/dafy-mode.json`;只有你点「检查更新 / 检查本体更新」时才会访问 npm registry(`registry.npmjs.org` 或你配置的镜像),不收集任何数据。
74
93
 
75
94
  ## 开发
76
95
 
@@ -95,7 +114,9 @@ MIT(只覆盖本插件自己的代码与文案)。
95
114
 
96
115
  A settings page that treats your anime skin stack as one switch: toggle the whole look, flip a
97
116
  persona prompt on/off, see every managed plugin's version, reinstall what's missing, and check for
98
- updates — all through DSH's own plugin-manager APIs.
117
+ updates — all through DSH's own plugin-manager APIs. The page also shows its own version and checks
118
+ npm for a newer `dsh-anime-bundle`; it never replaces itself while running, so update it from
119
+ **Settings → Plugins** (remove, then reinstall).
99
120
 
100
121
  **Unofficial.** Not affiliated with or endorsed by DeepSeek, DSH, or the authors of the plugins in
101
122
  the default list (`dafy-whale-theme`, `dsh-boot-suite`, the whale skins). Those packages keep their
package/catalog.js CHANGED
@@ -4,8 +4,9 @@
4
4
  * 这里只负责开箱默认值,不用为了增删改代码。
5
5
  *
6
6
  * kind:
7
- * - npm :走 npm 仓库安装,pin 是装回来时锁定的版本(保证"一键下载"复刻现在的组合)
8
- * - link :本机目录 link 安装,装不回来时给出明确提示
7
+ * - npm :走 npm 仓库安装,pin 是装回来时锁定的版本(保证"一键下载"复刻现在的组合)
8
+ * - link :本机目录 link 安装,装不回来时给出明确提示
9
+ * - github:走 GitHub 仓库安装,spec 是 pnpm 的 git 形式(本机需要可用的 git)
9
10
  * group:
10
11
  * - mode :二次元外观,归"大肥鱼模式"总开关管
11
12
  * - util :功能插件,只做单独开关,不随总开关走
@@ -35,9 +36,18 @@ export const MANAGED = [
35
36
  note: '六幕开机动画、模板与聊天壁纸',
36
37
  group: 'mode',
37
38
  kind: 'npm',
38
- pin: '2.16.2',
39
+ pin: '2.16.5',
39
40
  defaultEnabled: true,
40
41
  },
42
+ {
43
+ name: 'dsh-splash-animation',
44
+ title: '开屏动画',
45
+ note: '启动时播放视频再渐隐;和「开机动画套件」的开场二选一,默认关闭',
46
+ group: 'mode',
47
+ kind: 'github',
48
+ spec: 'github:KDDKBD/DeepSeek-splash-animation',
49
+ defaultEnabled: false,
50
+ },
41
51
  {
42
52
  name: '@smalltailqwq/dsh-client-ui-skin-deep-whale-manager',
43
53
  title: '皮肤管理器',
package/client.js CHANGED
@@ -73,6 +73,21 @@ window.__ModuleLoader__.load({
73
73
  addedGroupMode: '二次元外观',
74
74
  addedGroupUtil: '功能插件',
75
75
  resetDone: '已恢复默认清单。',
76
+ selfTitle: '插件本体',
77
+ selfDesc: '检查 dsh-anime-bundle 在 npm 上有没有新版本。',
78
+ selfCheck: '检查本体更新',
79
+ selfUpToDate: '已是最新',
80
+ selfNewer: '可更新 {v}',
81
+ selfCurrent: '当前 v{v}',
82
+ selfLatest: '最新 v{v}',
83
+ selfNever: '还没检查过本体更新',
84
+ selfLast: '上次检查:{time}',
85
+ selfNoCheck: '未检查',
86
+ selfFound: '发现本体新版本 v{v}(当前 v{c})。',
87
+ selfLatestMsg: '本体已是最新 v{v}。',
88
+ selfHint: '更新方法:设置 → 插件 → 卸载 dsh-anime-bundle 后重装;或命令行 dsh plugin remove dsh-anime-bundle 再 dsh plugin add dsh-anime-bundle@latest。',
89
+ githubLink: 'GitHub 仓库',
90
+ npmLink: 'npm 页面',
76
91
  confirmDisableAll: '这会停用清单里的所有插件(包括记忆、MCP 面板)。确定吗?',
77
92
  jobModeOn: '正在开启大肥鱼模式',
78
93
  jobModeOff: '正在关闭大肥鱼模式',
@@ -108,7 +123,7 @@ window.__ModuleLoader__.load({
108
123
  noticeTitle: '完成',
109
124
  dismiss: '知道了',
110
125
  progress: '{done}/{total}',
111
- footer: 'dsh-anime-bundle v1.0.0 · 所有开关即时保存,改完不用重启',
126
+ footer: 'dsh-anime-bundle v{v} · 所有开关即时保存,改完不用重启',
112
127
  autoNote: '人格来自插件内置文案,可在 persona.js 里换成你自己的。',
113
128
  busy: '有任务在跑,先等它结束。',
114
129
  phaseEnable: '启用',
@@ -174,6 +189,21 @@ window.__ModuleLoader__.load({
174
189
  addedGroupMode: 'visuals',
175
190
  addedGroupUtil: 'utilities',
176
191
  resetDone: 'Default list restored.',
192
+ selfTitle: 'This plugin',
193
+ selfDesc: 'Check npm for a newer version of dsh-anime-bundle.',
194
+ selfCheck: 'Check plugin update',
195
+ selfUpToDate: 'Up to date',
196
+ selfNewer: 'Update {v}',
197
+ selfCurrent: 'Current v{v}',
198
+ selfLatest: 'Latest v{v}',
199
+ selfNever: 'Never checked this plugin for updates',
200
+ selfLast: 'Last check: {time}',
201
+ selfNoCheck: 'Not checked',
202
+ selfFound: 'A newer version v{v} is available (current v{c}).',
203
+ selfLatestMsg: 'This plugin is up to date at v{v}.',
204
+ selfHint: 'To update: Settings → Plugins → remove dsh-anime-bundle, then reinstall; or run dsh plugin remove dsh-anime-bundle followed by dsh plugin add dsh-anime-bundle@latest.',
205
+ githubLink: 'GitHub repo',
206
+ npmLink: 'npm page',
177
207
  confirmDisableAll: 'This disables every plugin in the list, including memory and the MCP panel. Continue?',
178
208
  jobModeOn: 'Turning Big Fish Mode on',
179
209
  jobModeOff: 'Turning Big Fish Mode off',
@@ -209,7 +239,7 @@ window.__ModuleLoader__.load({
209
239
  noticeTitle: 'Done',
210
240
  dismiss: 'Got it',
211
241
  progress: '{done}/{total}',
212
- footer: 'dsh-anime-bundle v1.0.0 · every switch saves immediately, no restart needed',
242
+ footer: 'dsh-anime-bundle v{v} · every switch saves immediately, no restart needed',
213
243
  autoNote: 'The persona ships in persona.js — edit it to make the fish sound like yours.',
214
244
  busy: 'A task is running. Wait for it to finish.',
215
245
  phaseEnable: 'Enable',
@@ -302,6 +332,11 @@ window.__ModuleLoader__.load({
302
332
  .dfm-details summary { cursor: pointer; font-size: 12px; color: var(--dsw-alias-label-secondary); user-select: none; }
303
333
  .dfm-details summary:hover { color: var(--dsw-alias-label-primary); }
304
334
  .dfm-persona-text { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--dsw-alias-bg-layer-2); border: 1px solid var(--dsw-alias-border-l1); font-size: 12px; color: var(--dsw-alias-label-secondary); white-space: pre-wrap; max-height: 220px; overflow: auto; }
335
+ .dfm-self { margin-top: 14px; }
336
+ .dfm-self-version { font-size: 12px; color: var(--dsw-alias-label-secondary); }
337
+ .dfm-self-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 11.5px; }
338
+ .dfm-self-links a { color: var(--dsw-alias-brand-primary); text-decoration: none; }
339
+ .dfm-self-links a:hover { text-decoration: underline; }
305
340
  .dfm-foot { margin-top: 18px; font-size: 11px; color: var(--dsw-alias-label-secondary); text-align: center; }
306
341
  .dfm-loading { padding: 40px 0; text-align: center; color: var(--dsw-alias-label-secondary); font-size: 12.5px; }
307
342
  @media (max-width: 560px) { .dfm-hero { align-items: flex-start; } .dfm-tag { display: none; } .dfm-section-head--row { flex-direction: column; align-items: stretch; } .dfm-section-tools { justify-content: flex-end; } }
@@ -411,6 +446,7 @@ window.__ModuleLoader__.load({
411
446
  if (row.incompatible) parts.push(h(Badge, { key: 'bad', tone: 'warn' }, t('incompatible')))
412
447
  if (row.custom) parts.push(h(Badge, { key: 'custom' }, t('customBadge')))
413
448
  if (row.kind === 'link') parts.push(h(Badge, { key: 'link' }, t('linkBadge')))
449
+ if (row.kind === 'github') parts.push(h(Badge, { key: 'gh' }, 'GitHub'))
414
450
  if (row.update && row.update.newer) {
415
451
  parts.push(h(Badge, { key: 'upd', tone: 'update' }, fmt(t('updateTo'), { v: row.update.latest })))
416
452
  }
@@ -775,6 +811,17 @@ window.__ModuleLoader__.load({
775
811
  await post('/action', { action: 'set-mode', enabled: true })
776
812
  }, [post])
777
813
 
814
+ const checkSelf = useCallback(async () => {
815
+ const payload = await post('/action', { action: 'check-self-update' })
816
+ if (!payload || !payload.result) return
817
+ const result = payload.result
818
+ showNotice(
819
+ result.newer
820
+ ? fmt(t('selfFound'), { v: result.latest, c: result.current })
821
+ : fmt(t('selfLatestMsg'), { v: result.latest }),
822
+ )
823
+ }, [post, showNotice, t])
824
+
778
825
  if (!data) {
779
826
  return h(
780
827
  'div',
@@ -798,6 +845,15 @@ window.__ModuleLoader__.load({
798
845
  : t('modeDescOff')
799
846
  const modeRows = data.plugins.filter((row) => row.group === 'mode')
800
847
  const utilRows = data.plugins.filter((row) => row.group === 'util')
848
+ const selfInfo = data.self || {
849
+ name: 'dsh-anime-bundle',
850
+ version: '?',
851
+ latest: null,
852
+ checkedAt: 0,
853
+ newer: false,
854
+ repoUrl: null,
855
+ npmUrl: 'https://www.npmjs.com/package/dsh-anime-bundle',
856
+ }
801
857
  const lastCheck = data.updates.checkedAt
802
858
  ? fmt(t('lastCheckAt'), { time: timeText(data.updates.checkedAt) })
803
859
  : t('lastCheckNever')
@@ -981,7 +1037,74 @@ window.__ModuleLoader__.load({
981
1037
  }))),
982
1038
  ),
983
1039
 
984
- h('div', { className: 'dfm-foot' }, t('footer')),
1040
+ h(
1041
+ 'section',
1042
+ { className: 'dfm-card dfm-self' },
1043
+ h(
1044
+ 'div',
1045
+ { className: 'dfm-mode-head' },
1046
+ h(
1047
+ 'div',
1048
+ { className: 'dfm-mode-text' },
1049
+ h(
1050
+ 'div',
1051
+ { className: 'dfm-card-title' },
1052
+ t('selfTitle'),
1053
+ ' ',
1054
+ h('span', { className: 'dfm-pkg' }, selfInfo.name),
1055
+ ),
1056
+ h('div', { className: 'dfm-muted' }, t('selfDesc')),
1057
+ ),
1058
+ h(
1059
+ 'button',
1060
+ { type: 'button', className: 'dfm-btn', disabled: busy, onClick: checkSelf },
1061
+ t('selfCheck'),
1062
+ ),
1063
+ ),
1064
+ h(
1065
+ 'div',
1066
+ { className: 'dfm-mode-meta' },
1067
+ h(
1068
+ Badge,
1069
+ { tone: selfInfo.newer ? 'update' : selfInfo.latest ? 'on' : undefined },
1070
+ selfInfo.newer
1071
+ ? fmt(t('selfNewer'), { v: selfInfo.latest })
1072
+ : selfInfo.latest
1073
+ ? t('selfUpToDate')
1074
+ : t('selfNoCheck'),
1075
+ ),
1076
+ h('span', { className: 'dfm-self-version' }, fmt(t('selfCurrent'), { v: selfInfo.version })),
1077
+ selfInfo.latest
1078
+ ? h('span', { className: 'dfm-self-version' }, fmt(t('selfLatest'), { v: selfInfo.latest }))
1079
+ : null,
1080
+ h(
1081
+ 'span',
1082
+ { className: 'dfm-count' },
1083
+ selfInfo.checkedAt
1084
+ ? fmt(t('selfLast'), { time: timeText(selfInfo.checkedAt) })
1085
+ : t('selfNever'),
1086
+ ),
1087
+ ),
1088
+ selfInfo.newer ? h('div', { className: 'dfm-note', style: { marginTop: '8px' } }, t('selfHint')) : null,
1089
+ h(
1090
+ 'div',
1091
+ { className: 'dfm-self-links' },
1092
+ selfInfo.repoUrl
1093
+ ? h(
1094
+ 'a',
1095
+ { href: selfInfo.repoUrl, target: '_blank', rel: 'noreferrer' },
1096
+ `${t('githubLink')} ↗`,
1097
+ )
1098
+ : null,
1099
+ h(
1100
+ 'a',
1101
+ { href: selfInfo.npmUrl, target: '_blank', rel: 'noreferrer' },
1102
+ `${t('npmLink')} ↗`,
1103
+ ),
1104
+ ),
1105
+ ),
1106
+
1107
+ h('div', { className: 'dfm-foot' }, fmt(t('footer'), { v: selfInfo.version })),
985
1108
  )
986
1109
  }
987
1110
 
package/index.js CHANGED
@@ -7,9 +7,10 @@
7
7
  * 3. 用 ctx.systemPrompt.section 注入「大肥鱼人格」,开 / 关都不需要重启。
8
8
  */
9
9
  import { randomUUID } from 'node:crypto'
10
- import { promises as fsp } from 'node:fs'
10
+ import { promises as fsp, readFileSync } from 'node:fs'
11
11
  import { homedir } from 'node:os'
12
- import { join } from 'node:path'
12
+ import { dirname, join } from 'node:path'
13
+ import { fileURLToPath } from 'node:url'
13
14
  import { MANAGED } from './catalog.js'
14
15
  import { PERSONA_PREVIEW, PERSONA_TEXT } from './persona.js'
15
16
 
@@ -24,6 +25,30 @@ const STATE_FILE = join(DSH_HOME, 'dafy-mode.json')
24
25
  const VERIFY_ROUNDS = 3
25
26
  const CATALOG_NAMES = new Set(MANAGED.map((entry) => entry.name))
26
27
 
28
+ /** 本插件自己的清单:用来显示本体版本、仓库和 npm 页面。 */
29
+ const PACKAGE_ROOT = dirname(fileURLToPath(import.meta.url))
30
+ const SELF_MANIFEST = readSelfManifest()
31
+ const SELF_PACKAGE = typeof SELF_MANIFEST.name === 'string' && SELF_MANIFEST.name ? SELF_MANIFEST.name : SELF_NAME
32
+ const SELF_VERSION = typeof SELF_MANIFEST.version === 'string' && SELF_MANIFEST.version ? SELF_MANIFEST.version : '0.0.0'
33
+ const SELF_REPO_URL = normalizeRepoUrl(SELF_MANIFEST.repository)
34
+ const SELF_NPM_URL = `https://www.npmjs.com/package/${SELF_PACKAGE}`
35
+
36
+ function readSelfManifest() {
37
+ try {
38
+ return JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8'))
39
+ } catch {
40
+ return {}
41
+ }
42
+ }
43
+
44
+ function normalizeRepoUrl(repository) {
45
+ const raw = typeof repository === 'string' ? repository : repository && repository.url
46
+ if (typeof raw !== 'string' || !raw.trim()) return null
47
+ let url = raw.trim().replace(/^git\+/, '').replace(/\.git$/, '')
48
+ if (url.startsWith('git@github.com:')) url = `https://github.com/${url.slice('git@github.com:'.length)}`
49
+ return /^https?:\/\//.test(url) ? url : null
50
+ }
51
+
27
52
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
28
53
 
29
54
  function defaultState() {
@@ -37,6 +62,7 @@ function defaultState() {
37
62
  registry: null,
38
63
  added: [],
39
64
  removed: [],
65
+ selfUpdate: null,
40
66
  }
41
67
  }
42
68
 
@@ -146,6 +172,12 @@ async function loadState() {
146
172
  registry: typeof parsed.registry === 'string' ? parsed.registry : null,
147
173
  added,
148
174
  removed,
175
+ selfUpdate: parsed.selfUpdate && typeof parsed.selfUpdate === 'object'
176
+ ? {
177
+ latest: typeof parsed.selfUpdate.latest === 'string' ? parsed.selfUpdate.latest : null,
178
+ checkedAt: Number(parsed.selfUpdate.checkedAt) || 0,
179
+ }
180
+ : null,
149
181
  }
150
182
  } catch (error) {
151
183
  if (error && error.code !== 'ENOENT') {
@@ -272,6 +304,7 @@ function createApi(ctx, state) {
272
304
  registry: state.registry,
273
305
  added: state.added,
274
306
  removed: state.removed,
307
+ selfUpdate: state.selfUpdate,
275
308
  },
276
309
  null,
277
310
  2,
@@ -404,6 +437,17 @@ function createApi(ctx, state) {
404
437
  text: PERSONA_TEXT,
405
438
  chars: PERSONA_TEXT.length,
406
439
  },
440
+ self: {
441
+ name: SELF_PACKAGE,
442
+ version: SELF_VERSION,
443
+ latest: state.selfUpdate && state.selfUpdate.latest ? state.selfUpdate.latest : null,
444
+ checkedAt: state.selfUpdate && state.selfUpdate.checkedAt ? state.selfUpdate.checkedAt : 0,
445
+ newer: Boolean(
446
+ state.selfUpdate && state.selfUpdate.latest && isNewer(state.selfUpdate.latest, SELF_VERSION),
447
+ ),
448
+ repoUrl: SELF_REPO_URL,
449
+ npmUrl: SELF_NPM_URL,
450
+ },
407
451
  plugins,
408
452
  available,
409
453
  list: {
@@ -657,6 +701,12 @@ function createApi(ctx, state) {
657
701
  checks.push({ id: 'persona', ok: false, message: `提示词自检失败:${String((error && error.message) || error)}` })
658
702
  }
659
703
 
704
+ checks.push({
705
+ id: 'self',
706
+ ok: Boolean(SELF_PACKAGE && SELF_VERSION),
707
+ message: `本体 ${SELF_PACKAGE}@${SELF_VERSION}`,
708
+ })
709
+
660
710
  try {
661
711
  const raw = await fsp.readFile(STATE_FILE, 'utf8')
662
712
  const saved = JSON.parse(raw)
@@ -689,6 +739,25 @@ function createApi(ctx, state) {
689
739
  return { ok: passed === checks.length, checks, passed, total: checks.length }
690
740
  }
691
741
 
742
+ /** 检查插件本体:拿本地 package.json 的版本和 npm 上的 latest 比。 */
743
+ async function actionCheckSelf() {
744
+ const registry = await resolveRegistry()
745
+ const latest = await fetchLatest(registry, SELF_PACKAGE)
746
+ state.selfUpdate = { latest, checkedAt: Date.now() }
747
+ await persist()
748
+ return {
749
+ ok: true,
750
+ name: SELF_PACKAGE,
751
+ current: SELF_VERSION,
752
+ latest,
753
+ newer: isNewer(latest, SELF_VERSION),
754
+ checkedAt: state.selfUpdate.checkedAt,
755
+ registry,
756
+ repoUrl: SELF_REPO_URL,
757
+ npmUrl: SELF_NPM_URL,
758
+ }
759
+ }
760
+
692
761
  /* ---------------- 任务入口 ---------------- */
693
762
 
694
763
  function startSetMode(body) {
@@ -769,8 +838,10 @@ function createApi(ctx, state) {
769
838
  for (const entry of missing) {
770
839
  job.current = entry.name
771
840
  job.phase = 'install'
772
- let spec = entry.kind === 'link' ? `link:${entry.linkPath}` : entry.name
773
- if (entry.kind === 'npm' && entry.pin) spec = `${entry.name}@${entry.pin}`
841
+ let spec = entry.name
842
+ if (entry.kind === 'link') spec = `link:${entry.linkPath}`
843
+ else if (entry.kind === 'github') spec = entry.spec || entry.name
844
+ else if (entry.pin) spec = `${entry.name}@${entry.pin}`
774
845
  if (entry.kind === 'link') {
775
846
  let exists = true
776
847
  try {
@@ -832,11 +903,11 @@ function createApi(ctx, state) {
832
903
 
833
904
  function startCheckUpdates() {
834
905
  const npmEntries = effectiveEntries(state).filter((entry) => entry.kind === 'npm')
835
- return startJob('check', npmEntries.length, async (job) => {
906
+ return startJob('check', npmEntries.length + 1, async (job) => {
836
907
  const registry = await resolveRegistry()
837
908
  state.registry = registry
838
909
  const map = await listBundleMap()
839
- job.total = npmEntries.length
910
+ job.total = npmEntries.length + 1
840
911
  for (const entry of npmEntries) {
841
912
  job.current = entry.name
842
913
  job.phase = 'check'
@@ -862,6 +933,29 @@ function createApi(ctx, state) {
862
933
  })
863
934
  }
864
935
  }
936
+ // 顺手把插件本体也查一遍,主「检查更新」一次看全。
937
+ job.current = SELF_PACKAGE
938
+ job.phase = 'check'
939
+ try {
940
+ const latest = await fetchLatest(registry, SELF_PACKAGE)
941
+ state.selfUpdate = { latest, checkedAt: Date.now() }
942
+ const newer = isNewer(latest, SELF_VERSION)
943
+ pushResult(job, {
944
+ name: `${SELF_PACKAGE}(本体)`,
945
+ ok: true,
946
+ message: newer ? `可更新:${SELF_VERSION} → ${latest}` : `已是最新 ${latest}`,
947
+ latest,
948
+ current: SELF_VERSION,
949
+ newer,
950
+ self: true,
951
+ })
952
+ } catch (error) {
953
+ pushResult(job, {
954
+ name: `${SELF_PACKAGE}(本体)`,
955
+ ok: false,
956
+ message: `查询失败:${String((error && error.message) || error)}`,
957
+ })
958
+ }
865
959
  state.checkedAt = Date.now()
866
960
  await persist()
867
961
  })
@@ -1034,6 +1128,19 @@ function createApi(ctx, state) {
1034
1128
  sendJson(res, started.ok ? 200 : 409, { ...started, state: await buildState() })
1035
1129
  return
1036
1130
  }
1131
+ if (action === 'check-self-update') {
1132
+ try {
1133
+ const result = await actionCheckSelf()
1134
+ sendJson(res, 200, { ok: true, result, state: await buildState() })
1135
+ } catch (error) {
1136
+ sendJson(res, 200, {
1137
+ ok: false,
1138
+ error: `检查本体更新失败:${String((error && error.message) || error)}`,
1139
+ state: await buildState(),
1140
+ })
1141
+ }
1142
+ return
1143
+ }
1037
1144
  if (action === 'check-updates') {
1038
1145
  const started = startCheckUpdates()
1039
1146
  sendJson(res, started.ok ? 200 : 409, { ...started, state: await buildState() })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-anime-bundle",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "二次元大肥鱼模式:一键开关整套二次元外观插件、检查更新、装回缺失的插件,并带一个可随时开关的「肥鱼娘」人格。",
6
6
  "keywords": [