dsh-profile-config-sync 0.4.1 → 0.6.40
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/LICENSE +2 -1
- package/README.en.md +167 -738
- package/README.md +238 -571
- package/client.js +721 -269
- package/cordis.patch.yml +1 -1
- package/docs/CHANGELOG.en.md +28 -0
- package/docs/CHANGELOG.md +80 -0
- package/docs/HISTORY.en.md +221 -0
- package/docs/HISTORY.md +252 -0
- package/docs/MULTI-PLATFORM.md +165 -0
- package/docs/REFERENCE.md +172 -0
- package/index.js +1247 -190
- package/package.json +11 -5
- package/runtime/apply.ps1 +79 -33
- package/runtime/atomic-write.mjs +57 -0
- package/runtime/capture.ps1 +188 -37
- package/runtime/contract.mjs +59 -7
- package/runtime/dsh-sync-common.ps1 +361 -22
- package/runtime/install-plugin.ps1 +94 -3
- package/runtime/live-log.mjs +75 -0
- package/runtime/platform.mjs +35 -0
- package/runtime/post-exit.ps1 +201 -28
- package/runtime/restore.ps1 +76 -8
- package/runtime/sync-engine.mjs +1324 -857
- package/runtime/sync.ps1 +192 -82
- package/runtime/tools/fix-session-cwd.mjs +12 -3
- package/runtime/tools/workspace-view.mjs +7 -3
- package/runtime/webdav.mjs +269 -23
package/client.js
CHANGED
|
@@ -172,7 +172,16 @@ window.__ModuleLoader__.load({
|
|
|
172
172
|
kvRow: { display: 'flex', gap: '10px', fontSize: '12px', lineHeight: '18px', alignItems: 'flex-start', padding: '2px 0' },
|
|
173
173
|
kvKey: { minWidth: '100px', width: '100px', flexShrink: 0, color: 'var(--dsw-alias-label-tertiary)' },
|
|
174
174
|
kvVal: { flex: 1, minWidth: 0, color: 'var(--dsw-alias-label-secondary)', overflowWrap: 'break-word' },
|
|
175
|
-
advice: { fontSize: '12px', lineHeight: '
|
|
175
|
+
advice: { fontSize: '12px', lineHeight: '20px', color: 'var(--dsw-alias-label-secondary)', margin: 0, paddingLeft: '18px', display: 'flex', flexDirection: 'column', gap: '4px' },
|
|
176
|
+
anchorBtn: {
|
|
177
|
+
display: 'inline-flex', alignItems: 'center', gap: '3px',
|
|
178
|
+
marginLeft: '8px', padding: '1px 9px', borderRadius: '999px',
|
|
179
|
+
fontSize: '11.5px', lineHeight: '18px', fontWeight: 600,
|
|
180
|
+
border: '1px solid var(--dsw-alias-toast-action)',
|
|
181
|
+
background: 'color-mix(in srgb, var(--dsw-alias-toast-action) 10%, transparent)',
|
|
182
|
+
color: 'var(--dsw-alias-toast-action)', cursor: 'pointer',
|
|
183
|
+
verticalAlign: 'baseline', textDecoration: 'none',
|
|
184
|
+
},
|
|
176
185
|
actions: { display: 'flex', gap: '8px', flexWrap: 'wrap', alignItems: 'center' },
|
|
177
186
|
hint: { fontSize: '12px', lineHeight: '19px', color: 'var(--dsw-alias-label-tertiary)', wordBreak: 'break-all' },
|
|
178
187
|
code: {
|
|
@@ -227,7 +236,10 @@ window.__ModuleLoader__.load({
|
|
|
227
236
|
hint ? h('span', { style: { ...S.sectionHint, opacity: 0.75 } }, `· `) : null,
|
|
228
237
|
hint ? h('div', { style: S.sectionHint }, hint) : null,
|
|
229
238
|
),
|
|
230
|
-
|
|
239
|
+
// 用展开而不是把数组直接当 children:数组 children 会被 React 当成列表,
|
|
240
|
+
// 要求每一项都有 key(原来每区都在刷 "Each child in a list should have a unique key",
|
|
241
|
+
// 且报错位置指到 ConfigSyncPanel,很难对上号)。逐项展开就没有这个要求。
|
|
242
|
+
h('div', { style: S.grid }, ...list),
|
|
231
243
|
)
|
|
232
244
|
}
|
|
233
245
|
|
|
@@ -272,7 +284,20 @@ window.__ModuleLoader__.load({
|
|
|
272
284
|
if (repo.ahead > 0) return { kind: 'warn', text: M(`本机有 ${repo.ahead} 个提交还没推送`, `${repo.ahead} local commit(s) not pushed yet`) }
|
|
273
285
|
// git 干净不代表没东西要推:新会话/新资料还躺在 ~\.dsh 里,没 capture 之前仓库是完全干净的
|
|
274
286
|
const local = data.local || {}
|
|
275
|
-
|
|
287
|
+
// 三件不能混成一件事的:从没同步过 / 扫描没跑完 / 真的没有
|
|
288
|
+
if (local.known === false) return { kind: 'idle', text: M('还没有同步记录:先推送或拉取一次', 'No sync record yet — push or pull once') }
|
|
289
|
+
if (local.truncated) return { kind: 'warn', text: M('待推送扫描没跑完(文件太多或超时),数字可能偏小', 'Pending scan did not finish (too many files or timeout) — the count may be low') }
|
|
290
|
+
// 非 Windows:执行体只抓 profile / 提示 / Skills / 预设,别让「没有待推送」被读成「全都同步了」
|
|
291
|
+
if (Array.isArray(local.engineGroups) && local.pending === 0) {
|
|
292
|
+
return {
|
|
293
|
+
kind: 'idle',
|
|
294
|
+
text: M(
|
|
295
|
+
`已同步(这台机器走跨平台引擎,只处理 ${local.engineGroups.join(' / ')};会话记录、插件数据、额外路径等组要 Windows 版才会同步)`,
|
|
296
|
+
`Up to date (this machine uses the cross-platform engine, which only handles ${local.engineGroups.join(' / ')}; conversations, plugin data and extra paths sync on Windows)`,
|
|
297
|
+
),
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (local.pending > 0) {
|
|
276
301
|
return {
|
|
277
302
|
kind: 'warn',
|
|
278
303
|
text: M(
|
|
@@ -337,15 +362,15 @@ window.__ModuleLoader__.load({
|
|
|
337
362
|
throw new Error(M(`${reason}(已自动重试 3 次)`, `${reason} (retried 3 times)`))
|
|
338
363
|
}
|
|
339
364
|
|
|
340
|
-
/** 每个 POST
|
|
341
|
-
const jsonHeaders = { 'content-type': 'application/json', ...langHeaders() }
|
|
365
|
+
/** 每个 POST 都现读 accept-language:用户切语言后不必重载模块,宿主错误信息也跟着走。 */
|
|
366
|
+
const jsonHeaders = () => ({ 'content-type': 'application/json', ...langHeaders() })
|
|
342
367
|
|
|
343
368
|
async function callPrepare(action, message, backupDir) {
|
|
344
369
|
const res = await fetch('/config-sync/prepare', {
|
|
345
370
|
method: 'POST',
|
|
346
371
|
cache: 'no-store',
|
|
347
372
|
credentials: 'same-origin',
|
|
348
|
-
headers: jsonHeaders,
|
|
373
|
+
headers: jsonHeaders(),
|
|
349
374
|
body: JSON.stringify({ action, message: message || '', backupDir: backupDir || '' }),
|
|
350
375
|
})
|
|
351
376
|
const text = await res.text()
|
|
@@ -360,7 +385,7 @@ window.__ModuleLoader__.load({
|
|
|
360
385
|
method: 'POST',
|
|
361
386
|
cache: 'no-store',
|
|
362
387
|
credentials: 'same-origin',
|
|
363
|
-
headers: jsonHeaders,
|
|
388
|
+
headers: jsonHeaders(),
|
|
364
389
|
body: JSON.stringify(payload),
|
|
365
390
|
})
|
|
366
391
|
const text = await res.text()
|
|
@@ -370,13 +395,13 @@ window.__ModuleLoader__.load({
|
|
|
370
395
|
return body
|
|
371
396
|
}
|
|
372
397
|
|
|
373
|
-
/** 自动同步接口:check / pull-now / push-now / cancel。 */
|
|
398
|
+
/** 自动同步接口:check / pull-now / push-now / push-live / cancel。 */
|
|
374
399
|
async function callAuto(payload) {
|
|
375
400
|
const res = await fetch('/config-sync/auto', {
|
|
376
401
|
method: 'POST',
|
|
377
402
|
cache: 'no-store',
|
|
378
403
|
credentials: 'same-origin',
|
|
379
|
-
headers: jsonHeaders,
|
|
404
|
+
headers: jsonHeaders(),
|
|
380
405
|
body: JSON.stringify(payload),
|
|
381
406
|
})
|
|
382
407
|
const text = await res.text()
|
|
@@ -396,7 +421,7 @@ window.__ModuleLoader__.load({
|
|
|
396
421
|
method: 'POST',
|
|
397
422
|
cache: 'no-store',
|
|
398
423
|
credentials: 'same-origin',
|
|
399
|
-
headers: jsonHeaders,
|
|
424
|
+
headers: jsonHeaders(),
|
|
400
425
|
body: JSON.stringify(payload),
|
|
401
426
|
}
|
|
402
427
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -417,7 +442,7 @@ window.__ModuleLoader__.load({
|
|
|
417
442
|
method: 'POST',
|
|
418
443
|
cache: 'no-store',
|
|
419
444
|
credentials: 'same-origin',
|
|
420
|
-
headers: jsonHeaders,
|
|
445
|
+
headers: jsonHeaders(),
|
|
421
446
|
body: JSON.stringify(payload),
|
|
422
447
|
}
|
|
423
448
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -438,7 +463,7 @@ window.__ModuleLoader__.load({
|
|
|
438
463
|
method: 'POST',
|
|
439
464
|
cache: 'no-store',
|
|
440
465
|
credentials: 'same-origin',
|
|
441
|
-
headers: jsonHeaders,
|
|
466
|
+
headers: jsonHeaders(),
|
|
442
467
|
body: JSON.stringify(payload),
|
|
443
468
|
}
|
|
444
469
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -456,7 +481,7 @@ window.__ModuleLoader__.load({
|
|
|
456
481
|
method: 'POST',
|
|
457
482
|
cache: 'no-store',
|
|
458
483
|
credentials: 'same-origin',
|
|
459
|
-
headers: jsonHeaders,
|
|
484
|
+
headers: jsonHeaders(),
|
|
460
485
|
body: JSON.stringify(payload),
|
|
461
486
|
}
|
|
462
487
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -474,7 +499,7 @@ window.__ModuleLoader__.load({
|
|
|
474
499
|
method: 'POST',
|
|
475
500
|
cache: 'no-store',
|
|
476
501
|
credentials: 'same-origin',
|
|
477
|
-
headers: jsonHeaders,
|
|
502
|
+
headers: jsonHeaders(),
|
|
478
503
|
body: JSON.stringify(payload),
|
|
479
504
|
}
|
|
480
505
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -493,7 +518,7 @@ window.__ModuleLoader__.load({
|
|
|
493
518
|
method,
|
|
494
519
|
cache: 'no-store',
|
|
495
520
|
credentials: 'same-origin',
|
|
496
|
-
headers: payload ? jsonHeaders : langHeaders(),
|
|
521
|
+
headers: payload ? jsonHeaders() : langHeaders(),
|
|
497
522
|
body: payload ? JSON.stringify(payload) : undefined,
|
|
498
523
|
})
|
|
499
524
|
const text = await res.text()
|
|
@@ -515,7 +540,7 @@ window.__ModuleLoader__.load({
|
|
|
515
540
|
method: 'POST',
|
|
516
541
|
cache: 'no-store',
|
|
517
542
|
credentials: 'same-origin',
|
|
518
|
-
headers: jsonHeaders,
|
|
543
|
+
headers: jsonHeaders(),
|
|
519
544
|
body: JSON.stringify(payload),
|
|
520
545
|
}
|
|
521
546
|
: { cache: 'no-store', credentials: 'same-origin', headers: langHeaders() })
|
|
@@ -532,18 +557,21 @@ window.__ModuleLoader__.load({
|
|
|
532
557
|
const [busy, setBusy] = react.useState(false)
|
|
533
558
|
const [made, setMade] = react.useState(null)
|
|
534
559
|
|
|
535
|
-
const refresh = react.useCallback(async (
|
|
536
|
-
|
|
537
|
-
|
|
560
|
+
const refresh = react.useCallback(async (doneOrOpts, maybeOpts) => {
|
|
561
|
+
const done = typeof doneOrOpts === 'function' ? doneOrOpts : null
|
|
562
|
+
const opts = (typeof doneOrOpts === 'object' && doneOrOpts) ? doneOrOpts : (maybeOpts || {})
|
|
563
|
+
const silent = Boolean(opts && opts.silent)
|
|
564
|
+
if (!silent) setBusy(true)
|
|
565
|
+
if (!silent) setErr('')
|
|
538
566
|
try {
|
|
539
567
|
const d = await callStatus()
|
|
540
568
|
setData(d)
|
|
541
|
-
if (
|
|
569
|
+
if (done) done(null, d)
|
|
542
570
|
} catch (e) {
|
|
543
571
|
const msg = String((e && e.message) || e)
|
|
544
|
-
setErr(msg)
|
|
545
|
-
if (
|
|
546
|
-
} finally { setBusy(false) }
|
|
572
|
+
if (!silent) setErr(msg)
|
|
573
|
+
if (done) done(msg, null)
|
|
574
|
+
} finally { if (!silent) setBusy(false) }
|
|
547
575
|
}, [])
|
|
548
576
|
|
|
549
577
|
react.useEffect(() => {
|
|
@@ -669,7 +697,7 @@ window.__ModuleLoader__.load({
|
|
|
669
697
|
return (async () => {
|
|
670
698
|
const res = await fetch('/config-sync/webdav', {
|
|
671
699
|
method: payload ? 'POST' : 'GET',
|
|
672
|
-
headers: payload ? jsonHeaders : langHeaders(),
|
|
700
|
+
headers: payload ? jsonHeaders() : langHeaders(),
|
|
673
701
|
body: payload ? JSON.stringify(payload) : undefined,
|
|
674
702
|
})
|
|
675
703
|
const text = await res.text()
|
|
@@ -680,40 +708,118 @@ window.__ModuleLoader__.load({
|
|
|
680
708
|
})()
|
|
681
709
|
}
|
|
682
710
|
|
|
683
|
-
|
|
684
|
-
|
|
711
|
+
/**
|
|
712
|
+
* 云端仓库与同步方式卡(合并原「云端仓库」与「同步方式(WebDAV)」):
|
|
713
|
+
* - 先选同步模式:Git 仓库 / WebDAV / 自动(优先 WebDAV)
|
|
714
|
+
* - 按所选模式展开对应字段与操作,避免用 WebDAV 时还一直提示“先填 Git 远端地址”
|
|
715
|
+
*/
|
|
716
|
+
function CloudTargetCard(props) {
|
|
717
|
+
const remote = (props.data && props.data.remote) || {}
|
|
718
|
+
const wdStatus = (props.data && props.data.webdav) || {}
|
|
719
|
+
const [wdFetched, setWdFetched] = react.useState(null)
|
|
720
|
+
const st = wdFetched || wdStatus
|
|
721
|
+
const currentMode = st.mode || wdStatus.mode || 'git'
|
|
722
|
+
const currentWdUrl = st.url || ''
|
|
723
|
+
const currentWdUser = st.user || ''
|
|
724
|
+
const currentWdDir = st.dir || ''
|
|
725
|
+
const currentGitUrl = remote.url || ''
|
|
726
|
+
const currentGitKey = remote.sshKey || ''
|
|
727
|
+
|
|
685
728
|
const [editing, setEditing] = react.useState(false)
|
|
686
|
-
const [
|
|
687
|
-
const [
|
|
688
|
-
const [
|
|
689
|
-
const [
|
|
690
|
-
const [
|
|
729
|
+
const [mode, setMode] = react.useState(currentMode)
|
|
730
|
+
const [wdUrl, setWdUrl] = react.useState(currentWdUrl)
|
|
731
|
+
const [wdUser, setWdUser] = react.useState(currentWdUser)
|
|
732
|
+
const [wdPass, setWdPass] = react.useState('')
|
|
733
|
+
const [wdDir, setWdDir] = react.useState(currentWdDir)
|
|
734
|
+
const [gitUrl, setGitUrl] = react.useState(currentGitUrl)
|
|
735
|
+
const [gitKey, setGitKey] = react.useState(currentGitKey)
|
|
691
736
|
const [busy, setBusy] = react.useState(false)
|
|
692
737
|
const [err, setErr] = react.useState('')
|
|
693
738
|
const [msg, setMsg] = react.useState('')
|
|
694
739
|
|
|
695
|
-
const
|
|
740
|
+
const loadWebdav = react.useCallback(async () => {
|
|
696
741
|
try {
|
|
697
742
|
const r = await callWebdav()
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
setPass('')
|
|
701
|
-
} catch (e) { setErr(String((e && e.message) || e)) }
|
|
743
|
+
setWdFetched(r)
|
|
744
|
+
} catch { /* status 已带基础字段;不打断页面 */ }
|
|
702
745
|
}, [])
|
|
703
|
-
react.useEffect(() => {
|
|
746
|
+
react.useEffect(() => { loadWebdav() }, [])
|
|
747
|
+
|
|
748
|
+
react.useEffect(() => {
|
|
749
|
+
if (editing) return
|
|
750
|
+
setMode(currentMode)
|
|
751
|
+
setWdUrl(currentWdUrl)
|
|
752
|
+
setWdUser(currentWdUser)
|
|
753
|
+
setWdDir(currentWdDir)
|
|
754
|
+
setWdPass('')
|
|
755
|
+
setGitUrl(currentGitUrl)
|
|
756
|
+
setGitKey(currentGitKey)
|
|
757
|
+
}, [editing, currentMode, currentWdUrl, currentWdUser, currentWdDir, currentGitUrl, currentGitKey])
|
|
758
|
+
|
|
759
|
+
const activeMode = editing ? mode : currentMode
|
|
760
|
+
const wdConfigured = Boolean(st.configured || st.url)
|
|
761
|
+
const gitConfigured = Boolean(remote.configured || remote.url)
|
|
762
|
+
const missing = Boolean(props.data) && (
|
|
763
|
+
activeMode === 'webdav' ? !wdConfigured
|
|
764
|
+
: (activeMode === 'git' ? !gitConfigured : (!wdConfigured && !gitConfigured))
|
|
765
|
+
)
|
|
766
|
+
const isEditing = editing || (!wdConfigured && !gitConfigured && Boolean(props.data))
|
|
767
|
+
|
|
768
|
+
const sourceLabel = (s) => s === 'settings' ? M('本机设置', 'Machine settings')
|
|
769
|
+
: (s === 'git' ? M('git 配置', 'git config')
|
|
770
|
+
: (s === 'default' ? M('自动探测', 'Auto-detected') : M('未配置', 'Not set')))
|
|
771
|
+
|
|
772
|
+
const startEdit = () => {
|
|
773
|
+
setMode(currentMode)
|
|
774
|
+
setWdUrl(currentWdUrl)
|
|
775
|
+
setWdUser(currentWdUser)
|
|
776
|
+
setWdDir(currentWdDir)
|
|
777
|
+
setWdPass('')
|
|
778
|
+
setGitUrl(currentGitUrl)
|
|
779
|
+
setGitKey(currentGitKey)
|
|
780
|
+
setErr(''); setMsg(''); setEditing(true)
|
|
781
|
+
}
|
|
782
|
+
const cancelEdit = () => {
|
|
783
|
+
setMode(currentMode)
|
|
784
|
+
setWdUrl(currentWdUrl)
|
|
785
|
+
setWdUser(currentWdUser)
|
|
786
|
+
setWdDir(currentWdDir)
|
|
787
|
+
setWdPass('')
|
|
788
|
+
setGitUrl(currentGitUrl)
|
|
789
|
+
setGitKey(currentGitKey)
|
|
790
|
+
setEditing(false); setErr(''); setMsg('')
|
|
791
|
+
}
|
|
704
792
|
|
|
705
793
|
const save = async () => {
|
|
706
794
|
setBusy(true); setErr(''); setMsg('')
|
|
707
795
|
try {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
796
|
+
if (mode === 'webdav' && !wdUrl.trim()) {
|
|
797
|
+
throw new Error(M('请填写 WebDAV 地址', 'Enter a WebDAV URL'))
|
|
798
|
+
}
|
|
799
|
+
if (mode === 'git' && !gitUrl.trim()) {
|
|
800
|
+
throw new Error(M('请填写 Git 远端地址', 'Enter a Git remote URL'))
|
|
801
|
+
}
|
|
802
|
+
if (mode === 'auto' && !wdUrl.trim() && !gitUrl.trim()) {
|
|
803
|
+
throw new Error(M('自动模式下请至少填写 WebDAV 地址或 Git 远端地址', 'In Auto mode, provide at least a WebDAV URL or a Git remote URL'))
|
|
804
|
+
}
|
|
805
|
+
await callWebdav({ action: 'save', url: wdUrl, user: wdUser, dir: wdDir, mode, pass: wdPass })
|
|
806
|
+
let gitSet = false
|
|
807
|
+
const gitDirty = gitUrl.trim() !== currentGitUrl.trim() || gitKey.trim() !== currentGitKey.trim()
|
|
808
|
+
if (gitDirty && (gitUrl.trim() || currentGitUrl.trim() || gitKey.trim() || currentGitKey.trim())) {
|
|
809
|
+
const r = await callSettings({ remoteUrl: gitUrl, sshKey: gitKey })
|
|
810
|
+
gitSet = Boolean(r && r.gitRemoteSet)
|
|
811
|
+
}
|
|
812
|
+
setEditing(false); setWdPass('')
|
|
813
|
+
setMsg(M(
|
|
814
|
+
`已保存${gitSet ? ',并已更新本机 git origin' : ''}`,
|
|
815
|
+
`Saved${gitSet ? ' and updated local git origin' : ''}`,
|
|
816
|
+
))
|
|
817
|
+
await loadWebdav()
|
|
713
818
|
if (typeof props.onSaved === 'function') props.onSaved()
|
|
714
819
|
} catch (e) { setErr(String((e && e.message) || e)) } finally { setBusy(false) }
|
|
715
820
|
}
|
|
716
|
-
|
|
821
|
+
|
|
822
|
+
const runWebdav = async (action) => {
|
|
717
823
|
setBusy(true); setErr(''); setMsg('')
|
|
718
824
|
try {
|
|
719
825
|
const r = await callWebdav({ action })
|
|
@@ -729,7 +835,7 @@ window.__ModuleLoader__.load({
|
|
|
729
835
|
|
|
730
836
|
const field = (label, value, onCh, ph, type) => h('div', { style: S.kvRow },
|
|
731
837
|
h('div', { style: S.kvKey }, label),
|
|
732
|
-
|
|
838
|
+
isEditing
|
|
733
839
|
? h('input', {
|
|
734
840
|
type: type || 'text', style: S.input, value, placeholder: ph, spellCheck: false,
|
|
735
841
|
onChange: (e) => onCh(e.target.value),
|
|
@@ -738,70 +844,162 @@ window.__ModuleLoader__.load({
|
|
|
738
844
|
value || M('(未设置)', '(not set)')),
|
|
739
845
|
)
|
|
740
846
|
|
|
847
|
+
const modeText = currentMode === 'webdav'
|
|
848
|
+
? M('WebDAV', 'WebDAV')
|
|
849
|
+
: (currentMode === 'auto'
|
|
850
|
+
? (wdStatus.active ? M('自动(当前走 WebDAV)', 'Auto (using WebDAV)') : M('自动(当前走 Git)', 'Auto (using Git)'))
|
|
851
|
+
: M('Git 仓库', 'Git repo'))
|
|
852
|
+
const showWebdav = activeMode === 'webdav' || activeMode === 'auto'
|
|
853
|
+
const showGit = activeMode === 'git' || activeMode === 'auto'
|
|
854
|
+
|
|
741
855
|
return h('div', { style: S.card },
|
|
742
856
|
h('div', { style: S.cardHead },
|
|
743
|
-
h('div', { style: S.cardTitle }, M('
|
|
744
|
-
|
|
857
|
+
h('div', { style: S.cardTitle }, M('云端仓库与同步方式', 'Cloud repo & transport')),
|
|
858
|
+
isEditing && missing
|
|
859
|
+
? h('div', { style: { ...S.hint, flex: 1 } }, M('先选择并填好云端目标才能生成推送/拉取', 'Configure the cloud target to enable push/pull'))
|
|
860
|
+
: null,
|
|
861
|
+
isEditing
|
|
745
862
|
? h('div', { style: S.actions },
|
|
746
|
-
h('button', { type: 'button', style: S.btnPrimary, disabled: busy
|
|
747
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick:
|
|
863
|
+
h('button', { type: 'button', style: S.btnPrimary, disabled: busy, onClick: save }, busy ? M('保存中…', 'Saving…') : M('保存', 'Save')),
|
|
864
|
+
(!wdConfigured && !gitConfigured) ? null : h('button', { type: 'button', style: S.btn, disabled: busy, onClick: cancelEdit }, M('取消', 'Cancel')),
|
|
748
865
|
)
|
|
749
866
|
: h('div', { style: S.actions },
|
|
750
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick:
|
|
867
|
+
h('button', { type: 'button', style: S.btn, disabled: busy || !props.data, onClick: startEdit }, M('修改', 'Edit')),
|
|
751
868
|
),
|
|
752
869
|
),
|
|
753
|
-
|
|
754
|
-
setMode, ''),
|
|
755
|
-
editing
|
|
870
|
+
isEditing
|
|
756
871
|
? h('div', { style: S.kvRow },
|
|
757
|
-
h('div', { style: S.kvKey }, M('
|
|
872
|
+
h('div', { style: S.kvKey }, M('同步模式', 'Mode')),
|
|
758
873
|
h('select', {
|
|
759
874
|
style: S.input, value: mode,
|
|
760
875
|
onChange: (e) => setMode(e.target.value),
|
|
761
876
|
},
|
|
762
|
-
h('option', { value: 'git' }, M('
|
|
877
|
+
h('option', { value: 'git' }, M('Git 仓库(默认)', 'Git repo (default)')),
|
|
763
878
|
h('option', { value: 'webdav' }, M('WebDAV', 'WebDAV')),
|
|
764
|
-
h('option', { value: 'auto' }, M('
|
|
879
|
+
h('option', { value: 'auto' }, M('自动(配了 WebDAV 就用,否则用 Git)', 'Auto (WebDAV when set, else Git)')),
|
|
765
880
|
))
|
|
881
|
+
: h(Kv, { k: M('同步模式', 'Mode'), v: modeText }),
|
|
882
|
+
showWebdav
|
|
883
|
+
? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', paddingTop: activeMode === 'auto' ? '6px' : '0px', borderTop: activeMode === 'auto' ? '1px solid var(--dsw-alias-border-l1)' : 'none' } },
|
|
884
|
+
activeMode === 'auto' ? h('div', { style: { ...S.hint, fontWeight: 600 } }, M('WebDAV(优先)', 'WebDAV (primary)')) : null,
|
|
885
|
+
field(M('WebDAV 地址', 'WebDAV URL'), isEditing ? wdUrl : currentWdUrl, setWdUrl, 'https://dav.example.com/remote.php/dav/files/me'),
|
|
886
|
+
field(M('用户名', 'Username'), isEditing ? wdUser : currentWdUser, setWdUser, ''),
|
|
887
|
+
isEditing
|
|
888
|
+
? h('div', { style: S.kvRow },
|
|
889
|
+
h('div', { style: S.kvKey }, M('密码', 'Password')),
|
|
890
|
+
h('input', {
|
|
891
|
+
type: 'password', style: S.input, value: wdPass,
|
|
892
|
+
placeholder: st.hasPassword ? M('已设置,留空表示不改', 'Set; leave blank to keep') : '',
|
|
893
|
+
spellCheck: false,
|
|
894
|
+
onChange: (e) => setWdPass(e.target.value),
|
|
895
|
+
}))
|
|
896
|
+
: h(Kv, {
|
|
897
|
+
k: M('密码', 'Password'),
|
|
898
|
+
v: st.hasPassword ? M('已设置(不回显)', 'set (not shown)') : M('未设置', 'not set'),
|
|
899
|
+
}),
|
|
900
|
+
field(M('远端目录', 'Remote dir'), isEditing ? wdDir : currentWdDir, setWdDir, 'dsh-config-sync'),
|
|
901
|
+
h(Kv, {
|
|
902
|
+
k: M('传输安全', 'Transport'),
|
|
903
|
+
v: (st.secure === false)
|
|
904
|
+
? M('http 明文(有密码泄露风险)', 'http (credentials in clear text)')
|
|
905
|
+
: M('https', 'https'),
|
|
906
|
+
}),
|
|
907
|
+
h('div', { style: S.actions },
|
|
908
|
+
h('button', { type: 'button', style: S.btn, disabled: busy || isEditing || !wdConfigured, onClick: () => runWebdav('test') }, M('测试连接', 'Test')),
|
|
909
|
+
h('button', { type: 'button', style: S.btn, disabled: busy || isEditing || !wdConfigured, onClick: () => runWebdav('upload') }, M('立即上传', 'Upload now')),
|
|
910
|
+
h('button', { type: 'button', style: S.btn, disabled: busy || isEditing || !wdConfigured, onClick: () => runWebdav('download') }, M('立即下载', 'Download now')),
|
|
911
|
+
),
|
|
912
|
+
h('div', { style: S.footnote }, M(
|
|
913
|
+
'WebDAV 与 git 共用同一份仓库格式,只换传输层:上传不删云端多余文件(开启「同步内容 → 删除云端副本」时除外),下载不删本机多余文件;两边都有且不同时本机那份留底为 .conflict-<时间>。',
|
|
914
|
+
'WebDAV reuses the same repo format and only swaps the transport: upload keeps extra cloud files (unless "Also delete the cloud copy" is on in Content), download keeps extra local files; when both differ the local copy is kept as .conflict-<time>.',
|
|
915
|
+
)),
|
|
916
|
+
)
|
|
917
|
+
: null,
|
|
918
|
+
showGit
|
|
919
|
+
? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', paddingTop: activeMode === 'auto' ? '6px' : '0px', borderTop: activeMode === 'auto' ? '1px solid var(--dsw-alias-border-l1)' : 'none' } },
|
|
920
|
+
activeMode === 'auto' ? h('div', { style: { ...S.hint, fontWeight: 600 } }, M('Git 仓库(WebDAV 未配时备用)', 'Git repo (fallback)')) : null,
|
|
921
|
+
field(M('远端地址', 'Remote URL'), isEditing ? gitUrl : currentGitUrl, setGitUrl, 'git@<host>:you/dsh-config.git'),
|
|
922
|
+
field(M('SSH 私钥', 'SSH key'), isEditing ? gitKey : currentGitKey, setGitKey, M('C:\\Users\\你\\.ssh\\id_ed25519', 'C:\\Users\\you\\.ssh\\id_ed25519')),
|
|
923
|
+
h(Kv, {
|
|
924
|
+
k: M('私钥来源', 'Key source'),
|
|
925
|
+
v: `${sourceLabel(remote.sshKeyFrom)}${remote.sshKeyExists ? '' : M('(文件不存在)', ' (file missing)')}`,
|
|
926
|
+
}),
|
|
927
|
+
h(Kv, { k: M('地址来源', 'URL source'), v: sourceLabel(remote.urlSource) }),
|
|
928
|
+
h(Kv, { k: M('设置文件', 'Settings file'), v: remote.settingsPath || M('(未知)', '(unknown)') }),
|
|
929
|
+
h('div', { style: S.footnote }, M(
|
|
930
|
+
'远端地址支持任意 git 托管平台(Gitee / GitHub / GitLab / 自建 Gitea):'
|
|
931
|
+
+ 'git@host:owner/repo.git、ssh://、https:// 三种写法都行;'
|
|
932
|
+
+ '例:git@gitee.com:you/dsh-config.git、git@github.com:you/dsh-config.git、https://gitlab.com/you/dsh-config.git。'
|
|
933
|
+
+ 'SSH 地址用私钥/ssh config 走认证,https 地址用 Git 凭据管理器里的账号或令牌。',
|
|
934
|
+
'Any git host works (Gitee / GitHub / GitLab / self-hosted Gitea): '
|
|
935
|
+
+ 'git@host:owner/repo.git, ssh:// and https:// are all accepted; '
|
|
936
|
+
+ 'e.g. git@gitee.com:you/dsh-config.git, git@github.com:you/dsh-config.git, https://gitlab.com/you/dsh-config.git. '
|
|
937
|
+
+ 'SSH URLs authenticate with the key or ssh config; https URLs use the account or token in Git Credential Manager.',
|
|
938
|
+
)),
|
|
939
|
+
h('div', { style: S.footnote }, M(
|
|
940
|
+
'只存私钥路径不存内容;保存远端地址会同步更新本机 git origin,git 失败则整套回滚。',
|
|
941
|
+
'Only the key path is stored; saving also updates the local git origin, rolling everything back if git fails.',
|
|
942
|
+
)),
|
|
943
|
+
)
|
|
766
944
|
: null,
|
|
767
|
-
field(M('WebDAV 地址', 'WebDAV URL'), editing ? url : (st && st.url) || '', setUrl, 'https://dav.example.com/remote.php/dav/files/me'),
|
|
768
|
-
field(M('用户名', 'Username'), editing ? user : (st && st.user) || '', setUser, ''),
|
|
769
|
-
editing
|
|
770
|
-
? h('div', { style: S.kvRow },
|
|
771
|
-
h('div', { style: S.kvKey }, M('密码', 'Password')),
|
|
772
|
-
h('input', {
|
|
773
|
-
type: 'password', style: S.input, value: pass,
|
|
774
|
-
placeholder: (st && st.hasPassword) ? M('已设置,留空表示不改', 'Set; leave blank to keep') : '',
|
|
775
|
-
spellCheck: false,
|
|
776
|
-
onChange: (e) => setPass(e.target.value),
|
|
777
|
-
}))
|
|
778
|
-
: h(Kv, {
|
|
779
|
-
k: M('密码', 'Password'),
|
|
780
|
-
v: (st && st.hasPassword) ? M('已设置(不回显)', 'set (not shown)') : M('未设置', 'not set'),
|
|
781
|
-
}),
|
|
782
|
-
field(M('远端目录', 'Remote dir'), editing ? dir : (st && st.dir) || '', setDir, 'dsh-config-sync'),
|
|
783
|
-
h(Kv, {
|
|
784
|
-
k: M('传输安全', 'Transport'),
|
|
785
|
-
v: (st && st.secure === false)
|
|
786
|
-
? M('http 明文(有密码泄露风险)', 'http (credentials in clear text)')
|
|
787
|
-
: M('https', 'https'),
|
|
788
|
-
}),
|
|
789
|
-
h('div', { style: S.actions },
|
|
790
|
-
h('button', { type: 'button', style: S.btn, disabled: busy || !(st && st.configured), onClick: () => run('test') }, M('测试连接', 'Test')),
|
|
791
|
-
h('button', { type: 'button', style: S.btn, disabled: busy || !(st && st.configured), onClick: () => run('upload') }, M('立即上传', 'Upload now')),
|
|
792
|
-
h('button', { type: 'button', style: S.btn, disabled: busy || !(st && st.configured), onClick: () => run('download') }, M('立即下载', 'Download now')),
|
|
793
|
-
),
|
|
794
|
-
h('div', { style: S.footnote }, M(
|
|
795
|
-
'WebDAV 与 git 共用同一份仓库格式,只换传输层:上传不删云端多余文件,下载不删本机多余文件;两边都有且不同时本机那份留底为 .conflict-<时间>。',
|
|
796
|
-
'WebDAV reuses the same repo format and only swaps the transport: upload never deletes extra cloud files, download never deletes extra local files; when both differ the local copy is kept as .conflict-<time>.',
|
|
797
|
-
)),
|
|
798
945
|
err ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } }, M(`失败:${err}`, `Failed: ${err}`)) : null,
|
|
799
946
|
msg ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-success-primary)' } }, msg) : null,
|
|
800
947
|
)
|
|
801
948
|
}
|
|
802
949
|
|
|
950
|
+
/** 根据待办文案与当前体检状态映射直达目标区(用于「待办」里的锚文本快捷按钮)。 */
|
|
951
|
+
function adviceTarget(text, data) {
|
|
952
|
+
const s = String(text || '')
|
|
953
|
+
const webdavOn = Boolean(data && data.webdav && data.webdav.active)
|
|
954
|
+
if (/初始化推送|Initialize push/i.test(s)) {
|
|
955
|
+
return { section: 'automation', label: M('前往初始化推送 →', 'Go to initialize push →') }
|
|
956
|
+
}
|
|
957
|
+
if (/连不上 WebDAV|Cannot reach WebDAV/i.test(s)) {
|
|
958
|
+
return { section: 'targets', label: M('检查 WebDAV →', 'Check WebDAV →') }
|
|
959
|
+
}
|
|
960
|
+
if (/连不上云端|云端仓库地址|Cloud repo is not set|Cannot reach the cloud/i.test(s)) {
|
|
961
|
+
return { section: 'targets', label: webdavOn ? M('检查 WebDAV →', 'Check WebDAV →') : M('去配置云端 →', 'Go to cloud settings →') }
|
|
962
|
+
}
|
|
963
|
+
if (/拉取|run Pull|\bPull\b/i.test(s) && !/只允许拉取|only Pull is allowed/i.test(s)) {
|
|
964
|
+
return { section: 'automation', label: M('前往立即拉取 →', 'Go to pull →') }
|
|
965
|
+
}
|
|
966
|
+
if (/只允许拉取|only Pull is allowed/i.test(s)) {
|
|
967
|
+
return { section: 'targets', label: webdavOn ? M('检查 WebDAV →', 'Check WebDAV →') : M('检查云端配置 →', 'Check cloud config →') }
|
|
968
|
+
}
|
|
969
|
+
if (/推送|run Push|\bPush\b/i.test(s)) {
|
|
970
|
+
return { section: 'automation', label: M('前往立即推送 →', 'Go to push →') }
|
|
971
|
+
}
|
|
972
|
+
if (/仓库路径|本机仓库|Repo path|repo directory is not set|Local repo|仓库目录|runnable sync script/i.test(s)) {
|
|
973
|
+
return { section: 'targets', label: M('去设置仓库 →', 'Go to repo settings →') }
|
|
974
|
+
}
|
|
975
|
+
if (/客户端根目录|client root/i.test(s)) {
|
|
976
|
+
return { section: 'roots', openRoots: true, label: M('检查本机路径 →', 'Check local paths →') }
|
|
977
|
+
}
|
|
978
|
+
if (/客户端版本|two clients differ/i.test(s)) {
|
|
979
|
+
return { section: 'platform', label: M('查看跨端契约 →', 'View contract →') }
|
|
980
|
+
}
|
|
981
|
+
if (/bundle|依赖|dependency/i.test(s)) {
|
|
982
|
+
return { section: 'actions', label: M('查看生成脚本 →', 'View scripts →') }
|
|
983
|
+
}
|
|
984
|
+
return null
|
|
985
|
+
}
|
|
986
|
+
|
|
803
987
|
function Advice(props) {
|
|
804
|
-
|
|
988
|
+
const onNav = typeof props.onNavigate === 'function' ? props.onNavigate : null
|
|
989
|
+
return h('ul', { style: S.advice }, (props.items || []).map((a, i) => {
|
|
990
|
+
const target = onNav ? adviceTarget(a, props.data) : null
|
|
991
|
+
return h('li', { key: i },
|
|
992
|
+
h('span', null, a),
|
|
993
|
+
target
|
|
994
|
+
? h('button', {
|
|
995
|
+
type: 'button',
|
|
996
|
+
style: S.anchorBtn,
|
|
997
|
+
title: M('点击直达对应操作区', 'Jump directly to this section'),
|
|
998
|
+
onClick: () => onNav(target.section, target),
|
|
999
|
+
}, target.label)
|
|
1000
|
+
: null,
|
|
1001
|
+
)
|
|
1002
|
+
}))
|
|
805
1003
|
}
|
|
806
1004
|
|
|
807
1005
|
function MadeNote(props) {
|
|
@@ -969,106 +1167,7 @@ window.__ModuleLoader__.load({
|
|
|
969
1167
|
)
|
|
970
1168
|
}
|
|
971
1169
|
|
|
972
|
-
|
|
973
|
-
* 云端仓库卡:远端地址 + SSH 私钥路径。
|
|
974
|
-
* 默认只读展示;点「修改」才变成可编辑,保存走 POST /config-sync/settings,
|
|
975
|
-
* 宿主那边会同时 git remote set-url,失败则回滚设置文件并回显错误。
|
|
976
|
-
*/
|
|
977
|
-
function RemoteCard(props) {
|
|
978
|
-
const remote = (props.data && props.data.remote) || {}
|
|
979
|
-
// 没配过云端仓库 = 强制编辑态:不给「取消」,也不许就这么放着去生成推送/拉取
|
|
980
|
-
const missing = Boolean(props.data) && !remote.configured
|
|
981
|
-
const [editing, setEditing] = react.useState(false)
|
|
982
|
-
const [url, setUrl] = react.useState(remote.url || '')
|
|
983
|
-
const [key, setKey] = react.useState(remote.sshKey || '')
|
|
984
|
-
const [busy, setBusy] = react.useState(false)
|
|
985
|
-
const [err, setErr] = react.useState('')
|
|
986
|
-
const [msg, setMsg] = react.useState('')
|
|
987
|
-
const isEditing = editing || missing
|
|
988
|
-
const sourceLabel = (s) => s === 'settings' ? M('本机设置', 'Machine settings')
|
|
989
|
-
: (s === 'git' ? M('git 配置', 'git config')
|
|
990
|
-
: (s === 'default' ? M('自动探测', 'Auto-detected') : M('未配置', 'Not set')))
|
|
991
|
-
|
|
992
|
-
const startEdit = () => {
|
|
993
|
-
setUrl(remote.url || '')
|
|
994
|
-
setKey(remote.sshKey || '')
|
|
995
|
-
setErr('')
|
|
996
|
-
setMsg('')
|
|
997
|
-
setEditing(true)
|
|
998
|
-
}
|
|
999
|
-
const cancelEdit = () => { setEditing(false); setErr(''); setMsg('') }
|
|
1000
|
-
const save = async () => {
|
|
1001
|
-
setBusy(true); setErr(''); setMsg('')
|
|
1002
|
-
try {
|
|
1003
|
-
const r = await callSettings({ remoteUrl: url, sshKey: key })
|
|
1004
|
-
setMsg(M(
|
|
1005
|
-
`已保存${r.gitRemoteSet ? ',并已更新本机 git origin' : ''}`,
|
|
1006
|
-
`Saved${r.gitRemoteSet ? ' and updated the local git origin' : ''}`,
|
|
1007
|
-
))
|
|
1008
|
-
setEditing(false)
|
|
1009
|
-
if (typeof props.onSaved === 'function') props.onSaved()
|
|
1010
|
-
} catch (e) {
|
|
1011
|
-
setErr(String((e && e.message) || e))
|
|
1012
|
-
} finally { setBusy(false) }
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
const field = (label, value, onChange, placeholder) => h('div', { style: S.kvRow },
|
|
1016
|
-
h('div', { style: S.kvKey }, label),
|
|
1017
|
-
isEditing
|
|
1018
|
-
? h('input', {
|
|
1019
|
-
type: 'text', style: S.input, value, placeholder, spellCheck: false,
|
|
1020
|
-
onChange: (e) => onChange(e.target.value),
|
|
1021
|
-
})
|
|
1022
|
-
: h('div', { style: { ...S.kvVal, fontFamily: 'Consolas, ui-monospace, monospace' } }, value || M('(未配置)', '(not set)')),
|
|
1023
|
-
)
|
|
1024
|
-
|
|
1025
|
-
return h('div', { style: S.card },
|
|
1026
|
-
h('div', { style: S.cardHead },
|
|
1027
|
-
h('div', { style: S.cardTitle }, M('云端仓库', 'Cloud repo')),
|
|
1028
|
-
isEditing && missing
|
|
1029
|
-
? h('div', { style: { ...S.hint, flex: 1 } }, M('先填远端地址才能生成推送/拉取', 'Set the remote URL to enable push/pull'))
|
|
1030
|
-
: null,
|
|
1031
|
-
isEditing
|
|
1032
|
-
? h('div', { style: S.actions },
|
|
1033
|
-
h('button', { type: 'button', style: S.btnPrimary, disabled: busy || !url.trim(), onClick: save }, busy ? M('保存中…', 'Saving…') : M('保存', 'Save')),
|
|
1034
|
-
missing ? null : h('button', { type: 'button', style: S.btn, disabled: busy, onClick: cancelEdit }, M('取消', 'Cancel')),
|
|
1035
|
-
)
|
|
1036
|
-
: h('div', { style: S.actions },
|
|
1037
|
-
h('button', { type: 'button', style: S.btn, disabled: !props.data, onClick: startEdit }, M('修改', 'Edit')),
|
|
1038
|
-
),
|
|
1039
|
-
),
|
|
1040
|
-
field(M('远端地址', 'Remote URL'), isEditing ? url : (remote.url || ''), setUrl, 'git@<host>:you/dsh-config.git'),
|
|
1041
|
-
field(M('SSH 私钥', 'SSH key'), isEditing ? key : (remote.sshKey || ''), setKey, M('C:\\Users\\你\\.ssh\\id_ed25519', 'C:\\Users\\you\\.ssh\\id_ed25519')),
|
|
1042
|
-
h(Kv, {
|
|
1043
|
-
k: M('私钥来源', 'Key source'),
|
|
1044
|
-
v: `${sourceLabel(remote.sshKeyFrom)}${remote.sshKeyExists ? '' : M('(文件不存在)', ' (file missing)')}`,
|
|
1045
|
-
}),
|
|
1046
|
-
h(Kv, { k: M('地址来源', 'URL source'), v: sourceLabel(remote.urlSource) }),
|
|
1047
|
-
h(Kv, { k: M('设置文件', 'Settings file'), v: remote.settingsPath || M('(未知)', '(unknown)') }),
|
|
1048
|
-
missing && !remote.sshKeyExists
|
|
1049
|
-
? h('div', { style: S.footnote }, M(
|
|
1050
|
-
'私钥可留空:认证交给 .ssh\\config 或 Git 默认选择;填了才写进脚本的 GIT_SSH_COMMAND。',
|
|
1051
|
-
'The key is optional — auth falls back to .ssh\\config or Git defaults; fill it only to write GIT_SSH_COMMAND into scripts.',
|
|
1052
|
-
))
|
|
1053
|
-
: null,
|
|
1054
|
-
err ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } }, M(`保存失败:${err}`, `Save failed: ${err}`)) : null,
|
|
1055
|
-
msg ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-success-primary)' } }, msg) : null,
|
|
1056
|
-
h('div', { style: S.footnote }, M(
|
|
1057
|
-
'远端地址支持任意 git 托管平台(Gitee / GitHub / GitLab / 自建 Gitea):'
|
|
1058
|
-
+ 'git@host:owner/repo.git、ssh://、https:// 三种写法都行;'
|
|
1059
|
-
+ '例:git@gitee.com:you/dsh-config.git、git@github.com:you/dsh-config.git、https://gitlab.com/you/dsh-config.git。'
|
|
1060
|
-
+ 'SSH 地址用下面的私钥/ssh config 走认证,https 地址用 Git 凭据管理器里的账号或令牌。',
|
|
1061
|
-
'Any git host works (Gitee / GitHub / GitLab / self-hosted Gitea): '
|
|
1062
|
-
+ 'git@host:owner/repo.git, ssh:// and https:// are all accepted; '
|
|
1063
|
-
+ 'e.g. git@gitee.com:you/dsh-config.git, git@github.com:you/dsh-config.git, https://gitlab.com/you/dsh-config.git. '
|
|
1064
|
-
+ 'SSH URLs authenticate with the key or ssh config below; https URLs use the account or token in Git Credential Manager.',
|
|
1065
|
-
)),
|
|
1066
|
-
h('div', { style: S.footnote }, M(
|
|
1067
|
-
'只存私钥路径不存内容;保存远端地址会同步更新本机 git origin,git 失败则整套回滚。',
|
|
1068
|
-
'Only the key path is stored; saving also updates the local git origin, rolling everything back if git fails.',
|
|
1069
|
-
)),
|
|
1070
|
-
)
|
|
1071
|
-
}
|
|
1170
|
+
// RemoteCard 已合并进 CloudTargetCard(同步方式 + 云端目标统一在一张卡里)
|
|
1072
1171
|
|
|
1073
1172
|
/**
|
|
1074
1173
|
* 「还原备份」卡:先看备份目录在哪(默认 <DshHome>\backups,可改成别的绝对路径),
|
|
@@ -1279,7 +1378,7 @@ window.__ModuleLoader__.load({
|
|
|
1279
1378
|
`动手前先整份备份当前位置到 ${pv.backupTo || 'backups\\<自动命名>'},不满意还能再退回来。`,
|
|
1280
1379
|
`The current location is copied to ${pv.backupTo || 'backups\\<auto-named>'} first, so you can undo it.`,
|
|
1281
1380
|
)),
|
|
1282
|
-
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-
|
|
1381
|
+
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary, #d97706)' } }, M(
|
|
1283
1382
|
'确认后:客户端正常退出 → 弹出进度窗口执行 → 完成后自动重启客户端。',
|
|
1284
1383
|
'After confirming: the client closes normally, a progress window runs it, then the client restarts automatically.',
|
|
1285
1384
|
)),
|
|
@@ -1297,8 +1396,8 @@ window.__ModuleLoader__.load({
|
|
|
1297
1396
|
},
|
|
1298
1397
|
h('div', { style: { ...S.cardTitle, fontSize: '13px' } }, confirmTitle),
|
|
1299
1398
|
h('div', { style: S.hint }, M(
|
|
1300
|
-
`快照时间 ${when(confirm.snap.at)}(${rel(confirm.snap.at)})· ${confirm.snap.
|
|
1301
|
-
`Snapshot ${when(confirm.snap.at)} (${rel(confirm.snap.at)}) · ${confirm.snap.
|
|
1399
|
+
`快照时间 ${when(confirm.snap.at)}(${rel(confirm.snap.at)})· ${confirm.snap.plugins || 0} 个插件 · ${confirm.snap.bundles || 0} 个 bundle`,
|
|
1400
|
+
`Snapshot ${when(confirm.snap.at)} (${rel(confirm.snap.at)}) · ${confirm.snap.plugins || 0} plugins · ${confirm.snap.bundles || 0} bundles`,
|
|
1302
1401
|
)),
|
|
1303
1402
|
listBox(
|
|
1304
1403
|
M(`将撤走 ${pvRemovePlugins.length} 个快照之后装上的插件`, `Removing ${pvRemovePlugins.length} plugin(s) installed after this snapshot`),
|
|
@@ -1320,7 +1419,7 @@ window.__ModuleLoader__.load({
|
|
|
1320
1419
|
'动手前会把当前配置整份存到 backups\\manual-<时间戳>;撤走的东西另有 rollback 清单,随时能再还原回来。',
|
|
1321
1420
|
'The current config is copied to backups\\manual-<timestamp> first, and everything removed is listed in a rollback manifest — both can be restored later.',
|
|
1322
1421
|
)),
|
|
1323
|
-
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-
|
|
1422
|
+
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary, #d97706)' } }, M(
|
|
1324
1423
|
'确认后:客户端正常退出 → 弹出进度窗口执行还原 → 完成后自动重启客户端。',
|
|
1325
1424
|
'After confirming: the client closes normally, a progress window runs the restore, then the client restarts automatically.',
|
|
1326
1425
|
)),
|
|
@@ -1343,7 +1442,7 @@ window.__ModuleLoader__.load({
|
|
|
1343
1442
|
h('div', {
|
|
1344
1443
|
style: { ...S.hint, fontFamily: 'Consolas, ui-monospace, monospace', wordBreak: 'break-all' },
|
|
1345
1444
|
}, M(`备份位置:${manual.dir}`, `Backup path: ${manual.dir}`)),
|
|
1346
|
-
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-
|
|
1445
|
+
h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary, #d97706)' } }, M(
|
|
1347
1446
|
'这份备份认不出类型,自动还原不知道该写回哪,按下面三步手动拷:',
|
|
1348
1447
|
'This backup cannot be classified, so there is no automatic target. Copy it by hand:',
|
|
1349
1448
|
)),
|
|
@@ -1448,6 +1547,8 @@ window.__ModuleLoader__.load({
|
|
|
1448
1547
|
const [busy, setBusy] = react.useState(false)
|
|
1449
1548
|
const [err, setErr] = react.useState('')
|
|
1450
1549
|
const [msg, setMsg] = react.useState('')
|
|
1550
|
+
// 「放弃清单」的二次确认态:一次点击就删掉整份清单与已做的逐项选择,太容易被误触
|
|
1551
|
+
const [armDiscard, setArmDiscard] = react.useState(false)
|
|
1451
1552
|
|
|
1452
1553
|
const load = async () => {
|
|
1453
1554
|
setBusy(true); setErr('')
|
|
@@ -1468,6 +1569,9 @@ window.__ModuleLoader__.load({
|
|
|
1468
1569
|
h('div', { style: S.hint }, err
|
|
1469
1570
|
? M(`读取失败:${err}`, `Read failed: ${err}`)
|
|
1470
1571
|
: M('正在读取冲突清单…', 'Loading conflicts…')),
|
|
1572
|
+
// 失败后没有重试入口的话,这张卡会一直钉在「读取失败」上:
|
|
1573
|
+
// 父层的「重新检测」只刷 /status,不会重拉这张卡。
|
|
1574
|
+
err ? h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('重试', 'Retry')) : null,
|
|
1471
1575
|
)
|
|
1472
1576
|
}
|
|
1473
1577
|
if (!state.exists) return null
|
|
@@ -1615,7 +1719,12 @@ window.__ModuleLoader__.load({
|
|
|
1615
1719
|
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: () => setAll('cloud') }, M('全部用云端', 'All cloud')),
|
|
1616
1720
|
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: () => setAll('local') }, M('全部用本机', 'All local')),
|
|
1617
1721
|
h('button', { type: 'button', style: S.btnPrimary, disabled: busy, onClick: save }, busy ? M('保存中…', 'Saving…') : M('保存选择', 'Save')),
|
|
1618
|
-
|
|
1722
|
+
// 两段式:点一下就删掉整份清单(连同逐项选择),和旁边「保存选择」长得很像,
|
|
1723
|
+
// 误点等于白选一遍。第一次点只进入确认态,再点才真的删。
|
|
1724
|
+
h('button', {
|
|
1725
|
+
type: 'button', style: S.btn, disabled: busy,
|
|
1726
|
+
onClick: () => { if (!armDiscard) { setArmDiscard(true); return } setArmDiscard(false); discard() },
|
|
1727
|
+
}, armDiscard ? M('确认放弃?(点此删除清单)', 'Confirm discard (click again)') : M('放弃清单', 'Discard')),
|
|
1619
1728
|
),
|
|
1620
1729
|
err ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-error-primary)' } }, M(`操作失败:${err}`, `Failed: ${err}`)) : null,
|
|
1621
1730
|
msg ? h('div', { style: { ...S.footnote, color: 'var(--dsw-alias-state-success-primary)' } }, msg) : null,
|
|
@@ -1734,7 +1843,8 @@ window.__ModuleLoader__.load({
|
|
|
1734
1843
|
if (!data || !draft) {
|
|
1735
1844
|
return h('div', { style: S.card },
|
|
1736
1845
|
h('div', { style: S.cardTitle }, M('插件数据与额外路径', 'Plugin data & extra paths')),
|
|
1737
|
-
h('div', { style: S.hint }, err ? M(`读取失败:${err}`, `Read failed: ${err}`) : M('正在读取规则…', 'Loading rules…'))
|
|
1846
|
+
h('div', { style: S.hint }, err ? M(`读取失败:${err}`, `Read failed: ${err}`) : M('正在读取规则…', 'Loading rules…')),
|
|
1847
|
+
err ? h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('重试', 'Retry')) : null)
|
|
1738
1848
|
}
|
|
1739
1849
|
|
|
1740
1850
|
const hardMB = Math.round(data.hardMaxBytes / (1024 * 1024))
|
|
@@ -1785,6 +1895,18 @@ window.__ModuleLoader__.load({
|
|
|
1785
1895
|
),
|
|
1786
1896
|
|
|
1787
1897
|
// 排除名单
|
|
1898
|
+
// 安全必需项补齐要让人看见:宿主会把 browser-profiles 这类条目补回生效名单,
|
|
1899
|
+
// 但不静默改用户的口径 —— 这里明确说「你的文件缺这几条,已按内置名单补齐」。
|
|
1900
|
+
(() => {
|
|
1901
|
+
const mm = data && data.config && data.config.pluginData && data.config.pluginData.missingMandatory
|
|
1902
|
+
if (!mm || (!(mm.skipDirs || []).length && !(mm.exclude || []).length)) return null
|
|
1903
|
+
const parts = [...(mm.skipDirs || []), ...(mm.exclude || [])].filter((v, i, a) => a.indexOf(v) === i)
|
|
1904
|
+
return h('div', { style: { ...S.footnote, marginTop: '6px', color: 'var(--dsw-alias-label-warn, #b45309)' } },
|
|
1905
|
+
M(
|
|
1906
|
+
`你的规则文件缺少安全必需项,已按内置名单补齐:${parts.join('、')}(这些是浏览器剖面/凭据库,删掉也不会同步;点保存会写回文件)`,
|
|
1907
|
+
`Your rules file was missing mandatory safety entries; they are restored: ${parts.join(', ')} (browser profiles / credential stores — never synced even if removed; saving writes them back).`,
|
|
1908
|
+
))
|
|
1909
|
+
})(),
|
|
1788
1910
|
h('div', { style: { display: 'flex', gap: '8px', alignItems: 'center', marginTop: '6px', flexWrap: 'wrap' } },
|
|
1789
1911
|
h('div', { style: { fontSize: '12px' } }, M('排除名单(通配,一行一条)', 'Exclusions (wildcards, one per line)')),
|
|
1790
1912
|
h('button', { type: 'button', style: S.btn, disabled: !editing || busy, onClick: resetExclude }, M('恢复默认', 'Restore defaults')),
|
|
@@ -1888,7 +2010,8 @@ window.__ModuleLoader__.load({
|
|
|
1888
2010
|
if (!data || !data.available) {
|
|
1889
2011
|
return h('div', { style: S.card },
|
|
1890
2012
|
h('div', { style: S.cardTitle }, M('工作区显示状态', 'Workspace visibility')),
|
|
1891
|
-
h('div', { style: S.hint }, err ? M('读取失败:' + err, 'Read failed: ' + err) : M('本机还没有工作区数据,DSH 初始化后可用。', 'No workspace data yet — available after DSH initializes.'))
|
|
2013
|
+
h('div', { style: S.hint }, err ? M('读取失败:' + err, 'Read failed: ' + err) : M('本机还没有工作区数据,DSH 初始化后可用。', 'No workspace data yet — available after DSH initializes.')),
|
|
2014
|
+
err ? h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('重试', 'Retry')) : null)
|
|
1892
2015
|
}
|
|
1893
2016
|
|
|
1894
2017
|
const wss = data.workspaces || []
|
|
@@ -1984,9 +2107,9 @@ window.__ModuleLoader__.load({
|
|
|
1984
2107
|
// 编辑态下用带词义的按钮文案(隐藏/显示,颜色区分),不再是一个孤零零的按钮。
|
|
1985
2108
|
open
|
|
1986
2109
|
? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '2px', marginTop: '6px', paddingLeft: '18px' } },
|
|
1987
|
-
(w.sessions
|
|
2110
|
+
(Array.isArray(w.sessions) ? w.sessions : []).length === 0
|
|
1988
2111
|
? h('div', { style: S.footnote }, M('这个工作区还没有会话。', 'No sessions in this workspace.'))
|
|
1989
|
-
: w.sessions.map(s => h('div', {
|
|
2112
|
+
: (Array.isArray(w.sessions) ? w.sessions : []).map(s => h('div', {
|
|
1990
2113
|
key: s.id,
|
|
1991
2114
|
style: {
|
|
1992
2115
|
display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px', lineHeight: '18px',
|
|
@@ -2096,6 +2219,7 @@ window.__ModuleLoader__.load({
|
|
|
2096
2219
|
return h('div', { style: S.card },
|
|
2097
2220
|
h('div', { style: S.cardTitle }, M('同步内容', 'Sync content')),
|
|
2098
2221
|
h('div', { style: S.hint }, err ? M(`读取失败:${err}`, `Read failed: ${err}`) : M('正在读取同步范围…', 'Loading sync scope…')),
|
|
2222
|
+
err ? h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, M('重试', 'Retry')) : null,
|
|
2099
2223
|
)
|
|
2100
2224
|
}
|
|
2101
2225
|
|
|
@@ -2143,6 +2267,7 @@ window.__ModuleLoader__.load({
|
|
|
2143
2267
|
const groupOn = g.enabled !== false
|
|
2144
2268
|
const canExpand = items.length > 0
|
|
2145
2269
|
return h('div', {
|
|
2270
|
+
key: g.id,
|
|
2146
2271
|
style: { borderTop: '1px solid var(--dsw-alias-border-l1)', paddingTop: '6px', paddingBottom: '2px' },
|
|
2147
2272
|
},
|
|
2148
2273
|
// 整行可点:点一下展开明细,再点收起(不再单独放「明细」按钮)
|
|
@@ -2188,6 +2313,7 @@ window.__ModuleLoader__.load({
|
|
|
2188
2313
|
},
|
|
2189
2314
|
},
|
|
2190
2315
|
items.map((i) => h('label', {
|
|
2316
|
+
key: i.id,
|
|
2191
2317
|
style: {
|
|
2192
2318
|
display: 'flex', gap: '8px', alignItems: 'center', fontSize: '12px',
|
|
2193
2319
|
cursor: editing ? 'pointer' : 'default', opacity: groupOn ? 1 : 0.6,
|
|
@@ -2232,6 +2358,8 @@ window.__ModuleLoader__.load({
|
|
|
2232
2358
|
const [busy, setBusy] = react.useState('')
|
|
2233
2359
|
const [err, setErr] = react.useState('')
|
|
2234
2360
|
const [msg, setMsg] = react.useState('')
|
|
2361
|
+
const [liveLocal, setLiveLocal] = react.useState(null)
|
|
2362
|
+
const [nowTick, setNowTick] = react.useState(() => Date.now())
|
|
2235
2363
|
|
|
2236
2364
|
const save = async (patch) => {
|
|
2237
2365
|
setBusy('save'); setErr(''); setMsg('')
|
|
@@ -2244,27 +2372,49 @@ window.__ModuleLoader__.load({
|
|
|
2244
2372
|
|
|
2245
2373
|
const act = async (action, extra) => {
|
|
2246
2374
|
setBusy(action); setErr(''); setMsg('')
|
|
2375
|
+
if (action === 'push-live') {
|
|
2376
|
+
setLiveLocal({
|
|
2377
|
+
running: true,
|
|
2378
|
+
startedAt: Date.now(),
|
|
2379
|
+
finishedAt: 0,
|
|
2380
|
+
ok: null,
|
|
2381
|
+
phase: 'starting',
|
|
2382
|
+
message: initMode
|
|
2383
|
+
? M('正在核对云端状态并启动初始化推送…', 'Checking cloud state and starting initialize push…')
|
|
2384
|
+
: M('正在核对云端状态并启动后台推送…', 'Checking cloud state and starting background push…'),
|
|
2385
|
+
recent: [],
|
|
2386
|
+
initPush: initMode,
|
|
2387
|
+
})
|
|
2388
|
+
}
|
|
2247
2389
|
try {
|
|
2248
2390
|
const res = await fetch('/config-sync/auto', {
|
|
2249
2391
|
method: 'POST', cache: 'no-store', credentials: 'same-origin',
|
|
2250
|
-
headers: jsonHeaders,
|
|
2392
|
+
headers: jsonHeaders(),
|
|
2251
2393
|
body: JSON.stringify({ action, ...(extra || {}) }),
|
|
2252
2394
|
})
|
|
2253
2395
|
const text = await res.text()
|
|
2254
|
-
|
|
2396
|
+
let body
|
|
2397
|
+
// 这一处原来是全文件唯一没有 try 的 JSON.parse:宿主代理回一页 HTML 错误时,
|
|
2398
|
+
// 用户看到的是 "Unexpected token '<'" 这种噪声,而不是「500 返回非 JSON」。
|
|
2399
|
+
try { body = text ? JSON.parse(text) : null } catch { throw badJson(res) }
|
|
2255
2400
|
if (!res.ok || !body || body.ok !== true) throw new Error((body && body.error) || `${res.status}`)
|
|
2256
2401
|
if (action === 'check') {
|
|
2257
2402
|
const d = body.drift
|
|
2258
2403
|
setMsg(d
|
|
2259
2404
|
? M(`云端:落后 ${d.behind} 个提交,领先 ${d.ahead} 个提交`, `Cloud: ${d.behind} commit(s) behind, ${d.ahead} ahead`)
|
|
2260
2405
|
: (body.error || M('读不到远端', 'Cannot read the remote')))
|
|
2406
|
+
} else if (action === 'push-live') {
|
|
2407
|
+
if (body.livePush) setLiveLocal(body.livePush)
|
|
2261
2408
|
} else {
|
|
2262
2409
|
setMsg(body.closeRequested
|
|
2263
2410
|
? M('已排队:客户端马上关闭,退出后执行;拉取完成后按设置自动重开', 'Queued: the client closes now and the sync runs after exit; it relaunches per your settings when pulling finishes')
|
|
2264
2411
|
: M('已排队:退出 DSH 后自动执行', 'Queued: runs automatically after DSH exits'))
|
|
2265
2412
|
}
|
|
2266
|
-
if (typeof props.onSaved === 'function') props.onSaved()
|
|
2267
|
-
} catch (e) {
|
|
2413
|
+
if (typeof props.onSaved === 'function') props.onSaved(action === 'push-live' ? { silent: true } : undefined)
|
|
2414
|
+
} catch (e) {
|
|
2415
|
+
if (action === 'push-live') setLiveLocal(null)
|
|
2416
|
+
setErr(String((e && e.message) || e))
|
|
2417
|
+
} finally { setBusy('') }
|
|
2268
2418
|
}
|
|
2269
2419
|
|
|
2270
2420
|
const sw = (patchKey, stateKey, label, hintText) => {
|
|
@@ -2299,8 +2449,39 @@ window.__ModuleLoader__.load({
|
|
|
2299
2449
|
}
|
|
2300
2450
|
|
|
2301
2451
|
const pending = auto.pending
|
|
2452
|
+
const serverLive = auto.livePush || null
|
|
2453
|
+
const hasServerLive = Boolean(serverLive && (serverLive.running || serverLive.finishedAt))
|
|
2454
|
+
// 后端状态一旦到齐(或已有更新时间戳)就以真实状态为准,避免旧的乐观占位盖住真实进度
|
|
2455
|
+
const livePush = hasServerLive && (!liveLocal || serverLive.startedAt >= (liveLocal.startedAt || 0) - 2000)
|
|
2456
|
+
? serverLive
|
|
2457
|
+
: (liveLocal || serverLive)
|
|
2458
|
+
const liveRunning = Boolean(livePush && livePush.running)
|
|
2459
|
+
react.useEffect(() => {
|
|
2460
|
+
if (!liveRunning) return undefined
|
|
2461
|
+
setNowTick(Date.now())
|
|
2462
|
+
const timer = setInterval(() => setNowTick(Date.now()), 1000)
|
|
2463
|
+
return () => clearInterval(timer)
|
|
2464
|
+
}, [liveRunning])
|
|
2465
|
+
react.useEffect(() => {
|
|
2466
|
+
if (hasServerLive && !serverLive.running && liveLocal) setLiveLocal(null)
|
|
2467
|
+
}, [hasServerLive, serverLive && serverLive.running, serverLive && serverLive.finishedAt])
|
|
2302
2468
|
// 后台调度拿不到请求语言,宿主把原因中英各存一份,这里按当前界面语言挑
|
|
2303
2469
|
const pendingReason = pending ? (langIsZh() ? (pending.reasonZh || pending.reason) : (pending.reasonEn || pending.reason)) : ''
|
|
2470
|
+
const liveSteps = (() => {
|
|
2471
|
+
if (!livePush) return []
|
|
2472
|
+
const isWebdav = livePush.transport === 'webdav' || Boolean(props.data && props.data.webdav && props.data.webdav.active)
|
|
2473
|
+
const base = []
|
|
2474
|
+
if (livePush.initPush) base.push({ key: 'init', label: M('初始化仓库', 'Init repo') })
|
|
2475
|
+
base.push({ key: 'capture', label: M('抓取配置', 'Capture') })
|
|
2476
|
+
if (!isWebdav) base.push({ key: 'commit', label: M('提交变更', 'Commit') })
|
|
2477
|
+
base.push({ key: 'upload', label: isWebdav ? M('上传 WebDAV', 'Upload WebDAV') : M('推送远端', 'Push remote') })
|
|
2478
|
+
return base
|
|
2479
|
+
})()
|
|
2480
|
+
const phaseRank = { starting: -1, init: 0, capture: 1, commit: 2, upload: 3, done: 99, error: -2 }
|
|
2481
|
+
const curRank = phaseRank[String((livePush && livePush.phase) || 'starting')] ?? -1
|
|
2482
|
+
const elapsedSec = (livePush && livePush.startedAt)
|
|
2483
|
+
? Math.max(0, Math.floor(((livePush.finishedAt || nowTick) - livePush.startedAt) / 1000))
|
|
2484
|
+
: 0
|
|
2304
2485
|
return h('div', { style: S.card },
|
|
2305
2486
|
h('div', { style: S.cardHead },
|
|
2306
2487
|
h('div', { style: S.cardTitle }, M('自动同步', 'Auto sync')),
|
|
@@ -2332,26 +2513,110 @@ window.__ModuleLoader__.load({
|
|
|
2332
2513
|
h('button', {
|
|
2333
2514
|
type: 'button',
|
|
2334
2515
|
style: canPullNow ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
|
|
2335
|
-
disabled: Boolean(busy) || !canPullNow,
|
|
2516
|
+
disabled: Boolean(busy) || !canPullNow || liveRunning,
|
|
2336
2517
|
title: canPullNow ? '' : M('云端还是空的:没有内容可拉,先「初始化推送」', 'The cloud is still empty — nothing to pull, initialize push first'),
|
|
2337
2518
|
onClick: () => act('pull-now'),
|
|
2338
2519
|
}, M('立即拉取(会关闭 DSH)', 'Pull now (closes DSH)')),
|
|
2339
2520
|
h('button', {
|
|
2340
2521
|
type: 'button',
|
|
2341
|
-
style: pushAllowed ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
|
|
2342
|
-
disabled: Boolean(busy) || !pushAllowed,
|
|
2343
|
-
title: pushAllowed
|
|
2522
|
+
style: (pushAllowed && !liveRunning) ? S.btnPrimary : { ...S.btnPrimary, opacity: 0.5, cursor: 'not-allowed' },
|
|
2523
|
+
disabled: Boolean(busy) || !pushAllowed || liveRunning,
|
|
2524
|
+
title: pushAllowed
|
|
2525
|
+
? M('不关闭 DSH 直接在后台抓配置并上传(只读本地配置,安全不打断当前对话)', 'Capture and push in background without closing DSH')
|
|
2526
|
+
: M('云端已有内容:本机还是空的,先拉取', 'The cloud already has content — pull first'),
|
|
2527
|
+
onClick: () => act('push-live'),
|
|
2528
|
+
}, busy === 'push-live'
|
|
2529
|
+
? M('准备启动…', 'Starting…')
|
|
2530
|
+
: (liveRunning
|
|
2531
|
+
? M('后台推送中…', 'Pushing in background…')
|
|
2532
|
+
: (initMode
|
|
2533
|
+
? M('初始化推送(不关 DSH)', 'Initialize push (keep DSH open)')
|
|
2534
|
+
: M('立即推送(不关 DSH)', 'Push now (keep DSH open)')))),
|
|
2535
|
+
h('button', {
|
|
2536
|
+
type: 'button',
|
|
2537
|
+
style: (pushAllowed && !liveRunning) ? S.btn : { ...S.btn, opacity: 0.5, cursor: 'not-allowed' },
|
|
2538
|
+
disabled: Boolean(busy) || !pushAllowed || liveRunning,
|
|
2539
|
+
title: pushAllowed
|
|
2540
|
+
? M('先退出 DSH 再推,可确保内存中尚未落盘的改动一并写入', 'Exit DSH before pushing so in-memory changes flush first')
|
|
2541
|
+
: M('云端已有内容:本机还是空的,先拉取', 'The cloud already has content — pull first'),
|
|
2344
2542
|
onClick: () => act('push-now'),
|
|
2345
2543
|
}, initMode
|
|
2346
2544
|
? M('初始化推送(会关闭 DSH)', 'Initialize push (closes DSH)')
|
|
2347
|
-
: M('
|
|
2545
|
+
: M('退出后推送(会关闭 DSH)', 'Push after exit (closes DSH)')),
|
|
2348
2546
|
pending ? h('button', { type: 'button', style: S.btn, disabled: Boolean(busy), onClick: () => act('cancel') }, M('取消排队', 'Cancel queue')) : null,
|
|
2349
2547
|
),
|
|
2548
|
+
livePush && (livePush.running || livePush.finishedAt)
|
|
2549
|
+
? h('div', {
|
|
2550
|
+
style: {
|
|
2551
|
+
padding: '9px 11px', borderRadius: '8px', fontSize: '12px', lineHeight: '18px',
|
|
2552
|
+
display: 'flex', flexDirection: 'column', gap: '6px',
|
|
2553
|
+
border: '1px solid ' + (livePush.running
|
|
2554
|
+
? 'var(--dsw-alias-toast-action)'
|
|
2555
|
+
: (livePush.ok ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-error-primary)')),
|
|
2556
|
+
background: 'var(--dsw-alias-fill-l1, var(--dsw-alias-bg-layer-2))',
|
|
2557
|
+
color: livePush.running
|
|
2558
|
+
? 'var(--dsw-alias-label-primary)'
|
|
2559
|
+
: (livePush.ok ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-state-error-primary)'),
|
|
2560
|
+
},
|
|
2561
|
+
},
|
|
2562
|
+
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '8px', flexWrap: 'wrap' } },
|
|
2563
|
+
h('div', { style: { fontWeight: 600 } },
|
|
2564
|
+
(livePush.running ? '⏳ ' : (livePush.ok ? '✓ ' : '✕ ')) + (livePush.message || '')),
|
|
2565
|
+
h('div', { style: { ...S.footnote, fontFamily: 'Consolas, ui-monospace, monospace' } },
|
|
2566
|
+
livePush.running
|
|
2567
|
+
? M(`已耗时 ${elapsedSec}s`, `${elapsedSec}s elapsed`)
|
|
2568
|
+
: M(`耗时 ${elapsedSec}s`, `${elapsedSec}s`)),
|
|
2569
|
+
),
|
|
2570
|
+
liveSteps.length
|
|
2571
|
+
? h('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap', alignItems: 'center' } },
|
|
2572
|
+
liveSteps.map((st, idx) => {
|
|
2573
|
+
const stRank = phaseRank[st.key] ?? idx
|
|
2574
|
+
const done = livePush.phase === 'done' || (curRank > stRank && curRank >= 0)
|
|
2575
|
+
const active = livePush.running && curRank === stRank
|
|
2576
|
+
const failed = !livePush.running && livePush.ok === false && curRank === stRank
|
|
2577
|
+
return h('span', {
|
|
2578
|
+
key: st.key,
|
|
2579
|
+
style: {
|
|
2580
|
+
...S.chip,
|
|
2581
|
+
border: '1px solid ' + (active
|
|
2582
|
+
? 'var(--dsw-alias-toast-action)'
|
|
2583
|
+
: (done
|
|
2584
|
+
? 'var(--dsw-alias-state-success-primary)'
|
|
2585
|
+
: (failed ? 'var(--dsw-alias-state-error-primary)' : 'var(--dsw-alias-border-l1)'))),
|
|
2586
|
+
background: done
|
|
2587
|
+
? 'var(--dsw-alias-state-success-tertiary)'
|
|
2588
|
+
: (failed ? 'var(--dsw-alias-state-error-tertiary, var(--dsw-alias-file-diff-deleted-bg))' : 'var(--dsw-alias-bg-base)'),
|
|
2589
|
+
color: active
|
|
2590
|
+
? 'var(--dsw-alias-toast-action)'
|
|
2591
|
+
: (done ? 'var(--dsw-alias-label-primary)' : 'var(--dsw-alias-label-secondary)'),
|
|
2592
|
+
fontWeight: active ? 600 : 500,
|
|
2593
|
+
},
|
|
2594
|
+
}, `${done ? '✓ ' : (active ? '▸ ' : (failed ? '✕ ' : ''))}${idx + 1}. ${st.label}`)
|
|
2595
|
+
}))
|
|
2596
|
+
: null,
|
|
2597
|
+
(livePush.running || livePush.ok === false) && Array.isArray(livePush.recent) && livePush.recent.length
|
|
2598
|
+
? h('div', {
|
|
2599
|
+
style: {
|
|
2600
|
+
...S.code, padding: '6px 8px', fontSize: '11px', lineHeight: '16px',
|
|
2601
|
+
maxHeight: '96px', overflowY: 'auto',
|
|
2602
|
+
},
|
|
2603
|
+
}, livePush.recent.join('\n'))
|
|
2604
|
+
: null,
|
|
2605
|
+
livePush.finishedAt
|
|
2606
|
+
? h('div', { style: S.footnote },
|
|
2607
|
+
M(`完成时间:${new Date(livePush.finishedAt).toLocaleTimeString(localeNow(), { hour12: false })}`,
|
|
2608
|
+
`Finished at: ${new Date(livePush.finishedAt).toLocaleTimeString(localeNow(), { hour12: false })}`)
|
|
2609
|
+
+ (livePush.log ? ` · ${livePush.log}` : ''))
|
|
2610
|
+
: (livePush.log
|
|
2611
|
+
? h('div', { style: S.footnote }, M(`日志:${livePush.log}`, `Log: ${livePush.log}`))
|
|
2612
|
+
: null),
|
|
2613
|
+
)
|
|
2614
|
+
: null,
|
|
2350
2615
|
initMode
|
|
2351
2616
|
? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-warn-primary)' } },
|
|
2352
2617
|
M(
|
|
2353
|
-
'
|
|
2354
|
-
'Both the local repo and the cloud are empty: Initialize push
|
|
2618
|
+
'本机仓库和云端仓库都还是空的:点「初始化推送(不关 DSH)」会直接在后台抓配置并上传;若需先让内存状态完全落盘,也可选「初始化推送(会关闭 DSH)」。这时没有东西可拉,拉取按钮是灰的。',
|
|
2619
|
+
'Both the local repo and the cloud are empty: "Initialize push (keep DSH open)" captures and uploads in background; use "(closes DSH)" if you want in-memory state flushed first. Pull stays disabled until content exists.',
|
|
2355
2620
|
))
|
|
2356
2621
|
: null,
|
|
2357
2622
|
(!pushAllowed || !canPullNow)
|
|
@@ -2585,12 +2850,24 @@ window.__ModuleLoader__.load({
|
|
|
2585
2850
|
setUpdBusy(true)
|
|
2586
2851
|
setUpdMsg(M('DSH 即将退出,退出后安装并自动重启…', 'DSH will exit; the package is installed afterwards and DSH relaunches…'))
|
|
2587
2852
|
try {
|
|
2588
|
-
await callUpdate({ action: 'install-restart' })
|
|
2589
|
-
|
|
2853
|
+
const r = await callUpdate({ action: 'install-restart' })
|
|
2854
|
+
// closeRequested=false 说明后端没能让客户端退出(taskkill 被拦 / app.quit 被模态框挡住),
|
|
2855
|
+
// 这时再喊「马上退出」就是骗人:安装要等到真的退出之后才会发生。
|
|
2856
|
+
if (r && r.closeRequested === false) {
|
|
2857
|
+
setUpdMsg(M('已排队:没能让客户端自动退出,请手动完全退出 DSH,退出后会自动安装并重启',
|
|
2858
|
+
'Queued: the client did not exit automatically. Quit DSH fully; the install and relaunch run afterwards.'))
|
|
2859
|
+
showToast(M('已排队:请手动退出 DSH(窗口 + 托盘),退出后自动安装并重启',
|
|
2860
|
+
'Queued: quit DSH fully (window and tray); install and relaunch run afterwards.'))
|
|
2861
|
+
} else {
|
|
2862
|
+
showToast(M('DSH 即将退出并自动安装、重启…', 'DSH will exit, install, and relaunch…'))
|
|
2863
|
+
}
|
|
2590
2864
|
} catch (e) {
|
|
2591
2865
|
const msg = String((e && e.message) || e)
|
|
2592
2866
|
setUpdMsg(M('安装失败:', 'Install failed: ') + msg)
|
|
2593
2867
|
showToast(M('安装失败:', 'Install failed: ') + msg)
|
|
2868
|
+
} finally {
|
|
2869
|
+
// 必须复位:退出没真的发生时(上面 closeRequested=false 就是这种),
|
|
2870
|
+
// 卡上 7 个按钮会全部 disabled 且本会话内没有复位入口。
|
|
2594
2871
|
setUpdBusy(false)
|
|
2595
2872
|
}
|
|
2596
2873
|
}
|
|
@@ -2662,13 +2939,87 @@ window.__ModuleLoader__.load({
|
|
|
2662
2939
|
await callAuto({ action: 'check' })
|
|
2663
2940
|
} catch { /* 检查失败不该挡住页面,状态行会显示失败原因 */ }
|
|
2664
2941
|
if (alive) setChecking(false)
|
|
2665
|
-
|
|
2942
|
+
// 静默刷新:这里是每 2 分钟的自动复查。用非静默的 refresh() 会把整页 busy 置真
|
|
2943
|
+
//(按钮周期性变灰),网络抖动时还会把「读取失败」写进页面,而 data 明明是有效的。
|
|
2944
|
+
if (alive && typeof refresh === 'function') refresh({ silent: true })
|
|
2666
2945
|
}
|
|
2667
2946
|
run()
|
|
2668
2947
|
const timer = setInterval(run, 2 * 60 * 1000)
|
|
2669
2948
|
return () => { alive = false; clearInterval(timer) }
|
|
2670
2949
|
}, [])
|
|
2671
2950
|
|
|
2951
|
+
const lastLiveFinishedRef = react.useRef(0)
|
|
2952
|
+
|
|
2953
|
+
const jumpToSection = (sidOrTarget, opts) => {
|
|
2954
|
+
const sid = (sidOrTarget && typeof sidOrTarget === 'object') ? sidOrTarget.section : sidOrTarget
|
|
2955
|
+
const options = (sidOrTarget && typeof sidOrTarget === 'object') ? sidOrTarget : opts
|
|
2956
|
+
if (!sid) return
|
|
2957
|
+
if (options && options.openRoots && !showRoots) setShowRoots(true)
|
|
2958
|
+
setActiveSection(sid)
|
|
2959
|
+
const scrollNow = () => {
|
|
2960
|
+
const el = document.getElementById('sync-section-' + sid)
|
|
2961
|
+
if (!el) return
|
|
2962
|
+
const body = bodyRef && bodyRef.current
|
|
2963
|
+
if (body && typeof body.scrollTo === 'function') {
|
|
2964
|
+
const top = el.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop - 8
|
|
2965
|
+
body.scrollTo({ top: Math.max(0, top), behavior: 'smooth' })
|
|
2966
|
+
} else if (typeof el.scrollIntoView === 'function') {
|
|
2967
|
+
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
2968
|
+
}
|
|
2969
|
+
try {
|
|
2970
|
+
if (typeof el.animate === 'function') {
|
|
2971
|
+
el.animate([
|
|
2972
|
+
{ boxShadow: '0 0 0 2px var(--dsw-alias-toast-action)' },
|
|
2973
|
+
{ boxShadow: '0 0 0 0px transparent' },
|
|
2974
|
+
], { duration: 1500, easing: 'ease-out' })
|
|
2975
|
+
}
|
|
2976
|
+
} catch { }
|
|
2977
|
+
}
|
|
2978
|
+
if (options && options.openRoots && !showRoots) {
|
|
2979
|
+
setTimeout(scrollNow, 60)
|
|
2980
|
+
} else {
|
|
2981
|
+
scrollNow()
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
const liveRunning = Boolean(data && data.auto && data.auto.livePush && data.auto.livePush.running)
|
|
2986
|
+
// 后台在线推送进行中时,每 800ms 静默轮询状态直到结束,并弹出完成/失败提示。
|
|
2987
|
+
// 用「自调度 setTimeout + in-flight 门闩」而不是 setInterval:/status 要跑备份枚举与本机待推送统计,
|
|
2988
|
+
// 推送期间经常超过 800ms,setInterval 会让请求不断叠加(失败还要退避重试,越叠越多)。
|
|
2989
|
+
react.useEffect(() => {
|
|
2990
|
+
if (!liveRunning) return undefined
|
|
2991
|
+
let alive = true
|
|
2992
|
+
let pending = false
|
|
2993
|
+
let timer = null
|
|
2994
|
+
const tick = async () => {
|
|
2995
|
+
if (!alive) return
|
|
2996
|
+
if (!pending) {
|
|
2997
|
+
pending = true
|
|
2998
|
+
try {
|
|
2999
|
+
if (typeof refresh === 'function') await refresh({ silent: true })
|
|
3000
|
+
} catch { /* 静默轮询失败不影响页面 */ } finally { pending = false }
|
|
3001
|
+
}
|
|
3002
|
+
if (alive) timer = setTimeout(tick, 800)
|
|
3003
|
+
}
|
|
3004
|
+
timer = setTimeout(tick, 800)
|
|
3005
|
+
return () => { alive = false; if (timer) clearTimeout(timer) }
|
|
3006
|
+
}, [liveRunning])
|
|
3007
|
+
|
|
3008
|
+
react.useEffect(() => {
|
|
3009
|
+
const lp = data && data.auto && data.auto.livePush
|
|
3010
|
+
if (!lp || lp.running || !lp.finishedAt) return
|
|
3011
|
+
if (lastLiveFinishedRef.current === 0) {
|
|
3012
|
+
// 首次挂载时如果已经是很久以前完成的旧记录不重弹;10 秒内刚完成则弹提示
|
|
3013
|
+
if (Date.now() - lp.finishedAt > 10000) {
|
|
3014
|
+
lastLiveFinishedRef.current = lp.finishedAt
|
|
3015
|
+
return
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
if (lastLiveFinishedRef.current === lp.finishedAt) return
|
|
3019
|
+
lastLiveFinishedRef.current = lp.finishedAt
|
|
3020
|
+
showToast(lp.message || (lp.ok ? M('推送完成', 'Push completed') : M('推送失败', 'Push failed')))
|
|
3021
|
+
}, [data])
|
|
3022
|
+
|
|
2672
3023
|
// 上次「退出后自动同步」的结果:15 分钟内、且没弹过,就弹 5 秒提示。
|
|
2673
3024
|
// 判据与「启动即弹」共用 takeFreshResult(同一个 localStorage 键,不会弹两次)。
|
|
2674
3025
|
react.useEffect(() => {
|
|
@@ -2732,9 +3083,11 @@ window.__ModuleLoader__.load({
|
|
|
2732
3083
|
const failed = !has && u.ok === false && !restartRequired
|
|
2733
3084
|
const kind = (restartRequired || preparedReady || has) ? 'warn' : (failed ? 'error' : 'ok')
|
|
2734
3085
|
const notesText = (u.remote && (langIsZh() ? (u.remote.notes || u.remote.notesEn) : (u.remote.notesEn || u.remote.notes))) || ''
|
|
2735
|
-
//
|
|
3086
|
+
// 检查失败时仅在 error 尚未带明细时补充 sourceNote,避免把各源报错打印两遍
|
|
2736
3087
|
const badSources = (Array.isArray(u.sources) ? u.sources : []).filter((x) => x && x.ok === false)
|
|
2737
|
-
const
|
|
3088
|
+
const errText = String(u.error || '')
|
|
3089
|
+
const alreadyDetailed = badSources.length > 0 && badSources.some((x) => errText.includes(x.host || x.url || ''))
|
|
3090
|
+
const sourceNote = (badSources.length && !alreadyDetailed)
|
|
2738
3091
|
? M(
|
|
2739
3092
|
`(${badSources.map((x) => `${x.host || x.url}: ${x.error || '失败'}`).join(';')})`,
|
|
2740
3093
|
` (${badSources.map((x) => `${x.host || x.url}: ${x.error || 'failed'}`).join('; ')})`,
|
|
@@ -2809,15 +3162,15 @@ window.__ModuleLoader__.load({
|
|
|
2809
3162
|
h('input', {
|
|
2810
3163
|
type: 'text', style: S.input, value: updToken, spellCheck: false,
|
|
2811
3164
|
placeholder: cfg.tokenSet
|
|
2812
|
-
? M('
|
|
2813
|
-
: M('Gitee
|
|
3165
|
+
? M('已配置;留空表示不改(支持 $GITHUB_TOKEN 读取环境变量)', 'Already set; leave empty to keep (or enter $GITHUB_TOKEN for env var)')
|
|
3166
|
+
: M('GitHub / Gitee 令牌,或填 $GITHUB_TOKEN 读取本机环境变量', 'GitHub / Gitee token, or $GITHUB_TOKEN to read from env'),
|
|
2814
3167
|
onChange: (e) => setUpdToken(e.target.value),
|
|
2815
3168
|
}),
|
|
2816
3169
|
),
|
|
2817
3170
|
h('div', { style: S.actions },
|
|
2818
3171
|
h('button', { type: 'button', style: S.btnPrimary, disabled: updBusy, onClick: saveUpdConfig }, updBusy ? M('保存中…', 'Saving…') : M('保存', 'Save')),
|
|
2819
3172
|
h('button', { type: 'button', style: S.btn, disabled: updBusy, onClick: cancelEditUpd }, M('取消', 'Cancel')),
|
|
2820
|
-
cfg.
|
|
3173
|
+
cfg.tokenSaved
|
|
2821
3174
|
? h('button', { type: 'button', style: S.btn, disabled: updBusy, onClick: clearUpdToken }, M('清除已存令牌', 'Clear stored token'))
|
|
2822
3175
|
: null,
|
|
2823
3176
|
),
|
|
@@ -2826,7 +3179,7 @@ window.__ModuleLoader__.load({
|
|
|
2826
3179
|
h(Kv, {
|
|
2827
3180
|
k: M('更新清单', 'Manifest'),
|
|
2828
3181
|
v: cfg.manifestUrlIsDefault
|
|
2829
|
-
? M('内置默认(
|
|
3182
|
+
? M('内置默认(GitHub API / gh-proxy / ghfast / GitHub raw 依次尝试)', 'Built-in default (GitHub API / gh-proxy / ghfast / GitHub raw in order)')
|
|
2830
3183
|
: (cfg.manifestUrl || '…'),
|
|
2831
3184
|
}),
|
|
2832
3185
|
h(Kv, {
|
|
@@ -2837,9 +3190,15 @@ window.__ModuleLoader__.load({
|
|
|
2837
3190
|
}),
|
|
2838
3191
|
h(Kv, {
|
|
2839
3192
|
k: M('更新令牌', 'Token'),
|
|
2840
|
-
v: cfg.
|
|
2841
|
-
? M(
|
|
2842
|
-
:
|
|
3193
|
+
v: cfg.tokenSource === 'env' && cfg.tokenEnv
|
|
3194
|
+
? M(`已从环境变量 ${cfg.tokenEnv} 读取(不落盘、绝不推送)`, `From env var ${cfg.tokenEnv} (not stored, never pushed)`)
|
|
3195
|
+
: cfg.tokenSource === 'git-credential'
|
|
3196
|
+
? M('已从本机 git 凭据自动读取(不落盘、绝不推送)', 'From local git credential (not stored, never pushed)')
|
|
3197
|
+
: cfg.tokenSource === 'gh-cli'
|
|
3198
|
+
? M('已从 GitHub CLI (gh) 自动读取(不落盘、绝不推送)', 'From GitHub CLI (gh) (not stored, never pushed)')
|
|
3199
|
+
: cfg.tokenSet
|
|
3200
|
+
? M('已配置(仅存本机,绝不推送)', 'Set (local only, never pushed)')
|
|
3201
|
+
: M('未配置(公开库可不填;私有库可用本机 GitHub 登录、$GITHUB_TOKEN 或填入令牌)', 'Not set (optional for public repos; private repos use local GitHub login, $GITHUB_TOKEN, or a token)'),
|
|
2843
3202
|
}),
|
|
2844
3203
|
u.remote && u.remote.npmTgzUrls && u.remote.npmTgzUrls.length
|
|
2845
3204
|
? h(Kv, {
|
|
@@ -2964,11 +3323,20 @@ window.__ModuleLoader__.load({
|
|
|
2964
3323
|
}, pendingDetailOpen ? M('收起', 'Collapse') : M('展开', 'Expand'))
|
|
2965
3324
|
: null,
|
|
2966
3325
|
),
|
|
2967
|
-
pendingDetailOpen ? localBlock : (localBlock ? h('div', { style: S.footnote },
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
3326
|
+
pendingDetailOpen ? localBlock : (localBlock ? h('div', { style: S.footnote },
|
|
3327
|
+
h('span', null, M(
|
|
3328
|
+
`${data.local.pending > 0 ? `有 ${data.local.pending} 个文件待推送` : '没有新写入'} · 点「展开」看具体会话记录与本机 profile`,
|
|
3329
|
+
`${data.local.pending > 0 ? `${data.local.pending} file(s) to push` : 'nothing new'} · click Expand for session names and local profile`,
|
|
3330
|
+
)),
|
|
3331
|
+
data.local.pending > 0
|
|
3332
|
+
? h('button', {
|
|
3333
|
+
type: 'button',
|
|
3334
|
+
style: S.anchorBtn,
|
|
3335
|
+
onClick: () => jumpToSection('automation'),
|
|
3336
|
+
}, M('前往立即推送 →', 'Go to push →'))
|
|
3337
|
+
: null,
|
|
3338
|
+
) : null),
|
|
3339
|
+
data && Array.isArray(data.advice) && data.advice.length ? h(Advice, { items: data.advice, data, onNavigate: jumpToSection }) : null)
|
|
2972
3340
|
: null,
|
|
2973
3341
|
)
|
|
2974
3342
|
|
|
@@ -3038,11 +3406,9 @@ window.__ModuleLoader__.load({
|
|
|
3038
3406
|
)
|
|
3039
3407
|
|
|
3040
3408
|
const workspaceViewCard = h(WorkspaceViewCard, {})
|
|
3041
|
-
const
|
|
3409
|
+
const cloudCard = data ? h(CloudTargetCard, { data, onSaved: refresh }) : null
|
|
3042
3410
|
const autoCard = data ? h(AutoCard, { data, onSaved: refresh }) : null
|
|
3043
|
-
// 0.4.0:跨端状态卡(只读)与 WebDAV 同步方式卡
|
|
3044
3411
|
const platformCard = h(PlatformCard, { data })
|
|
3045
|
-
const webdavCard = h(WebdavCard, { onSaved: refresh })
|
|
3046
3412
|
// 「还原备份」自己拿 status 里的 backup 段(快照列表),改动后让父层 refresh 重新读
|
|
3047
3413
|
const restoreCard = data ? h(RestoreCard, { data, onSaved: refresh }) : null
|
|
3048
3414
|
// 「同步内容」卡自己拉 /config-sync/scope,不依赖 status(status 读的是仓库与本机,跟勾选无关)
|
|
@@ -3066,7 +3432,7 @@ window.__ModuleLoader__.load({
|
|
|
3066
3432
|
h('div', { ref: headerRef, style: S.pageHeader },
|
|
3067
3433
|
h('div', { style: S.pageHeaderMain },
|
|
3068
3434
|
h('div', { style: S.pageTitleRow },
|
|
3069
|
-
h('div', { style: S.pageTitle }, M('
|
|
3435
|
+
h('div', { style: S.pageTitle }, M('配置备份与同步', 'Config Backup & Sync')),
|
|
3070
3436
|
h('div', { style: S.badgeGroup },
|
|
3071
3437
|
h('span', { style: S.badgeKey }, M('本机', 'local')),
|
|
3072
3438
|
h('span', { style: chipStyle(summary.kind) }, chipLabel(summary.kind)),
|
|
@@ -3090,8 +3456,8 @@ window.__ModuleLoader__.load({
|
|
|
3090
3456
|
] : h('span', null, summary.text),
|
|
3091
3457
|
),
|
|
3092
3458
|
h('div', { style: S.pageLead },
|
|
3093
|
-
M('
|
|
3094
|
-
'
|
|
3459
|
+
M('多端配置备份、同步与还原:本机 → 仓库 → 云端 → 另一台机器。改完立即生效;写回与还原在退出客户端后执行。',
|
|
3460
|
+
'Multi-device backup, sync and restore: this machine → repo → cloud → another machine. Edits apply at once; write-back and restore run after the client quits.')),
|
|
3095
3461
|
),
|
|
3096
3462
|
h('div', { style: S.headerActions },
|
|
3097
3463
|
// 「本机路径」区唯一的入口:平时普通按钮,只有根外路径/被覆盖这两类告警才变橙并带数字
|
|
@@ -3119,7 +3485,7 @@ window.__ModuleLoader__.load({
|
|
|
3119
3485
|
...(conflictCard ? [['conflict', M('同步冲突', 'Sync conflicts')]] : []),
|
|
3120
3486
|
...(showRoots ? [['roots', M('本机路径', 'Local paths')]] : []),
|
|
3121
3487
|
['targets', M('同步目标', 'Targets')],
|
|
3122
|
-
['platform', M('
|
|
3488
|
+
['platform', M('跨端状态', 'Platform')],
|
|
3123
3489
|
['automation', M('自动化', 'Automation')],
|
|
3124
3490
|
['actions', M('生成脚本', 'Scripts')],
|
|
3125
3491
|
['restore', M('还原备份', 'Restore')],
|
|
@@ -3141,12 +3507,7 @@ window.__ModuleLoader__.load({
|
|
|
3141
3507
|
fontWeight: active ? 600 : 400,
|
|
3142
3508
|
},
|
|
3143
3509
|
title: active ? M('当前所在区', 'Current section') : M('跳转到此区', 'Jump to section'),
|
|
3144
|
-
onClick: () =>
|
|
3145
|
-
setActiveSection(sid)
|
|
3146
|
-
const el = document.getElementById('sync-section-' + sid)
|
|
3147
|
-
if (!el || !el.scrollIntoView) return
|
|
3148
|
-
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
3149
|
-
},
|
|
3510
|
+
onClick: () => jumpToSection(sid),
|
|
3150
3511
|
}, label)
|
|
3151
3512
|
}),
|
|
3152
3513
|
),
|
|
@@ -3175,9 +3536,8 @@ window.__ModuleLoader__.load({
|
|
|
3175
3536
|
? Section(M('同步冲突', 'Sync conflicts'), M('这些文件挡住了拉取:逐项选完保存,再点「立即拉取」', 'These files block the pull: pick per file, save, then pull'), [conflictCard], 'conflict')
|
|
3176
3537
|
: null,
|
|
3177
3538
|
Section(M('本机路径', 'Local paths'), M('每台机器确认一次即可:仓库里用占位符,落地时按这里展开', 'Confirm once per machine: the repo stores placeholders, expanded with these paths'), [rootsCard], 'roots'),
|
|
3178
|
-
Section(M('同步目标', 'Sync targets'), M('
|
|
3179
|
-
|
|
3180
|
-
Section(M('跨端与同步方式', 'Platform & transport'), M('本机平台、仓库契约来自哪个平台、是否改用 WebDAV', 'Local platform, which platform the contract came from, and whether to use WebDAV'), [platformCard, webdavCard].filter(Boolean), 'platform'),
|
|
3539
|
+
Section(M('同步目标', 'Sync targets'), M('本机仓库、同步方式(Git / WebDAV)与云端目标统一在这里设置', 'Local repo, sync transport (Git / WebDAV), and cloud target settings'), [repoCard, cloudCard].filter(Boolean), 'targets'),
|
|
3540
|
+
Section(M('跨端状态', 'Cross-platform'), M('本机平台、仓库契约来自哪个平台与已登记机器', 'Local platform, which platform the contract came from, and registered machines'), [platformCard].filter(Boolean), 'platform'),
|
|
3181
3541
|
Section(M('自动化与插件更新', 'Automation & plugin update'), M('退出后自动做什么、插件自己怎么升级', 'What runs automatically after exit, and how the plugin upgrades'), [autoCard, updCard].filter(Boolean), 'automation'),
|
|
3182
3542
|
Section(M('退出后执行', 'After exit'), M('生成脚本 → 退出客户端后跑一遍', 'Generate the script → it runs after the client quits'), [actionCard], 'actions'),
|
|
3183
3543
|
Section(M('还原备份', 'Restore backup'), M('点快照 → 确认差异 → 排队还原(退出客户端后执行)', 'Pick a snapshot → confirm the diff → queued restore (runs after the client quits)'), [restoreCard].filter(Boolean), 'restore'),
|
|
@@ -3220,7 +3580,13 @@ window.__ModuleLoader__.load({
|
|
|
3220
3580
|
try {
|
|
3221
3581
|
const r = await callRoots()
|
|
3222
3582
|
setData(r)
|
|
3223
|
-
|
|
3583
|
+
const next = snap(r)
|
|
3584
|
+
// 两件事一起判:
|
|
3585
|
+
// ① 编辑态下不用服务端值覆盖未保存的草稿(手填的路径会无声消失);
|
|
3586
|
+
// ② 一个根都没探测到(forced:没路径就先填)时也要把空草稿灌进去,
|
|
3587
|
+
// 否则输入框永远不出现、保存按钮恒 disabled,「首次填根」直接成死局。
|
|
3588
|
+
const noRoots = !(next.appRoot || next.dshHome || next.workspaceHome)
|
|
3589
|
+
if (!draft && (editing || noRoots)) setDraft(next)
|
|
3224
3590
|
} catch (e) {
|
|
3225
3591
|
setErr(String((e && e.message) || e))
|
|
3226
3592
|
} finally { setBusy(false) }
|
|
@@ -3472,11 +3838,12 @@ window.__ModuleLoader__.load({
|
|
|
3472
3838
|
*/
|
|
3473
3839
|
/** 问题反馈:提交即建 GitHub Issue(label feedback),列表读 Issue,点「已解决」就关单。 */
|
|
3474
3840
|
function FeedbackCard() {
|
|
3475
|
-
const empty = { connected: false, repo: '', label: 'feedback', items: [], counts: { open: 0, closed: 0, total: 0 }, outbox: [], error: '', ghFile: '', version: '', owner: '', login: '', canClose: false, readAnon: false, note: '' }
|
|
3841
|
+
const empty = { connected: false, repo: '', defaultRepo: '', label: 'feedback', items: [], counts: { open: 0, closed: 0, total: 0 }, outbox: [], error: '', ghFile: '', version: '', owner: '', login: '', canClose: false, readAnon: false, note: '', tokenPresent: false, tokenSource: 'none', tokenEnv: '', tokenSaved: false, envCandidates: [] }
|
|
3476
3842
|
const [st, setSt] = react.useState(empty)
|
|
3477
3843
|
const [title, setTitle] = react.useState('')
|
|
3478
3844
|
const [text, setText] = react.useState('')
|
|
3479
3845
|
const [token, setToken] = react.useState('')
|
|
3846
|
+
const [repoInput, setRepoInput] = react.useState('')
|
|
3480
3847
|
const [askToken, setAskToken] = react.useState(false)
|
|
3481
3848
|
const [busy, setBusy] = react.useState(false)
|
|
3482
3849
|
const [msg, setMsg] = react.useState('')
|
|
@@ -3485,17 +3852,18 @@ window.__ModuleLoader__.load({
|
|
|
3485
3852
|
const [filter, setFilter] = react.useState('open')
|
|
3486
3853
|
const [kw, setKw] = react.useState('')
|
|
3487
3854
|
|
|
3488
|
-
const load = async () => {
|
|
3855
|
+
const load = async (forceRefresh = false) => {
|
|
3489
3856
|
setBusy(true)
|
|
3490
3857
|
try {
|
|
3491
|
-
const r = await callFeedback(null)
|
|
3858
|
+
const r = await callFeedback(null, forceRefresh ? { query: { refresh: '1' } } : undefined)
|
|
3492
3859
|
setSt({ ...empty, ...r })
|
|
3860
|
+
if (r && r.repo && !askToken) setRepoInput(String(r.repo))
|
|
3493
3861
|
setErr(String(r.error || ''))
|
|
3494
3862
|
} catch (e) {
|
|
3495
3863
|
setErr(String((e && e.message) || e))
|
|
3496
3864
|
} finally { setBusy(false) }
|
|
3497
3865
|
}
|
|
3498
|
-
react.useEffect(() => { load() }, [])
|
|
3866
|
+
react.useEffect(() => { load(false) }, [])
|
|
3499
3867
|
|
|
3500
3868
|
const submit = async () => {
|
|
3501
3869
|
setBusy(true); setErr(''); setMsg('')
|
|
@@ -3519,14 +3887,29 @@ window.__ModuleLoader__.load({
|
|
|
3519
3887
|
} finally { setBusy(false) }
|
|
3520
3888
|
}
|
|
3521
3889
|
|
|
3522
|
-
const saveToken = async () => {
|
|
3890
|
+
const saveToken = async (opts = {}) => {
|
|
3523
3891
|
setBusy(true); setErr(''); setMsg('')
|
|
3524
3892
|
try {
|
|
3525
|
-
|
|
3893
|
+
const body = { repo: (opts.repo || repoInput || st.repo || '').trim() }
|
|
3894
|
+
if (opts.clearToken) {
|
|
3895
|
+
body.clearToken = true
|
|
3896
|
+
body.clearEnv = Boolean(opts.clearEnv)
|
|
3897
|
+
} else if (opts.tokenEnv) {
|
|
3898
|
+
body.tokenEnv = String(opts.tokenEnv).trim()
|
|
3899
|
+
} else if (token.trim()) {
|
|
3900
|
+
body.token = token.trim()
|
|
3901
|
+
}
|
|
3902
|
+
const res = await callFeedback(body, { query: { action: 'token' } })
|
|
3526
3903
|
setToken('')
|
|
3527
3904
|
setAskToken(false)
|
|
3528
|
-
|
|
3529
|
-
|
|
3905
|
+
if (opts.clearToken) {
|
|
3906
|
+
setMsg(M('已清除本机保存的明文令牌(后续优先读本机环境变量或 git 凭据,绝不推送进同步仓库)。', 'Cleared the stored plaintext token (env vars / git credential will be used instead, never pushed).'))
|
|
3907
|
+
} else if (res && res.tokenSource === 'env') {
|
|
3908
|
+
setMsg(M(`已绑定环境变量 ${res.tokenEnv || ''}(实时读取,不写入明文令牌,绝不推送进同步仓库)。`, `Bound env var ${res.tokenEnv || ''} (read dynamically, no plaintext token saved or pushed).`))
|
|
3909
|
+
} else {
|
|
3910
|
+
setMsg(M('已保存到本机私有配置(绝不推送进同步仓库),连接正常。', 'Saved locally (never committed or pushed); connection works.'))
|
|
3911
|
+
}
|
|
3912
|
+
await load(true)
|
|
3530
3913
|
} catch (e) {
|
|
3531
3914
|
setErr(String((e && e.message) || e))
|
|
3532
3915
|
} finally { setBusy(false) }
|
|
@@ -3583,40 +3966,109 @@ window.__ModuleLoader__.load({
|
|
|
3583
3966
|
onClick: () => setFilter(key),
|
|
3584
3967
|
}, label)
|
|
3585
3968
|
|
|
3969
|
+
const tokenSourceHint = () => {
|
|
3970
|
+
if (st.note) return st.note
|
|
3971
|
+
if (st.tokenSource === 'env' && st.tokenEnv) {
|
|
3972
|
+
return M(
|
|
3973
|
+
`令牌来源:本机环境变量 ${st.tokenEnv}(实时读取,不落盘、绝不推送进同步仓库);仓库记在 ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3974
|
+
`Token source: local env var ${st.tokenEnv} (read dynamically, never saved or pushed); repo lives in ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3975
|
+
)
|
|
3976
|
+
}
|
|
3977
|
+
if (st.tokenSource === 'git-credential') {
|
|
3978
|
+
return M(
|
|
3979
|
+
`令牌来源:本机 git 凭据(仅内存使用,不落盘、绝不推送进同步仓库);仓库记在 ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3980
|
+
`Token source: local git credential (memory only, never saved or pushed); repo lives in ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3981
|
+
)
|
|
3982
|
+
}
|
|
3983
|
+
if (st.tokenSource === 'gh-cli') {
|
|
3984
|
+
return M(
|
|
3985
|
+
`令牌来源:本机 GitHub CLI(gh auth token,仅内存使用,不落盘、绝不推送进同步仓库);仓库记在 ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3986
|
+
`Token source: local GitHub CLI (gh auth token, memory only, never saved or pushed); repo lives in ${st.ghFile || 'config-sync-gh.json'}`,
|
|
3987
|
+
)
|
|
3988
|
+
}
|
|
3989
|
+
if (st.tokenSaved) {
|
|
3990
|
+
return M(
|
|
3991
|
+
`令牌/仓库记在 ${st.ghFile || 'config-sync-gh.json'}(本机私有,绝不推送进同步仓库;也可改用 $GITHUB_TOKEN)`,
|
|
3992
|
+
`Token and repo live in ${st.ghFile || 'config-sync-gh.json'} (local only, never pushed; or switch to $GITHUB_TOKEN)`,
|
|
3993
|
+
)
|
|
3994
|
+
}
|
|
3995
|
+
return M(
|
|
3996
|
+
`支持读取本机环境变量(DSH_CONFIG_SYNC_GH_TOKEN / GITHUB_TOKEN / GH_TOKEN);只存仓库与变量名于 ${st.ghFile || 'config-sync-gh.json'}(绝不推送令牌)`,
|
|
3997
|
+
`Supports local env vars (DSH_CONFIG_SYNC_GH_TOKEN / GITHUB_TOKEN / GH_TOKEN); only repo/var name live in ${st.ghFile || 'config-sync-gh.json'} (tokens never pushed)`,
|
|
3998
|
+
)
|
|
3999
|
+
}
|
|
4000
|
+
|
|
3586
4001
|
return h('div', { style: S.card },
|
|
3587
4002
|
h('div', { style: S.cardHead },
|
|
3588
4003
|
h('div', { style: S.cardTitle }, M('问题反馈', 'Feedback')),
|
|
3589
4004
|
h('div', { style: { flex: 1 } }, null),
|
|
3590
4005
|
h('span', { style: S.chip }, M(`${open} 待处理 / 共 ${total}`, `${open} open / ${total} total`)),
|
|
3591
|
-
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
4006
|
+
h('button', { type: 'button', style: S.btn, disabled: busy, onClick: () => load(true) }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
|
|
3592
4007
|
),
|
|
3593
4008
|
h('div', { style: S.kvRow },
|
|
3594
4009
|
h('div', { style: S.kvKey }, M('连接', 'Connect')),
|
|
3595
4010
|
h('div', { style: S.kvVal },
|
|
3596
4011
|
h('div', null,
|
|
3597
|
-
dot(st.canClose ? 'var(--dsw-alias-state-success-primary, #35a854)' : (st.items.length ? 'var(--dsw-alias-state-
|
|
3598
|
-
st.canClose
|
|
4012
|
+
dot(st.canClose && st.connected ? 'var(--dsw-alias-state-success-primary, #35a854)' : ((st.items.length || st.tokenPresent) ? 'var(--dsw-alias-state-warn-primary, #d97706)' : 'var(--dsw-alias-state-error-primary)')),
|
|
4013
|
+
st.canClose && st.connected
|
|
3599
4014
|
? M(`GitHub ${st.repo} · 已用 ${st.login} 登录(可提交、可关单)`, `GitHub ${st.repo} · signed in as ${st.login} (can submit and close)`)
|
|
3600
4015
|
: st.connected
|
|
3601
4016
|
? M(`GitHub ${st.repo} · 令牌属于 ${st.login || '?'},不是仓库所有者,只能读和提交`, `GitHub ${st.repo} · token belongs to ${st.login || '?'}, not the repo owner: read and submit only`)
|
|
3602
4017
|
: st.readAnon
|
|
3603
4018
|
? M(`GitHub ${st.repo} · 匿名读取(公开仓库,不需要令牌;提交走浏览器)`, `GitHub ${st.repo} · anonymous read (public repo, no token; submit via browser)`)
|
|
3604
|
-
:
|
|
4019
|
+
: st.tokenPresent
|
|
4020
|
+
? M(`GitHub ${st.repo || st.defaultRepo || 'huanyu-a/dsh-profile-config-sync'} · 已读取本机令牌${st.login ? `(${st.login})` : ''},但连不上 GitHub API(请检查网络/代理)`, `GitHub ${st.repo || st.defaultRepo || 'huanyu-a/dsh-profile-config-sync'} · local token loaded${st.login ? ` (${st.login})` : ''}, but cannot reach GitHub API (check network/proxy)`)
|
|
4021
|
+
: M('还没连上 GitHub(令牌没取到或网络不通)', 'Not connected to GitHub (no token or no network)'),
|
|
3605
4022
|
),
|
|
3606
|
-
h('div', { style: S.footnote },
|
|
3607
|
-
st.note || (st.ghFile ? M(`令牌/仓库记在 ${st.ghFile}(本机私有,不进仓库)`, `Token and repo live in ${st.ghFile} (local only, never committed)`) : null)),
|
|
4023
|
+
h('div', { style: S.footnote }, tokenSourceHint()),
|
|
3608
4024
|
),
|
|
3609
4025
|
),
|
|
3610
|
-
(askToken || !st.connected)
|
|
3611
|
-
? h('div', { style:
|
|
3612
|
-
h('div', { style: S.
|
|
3613
|
-
|
|
3614
|
-
h('
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
4026
|
+
(askToken || (!st.connected && !st.tokenPresent))
|
|
4027
|
+
? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
|
|
4028
|
+
h('div', { style: S.kvRow },
|
|
4029
|
+
h('div', { style: S.kvKey }, M('仓库', 'Repo')),
|
|
4030
|
+
h('div', { style: { ...S.kvVal, display: 'flex', gap: '8px', alignItems: 'center' } },
|
|
4031
|
+
h('input', {
|
|
4032
|
+
type: 'text', style: S.input, value: repoInput, spellCheck: false,
|
|
4033
|
+
placeholder: st.defaultRepo || 'huanyu-a/dsh-profile-config-sync',
|
|
4034
|
+
onChange: (e) => setRepoInput(e.target.value),
|
|
4035
|
+
}),
|
|
4036
|
+
st.defaultRepo && repoInput.trim() !== st.defaultRepo
|
|
4037
|
+
? h('button', {
|
|
4038
|
+
type: 'button', style: S.btn, disabled: busy,
|
|
4039
|
+
onClick: () => { setRepoInput(st.defaultRepo); saveToken({ repo: st.defaultRepo }) },
|
|
4040
|
+
}, M(`改用 ${st.defaultRepo}`, `Use ${st.defaultRepo}`))
|
|
4041
|
+
: null,
|
|
4042
|
+
),
|
|
4043
|
+
),
|
|
4044
|
+
h('div', { style: S.kvRow },
|
|
4045
|
+
h('div', { style: S.kvKey }, M('令牌', 'Token')),
|
|
4046
|
+
h('div', { style: { ...S.kvVal, display: 'flex', flexDirection: 'column', gap: '6px' } },
|
|
4047
|
+
h('div', { style: { display: 'flex', gap: '8px' } },
|
|
4048
|
+
h('input', {
|
|
4049
|
+
type: 'password', style: S.input, value: token, spellCheck: false, autoComplete: 'off',
|
|
4050
|
+
placeholder: M('填 $GITHUB_TOKEN / env:GH_TOKEN 读环境变量,或粘贴令牌(留空也可只改仓库)', 'Enter $GITHUB_TOKEN / env:GH_TOKEN for env var, or paste a token'),
|
|
4051
|
+
onChange: (e) => setToken(e.target.value),
|
|
4052
|
+
}),
|
|
4053
|
+
h('button', {
|
|
4054
|
+
type: 'button', style: S.btnPrimary,
|
|
4055
|
+
disabled: busy || (!token.trim() && repoInput.trim() === String(st.repo || '')),
|
|
4056
|
+
onClick: () => saveToken(),
|
|
4057
|
+
}, M('保存', 'Save')),
|
|
4058
|
+
),
|
|
4059
|
+
h('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap', alignItems: 'center' } },
|
|
4060
|
+
...(Array.isArray(st.envCandidates) ? st.envCandidates : []).map((envName) => h('button', {
|
|
4061
|
+
key: envName, type: 'button', style: S.btn, disabled: busy,
|
|
4062
|
+
onClick: () => saveToken({ tokenEnv: envName }),
|
|
4063
|
+
}, M(`使用环境变量 ${envName}`, `Use env ${envName}`))),
|
|
4064
|
+
st.tokenSaved
|
|
4065
|
+
? h('button', {
|
|
4066
|
+
type: 'button', style: S.btn, disabled: busy,
|
|
4067
|
+
onClick: () => saveToken({ clearToken: true }),
|
|
4068
|
+
}, M('清除已存令牌(改用环境变量)', 'Clear saved token (use env)'))
|
|
4069
|
+
: null,
|
|
4070
|
+
),
|
|
4071
|
+
),
|
|
3620
4072
|
),
|
|
3621
4073
|
)
|
|
3622
4074
|
: null,
|
|
@@ -3753,7 +4205,7 @@ window.__ModuleLoader__.load({
|
|
|
3753
4205
|
|
|
3754
4206
|
const head = h('div', { style: S.head },
|
|
3755
4207
|
h('div', { style: S.headText },
|
|
3756
|
-
h('div', { style: S.title }, M('
|
|
4208
|
+
h('div', { style: S.title }, M('配置备份与同步', 'Config Backup & Sync')),
|
|
3757
4209
|
h('div', { style: S.sub }, busy ? M('检测中…', 'Checking…') : summary.text),
|
|
3758
4210
|
data ? h('div', { style: S.sub }, `app ${data.version.local || '?'} / ${M('契约', 'contract')} ${data.version.contract || '?'}`) : null,
|
|
3759
4211
|
),
|
|
@@ -3896,7 +4348,7 @@ window.__ModuleLoader__.load({
|
|
|
3896
4348
|
method: 'POST',
|
|
3897
4349
|
cache: 'no-store',
|
|
3898
4350
|
credentials: 'same-origin',
|
|
3899
|
-
headers: jsonHeaders,
|
|
4351
|
+
headers: jsonHeaders(),
|
|
3900
4352
|
body: JSON.stringify({ action: 'busy', sessionId: sessionId || '' }),
|
|
3901
4353
|
})
|
|
3902
4354
|
if (!res.ok) return false
|
|
@@ -3947,7 +4399,7 @@ window.__ModuleLoader__.load({
|
|
|
3947
4399
|
name: 'sidebar.panellist',
|
|
3948
4400
|
id: PANEL_ID,
|
|
3949
4401
|
order: 35,
|
|
3950
|
-
label: () => M('
|
|
4402
|
+
label: () => M('配置备份与同步', 'Config Backup & Sync'),
|
|
3951
4403
|
locale: 'config-sync',
|
|
3952
4404
|
}, SidebarIcon)
|
|
3953
4405
|
return () => {
|