dsh-chat-embed 0.6.12 → 0.6.14
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 +98 -46
- package/client.js +449 -165
- package/index.js +858 -134
- package/package.json +1 -4
- package/tools/shell-patch/shell-patch.cmd +66 -0
- package/tools/shell-patch/shell-patch.command +70 -0
- package/tools/shell-patch/shell-patch.mjs +1260 -0
- package/docs/architecture.md +0 -387
- package/docs/publishing.md +0 -188
- package/restore-shell-patch.cmd +0 -39
- package/tools/shell-patch/clean-cache.ps1 +0 -76
- package/tools/shell-patch/patch-asar.cjs +0 -272
- package/tools/shell-patch/watchdog.ps1 +0 -124
- package//346/270/205/347/220/206/350/201/212/345/244/251/347/274/223/345/255/230.cmd +0 -12
package/client.js
CHANGED
|
@@ -115,7 +115,7 @@ window.__ModuleLoader__.load({
|
|
|
115
115
|
let activeCtx = undefined
|
|
116
116
|
|
|
117
117
|
/** Build identity, surfaced in the panel so a packaged app can be diagnosed. */
|
|
118
|
-
const BUILD = '0.6.
|
|
118
|
+
const BUILD = '0.6.14'
|
|
119
119
|
|
|
120
120
|
/** Where a re-applied instance finds the one it must take over from. */
|
|
121
121
|
const INSTANCE_KEY = '__DSH_CHAT_EMBED_INSTANCE__'
|
|
@@ -276,24 +276,38 @@ let activeCtx = undefined
|
|
|
276
276
|
persistHint: 'Needs the shell patch; a plugin cannot change how the shell names partitions.',
|
|
277
277
|
persistRisk:
|
|
278
278
|
'Experimental: the patch rewrites the app.asar of the desktop shell and needs write access to its install folder. A shell update replaces it, so the patch has to be applied again.',
|
|
279
|
-
persistCheckHint: '
|
|
279
|
+
persistCheckHint: 'Click to apply the patch now; it asks you to quit DSH',
|
|
280
280
|
persistConfirmTitle: 'Turn on “login across restarts”?',
|
|
281
|
-
persistConfirmNote:
|
|
282
|
-
|
|
281
|
+
persistConfirmNote:
|
|
282
|
+
'The switch runs this script by itself. This copyable command is the fallback for when it cannot: run it, quit DSH when it says so, and it swaps the file.',
|
|
283
|
+
persistConfirmGo: 'Copy command',
|
|
283
284
|
persistConfirmCancel: 'Cancel',
|
|
284
285
|
persistOffTitle: 'Turn off "logins survive restarts"?',
|
|
285
286
|
persistOffBody: 'This removes the patch and puts the original app.asar back. Every restart will ask you to sign in again; flip the switch to undo.',
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
287
|
+
patchPending: 'Patch ready',
|
|
288
|
+
patchPendingHint:
|
|
289
|
+
'Quit DSH from the tray (right-click the tray icon → Quit). The archive is swapped and DSH reopens on its own. You do not have to quit immediately — the script waits up to 12 hours.',
|
|
290
|
+
patchNeedsAdmin: 'The install folder needs administrator rights, so it cannot run from here. Run the command below as administrator.',
|
|
291
|
+
patchNoInstall: 'No DSH desktop install was found, so there is no shell to patch. Open this panel in the desktop app.',
|
|
292
|
+
patchSame: 'Nothing to change: the shell archive is already in that state.',
|
|
293
|
+
patchNoRoute: 'This DSH build has no route for the switch yet; run the command below instead.',
|
|
294
|
+
patchStartFailed: 'The patch could not be started:',
|
|
295
|
+
patchScriptLabel: 'Script',
|
|
296
|
+
patchCommandLabel: 'Command',
|
|
297
|
+
patchScriptMissing: 'The patch script is not in this install (tools/shell-patch). The plugin may live elsewhere, or the package is incomplete.',
|
|
298
|
+
patchNoSite: 'This shell version has no patch site, so the script needs updating too; running it only reports that and changes nothing.',
|
|
299
|
+
patchRestartHint: 'Restart DSH afterwards for the change to take effect.',
|
|
300
|
+
cacheLabel: 'Cache',
|
|
301
|
+
cacheClear: 'Clear',
|
|
302
|
+
cacheClearing: 'Clearing…',
|
|
303
|
+
cacheKeepHint: 'Login across restarts is on: only disposable cache is removed. Sign-in data stays.',
|
|
304
|
+
cachePurgeHint: 'Login across restarts is off: this deletes the leftover sign-in data of these seven services.',
|
|
305
|
+
cachePurgeTitle: 'Delete leftover sign-in data?',
|
|
306
|
+
cachePurgeBody:
|
|
307
|
+
'The patch is off. This removes the seven partitions that belong to this panel, including their saved sign-ins. It does not touch DSH’s own sign-in, or any other partition.',
|
|
308
|
+
cachePurgeGo: 'Delete',
|
|
309
|
+
cacheUnavailable: 'unavailable',
|
|
310
|
+
cacheFailed: 'Could not clear:',
|
|
297
311
|
copyDiag: 'Copy diagnostics',
|
|
298
312
|
copied: 'Copied',
|
|
299
313
|
copyFailed: 'Copy failed',
|
|
@@ -370,23 +384,37 @@ let activeCtx = undefined
|
|
|
370
384
|
persistUnknown: '尚未检测',
|
|
371
385
|
persistHint: '需要桌面壳补丁;插件无法改变壳的分区命名。',
|
|
372
386
|
persistRisk: '实验性功能:补丁会改写桌面壳的 app.asar,需要安装目录的写权限;桌面壳升级会覆盖补丁,需要重新打一次。',
|
|
373
|
-
persistCheckHint: '
|
|
387
|
+
persistCheckHint: '点一下直接执行补丁,会请你退出 DSH',
|
|
374
388
|
persistConfirmTitle: '开启「重启保持登录」?',
|
|
375
|
-
persistConfirmNote:
|
|
376
|
-
|
|
389
|
+
persistConfirmNote:
|
|
390
|
+
'开关会自己运行这个脚本;只有它跑不起来时才需要下面这条命令:运行它,按提示退出 DSH,脚本会替换好文件。',
|
|
391
|
+
persistConfirmGo: '复制命令',
|
|
377
392
|
persistConfirmCancel: '取消',
|
|
378
393
|
persistOffTitle: '关闭「重启保持登录」?',
|
|
379
394
|
persistOffBody: '会撤掉补丁、恢复原版 app.asar。之后每次重启都要重新登录;想再开启,再点一次这个开关即可。',
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
395
|
+
patchPending: '补丁已就绪',
|
|
396
|
+
patchPendingHint: '请从托盘退出 DSH(右键托盘图标 →「退出」),退出后自动替换并重新打开。不必马上退出,脚本最多等 12 小时。',
|
|
397
|
+
patchNeedsAdmin: '安装目录需要管理员权限,这里没法直接执行。请以管理员身份运行下面的命令。',
|
|
398
|
+
patchNoInstall: '没有找到 DSH 桌面版安装目录,没有可以打补丁的壳。请在桌面版里打开本面板。',
|
|
399
|
+
patchSame: '不用改:桌面壳档案已经是这个状态。',
|
|
400
|
+
patchNoRoute: '这个 DSH 版本还没有提供开关用的通道;请改运行下面的命令。',
|
|
401
|
+
patchStartFailed: '没能启动补丁:',
|
|
402
|
+
patchScriptLabel: '脚本',
|
|
403
|
+
patchCommandLabel: '命令',
|
|
404
|
+
patchScriptMissing: '这个安装里找不到补丁脚本(tools/shell-patch)。插件可能装在别处,或包不完整。',
|
|
405
|
+
patchNoSite: '当前桌面壳版本里找不到补丁点,脚本也需要更新;运行它只会报告这一点,不会改动文件。',
|
|
406
|
+
patchRestartHint: '运行后请重新打开 DSH 使其生效。',
|
|
407
|
+
cacheLabel: '缓存',
|
|
408
|
+
cacheClear: '清空',
|
|
409
|
+
cacheClearing: '正在清空…',
|
|
410
|
+
cacheKeepHint: '重启保持登录已开启:只删除缓存,登录保留。',
|
|
411
|
+
cachePurgeHint: '重启保持登录已关闭:将删除这 7 个服务留下的登录数据。',
|
|
412
|
+
cachePurgeTitle: '删除残留登录?',
|
|
413
|
+
cachePurgeBody:
|
|
414
|
+
'补丁已关闭。这会删除本面板自己的 7 个分区,包括其中的登录。不会动 DSH 自己的登录,也不会动其他分区。',
|
|
415
|
+
cachePurgeGo: '删除',
|
|
416
|
+
cacheUnavailable: '无法测量',
|
|
417
|
+
cacheFailed: '没能清空:',
|
|
390
418
|
copyDiag: '复制诊断信息',
|
|
391
419
|
copied: '已复制',
|
|
392
420
|
copyFailed: '复制失败',
|
|
@@ -2175,7 +2203,8 @@ let activeCtx = undefined
|
|
|
2175
2203
|
const workspace = typeof ctx.get === 'function' ? ctx.get('uiWorkspace') : undefined
|
|
2176
2204
|
out.uiWorkspace = workspace !== undefined && workspace !== null
|
|
2177
2205
|
out.uiWorkspaceStartSession = out.uiWorkspace && typeof workspace.startSession === 'function'
|
|
2178
|
-
out.
|
|
2206
|
+
out.patchRunning = patchAction.running
|
|
2207
|
+
out.patchPending = patchAction.pending
|
|
2179
2208
|
out.activeCtx = activeCtx !== undefined && activeCtx !== null
|
|
2180
2209
|
out.probeLoaded = patchProbe.loaded
|
|
2181
2210
|
if (out.service) {
|
|
@@ -2517,6 +2546,21 @@ let activeCtx = undefined
|
|
|
2517
2546
|
return t('persistUnknown')
|
|
2518
2547
|
}
|
|
2519
2548
|
|
|
2549
|
+
/**
|
|
2550
|
+
* Compact size for the cache row. Unknown stays blank so the row can say
|
|
2551
|
+
* "unavailable" instead of pretending the cache is empty.
|
|
2552
|
+
*
|
|
2553
|
+
* @param {unknown} bytes
|
|
2554
|
+
* @returns {string}
|
|
2555
|
+
*/
|
|
2556
|
+
function formatCacheBytes(bytes) {
|
|
2557
|
+
const value = typeof bytes === 'number' ? bytes : Number(bytes)
|
|
2558
|
+
if (!Number.isFinite(value) || value < 0) return ''
|
|
2559
|
+
if (value >= 1024 * 1024) return (value / (1024 * 1024)).toFixed(1) + ' MB'
|
|
2560
|
+
if (value >= 1024) return (value / 1024).toFixed(1) + ' KB'
|
|
2561
|
+
return String(Math.round(value)) + ' B'
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2520
2564
|
/**
|
|
2521
2565
|
* The clipboard copy behind "copy the patch instructions": what to run,
|
|
2522
2566
|
* where the tool is, and how to replace the archive safely.
|
|
@@ -2534,36 +2578,36 @@ let activeCtx = undefined
|
|
|
2534
2578
|
* @param {any} [probe]
|
|
2535
2579
|
* @returns {string}
|
|
2536
2580
|
*/
|
|
2537
|
-
function patchInstructions(t, probe) {
|
|
2581
|
+
function patchInstructions(t, probe, mode) {
|
|
2538
2582
|
const info = probe !== undefined && probe !== null ? probe : {}
|
|
2583
|
+
const action = mode === 'off' ? 'revert' : 'apply'
|
|
2539
2584
|
const command =
|
|
2540
|
-
typeof info
|
|
2541
|
-
? info
|
|
2542
|
-
: 'node tools/shell-patch/patch
|
|
2543
|
-
const lines = [
|
|
2544
|
-
lines.push('
|
|
2545
|
-
lines.push(' ' + command)
|
|
2546
|
-
lines.push(' 脚本会自动探测安装目录并逐字节校验,生成 app.asar.new。')
|
|
2547
|
-
lines.push('')
|
|
2548
|
-
lines.push('2) 完全退出 DSH 后替换(任选其一):')
|
|
2549
|
-
lines.push(' - 运行 tools/shell-patch/watchdog.ps1,退出瞬间自动替换;')
|
|
2550
|
-
lines.push(' - 手动把 resources\\app.asar.new 改名为 app.asar。')
|
|
2585
|
+
typeof info[action + 'Command'] === 'string' && info[action + 'Command'] !== ''
|
|
2586
|
+
? info[action + 'Command']
|
|
2587
|
+
: 'node tools/shell-patch/shell-patch.mjs ' + action
|
|
2588
|
+
const lines = []
|
|
2589
|
+
lines.push(t('persistLabel') + ':' + t('persistConfirmTitle'))
|
|
2551
2590
|
lines.push('')
|
|
2552
|
-
|
|
2591
|
+
if (typeof info.launcher === 'string' && info.launcher !== '') {
|
|
2592
|
+
lines.push(t('patchScriptLabel') + ': ' + info.launcher)
|
|
2593
|
+
}
|
|
2594
|
+
lines.push(t('patchCommandLabel') + ':')
|
|
2595
|
+
lines.push(' ' + command)
|
|
2553
2596
|
lines.push('')
|
|
2554
|
-
lines.push('
|
|
2555
|
-
lines.push('Windows 之外的安装目录请用 --resources 指定。')
|
|
2597
|
+
lines.push(t('patchRestartHint'))
|
|
2556
2598
|
return lines.join('\n')
|
|
2557
2599
|
}
|
|
2558
2600
|
|
|
2559
2601
|
/**
|
|
2560
|
-
*
|
|
2561
|
-
* half answers, so a renderer without Node access can still report where
|
|
2562
|
-
* the shell lives and whether the archive is writable.
|
|
2602
|
+
* State behind the "login across restarts" switch.
|
|
2563
2603
|
*
|
|
2564
|
-
*
|
|
2604
|
+
* Clicking it starts the patch script through the Host. `pending` means a
|
|
2605
|
+
* script is running and waiting for DSH to exit, so the panel stops
|
|
2606
|
+
* pretending a restart is still needed.
|
|
2607
|
+
*
|
|
2608
|
+
* @type {{ running: boolean, pending: boolean, action: string }}
|
|
2565
2609
|
*/
|
|
2566
|
-
const
|
|
2610
|
+
const patchAction = { running: false, pending: false, action: 'on' }
|
|
2567
2611
|
|
|
2568
2612
|
/** One-shot cache of the Host probe, so both actions read the same facts. */
|
|
2569
2613
|
const patchProbe = { loaded: false, value: undefined }
|
|
@@ -2612,118 +2656,137 @@ let activeCtx = undefined
|
|
|
2612
2656
|
}
|
|
2613
2657
|
|
|
2614
2658
|
/**
|
|
2615
|
-
*
|
|
2659
|
+
* What to tell the user when the action did not start.
|
|
2616
2660
|
*
|
|
2617
|
-
*
|
|
2618
|
-
*
|
|
2619
|
-
*
|
|
2620
|
-
|
|
2621
|
-
|
|
2661
|
+
* @param {(key: string) => string} t
|
|
2662
|
+
* @param {any} body the Host's answer, when there was one
|
|
2663
|
+
* @returns {string}
|
|
2664
|
+
*/
|
|
2665
|
+
function patchFallbackText(t, body) {
|
|
2666
|
+
const state = body !== undefined && body !== null && typeof body.state === 'string' ? body.state : ''
|
|
2667
|
+
const detail = body !== undefined && body !== null && typeof body.detail === 'string' ? body.detail : ''
|
|
2668
|
+
const lead =
|
|
2669
|
+
state === 'denied'
|
|
2670
|
+
? t('patchNeedsAdmin')
|
|
2671
|
+
: state === 'noapp'
|
|
2672
|
+
? t('patchNoInstall')
|
|
2673
|
+
: state === 'unsupported'
|
|
2674
|
+
? t('patchNoSite')
|
|
2675
|
+
: state === 'same'
|
|
2676
|
+
? t('patchSame')
|
|
2677
|
+
: t('patchNoRoute')
|
|
2678
|
+
return detail === '' ? lead : lead + ' ' + detail
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
/**
|
|
2682
|
+
* Ask the Host to run the patch script — the switch's whole job.
|
|
2683
|
+
*
|
|
2684
|
+
* A click that can work does not open a dialog: the Host spawns the script,
|
|
2685
|
+
* the script waits for DSH to exit, swaps the archive, and starts DSH
|
|
2686
|
+
* again. The dialog is the fallback for the cases where nothing can be
|
|
2687
|
+
* started from here (an older Host without the route, an install folder
|
|
2688
|
+
* that needs administrator rights, a shell whose patch site moved, no
|
|
2689
|
+
* install at all), and it still carries the exact command, because a user
|
|
2690
|
+
* who cannot click their way out needs something to run.
|
|
2622
2691
|
*
|
|
2623
2692
|
* @param {(key: string) => string} t
|
|
2624
|
-
* @
|
|
2693
|
+
* @param {string} mode 'on' or 'off'
|
|
2694
|
+
* @returns {Promise<{ lead: string, script: string | undefined }>} `lead` is
|
|
2695
|
+
* empty when the script started; otherwise it explains the dialog
|
|
2625
2696
|
*/
|
|
2626
|
-
async function
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2697
|
+
async function startPatchAction(t, mode) {
|
|
2698
|
+
if (patchAction.running) return { lead: '', script: undefined }
|
|
2699
|
+
patchAction.running = true
|
|
2700
|
+
patchAction.action = mode
|
|
2701
|
+
notify()
|
|
2702
|
+
const action = mode === 'off' ? 'revert' : 'apply'
|
|
2703
|
+
let script
|
|
2632
2704
|
try {
|
|
2633
|
-
log('info', 'patch-
|
|
2634
|
-
const
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2705
|
+
log('info', 'patch-action: entered (' + action + ')')
|
|
2706
|
+
const probe = await fetchProbe()
|
|
2707
|
+
const info = probe !== undefined && probe !== null ? probe : {}
|
|
2708
|
+
if (probe !== undefined && probe !== null) {
|
|
2709
|
+
// The launcher is what a user double-clicks; a platform without one
|
|
2710
|
+
// still gets the script, which is the same thing with a command in
|
|
2711
|
+
// front of it.
|
|
2712
|
+
script =
|
|
2713
|
+
typeof info.launcher === 'string' && info.launcher !== ''
|
|
2714
|
+
? info.launcher
|
|
2715
|
+
: typeof info.script === 'string' && info.script !== ''
|
|
2716
|
+
? info.script
|
|
2717
|
+
: ''
|
|
2718
|
+
}
|
|
2719
|
+
const token = typeof info.token === 'string' ? info.token : ''
|
|
2720
|
+
if (token === '') {
|
|
2721
|
+
log('warn', 'patch-action: the Host has no action route yet')
|
|
2722
|
+
return { lead: t('patchNoRoute'), script }
|
|
2723
|
+
}
|
|
2724
|
+
// The carrier behind these routes answers GET/HEAD only, so the action
|
|
2725
|
+
// is a GET guarded by the token the probe just handed out.
|
|
2726
|
+
const controller = new AbortController()
|
|
2727
|
+
const timer = setTimeout(() => controller.abort(), 8000)
|
|
2728
|
+
let response
|
|
2729
|
+
try {
|
|
2730
|
+
response = await fetch('./dsh-chat-embed/patch?action=' + action + '&token=' + encodeURIComponent(token), {
|
|
2731
|
+
method: 'GET',
|
|
2732
|
+
headers: { accept: 'application/json' },
|
|
2733
|
+
cache: 'no-store',
|
|
2734
|
+
signal: controller.signal,
|
|
2735
|
+
})
|
|
2736
|
+
} finally {
|
|
2737
|
+
clearTimeout(timer)
|
|
2644
2738
|
}
|
|
2645
|
-
|
|
2739
|
+
let body
|
|
2740
|
+
try {
|
|
2741
|
+
body = await response.json()
|
|
2742
|
+
} catch (error) {
|
|
2743
|
+
log('warn', 'patch-action: the answer was not JSON: ' + messageOf(error))
|
|
2744
|
+
body = undefined
|
|
2745
|
+
}
|
|
2746
|
+
if (body !== undefined && body !== null && body.ok === true && body.state === 'started') {
|
|
2747
|
+
patchAction.pending = true
|
|
2748
|
+
log('info', 'patch-action: started ' + action)
|
|
2749
|
+
notify()
|
|
2750
|
+
return { lead: '', script }
|
|
2751
|
+
}
|
|
2752
|
+
log('warn', 'patch-action: not started (' + (body === undefined ? 'no body' : String(body.state)) + ')')
|
|
2753
|
+
return { lead: patchFallbackText(t, body), script }
|
|
2754
|
+
} catch (error) {
|
|
2755
|
+
log('error', 'patch-action: failed', messageOf(error))
|
|
2756
|
+
return { lead: t('patchStartFailed') + ' ' + messageOf(error), script }
|
|
2757
|
+
} finally {
|
|
2758
|
+
patchAction.running = false
|
|
2646
2759
|
notify()
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
async function copyPatchCommand(t, mode) {
|
|
2764
|
+
// No session, no agent: the script does the whole job, so all this has to
|
|
2765
|
+
// do is put its exact path and command on the clipboard. Every step is
|
|
2766
|
+
// logged and the reason comes back to the dialog, because a click that
|
|
2767
|
+
// does nothing is indistinguishable from a broken build.
|
|
2768
|
+
let failure = ''
|
|
2769
|
+
patchAction.running = true
|
|
2770
|
+
notify()
|
|
2771
|
+
try {
|
|
2772
|
+
log('info', 'patch-command: entered')
|
|
2647
2773
|
const probe = await fetchProbe()
|
|
2648
|
-
log('info', 'patch-
|
|
2649
|
-
const
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
// Hand the main area back to the conversation first.
|
|
2654
|
-
const layout = host !== undefined && typeof host.get === 'function' ? host.get('layout') : undefined
|
|
2655
|
-
if (layout !== undefined && layout !== null && typeof layout.selectPanel === 'function') {
|
|
2656
|
-
log('info', 'patch-check: releasing the main panel before opening the Session')
|
|
2657
|
-
layout.selectPanel(null)
|
|
2658
|
-
}
|
|
2659
|
-
log('info', 'patch-check: opening a Session with a ' + prompt.length + '-char draft')
|
|
2660
|
-
// 'replace', not 'append': the Workspace blank can already hold a draft
|
|
2661
|
-
// from another flow (the plugin-creation template, for one), and appending
|
|
2662
|
-
// would hand the agent two unrelated instructions at once.
|
|
2663
|
-
workspace.startSession(undefined, { prompt, whenDraftExists: 'replace' })
|
|
2664
|
-
log('info', 'patch-check: startSession returned')
|
|
2774
|
+
log('info', 'patch-command: probe ' + (probe === undefined || probe === null ? 'absent' : 'ok'))
|
|
2775
|
+
const text = patchInstructions(t, probe, mode)
|
|
2776
|
+
const copied = await copyText(text)
|
|
2777
|
+
log('info', 'patch-command: clipboard ' + (copied ? 'ok' : 'failed'))
|
|
2778
|
+
if (copied !== true) failure = t('copyFailed')
|
|
2665
2779
|
} catch (error) {
|
|
2666
2780
|
failure = messageOf(error)
|
|
2667
|
-
log('error', 'patch-
|
|
2668
|
-
void copyText(patchInstructions(t, patchProbe.value) + '\n' + t('copyFailed') + ': ' + failure)
|
|
2781
|
+
log('error', 'patch-command: failed', failure)
|
|
2669
2782
|
} finally {
|
|
2670
|
-
|
|
2783
|
+
patchAction.running = false
|
|
2671
2784
|
notify()
|
|
2672
2785
|
}
|
|
2673
2786
|
return failure
|
|
2674
2787
|
}
|
|
2675
2788
|
|
|
2676
|
-
/**
|
|
2677
|
-
* The draft for the other direction: put the original app.asar back.
|
|
2678
|
-
*
|
|
2679
|
-
* Turning the switch off is a real operation, not a dead end — the patch
|
|
2680
|
-
* kept a copy, so undoing it is a rename away.
|
|
2681
|
-
*
|
|
2682
|
-
* @param {(key: string) => string} t
|
|
2683
|
-
* @param {any} [probe]
|
|
2684
|
-
* @returns {string}
|
|
2685
|
-
*/
|
|
2686
|
-
function buildRestorePrompt(t, probe) {
|
|
2687
|
-
const info = probe !== undefined && probe !== null ? probe : {}
|
|
2688
|
-
const lines = [t('restoreTask')]
|
|
2689
|
-
if (typeof info.resources === 'string' && info.resources !== '') {
|
|
2690
|
-
lines.push('', t('patchTaskDir') + ': ' + info.resources)
|
|
2691
|
-
}
|
|
2692
|
-
if (typeof info.asar === 'string' && info.asar !== '') {
|
|
2693
|
-
lines.push('', t('restoreStepsTitle') + ':')
|
|
2694
|
-
lines.push(' 1. ' + info.asar + ' -> ' + info.asar + '.patched.bak')
|
|
2695
|
-
lines.push(' 2. ' + info.asar + '.orig -> ' + info.asar)
|
|
2696
|
-
}
|
|
2697
|
-
if (info.writable === false) lines.push('', t('patchTaskReadonly'))
|
|
2698
|
-
lines.push('', t('restoreWarning'))
|
|
2699
|
-
lines.push('', t('patchTaskVerify'))
|
|
2700
|
-
return lines.join('\n')
|
|
2701
|
-
}
|
|
2702
2789
|
|
|
2703
|
-
/**
|
|
2704
|
-
* The text dropped into the new Session's draft: what is already known, so
|
|
2705
|
-
* the agent starts from facts instead of asking the user to run something.
|
|
2706
|
-
*
|
|
2707
|
-
* @param {(key: string) => string} t
|
|
2708
|
-
* @param {any} probe
|
|
2709
|
-
* @returns {string}
|
|
2710
|
-
*/
|
|
2711
|
-
function buildPatchPrompt(t, probe) {
|
|
2712
|
-
const info = probe !== undefined && probe !== null ? probe : {}
|
|
2713
|
-
// The plugin already knows the state; the draft only says what to do about
|
|
2714
|
-
// it. Anything the patch script enforces itself (byte checks, quitting
|
|
2715
|
-
// first) does not belong here — that is a manual, not an instruction.
|
|
2716
|
-
const lines = [t('patchTask')]
|
|
2717
|
-
const command = typeof info.patchCommand === 'string' && info.patchCommand !== '' ? info.patchCommand : ''
|
|
2718
|
-
if (typeof info.resources === 'string' && info.resources !== '') {
|
|
2719
|
-
lines.push('', t('patchTaskDir') + ': ' + info.resources)
|
|
2720
|
-
}
|
|
2721
|
-
if (command !== '') lines.push('', t('patchTaskCommand') + ':', ' ' + command)
|
|
2722
|
-
if (info.writable === false) lines.push('', t('patchTaskReadonly'))
|
|
2723
|
-
if (info.patchSite === false) lines.push('', t('patchTaskNoSite'))
|
|
2724
|
-
lines.push('', t('patchTaskVerify'))
|
|
2725
|
-
return lines.join('\n')
|
|
2726
|
-
}
|
|
2727
2790
|
|
|
2728
2791
|
/** @returns {{ state: string, detail: string, seats: any[] }} */
|
|
2729
2792
|
function rightSidebarStatus() {
|
|
@@ -2917,6 +2980,10 @@ let activeCtx = undefined
|
|
|
2917
2980
|
'.dce-icon-button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}',
|
|
2918
2981
|
'.dce-icon-button:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#4c6ef5);outline-offset:-2px}',
|
|
2919
2982
|
'.dce-status-bar{position:absolute;top:0;left:0;right:0;z-index:2;display:flex;align-items:center;gap:8px;box-sizing:border-box;padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l1,rgba(127,127,127,.18));background:var(--dsw-alias-bg-base,#fff);font-size:12px}',
|
|
2983
|
+
// A pending patch keeps the tab bar pinned open, and the tab bar sits on
|
|
2984
|
+
// the same top edge with a higher z-index — so the strip has to move below
|
|
2985
|
+
// it or it is hidden by the very state it is reporting.
|
|
2986
|
+
'.dce-status-bar[data-patch-pending="true"]{top:33px;z-index:5;}',
|
|
2920
2987
|
'.dce-dot{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--dsw-alias-label-tertiary,#9aa0a6)}',
|
|
2921
2988
|
'.dce-dot[data-phase="ready"]{background:var(--dsw-alias-state-success-primary,#2ea043)}',
|
|
2922
2989
|
'.dce-dot[data-phase="failed"]{background:var(--dsw-alias-state-error-primary,#d33)}',
|
|
@@ -2952,6 +3019,9 @@ let activeCtx = undefined
|
|
|
2952
3019
|
'.dce-card[data-modal="true"]{z-index:8}',
|
|
2953
3020
|
'.dce-menu-item{display:flex;align-items:center;justify-content:flex-start;gap:8px;width:100%;box-sizing:border-box;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:inherit;font-size:13px;text-align:left;cursor:pointer}',
|
|
2954
3021
|
'.dce-menu-item:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.12))}',
|
|
3022
|
+
'.dce-menu-action{flex:0 0 auto;border:0;border-radius:6px;padding:3px 8px;background:transparent;color:inherit;font-size:12px;cursor:pointer}',
|
|
3023
|
+
'.dce-menu-action:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(127,127,127,.18))}',
|
|
3024
|
+
'.dce-menu-action:disabled{opacity:.45;cursor:default}',
|
|
2955
3025
|
'.dce-right-title{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
2956
3026
|
'.dce-right-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#19a15f);flex:0 0 auto}',
|
|
2957
3027
|
'.dce-right-dot[data-phase="failed"]{background:var(--dsw-alias-state-error-primary,#d33)}',
|
|
@@ -3371,8 +3441,21 @@ let activeCtx = undefined
|
|
|
3371
3441
|
const [barOpen, setBarOpen] = React.useState(false)
|
|
3372
3442
|
const [menuOpen, setMenuOpen] = React.useState(false)
|
|
3373
3443
|
const [confirmOpen, setConfirmOpen] = React.useState(false)
|
|
3444
|
+
const [cacheReport, setCacheReport] = React.useState(undefined)
|
|
3445
|
+
const [cacheBusy, setCacheBusy] = React.useState(false)
|
|
3446
|
+
const [cacheConfirm, setCacheConfirm] = React.useState(false)
|
|
3374
3447
|
const [confirmError, setConfirmError] = React.useState('')
|
|
3375
3448
|
const [confirmMode, setConfirmMode] = React.useState('on')
|
|
3449
|
+
// Why the dialog is open at all: the action could not start, and this
|
|
3450
|
+
// line says which reason applied. Empty on a dialog opened by a click
|
|
3451
|
+
// that never tried to start anything.
|
|
3452
|
+
const [confirmLead, setConfirmLead] = React.useState('')
|
|
3453
|
+
// The launcher path the dialog names. Three states, because "still
|
|
3454
|
+
// asking the Host" must not read as "this install has no script":
|
|
3455
|
+
// undefined the probe has not answered yet
|
|
3456
|
+
// '' it answered, and there is no launcher
|
|
3457
|
+
// '<path>' the file to double-click
|
|
3458
|
+
const [confirmScript, setConfirmScript] = React.useState(undefined)
|
|
3376
3459
|
|
|
3377
3460
|
/**
|
|
3378
3461
|
* Close the settings menu.
|
|
@@ -3383,6 +3466,68 @@ let activeCtx = undefined
|
|
|
3383
3466
|
const closeMenu = () => {
|
|
3384
3467
|
setMenuOpen(false)
|
|
3385
3468
|
}
|
|
3469
|
+
|
|
3470
|
+
/**
|
|
3471
|
+
* Ask the Host how much of this panel's partitions the clear button would
|
|
3472
|
+
* remove. Opening the menu is the event; nothing polls.
|
|
3473
|
+
*/
|
|
3474
|
+
const refreshCache = () => {
|
|
3475
|
+
const controller = new AbortController()
|
|
3476
|
+
const timer = setTimeout(() => controller.abort(), 4000)
|
|
3477
|
+
fetch('./dsh-chat-embed/cache', {
|
|
3478
|
+
method: 'GET',
|
|
3479
|
+
headers: { accept: 'application/json' },
|
|
3480
|
+
cache: 'no-store',
|
|
3481
|
+
signal: controller.signal,
|
|
3482
|
+
})
|
|
3483
|
+
.then((response) => (response.ok ? response.json() : undefined))
|
|
3484
|
+
.then((body) => {
|
|
3485
|
+
setCacheReport(body)
|
|
3486
|
+
})
|
|
3487
|
+
.catch((error) => {
|
|
3488
|
+
setCacheReport(undefined)
|
|
3489
|
+
log('warn', 'cache: size route did not answer: ' + messageOf(error))
|
|
3490
|
+
})
|
|
3491
|
+
.finally(() => {
|
|
3492
|
+
clearTimeout(timer)
|
|
3493
|
+
})
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3496
|
+
/**
|
|
3497
|
+
* Start the script. The Host does not delete; the script re-reads the
|
|
3498
|
+
* archive and refuses to touch any partition that is not one of the seven.
|
|
3499
|
+
*/
|
|
3500
|
+
const requestCacheClear = () => {
|
|
3501
|
+
const info = cacheReport !== undefined && cacheReport !== null ? cacheReport : {}
|
|
3502
|
+
const token = typeof info.token === 'string' ? info.token : ''
|
|
3503
|
+
if (token === '' || cacheBusy) return
|
|
3504
|
+
setCacheBusy(true)
|
|
3505
|
+
setCacheConfirm(false)
|
|
3506
|
+
const controller = new AbortController()
|
|
3507
|
+
const timer = setTimeout(() => controller.abort(), 60000)
|
|
3508
|
+
fetch('./dsh-chat-embed/cache-clear?token=' + encodeURIComponent(token), {
|
|
3509
|
+
method: 'GET',
|
|
3510
|
+
headers: { accept: 'application/json' },
|
|
3511
|
+
cache: 'no-store',
|
|
3512
|
+
signal: controller.signal,
|
|
3513
|
+
})
|
|
3514
|
+
.then((response) => (response.ok ? response.json() : undefined))
|
|
3515
|
+
.then((body) => {
|
|
3516
|
+
if (body === undefined || body === null) {
|
|
3517
|
+
setCacheReport({ ...info, detail: t('cacheFailed') })
|
|
3518
|
+
return
|
|
3519
|
+
}
|
|
3520
|
+
setCacheReport({ ...info, ...body, token })
|
|
3521
|
+
})
|
|
3522
|
+
.catch((error) => {
|
|
3523
|
+
setCacheReport({ ...info, ok: false, detail: messageOf(error) })
|
|
3524
|
+
log('warn', 'cache: clear did not finish: ' + messageOf(error))
|
|
3525
|
+
})
|
|
3526
|
+
.finally(() => {
|
|
3527
|
+
clearTimeout(timer)
|
|
3528
|
+
setCacheBusy(false)
|
|
3529
|
+
})
|
|
3530
|
+
}
|
|
3386
3531
|
const [copyState, setCopyState] = React.useState('')
|
|
3387
3532
|
const barTimerRef = React.useRef(0)
|
|
3388
3533
|
const cancelBarTimer = () => {
|
|
@@ -3451,14 +3596,18 @@ let activeCtx = undefined
|
|
|
3451
3596
|
const record = guestRecord(provider.id)
|
|
3452
3597
|
|
|
3453
3598
|
// The status strip only earns its space while something is happening or
|
|
3454
|
-
// wrong; a healthy tab shows nothing but its tabs.
|
|
3455
|
-
|
|
3599
|
+
// wrong; a healthy tab shows nothing but its tabs. A pending patch is
|
|
3600
|
+
// "something is happening": the script is waiting for DSH to exit, and
|
|
3601
|
+
// the user has to quit it from the tray, so say so where they look.
|
|
3602
|
+
const patchPending = patchAction.pending
|
|
3603
|
+
const showStatus = patchPending || snapshot.phase !== PHASE.READY && snapshot.phase !== PHASE.IDLE
|
|
3456
3604
|
// A problem keeps the bar reachable without hunting for it.
|
|
3457
3605
|
const barVisible =
|
|
3458
3606
|
barOpen ||
|
|
3459
3607
|
menuOpen ||
|
|
3460
3608
|
record.diagOpen ||
|
|
3461
3609
|
record.oauthBlocked ||
|
|
3610
|
+
patchPending ||
|
|
3462
3611
|
snapshot.phase === PHASE.FAILED
|
|
3463
3612
|
const reloadTitle =
|
|
3464
3613
|
t('reload') +
|
|
@@ -3570,7 +3719,10 @@ let activeCtx = undefined
|
|
|
3570
3719
|
'aria-expanded': menuOpen ? 'true' : 'false',
|
|
3571
3720
|
onClick: () => {
|
|
3572
3721
|
if (menuOpen) closeMenu()
|
|
3573
|
-
else
|
|
3722
|
+
else {
|
|
3723
|
+
setMenuOpen(true)
|
|
3724
|
+
refreshCache()
|
|
3725
|
+
}
|
|
3574
3726
|
openBar()
|
|
3575
3727
|
},
|
|
3576
3728
|
},
|
|
@@ -3630,16 +3782,83 @@ let activeCtx = undefined
|
|
|
3630
3782
|
'data-persist-open': 'true',
|
|
3631
3783
|
'aria-label': t('persistLabel'),
|
|
3632
3784
|
title: t('persistCheckHint'),
|
|
3633
|
-
disabled:
|
|
3785
|
+
disabled: patchAction.running,
|
|
3634
3786
|
onClick: () => {
|
|
3635
|
-
|
|
3787
|
+
// The switch is the control, not a question: a click that
|
|
3788
|
+
// can work starts the script straight away. The dialog is
|
|
3789
|
+
// the fallback, so it only opens when nothing started.
|
|
3790
|
+
const target = persistenceState() === 'on' ? 'off' : 'on'
|
|
3791
|
+
log('info', 'patch: restart-login switch -> ' + target)
|
|
3636
3792
|
closeMenu()
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3793
|
+
void startPatchAction(t, target).then(
|
|
3794
|
+
(outcome) => {
|
|
3795
|
+
if (outcome === undefined || outcome === null || outcome.lead === '') return
|
|
3796
|
+
setConfirmMode(target)
|
|
3797
|
+
setConfirmLead(outcome.lead)
|
|
3798
|
+
setConfirmScript(outcome.script)
|
|
3799
|
+
setConfirmOpen(true)
|
|
3800
|
+
notify()
|
|
3801
|
+
},
|
|
3802
|
+
(error) => {
|
|
3803
|
+
log('error', 'patch: startPatchAction rejected', messageOf(error))
|
|
3804
|
+
},
|
|
3805
|
+
)
|
|
3640
3806
|
},
|
|
3641
3807
|
}),
|
|
3642
3808
|
),
|
|
3809
|
+
h(
|
|
3810
|
+
'div',
|
|
3811
|
+
{ className: 'dce-menu-row', 'data-cache-row': 'true' },
|
|
3812
|
+
h(
|
|
3813
|
+
'span',
|
|
3814
|
+
{
|
|
3815
|
+
className: 'dce-menu-label',
|
|
3816
|
+
title:
|
|
3817
|
+
cacheReport !== undefined && cacheReport !== null && cacheReport.mode === 'keep'
|
|
3818
|
+
? t('cacheKeepHint')
|
|
3819
|
+
: cacheReport !== undefined && cacheReport !== null && cacheReport.mode === 'purge'
|
|
3820
|
+
? t('cachePurgeHint')
|
|
3821
|
+
: t('cacheUnavailable'),
|
|
3822
|
+
},
|
|
3823
|
+
t('cacheLabel') +
|
|
3824
|
+
' ' +
|
|
3825
|
+
(cacheReport === undefined || cacheReport === null || cacheReport.ok !== true
|
|
3826
|
+
? t('cacheUnavailable')
|
|
3827
|
+
: formatCacheBytes(cacheReport.bytes)),
|
|
3828
|
+
),
|
|
3829
|
+
h(
|
|
3830
|
+
'button',
|
|
3831
|
+
{
|
|
3832
|
+
type: 'button',
|
|
3833
|
+
className: 'dce-menu-action',
|
|
3834
|
+
'data-cache-clear': 'true',
|
|
3835
|
+
disabled:
|
|
3836
|
+
cacheBusy ||
|
|
3837
|
+
cacheReport === undefined ||
|
|
3838
|
+
cacheReport === null ||
|
|
3839
|
+
cacheReport.ok !== true ||
|
|
3840
|
+
cacheReport.bytes === 0,
|
|
3841
|
+
title:
|
|
3842
|
+
cacheReport !== undefined &&
|
|
3843
|
+
cacheReport !== null &&
|
|
3844
|
+
typeof cacheReport.detail === 'string' &&
|
|
3845
|
+
cacheReport.detail !== ''
|
|
3846
|
+
? t('cacheFailed') + ' ' + cacheReport.detail
|
|
3847
|
+
: cacheReport !== undefined && cacheReport !== null && cacheReport.mode === 'purge'
|
|
3848
|
+
? t('cachePurgeHint')
|
|
3849
|
+
: t('cacheKeepHint'),
|
|
3850
|
+
onClick: () => {
|
|
3851
|
+
if (cacheReport !== undefined && cacheReport !== null && cacheReport.mode === 'purge') {
|
|
3852
|
+
closeMenu()
|
|
3853
|
+
setCacheConfirm(true)
|
|
3854
|
+
return
|
|
3855
|
+
}
|
|
3856
|
+
requestCacheClear()
|
|
3857
|
+
},
|
|
3858
|
+
},
|
|
3859
|
+
cacheBusy ? t('cacheClearing') : t('cacheClear'),
|
|
3860
|
+
),
|
|
3861
|
+
),
|
|
3643
3862
|
h(
|
|
3644
3863
|
'button',
|
|
3645
3864
|
{
|
|
@@ -3699,10 +3918,14 @@ let activeCtx = undefined
|
|
|
3699
3918
|
{ className: 'dce-card-title' },
|
|
3700
3919
|
t(confirmMode === 'off' ? 'persistOffTitle' : 'persistConfirmTitle'),
|
|
3701
3920
|
),
|
|
3921
|
+
confirmLead === '' ? null : h('div', { className: 'dce-card-body', 'data-persist-lead': 'true' }, confirmLead),
|
|
3702
3922
|
h('div', { className: 'dce-card-body' }, t(confirmMode === 'off' ? 'persistOffBody' : 'persistRisk')),
|
|
3703
|
-
confirmMode === 'off'
|
|
3923
|
+
confirmMode === 'off' ? null : h('div', { className: 'dce-card-body' }, t('persistConfirmNote')),
|
|
3924
|
+
confirmScript === undefined
|
|
3704
3925
|
? null
|
|
3705
|
-
:
|
|
3926
|
+
: confirmScript === ''
|
|
3927
|
+
? h('div', { className: 'dce-card-body' }, t('patchScriptMissing'))
|
|
3928
|
+
: h('div', { className: 'dce-card-detail' }, confirmScript),
|
|
3706
3929
|
confirmError === '' ? null : h('div', { className: 'dce-card-detail' }, confirmError),
|
|
3707
3930
|
h(
|
|
3708
3931
|
'div',
|
|
@@ -3718,18 +3941,18 @@ let activeCtx = undefined
|
|
|
3718
3941
|
type: 'button',
|
|
3719
3942
|
className: 'dce-button dce-button-primary',
|
|
3720
3943
|
'data-persist-confirm': 'true',
|
|
3721
|
-
disabled:
|
|
3944
|
+
disabled: patchAction.running,
|
|
3722
3945
|
onClick: () => {
|
|
3723
3946
|
log('info', 'dialog: the confirm button was clicked')
|
|
3724
3947
|
setConfirmError('')
|
|
3725
|
-
void
|
|
3948
|
+
void copyPatchCommand(t, confirmMode).then(
|
|
3726
3949
|
(failure) => {
|
|
3727
3950
|
if (typeof failure === 'string' && failure !== '') setConfirmError(failure)
|
|
3728
3951
|
else setConfirmOpen(false)
|
|
3729
3952
|
},
|
|
3730
3953
|
(error) => {
|
|
3731
3954
|
const reason = messageOf(error)
|
|
3732
|
-
log('error', 'dialog:
|
|
3955
|
+
log('error', 'dialog: copyPatchCommand rejected', reason)
|
|
3733
3956
|
setConfirmError(reason)
|
|
3734
3957
|
},
|
|
3735
3958
|
)
|
|
@@ -3740,13 +3963,73 @@ let activeCtx = undefined
|
|
|
3740
3963
|
),
|
|
3741
3964
|
)
|
|
3742
3965
|
: null,
|
|
3966
|
+
cacheConfirm
|
|
3967
|
+
? h('div', {
|
|
3968
|
+
className: 'dce-confirm-scrim',
|
|
3969
|
+
onPointerDown: () => setCacheConfirm(false),
|
|
3970
|
+
})
|
|
3971
|
+
: null,
|
|
3972
|
+
cacheConfirm
|
|
3973
|
+
? h(
|
|
3974
|
+
'div',
|
|
3975
|
+
{
|
|
3976
|
+
className: 'dce-card',
|
|
3977
|
+
role: 'dialog',
|
|
3978
|
+
'aria-modal': 'true',
|
|
3979
|
+
'data-modal': 'true',
|
|
3980
|
+
'data-cache-confirm': 'true',
|
|
3981
|
+
'aria-label': t('cachePurgeTitle'),
|
|
3982
|
+
},
|
|
3983
|
+
h('div', { className: 'dce-card-title' }, t('cachePurgeTitle')),
|
|
3984
|
+
h('div', { className: 'dce-card-body' }, t('cachePurgeBody')),
|
|
3985
|
+
h(
|
|
3986
|
+
'div',
|
|
3987
|
+
{ className: 'dce-card-actions' },
|
|
3988
|
+
h(
|
|
3989
|
+
'button',
|
|
3990
|
+
{
|
|
3991
|
+
type: 'button',
|
|
3992
|
+
className: 'dce-button',
|
|
3993
|
+
'data-cache-cancel': 'true',
|
|
3994
|
+
onClick: () => setCacheConfirm(false),
|
|
3995
|
+
},
|
|
3996
|
+
t('persistConfirmCancel'),
|
|
3997
|
+
),
|
|
3998
|
+
h(
|
|
3999
|
+
'button',
|
|
4000
|
+
{
|
|
4001
|
+
type: 'button',
|
|
4002
|
+
className: 'dce-button dce-button-primary',
|
|
4003
|
+
'data-cache-confirm-go': 'true',
|
|
4004
|
+
disabled: cacheBusy,
|
|
4005
|
+
onClick: () => {
|
|
4006
|
+
requestCacheClear()
|
|
4007
|
+
},
|
|
4008
|
+
},
|
|
4009
|
+
t('cachePurgeGo'),
|
|
4010
|
+
),
|
|
4011
|
+
),
|
|
4012
|
+
)
|
|
4013
|
+
: null,
|
|
3743
4014
|
showStatus
|
|
3744
4015
|
? h(
|
|
3745
4016
|
'div',
|
|
3746
|
-
{ className: 'dce-status-bar' },
|
|
3747
|
-
h('span', {
|
|
3748
|
-
|
|
3749
|
-
|
|
4017
|
+
{ className: 'dce-status-bar', 'data-patch-pending': patchPending ? 'true' : 'false' },
|
|
4018
|
+
h('span', {
|
|
4019
|
+
className: 'dce-dot',
|
|
4020
|
+
'data-phase': patchPending ? 'pending' : snapshot.phase,
|
|
4021
|
+
'aria-hidden': true,
|
|
4022
|
+
}),
|
|
4023
|
+
h(
|
|
4024
|
+
'span',
|
|
4025
|
+
{ className: 'dce-status' },
|
|
4026
|
+
patchPending ? t('patchPending') : t(STATUS_KEY[snapshot.phase] || 'statusIdle'),
|
|
4027
|
+
),
|
|
4028
|
+
patchPending
|
|
4029
|
+
? h('span', { className: 'dce-diag' }, t('patchPendingHint'))
|
|
4030
|
+
: snapshot.detail === ''
|
|
4031
|
+
? null
|
|
4032
|
+
: h('span', { className: 'dce-diag' }, snapshot.detail),
|
|
3750
4033
|
)
|
|
3751
4034
|
: null,
|
|
3752
4035
|
h(
|
|
@@ -3977,16 +4260,17 @@ let activeCtx = undefined
|
|
|
3977
4260
|
updateSurface,
|
|
3978
4261
|
getLogging,
|
|
3979
4262
|
persistenceState,
|
|
4263
|
+
formatCacheBytes,
|
|
3980
4264
|
readPersistedSeen,
|
|
3981
4265
|
storePersistenceSeen,
|
|
3982
4266
|
livePartitionState,
|
|
3983
4267
|
patchInstructions,
|
|
3984
4268
|
fetchProbe,
|
|
3985
4269
|
patchProbe,
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4270
|
+
patchAction,
|
|
4271
|
+
startPatchAction,
|
|
4272
|
+
patchFallbackText,
|
|
4273
|
+
copyPatchCommand,
|
|
3990
4274
|
setLogging,
|
|
3991
4275
|
clearLog,
|
|
3992
4276
|
readLogEntries,
|