@huaqiu/dsh-tool-plugin-update 0.6.6 → 0.6.8
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/lib/client.js +1852 -397
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +36 -4
- package/package.json +3 -3
- package/src/client/api.ts +281 -1
- package/src/client/copy.ts +230 -6
- package/src/client/index.ts +881 -12
- package/src/client/update-view.ts +848 -242
- package/src/routes.ts +49 -7
package/src/client/copy.ts
CHANGED
|
@@ -20,9 +20,16 @@ const zh = {
|
|
|
20
20
|
loading: '正在读取插件更新…',
|
|
21
21
|
empty: '没有可用的插件更新',
|
|
22
22
|
checkFailed: '检查更新失败,请重试',
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// The button installs the ENTIRE offered set at once (not one card) — label
|
|
24
|
+
// it honestly rather than per-plugin.
|
|
25
|
+
installAll: (count: number) => `安装整套更新(${count} 项)`,
|
|
26
|
+
installOne: '安装整套',
|
|
27
|
+
installOneTip: '将安装整套 N 项更新并自动重启 DSH,而不仅是此插件',
|
|
25
28
|
installing: '正在安装…(DSH 将自动重启)',
|
|
29
|
+
retry: '重试',
|
|
30
|
+
checkedAt: (when: string) => `上次检查:${when}`,
|
|
31
|
+
checkFailedBanner: (message: string) => `检查更新失败:${message}`,
|
|
32
|
+
staleNote: '以下为上次成功检查的结果,可能已过期',
|
|
26
33
|
nothingToInstall: '暂无可安装的更新',
|
|
27
34
|
ignore: '忽略此版本',
|
|
28
35
|
unignore: '恢复提醒',
|
|
@@ -56,11 +63,23 @@ const zh = {
|
|
|
56
63
|
unknown: '版本未知',
|
|
57
64
|
notConfigured: '未配置更新源',
|
|
58
65
|
note: '运行时更新由 EDA 安装器处理',
|
|
66
|
+
sizeLabel: '包大小',
|
|
59
67
|
update: '安装运行时更新',
|
|
60
68
|
updateConfirm: (version: string) =>
|
|
61
69
|
`安装 HQ Edge 运行时 ${version}?HQ Edge 会先关闭并完成替换,然后重新启动。`,
|
|
62
|
-
|
|
70
|
+
// No fixed "takes one minute" claim: duration depends on download speed
|
|
71
|
+
// and package size (the bundle is hundreds of MB).
|
|
72
|
+
updating: '正在下载并校验运行时包…',
|
|
73
|
+
durationNote: '耗时取决于下载速度与包体大小;运行时包较大,替换后 HQ Edge 会自动重启。',
|
|
63
74
|
updateAccepted: '运行时更新已受理,HQ Edge 正在重启…',
|
|
75
|
+
size: (bytes: number) => `约 ${formatMb(bytes)}`,
|
|
76
|
+
lastResult: {
|
|
77
|
+
title: '上次运行时更新结果',
|
|
78
|
+
succeeded: '运行时更新成功',
|
|
79
|
+
failed: '运行时更新失败',
|
|
80
|
+
rolledBack: '运行时更新已回滚(已恢复旧版本)',
|
|
81
|
+
elevation: '系统级安装可能弹出 UAC 提权窗口;拒绝提权会导致替换失败并自动回滚到旧版本。',
|
|
82
|
+
},
|
|
64
83
|
// ── Update-source editor ──
|
|
65
84
|
sourceHint: '运行时更新清单的下载地址,保存后立即生效',
|
|
66
85
|
sourceEdit: '修改',
|
|
@@ -92,6 +111,108 @@ const zh = {
|
|
|
92
111
|
installSuccess: '更新已安装,正在重启 DSH…',
|
|
93
112
|
confirmInstall: '确认安装',
|
|
94
113
|
cancel: '取消',
|
|
114
|
+
// ── Durable update job (active / result / recent) ──
|
|
115
|
+
job: {
|
|
116
|
+
kindPluginSet: '插件集更新',
|
|
117
|
+
kindRuntime: 'HQ Edge 运行时更新',
|
|
118
|
+
phase: {
|
|
119
|
+
queued: '排队中',
|
|
120
|
+
resolving: '解析版本',
|
|
121
|
+
downloading: '下载中',
|
|
122
|
+
verifying: '校验完整性',
|
|
123
|
+
staging: '暂存文件',
|
|
124
|
+
activating: '启用插件集',
|
|
125
|
+
'awaiting-host': '等待主机替换运行时',
|
|
126
|
+
restarting: '正在重启',
|
|
127
|
+
'verifying-after-restart': '重启后校验',
|
|
128
|
+
done: '已完成',
|
|
129
|
+
failed: '失败',
|
|
130
|
+
'rolled-back': '已回滚',
|
|
131
|
+
abandoned: '已中断',
|
|
132
|
+
} as Record<string, string>,
|
|
133
|
+
willRestartDsh: '完成后 DSH 将自动重启,更新本身会在后台继续。',
|
|
134
|
+
willSwapRuntime: 'HQ Edge 会下载完整运行时包并退出,由 EDA 主机替换后重启;系统级安装可能弹出 UAC 提权窗口。',
|
|
135
|
+
closeNote: '关闭此面板不会取消更新。',
|
|
136
|
+
bytes: (done: string, total: string) => `${done} / ${total}`,
|
|
137
|
+
speed: (v: string) => `${v}/s`,
|
|
138
|
+
eta: (s: string) => `剩余约 ${s}`,
|
|
139
|
+
nextDone: '正在完成,请稍候…',
|
|
140
|
+
// Terminal result view
|
|
141
|
+
resultDone: '更新已完成',
|
|
142
|
+
resultFailed: '更新失败',
|
|
143
|
+
resultRolledBack: '更新已回滚',
|
|
144
|
+
resultAbandoned: '更新未完成',
|
|
145
|
+
retry: '重新尝试(发起新的更新)',
|
|
146
|
+
recentTitle: '最近更新',
|
|
147
|
+
stepsTitle: '各组件进度',
|
|
148
|
+
logHint: (hint: string) => `日志标识:${hint}`,
|
|
149
|
+
},
|
|
150
|
+
// ── Release metadata ──
|
|
151
|
+
release: {
|
|
152
|
+
summaryTitle: '版本说明',
|
|
153
|
+
notesLink: '查看发布说明',
|
|
154
|
+
breakingTitle: '破坏性变更',
|
|
155
|
+
changesTitle: '更新内容',
|
|
156
|
+
advanced: '高级:更新源',
|
|
157
|
+
publishedAt: (when: string) => `发布于 ${when}`,
|
|
158
|
+
},
|
|
159
|
+
// ── Refactored dock layout (interactive_refactored_ui_mockup.html) ──
|
|
160
|
+
ui: {
|
|
161
|
+
title: '更新中心',
|
|
162
|
+
gearTooltip: '高级设置',
|
|
163
|
+
settingsTitle: '更新源配置 (高级)',
|
|
164
|
+
originDefault: '默认源',
|
|
165
|
+
originCustom: '自定义源',
|
|
166
|
+
pluginUrlLabel: '插件 Manifest URL',
|
|
167
|
+
runtimeUrlLabel: '运行时 Manifest URL',
|
|
168
|
+
saveAndRefresh: '保存并刷新',
|
|
169
|
+
checkedAgo: (ago: string) => `上次检查: ${ago}`,
|
|
170
|
+
checkedUnknown: '尚未检查更新',
|
|
171
|
+
agoJust: '刚刚',
|
|
172
|
+
agoMinutes: (n: number) => `${n} 分钟前`,
|
|
173
|
+
agoHours: (n: number) => `${n} 小时前`,
|
|
174
|
+
agoDays: (n: number) => `${n} 天前`,
|
|
175
|
+
// Active-job banner
|
|
176
|
+
jobPluginTitle: (v: string) => `正在升级全套插件 (v${v})`,
|
|
177
|
+
jobRuntimeTitle: (v: string) => `正在升级 HQ Edge 运行时 (v${v})`,
|
|
178
|
+
jobSteps: ['下载', '校验', '替换', '重启'],
|
|
179
|
+
// Runtime result alert
|
|
180
|
+
rollbackTitle: '上次 HQ Edge 运行时更新已自动回滚',
|
|
181
|
+
failedTitle: '上次 HQ Edge 运行时更新失败',
|
|
182
|
+
rollbackBody: (oldVer: string, code: string) =>
|
|
183
|
+
`系统已安全恢复至旧版本 (v${oldVer})。代码: ${code}`,
|
|
184
|
+
failedBody: (oldVer: string, code: string) => `未能完成运行时替换 (旧版本 v${oldVer})。代码: ${code}`,
|
|
185
|
+
dismiss: '忽略',
|
|
186
|
+
successInline: '上次运行时更新成功',
|
|
187
|
+
// Runtime engine card
|
|
188
|
+
runtimeEngine: 'HQ Edge 核心运行时',
|
|
189
|
+
currentChip: (v: string) => `v${v} (当前)`,
|
|
190
|
+
newVersion: (v: string) => `新版本 v${v} 可用`,
|
|
191
|
+
breakingTag: '关键修复',
|
|
192
|
+
sizeLine: (size: string, summary: string) => `体积: ${size}${summary ? ` · ${summary}` : ''}`,
|
|
193
|
+
upgradeCore: '升级核心',
|
|
194
|
+
runtimeRestartNote: '升级运行时需自动重启 KiCad 进程服务',
|
|
195
|
+
// Plugin list
|
|
196
|
+
pendingTitle: '待更新插件',
|
|
197
|
+
allChangelog: '展开全部更新日志',
|
|
198
|
+
changelogBtn: '日志',
|
|
199
|
+
changelogTitle: '更新内容:',
|
|
200
|
+
blockedBadge: '无法安装',
|
|
201
|
+
// Footer
|
|
202
|
+
footerCount: (n: number) => `准备安装 ${n} 项兼容插件`,
|
|
203
|
+
footerSet: (v: string) => `版本集: v${v}`,
|
|
204
|
+
installAllSet: (v: string) => `一键更新全套插件 (v${v})`,
|
|
205
|
+
ignoreBtn: '忽略',
|
|
206
|
+
footnote: '更新将自动应用并重启 DSH 视图,不影响 EDA 图纸数据',
|
|
207
|
+
},
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Compact a byte count for display: "约 12.3 MB" / "约 480 MB". */
|
|
211
|
+
export function formatMb(bytes: number): string {
|
|
212
|
+
if (!Number.isFinite(bytes) || bytes <= 0) return ''
|
|
213
|
+
const mb = bytes / (1024 * 1024)
|
|
214
|
+
if (mb >= 100) return `${Math.round(mb)} MB`
|
|
215
|
+
return `${mb.toFixed(1)} MB`
|
|
95
216
|
}
|
|
96
217
|
|
|
97
218
|
export type UpdateCopy = typeof zh
|
|
@@ -107,9 +228,14 @@ const en: UpdateCopy = {
|
|
|
107
228
|
loading: 'Reading plugin updates…',
|
|
108
229
|
empty: 'No plugin updates available',
|
|
109
230
|
checkFailed: 'Failed to check for updates — please retry',
|
|
110
|
-
installAll: (count: number) => `Install
|
|
111
|
-
installOne: 'Install',
|
|
231
|
+
installAll: (count: number) => `Install whole set (${count})`,
|
|
232
|
+
installOne: 'Install set',
|
|
233
|
+
installOneTip: 'Installs the whole set of N updates and restarts DSH — not just this plugin',
|
|
112
234
|
installing: 'Installing… (DSH will restart)',
|
|
235
|
+
retry: 'Retry',
|
|
236
|
+
checkedAt: (when: string) => `Last checked: ${when}`,
|
|
237
|
+
checkFailedBanner: (message: string) => `Update check failed: ${message}`,
|
|
238
|
+
staleNote: 'Showing the last successful check — it may be stale',
|
|
113
239
|
nothingToInstall: 'Nothing to install right now',
|
|
114
240
|
ignore: 'Ignore this release',
|
|
115
241
|
unignore: 'Show again',
|
|
@@ -143,11 +269,21 @@ const en: UpdateCopy = {
|
|
|
143
269
|
unknown: 'Version unknown',
|
|
144
270
|
notConfigured: 'No update source configured',
|
|
145
271
|
note: 'Runtime updates are handled by the EDA installer',
|
|
272
|
+
sizeLabel: 'Package size',
|
|
146
273
|
update: 'Install runtime update',
|
|
147
274
|
updateConfirm: (version: string) =>
|
|
148
275
|
`Install HQ Edge runtime ${version}? HQ Edge shuts down to swap the runtime, then restarts.`,
|
|
149
|
-
updating: 'Downloading and verifying the runtime bundle
|
|
276
|
+
updating: 'Downloading and verifying the runtime bundle…',
|
|
277
|
+
durationNote: 'Duration depends on download speed and package size; the runtime bundle is large, and HQ Edge restarts after the swap.',
|
|
150
278
|
updateAccepted: 'Runtime update accepted — HQ Edge is restarting…',
|
|
279
|
+
size: (bytes: number) => `~ ${formatMb(bytes)}`,
|
|
280
|
+
lastResult: {
|
|
281
|
+
title: 'Last runtime update result',
|
|
282
|
+
succeeded: 'Runtime update succeeded',
|
|
283
|
+
failed: 'Runtime update failed',
|
|
284
|
+
rolledBack: 'Runtime update rolled back (previous version restored)',
|
|
285
|
+
elevation: 'A system-wide install may show a UAC elevation prompt; declining it fails the swap and rolls back to the previous version.',
|
|
286
|
+
},
|
|
151
287
|
// ── Update-source editor ──
|
|
152
288
|
sourceHint: 'Where the runtime update manifest is fetched from; saved changes take effect immediately',
|
|
153
289
|
sourceEdit: 'Edit',
|
|
@@ -180,6 +316,94 @@ const en: UpdateCopy = {
|
|
|
180
316
|
installSuccess: 'Update installed — restarting DSH…',
|
|
181
317
|
confirmInstall: 'Confirm install',
|
|
182
318
|
cancel: 'Cancel',
|
|
319
|
+
// ── Durable update job (active / result / recent) ──
|
|
320
|
+
job: {
|
|
321
|
+
kindPluginSet: 'Plugin-set update',
|
|
322
|
+
kindRuntime: 'HQ Edge runtime update',
|
|
323
|
+
phase: {
|
|
324
|
+
queued: 'Queued',
|
|
325
|
+
resolving: 'Resolving version',
|
|
326
|
+
downloading: 'Downloading',
|
|
327
|
+
verifying: 'Verifying integrity',
|
|
328
|
+
staging: 'Staging files',
|
|
329
|
+
activating: 'Activating plugin set',
|
|
330
|
+
'awaiting-host': 'Waiting for host to swap runtime',
|
|
331
|
+
restarting: 'Restarting',
|
|
332
|
+
'verifying-after-restart': 'Verifying after restart',
|
|
333
|
+
done: 'Done',
|
|
334
|
+
failed: 'Failed',
|
|
335
|
+
'rolled-back': 'Rolled back',
|
|
336
|
+
abandoned: 'Abandoned',
|
|
337
|
+
} as Record<string, string>,
|
|
338
|
+
willRestartDsh: 'DSH restarts automatically once this finishes; the update continues in the background.',
|
|
339
|
+
willSwapRuntime: 'HQ Edge downloads the full runtime bundle and exits; the EDA host swaps and relaunches it. A system-wide install may show a UAC prompt.',
|
|
340
|
+
closeNote: 'Closing this panel does not cancel the update.',
|
|
341
|
+
bytes: (done: string, total: string) => `${done} / ${total}`,
|
|
342
|
+
speed: (v: string) => `${v}/s`,
|
|
343
|
+
eta: (s: string) => `~${s} left`,
|
|
344
|
+
nextDone: 'Finishing — please wait…',
|
|
345
|
+
resultDone: 'Update completed',
|
|
346
|
+
resultFailed: 'Update failed',
|
|
347
|
+
resultRolledBack: 'Update rolled back',
|
|
348
|
+
resultAbandoned: 'Update did not complete',
|
|
349
|
+
retry: 'Retry (start a new update)',
|
|
350
|
+
recentTitle: 'Recent updates',
|
|
351
|
+
stepsTitle: 'Per-component progress',
|
|
352
|
+
logHint: (hint: string) => `Log id: ${hint}`,
|
|
353
|
+
},
|
|
354
|
+
// ── Release metadata ──
|
|
355
|
+
release: {
|
|
356
|
+
summaryTitle: 'Release notes',
|
|
357
|
+
notesLink: 'View release notes',
|
|
358
|
+
breakingTitle: 'Breaking changes',
|
|
359
|
+
changesTitle: 'What changed',
|
|
360
|
+
advanced: 'Advanced: update sources',
|
|
361
|
+
publishedAt: (when: string) => `Published ${when}`,
|
|
362
|
+
},
|
|
363
|
+
// ── Refactored dock layout (interactive_refactored_ui_mockup.html) ──
|
|
364
|
+
ui: {
|
|
365
|
+
title: 'Update Center',
|
|
366
|
+
gearTooltip: 'Advanced settings',
|
|
367
|
+
settingsTitle: 'Update source (advanced)',
|
|
368
|
+
originDefault: 'Default source',
|
|
369
|
+
originCustom: 'Custom source',
|
|
370
|
+
pluginUrlLabel: 'Plugin manifest URL',
|
|
371
|
+
runtimeUrlLabel: 'Runtime manifest URL',
|
|
372
|
+
saveAndRefresh: 'Save & refresh',
|
|
373
|
+
checkedAgo: (ago: string) => `Last checked: ${ago}`,
|
|
374
|
+
checkedUnknown: 'No check yet',
|
|
375
|
+
agoJust: 'just now',
|
|
376
|
+
agoMinutes: (n: number) => `${n} min ago`,
|
|
377
|
+
agoHours: (n: number) => `${n} h ago`,
|
|
378
|
+
agoDays: (n: number) => `${n} d ago`,
|
|
379
|
+
jobPluginTitle: (v: string) => `Updating plugin set (v${v})`,
|
|
380
|
+
jobRuntimeTitle: (v: string) => `Upgrading HQ Edge runtime (v${v})`,
|
|
381
|
+
jobSteps: ['Download', 'Verify', 'Swap', 'Restart'],
|
|
382
|
+
rollbackTitle: 'Last HQ Edge runtime update rolled back automatically',
|
|
383
|
+
failedTitle: 'Last HQ Edge runtime update failed',
|
|
384
|
+
rollbackBody: (oldVer: string, code: string) =>
|
|
385
|
+
`Safely restored to the previous version (v${oldVer}). Code: ${code}`,
|
|
386
|
+
failedBody: (oldVer: string, code: string) => `Runtime swap did not complete (old v${oldVer}). Code: ${code}`,
|
|
387
|
+
dismiss: 'Dismiss',
|
|
388
|
+
successInline: 'Last runtime update succeeded',
|
|
389
|
+
runtimeEngine: 'HQ Core Runtime',
|
|
390
|
+
currentChip: (v: string) => `v${v} (current)`,
|
|
391
|
+
newVersion: (v: string) => `New v${v} available`,
|
|
392
|
+
breakingTag: 'Critical fix',
|
|
393
|
+
sizeLine: (size: string, summary: string) => `Size: ${size}${summary ? ` · ${summary}` : ''}`,
|
|
394
|
+
upgradeCore: 'Upgrade core',
|
|
395
|
+
runtimeRestartNote: 'Upgrading the runtime restarts the KiCad process service',
|
|
396
|
+
pendingTitle: 'Plugins to update',
|
|
397
|
+
allChangelog: 'Expand all changelogs',
|
|
398
|
+
changelogBtn: 'Log',
|
|
399
|
+
changelogTitle: 'What changed:',
|
|
400
|
+
blockedBadge: 'Cannot install',
|
|
401
|
+
footerCount: (n: number) => `Ready to install ${n} compatible plugin${n === 1 ? '' : 's'}`,
|
|
402
|
+
footerSet: (v: string) => `Set: v${v}`,
|
|
403
|
+
installAllSet: (v: string) => `Update all plugins (v${v})`,
|
|
404
|
+
ignoreBtn: 'Ignore',
|
|
405
|
+
footnote: 'Updates apply automatically and restart the DSH view — your EDA schematic data is untouched',
|
|
406
|
+
},
|
|
183
407
|
}
|
|
184
408
|
|
|
185
409
|
export const COPY = { zh, en } as const
|