zen-gitsync 2.10.21 → 2.10.24
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/package.json +1 -1
- package/src/config.js +27 -5
- package/src/ui/public/assets/index-D_n92IoC.css +1 -0
- package/src/ui/public/assets/index-b9vh2ATa.js +108 -0
- package/src/ui/public/assets/{vendor-BpNfZzQX.js → vendor-DrABRxF7.js} +167 -167
- package/src/ui/public/index.html +3 -3
- package/src/ui/server/routes/config.js +25 -1
- package/src/ui/server/routes/gitOps.js +11 -5
- package/src/utils/index.js +5 -2
- package/src/ui/public/assets/index-OJy1G6pO.js +0 -108
- package/src/ui/public/assets/index-izOobFz3.css +0 -1
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -31,7 +31,10 @@ const defaultConfig = {
|
|
|
31
31
|
type: 'command',
|
|
32
32
|
refId: ''
|
|
33
33
|
},
|
|
34
|
-
currentDirectory: ''
|
|
34
|
+
currentDirectory: '',
|
|
35
|
+
// 通用设置
|
|
36
|
+
theme: 'light', // 主题: light | dark | auto
|
|
37
|
+
locale: 'zh-CN' // 语言: zh-CN | en-US
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
// 规范化项目路径作为配置键
|
|
@@ -109,9 +112,15 @@ async function loadConfig() {
|
|
|
109
112
|
return { ...defaultConfig, ...raw };
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
// 新版结构:{ projects: { [key]: projectConfig },
|
|
115
|
+
// 新版结构:{ projects: { [key]: projectConfig }, theme?, locale?, recentDirectories? }
|
|
113
116
|
const projectConfig = raw?.projects?.[key];
|
|
114
|
-
|
|
117
|
+
// 合并:默认配置 + 项目配置 + 全局通用设置(theme, locale)
|
|
118
|
+
return {
|
|
119
|
+
...defaultConfig,
|
|
120
|
+
...(projectConfig || {}),
|
|
121
|
+
theme: raw?.theme ?? defaultConfig.theme,
|
|
122
|
+
locale: raw?.locale ?? defaultConfig.locale
|
|
123
|
+
};
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
// 异步保存配置
|
|
@@ -141,9 +150,20 @@ async function saveConfig(config) {
|
|
|
141
150
|
raw.projects = {};
|
|
142
151
|
}
|
|
143
152
|
|
|
153
|
+
// 分离全局设置和项目设置
|
|
154
|
+
const { theme, locale, ...projectConfig } = config;
|
|
155
|
+
|
|
156
|
+
// 保存全局设置到根级别
|
|
157
|
+
if (theme !== undefined) {
|
|
158
|
+
raw.theme = theme;
|
|
159
|
+
}
|
|
160
|
+
if (locale !== undefined) {
|
|
161
|
+
raw.locale = locale;
|
|
162
|
+
}
|
|
163
|
+
|
|
144
164
|
// 写入当前项目配置(在 defaultConfig 基础上合并,但不清空顶层其它键)
|
|
145
165
|
const existingProjectConfig = (raw.projects[key] && typeof raw.projects[key] === 'object') ? raw.projects[key] : {};
|
|
146
|
-
raw.projects[key] = { ...defaultConfig, ...existingProjectConfig, ...
|
|
166
|
+
raw.projects[key] = { ...defaultConfig, ...existingProjectConfig, ...projectConfig };
|
|
147
167
|
await backupConfigFileIfExists();
|
|
148
168
|
await writeRawConfigFile(raw);
|
|
149
169
|
}
|
|
@@ -263,5 +283,7 @@ export default {
|
|
|
263
283
|
listLockedFiles,
|
|
264
284
|
getLockedFiles,
|
|
265
285
|
getRecentDirectories,
|
|
266
|
-
saveRecentDirectory
|
|
286
|
+
saveRecentDirectory,
|
|
287
|
+
readRawConfigFile,
|
|
288
|
+
writeRawConfigFile
|
|
267
289
|
};
|