@restregular/dsh-powerup 0.4.1 → 0.5.0
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 +29 -12
- package/client.js +378 -31
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,7 +30,9 @@ Right-click empty space in the ledger:
|
|
|
30
30
|
- **Open the Power-Up page** — the sidebar control panel.
|
|
31
31
|
|
|
32
32
|
The sidebar **Power-Up** page turns the menu on or off and lists the available
|
|
33
|
-
actions. The setting is stored in the browser.
|
|
33
|
+
actions. The setting is stored in the browser. It also holds the defaults for
|
|
34
|
+
**one-click update** (auto-enable and auto-restart), which the plugin updater
|
|
35
|
+
uses.
|
|
34
36
|
|
|
35
37
|
### Stop a background job with a reason
|
|
36
38
|
|
|
@@ -64,18 +66,25 @@ update dialog:
|
|
|
64
66
|
2. Type a version or pick one from the floating version list. The current
|
|
65
67
|
installed version is tagged **Current**; the newest is tagged **latest**, and
|
|
66
68
|
a version that is both uses one **Current · latest** tag.
|
|
67
|
-
3.
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
3. **One-click update** installs the newest version and skips both questions:
|
|
70
|
+
by default the new copy is enabled and DSH restarts automatically. The
|
|
71
|
+
Power-Up page can turn either default off. With auto-enable off, the new
|
|
72
|
+
version is left disabled and nothing restarts. With auto-restart off (or when
|
|
73
|
+
the current runtime cannot restart itself), the completion panel closes
|
|
74
|
+
itself after a few seconds instead of staying on screen. Power-Up's own
|
|
75
|
+
update keeps its background handoff and does not offer one-click.
|
|
76
|
+
4. Otherwise, confirming removes the installed copy, checks the new spec the
|
|
77
|
+
way **Add plugin** does, and installs the selected version without enabling
|
|
78
|
+
it. Because the old copy is already gone at that point, a refused check or a
|
|
70
79
|
failed install automatically re-installs the removed version with its
|
|
71
80
|
previous enabled state; the dialog reports both the failure and the rollback
|
|
72
81
|
result.
|
|
73
|
-
|
|
74
|
-
|
|
82
|
+
5. The dialog then asks whether to enable the new version.
|
|
83
|
+
6. After enabling, it asks whether to restart DSH. On the desktop app the
|
|
75
84
|
`lib/restart-helper.cjs` helper relaunches the exact executable after the old
|
|
76
85
|
Host exits; under `dsh web` the dialog explains that the terminal owns the
|
|
77
86
|
process.
|
|
78
|
-
|
|
87
|
+
7. A management call that reports `restart-required` keeps a **Restart needed**
|
|
79
88
|
tag on the card and adds the plugin to the count beside the **Installed
|
|
80
89
|
plugins** heading. The heading bar is always present — with **No plugins need
|
|
81
90
|
a restart** and the restart button when nothing is pending — and a **Restart
|
|
@@ -84,11 +93,11 @@ update dialog:
|
|
|
84
93
|
the built-in **Add plugin** / **Update** UI, or before this page loaded, are
|
|
85
94
|
marked too.
|
|
86
95
|
|
|
87
|
-
Power-Up updates itself through the same dialog
|
|
88
|
-
unloads this panel, the Host answers
|
|
89
|
-
`inspect` → `installBundle(enabled: true)`
|
|
90
|
-
which keeps running after the Power-Up Host
|
|
91
|
-
refresh the page when the install finishes.
|
|
96
|
+
Power-Up updates itself through the same dialog (the one-click action is hidden
|
|
97
|
+
for itself). Because removing the plugin unloads this panel, the Host answers
|
|
98
|
+
first and then hands `removeBundle` → `inspect` → `installBundle(enabled: true)`
|
|
99
|
+
to the built-in manager service, which keeps running after the Power-Up Host
|
|
100
|
+
fiber is unloaded. The panel closes; refresh the page when the install finishes.
|
|
92
101
|
|
|
93
102
|
## Design notes
|
|
94
103
|
|
|
@@ -131,6 +140,14 @@ refresh the page when the install finishes.
|
|
|
131
140
|
`~/.dsh/powerup/self-update.log`. The Host captures the version it was loaded
|
|
132
141
|
from before removal and re-installs that version if the check or install
|
|
133
142
|
fails, so a failed self-update does not leave Power-Up missing.
|
|
143
|
+
- **One-click update is a client-side decision.** The newest version and both
|
|
144
|
+
defaults live in the shared settings store (`dsh-powerup:settings:v1`), so the
|
|
145
|
+
Power-Up page and an open dialog agree without a reload. A one-click run
|
|
146
|
+
installs disabled — the same shape as **Add plugin** — then enables through
|
|
147
|
+
`setBundleEnabled`, and posts the restart only when the defaults allow it. With
|
|
148
|
+
auto-enable off the new copy stays disabled and nothing restarts. When no
|
|
149
|
+
restart happens the completion panel closes on a timer; install, enable, and
|
|
150
|
+
restart failures stay on screen with their reason instead.
|
|
134
151
|
- **Restart status lives in this browser session.** A management result that
|
|
135
152
|
says `restart-required` is written to `sessionStorage`; the card gets a
|
|
136
153
|
**Restart needed** tag and the group heading gets a count plus a restart
|
package/client.js
CHANGED
|
@@ -44,9 +44,11 @@
|
|
|
44
44
|
|
|
45
45
|
const NS = 'dsh-powerup';
|
|
46
46
|
const SETTINGS_KEY = 'dsh-powerup:settings:v1';
|
|
47
|
-
const VERSION = '0.
|
|
47
|
+
const VERSION = '0.5.0';
|
|
48
48
|
const MENU_GAP = 8;
|
|
49
49
|
const MENU_WIDTH = 248;
|
|
50
|
+
/** How long a one-click update's completion panel stays open when nothing restarts. */
|
|
51
|
+
const ONE_CLICK_AUTO_CLOSE_MS = 4000;
|
|
50
52
|
|
|
51
53
|
// ------------------------------------------------------------------
|
|
52
54
|
// Dictionaries
|
|
@@ -66,8 +68,14 @@
|
|
|
66
68
|
'page.how2': '在记录行上右键;在空白处右键可执行会话级操作。',
|
|
67
69
|
'page.how3': '菜单支持 ↑ / ↓ 选择、Enter 执行、Esc 关闭。',
|
|
68
70
|
'page.updateTitle': '插件自更新',
|
|
69
|
-
'page.updateDesc': '在插件页为每个第三方已安装插件提供更新入口:从安装源选版本、卸载旧版、按「添加插件」流程重装,并可立即启用与重启 DSH
|
|
70
|
-
'page.updateHow': '
|
|
71
|
+
'page.updateDesc': '在插件页为每个第三方已安装插件提供更新入口:从安装源选版本、卸载旧版、按「添加插件」流程重装,并可立即启用与重启 DSH;也可以一键更新到最新版。',
|
|
72
|
+
'page.updateHow': '打开侧边栏的「插件」页,在「已安装插件」分组中点击卡片右侧的更新图标;在更新面板里点「一键更新」即可安装最新版,并按下面的默认行为处理。',
|
|
73
|
+
'page.oneClickTitle': '一键更新',
|
|
74
|
+
'page.oneClickDesc': '在更新面板里点「一键更新」时,直接安装最新版本,跳过「是否启用」和「是否重启」的询问。',
|
|
75
|
+
'page.oneClickEnable': '自动启用新版本',
|
|
76
|
+
'page.oneClickEnableHint': '关闭后,一键更新只安装新版本,保持停用,也不自动重启。',
|
|
77
|
+
'page.oneClickRestart': '自动重启 DSH',
|
|
78
|
+
'page.oneClickRestartHint': '关闭后,更新完成的提示会自动关闭。',
|
|
71
79
|
'page.jobStopTitle': '后台任务停止原因',
|
|
72
80
|
'page.jobStopDesc': '在会话顶部的后台任务面板里点停止按钮时,可以顺手填写停止原因;原因会附加在任务结束后注入会话的提示里。',
|
|
73
81
|
'page.jobStopHow': '打开任意会话,点顶部的「后台任务」面板,在运行中的任务右侧点停止,填写原因(可留空)后确认。',
|
|
@@ -186,7 +194,18 @@
|
|
|
186
194
|
'update.doneDisabled': '{name} 已安装 {version},尚未启用。',
|
|
187
195
|
'update.doneEnabled': '新版本已启用。',
|
|
188
196
|
'update.doneRestart': '部分更改需要重启 DSH 后生效。',
|
|
197
|
+
'update.doneAutoClose': '完成面板将在 {seconds} 秒后自动关闭。',
|
|
189
198
|
'update.doneButton': '完成',
|
|
199
|
+
'update.oneClick': '一键更新',
|
|
200
|
+
'update.oneClickTitle': '一键更新',
|
|
201
|
+
'update.oneClickHint': '安装最新版本 {version},跳过「是否启用」和「是否重启」的询问。',
|
|
202
|
+
'update.oneClickDefaults': '自动启用:{enable} · 自动重启:{restart}。可在侧边栏 Power-Up 页面修改。',
|
|
203
|
+
'update.on': '开',
|
|
204
|
+
'update.off': '关',
|
|
205
|
+
'update.oneClickNoLatest': '暂时读不到最新版本,请重试或手动选择版本。',
|
|
206
|
+
'update.oneClickUpToDate': '已经是最新版本,无需更新。',
|
|
207
|
+
'update.oneClickEnableFailed': '新版本已安装,但自动启用失败。请到「插件」页手动启用。',
|
|
208
|
+
'update.oneClickSkippedEnable': '已按设置保持停用;需要时到「插件」页启用。',
|
|
190
209
|
'update.errorTitle': '更新失败',
|
|
191
210
|
'update.rollbackOkTitle': '已恢复旧版本',
|
|
192
211
|
'update.rollbackOkDesc': '更新失败,{name} 已自动回滚到 {version},仍可继续使用。',
|
|
@@ -220,8 +239,14 @@
|
|
|
220
239
|
'page.how2': 'Right-click a record row; right-click empty space for session actions.',
|
|
221
240
|
'page.how3': 'Use ↑ / ↓ to move, Enter to run, Esc to close.',
|
|
222
241
|
'page.updateTitle': 'Update plugins',
|
|
223
|
-
'page.updateDesc': 'Every third-party plugin on the Plugins page gains an update entry: pick a version from a registry, remove the old copy, reinstall through the Add plugin path, then enable and restart DSH.',
|
|
224
|
-
'page.updateHow': 'Open Plugins in the sidebar and click the update icon at the right of a card under Installed plugins.',
|
|
242
|
+
'page.updateDesc': 'Every third-party plugin on the Plugins page gains an update entry: pick a version from a registry, remove the old copy, reinstall through the Add plugin path, then enable and restart DSH — or update to the newest version in one click.',
|
|
243
|
+
'page.updateHow': 'Open Plugins in the sidebar and click the update icon at the right of a card under Installed plugins; in the update panel, One-click update installs the newest version using the defaults below.',
|
|
244
|
+
'page.oneClickTitle': 'One-click update',
|
|
245
|
+
'page.oneClickDesc': 'One-click update installs the newest version and skips both the enable and the restart questions.',
|
|
246
|
+
'page.oneClickEnable': 'Enable the new version automatically',
|
|
247
|
+
'page.oneClickEnableHint': 'When off, one-click update only installs it, leaves it disabled, and does not restart.',
|
|
248
|
+
'page.oneClickRestart': 'Restart DSH automatically',
|
|
249
|
+
'page.oneClickRestartHint': 'When off, the completion panel closes itself.',
|
|
225
250
|
'page.jobStopTitle': 'Background job stop reason',
|
|
226
251
|
'page.jobStopDesc': 'When you stop a running job from the background jobs panel in the session header, you can leave a reason; the reason is appended to the notice injected into the session when the job settles.',
|
|
227
252
|
'page.jobStopHow': 'Open a session, expand the background jobs panel, press stop on a running job, type a reason (optional), then confirm.',
|
|
@@ -340,7 +365,18 @@
|
|
|
340
365
|
'update.doneDisabled': '{name} {version} is installed but not enabled.',
|
|
341
366
|
'update.doneEnabled': 'The new version is enabled.',
|
|
342
367
|
'update.doneRestart': 'Some changes apply only after DSH restarts.',
|
|
368
|
+
'update.doneAutoClose': 'This panel closes itself in {seconds} seconds.',
|
|
343
369
|
'update.doneButton': 'Done',
|
|
370
|
+
'update.oneClick': 'One-click update',
|
|
371
|
+
'update.oneClickTitle': 'One-click update',
|
|
372
|
+
'update.oneClickHint': 'Installs the newest version ({version}) and skips the enable and restart questions.',
|
|
373
|
+
'update.oneClickDefaults': 'Auto-enable: {enable} · Auto-restart: {restart}. Change these on the Power-Up page.',
|
|
374
|
+
'update.on': 'on',
|
|
375
|
+
'update.off': 'off',
|
|
376
|
+
'update.oneClickNoLatest': 'The newest version is not available yet. Retry or pick a version manually.',
|
|
377
|
+
'update.oneClickUpToDate': 'Already up to date.',
|
|
378
|
+
'update.oneClickEnableFailed': 'The new version is installed but could not be enabled. Enable it on the Plugins page.',
|
|
379
|
+
'update.oneClickSkippedEnable': 'Left disabled as configured; enable it on the Plugins page when ready.',
|
|
344
380
|
'update.errorTitle': 'Update failed',
|
|
345
381
|
'update.rollbackOkTitle': 'Previous version restored',
|
|
346
382
|
'update.rollbackOkDesc': 'The update failed, so {name} was rolled back to {version} and is ready to use.',
|
|
@@ -388,16 +424,23 @@
|
|
|
388
424
|
// ------------------------------------------------------------------
|
|
389
425
|
// Settings store (localStorage, per browser)
|
|
390
426
|
// ------------------------------------------------------------------
|
|
427
|
+
/** One-click update defaults: enable and restart unless the user turned one off. */
|
|
428
|
+
const DEFAULT_SETTINGS = { enabled: true, oneClickEnable: true, oneClickRestart: true };
|
|
429
|
+
|
|
391
430
|
function readSettings() {
|
|
392
431
|
try {
|
|
393
432
|
const parsed = JSON.parse(localStorage.getItem(SETTINGS_KEY) || 'null');
|
|
394
433
|
if (parsed !== null && typeof parsed === 'object') {
|
|
395
|
-
return {
|
|
434
|
+
return {
|
|
435
|
+
enabled: parsed.enabled !== false,
|
|
436
|
+
oneClickEnable: parsed.oneClickEnable !== false,
|
|
437
|
+
oneClickRestart: parsed.oneClickRestart !== false,
|
|
438
|
+
};
|
|
396
439
|
}
|
|
397
440
|
} catch {
|
|
398
441
|
/* Private mode or a corrupted value: use the default. */
|
|
399
442
|
}
|
|
400
|
-
return {
|
|
443
|
+
return { ...DEFAULT_SETTINGS };
|
|
401
444
|
}
|
|
402
445
|
|
|
403
446
|
let settingsValue = readSettings();
|
|
@@ -641,6 +684,16 @@
|
|
|
641
684
|
);
|
|
642
685
|
}
|
|
643
686
|
|
|
687
|
+
/** A lightning bolt: the one-click update action. */
|
|
688
|
+
function QuickIcon({ size = 16 }) {
|
|
689
|
+
return h(Icon, { size },
|
|
690
|
+
h('path', {
|
|
691
|
+
d: 'M9.1 1.9 3.9 8.7h3.1L6.9 14l5.2-6.8H9L9.1 1.9Z',
|
|
692
|
+
fill: 'currentColor',
|
|
693
|
+
}),
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
|
|
644
697
|
function StopIcon({ size = 16 }) {
|
|
645
698
|
return h(Icon, { size },
|
|
646
699
|
h('rect', {
|
|
@@ -719,6 +772,13 @@
|
|
|
719
772
|
.dsh-powerup-switch[aria-checked=true] .dsh-powerup-switch-track{background:var(--dsw-alias-brand-primary)}
|
|
720
773
|
.dsh-powerup-switch[aria-checked=true] .dsh-powerup-switch-thumb{background:var(--dsw-alias-label-primary-foreground,var(--dsw-alias-bg-layer-1));transform:translateX(15px)}
|
|
721
774
|
.dsh-powerup-section-title{margin:0 0 10px;color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase}
|
|
775
|
+
.dsh-powerup-settings{display:flex;flex-direction:column;gap:0;margin-top:12px}
|
|
776
|
+
.dsh-powerup-setting{display:flex;align-items:center;gap:14px;padding:9px 0;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
777
|
+
.dsh-powerup-setting:first-child{border-top:0;padding-top:4px}
|
|
778
|
+
.dsh-powerup-setting-copy{display:flex;flex:1 1 auto;flex-direction:column;gap:1px;min-width:0}
|
|
779
|
+
.dsh-powerup-setting-label{color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:18px}
|
|
780
|
+
.dsh-powerup-setting-hint{color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:15px}
|
|
781
|
+
.dsh-powerup-setting .dsh-powerup-switch{margin-left:auto}
|
|
722
782
|
.dsh-powerup-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0;padding:0;list-style:none}
|
|
723
783
|
.dsh-powerup-action{display:flex;align-items:flex-start;gap:8px;min-width:0;padding:7px 8px;border-radius:8px}
|
|
724
784
|
.dsh-powerup-action-icon{flex:none;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin-top:1px;color:var(--dsw-alias-label-tertiary)}
|
|
@@ -859,14 +919,20 @@
|
|
|
859
919
|
.dsh-powerup-update-option-title{color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:18px}
|
|
860
920
|
.dsh-powerup-update-option-host{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;overflow-wrap:anywhere}
|
|
861
921
|
.dsh-powerup-update-option .dsh-powerup-update-check{flex:none;margin-top:2px}
|
|
862
|
-
.dsh-powerup-update-foot{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:16px 24px 22px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
922
|
+
.dsh-powerup-update-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;padding:16px 24px 22px;border-top:.5px solid var(--dsw-alias-border-l1)}
|
|
863
923
|
.dsh-powerup-update-primary{height:36px;padding:0 14px;border:0;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-brand-primary));color:var(--dsw-alias-label-primary-foreground);font:inherit;font-size:14px;line-height:22px;cursor:pointer;transition:background .14s ease}
|
|
864
924
|
.dsh-powerup-update-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,var(--dsw-alias-brand-primary))}
|
|
865
925
|
.dsh-powerup-update-primary:disabled{opacity:.4;cursor:not-allowed}
|
|
866
926
|
.dsh-powerup-update-ghost{height:36px;padding:0 14px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:22px;cursor:pointer}
|
|
867
927
|
.dsh-powerup-update-ghost:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
868
928
|
.dsh-powerup-update-ghost:active{background:var(--dsw-alias-interactive-bg-active)}
|
|
869
|
-
.dsh-powerup-update-
|
|
929
|
+
.dsh-powerup-update-quick{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 13px;border:.5px solid color-mix(in srgb,var(--dsw-alias-state-warn-primary) 38%,transparent);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-label);font:inherit;font-size:13.5px;line-height:20px;white-space:nowrap;cursor:pointer;transition:background .14s ease,border-color .14s ease}
|
|
930
|
+
.dsh-powerup-update-quick:hover:not(:disabled){background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 16%,transparent)}
|
|
931
|
+
.dsh-powerup-update-quick:disabled{opacity:.45;cursor:not-allowed}
|
|
932
|
+
.dsh-powerup-update-quick-note{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border:.5px solid color-mix(in srgb,var(--dsw-alias-state-warn-primary) 26%,transparent);border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-state-warn-tertiary)}
|
|
933
|
+
.dsh-powerup-update-quick-note-title{display:flex;align-items:center;gap:6px;color:var(--dsw-alias-state-warn-label);font-size:12px;line-height:17px;font-weight:500}
|
|
934
|
+
.dsh-powerup-update-quick-note .dsh-powerup-update-note{color:var(--dsw-alias-label-secondary)}
|
|
935
|
+
.dsh-powerup-update-close:focus-visible,.dsh-powerup-update-toggle:focus-visible,.dsh-powerup-update-version:focus-visible,.dsh-powerup-update-select-trigger:focus-visible,.dsh-powerup-update-option:focus-visible,.dsh-powerup-update-primary:focus-visible,.dsh-powerup-update-ghost:focus-visible,.dsh-powerup-update-quick:focus-visible,.dsh-powerup-update-button:focus-visible,.dsh-powerup-restart-action:focus-visible,.dsh-powerup-update-default:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
870
936
|
@media (max-width:680px){.dsh-powerup-page{padding:20px 16px 42px}.dsh-powerup-actions{grid-template-columns:minmax(0,1fr)}.dsh-powerup-hero-art{width:54px;height:54px}.dsh-powerup-hero h1{font-size:19px}.dsh-powerup-card-head{flex-wrap:wrap}.dsh-powerup-switch{margin-left:auto}.dsh-powerup-update-mask{padding:12px}.dsh-powerup-update-dialog{max-height:calc(100dvh - 24px)}.dsh-powerup-update-head{padding:18px 12px 10px 18px}.dsh-powerup-update-body{padding:0 18px 4px}.dsh-powerup-update-foot{padding:14px 18px 18px}}
|
|
871
937
|
`;
|
|
872
938
|
|
|
@@ -1626,6 +1692,33 @@
|
|
|
1626
1692
|
return /^\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.test(text) ? text : '';
|
|
1627
1693
|
}
|
|
1628
1694
|
|
|
1695
|
+
/**
|
|
1696
|
+
* The version a one-click update targets: the registry's `latest` tag,
|
|
1697
|
+
* falling back to the first row of the already sorted version list.
|
|
1698
|
+
* @param {{ latest?: unknown, versions?: unknown }} view
|
|
1699
|
+
* @returns {string} a concrete version, or '' when none is known yet.
|
|
1700
|
+
*/
|
|
1701
|
+
function oneClickVersion(view) {
|
|
1702
|
+
const declared = normalizeVersionInput(view?.latest);
|
|
1703
|
+
if (declared !== '') return declared;
|
|
1704
|
+
const first = Array.isArray(view?.versions) ? view.versions[0] : null;
|
|
1705
|
+
return normalizeVersionInput(first);
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
/**
|
|
1709
|
+
* Whether a target version is strictly newer than the installed one.
|
|
1710
|
+
* @param {unknown} target
|
|
1711
|
+
* @param {unknown} current
|
|
1712
|
+
* @returns {boolean}
|
|
1713
|
+
*/
|
|
1714
|
+
function isUpdateAvailable(target, current) {
|
|
1715
|
+
const version = normalizeVersionInput(target);
|
|
1716
|
+
if (version === '') return false;
|
|
1717
|
+
const installed = normalizeVersionInput(current);
|
|
1718
|
+
if (installed === '') return true;
|
|
1719
|
+
return compareVersionsDesc(version, installed) < 0;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1629
1722
|
/** A display title for a bundle, following the page's locale fallback. */
|
|
1630
1723
|
function packageDisplayTitle(pkg) {
|
|
1631
1724
|
const title = pkg?.meta?.title;
|
|
@@ -1702,6 +1795,105 @@
|
|
|
1702
1795
|
};
|
|
1703
1796
|
}
|
|
1704
1797
|
|
|
1798
|
+
/**
|
|
1799
|
+
* Apply a one-click update's post-install defaults: enable the new copy,
|
|
1800
|
+
* then restart, without asking. A skipped restart (setting off or an
|
|
1801
|
+
* unsupported runtime) ends in `done` with `autoClose`, so the dialog can
|
|
1802
|
+
* dismiss itself; enable/restart failures end in `done` without
|
|
1803
|
+
* `autoClose` and carry their reason.
|
|
1804
|
+
* @param {{
|
|
1805
|
+
* manager: { setBundleEnabled: Function },
|
|
1806
|
+
* name: string,
|
|
1807
|
+
* installedVersion: string,
|
|
1808
|
+
* restartRequired: boolean,
|
|
1809
|
+
* settings: { oneClickEnable?: boolean, oneClickRestart?: boolean },
|
|
1810
|
+
* apply: (patch: object) => void,
|
|
1811
|
+
* isCurrent: () => boolean,
|
|
1812
|
+
* recordPending: (entry: { name: string, version: string, reason: string }) => void,
|
|
1813
|
+
* readRestartCapability: () => Promise<{ supported: boolean, reason: string }>,
|
|
1814
|
+
* requestRestart: () => Promise<void>,
|
|
1815
|
+
* t: (key: string, params?: object) => string,
|
|
1816
|
+
* }} input
|
|
1817
|
+
* @returns {Promise<void>}
|
|
1818
|
+
*/
|
|
1819
|
+
async function runOneClickUpdate(input) {
|
|
1820
|
+
const {
|
|
1821
|
+
manager, name, installedVersion, restartRequired, settings,
|
|
1822
|
+
apply, isCurrent, recordPending, readRestartCapability, requestRestart, t,
|
|
1823
|
+
} = input;
|
|
1824
|
+
if (settings.oneClickEnable === false) {
|
|
1825
|
+
apply({
|
|
1826
|
+
phase: 'done',
|
|
1827
|
+
step: null,
|
|
1828
|
+
installedVersion,
|
|
1829
|
+
enabled: false,
|
|
1830
|
+
restartRequired,
|
|
1831
|
+
restartSkipped: true,
|
|
1832
|
+
skippedEnable: true,
|
|
1833
|
+
autoClose: true,
|
|
1834
|
+
});
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
apply({ phase: 'working', step: 'enabling', installedVersion, restartRequired });
|
|
1838
|
+
let enabledValue;
|
|
1839
|
+
try {
|
|
1840
|
+
const enabled = await manager.setBundleEnabled(name, true);
|
|
1841
|
+
if (!isCurrent()) return;
|
|
1842
|
+
if (!enabled.ok) throw new Error(enabled.error?.message ?? t('update.unknown'));
|
|
1843
|
+
enabledValue = enabled.value ?? {};
|
|
1844
|
+
if (enabledValue.error !== undefined || enabledValue.application === 'failed') throw new Error(operationReason(enabledValue, t));
|
|
1845
|
+
if (enabledValue.application === 'cancelled') throw new Error(t('update.cancelled'));
|
|
1846
|
+
} catch (error) {
|
|
1847
|
+
apply({
|
|
1848
|
+
phase: 'done',
|
|
1849
|
+
step: null,
|
|
1850
|
+
installedVersion,
|
|
1851
|
+
enabled: false,
|
|
1852
|
+
enableError: errorText(error) || t('update.unknown'),
|
|
1853
|
+
autoClose: false,
|
|
1854
|
+
});
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
if (restartRequired || enabledValue.application === 'restart-required') {
|
|
1858
|
+
recordPending({
|
|
1859
|
+
name,
|
|
1860
|
+
version: installedVersion,
|
|
1861
|
+
reason: enabledValue.restartReason ?? '',
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
if (settings.oneClickRestart === false) {
|
|
1865
|
+
apply({ phase: 'done', step: null, installedVersion, enabled: true, restartSkipped: true, autoClose: true });
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
const restart = await readRestartCapability();
|
|
1869
|
+
if (!isCurrent()) return;
|
|
1870
|
+
if (restart.supported !== true) {
|
|
1871
|
+
apply({
|
|
1872
|
+
phase: 'done',
|
|
1873
|
+
step: null,
|
|
1874
|
+
installedVersion,
|
|
1875
|
+
enabled: true,
|
|
1876
|
+
restartSkipped: true,
|
|
1877
|
+
restartUnsupported: restart.reason,
|
|
1878
|
+
autoClose: true,
|
|
1879
|
+
});
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
apply({ phase: 'restarting', step: null, installedVersion, enabled: true, restarting: true });
|
|
1883
|
+
try {
|
|
1884
|
+
await requestRestart();
|
|
1885
|
+
} catch (error) {
|
|
1886
|
+
apply({
|
|
1887
|
+
phase: 'done',
|
|
1888
|
+
step: null,
|
|
1889
|
+
installedVersion,
|
|
1890
|
+
enabled: true,
|
|
1891
|
+
restartError: errorText(error) || t('update.unknown'),
|
|
1892
|
+
autoClose: false,
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1705
1897
|
/**
|
|
1706
1898
|
* The package name of a registry install spec. Git, tarball, and local
|
|
1707
1899
|
* paths return null; their installed name comes from the Host result.
|
|
@@ -2331,7 +2523,7 @@
|
|
|
2331
2523
|
const seq = versionSeq.current + 1;
|
|
2332
2524
|
versionSeq.current = seq;
|
|
2333
2525
|
const current = () => versionSeq.current === seq && tokenRef.current === token;
|
|
2334
|
-
patch(token, { versionsState: 'loading', versionsError: null, versionsRegistry: null, ...(resetVersion === true ? { versions: [], version: '' } : {}) });
|
|
2526
|
+
patch(token, { versionsState: 'loading', versionsError: null, versionsRegistry: null, ...(resetVersion === true ? { versions: [], version: '', latest: null } : {}) });
|
|
2335
2527
|
let lastError = null;
|
|
2336
2528
|
for (const candidate of lookupRegistries(choices, choice)) {
|
|
2337
2529
|
if (!current()) return;
|
|
@@ -2575,6 +2767,26 @@
|
|
|
2575
2767
|
return () => document.removeEventListener('keydown', onKeyDown, true);
|
|
2576
2768
|
}, [restartAsk, restartBusy]);
|
|
2577
2769
|
|
|
2770
|
+
// A one-click update that does not restart leaves a completion panel;
|
|
2771
|
+
// close it on its own so it never lingers over the Plugins page.
|
|
2772
|
+
useEffect(() => {
|
|
2773
|
+
if (view === null || view.phase !== 'done' || view.autoClose !== true) return undefined;
|
|
2774
|
+
const timer = window.setTimeout(() => {
|
|
2775
|
+
setView((current) => {
|
|
2776
|
+
if (current === null || current.phase !== 'done' || current.autoClose !== true) return current;
|
|
2777
|
+
tokenRef.current = null;
|
|
2778
|
+
try {
|
|
2779
|
+
abortRef.current?.abort?.();
|
|
2780
|
+
} catch {
|
|
2781
|
+
/* ignore */
|
|
2782
|
+
}
|
|
2783
|
+
abortRef.current = null;
|
|
2784
|
+
return null;
|
|
2785
|
+
});
|
|
2786
|
+
}, ONE_CLICK_AUTO_CLOSE_MS);
|
|
2787
|
+
return () => window.clearTimeout(timer);
|
|
2788
|
+
}, [view === null ? null : view.phase, view === null ? null : view.autoClose]);
|
|
2789
|
+
|
|
2578
2790
|
const chooseVersion = (version) => {
|
|
2579
2791
|
if (tokenRef.current === null) return;
|
|
2580
2792
|
setView((current) => current === null ? current : { ...current, version, listOpen: false, listPopover: null, formError: null });
|
|
@@ -2642,14 +2854,24 @@
|
|
|
2642
2854
|
});
|
|
2643
2855
|
};
|
|
2644
2856
|
|
|
2645
|
-
const startUpdate = async () => {
|
|
2857
|
+
const startUpdate = async (options = {}) => {
|
|
2646
2858
|
const token = tokenRef.current;
|
|
2647
2859
|
const current = view;
|
|
2648
2860
|
if (token === null || current === null || current.phase !== 'choose') return;
|
|
2649
2861
|
const t = tRef.current;
|
|
2650
|
-
const
|
|
2862
|
+
const oneClick = options?.oneClick === true;
|
|
2863
|
+
// One-click installs the registry's newest version; the manual path
|
|
2864
|
+
// uses what the user typed or picked.
|
|
2865
|
+
const version = oneClick ? oneClickVersion(current) : normalizeVersionInput(current.version);
|
|
2651
2866
|
if (version === '') {
|
|
2652
|
-
setView((state) => state === null ? state : {
|
|
2867
|
+
setView((state) => state === null ? state : {
|
|
2868
|
+
...state,
|
|
2869
|
+
formError: t(oneClick ? 'update.oneClickNoLatest' : 'update.invalidVersion'),
|
|
2870
|
+
});
|
|
2871
|
+
return;
|
|
2872
|
+
}
|
|
2873
|
+
if (oneClick && isUpdateAvailable(version, current.currentVersion) !== true) {
|
|
2874
|
+
setView((state) => state === null ? state : { ...state, formError: t('update.oneClickUpToDate') });
|
|
2653
2875
|
return;
|
|
2654
2876
|
}
|
|
2655
2877
|
const choice = current.choices.find((item) => item.key === current.registryKey) ?? current.choices[0];
|
|
@@ -2659,7 +2881,19 @@
|
|
|
2659
2881
|
const previousVersion = typeof current.currentVersion === 'string' && current.currentVersion !== '' ? current.currentVersion : null;
|
|
2660
2882
|
const previousEnabled = current.enabled !== false;
|
|
2661
2883
|
let removedOld = false;
|
|
2662
|
-
patch(token, {
|
|
2884
|
+
patch(token, {
|
|
2885
|
+
phase: 'working',
|
|
2886
|
+
step: current.self === true ? 'installing' : 'removing',
|
|
2887
|
+
error: null,
|
|
2888
|
+
formError: null,
|
|
2889
|
+
log: '',
|
|
2890
|
+
logLabel: spec,
|
|
2891
|
+
oneClick,
|
|
2892
|
+
listOpen: false,
|
|
2893
|
+
listPopover: null,
|
|
2894
|
+
registryOpen: false,
|
|
2895
|
+
registryPopover: null,
|
|
2896
|
+
});
|
|
2663
2897
|
if (current.self === true) {
|
|
2664
2898
|
// Power-Up cannot reinstall itself from its own client: removing
|
|
2665
2899
|
// the bundle unloads this dialog. The Host route receives the
|
|
@@ -2714,6 +2948,23 @@
|
|
|
2714
2948
|
reason: value.restartReason ?? '',
|
|
2715
2949
|
});
|
|
2716
2950
|
}
|
|
2951
|
+
if (oneClick) {
|
|
2952
|
+
// No enable/restart questions: apply the stored defaults.
|
|
2953
|
+
await runOneClickUpdate({
|
|
2954
|
+
manager,
|
|
2955
|
+
name: current.name,
|
|
2956
|
+
installedVersion: value.version ?? version,
|
|
2957
|
+
restartRequired,
|
|
2958
|
+
settings: getSettings(),
|
|
2959
|
+
apply: (delta) => patch(token, delta),
|
|
2960
|
+
isCurrent: () => tokenRef.current === token,
|
|
2961
|
+
recordPending,
|
|
2962
|
+
readRestartCapability,
|
|
2963
|
+
requestRestart: requestAppRestart,
|
|
2964
|
+
t,
|
|
2965
|
+
});
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2717
2968
|
patch(token, {
|
|
2718
2969
|
phase: 'enable',
|
|
2719
2970
|
step: null,
|
|
@@ -2773,6 +3024,17 @@
|
|
|
2773
3024
|
}
|
|
2774
3025
|
};
|
|
2775
3026
|
|
|
3027
|
+
/** POST the restart command; throws when the Host refuses. */
|
|
3028
|
+
const requestAppRestart = async () => {
|
|
3029
|
+
const response = await fetch(UPDATE_API, {
|
|
3030
|
+
method: 'POST',
|
|
3031
|
+
headers: { 'content-type': 'application/json' },
|
|
3032
|
+
body: JSON.stringify({ action: 'restart' }),
|
|
3033
|
+
});
|
|
3034
|
+
const data = await response.json().catch(() => null);
|
|
3035
|
+
if (!response.ok || data?.ok !== true) throw new Error(data?.error ?? `HTTP ${response.status}`);
|
|
3036
|
+
};
|
|
3037
|
+
|
|
2776
3038
|
/** Open the list-header restart confirmation and read the capability. */
|
|
2777
3039
|
const openRestart = () => {
|
|
2778
3040
|
setRestartAsk(true);
|
|
@@ -2789,13 +3051,7 @@
|
|
|
2789
3051
|
setRestartBusy(true);
|
|
2790
3052
|
setRestartError(null);
|
|
2791
3053
|
try {
|
|
2792
|
-
|
|
2793
|
-
method: 'POST',
|
|
2794
|
-
headers: { 'content-type': 'application/json' },
|
|
2795
|
-
body: JSON.stringify({ action: 'restart' }),
|
|
2796
|
-
});
|
|
2797
|
-
const data = await response.json().catch(() => null);
|
|
2798
|
-
if (!response.ok || data?.ok !== true) throw new Error(data?.error ?? `HTTP ${response.status}`);
|
|
3054
|
+
await requestAppRestart();
|
|
2799
3055
|
} catch (error) {
|
|
2800
3056
|
setRestartBusy(false);
|
|
2801
3057
|
setRestartError(errorText(error) || tRef.current('update.unknown'));
|
|
@@ -2845,13 +3101,7 @@
|
|
|
2845
3101
|
const t = tRef.current;
|
|
2846
3102
|
patch(token, { restarting: true, restartError: null });
|
|
2847
3103
|
try {
|
|
2848
|
-
|
|
2849
|
-
method: 'POST',
|
|
2850
|
-
headers: { 'content-type': 'application/json' },
|
|
2851
|
-
body: JSON.stringify({ action: 'restart' }),
|
|
2852
|
-
});
|
|
2853
|
-
const data = await response.json().catch(() => null);
|
|
2854
|
-
if (!response.ok || data?.ok !== true) throw new Error(data?.error ?? `HTTP ${response.status}`);
|
|
3104
|
+
await requestAppRestart();
|
|
2855
3105
|
patch(token, { phase: 'restarting', restarting: true });
|
|
2856
3106
|
} catch (error) {
|
|
2857
3107
|
patch(token, { restarting: false, restartError: errorText(error) || t('update.unknown') });
|
|
@@ -2919,19 +3169,39 @@
|
|
|
2919
3169
|
const canClose = !busy;
|
|
2920
3170
|
const title = view.title === undefined || view.title === '' ? view.name : view.title;
|
|
2921
3171
|
const showVersions = view.phase === 'choose' && view.listOpen === true;
|
|
3172
|
+
// The newest version a one-click update would install right now.
|
|
3173
|
+
const quickVersion = oneClickVersion(view);
|
|
3174
|
+
const quickAvailable = view.self !== true
|
|
3175
|
+
&& view.versionsState === 'ready'
|
|
3176
|
+
&& quickVersion !== ''
|
|
3177
|
+
&& isUpdateAvailable(quickVersion, view.currentVersion);
|
|
2922
3178
|
|
|
2923
3179
|
const footer = (() => {
|
|
2924
3180
|
if (view.phase === 'choose') {
|
|
2925
3181
|
return [
|
|
2926
3182
|
h('button', { key: 'cancel', type: 'button', className: 'dsh-powerup-update-ghost', onClick: close }, t('update.cancel')),
|
|
3183
|
+
view.self === true
|
|
3184
|
+
? null
|
|
3185
|
+
: h('button', {
|
|
3186
|
+
key: 'quick',
|
|
3187
|
+
type: 'button',
|
|
3188
|
+
className: 'dsh-powerup-update-quick',
|
|
3189
|
+
disabled: !quickAvailable,
|
|
3190
|
+
title: quickAvailable
|
|
3191
|
+
? t('update.oneClickHint', { version: quickVersion })
|
|
3192
|
+
: quickVersion === ''
|
|
3193
|
+
? t('update.oneClickNoLatest')
|
|
3194
|
+
: t('update.oneClickUpToDate'),
|
|
3195
|
+
onClick: () => startUpdate({ oneClick: true }),
|
|
3196
|
+
}, h(QuickIcon, { size: 13 }), t('update.oneClick')),
|
|
2927
3197
|
h('button', {
|
|
2928
3198
|
key: 'start',
|
|
2929
3199
|
type: 'button',
|
|
2930
3200
|
className: 'dsh-powerup-update-primary',
|
|
2931
3201
|
disabled: view.versionsState === 'loading' || String(view.version ?? '').trim() === '',
|
|
2932
|
-
onClick: startUpdate,
|
|
3202
|
+
onClick: () => startUpdate(),
|
|
2933
3203
|
}, t('update.start')),
|
|
2934
|
-
];
|
|
3204
|
+
].filter(Boolean);
|
|
2935
3205
|
}
|
|
2936
3206
|
if (view.phase === 'enable') {
|
|
2937
3207
|
return [
|
|
@@ -3093,6 +3363,25 @@
|
|
|
3093
3363
|
? null
|
|
3094
3364
|
: h('span', { className: 'dsh-powerup-update-note' }, t('update.registryFrom', { registry: view.versionsRegistry.hint })),
|
|
3095
3365
|
),
|
|
3366
|
+
view.self === true
|
|
3367
|
+
? null
|
|
3368
|
+
: h('div', { key: 'quick', className: 'dsh-powerup-update-quick-note' },
|
|
3369
|
+
h('div', { className: 'dsh-powerup-update-quick-note-title' },
|
|
3370
|
+
h(QuickIcon, { size: 13 }),
|
|
3371
|
+
t('update.oneClickTitle'),
|
|
3372
|
+
),
|
|
3373
|
+
h('p', { className: 'dsh-powerup-update-note' }, quickAvailable
|
|
3374
|
+
? t('update.oneClickHint', { version: quickVersion })
|
|
3375
|
+
: quickVersion === ''
|
|
3376
|
+
? t('update.oneClickNoLatest')
|
|
3377
|
+
: t('update.oneClickUpToDate')),
|
|
3378
|
+
quickAvailable
|
|
3379
|
+
? h('p', { className: 'dsh-powerup-update-note' }, t('update.oneClickDefaults', {
|
|
3380
|
+
enable: getSettings().oneClickEnable === false ? t('update.off') : t('update.on'),
|
|
3381
|
+
restart: getSettings().oneClickRestart === false ? t('update.off') : t('update.on'),
|
|
3382
|
+
}))
|
|
3383
|
+
: null,
|
|
3384
|
+
),
|
|
3096
3385
|
];
|
|
3097
3386
|
}
|
|
3098
3387
|
if (view.phase === 'working') {
|
|
@@ -3102,7 +3391,9 @@
|
|
|
3102
3391
|
? t('update.step.installing', { version: view.logLabel ?? '' })
|
|
3103
3392
|
: view.step === 'rollback'
|
|
3104
3393
|
? t('update.step.rollback', { version: view.rollbackVersion ?? view.currentVersion ?? '' })
|
|
3105
|
-
:
|
|
3394
|
+
: view.step === 'enabling'
|
|
3395
|
+
? t('update.step.enabling')
|
|
3396
|
+
: t('update.step.checking');
|
|
3106
3397
|
return [
|
|
3107
3398
|
h('div', { key: 'status', className: 'dsh-powerup-update-status' },
|
|
3108
3399
|
h('span', { className: 'dsh-powerup-update-spinner', 'aria-hidden': 'true' }),
|
|
@@ -3161,6 +3452,22 @@
|
|
|
3161
3452
|
? t('update.doneDisabled', { name: view.name, version: view.installedVersion ?? '' })
|
|
3162
3453
|
: t('update.doneInstalled', { name: view.name, version: view.installedVersion ?? '' })),
|
|
3163
3454
|
view.restartSkipped === true ? h('p', { key: 'restart', className: 'dsh-powerup-update-note' }, t('update.doneRestart')) : null,
|
|
3455
|
+
view.skippedEnable === true ? h('p', { key: 'skipped-enable', className: 'dsh-powerup-update-note' }, t('update.oneClickSkippedEnable')) : null,
|
|
3456
|
+
view.enableError === null || view.enableError === undefined
|
|
3457
|
+
? null
|
|
3458
|
+
: notice('error', h(WarnIcon, { size: 14 }), t('update.errorTitle'), t('update.enableFailed', { message: view.enableError })),
|
|
3459
|
+
view.enableError === null || view.enableError === undefined
|
|
3460
|
+
? null
|
|
3461
|
+
: h('p', { key: 'enable-failed', className: 'dsh-powerup-update-note' }, t('update.oneClickEnableFailed')),
|
|
3462
|
+
view.restartUnsupported === null || view.restartUnsupported === undefined
|
|
3463
|
+
? null
|
|
3464
|
+
: notice('warn', h(WarnIcon, { size: 14 }), null, t('update.restartUnsupported', { reason: view.restartUnsupported })),
|
|
3465
|
+
view.restartError === null || view.restartError === undefined
|
|
3466
|
+
? null
|
|
3467
|
+
: notice('error', h(WarnIcon, { size: 14 }), t('update.errorTitle'), t('update.restartFailed', { message: view.restartError })),
|
|
3468
|
+
view.autoClose === true
|
|
3469
|
+
? h('p', { key: 'auto-close', className: 'dsh-powerup-update-note' }, t('update.doneAutoClose', { seconds: Math.round(ONE_CLICK_AUTO_CLOSE_MS / 1000) }))
|
|
3470
|
+
: null,
|
|
3164
3471
|
];
|
|
3165
3472
|
}
|
|
3166
3473
|
if (view.phase === 'error') {
|
|
@@ -3453,6 +3760,26 @@
|
|
|
3453
3760
|
{ id: 'fork', icon: ForkIcon, name: t('action.fork'), hint: t('action.forkHint') },
|
|
3454
3761
|
{ id: 'export', icon: ExportIcon, name: t('action.export'), hint: t('action.exportHint') },
|
|
3455
3762
|
];
|
|
3763
|
+
/** One label/description row with a host-styled switch. */
|
|
3764
|
+
const settingRow = (key, checked, label, hint) => h('div', { key, className: 'dsh-powerup-setting' },
|
|
3765
|
+
h('div', { className: 'dsh-powerup-setting-copy' },
|
|
3766
|
+
h('span', { className: 'dsh-powerup-setting-label' }, label),
|
|
3767
|
+
h('span', { className: 'dsh-powerup-setting-hint' }, hint),
|
|
3768
|
+
),
|
|
3769
|
+
h('button', {
|
|
3770
|
+
type: 'button',
|
|
3771
|
+
role: 'switch',
|
|
3772
|
+
'aria-checked': checked ? 'true' : 'false',
|
|
3773
|
+
'aria-label': label,
|
|
3774
|
+
className: 'dsh-powerup-switch',
|
|
3775
|
+
onClick: () => setSettings({ [key]: !checked }),
|
|
3776
|
+
},
|
|
3777
|
+
h('span', { className: 'dsh-powerup-switch-track' },
|
|
3778
|
+
h('span', { className: 'dsh-powerup-switch-thumb' }),
|
|
3779
|
+
),
|
|
3780
|
+
h('span', null, checked ? t('page.enabled') : t('page.disabled')),
|
|
3781
|
+
),
|
|
3782
|
+
);
|
|
3456
3783
|
return h('div', { className: 'dsh-powerup-page' },
|
|
3457
3784
|
h('div', { className: 'dsh-powerup-shell' },
|
|
3458
3785
|
h('header', { className: 'dsh-powerup-hero' },
|
|
@@ -3496,6 +3823,19 @@
|
|
|
3496
3823
|
),
|
|
3497
3824
|
),
|
|
3498
3825
|
),
|
|
3826
|
+
h('section', { className: 'dsh-powerup-card' },
|
|
3827
|
+
h('div', { className: 'dsh-powerup-card-head' },
|
|
3828
|
+
h('div', { className: 'dsh-powerup-card-icon' }, h(QuickIcon, { size: 18 })),
|
|
3829
|
+
h('div', { className: 'dsh-powerup-card-copy' },
|
|
3830
|
+
h('h2', null, t('page.oneClickTitle')),
|
|
3831
|
+
h('p', null, t('page.oneClickDesc')),
|
|
3832
|
+
),
|
|
3833
|
+
),
|
|
3834
|
+
h('div', { className: 'dsh-powerup-settings' },
|
|
3835
|
+
settingRow('oneClickEnable', settings.oneClickEnable !== false, t('page.oneClickEnable'), t('page.oneClickEnableHint')),
|
|
3836
|
+
settingRow('oneClickRestart', settings.oneClickRestart !== false, t('page.oneClickRestart'), t('page.oneClickRestartHint')),
|
|
3837
|
+
),
|
|
3838
|
+
),
|
|
3499
3839
|
h('section', { className: 'dsh-powerup-card' },
|
|
3500
3840
|
h('div', { className: 'dsh-powerup-card-head' },
|
|
3501
3841
|
h('div', { className: 'dsh-powerup-card-icon' }, h(UpdateIcon, { size: 18 })),
|
|
@@ -3665,6 +4005,7 @@
|
|
|
3665
4005
|
CSS,
|
|
3666
4006
|
PowerUpLineIcon,
|
|
3667
4007
|
UpdateIcon,
|
|
4008
|
+
QuickIcon,
|
|
3668
4009
|
PowerUpBridge,
|
|
3669
4010
|
PowerUpPage,
|
|
3670
4011
|
PowerUpOverlay,
|
|
@@ -3698,9 +4039,15 @@
|
|
|
3698
4039
|
readRememberedRegistry,
|
|
3699
4040
|
packageDisplayTitle,
|
|
3700
4041
|
normalizeVersionInput,
|
|
4042
|
+
oneClickVersion,
|
|
4043
|
+
isUpdateAvailable,
|
|
4044
|
+
readSettings,
|
|
4045
|
+
getSettings,
|
|
4046
|
+
setSettings,
|
|
3701
4047
|
inspectReason,
|
|
3702
4048
|
operationReason,
|
|
3703
4049
|
restorePreviousBundle,
|
|
4050
|
+
runOneClickUpdate,
|
|
3704
4051
|
},
|
|
3705
4052
|
};
|
|
3706
4053
|
},
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "Adds a right-click action menu to the Trajectory ledger: copy a record, copy a Markdown quote, quote it into the composer, open the record inspector, fork the session at that record, export the trajectory snapshot, and copy the session ID. The session header's background jobs panel gains an optional stop reason when a job is stopped by hand; the reason is appended to the completion notice injected into the session. The Plugins page gains an update control on every third-party installed plugin: choose a version from the registry, uninstall the old copy, reinstall through the Add plugin path, then enable and optionally restart DSH."
|
|
4
|
+
"description": "Adds a right-click action menu to the Trajectory ledger: copy a record, copy a Markdown quote, quote it into the composer, open the record inspector, fork the session at that record, export the trajectory snapshot, and copy the session ID. The session header's background jobs panel gains an optional stop reason when a job is stopped by hand; the reason is appended to the completion notice injected into the session. The Plugins page gains an update control on every third-party installed plugin: choose a version from the registry, uninstall the old copy, reinstall through the Add plugin path, then enable and optionally restart DSH. The update panel also offers a one-click update that installs the newest version without the enable and restart questions, enabling and restarting automatically by default; both defaults are configurable on the Power-Up page."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "在轨迹页面为记录增加右键操作菜单:复制内容、复制 Markdown 引用、引用到输入框、查看记录详情、从该记录 Fork 会话、导出轨迹快照、复制会话 ID。在会话顶部的后台任务面板手动停止任务时可以填写停止原因,原因会附加在任务结束后注入会话的提示里。插件页为每个第三方已安装插件增加更新按钮:从安装源选择版本,先卸载旧版再按「添加插件」流程安装,完成后可立即启用并选择是否重启 DSH
|
|
4
|
+
"description": "在轨迹页面为记录增加右键操作菜单:复制内容、复制 Markdown 引用、引用到输入框、查看记录详情、从该记录 Fork 会话、导出轨迹快照、复制会话 ID。在会话顶部的后台任务面板手动停止任务时可以填写停止原因,原因会附加在任务结束后注入会话的提示里。插件页为每个第三方已安装插件增加更新按钮:从安装源选择版本,先卸载旧版再按「添加插件」流程安装,完成后可立即启用并选择是否重启 DSH。插件更新面板还提供「一键更新」:安装最新版本并跳过启用与重启的询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Power-Up — small, opt-in upgrades for DeepSeek Harness. Adds a right-click action menu to the Trajectory ledger, an optional stop reason in the session header's background jobs panel (appended to the injected completion notice), and an update control for third-party plugins installed from the Plugins page, with version lookup from the configured registries, a starred default source, uninstall-and-reinstall through the Add plugin path, restart-needed markers, a background self-update, and an optional DSH restart. · 为 DeepSeek Harness 提供小型增强:在轨迹页面右键记录即可复制、引用、查看详情或从该记录 Fork
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Power-Up — small, opt-in upgrades for DeepSeek Harness. Adds a right-click action menu to the Trajectory ledger, an optional stop reason in the session header's background jobs panel (appended to the injected completion notice), and an update control for third-party plugins installed from the Plugins page, with version lookup from the configured registries, a starred default source, uninstall-and-reinstall through the Add plugin path, restart-needed markers, a background self-update, and an optional DSH restart, plus a one-click update that installs the newest version and can enable and restart automatically. · 为 DeepSeek Harness 提供小型增强:在轨迹页面右键记录即可复制、引用、查看详情或从该记录 Fork;在会话顶部的后台任务面板手动停止任务时可填写停止原因,原因会附加到任务结束后的会话提示;并在插件页为已安装插件提供带版本查询的更新按钮,安装源可设默认,沿用「添加插件」的安装流程,支持待重启标记、后台自更新与一键重启;插件更新面板提供「一键更新」,默认安装最新版后自动启用并重启,可在 Power-Up 页面调整默认行为。",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|