支持从git提取贡献者信息

Signed-off-by: gfdgd_xi <3025613752@qq.com>
This commit is contained in:
2026-07-27 16:22:57 +08:00
parent 17cbb7cff2
commit c1b89cab1a
+26 -1
View File
@@ -868,6 +868,23 @@ const isValidUrl = (url: string): boolean => {
} }
}; };
const getContributorFromGit = async (): Promise<string> => {
try {
const nameResult = await window.ipcRenderer.invoke("get-git-name");
const emailResult = await window.ipcRenderer.invoke("get-git-email");
const name = nameResult?.success ? nameResult.data : "";
const email = emailResult?.success ? emailResult.data : "";
if (name && email) {
return `${name} <${email}>`;
}
} catch (error) {
console.warn("[Submitter] Failed to get git config:", error);
}
return "";
};
const isFormValid = computed(() => { const isFormValid = computed(() => {
const hasRequiredFields = const hasRequiredFields =
formData.name.trim() && formData.name.trim() &&
@@ -1345,6 +1362,12 @@ const parseDebFileAndSearchHistory = async (debPath: string) => {
JSON.stringify(formData, null, 2), JSON.stringify(formData, null, 2),
); );
const gitContributor = await getContributorFromGit();
if (gitContributor) {
formData.contributor = gitContributor;
console.log("[Submitter] Contributor updated from git:", gitContributor);
}
if (formData.pkgname) { if (formData.pkgname) {
isSearchingHistory.value = true; isSearchingHistory.value = true;
try { try {
@@ -1460,7 +1483,9 @@ const selectArch = async (arch: HistoryArchInfo) => {
formData.name = arch.name || formData.name; formData.name = arch.name || formData.name;
formData.author = arch.author || formData.author; formData.author = arch.author || formData.author;
formData.contributor = arch.contributor || formData.contributor; if (!formData.contributor) {
formData.contributor = arch.contributor || "";
}
formData.website = arch.website || formData.website; formData.website = arch.website || formData.website;
formData.category = arch.category || formData.category; formData.category = arch.category || formData.category;
formData.description = arch.more || formData.description; formData.description = arch.more || formData.description;