Compare commits

...
12 Commits
Author SHA1 Message Date
shenmo7192 3b7f14862d refactor(DownloadQueue): 移除无用的滚轮隐藏队列逻辑与相关依赖
移除了页面滚轮事件监听、isHidden状态和相关的DOM引用,简化组件逻辑
2026-07-18 22:11:54 +08:00
shenmo7192 367828f1f4 chore(vscode & download queue): 修复调试配置和下载面板交互问题
1. 给VSCode调试配置添加--no-sandbox参数以解决容器/权限问题
2. 修复下载队列面板收起时点击无响应的bug,调整隐藏状态的位移参数
3. 优化展开/收起切换逻辑,隐藏状态下点击会自动展开面板
2026-07-18 22:04:23 +08:00
shenmo7192 70250acc76 fix(submitter): 捕获打开输出文件夹失败的错误
新增错误捕获逻辑,避免打开打包完成的文件夹失败时导致程序报错
2026-07-18 12:48:49 +08:00
shenmo7192andGitee 3157714776 !406 fix: 仅在使用loonggpu时禁用显卡加速
Merge pull request !406 from AAA Elysia 猫猫侠 ⁧~喵/N/A
2026-07-18 04:30:26 +00:00
AAA Elysia 猫猫侠 ⁧~喵andGitee bfd7626b8f fix: 仅在使用loonggpu时禁用显卡加速
Signed-off-by: AAA Elysia 猫猫侠 ⁧~喵 <elysia-best@simplelinux.cn.eu.org>
2026-07-18 04:27:53 +00:00
shenmo7192 5d512c4e86 add: 龙芯禁用GPU 2026-07-18 11:34:59 +08:00
shenmo7192 9323c368d6 style: 统一文件名小写处理并格式化代码
1. 对deb包名、打包文件名统一转为小写格式,避免大小写不一致问题
2. 格式化多处代码换行和缩进,提升代码可读性
2026-07-18 10:37:52 +08:00
shenmo7192 1f9971f7aa chore(gitignore): ignore Debian build intermediates under debian/ 2026-07-18 10:34:56 +08:00
shenmo7192 d67f7b3666 feat(submitter): 完善提交表单功能,优化交互与体验
1.  新增electronUtils接口用于获取文件路径,支持拖拽上传deb包
2.  交换贡献者与官网地址表单字段
3.  重构架构选择UI,按来源和架构排序并添加来源标识
4.  新增截图和图标上传格式校验,限制仅支持PNG
5.  优化截图上传区域样式,支持拖放上传
6.  拆分重置表单和提交成功后的状态清理逻辑
7.  重构架构排序逻辑,兼容新旧存储格式
2026-07-18 00:22:45 +08:00
shenmo7192 c2ba273ca2 update 5.2.1.0 2026-07-17 23:47:22 +08:00
shenmo7192 361dad1a64 feat(submitter): 新增自动获取git用户名并填充提交信息
扩展了提交器的自动填充能力,新增通过git config获取本地git用户名的能力,和原有邮箱获取逻辑结合,自动按照格式填充贡献者字段,优化用户提交体验
2026-07-17 23:12:10 +08:00
shenmo7192 5730c0bfea feat(SubmitterWindow): add view submission queue button
add a button to open the submission queue page in new tab, alongside the close button in the header
2026-07-17 22:52:03 +08:00
9 changed files with 339 additions and 134 deletions
+10
View File
@@ -55,3 +55,13 @@ test-results.json
# VSCode CMake Extension
build/*
# Debian build intermediates
debian/*.log
debian/*.substvars
debian/*.debhelper
debian/debhelper-build-stamp
debian/files
debian/tmp/
debian/.debhelper/
debian/spark-store/
+1
View File
@@ -30,6 +30,7 @@
// },
"runtimeArgs": [
"--remote-debugging-port=9229",
"--no-sandbox",
"."
],
"envFile": "${workspaceFolder}/.vscode/.debug.env",
+1 -1
View File
@@ -1,4 +1,4 @@
spark-store (5.2.1-0) UNRELEASED; urgency=medium
spark-store (5.2.1.0) UNRELEASED; urgency=medium
* Initial release. (Closes: #nnnn) <nnnn is the bug number of your ITP>
+28 -6
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";
@@ -1402,8 +1420,9 @@ export function registerSubmitterHandlers(
// arch 由前端解析 deb 时获取并传入,无需再次调用 dpkg-deb
const debArch = String(dataObj.arch || "amd64");
const pkgVersion = String(dataObj.version || "0.0.0");
const debPkgName = String(dataObj.pkgname || "unknown");
const formFileName = `${debPkgName}_${pkgVersion}_${debArch}.deb`;
const debPkgName = String(dataObj.pkgname || "unknown").toLowerCase();
const formFileName =
`${debPkgName}_${pkgVersion}_${debArch}.deb`.toLowerCase();
logger.info(
{ formFileName, debArch },
"[Submitter] Constructed file_name",
@@ -1671,7 +1690,7 @@ export function registerSubmitterHandlers(
}
const dataObj = formData as Record<string, unknown>;
const pkgname = String(dataObj.pkgname || "");
const pkgname = String(dataObj.pkgname || "").toLowerCase();
const packageName = String(dataObj.name || "");
const packageVersion = String(dataObj.version || "");
const packageCategory = String(dataObj.category || "");
@@ -1862,7 +1881,8 @@ export function registerSubmitterHandlers(
"[Submitter] Deb metadata parsed",
);
const packDebFileName = `${debPkgName}_${debVersion}_${debArch}.deb`;
const packDebFileName =
`${debPkgName}_${debVersion}_${debArch}.deb`.toLowerCase();
logger.info(
{
from: debFilePath,
@@ -1913,7 +1933,7 @@ export function registerSubmitterHandlers(
sendPackageProgress("tar", 85, "正在打包 tar.gz...");
logger.info("[Submitter] Starting tar...");
const tarFileName = `${pkgname}-${storeArch}.tar.gz`;
const tarFileName = `${pkgname.toLowerCase()}-${storeArch.toLowerCase()}.tar.gz`;
const tarOutputPath = path.join(baseTempDir, tarFileName);
try {
await execAsync(
@@ -1938,7 +1958,9 @@ export function registerSubmitterHandlers(
sendPackageProgress("done", 100, "打包完成!");
logger.info({ baseTempDir }, "[Submitter] Opening folder");
await shell.openPath(baseTempDir);
shell.openPath(baseTempDir).catch((err) => {
logger.warn({ err }, "[Submitter] Failed to open folder");
});
const duration = Date.now() - startTime;
logger.info(
+10 -1
View File
@@ -1,4 +1,9 @@
import { ipcRenderer, contextBridge, type IpcRendererEvent } from "electron";
import {
ipcRenderer,
contextBridge,
webUtils,
type IpcRendererEvent,
} from "electron";
type StoreFilter = "spark" | "apm" | "both";
@@ -97,6 +102,10 @@ contextBridge.exposeInMainWorld("apm_store", {
})(),
});
contextBridge.exposeInMainWorld("electronUtils", {
getPathForFile: (file: File): string => webUtils.getPathForFile(file),
});
contextBridge.exposeInMainWorld("windowControls", {
minimize: () => ipcRenderer.send("window-control-minimize"),
toggleMaximize: () => ipcRenderer.send("window-control-toggle-maximize"),
+10
View File
@@ -29,6 +29,16 @@ if grep -q "ID=aosc" /etc/os-release; then
ARGS="$ARGS --no-spark"
fi
# 检查龙GPU,添加 --disable-gpu
ARCH=$(uname -m)
if [ "$ARCH" = "loongarch64" ] || [ "$ARCH" = "loong64" ]; then
is_loonggpu=$(lspci -s $(basename $(readlink $(grep -l connected /sys/class/drm/card*/*/status 2>/dev/null | head -1 | grep -o 'card[0-9]*' | xargs -I{} echo /sys/class/drm/{}/device))) | grep -qi loongson && echo "Found" || echo "NotFound")
if [ "$is_loonggpu" = "Found" ]; then
echo "检测到龙GPU"
ARGS="$ARGS --disable-gpu"
fi
fi
# 注意:已移除原先针对 arm64 + wayland 添加 --disable-gpu 的逻辑,
# 现在 arm64 设备无论是否使用 wayland 均不再添加此参数。
+1 -31
View File
@@ -1,12 +1,6 @@
<template>
<div
ref="queueRef"
class="fixed inset-x-4 bottom-4 z-40 rounded-3xl border border-slate-200/70 bg-white shadow-2xl transition-all duration-200 dark:border-slate-800/70 dark:bg-slate-900 sm:left-auto sm:right-6 sm:w-96"
:class="
isHidden
? 'pointer-events-none translate-y-[calc(100%+1rem)] opacity-0'
: 'translate-y-0 opacity-100'
"
>
<div
class="flex items-center justify-between px-5 py-4"
@@ -136,7 +130,7 @@
</template>
<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from "vue";
import { computed, ref } from "vue";
import type { DownloadItem } from "../global/typedefinition";
const props = defineProps<{
@@ -153,30 +147,6 @@ const emit = defineEmits<{
}>();
const isExpanded = ref(false);
const isHidden = ref(false);
const queueRef = ref<HTMLElement | null>(null);
const onWheel = (event: WheelEvent) => {
if (queueRef.value?.contains(event.target as Node) || event.deltaY === 0) {
return;
}
if (event.deltaY > 0) {
isExpanded.value = false;
isHidden.value = true;
return;
}
isHidden.value = false;
};
onMounted(() => {
document.addEventListener("wheel", onWheel, { passive: true, capture: true });
});
onUnmounted(() => {
document.removeEventListener("wheel", onWheel, { capture: true });
});
const completedDownloads = computed(() => {
return props.downloads.filter((d) => d.status === "completed").length;
+274 -94
View File
@@ -14,13 +14,23 @@
</div>
<h1 class="text-lg font-semibold">投稿应用</h1>
</div>
<button
type="button"
class="submitter-close-button inline-flex h-8 w-8 items-center justify-center rounded-lg text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"
@click="closeWindow"
>
<i class="fas fa-times"></i>
</button>
<div class="flex items-center gap-2">
<button
type="button"
class="submitter-close-button inline-flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-slate-800"
@click="openSubmissionQueue"
>
<i class="fas fa-list"></i>
查看当前投稿队列
</button>
<button
type="button"
class="submitter-close-button inline-flex h-8 w-8 items-center justify-center rounded-lg text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-800"
@click="closeWindow"
>
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
@@ -135,6 +145,19 @@
</div>
</div>
<div>
<label
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
>官网地址</label
>
<input
v-model="formData.website"
type="url"
placeholder="https://example.com"
class="w-full px-4 py-2.5 rounded-lg border border-slate-200 bg-white dark:bg-slate-800 dark:border-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
<div>
<label
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
@@ -161,19 +184,6 @@
/>
</div>
<div>
<label
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
>官网地址</label
>
<input
v-model="formData.website"
type="url"
placeholder="https://example.com"
class="w-full px-4 py-2.5 rounded-lg border border-slate-200 bg-white dark:bg-slate-800 dark:border-slate-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
<div>
<label
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
@@ -215,12 +225,16 @@
>截图最多5张</label
>
<p class="mb-2 text-xs text-slate-500 dark:text-slate-400">
可直接 Ctrl+V 粘贴截图
点击添加拖放或直接 Ctrl+V 粘贴 PNG 截图
</p>
<div
tabindex="0"
class="grid grid-cols-5 gap-3 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
class="grid grid-cols-5 gap-3 rounded-lg border-2 border-dashed border-transparent p-2 transition-colors hover:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
@paste="handleScreenshotPaste"
@drop="handleScreenshotDrop"
@dragover.prevent
@dragenter.prevent
@dragleave.prevent
>
<div
v-for="(screenshot, index) in formData.screenshots"
@@ -247,11 +261,17 @@
<input
ref="screenshotInput"
type="file"
accept=".png,.jpg,.jpeg"
accept=".png"
multiple
class="hidden"
@change="handleScreenshotSelect"
/>
<p
v-if="mediaError"
class="mt-2 text-sm text-red-600 dark:text-red-400"
>
{{ mediaError }}
</p>
</div>
<div>
@@ -536,7 +556,7 @@
<button
type="button"
class="flex-1 px-4 py-2 rounded-lg border border-slate-200 bg-white text-slate-700 dark:bg-slate-800 dark:border-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors"
@click="resetFormAndClose"
@click="continueSubmission"
>
继续投递
</button>
@@ -620,11 +640,25 @@
class="w-full p-4 rounded-lg border-2 border-slate-200 dark:border-slate-700 hover:border-emerald-500 transition-colors text-left"
@click="selectPackArch(arch)"
>
<div class="font-medium text-slate-900 dark:text-slate-100">
{{ getArchDisplayName(arch.store) }}
<div class="flex items-center gap-2">
<span
class="rounded-full px-2 py-0.5 text-xs font-medium"
:class="
isSparkHistoryStore(arch.store)
? 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300'
: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300'
"
>
{{ isSparkHistoryStore(arch.store) ? "Spark" : "APM" }}
</span>
<span class="font-medium text-slate-900 dark:text-slate-100">
{{ getArchDisplayName(arch.store) }}
</span>
</div>
<div class="text-sm text-slate-500 dark:text-slate-400 mt-1">
输出: {{ formData.pkgname }}-{{ arch.store }}.tar.gz
输出: {{ formData.pkgname.toLowerCase() }}-{{
arch.store
}}.tar.gz
</div>
</button>
</div>
@@ -676,14 +710,23 @@
<div class="space-y-3 mb-6">
<button
v-for="arch in availableArchs"
v-for="arch in sortedArchs"
:key="arch.store"
type="button"
class="w-full p-4 rounded-lg border-2 border-slate-200 dark:border-slate-700 hover:border-blue-500 transition-colors text-left"
class="w-full p-4 rounded-lg border-2 transition-colors text-left"
:class="archOriginBorderClass(arch.store)"
@click="selectArch(arch)"
>
<div class="font-medium text-slate-900 dark:text-slate-100">
{{ getArchDisplayName(arch.store) }}
<div class="flex items-center gap-2">
<span class="font-medium text-slate-900 dark:text-slate-100">
{{ getArchDisplayName(arch.store) }}
</span>
<span
class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium"
:class="getOriginBadgeClass(arch.store)"
>
{{ getOriginLabel(arch.store) }}
</span>
</div>
<div class="text-sm text-slate-500 dark:text-slate-400 mt-1">
版本: {{ arch.version }} | 分类: {{ arch.category }}
@@ -767,6 +810,7 @@ const isSearchingHistory = ref(false);
const showArchDialog = ref(false);
const availableArchs = ref<HistoryArchInfo[]>([]);
const currentDebArch = ref("");
const mediaError = ref("");
const iconPreview = ref("");
const iconFileName = ref("");
@@ -864,13 +908,70 @@ const hasUserStartedFilling = computed(() => {
);
});
const getArchDisplayName = (store: string): string => {
const archMap: Record<string, string> = {
store: "AMD64 (x86_64)",
"aarch64-store": "ARM64 (aarch64)",
"loong64-store": "LoongArch64",
const getHistoryArch = (
store: string,
): "amd64" | "arm64" | "loong64" | "other" => {
if (store === "store" || store.startsWith("amd64-")) return "amd64";
if (store === "aarch64-store" || store.startsWith("arm64-")) return "arm64";
if (store === "loong64-store" || store.startsWith("loong64-"))
return "loong64";
return "other";
};
const isSparkHistoryStore = (store: string): boolean => {
// 兼容新格式(amd64-store / arm64-store / loong64-store / amd64-apm ...
// 与旧格式(store / aarch64-store / loong64-store
return store === "store" || store.endsWith("-store");
};
const sortHistoryArchs = (archs: HistoryArchInfo[]): HistoryArchInfo[] => {
const archOrder: Record<ReturnType<typeof getHistoryArch>, number> = {
amd64: 0,
arm64: 1,
loong64: 2,
other: 3,
};
return archMap[store] || store;
return [...archs].sort((a, b) => {
const sourceOrder =
Number(isSparkHistoryStore(b.store)) -
Number(isSparkHistoryStore(a.store));
if (sourceOrder !== 0) return sourceOrder;
return (
archOrder[getHistoryArch(a.store)] - archOrder[getHistoryArch(b.store)]
);
});
};
const getArchDisplayName = (store: string): string => {
const arch = getHistoryArch(store);
const archMap: Record<typeof arch, string> = {
amd64: "AMD64 (x86_64)",
arm64: "ARM64 (aarch64)",
loong64: "LoongArch64",
other: store,
};
return archMap[arch];
};
const sortedArchs = computed(() => sortHistoryArchs(availableArchs.value));
const getOriginLabel = (store: string): string => {
return isSparkHistoryStore(store) ? "Spark" : "APM";
};
const getOriginBadgeClass = (store: string): string => {
if (isSparkHistoryStore(store)) {
return "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400";
}
return "bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400";
};
const archOriginBorderClass = (store: string): string => {
if (isSparkHistoryStore(store)) {
return "border-slate-200 dark:border-slate-700 hover:border-blue-500";
}
return "border-slate-200 dark:border-slate-700 hover:border-amber-400";
};
const loadCategoriesPromise = ref<Promise<void> | null>(null);
@@ -1042,6 +1143,14 @@ const updateFormTags = () => {
formData.tags = selectedTags.value.map((t) => t.value).join(";");
};
const openSubmissionQueue = (): void => {
window.open(
"https://upload.spark-app.store/",
"_blank",
"noopener,noreferrer",
);
};
const selectDebFile = async () => {
const result = await window.ipcRenderer.invoke("select-deb-file");
if (result?.success && result.filePath) {
@@ -1091,14 +1200,8 @@ const searchHistoryApp = async () => {
console.log("[Submitter] availableArchs before:", availableArchs.value);
console.log("[Submitter] showArchDialog before:", showArchDialog.value);
// 按 amd64 → arm64 → loong64 顺序排序
const archOrder: Record<string, number> = {
store: 0,
"aarch64-store": 1,
"loong64-store": 2,
};
availableArchs.value = [...historyResult.data].sort(
(a, b) => (archOrder[a.store] ?? 99) - (archOrder[b.store] ?? 99),
availableArchs.value = sortHistoryArchs(
historyResult.data as HistoryArchInfo[],
);
console.log("[Submitter] availableArchs after:", availableArchs.value);
console.log(
@@ -1112,7 +1215,7 @@ const searchHistoryApp = async () => {
}
// 从第一条历史记录预填名称和分类
const firstArch = historyResult.data[0];
const firstArch = availableArchs.value[0];
if (firstArch) {
formData.name = firstArch.name || formData.name;
formData.category = firstArch.category || formData.category;
@@ -1183,6 +1286,15 @@ const searchHistoryApp = async () => {
const parseDebFileAndSearchHistory = async (debPath: string) => {
isParsingDeb.value = true;
debParseError.value = "";
availableArchs.value = [];
showArchDialog.value = false;
formData.pkgname = "";
formData.version = "";
formData.author = "";
formData.contributor = "";
formData.website = "";
formData.description = "";
currentDebArch.value = "";
try {
console.log(
@@ -1294,13 +1406,20 @@ const handleDrop = async (event: DragEvent) => {
if (file.name.endsWith(".deb")) {
console.log("[Submitter] File is a deb package");
const textUriList = event.dataTransfer?.getData("text/uri-list");
console.log("[Submitter] text/uri-list:", textUriList);
const textPlain = event.dataTransfer?.getData("text/plain");
console.log("[Submitter] text/plain:", textPlain);
const filePath = file.path || textUriList || textPlain;
// 在 contextIsolation 环境下,File.path 不可用
// 使用 Electron 的 webUtils.getPathForFile() 获取真实文件系统路径
let filePath: string;
try {
filePath = window.electronUtils.getPathForFile(file);
console.log("[Submitter] File path from electronUtils:", filePath);
} catch {
console.warn(
"[Submitter] electronUtils.getPathForFile failed, trying fallback",
);
const textUriList = event.dataTransfer?.getData("text/uri-list");
const textPlain = event.dataTransfer?.getData("text/plain");
filePath = textUriList || textPlain || "";
}
console.log("[Submitter] Final filePath:", filePath);
if (filePath) {
@@ -1397,38 +1516,46 @@ const selectIconFile = () => {
iconFileInput.value?.click();
};
const isPngFile = (file: File): boolean => {
return (
file.type === "image/png" || (file.type === "" && /\.png$/i.test(file.name))
);
};
const readIconFile = (file: File): void => {
iconFileName.value = file.name;
const reader = new FileReader();
reader.onload = (e) => {
const dataUrl = e.target?.result as string;
formData.iconPath = dataUrl;
iconPreview.value = dataUrl;
};
reader.readAsDataURL(file);
};
const handleIconFileSelect = (event: Event) => {
const target = event.target as HTMLInputElement;
const file = target.files?.[0];
if (file) {
iconFileName.value = file.name;
const reader = new FileReader();
reader.onload = (e) => {
const dataUrl = e.target?.result as string;
formData.iconPath = dataUrl;
iconPreview.value = dataUrl;
};
reader.readAsDataURL(file);
if (isPngFile(file)) {
mediaError.value = "";
readIconFile(file);
} else {
mediaError.value = "应用图标仅支持 PNG 格式。";
}
}
target.value = "";
};
const handleIconDrop = (event: DragEvent) => {
event.preventDefault();
const file = event.dataTransfer?.files?.[0];
if (
file &&
(file.name.endsWith(".png") ||
file.name.endsWith(".jpg") ||
file.name.endsWith(".jpeg"))
) {
iconFileName.value = file.name;
const reader = new FileReader();
reader.onload = (e) => {
const dataUrl = e.target?.result as string;
formData.iconPath = dataUrl;
iconPreview.value = dataUrl;
};
reader.readAsDataURL(file);
if (!file) return;
if (isPngFile(file)) {
mediaError.value = "";
readIconFile(file);
} else {
mediaError.value = "应用图标仅支持 PNG 格式。";
}
};
@@ -1437,7 +1564,14 @@ const addScreenshot = () => {
};
const importScreenshots = (files: File[]) => {
for (const file of files) {
const pngFiles = files.filter(isPngFile);
if (pngFiles.length !== files.length) {
mediaError.value = "截图仅支持 PNG 格式。";
} else if (pngFiles.length > 0) {
mediaError.value = "";
}
for (const file of pngFiles) {
if (formData.screenshots.length >= 5) break;
const reader = new FileReader();
@@ -1455,16 +1589,18 @@ const importScreenshots = (files: File[]) => {
const handleScreenshotSelect = (event: Event) => {
const target = event.target as HTMLInputElement;
const files = Array.from(target.files ?? []).filter((file) =>
/\.(png|jpe?g)$/i.test(file.name),
);
importScreenshots(files);
importScreenshots(Array.from(target.files ?? []));
target.value = "";
};
const handleScreenshotDrop = (event: DragEvent) => {
event.preventDefault();
importScreenshots(Array.from(event.dataTransfer?.files ?? []));
};
const handleScreenshotPaste = (event: ClipboardEvent) => {
const files = Array.from(event.clipboardData?.items ?? [])
.filter((item) => item.type.startsWith("image/"))
.filter((item) => item.kind === "file")
.map((item) => item.getAsFile())
.filter((file): file is File => file !== null);
@@ -1497,6 +1633,7 @@ const resetForm = () => {
submitSuccess.value = false;
submitError.value = "";
debParseError.value = "";
mediaError.value = "";
packageSuccess.value = false;
packageError.value = "";
packageResult.value = null;
@@ -1514,14 +1651,29 @@ const resetForm = () => {
isSearchingHistory.value = false;
};
const closeSubmitSuccessModal = () => {
const clearSubmitTransientState = (): void => {
showSubmitSuccessModal.value = false;
resetForm();
submitSuccess.value = false;
isSubmitting.value = false;
uploadProgress.value = 0;
uploadStage.value = "";
uploadStageMessage.value = "";
uploadStages.value = [];
};
const resetFormAndClose = () => {
showSubmitSuccessModal.value = false;
resetForm();
const closeSubmitSuccessModal = () => {
clearSubmitTransientState();
};
const continueSubmission = () => {
const shouldClear = window.confirm(
"是否清空当前表单内容后继续投递?选择“取消”将保留已填写内容。",
);
if (shouldClear) {
resetForm();
} else {
clearSubmitTransientState();
}
};
const submitForm = async () => {
@@ -1714,15 +1866,43 @@ const closeWindow = () => {
import { onMounted, nextTick } from "vue";
const getGitEmail = async () => {
const getGitInfo = async () => {
try {
const result = await window.ipcRenderer.invoke("get-git-email");
if (result?.success && result.data) {
formData.mail = result.data;
console.log("[Submitter] Git email auto-filled:", result.data);
const [nameResult, emailResult] = await Promise.all([
window.ipcRenderer.invoke("get-git-name"),
window.ipcRenderer.invoke("get-git-email"),
]);
let gitName = "";
let gitEmail = "";
if (nameResult?.success && nameResult.data) {
gitName = nameResult.data;
console.log("[Submitter] Git name auto-filled:", gitName);
}
if (emailResult?.success && emailResult.data) {
gitEmail = emailResult.data;
console.log("[Submitter] Git email auto-filled:", gitEmail);
}
// 将 git name 和 email 合并填入 contributor 字段,格式: Name <email>
if (gitName || gitEmail) {
if (gitName && gitEmail) {
formData.contributor = `${gitName} <${gitEmail}>`;
} else if (gitName) {
formData.contributor = gitName;
} else if (gitEmail) {
formData.contributor = gitEmail;
}
}
// 单独填入邮箱
if (gitEmail) {
formData.mail = gitEmail;
}
} catch (err) {
console.warn("[Submitter] Failed to get git email:", err);
console.warn("[Submitter] Failed to get git info:", err);
}
};
@@ -1730,8 +1910,8 @@ onMounted(async () => {
console.log("[Submitter] Component mounted, loading categories and tags");
// 先等待分类列表加载完成,避免后续竞态
await Promise.all([loadCategoriesList(), loadTagsList()]);
// 尝试从 git 配置读取邮箱
await getGitEmail();
// 尝试从 git 配置读取 name 和 email,填入 contributor 和 mail
await getGitInfo();
});
</script>
+3
View File
@@ -22,6 +22,9 @@ declare global {
};
windowControls: WindowControlBridge;
updateCenter: UpdateCenterBridge;
electronUtils: {
getPathForFile: (file: File) => string;
};
}
}