dsh-config-manager 0.1.25 → 0.1.26

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/lib/client.d.ts CHANGED
@@ -472,6 +472,9 @@ declare const uiZh: {
472
472
  readonly 'sync.interval.6h': "6 小时";
473
473
  readonly 'sync.interval.12h': "12 小时";
474
474
  readonly 'sync.interval.24h': "24 小时";
475
+ readonly 'sync.duration.min': "{n} 分钟";
476
+ readonly 'sync.duration.hour': "{n} 小时";
477
+ readonly 'sync.duration.day': "{n} 天";
475
478
  readonly 'sync.hist.autosync': "自动同步";
476
479
  readonly 'sync.hist.directionPull': "下载";
477
480
  readonly 'sync.hist.directionPush': "上传";
@@ -1097,6 +1100,7 @@ declare const zh: {
1097
1100
  readonly 'autosync.status': "上次运行:{status}({time})";
1098
1101
  readonly 'autosync.statusNever': "从未运行";
1099
1102
  readonly 'autosync.nextRun': "下次约 {time} 后";
1103
+ readonly 'autosync.due': "已到同步时间,即将执行";
1100
1104
  readonly 'autosync.failCount': "连续失败 {n} 次";
1101
1105
  readonly 'autosync.running': "自动同步进行中…";
1102
1106
  readonly 'autosync.success': "成功";
package/lib/client.js CHANGED
@@ -211,6 +211,9 @@ const uiZh = {
211
211
  "sync.interval.6h": "6 小时",
212
212
  "sync.interval.12h": "12 小时",
213
213
  "sync.interval.24h": "24 小时",
214
+ "sync.duration.min": "{n} 分钟",
215
+ "sync.duration.hour": "{n} 小时",
216
+ "sync.duration.day": "{n} 天",
214
217
  "sync.hist.autosync": "自动同步",
215
218
  "sync.hist.directionPull": "下载",
216
219
  "sync.hist.directionPush": "上传",
@@ -430,6 +433,9 @@ const uiEn = {
430
433
  "sync.interval.6h": "6 hr",
431
434
  "sync.interval.12h": "12 hr",
432
435
  "sync.interval.24h": "24 hr",
436
+ "sync.duration.min": "{n} min",
437
+ "sync.duration.hour": "{n} hr",
438
+ "sync.duration.day": "{n} day",
433
439
  "sync.hist.autosync": "Auto Sync",
434
440
  "sync.hist.directionPull": "Pull",
435
441
  "sync.hist.directionPush": "Push",
@@ -2075,108 +2081,108 @@ if (typeof document !== "undefined" && document.querySelector("style[data-tag=\"
2075
2081
  document.head.appendChild(tag);
2076
2082
  }
2077
2083
  var config_manager_module_css_default = {
2078
- "warnList": "_367UGW_warnList",
2079
- "progressIndeterminate": "_367UGW_progressIndeterminate",
2080
- "sectionSubtitle": "_367UGW_sectionSubtitle",
2081
- "groupNote": "_367UGW_groupNote",
2082
- "conflictItem": "_367UGW_conflictItem",
2083
- "badgeWarn": "_367UGW_badgeWarn",
2084
- "progressBadge": "_367UGW_progressBadge",
2085
- "conflictOptions": "_367UGW_conflictOptions",
2086
- "pathOld": "_367UGW_pathOld",
2087
- "pathIssueKind": "_367UGW_pathIssueKind",
2088
2084
  "categoryName": "_367UGW_categoryName",
2089
- "fieldLabel": "_367UGW_fieldLabel",
2085
+ "badge": "_367UGW_badge",
2086
+ "rowActions": "_367UGW_rowActions",
2087
+ "sectionBody": "_367UGW_sectionBody",
2088
+ "badgeOk": "_367UGW_badgeOk",
2090
2089
  "section": "_367UGW_section",
2091
- "radioLabel": "_367UGW_radioLabel",
2092
- "groupLabel": "_367UGW_groupLabel",
2090
+ "progressBar": "_367UGW_progressBar",
2091
+ "hint": "_367UGW_hint",
2092
+ "sectionTitle": "_367UGW_sectionTitle",
2093
2093
  "dshCmIndeterminate": "_367UGW_dshCmIndeterminate",
2094
- "errorLine": "_367UGW_errorLine",
2094
+ "errorTitle": "_367UGW_errorTitle",
2095
+ "pathRow": "_367UGW_pathRow",
2096
+ "pathIssueKind": "_367UGW_pathIssueKind",
2097
+ "conflictList": "_367UGW_conflictList",
2095
2098
  "spinnerLabel": "_367UGW_spinnerLabel",
2099
+ "groupNote": "_367UGW_groupNote",
2100
+ "reportView": "_367UGW_reportView",
2101
+ "snapshotRowHeader": "_367UGW_snapshotRowHeader",
2102
+ "primaryButton": "_367UGW_primaryButton",
2103
+ "categoryItem": "_367UGW_categoryItem",
2104
+ "warnList": "_367UGW_warnList",
2105
+ "progressPercent": "_367UGW_progressPercent",
2106
+ "errorReason": "_367UGW_errorReason",
2107
+ "conflictDetail": "_367UGW_conflictDetail",
2108
+ "badgeWarn": "_367UGW_badgeWarn",
2096
2109
  "groupList": "_367UGW_groupList",
2097
- "actionRow": "_367UGW_actionRow",
2098
- "progressBarDone": "_367UGW_progressBarDone",
2099
- "errorAction": "_367UGW_errorAction",
2100
- "progressBlock": "_367UGW_progressBlock",
2101
- "snapshotList": "_367UGW_snapshotList",
2110
+ "warnText": "_367UGW_warnText",
2111
+ "progressLabel": "_367UGW_progressLabel",
2102
2112
  "kindTag": "_367UGW_kindTag",
2103
- "spinner": "_367UGW_spinner",
2104
- "conflictList": "_367UGW_conflictList",
2113
+ "progressBadgeSection": "_367UGW_progressBadgeSection",
2114
+ "conflictItem": "_367UGW_conflictItem",
2105
2115
  "reportFooter": "_367UGW_reportFooter",
2116
+ "conflictOptions": "_367UGW_conflictOptions",
2117
+ "pathValue": "_367UGW_pathValue",
2118
+ "progressBadge": "_367UGW_progressBadge",
2106
2119
  "banner": "_367UGW_banner",
2107
2120
  "field": "_367UGW_field",
2108
- "categoryItem": "_367UGW_categoryItem",
2109
- "errorBanner": "_367UGW_errorBanner",
2110
- "snapshotRowHeader": "_367UGW_snapshotRowHeader",
2111
- "primaryButton": "_367UGW_primaryButton",
2112
- "reportText": "_367UGW_reportText",
2113
- "reportScroll": "_367UGW_reportScroll",
2114
- "sectionTitleBlock": "_367UGW_sectionTitleBlock",
2115
- "conflictDetail": "_367UGW_conflictDetail",
2116
- "empty": "_367UGW_empty",
2117
- "sectionTitle": "_367UGW_sectionTitle",
2118
- "badgeInfo": "_367UGW_badgeInfo",
2119
- "hiddenFile": "_367UGW_hiddenFile",
2120
- "errorItem": "_367UGW_errorItem",
2121
- "pathMappingList": "_367UGW_pathMappingList",
2122
- "card": "_367UGW_card",
2123
- "diffScroll": "_367UGW_diffScroll",
2124
- "viewBody": "_367UGW_viewBody",
2125
2121
  "conflictId": "_367UGW_conflictId",
2126
2122
  "errorFooter": "_367UGW_errorFooter",
2123
+ "errorBanner": "_367UGW_errorBanner",
2124
+ "spinner": "_367UGW_spinner",
2125
+ "hiddenFile": "_367UGW_hiddenFile",
2126
+ "groupLabel": "_367UGW_groupLabel",
2127
2127
  "severityError": "_367UGW_severityError",
2128
- "errorReason": "_367UGW_errorReason",
2129
- "secretsList": "_367UGW_secretsList",
2130
- "modeTab": "_367UGW_modeTab",
2131
- "dangerButton": "_367UGW_dangerButton",
2132
- "statRow": "_367UGW_statRow",
2133
- "dshCmSpin": "_367UGW_dshCmSpin",
2134
2128
  "snapshotRow": "_367UGW_snapshotRow",
2135
- "warnText": "_367UGW_warnText",
2136
- "rowActions": "_367UGW_rowActions",
2129
+ "planScroll": "_367UGW_planScroll",
2130
+ "statRow": "_367UGW_statRow",
2131
+ "snapshotList": "_367UGW_snapshotList",
2132
+ "empty": "_367UGW_empty",
2133
+ "secretFields": "_367UGW_secretFields",
2134
+ "viewTabs": "_367UGW_viewTabs",
2135
+ "progressBarDone": "_367UGW_progressBarDone",
2136
+ "viewBody": "_367UGW_viewBody",
2137
+ "radioLabel": "_367UGW_radioLabel",
2138
+ "progressIndeterminate": "_367UGW_progressIndeterminate",
2139
+ "fieldLabel": "_367UGW_fieldLabel",
2140
+ "reportScroll": "_367UGW_reportScroll",
2141
+ "secretsList": "_367UGW_secretsList",
2142
+ "actionRow": "_367UGW_actionRow",
2143
+ "errorActionLabel": "_367UGW_errorActionLabel",
2144
+ "conflictHead": "_367UGW_conflictHead",
2145
+ "modeHint": "_367UGW_modeHint",
2137
2146
  "groupCard": "_367UGW_groupCard",
2138
- "sectionHeader": "_367UGW_sectionHeader",
2139
- "badge": "_367UGW_badge",
2140
- "checkboxRow": "_367UGW_checkboxRow",
2141
- "pathNew": "_367UGW_pathNew",
2142
- "viewTab": "_367UGW_viewTab",
2143
2147
  "rollbackBox": "_367UGW_rollbackBox",
2144
- "spinnerWrap": "_367UGW_spinnerWrap",
2145
- "reportList": "_367UGW_reportList",
2146
- "pullScroll": "_367UGW_pullScroll",
2147
- "optionsCard": "_367UGW_optionsCard",
2148
- "groupHeader": "_367UGW_groupHeader",
2149
- "groupItems": "_367UGW_groupItems",
2150
- "progressBadgeCount": "_367UGW_progressBadgeCount",
2151
- "reportView": "_367UGW_reportView",
2148
+ "progressTrack": "_367UGW_progressTrack",
2149
+ "pathMappingList": "_367UGW_pathMappingList",
2150
+ "dshCmSpin": "_367UGW_dshCmSpin",
2152
2151
  "confirmScroll": "_367UGW_confirmScroll",
2152
+ "select": "_367UGW_select",
2153
+ "progressBadgeCount": "_367UGW_progressBadgeCount",
2154
+ "sectionHeader": "_367UGW_sectionHeader",
2155
+ "input": "_367UGW_input",
2156
+ "modeTabs": "_367UGW_modeTabs",
2157
+ "reportText": "_367UGW_reportText",
2158
+ "errorItem": "_367UGW_errorItem",
2159
+ "errorAction": "_367UGW_errorAction",
2160
+ "optionsCard": "_367UGW_optionsCard",
2161
+ "viewTab": "_367UGW_viewTab",
2162
+ "dangerButton": "_367UGW_dangerButton",
2163
+ "sectionTitleBlock": "_367UGW_sectionTitleBlock",
2164
+ "sectionSubtitle": "_367UGW_sectionSubtitle",
2165
+ "modeTab": "_367UGW_modeTab",
2166
+ "errorList": "_367UGW_errorList",
2153
2167
  "progressMeta": "_367UGW_progressMeta",
2154
- "errorTitle": "_367UGW_errorTitle",
2168
+ "progressBlock": "_367UGW_progressBlock",
2169
+ "pathOld": "_367UGW_pathOld",
2170
+ "spinnerWrap": "_367UGW_spinnerWrap",
2171
+ "diffScroll": "_367UGW_diffScroll",
2172
+ "ghostButton": "_367UGW_ghostButton",
2173
+ "progressDetail": "_367UGW_progressDetail",
2155
2174
  "badgeError": "_367UGW_badgeError",
2156
- "sectionBody": "_367UGW_sectionBody",
2157
- "progressLabel": "_367UGW_progressLabel",
2158
- "input": "_367UGW_input",
2175
+ "errorLine": "_367UGW_errorLine",
2176
+ "card": "_367UGW_card",
2177
+ "pathNew": "_367UGW_pathNew",
2159
2178
  "categoryDesc": "_367UGW_categoryDesc",
2160
- "progressBar": "_367UGW_progressBar",
2161
- "viewTabs": "_367UGW_viewTabs",
2162
- "pathRow": "_367UGW_pathRow",
2163
- "badgeOk": "_367UGW_badgeOk",
2164
- "hint": "_367UGW_hint",
2179
+ "reportList": "_367UGW_reportList",
2165
2180
  "formError": "_367UGW_formError",
2166
- "progressDetail": "_367UGW_progressDetail",
2167
- "progressTrack": "_367UGW_progressTrack",
2168
- "select": "_367UGW_select",
2169
- "errorList": "_367UGW_errorList",
2170
- "ghostButton": "_367UGW_ghostButton",
2171
- "conflictHead": "_367UGW_conflictHead",
2172
- "errorActionLabel": "_367UGW_errorActionLabel",
2173
- "modeHint": "_367UGW_modeHint",
2174
- "progressBadgeSection": "_367UGW_progressBadgeSection",
2175
- "modeTabs": "_367UGW_modeTabs",
2176
- "progressPercent": "_367UGW_progressPercent",
2177
- "secretFields": "_367UGW_secretFields",
2178
- "pathValue": "_367UGW_pathValue",
2179
- "planScroll": "_367UGW_planScroll"
2181
+ "groupItems": "_367UGW_groupItems",
2182
+ "pullScroll": "_367UGW_pullScroll",
2183
+ "groupHeader": "_367UGW_groupHeader",
2184
+ "checkboxRow": "_367UGW_checkboxRow",
2185
+ "badgeInfo": "_367UGW_badgeInfo"
2180
2186
  };
2181
2187
  //#endregion
2182
2188
  //#region src/client/common/ui.tsx
@@ -4359,15 +4365,16 @@ function computeAutosyncCountdown(elapsedMs, intervalMs) {
4359
4365
  if (elapsedMs < 0) return -1;
4360
4366
  return Math.max(0, intervalMs - elapsedMs);
4361
4367
  }
4362
- /** 间隔 ms → 可读时长(如「30 分钟」「6 小时」)。 */
4368
+ /**
4369
+ * 剩余时长 → 可读文案(向上取整,避免出现「0 分钟」;≤0 视为 1 分钟兜底)。
4370
+ * 例:4 分钟 →「4 分钟」;90 分钟 →「2 小时」;30 小时 →「2 天」。
4371
+ */
4363
4372
  function formatIntervalDuration(ms, t = zhUiT) {
4364
- const minutes = Math.round(ms / 6e4);
4365
- if (minutes < 60) return t("sync.interval.30m");
4366
- const hours = Math.round(minutes / 60);
4367
- if (hours === 6) return t("sync.interval.6h");
4368
- if (hours === 12) return t("sync.interval.12h");
4369
- if (hours === 24) return t("sync.interval.24h");
4370
- return `${hours}h`;
4373
+ const totalMinutes = Math.max(1, Math.ceil(ms / 6e4));
4374
+ if (totalMinutes < 60) return t("sync.duration.min", { n: totalMinutes });
4375
+ const totalHours = Math.ceil(totalMinutes / 60);
4376
+ if (totalHours < 24) return t("sync.duration.hour", { n: totalHours });
4377
+ return t("sync.duration.day", { n: Math.ceil(totalHours / 24) });
4371
4378
  }
4372
4379
  /** 自动同步状态行的可读文案(未运行 / 上次状态 / 连续失败计数)。 */
4373
4380
  function autosyncStatusText(status, t = zhUiT) {
@@ -5279,7 +5286,8 @@ function SyncSettingsView({ api, t }) {
5279
5286
  /** GitHub 流程进行中(请求设备码 / 等待授权 / 轮询):禁用 push/pull,避免无凭据操作 */
5280
5287
  const githubBusy = state.github.phase === "starting" || state.github.phase === "waiting" || state.github.phase === "polling";
5281
5288
  const autosyncText = state.autosync !== null ? autosyncStatusText(state.autosync, uiT) : t("autosync.statusNever");
5282
- const autosyncCountdown = state.autosync !== null && state.autosync.elapsedMs >= 0 ? formatIntervalDuration(computeAutosyncCountdown(state.autosync.elapsedMs, autosyncIntervalMs(state.autosync.interval)), uiT) : null;
5289
+ /** 距下次自动同步剩余 ms(null = 从未运行;0 = 已到期) */
5290
+ const autosyncCountdownMs = state.autosync !== null && state.autosync.elapsedMs >= 0 ? computeAutosyncCountdown(state.autosync.elapsedMs, autosyncIntervalMs(state.autosync.interval)) : null;
5283
5291
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5284
5292
  className: config_manager_module_css_default.viewBody,
5285
5293
  children: [
@@ -5663,9 +5671,9 @@ function SyncSettingsView({ api, t }) {
5663
5671
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
5664
5672
  kind: state.autosync?.lastRunStatus === "failed" ? "error" : state.autosync?.lastRunStatus === "skipped" ? "warn" : "info",
5665
5673
  children: autosyncText
5666
- }), autosyncCountdown !== null && state.autosyncEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
5674
+ }), autosyncCountdownMs !== null && state.autosyncEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
5667
5675
  kind: "info",
5668
- children: t("autosync.nextRun", { time: autosyncCountdown })
5676
+ children: autosyncCountdownMs <= 0 ? t("autosync.due") : t("autosync.nextRun", { time: formatIntervalDuration(autosyncCountdownMs, uiT) })
5669
5677
  })]
5670
5678
  })
5671
5679
  ] }),
@@ -6123,6 +6131,7 @@ const zh = {
6123
6131
  "autosync.status": "上次运行:{status}({time})",
6124
6132
  "autosync.statusNever": "从未运行",
6125
6133
  "autosync.nextRun": "下次约 {time} 后",
6134
+ "autosync.due": "已到同步时间,即将执行",
6126
6135
  "autosync.failCount": "连续失败 {n} 次",
6127
6136
  "autosync.running": "自动同步进行中…",
6128
6137
  "autosync.success": "成功",
@@ -6242,6 +6251,7 @@ const en = {
6242
6251
  "autosync.status": "Last run: {status} ({time})",
6243
6252
  "autosync.statusNever": "Never run",
6244
6253
  "autosync.nextRun": "Next in ~{time}",
6254
+ "autosync.due": "Due — running soon",
6245
6255
  "autosync.failCount": "{n} consecutive failure(s)",
6246
6256
  "autosync.running": "Auto sync running…",
6247
6257
  "autosync.success": "Success",