dsh-config-manager 0.1.24 → 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 +4 -0
- package/lib/client.js +107 -97
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/sync/sync-engine.d.ts +4 -0
- package/lib/sync/sync-engine.js +4 -2
- package/lib/sync/sync-engine.js.map +1 -1
- package/lib/ui/i18n.d.ts +3 -0
- package/lib/ui/i18n.js +7 -0
- package/lib/ui/i18n.js.map +1 -1
- package/package.json +1 -1
- package/src/client/sync/SyncSettingsView.tsx +9 -4
- package/src/client/sync/sync-locales.ts +2 -0
- package/src/client/sync/sync-view.test.ts +40 -3
- package/src/client/sync/sync-view.ts +10 -8
- package/src/index.ts +1 -1
- package/src/sync/sync-engine.ts +7 -2
- package/src/ui/i18n.ts +8 -1
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
|
-
"
|
|
2079
|
-
"
|
|
2080
|
-
"pathValue": "_367UGW_pathValue",
|
|
2081
|
-
"formError": "_367UGW_formError",
|
|
2082
|
-
"pathRow": "_367UGW_pathRow",
|
|
2083
|
-
"viewBody": "_367UGW_viewBody",
|
|
2084
|
-
"badgeWarn": "_367UGW_badgeWarn",
|
|
2085
|
-
"fieldLabel": "_367UGW_fieldLabel",
|
|
2086
|
-
"conflictDetail": "_367UGW_conflictDetail",
|
|
2087
|
-
"pathMappingList": "_367UGW_pathMappingList",
|
|
2084
|
+
"categoryName": "_367UGW_categoryName",
|
|
2085
|
+
"badge": "_367UGW_badge",
|
|
2088
2086
|
"rowActions": "_367UGW_rowActions",
|
|
2089
|
-
"
|
|
2090
|
-
"
|
|
2091
|
-
"
|
|
2092
|
-
"
|
|
2093
|
-
"
|
|
2094
|
-
"
|
|
2095
|
-
"
|
|
2087
|
+
"sectionBody": "_367UGW_sectionBody",
|
|
2088
|
+
"badgeOk": "_367UGW_badgeOk",
|
|
2089
|
+
"section": "_367UGW_section",
|
|
2090
|
+
"progressBar": "_367UGW_progressBar",
|
|
2091
|
+
"hint": "_367UGW_hint",
|
|
2092
|
+
"sectionTitle": "_367UGW_sectionTitle",
|
|
2093
|
+
"dshCmIndeterminate": "_367UGW_dshCmIndeterminate",
|
|
2094
|
+
"errorTitle": "_367UGW_errorTitle",
|
|
2095
|
+
"pathRow": "_367UGW_pathRow",
|
|
2096
|
+
"pathIssueKind": "_367UGW_pathIssueKind",
|
|
2097
|
+
"conflictList": "_367UGW_conflictList",
|
|
2098
|
+
"spinnerLabel": "_367UGW_spinnerLabel",
|
|
2099
|
+
"groupNote": "_367UGW_groupNote",
|
|
2100
|
+
"reportView": "_367UGW_reportView",
|
|
2101
|
+
"snapshotRowHeader": "_367UGW_snapshotRowHeader",
|
|
2096
2102
|
"primaryButton": "_367UGW_primaryButton",
|
|
2097
|
-
"
|
|
2098
|
-
"secretsList": "_367UGW_secretsList",
|
|
2099
|
-
"groupList": "_367UGW_groupList",
|
|
2100
|
-
"badge": "_367UGW_badge",
|
|
2103
|
+
"categoryItem": "_367UGW_categoryItem",
|
|
2101
2104
|
"warnList": "_367UGW_warnList",
|
|
2102
|
-
"
|
|
2103
|
-
"
|
|
2105
|
+
"progressPercent": "_367UGW_progressPercent",
|
|
2106
|
+
"errorReason": "_367UGW_errorReason",
|
|
2107
|
+
"conflictDetail": "_367UGW_conflictDetail",
|
|
2108
|
+
"badgeWarn": "_367UGW_badgeWarn",
|
|
2109
|
+
"groupList": "_367UGW_groupList",
|
|
2104
2110
|
"warnText": "_367UGW_warnText",
|
|
2105
|
-
"reportList": "_367UGW_reportList",
|
|
2106
|
-
"card": "_367UGW_card",
|
|
2107
|
-
"actionRow": "_367UGW_actionRow",
|
|
2108
2111
|
"progressLabel": "_367UGW_progressLabel",
|
|
2109
|
-
"
|
|
2110
|
-
"
|
|
2111
|
-
"
|
|
2112
|
-
"groupCard": "_367UGW_groupCard",
|
|
2113
|
-
"progressPercent": "_367UGW_progressPercent",
|
|
2114
|
-
"conflictList": "_367UGW_conflictList",
|
|
2112
|
+
"kindTag": "_367UGW_kindTag",
|
|
2113
|
+
"progressBadgeSection": "_367UGW_progressBadgeSection",
|
|
2114
|
+
"conflictItem": "_367UGW_conflictItem",
|
|
2115
2115
|
"reportFooter": "_367UGW_reportFooter",
|
|
2116
|
-
"
|
|
2117
|
-
"
|
|
2118
|
-
"
|
|
2119
|
-
"
|
|
2120
|
-
"
|
|
2121
|
-
"
|
|
2122
|
-
"
|
|
2123
|
-
"
|
|
2124
|
-
"
|
|
2125
|
-
"spinnerWrap": "_367UGW_spinnerWrap",
|
|
2126
|
-
"progressBlock": "_367UGW_progressBlock",
|
|
2116
|
+
"conflictOptions": "_367UGW_conflictOptions",
|
|
2117
|
+
"pathValue": "_367UGW_pathValue",
|
|
2118
|
+
"progressBadge": "_367UGW_progressBadge",
|
|
2119
|
+
"banner": "_367UGW_banner",
|
|
2120
|
+
"field": "_367UGW_field",
|
|
2121
|
+
"conflictId": "_367UGW_conflictId",
|
|
2122
|
+
"errorFooter": "_367UGW_errorFooter",
|
|
2123
|
+
"errorBanner": "_367UGW_errorBanner",
|
|
2124
|
+
"spinner": "_367UGW_spinner",
|
|
2127
2125
|
"hiddenFile": "_367UGW_hiddenFile",
|
|
2128
|
-
"hint": "_367UGW_hint",
|
|
2129
|
-
"diffScroll": "_367UGW_diffScroll",
|
|
2130
2126
|
"groupLabel": "_367UGW_groupLabel",
|
|
2131
|
-
"
|
|
2132
|
-
"
|
|
2133
|
-
"sectionBody": "_367UGW_sectionBody",
|
|
2134
|
-
"progressIndeterminate": "_367UGW_progressIndeterminate",
|
|
2135
|
-
"errorList": "_367UGW_errorList",
|
|
2127
|
+
"severityError": "_367UGW_severityError",
|
|
2128
|
+
"snapshotRow": "_367UGW_snapshotRow",
|
|
2136
2129
|
"planScroll": "_367UGW_planScroll",
|
|
2137
|
-
"
|
|
2138
|
-
"
|
|
2139
|
-
"
|
|
2140
|
-
"pullScroll": "_367UGW_pullScroll",
|
|
2141
|
-
"categoryName": "_367UGW_categoryName",
|
|
2142
|
-
"conflictOptions": "_367UGW_conflictOptions",
|
|
2143
|
-
"progressBarDone": "_367UGW_progressBarDone",
|
|
2144
|
-
"progressBadgeSection": "_367UGW_progressBadgeSection",
|
|
2130
|
+
"statRow": "_367UGW_statRow",
|
|
2131
|
+
"snapshotList": "_367UGW_snapshotList",
|
|
2132
|
+
"empty": "_367UGW_empty",
|
|
2145
2133
|
"secretFields": "_367UGW_secretFields",
|
|
2146
|
-
"
|
|
2147
|
-
"
|
|
2148
|
-
"
|
|
2149
|
-
"spinner": "_367UGW_spinner",
|
|
2150
|
-
"rollbackBox": "_367UGW_rollbackBox",
|
|
2151
|
-
"progressBar": "_367UGW_progressBar",
|
|
2152
|
-
"badgeError": "_367UGW_badgeError",
|
|
2134
|
+
"viewTabs": "_367UGW_viewTabs",
|
|
2135
|
+
"progressBarDone": "_367UGW_progressBarDone",
|
|
2136
|
+
"viewBody": "_367UGW_viewBody",
|
|
2153
2137
|
"radioLabel": "_367UGW_radioLabel",
|
|
2154
|
-
"
|
|
2155
|
-
"
|
|
2156
|
-
"
|
|
2157
|
-
"
|
|
2158
|
-
"
|
|
2159
|
-
"
|
|
2160
|
-
"
|
|
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",
|
|
2146
|
+
"groupCard": "_367UGW_groupCard",
|
|
2147
|
+
"rollbackBox": "_367UGW_rollbackBox",
|
|
2148
|
+
"progressTrack": "_367UGW_progressTrack",
|
|
2149
|
+
"pathMappingList": "_367UGW_pathMappingList",
|
|
2150
|
+
"dshCmSpin": "_367UGW_dshCmSpin",
|
|
2151
|
+
"confirmScroll": "_367UGW_confirmScroll",
|
|
2152
|
+
"select": "_367UGW_select",
|
|
2153
|
+
"progressBadgeCount": "_367UGW_progressBadgeCount",
|
|
2154
|
+
"sectionHeader": "_367UGW_sectionHeader",
|
|
2155
|
+
"input": "_367UGW_input",
|
|
2156
|
+
"modeTabs": "_367UGW_modeTabs",
|
|
2161
2157
|
"reportText": "_367UGW_reportText",
|
|
2162
|
-
"
|
|
2163
|
-
"errorReason": "_367UGW_errorReason",
|
|
2164
|
-
"dangerButton": "_367UGW_dangerButton",
|
|
2165
|
-
"categoryItem": "_367UGW_categoryItem",
|
|
2166
|
-
"dshCmIndeterminate": "_367UGW_dshCmIndeterminate",
|
|
2167
|
-
"errorTitle": "_367UGW_errorTitle",
|
|
2158
|
+
"errorItem": "_367UGW_errorItem",
|
|
2168
2159
|
"errorAction": "_367UGW_errorAction",
|
|
2169
|
-
"
|
|
2170
|
-
"
|
|
2160
|
+
"optionsCard": "_367UGW_optionsCard",
|
|
2161
|
+
"viewTab": "_367UGW_viewTab",
|
|
2162
|
+
"dangerButton": "_367UGW_dangerButton",
|
|
2171
2163
|
"sectionTitleBlock": "_367UGW_sectionTitleBlock",
|
|
2172
2164
|
"sectionSubtitle": "_367UGW_sectionSubtitle",
|
|
2173
|
-
"
|
|
2174
|
-
"
|
|
2175
|
-
"
|
|
2176
|
-
"
|
|
2165
|
+
"modeTab": "_367UGW_modeTab",
|
|
2166
|
+
"errorList": "_367UGW_errorList",
|
|
2167
|
+
"progressMeta": "_367UGW_progressMeta",
|
|
2168
|
+
"progressBlock": "_367UGW_progressBlock",
|
|
2169
|
+
"pathOld": "_367UGW_pathOld",
|
|
2170
|
+
"spinnerWrap": "_367UGW_spinnerWrap",
|
|
2171
|
+
"diffScroll": "_367UGW_diffScroll",
|
|
2172
|
+
"ghostButton": "_367UGW_ghostButton",
|
|
2177
2173
|
"progressDetail": "_367UGW_progressDetail",
|
|
2178
|
-
"
|
|
2179
|
-
"
|
|
2174
|
+
"badgeError": "_367UGW_badgeError",
|
|
2175
|
+
"errorLine": "_367UGW_errorLine",
|
|
2176
|
+
"card": "_367UGW_card",
|
|
2177
|
+
"pathNew": "_367UGW_pathNew",
|
|
2178
|
+
"categoryDesc": "_367UGW_categoryDesc",
|
|
2179
|
+
"reportList": "_367UGW_reportList",
|
|
2180
|
+
"formError": "_367UGW_formError",
|
|
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
|
-
/**
|
|
4368
|
+
/**
|
|
4369
|
+
* 剩余时长 → 可读文案(向上取整,避免出现「0 分钟」;≤0 视为 1 分钟兜底)。
|
|
4370
|
+
* 例:4 分钟 →「4 分钟」;90 分钟 →「2 小时」;30 小时 →「2 天」。
|
|
4371
|
+
*/
|
|
4363
4372
|
function formatIntervalDuration(ms, t = zhUiT) {
|
|
4364
|
-
const
|
|
4365
|
-
if (
|
|
4366
|
-
const
|
|
4367
|
-
if (
|
|
4368
|
-
|
|
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
|
-
|
|
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
|
-
}),
|
|
5674
|
+
}), autosyncCountdownMs !== null && state.autosyncEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
|
|
5667
5675
|
kind: "info",
|
|
5668
|
-
children: t("autosync.nextRun", { time:
|
|
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",
|