dsh-config-sync-plugin 0.4.10 → 0.4.12
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.en.md +22 -0
- package/README.md +22 -0
- package/client.js +48 -42
- package/index.js +203 -33
- package/package.json +1 -1
- package/runtime/apply.ps1 +3 -1
- package/runtime/capture.ps1 +1 -1
- package/runtime/dsh-sync-common.ps1 +1 -1
- package/runtime/restore.ps1 +11 -13
- package/runtime/sync.ps1 +3 -1
- package/tools/clientcheck.mjs +3 -2
- package/tools/pack-plugin.ps1 +11 -3
- package/tools/selftest.mjs +14 -9
- package/README.en.md.bak-0410 +0 -830
- package/README.md.bak-0410 +0 -822
- package/runtime/apply.ps1.bak-0410 +0 -1646
- package/runtime/sync.ps1.bak-0410 +0 -1117
- package/tools/selftest.mjs.bak-0410 +0 -2045
package/README.en.md
CHANGED
|
@@ -257,6 +257,28 @@ Two display fixes on top of 0.3.77:
|
|
|
257
257
|
|
|
258
258
|
The "Plugin update" card now shows an **npm download URL** line with the actual fallback addresses (domestic mirror `registry.npmmirror.com` + official `registry.npmjs.org`). When the GitHub release download is unreachable (common in mainland China), the update package automatically falls back to npm. It is still verified against the authoritative sha256 in `version.json` — switching source never relaxes verification. The two sources back each other up: the mirror can briefly 404 during its first-sync window, and the official source takes over. The npm tarball is byte-identical to the GitHub release tgz (same sha256).
|
|
259
259
|
|
|
260
|
+
### Content-level pending detection: only prompt to push when content actually changed (0.4.12)
|
|
261
|
+
|
|
262
|
+
This release changes the "pending push" rule from a timestamp check to a content-level check, fixing false positives without altering the normal push/pull flow:
|
|
263
|
+
|
|
264
|
+
- **No more mtime-only false changes**: DSH rewrites of `cordis.patch.yml`, session `projcache` / `session-index` that only touch timestamps without changing content are no longer reported as pending.
|
|
265
|
+
- **Content-fingerprint baseline + `pendingKeys`**: a content fingerprint is used as the baseline for real changes, and `pendingKeys` prevents the two sides from whitewashing each other with identical content.
|
|
266
|
+
- **No db/sqlite misses**: db/sqlite files up to 64MB use full hashing so same-size in-place updates are not missed by size/mtime-only checks.
|
|
267
|
+
- **Criteria aligned**: `autoPush` and close-time push use the same new rule, instead of one using content and the other timestamps.
|
|
268
|
+
- **Verification**: two rounds of isolated review found no blocking issues, and `selftest` had no new failures.
|
|
269
|
+
|
|
270
|
+
### Code cleanup and consistency fixes: equivalent refactor, no feature change (0.4.11)
|
|
271
|
+
|
|
272
|
+
This release is an equivalent refactor. The normal sync path is identical to 0.4.10 and no user-visible feature changes:
|
|
273
|
+
|
|
274
|
+
- **Gate criteria consolidated**: `pushAllowed` / `pullAllowed` are now unified into `canPush()` / `canPull()`, word-for-word equivalent to the original criteria; the fast criteria on the close path are unchanged and introduce no new allow conditions.
|
|
275
|
+
- **One fewer remote request**: the periodic re-check already ran `git fetch` and has the drift, so it reuses it via `driftOverride` instead of fetching again.
|
|
276
|
+
- **Idempotent force-kill**: multiple force-kill triggers within 1.5 seconds execute only once, so the close hook / periodic pre-queue / frontend beacon do not kill the same process family repeatedly.
|
|
277
|
+
- **Single source of truth**: the plugin root and version are consolidated to a single `PLUGIN_DIR` / `PLUGIN_VERSION` definition; dead code (`lsRemoteHeads`, unused imports, unused state) was removed.
|
|
278
|
+
- **Consistency fixes**: `market-index.json` `publishTimestamp` normalized to milliseconds; leading-zero versions gain an `npmVersion` field; packaging excludes `_stage-*` / `_refactor-*` / `*.bak*` temp artifacts; the restore flow's AppRoot detection and experimental-bundle (`app.asar`) recognition are aligned with the main path; the language header is computed at request time (POST follows a language switch too); `callUpdate` now checks failures.
|
|
279
|
+
|
|
280
|
+
Self-test: the four `node --check` targets, `selftest.mjs` and `clientcheck.mjs` match the 0.4.10 baseline item by item (the 8 prepare failures in this environment are pre-existing baseline failures with no `origin` configured, not introduced by this release).
|
|
281
|
+
|
|
260
282
|
### Pending push but nothing happens on × close: backend periodic pre-queue (0.4.05)
|
|
261
283
|
|
|
262
284
|
End-to-end diagnosis (manual POST to `/config-sync/auto-exit`) proved the backend check and route are fine — it instantly returns `queued:true`, queues the watcher, force-exits DSH and completes the push. Root cause is the frontend: `pagehide → navigator.sendBeacon('/config-sync/auto-exit')` never reaches the backend when DSH really exits (no beacon arrival in launch.log during × close), yet 0.3.96+ relied solely on it — code-level selftests passed but real UI never verified it.
|
package/README.md
CHANGED
|
@@ -277,6 +277,28 @@ pwsh -File runtime\sync.ps1 pull `
|
|
|
277
277
|
|
|
278
278
|
「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(国内镜像 `registry.npmmirror.com` + 官方 `registry.npmjs.org` 两个源)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。两个源互为备份:镜像首发同步窗口期会短暂 404,官方源随即兜上。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
|
|
279
279
|
|
|
280
|
+
### 待推送判据改为内容级:实际内容变了才提示推送(0.4.12)
|
|
281
|
+
|
|
282
|
+
本版把「待推送」从时间戳判据改为内容级判据,只修误报、不改变正常推送/拉取流程:
|
|
283
|
+
|
|
284
|
+
- **消除 mtime 假变更**:DSH 重写 `cordis.patch.yml`、会话 `projcache` / `session-index` 时只改时间戳不改内容,不再被判为待推送。
|
|
285
|
+
- **内容指纹基线 + `pendingKeys`**:以内容指纹为基线识别真正变化,`pendingKeys` 防止双方同内容互相洗白。
|
|
286
|
+
- **db/sqlite 不漏检**:≤64MB 的 db/sqlite 走全量 hash,避免同尺寸原地更新只看大小/mtime 时漏检。
|
|
287
|
+
- **判据同步**:`autoPush` 与退出推送使用同一套新口径,不再一边按内容、一边按时间戳。
|
|
288
|
+
- **验证**:隔离审查两轮无阻断项,`selftest` 无新增失败。
|
|
289
|
+
|
|
290
|
+
### 代码整理与一致性修复:等价重构,功能不变(0.4.11)
|
|
291
|
+
|
|
292
|
+
本版是一次等价重构,正常同步路径与 0.4.10 完全一致,不改变任何用户可见功能:
|
|
293
|
+
|
|
294
|
+
- **门禁判据收敛**:`pushAllowed` / `pullAllowed` 抽成 `canPush()` / `canPull()` 统一函数,判据与原来逐字等价;退出关闭路径的 fast 判据保持原样,不引入新的放行条件。
|
|
295
|
+
- **少一次远端请求**:定时复查已经 `git fetch` 得到 drift,直接复用并传给 `checkAndQueueAutoSync`(`driftOverride`),不再重复 fetch。
|
|
296
|
+
- **强杀幂等**:1.5 秒内多次触发强杀只执行一次,避免窗口关闭钩子 / 定时预排 / 前端信标三路重复杀同一进程族。
|
|
297
|
+
- **单一定义**:插件根目录与版本收敛到 `PLUGIN_DIR` / `PLUGIN_VERSION` 单一来源;删除从未调用的 `lsRemoteHeads`、死导入与未使用的 state 等死代码。
|
|
298
|
+
- **一致性修复**:`market-index.json` 的 `publishTimestamp` 统一为毫秒;前导零版本补 `npmVersion` 字段;打包排除 `_stage-*` / `_refactor-*` / `*.bak*` 等临时产物;还原流程的 AppRoot 探测与实验 bundle(`app.asar`)识别对齐主链路;语言头改为请求时计算(切换语言后 POST 也跟随);`callUpdate` 补失败判断。
|
|
299
|
+
|
|
300
|
+
自测:`node --check` 四项、`selftest.mjs`、`clientcheck.mjs` 与 0.4.10 基线逐项一致(本环境 8 项 prepare 失败为无 origin 的既有基线失败,非本版引入)。
|
|
301
|
+
|
|
280
302
|
### 点 × 立即执行待推送/待拉取:后端窗口监视(0.4.06)
|
|
281
303
|
|
|
282
304
|
0.4.05 把「点 × 后没执行」的根因定位到前端信标送不到后端,用 2 分钟定时复查预排 watcher 绕开。但预排有窗口期:用户在两次复查之间点 ×,那一刻既没有预排 watcher、信标又送不到,退出后就什么都不执行。
|
package/client.js
CHANGED
|
@@ -231,6 +231,10 @@ window.__ModuleLoader__.load({
|
|
|
231
231
|
)
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// 状态口径统一:后端 0.4.10 起用 uncommitted,旧快照/旧版本可能只有 dirty;
|
|
235
|
+
// 这里统一取值函数,local.pending / repo.pending 仍是“待推送”语义,保持原样。
|
|
236
|
+
const uncommittedOf = (repo) => (repo?.uncommitted ?? repo?.dirty ?? 0)
|
|
237
|
+
|
|
234
238
|
/**
|
|
235
239
|
* 左侧徽标:只说**本机自身**的状态(配置是否齐、依赖是否缺、有没有未提交/未推送的改动)。
|
|
236
240
|
* 「云端比本机领先多少」一律交给右侧云端徽标(cloudLine),否则标题行会同时出现
|
|
@@ -259,7 +263,7 @@ window.__ModuleLoader__.load({
|
|
|
259
263
|
}
|
|
260
264
|
// 0.4.10 起:本机/契约版本不一致不再算告警——拉取不再因版本不一致被阻断,只保留左上角信息条展示。
|
|
261
265
|
if (repo.behind === null) return { kind: 'idle', text: M('读不到本机 git 状态(git 不可用或没 upstream)', 'Cannot read local git state (git missing or no upstream)') }
|
|
262
|
-
if (repo
|
|
266
|
+
if (uncommittedOf(repo) > 0) return { kind: 'warn', text: M(`本机有 ${uncommittedOf(repo)} 处未提交改动,建议推送`, `${uncommittedOf(repo)} uncommitted change(s) — consider pushing`) }
|
|
263
267
|
if (repo.ahead > 0) return { kind: 'warn', text: M(`本机有 ${repo.ahead} 个提交还没推送`, `${repo.ahead} local commit(s) not pushed yet`) }
|
|
264
268
|
// git 干净不代表没东西要推:新会话/新资料还躺在 ~\.dsh 里,没 capture 之前仓库是完全干净的
|
|
265
269
|
const local = data.local || {}
|
|
@@ -329,14 +333,15 @@ window.__ModuleLoader__.load({
|
|
|
329
333
|
}
|
|
330
334
|
|
|
331
335
|
/** 每个 POST 都带 accept-language:宿主的建议句/错误信息按它出中文或英文。 */
|
|
332
|
-
|
|
336
|
+
// 函数化:每次请求现读语言,避免面板加载后才切换语言时 POST 仍带旧 accept-language。
|
|
337
|
+
const jsonHeaders = () => ({ 'content-type': 'application/json', ...langHeaders() })
|
|
333
338
|
|
|
334
339
|
async function callPrepare(action, message, backupDir) {
|
|
335
340
|
const res = await fetch('/config-sync/prepare', {
|
|
336
341
|
method: 'POST',
|
|
337
342
|
cache: 'no-store',
|
|
338
343
|
credentials: 'same-origin',
|
|
339
|
-
headers: jsonHeaders,
|
|
344
|
+
headers: jsonHeaders(),
|
|
340
345
|
body: JSON.stringify({ action, message: message || '', backupDir: backupDir || '' }),
|
|
341
346
|
})
|
|
342
347
|
const text = await res.text()
|
|
@@ -351,7 +356,7 @@ window.__ModuleLoader__.load({
|
|
|
351
356
|
method: 'POST',
|
|
352
357
|
cache: 'no-store',
|
|
353
358
|
credentials: 'same-origin',
|
|
354
|
-
headers: jsonHeaders,
|
|
359
|
+
headers: jsonHeaders(),
|
|
355
360
|
body: JSON.stringify(payload),
|
|
356
361
|
})
|
|
357
362
|
const text = await res.text()
|
|
@@ -367,7 +372,7 @@ window.__ModuleLoader__.load({
|
|
|
367
372
|
method: 'POST',
|
|
368
373
|
cache: 'no-store',
|
|
369
374
|
credentials: 'same-origin',
|
|
370
|
-
headers: jsonHeaders,
|
|
375
|
+
headers: jsonHeaders(),
|
|
371
376
|
body: JSON.stringify(payload),
|
|
372
377
|
})
|
|
373
378
|
const text = await res.text()
|
|
@@ -387,7 +392,7 @@ window.__ModuleLoader__.load({
|
|
|
387
392
|
method: 'POST',
|
|
388
393
|
cache: 'no-store',
|
|
389
394
|
credentials: 'same-origin',
|
|
390
|
-
headers: jsonHeaders,
|
|
395
|
+
headers: jsonHeaders(),
|
|
391
396
|
body: JSON.stringify(payload),
|
|
392
397
|
}
|
|
393
398
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -408,7 +413,7 @@ window.__ModuleLoader__.load({
|
|
|
408
413
|
method: 'POST',
|
|
409
414
|
cache: 'no-store',
|
|
410
415
|
credentials: 'same-origin',
|
|
411
|
-
headers: jsonHeaders,
|
|
416
|
+
headers: jsonHeaders(),
|
|
412
417
|
body: JSON.stringify(payload),
|
|
413
418
|
}
|
|
414
419
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -429,7 +434,7 @@ window.__ModuleLoader__.load({
|
|
|
429
434
|
method: 'POST',
|
|
430
435
|
cache: 'no-store',
|
|
431
436
|
credentials: 'same-origin',
|
|
432
|
-
headers: jsonHeaders,
|
|
437
|
+
headers: jsonHeaders(),
|
|
433
438
|
body: JSON.stringify(payload),
|
|
434
439
|
}
|
|
435
440
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -447,14 +452,14 @@ window.__ModuleLoader__.load({
|
|
|
447
452
|
method: 'POST',
|
|
448
453
|
cache: 'no-store',
|
|
449
454
|
credentials: 'same-origin',
|
|
450
|
-
headers: jsonHeaders,
|
|
455
|
+
headers: jsonHeaders(),
|
|
451
456
|
body: JSON.stringify(payload),
|
|
452
457
|
}
|
|
453
458
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
454
459
|
const text = await res.text()
|
|
455
460
|
let body
|
|
456
461
|
try { body = text ? JSON.parse(text) : null } catch { throw badJson(res) }
|
|
457
|
-
if (!res.ok || !body) throw new Error((body && body.error) || `${res.status}`)
|
|
462
|
+
if (!res.ok || !body || body.ok !== true) throw new Error((body && body.error) || `${res.status}`)
|
|
458
463
|
return body
|
|
459
464
|
}
|
|
460
465
|
|
|
@@ -465,7 +470,7 @@ window.__ModuleLoader__.load({
|
|
|
465
470
|
method: 'POST',
|
|
466
471
|
cache: 'no-store',
|
|
467
472
|
credentials: 'same-origin',
|
|
468
|
-
headers: jsonHeaders,
|
|
473
|
+
headers: jsonHeaders(),
|
|
469
474
|
body: JSON.stringify(payload),
|
|
470
475
|
}
|
|
471
476
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -484,7 +489,7 @@ window.__ModuleLoader__.load({
|
|
|
484
489
|
method,
|
|
485
490
|
cache: 'no-store',
|
|
486
491
|
credentials: 'same-origin',
|
|
487
|
-
headers: payload ? jsonHeaders : langHeaders(),
|
|
492
|
+
headers: payload ? jsonHeaders() : langHeaders(),
|
|
488
493
|
body: payload ? JSON.stringify(payload) : undefined,
|
|
489
494
|
})
|
|
490
495
|
const text = await res.text()
|
|
@@ -506,7 +511,7 @@ window.__ModuleLoader__.load({
|
|
|
506
511
|
method: 'POST',
|
|
507
512
|
cache: 'no-store',
|
|
508
513
|
credentials: 'same-origin',
|
|
509
|
-
headers: jsonHeaders,
|
|
514
|
+
headers: jsonHeaders(),
|
|
510
515
|
body: JSON.stringify(payload),
|
|
511
516
|
}
|
|
512
517
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -688,8 +693,8 @@ window.__ModuleLoader__.load({
|
|
|
688
693
|
k: M('远端', 'Remote'),
|
|
689
694
|
v: repo.exists
|
|
690
695
|
? M(
|
|
691
|
-
`落后 ${repo.behind ?? '?'} · 领先 ${repo.ahead ?? '?'} · 未提交 ${repo
|
|
692
|
-
`behind ${repo.behind ?? '?'} · ahead ${repo.ahead ?? '?'} · uncommitted ${repo
|
|
696
|
+
`落后 ${repo.behind ?? '?'} · 领先 ${repo.ahead ?? '?'} · 未提交 ${uncommittedOf(repo)}` + (repo.pending ? `(本机待同步 ${repo.pending})` : ''),
|
|
697
|
+
`behind ${repo.behind ?? '?'} · ahead ${repo.ahead ?? '?'} · uncommitted ${uncommittedOf(repo)}` + (repo.pending ? ` (${repo.pending} pending on this machine)` : ''),
|
|
693
698
|
)
|
|
694
699
|
: (repo.empty ? M('(拉取之后才有得比)', '(available after the first pull)') : M('(不可用)', '(unavailable)')),
|
|
695
700
|
}),
|
|
@@ -845,7 +850,6 @@ window.__ModuleLoader__.load({
|
|
|
845
850
|
const [busy, setBusy] = react.useState(false)
|
|
846
851
|
const [err, setErr] = react.useState('')
|
|
847
852
|
const [msg, setMsg] = react.useState('')
|
|
848
|
-
const [made, setMade] = react.useState(null)
|
|
849
853
|
const [confirm, setConfirm] = react.useState(null) // { snap, preview }:确认环节
|
|
850
854
|
const [queued, setQueued] = react.useState(null) // restore-now 的排队结果
|
|
851
855
|
const [manual, setManual] = react.useState(null) // 认不出类型时的「手动还原」指引
|
|
@@ -1164,17 +1168,6 @@ window.__ModuleLoader__.load({
|
|
|
1164
1168
|
manualBlock,
|
|
1165
1169
|
queuedBlock,
|
|
1166
1170
|
lastRestoreBlock,
|
|
1167
|
-
made
|
|
1168
|
-
? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } },
|
|
1169
|
-
h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-success-primary)' } },
|
|
1170
|
-
M(`已生成:${made.path}`, `Generated: ${made.path}`)),
|
|
1171
|
-
h('div', { style: S.code }, made.command || ''),
|
|
1172
|
-
h('div', { style: S.footnote }, M(
|
|
1173
|
-
'完全退出 DSH 后双击这份 .cmd:先打印计划,输 y 才真正写(写前自动备份当前状态)。',
|
|
1174
|
-
'Quit DSH, then double-click the .cmd: it prints the plan and only writes after y (backing up the current state first).',
|
|
1175
|
-
)),
|
|
1176
|
-
)
|
|
1177
|
-
: null,
|
|
1178
1171
|
err ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } }, M(`操作失败:${err}`, `Failed: ${err}`)) : null,
|
|
1179
1172
|
msg ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-success-primary)' } }, msg) : null,
|
|
1180
1173
|
h('div', { style: S.footnote }, M(
|
|
@@ -2007,7 +2000,7 @@ window.__ModuleLoader__.load({
|
|
|
2007
2000
|
try {
|
|
2008
2001
|
const res = await fetch('/config-sync/auto', {
|
|
2009
2002
|
method: 'POST', cache: 'no-store', credentials: 'same-origin',
|
|
2010
|
-
headers: jsonHeaders,
|
|
2003
|
+
headers: jsonHeaders(),
|
|
2011
2004
|
body: JSON.stringify({ action, ...(extra || {}) }),
|
|
2012
2005
|
})
|
|
2013
2006
|
const text = await res.text()
|
|
@@ -2093,6 +2086,8 @@ window.__ModuleLoader__.load({
|
|
|
2093
2086
|
type: 'button',
|
|
2094
2087
|
style: canPullNow ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
|
|
2095
2088
|
disabled: Boolean(busy) || !canPullNow,
|
|
2089
|
+
// 文案分叉是刻意的,与设置页摘要行不同:本卡的推送按钮在 initMode 下会切成「初始化推送」,
|
|
2090
|
+
// 所以这里指引写「先初始化推送」与按钮实际标签一致;摘要行按钮固定「立即推送」,两处场景不同,保留各自口径。
|
|
2096
2091
|
title: canPullNow ? '' : M('云端还是空的:没有内容可拉,先「初始化推送」', 'The cloud is still empty — nothing to pull, initialize push first'),
|
|
2097
2092
|
onClick: () => act('pull-now'),
|
|
2098
2093
|
}, M('立即拉取(会关闭 DSH)', 'Pull now (closes DSH)')),
|
|
@@ -2241,7 +2236,6 @@ window.__ModuleLoader__.load({
|
|
|
2241
2236
|
// 定时器放 ref 里:数据每刷新一次 effect 就会重跑,若在 effect 里 return 清理函数,
|
|
2242
2237
|
// 会把还没到点的"5 秒后消失"定时器一起清掉,提示就一直挂在屏幕上。
|
|
2243
2238
|
const toastTimer = react.useRef(null)
|
|
2244
|
-
const headerRef = react.useRef(null)
|
|
2245
2239
|
const summary = summarize(data)
|
|
2246
2240
|
// 门禁分三条:有路径就能生成还原脚本;拉取允许「真仓库 or 空目录」;推送只允许真仓库。
|
|
2247
2241
|
// 空目录 = 新机器还没拉过,面板只放行「拉取」,推送按钮直接禁掉(后端也会再拦一次)。
|
|
@@ -2305,6 +2299,9 @@ window.__ModuleLoader__.load({
|
|
|
2305
2299
|
if (failure) {
|
|
2306
2300
|
showToast(M(`重新检测失败:${failure}`, `Re-check failed: ${failure}`))
|
|
2307
2301
|
} else {
|
|
2302
|
+
// 时间格式三处不统一是刻意保留:toast 只需当前「时分秒」即时反馈,短格式更轻;
|
|
2303
|
+
// 概览指标用固定 M/D HH:mm 省版面,待办卡用 toLocaleString 出完整日期。三者可见格式不同,
|
|
2304
|
+
// 统一会改变用户看到的文案,按功能不变优先保持原样。
|
|
2308
2305
|
const t = new Date().toLocaleTimeString()
|
|
2309
2306
|
showToast(M(`已重新检测,数据已是最新(${t})`, `Re-checked, data is up to date (${t})`))
|
|
2310
2307
|
}
|
|
@@ -2348,7 +2345,9 @@ window.__ModuleLoader__.load({
|
|
|
2348
2345
|
}
|
|
2349
2346
|
}
|
|
2350
2347
|
|
|
2351
|
-
// 老路径遗留(install-live
|
|
2348
|
+
// 老路径遗留(install-live 装好了但没重启):只重启,不装东西。
|
|
2349
|
+
// 这里保留 restartDsh:restartRequired 场景下包已经覆盖进插件目录,只缺一次重启;
|
|
2350
|
+
// 主路径 restartAndInstall 走 install-restart,会先检查 prepared 包并再次安装,和这个场景不等价。
|
|
2352
2351
|
const restartDsh = async () => {
|
|
2353
2352
|
setUpdBusy(true)
|
|
2354
2353
|
try {
|
|
@@ -2460,9 +2459,12 @@ window.__ModuleLoader__.load({
|
|
|
2460
2459
|
return { kind: 'idle', text: M('云端检查中…', 'Checking the cloud…') }
|
|
2461
2460
|
})()
|
|
2462
2461
|
|
|
2462
|
+
// cloudLine 实际可能返回 ok / error / pull / init / idle;原先 init 落到默认「检查中」,
|
|
2463
|
+
// error 也只写「不一致」,这里按 chipLabel 的同款口径补全每一种 kind 的短标签。
|
|
2463
2464
|
const cloudLabel = cloudLine.kind === 'ok' ? M('一致', 'In sync')
|
|
2464
|
-
: (cloudLine.kind === 'error' ? M('
|
|
2465
|
-
: (cloudLine.kind === 'pull' ? M('待拉取', 'To pull')
|
|
2465
|
+
: (cloudLine.kind === 'error' ? M('检查失败', 'Check failed')
|
|
2466
|
+
: (cloudLine.kind === 'pull' ? M('待拉取', 'To pull')
|
|
2467
|
+
: (cloudLine.kind === 'init' ? M('待初始化', 'To initialize') : M('检查中', 'Checking'))))
|
|
2466
2468
|
|
|
2467
2469
|
// 插件更新卡:老版本机器进来第一眼就能看到"有新版本 x.y.z"和更新按钮;
|
|
2468
2470
|
// 更新相关的配置(清单地址、只读令牌)也收在这张卡里,别散到「云端仓库」去。
|
|
@@ -2809,7 +2811,7 @@ window.__ModuleLoader__.load({
|
|
|
2809
2811
|
// 页头在滚动区之外:内容滚不到它上面,区标签跳转后的标题也只出现在它下面
|
|
2810
2812
|
h('div', { style: S.pageHeaderWrap },
|
|
2811
2813
|
h('div', { style: S.pageHeaderInner },
|
|
2812
|
-
h('div', {
|
|
2814
|
+
h('div', { style: S.pageHeader },
|
|
2813
2815
|
h('div', { style: S.pageHeaderMain },
|
|
2814
2816
|
h('div', { style: S.pageTitleRow },
|
|
2815
2817
|
h('div', { style: S.pageTitle }, M('配置同步', 'Config Sync')),
|
|
@@ -2865,12 +2867,13 @@ window.__ModuleLoader__.load({
|
|
|
2865
2867
|
...(conflictCard ? [['conflict', M('同步冲突', 'Sync conflicts')]] : []),
|
|
2866
2868
|
...(showRoots ? [['roots', M('本机路径', 'Local paths')]] : []),
|
|
2867
2869
|
['targets', M('同步目标', 'Targets')],
|
|
2868
|
-
|
|
2869
|
-
['
|
|
2870
|
-
['
|
|
2871
|
-
['
|
|
2872
|
-
['
|
|
2873
|
-
['
|
|
2870
|
+
// 导航文案与 Section 标题口径对齐:key 仍是滚动锚点,只改显示标签,不改功能分组。
|
|
2871
|
+
['automation', M('自动化与插件更新', 'Automation & plugin update')],
|
|
2872
|
+
['actions', M('退出后执行', 'After exit')],
|
|
2873
|
+
['restore', M('还原备份', 'Restore backup')],
|
|
2874
|
+
['scope', M('同步内容', 'Sync content')],
|
|
2875
|
+
['extra', M('插件数据与额外路径', 'Plugin data & extra paths')],
|
|
2876
|
+
['workspace', M('工作区显示', 'Workspace visibility')],
|
|
2874
2877
|
['feedback', M('问题反馈', 'Feedback')],
|
|
2875
2878
|
].map((pair) => {
|
|
2876
2879
|
const sid = pair[0], label = pair[1]
|
|
@@ -3527,8 +3530,8 @@ window.__ModuleLoader__.load({
|
|
|
3527
3530
|
v: data.repo.behind === null
|
|
3528
3531
|
? M('读不到', 'Unavailable')
|
|
3529
3532
|
: M(
|
|
3530
|
-
`落后 ${data.repo.behind} · 领先 ${data.repo.ahead} · 未提交 ${data.repo
|
|
3531
|
-
`behind ${data.repo.behind} · ahead ${data.repo.ahead} · uncommitted ${data.repo
|
|
3533
|
+
`落后 ${data.repo.behind} · 领先 ${data.repo.ahead} · 未提交 ${uncommittedOf(data.repo)}` + (data.repo.pending ? `(本机待同步 ${data.repo.pending})` : ''),
|
|
3534
|
+
`behind ${data.repo.behind} · ahead ${data.repo.ahead} · uncommitted ${uncommittedOf(data.repo)}` + (data.repo.pending ? ` (${data.repo.pending} pending on this machine)` : ''),
|
|
3532
3535
|
),
|
|
3533
3536
|
}) : null,
|
|
3534
3537
|
data ? h(Kv, {
|
|
@@ -3546,6 +3549,9 @@ window.__ModuleLoader__.load({
|
|
|
3546
3549
|
type: 'button',
|
|
3547
3550
|
style: canPull ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
|
|
3548
3551
|
disabled: Boolean(actBusy) || !canPull,
|
|
3552
|
+
// 文案分叉是刻意的,与「自动同步」卡不同:本摘要行的推送按钮固定显示「立即推送」,
|
|
3553
|
+
// 两边都空时那次推送即初始化推送;自动同步卡在 initMode 会把按钮切成「初始化推送」。
|
|
3554
|
+
// 两处场景不同,各自指引与旁边按钮标签一致,保留原口径。
|
|
3549
3555
|
title: canPull ? '' : M('云端还是空的:没有内容可拉,先「立即推送」', 'The cloud is still empty — nothing to pull, push first'),
|
|
3550
3556
|
onClick: () => actNow('pull-now'),
|
|
3551
3557
|
}, actBusy === 'pull-now' ? M('排队中…', 'Queueing…') : M('立即拉取(会关闭 DSH)', 'Pull now (closes DSH)')),
|
|
@@ -3639,7 +3645,7 @@ window.__ModuleLoader__.load({
|
|
|
3639
3645
|
method: 'POST',
|
|
3640
3646
|
cache: 'no-store',
|
|
3641
3647
|
credentials: 'same-origin',
|
|
3642
|
-
headers: jsonHeaders,
|
|
3648
|
+
headers: jsonHeaders(),
|
|
3643
3649
|
body: JSON.stringify({ action: 'busy', sessionId: sessionId || '' }),
|
|
3644
3650
|
})
|
|
3645
3651
|
if (!res.ok) return false
|