feat(submitter): 新增自动获取git用户名并填充提交信息

扩展了提交器的自动填充能力,新增通过git config获取本地git用户名的能力,和原有邮箱获取逻辑结合,自动按照格式填充贡献者字段,优化用户提交体验
This commit is contained in:
2026-07-17 23:12:10 +08:00
parent 5730c0bfea
commit 361dad1a64
2 changed files with 54 additions and 8 deletions
+18
View File
@@ -972,6 +972,24 @@ export function registerSubmitterHandlers(
}
});
ipcMain.handle("get-git-name", async () => {
try {
const { exec } = await import("node:child_process");
const util = await import("util");
const execAsync = util.promisify(exec);
const { stdout } = await execAsync("git config user.name");
const name = stdout.trim();
logger.info({ name }, "[Submitter] Git name retrieved");
return { success: true, data: name || "" };
} catch (err) {
logger.warn(
{ err },
"[Submitter] Failed to get git name, not a git repo or git not installed",
);
return { success: false, data: "" };
}
});
ipcMain.handle("get-tags-list", async () => {
try {
const apiUrl = "https://upload.deepinos.org.cn/api/index/get_tags_list";