dsh-config-manager 0.4.1 → 0.4.3

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.
Files changed (131) hide show
  1. package/README.md +14 -0
  2. package/lib/cli/actions.js +2 -3
  3. package/lib/cli/import-source.js +2 -6
  4. package/lib/cli/index.js +2 -3
  5. package/lib/client.d.ts +5 -5
  6. package/lib/client.js +26250 -25872
  7. package/lib/core/access-mode.d.ts +25 -0
  8. package/lib/core/access-mode.js +28 -0
  9. package/lib/core/exporter.js +2 -4
  10. package/lib/core/host-schedulers/cache-cleanup.d.ts +41 -0
  11. package/lib/core/host-schedulers/cache-cleanup.js +45 -0
  12. package/lib/core/host-schedulers/lifecycle-hooks.d.ts +51 -0
  13. package/lib/core/host-schedulers/lifecycle-hooks.js +78 -0
  14. package/lib/core/host-schedulers/market-cache.d.ts +40 -0
  15. package/lib/core/host-schedulers/market-cache.js +92 -0
  16. package/lib/core/model-tools.js +2 -6
  17. package/lib/core/restore.d.ts +0 -2
  18. package/lib/core/restore.js +16 -18
  19. package/lib/core/verify-recovery.js +4 -7
  20. package/lib/index.d.ts +3 -22
  21. package/lib/index.js +74 -330
  22. package/lib/profiles/dsh-profile-manager.d.ts +23 -1
  23. package/lib/profiles/dsh-profile-manager.js +70 -2
  24. package/lib/routes/kit.d.ts +61 -1
  25. package/lib/routes/kit.js +72 -3
  26. package/lib/routes/prefs.js +6 -6
  27. package/lib/routes/recovery.js +25 -41
  28. package/lib/routes/request-trust.d.ts +28 -0
  29. package/lib/routes/request-trust.js +65 -0
  30. package/lib/routes/route-support.d.ts +23 -1
  31. package/lib/routes/route-support.js +185 -0
  32. package/lib/routes/snapshots.js +4 -11
  33. package/lib/routes/sync.js +5 -7
  34. package/lib/security/redaction.d.ts +5 -1
  35. package/lib/security/redaction.js +26 -23
  36. package/lib/sync/backup-scheduler.js +2 -6
  37. package/lib/ui/backup-inspect.d.ts +1 -1
  38. package/lib/ui/dsh-profiles-view.d.ts +0 -10
  39. package/lib/ui/dsh-profiles-view.js +3 -7
  40. package/lib/ui/snapshots-view.d.ts +0 -14
  41. package/lib/ui/snapshots-view.js +16 -2
  42. package/lib/utils/paths.d.ts +20 -4
  43. package/lib/utils/paths.js +22 -6
  44. package/lib/utils/time.d.ts +31 -0
  45. package/lib/utils/time.js +54 -0
  46. package/package.json +1 -1
  47. package/src/cli/actions.ts +2 -3
  48. package/src/cli/import-source.ts +2 -7
  49. package/src/cli/index.ts +2 -3
  50. package/src/client/about/AboutPanel.tsx +8 -1
  51. package/src/client/about/ReleaseBody.tsx +22 -52
  52. package/src/client/about/ReleaseNotesDialog.tsx +15 -69
  53. package/src/client/about/release-notes-view.ts +4 -11
  54. package/src/client/common/access-mode.ts +21 -0
  55. package/src/client/common/info-hint-guard.test.ts +11 -5
  56. package/src/client/common/ui.tsx +23 -0
  57. package/src/client/config-manager.module.css +201 -32
  58. package/src/client/css-token-guard.test.ts +135 -1
  59. package/src/client/home/HomePanel.tsx +31 -6
  60. package/src/client/import/ConflictList.tsx +3 -3
  61. package/src/client/import/ImportWizardView.tsx +1 -1
  62. package/src/client/library/ArtifactRow.tsx +2 -2
  63. package/src/client/library/RestorePlanView.tsx +21 -9
  64. package/src/client/library/report-dismiss.test.ts +5 -3
  65. package/src/client/locales/about.ts +103 -0
  66. package/src/client/locales/backup.ts +141 -0
  67. package/src/client/locales/common.ts +113 -0
  68. package/src/client/locales/export.ts +184 -0
  69. package/src/client/locales/foreign.ts +184 -0
  70. package/src/client/locales/import-compat.ts +32 -0
  71. package/src/client/locales/import.ts +192 -0
  72. package/src/client/locales/next-steps.ts +25 -0
  73. package/src/client/locales/overview-control.ts +32 -0
  74. package/src/client/locales/overview.ts +153 -0
  75. package/src/client/locales/profiles.ts +263 -0
  76. package/src/client/locales/report.ts +17 -0
  77. package/src/client/locales/restore.ts +132 -0
  78. package/src/client/locales/sessions.ts +257 -0
  79. package/src/client/locales/shell.ts +149 -0
  80. package/src/client/locales.ts +49 -1783
  81. package/src/client/market/MarketImportReview.tsx +2 -2
  82. package/src/client/market/MarketPanel.tsx +1 -1
  83. package/src/client/market/market-view.ts +3 -5
  84. package/src/client/recovery/RecoveryPanel.tsx +62 -1054
  85. package/src/client/recovery/SessionHealthCard.tsx +134 -0
  86. package/src/client/recovery/SessionHealthDialog.tsx +665 -0
  87. package/src/client/recovery/SessionLayoutSection.tsx +284 -0
  88. package/src/client/recovery/recovery-api.ts +10 -1
  89. package/src/client/recovery/recovery-panel-layout.test.ts +20 -5
  90. package/src/client/recovery/session-dialog-mount.test.ts +16 -9
  91. package/src/client/recovery/use-recovery-write.test.ts +90 -0
  92. package/src/client/recovery/use-recovery-write.ts +53 -0
  93. package/src/client/run-store.ts +57 -2
  94. package/src/client/sync/PushPreviewCard.tsx +2 -2
  95. package/src/client/sync/SyncConfirmView.tsx +5 -5
  96. package/src/client/sync/SyncLogList.tsx +2 -2
  97. package/src/client/sync/history-model.ts +4 -5
  98. package/src/client/sync/sync-view.ts +3 -4
  99. package/src/core/access-mode.ts +37 -0
  100. package/src/core/exporter.ts +2 -4
  101. package/src/core/host-schedulers/cache-cleanup.test.ts +84 -0
  102. package/src/core/host-schedulers/cache-cleanup.ts +74 -0
  103. package/src/core/host-schedulers/lifecycle-hooks.test.ts +111 -0
  104. package/src/core/host-schedulers/lifecycle-hooks.ts +118 -0
  105. package/src/core/host-schedulers/market-cache.test.ts +93 -0
  106. package/src/core/host-schedulers/market-cache.ts +116 -0
  107. package/src/core/model-tools.ts +2 -7
  108. package/src/core/restore-failure-state.test.ts +210 -0
  109. package/src/core/restore.ts +16 -18
  110. package/src/core/verify-recovery.ts +4 -7
  111. package/src/index.ts +81 -335
  112. package/src/profiles/dsh-profile-copy-rollback.test.ts +156 -0
  113. package/src/profiles/dsh-profile-manager.ts +71 -3
  114. package/src/routes/kit.ts +106 -3
  115. package/src/routes/prefs.ts +6 -6
  116. package/src/routes/recovery.ts +25 -42
  117. package/src/routes/request-trust.ts +97 -0
  118. package/src/routes/route-support.ts +208 -1
  119. package/src/routes/snapshots.ts +4 -9
  120. package/src/routes/sync.ts +4 -7
  121. package/src/security/redaction.ts +29 -23
  122. package/src/sync/backup-scheduler.ts +3 -6
  123. package/src/sync/sync-config.test.ts +24 -13
  124. package/src/ui/backup-inspect.ts +1 -1
  125. package/src/ui/dsh-profiles-view.ts +3 -5
  126. package/src/ui/i18n.test.ts +8 -3
  127. package/src/ui/snapshots-view.ts +2 -2
  128. package/src/utils/paths.test.ts +36 -1
  129. package/src/utils/paths.ts +30 -6
  130. package/src/utils/time.test.ts +46 -0
  131. package/src/utils/time.ts +55 -0
@@ -34,6 +34,7 @@ import {
34
34
  import { EnvironmentLockManager, OWNERSHIP_FILE } from '../utils/env-lock.ts'
35
35
  import { scanSessionHealth, type SessionHealthScanResult } from '../utils/session-health-scan.ts'
36
36
  import type { SessionVerifyResult } from '../utils/session-verify.ts'
37
+ import { formatDateStamp } from '../utils/time.ts'
37
38
 
38
39
  /* ------------------------------------------------------------ 进程/实例事实 */
39
40
 
@@ -1352,9 +1353,7 @@ export async function exportOfflineBackup(
1352
1353
  if (collection.entries.length === 0) {
1353
1354
  return { ok: false, code: 'nothing-to-export', message: '没有可打包的内容(该 home 下未找到可离线收集的分区)。' }
1354
1355
  }
1355
- const now = new Date()
1356
- const stamp = String(now.getFullYear()) + String(now.getMonth() + 1).padStart(2, '0') + String(now.getDate()).padStart(2, '0')
1357
- + '-' + String(now.getHours()).padStart(2, '0') + String(now.getMinutes()).padStart(2, '0') + String(now.getSeconds()).padStart(2, '0')
1356
+ const stamp = formatDateStamp()
1358
1357
  const { randomBytes } = await import('node:crypto')
1359
1358
  const desired = 'dsh-config-cli-' + stamp + '-' + randomBytes(4).toString('hex') + '.zip'
1360
1359
  await fsp.mkdir(paths.exportsDir, { recursive: true })
@@ -29,6 +29,7 @@ import { foreignSourceContext } from '../routes/foreign-context.ts';
29
29
  import type { ForeignSourceContext, ForeignSourceDetection } from '../foreign/registry.ts';
30
30
  import type { ForeignImportResult } from '../foreign/types.ts';
31
31
  import type { Platform } from '../schema/types.ts';
32
+ import { formatDateStamp } from '../utils/time.ts';
32
33
 
33
34
  /** CLI 侧只依赖这个最小 IO 形状(与 src/cli/index.ts 的 CliIo 结构等价,避免循环 import) */
34
35
  export interface ImportIo {
@@ -110,7 +111,7 @@ function printImportSummary(
110
111
  async function resolveOutPath(options: ImportSourceOptions, sourceId: string): Promise<string> {
111
112
  const desired = options.out !== undefined && options.out !== ''
112
113
  ? path.resolve(options.out)
113
- : path.join(options.exportsDir, 'foreign-' + sourceId + '-' + stamp() + '-' + randomHex4() + '.zip');
114
+ : path.join(options.exportsDir, 'foreign-' + sourceId + '-' + formatDateStamp() + '-' + randomHex4() + '.zip');
114
115
  if (!(await pathExists(desired))) return desired;
115
116
  const base = desired.endsWith('.zip') ? desired.slice(0, -4) : desired;
116
117
  for (let i = 1; ; i += 1) {
@@ -119,12 +120,6 @@ async function resolveOutPath(options: ImportSourceOptions, sourceId: string): P
119
120
  }
120
121
  }
121
122
 
122
- function stamp(): string {
123
- const now = new Date();
124
- return `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}`
125
- + `-${String(now.getHours()).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}${String(now.getSeconds()).padStart(2, '0')}`;
126
- }
127
-
128
123
  function randomHex4(): string {
129
124
  // 用全局 crypto(Node ≥ 19);零额外依赖
130
125
  const bytes = new Uint8Array(4);
package/src/cli/index.ts CHANGED
@@ -54,6 +54,7 @@ import { stringifyJsonSafe } from '../utils/json.ts';
54
54
  import { buildManifest, CHECKSUMS_FILE, MANIFEST_FILE } from '../schema/manifest.ts';
55
55
  import { writeZip } from '../utils/zip.ts';
56
56
  import type { Manifest, SectionId } from '../schema/types.ts';
57
+ import { formatDateStamp } from '../utils/time.ts';
57
58
 
58
59
  /* ------------------------------------------------------------ 参数解析(纯函数) */
59
60
 
@@ -1354,9 +1355,7 @@ async function runBackup(
1354
1355
  }
1355
1356
  } else {
1356
1357
  // 注意:此处刻意不 mkdir —— dry-run 必须零写入,目录在真正落盘前才创建
1357
- const now = new Date();
1358
- const stamp = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}`
1359
- + `-${String(now.getHours()).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}${String(now.getSeconds()).padStart(2, '0')}`;
1358
+ const stamp = formatDateStamp();
1360
1359
  try {
1361
1360
  const rand = await randomHex4();
1362
1361
  outPath = await resolveNonCollidingName(exportsDir, `dsh-config-cli-${stamp}-${rand}.zip`);
@@ -133,7 +133,7 @@ export function AboutPanel({ api, t }: AboutPanelProps) {
133
133
  {/* issue #28 诊断位:插件清单实际读的目录 / profile / 识别到的插件数。
134
134
  用于自查「装了插件却没被备份识别到」——此前用户完全无从查看。 */}
135
135
  {state.rows?.diagnostics != null && (
136
- <div className={css.statRow} style={{ flexDirection: 'column', alignItems: 'flex-start', gap: '4px' }}>
136
+ <div className={css.statRow + ' ' + css.statRowStack}>
137
137
  <span className={css.groupLabel}>{t('about.diag.label')} <InfoHint text={t('about.diag.hint')} label={t('common.infoHint')} /></span>
138
138
  <span>{t('about.diag.profileDir', { path: state.rows.diagnostics.profileDir })}</span>
139
139
  <span>{t('about.diag.profile', { profile: state.rows.diagnostics.profile })}</span>
@@ -254,6 +254,13 @@ export function AboutPanel({ api, t }: AboutPanelProps) {
254
254
  </div>
255
255
  </Card>
256
256
 
257
+ {/* issue #126:访问范围(宿主 --host 局域网地址 / 反代 → 页面能开、数据读不到)。
258
+ 放在 CLI 卡之后:两者回答同一个问题「换个入口还能不能用」,用户排查时一起看到。 */}
259
+ <Card>
260
+ <span className={css.groupLabel}>{t('about.access.title')}</span>
261
+ <div className={css.hint}>{t('about.access.hint')}</div>
262
+ </Card>
263
+
257
264
  {/* 版本更新内容弹窗(支持向下无限滚动加载) */}
258
265
  <ReleaseNotesDialog
259
266
  open={releaseNotesOpen}
@@ -58,58 +58,39 @@ function renderInlineMarkdown(text: string) {
58
58
  function MarkdownBlockView({ block }: { block: MarkdownBlock }) {
59
59
  switch (block.type) {
60
60
  case 'heading': {
61
- const headingStyle = {
62
- fontWeight: 600,
63
- color: 'var(--dsw-alias-label-primary)',
64
- marginTop: block.level === 1 ? '12px' : '8px',
65
- marginBottom: '4px',
66
- fontSize: block.level === 1 ? '15px' : block.level === 2 ? '14px' : '13px',
67
- }
68
- return <div style={headingStyle}>{block.text}</div>
61
+ /**
62
+ * 只有字号还留在内联:15/14/13px 三级要靠同一规则表达,而 DESIGN.md §4 的字号 scale
63
+ * 只有 4 档(11/12/12.5/13)—— 把 15/14 写进 CSS 会让 scale-01 直接变红。
64
+ * 这是 css-token-guard 豁免表里唯一一条 release 相关例外(见 TSX_STYLE_WHITELIST)。
65
+ */
66
+ return (
67
+ <div
68
+ className={css.releaseHeading}
69
+ data-level={String(block.level)}
70
+ style={{ fontSize: block.level === 1 ? '15px' : block.level === 2 ? '14px' : '13px' }}
71
+ >
72
+ {block.text}
73
+ </div>
74
+ )
69
75
  }
70
76
  case 'list-item': {
71
77
  return (
72
- <div style={{ display: 'flex', gap: '6px', alignItems: 'flex-start', paddingLeft: '4px' }}>
73
- <span style={{ color: 'var(--dsw-alias-label-tertiary)', userSelect: 'none' }}>
78
+ <div className={css.releaseListItem}>
79
+ <span className={css.releaseBullet}>
74
80
  {block.ordered ? (block.index ?? 1) + '.' : '•'}
75
81
  </span>
76
- <div style={{ flex: 1 }}>{renderInlineMarkdown(block.text)}</div>
82
+ <div className={css.releaseItemBody}>{renderInlineMarkdown(block.text)}</div>
77
83
  </div>
78
84
  )
79
85
  }
80
86
  case 'quote': {
81
- return (
82
- <div
83
- style={{
84
- borderLeft: '3px solid var(--dsw-alias-border-l1)',
85
- paddingLeft: '8px',
86
- color: 'var(--dsw-alias-label-secondary)',
87
- fontStyle: 'italic',
88
- }}
89
- >
90
- {renderInlineMarkdown(block.text)}
91
- </div>
92
- )
87
+ return <div className={css.releaseQuote}>{renderInlineMarkdown(block.text)}</div>
93
88
  }
94
89
  case 'code-block': {
95
- return (
96
- <pre
97
- className={css.cliCommand}
98
- style={{ margin: '4px 0', padding: '8px', fontSize: '12px' }}
99
- >
100
- {block.code}
101
- </pre>
102
- )
90
+ return <pre className={css.cliCommand + ' ' + css.releaseCode}>{block.code}</pre>
103
91
  }
104
92
  case 'hr': {
105
- return (
106
- <div
107
- style={{
108
- borderBottom: '1px solid var(--dsw-alias-border-l2)',
109
- margin: '8px 0',
110
- }}
111
- />
112
- )
93
+ return <div className={css.releaseRule} />
113
94
  }
114
95
  case 'paragraph':
115
96
  default: {
@@ -122,22 +103,11 @@ function MarkdownBlockView({ block }: { block: MarkdownBlock }) {
122
103
  export function ReleaseBody({ body, t }: { body: string; t: TranslateNS<'config-manager'> }) {
123
104
  const blocks = parseMarkdownBlocks(body)
124
105
  return (
125
- <div
126
- style={{
127
- display: 'flex',
128
- flexDirection: 'column',
129
- gap: '6px',
130
- fontSize: '13px',
131
- lineHeight: '1.6',
132
- color: 'var(--dsw-alias-label-primary)',
133
- }}
134
- >
106
+ <div className={css.releaseBody}>
135
107
  {blocks.length > 0 ? (
136
108
  blocks.map((block, idx) => <MarkdownBlockView key={idx} block={block} />)
137
109
  ) : (
138
- <div style={{ color: 'var(--dsw-alias-label-tertiary)', fontStyle: 'italic' }}>
139
- {t('about.releaseNotes.noBody')}
140
- </div>
110
+ <div className={css.releaseEmpty}>{t('about.releaseNotes.noBody')}</div>
141
111
  )}
142
112
  </div>
143
113
  )
@@ -48,37 +48,11 @@ function ReleaseCardView({
48
48
  t: TranslateNS<'config-manager'>
49
49
  }) {
50
50
  return (
51
- <div
52
- style={{
53
- display: 'flex',
54
- flexDirection: 'column',
55
- gap: '8px',
56
- padding: '12px',
57
- background: 'var(--dsw-alias-bg-base)',
58
- border: '1px solid var(--dsw-alias-border-l1)',
59
- borderRadius: '8px',
60
- }}
61
- >
51
+ <div className={css.releaseCard}>
62
52
  {/* 头部:版本号 + 标题 + 徽章 + 日期 + 外链 */}
63
- <div
64
- style={{
65
- display: 'flex',
66
- justifyContent: 'space-between',
67
- alignItems: 'flex-start',
68
- gap: '8px',
69
- flexWrap: 'wrap',
70
- }}
71
- >
72
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' }}>
73
- <span
74
- style={{
75
- fontSize: '14px',
76
- fontWeight: 600,
77
- color: 'var(--dsw-alias-label-primary)',
78
- }}
79
- >
80
- {release.title}
81
- </span>
53
+ <div className={css.releaseCardHead}>
54
+ <div className={css.releaseTitleRow}>
55
+ <span className={css.releaseTitle}>{release.title}</span>
82
56
  {isFirst && !release.isPrerelease && (
83
57
  <Badge kind="ok">{t('about.releaseNotes.latest')}</Badge>
84
58
  )}
@@ -86,14 +60,7 @@ function ReleaseCardView({
86
60
  <Badge kind="warn">{t('about.releaseNotes.prerelease')}</Badge>
87
61
  )}
88
62
  {release.publishedDateStr && (
89
- <span
90
- style={{
91
- fontSize: '12px',
92
- color: 'var(--dsw-alias-label-tertiary)',
93
- }}
94
- >
95
- {release.publishedDateStr}
96
- </span>
63
+ <span className={css.releaseDate}>{release.publishedDateStr}</span>
97
64
  )}
98
65
  </div>
99
66
 
@@ -235,7 +202,10 @@ export function ReleaseNotesDialog({
235
202
  scroll
236
203
  innerRef={bodyRef}
237
204
  onScroll={handleScroll}
238
- style={{ maxHeight: '65vh', gap: '12px' }}
205
+ /* maxHeight 走内联:Modal.Body 只暴露 style(common/Modal.tsx 不在本次改动范围),
206
+ 而 65vh 是「让无限滚动有界」的布局值,不属 DESIGN.md 的节奏 scale。
207
+ 原 gap: '12px' 一并去掉 —— .dialogBody 不是 flex/grid 容器,gap 从来没有生效过。 */
208
+ style={{ maxHeight: '65vh' }}
239
209
  >
240
210
  {loading && (
241
211
  <div>
@@ -248,7 +218,7 @@ export function ReleaseNotesDialog({
248
218
  <div>
249
219
  {/* G-04:release notes 的错误文本来自 GitHub 状态/网络响应 —— 展示前统一过 redact */}
250
220
  <Banner kind="error">{redact(error)}</Banner>
251
- <div className={css.actionRow} style={{ marginTop: '8px' }}>
221
+ <div className={css.actionRow + ' ' + css.actionRowSpaced}>
252
222
  <Button onClick={() => { void loadFirstPage() }}>
253
223
  {t('about.releaseNotes.retry')}
254
224
  </Button>
@@ -260,9 +230,7 @@ export function ReleaseNotesDialog({
260
230
  )}
261
231
 
262
232
  {!loading && error === null && releases.length === 0 && (
263
- <div style={{ padding: '20px 0', textAlign: 'center', color: 'var(--dsw-alias-label-secondary)' }}>
264
- {t('about.releaseNotes.empty')}
265
- </div>
233
+ <div className={css.releaseNotesEmpty}>{t('about.releaseNotes.empty')}</div>
266
234
  )}
267
235
 
268
236
  {!loading &&
@@ -276,42 +244,20 @@ export function ReleaseNotesDialog({
276
244
  ))}
277
245
 
278
246
  {loadingMore && (
279
- <div style={{ padding: '12px 0', display: 'flex', justifyContent: 'center' }}>
247
+ <div className={css.releaseNotesLoadingMore}>
280
248
  <Spinner label={t('about.releaseNotes.loadingMore')} />
281
249
  </div>
282
250
  )}
283
251
 
284
252
  {!loading && !loadingMore && !hasMore && releases.length > 0 && (
285
- <div
286
- style={{
287
- textAlign: 'center',
288
- padding: '8px 0',
289
- fontSize: '12px',
290
- color: 'var(--dsw-alias-label-tertiary)',
291
- }}
292
- >
293
- {t('about.releaseNotes.allLoaded')}
294
- </div>
253
+ <div className={css.releaseNotesAllLoaded}>{t('about.releaseNotes.allLoaded')}</div>
295
254
  )}
296
255
  </Modal.Body>
297
256
 
298
257
  {/* 底部按钮区 */}
299
- <div
300
- className={css.actionRow}
301
- style={{
302
- justifyContent: 'space-between',
303
- alignItems: 'center',
304
- borderTop: '1px solid var(--dsw-alias-border-l1)',
305
- paddingTop: '10px',
306
- paddingBottom: '14px',
307
- paddingLeft: '16px',
308
- paddingRight: '16px',
309
- flexWrap: 'wrap',
310
- gap: '8px',
311
- }}
312
- >
258
+ <div className={css.actionRow + ' ' + css.releaseNotesFoot}>
313
259
  <Button href={releasesPageUrl}>{t('about.releaseNotes.viewOnGithub')}</Button>
314
- <div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
260
+ <div className={css.releaseNotesFootActions}>
315
261
  <Button onClick={handleNeverShow}>
316
262
  {t('about.releaseNotes.neverShow')}
317
263
  </Button>
@@ -9,6 +9,7 @@
9
9
  * - 轻量级安全 Markdown 分块解析器(纯文本结构化,零 dangerouslySetInnerHTML / 零 XSS 风险)
10
10
  */
11
11
  import type { TranslateNS } from '../client-types.ts';
12
+ import { formatDateOnly, parseDateInput } from '../../utils/time.ts';
12
13
 
13
14
  export interface GitHubReleaseRaw {
14
15
  id?: number;
@@ -76,20 +77,12 @@ export function deriveReleasesUrl(repoUrl: string): string {
76
77
  }
77
78
 
78
79
  /**
79
- * 格式化 ISO 日期为可读字符串(YYYY-MM-DD)。
80
+ * 格式化 ISO 日期为可读字符串(YYYY-MM-DD);缺失 = 空串、非法输入原样回显。
80
81
  */
81
82
  export function formatReleaseDate(isoDate: string | null | undefined): string {
82
83
  if (!isoDate || typeof isoDate !== 'string') return '';
83
- try {
84
- const d = new Date(isoDate);
85
- if (isNaN(d.getTime())) return isoDate;
86
- const y = d.getFullYear();
87
- const m = String(d.getMonth() + 1).padStart(2, '0');
88
- const day = String(d.getDate()).padStart(2, '0');
89
- return `${y}-${m}-${day}`;
90
- } catch {
91
- return isoDate;
92
- }
84
+ const d = parseDateInput(isoDate);
85
+ return d === null ? isoDate : formatDateOnly(d);
93
86
  }
94
87
 
95
88
  /**
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 「访问方式」类拒绝的识别(issue #126)。
3
+ *
4
+ * 背景:宿主以 --host 10.0.0.10 起 dsh web 后,从局域网打开内嵌面板时每条只读请求都被围栏
5
+ * 拒掉。改造前客户端只能把这条 403 当普通错误显示成「有 N 项数据读取失败」+ 一个点了没用的
6
+ * 「重试」—— 用户据此会以为数据坏了。
7
+ *
8
+ * 判据(两条并存,缺一不可):
9
+ * 1. 宿主给的新机器码(src/core/access-mode.ts,与围栏同一份字面量);
10
+ * 2. 旧宿主(< 本修复)没有 code,只有 'forbidden: loopback-only' 文案 —— 用文案兜底识别,
11
+ * 这样升级插件但没升级 DSH 的用户也能看到正确解释。
12
+ */
13
+ import { isAccessModeCode } from '../../core/access-mode.ts'
14
+ import { ConfigManagerApiError } from './http.ts'
15
+
16
+ /** 该错误是否属于「当前访问方式不受支持」(不是数据问题,重试也没用)。 */
17
+ export function isAccessModeError(error: unknown): boolean {
18
+ if (!(error instanceof ConfigManagerApiError)) return false
19
+ if (isAccessModeCode(error.code)) return true
20
+ return error.status === 403 && /loopback-only/i.test(error.message)
21
+ }
@@ -139,7 +139,7 @@ const MOVE_PINS: readonly MovePin[] = [
139
139
  { key: 'profiles.create.hint', file: 'src/client/environment/EnvironmentPanel.tsx', kind: '机制' },
140
140
  { key: 'profiles.list.hint', file: 'src/client/environment/EnvironmentPanel.tsx', kind: '省事提示' },
141
141
  // t5:recovery/
142
- { key: 'sessions.desc', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '机制' },
142
+ { key: 'sessions.desc', file: 'src/client/recovery/SessionHealthCard.tsx', kind: '机制' },
143
143
  { key: 'recovery.preview.hint', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '机制' },
144
144
  // t7(2026-10-12 用户要求「所有描述都收进 ⓘ」):页级 / 分区级副标题 + 卡片 / 字段说明。
145
145
  // 判定口径见 DESIGN.md §7(本次把原 KEEP-2 的**静态安全说明**与 KEEP-7 的**静态副标题**一并纳入 MOVE;
@@ -171,9 +171,9 @@ const MOVE_PINS: readonly MovePin[] = [
171
171
  { key: 'snapshots.selectHint', file: 'src/client/library/LibraryActions.tsx', kind: '省事提示' },
172
172
  { key: 'diskUsage.clean.hint', file: 'src/client/environment/maintenance/DiskUsageCard.tsx', kind: '边界' },
173
173
  { key: 'recovery.safeMode.detail', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '机制' },
174
- { key: 'sessions.repair.desc', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '机制' },
174
+ { key: 'sessions.repair.desc', file: 'src/client/recovery/SessionHealthDialog.tsx', kind: '机制' },
175
175
  { key: 'recovery.rescue.desc', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '机制' },
176
- { key: 'sessions.layout.planReadOnly', file: 'src/client/recovery/RecoveryPanel.tsx', kind: '边界' },
176
+ { key: 'sessions.layout.planReadOnly', file: 'src/client/recovery/SessionLayoutSection.tsx', kind: '边界' },
177
177
  { key: 'recovery.incomplete.hint', file: 'src/client/recovery/IncompleteCopiesSection.tsx', kind: '机制' },
178
178
  { key: 'repoPicker.privateOnly', file: 'src/client/sync/SyncRepositoryPicker.tsx', kind: '输入规则' },
179
179
  { key: 'config.tokenHint', file: 'src/client/sync/ChannelConfigDialog.tsx', kind: '输入规则' },
@@ -250,9 +250,15 @@ const HINT_CALL_RE = /<InfoHint\b[\s\S]*?\/>/g;
250
250
  const CANON_ZH = '查看说明';
251
251
  const CANON_EN = 'Show description';
252
252
 
253
- /** 必须带该键的命名空间字典(出现 ⓘ 调用点的命名空间;history 零 MOVE,不参与)。 */
253
+ /**
254
+ * 必须带该键的命名空间字典(出现 ⓘ 调用点的命名空间;history 零 MOVE,不参与)。
255
+ *
256
+ * tech-debt #22(2026-11 字典按域拆分):`common.infoHint` 在原文里物理位于「会话归位」段
257
+ * (HEAD:src/client/locales.ts:715),拆完落在 `src/client/locales/sessions.ts`;聚合器
258
+ * `src/client/locales.ts` 只剩展开语句,不再含任何键字面量。
259
+ */
254
260
  const INFO_HINT_DICTS: readonly string[] = [
255
- 'src/client/locales.ts',
261
+ 'src/client/locales/sessions.ts',
256
262
  'src/client/market/market-locales.ts',
257
263
  'src/client/sync/sync-locales.ts',
258
264
  'src/client/recovery/recovery-locales.ts',
@@ -216,6 +216,29 @@ export function Badge({ kind = 'info', children, title }: BadgeProps) {
216
216
  return <span className={css.badge} data-kind={kind} title={title}>{children}</span>
217
217
  }
218
218
 
219
+ /* ---------------- Chip ---------------- */
220
+
221
+ export interface ChipProps {
222
+ children: ReactNode
223
+ /** 悬停提示(可选) */
224
+ title?: string
225
+ }
226
+
227
+ /**
228
+ * 中性分类片:**没有状态语义**的短标签(来源 / 形态 / 适配器 / 分区数)。
229
+ *
230
+ * 为什么不复用 `<Badge>`:Badge 的 kind 是四态**语义**(info/ok/warn/error),
231
+ * 传一个「中性」进去会逼着 `src/ui/badge-tone.ts` 再造第五档,四态表立刻失去
232
+ * 「一档一义」的约束;而这里要表达的是「分类,不分轻重」。所以拆成独立组件:
233
+ * - Badge = 状态(颜色编码,四态唯一来源)
234
+ * - Chip = 分类(中性灰底,与 Badge 同盒模型基线)
235
+ * 盒模型由 `.chip` 与 `.badge` 逐字对齐保证(同高 19px / 同药丸圆角 / 同 11px 字号),
236
+ * 差别只在色调 —— 同屏混排时它们读起来是「同一套小片子的两种用法」。
237
+ */
238
+ export function Chip({ children, title }: ChipProps) {
239
+ return <span className={css.chip} title={title}>{children}</span>
240
+ }
241
+
219
242
  /* ---------------- Banner ---------------- */
220
243
 
221
244
  export type BannerKind = 'ok' | 'error' | 'info' | 'warn'