dsh-aupdate 0.7.1 → 0.7.2

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/client.js +42 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -149,6 +149,12 @@ mtime 为准:那是磁盘事实。会话目录整个读不到时返回「不
149
149
  - 「全选 / 清空」只作用于当前筛选出来的行——搜完再点全选,意思是把搜到的都勾上
150
150
  - 这个 profile 里装着的插件都会列出来,列表本身就是「能勾什么」的全部答案
151
151
 
152
+ ### 提示不重复
153
+
154
+ 「上一次」卡片里,本轮结果的原因只出现一次:点「立刻检查」后的反馈只是一句
155
+ 「检查完成」,6 秒后自动收掉——不再把 reason 和状态词(还是英文 done)拼一遍贴在下面。
156
+ 状态词只在没有已渲染原因时作为兜底,且按当前语言显示。
157
+
152
158
  ### 关于 aupdate
153
159
 
154
160
  设置页底部有「关于 aupdate」信息组(照 Bloom 的「关于 Bloom」做):版本号(从 package.json
@@ -407,6 +413,13 @@ their installed versions, instead of a textarea you had to type package names in
407
413
  Search narrows the list; Select all / Clear only touch the rows currently shown, so
408
414
  "search, then select all" means what you expect.
409
415
 
416
+ ### No duplicated hints
417
+
418
+ The Last run card states the outcome once. Clicking Check now only adds a short
419
+ "Check finished" acknowledgment that clears itself after six seconds — it no longer echoes
420
+ the same reason plus a raw status word underneath. Status words are a localized fallback
421
+ used only when no rendered reason exists.
422
+
410
423
  An **About aupdate** group sits at the bottom of the page (modeled on Bloom's About section):
411
424
  the version (read from package.json, so releases need no front-end edit), a changelog link,
412
425
  source repository, issue tracker, plus Star and Share (copies the project URL; the URL is
package/client.js CHANGED
@@ -14,6 +14,30 @@ window.__ModuleLoader__.load({
14
14
  * 外链一律 target=_blank + rel=noopener noreferrer:设置页可能跑在受限
15
15
  * webview 里,noopener 防止新页反向控制本页。
16
16
  */
17
+ /**
18
+ * 状态词本地化。
19
+ *
20
+ * 后端存的是数据(done / failed / blocked…),不该直接显示在界面上。
21
+ * 只有拿不到已渲染的 reason 时的兜底路径会用到它,所以表不用很大。
22
+ */
23
+ const STATUS_LABELS = {
24
+ zh: {
25
+ done: '完成', failed: '失败', blocked: '已让开', partial: '部分完成', busy: '正在跑',
26
+ skipped: '已跳过', none: '无', ok: '成功', cancelled: '已取消', restart: '需重启',
27
+ applying: '生效中', unavailable: '不可用',
28
+ },
29
+ en: {
30
+ done: 'done', failed: 'failed', blocked: 'held off', partial: 'partly done', busy: 'busy',
31
+ skipped: 'skipped', none: 'none', ok: 'ok', cancelled: 'cancelled', restart: 'restart needed',
32
+ applying: 'applying', unavailable: 'unavailable',
33
+ },
34
+ }
35
+
36
+ function statusLabel(value) {
37
+ const table = STATUS_LABELS[LANG] ?? STATUS_LABELS.zh
38
+ return table[String(value ?? '')] ?? String(value ?? '')
39
+ }
40
+
17
41
  const REPO_URL = 'https://github.com/CalmSun/dsh-aupdate'
18
42
  const CHANGELOG_URL = REPO_URL + '/releases'
19
43
  const ISSUES_URL = REPO_URL + '/issues/new'
@@ -37,6 +61,7 @@ window.__ModuleLoader__.load({
37
61
  progressApply: '正在就地生效…',
38
62
  runDone: '检查完成',
39
63
  runFailed: '检查没能完成',
64
+ off: '已关闭',
40
65
  lastRun: '上一次',
41
66
  never: '还没跑过',
42
67
  checked: '检查了',
@@ -170,6 +195,7 @@ window.__ModuleLoader__.load({
170
195
  progressApply: 'Applying in place…',
171
196
  runDone: 'Check finished',
172
197
  runFailed: 'Check could not finish',
198
+ off: 'off',
173
199
  lastRun: 'Last run',
174
200
  never: 'never',
175
201
  checked: 'checked',
@@ -893,9 +919,12 @@ window.__ModuleLoader__.load({
893
919
  // 进度由上面的常驻轮询统一负责,这里只发请求。
894
920
  const result = await runNow('update')
895
921
  if (result?.started === false) {
922
+ // 「已经有一轮在跑」这类信息在「上一次」里没有,必须显示。
896
923
  setRunHint(result.reason || T.runFailed)
897
924
  } else {
898
- setRunHint((result?.reason || T.runDone) + ' · ' + (result?.status ?? ''))
925
+ // 只给一句「检查完成」。原因和状态已经写进「上一次」那张卡,
926
+ // 这里再拼一遍 reason + status 会和它逐字重复(还有英文 done)。
927
+ setRunHint(T.runDone)
899
928
  }
900
929
  // 跑完把状态刷一遍,页面上看到的就是最新结果。
901
930
  try {
@@ -911,6 +940,14 @@ window.__ModuleLoader__.load({
911
940
  }
912
941
  }, [running])
913
942
 
943
+ // 结束提示只是一次性反馈:6 秒后自己收掉,免得它一直挂在卡片里,
944
+ // 和下面「上一次」的原因并列成两段一样的文字。
945
+ useEffect(() => {
946
+ if (running || runHint === '') return undefined
947
+ const timer = setTimeout(() => setRunHint(''), 6000)
948
+ return () => clearTimeout(timer)
949
+ }, [running, runHint])
950
+
914
951
  const doCleanup = useCallback(async () => {
915
952
  if (cleaning) return
916
953
  setCleaning(true)
@@ -1099,7 +1136,9 @@ window.__ModuleLoader__.load({
1099
1136
  h('span', null, (last.updates?.length ?? 0) > 0
1100
1137
  ? (last.updates?.length ?? 0) + ' ' + T.updates
1101
1138
  : T.upToDate),
1102
- h('span', null, last.reason || last.status || ''),
1139
+ // reason 是后端按语言渲染好的句子;没有它才退回本地化的状态词,
1140
+ // 绝不要把英文 done 直接摆到界面上。
1141
+ h('span', null, last.reason || statusLabel(last.status) || ''),
1103
1142
  ),
1104
1143
  // 只报「4 个可更新」不够:要看得出是哪几个、从哪版到哪版。
1105
1144
  // 列表封高度、内部滚动,30 个包也不会把这张卡拉成一屏多。
@@ -1253,7 +1292,7 @@ window.__ModuleLoader__.load({
1253
1292
  const text = state === null
1254
1293
  ? '…'
1255
1294
  : state.settings?.enabled === false
1256
- ? (T.enabled + ':' + 'off')
1295
+ ? (T.enabled + ':' + T.off)
1257
1296
  : last === null || last === undefined
1258
1297
  ? T.never
1259
1298
  : (last.updates?.length ?? 0) > 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aupdate",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "description": "定时检查 DSH 插件更新,串行安装后就地生效,不重启;支持多种调度节奏、失败抑制、按包回滚,并在动手前留快照、忙时自动让开;不更新/只更新哪些插件改成勾选,发现更新在右下角提醒,日志最新在最上面,并在「设置 → 插件更新」里有独立一页。",
6
6
  "license": "MIT",