From 2cab0b2161f4e3aa71da99f0360a3bcf70d9b888 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sat, 27 Jun 2026 18:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E7=A8=BF=E5=99=A8=E7=94=A8=E8=87=AA?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?alert=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9deb=E5=90=8E=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=BC=96=E8=BE=91=E4=BF=A1=E6=81=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gfdgd_xi <3025613752@qq.com> --- electron/main/backend/submitter.ts | 12 +- src/components/SubmitterWindow.vue | 368 ++++++++++++++++++----------- 2 files changed, 241 insertions(+), 139 deletions(-) diff --git a/electron/main/backend/submitter.ts b/electron/main/backend/submitter.ts index 28c96e5f..c3720688 100644 --- a/electron/main/backend/submitter.ts +++ b/electron/main/backend/submitter.ts @@ -1,4 +1,4 @@ -import { type BrowserWindow, dialog, ipcMain, shell } from "electron"; +import { BrowserWindow, dialog, ipcMain, shell } from "electron"; import path from "node:path"; import fs from "node:fs"; import os from "node:os"; @@ -462,13 +462,12 @@ export function registerSubmitterHandlers( return { success: true }; } - const BrowserWindowClass = (await import("electron")).BrowserWindow; - - const newWin = new BrowserWindowClass({ + const newWin = new BrowserWindow({ title: "星火应用商店 - 投稿应用", width: 800, height: 900, frame: false, + show: false, autoHideMenuBar: true, icon: path.join(process.env.VITE_PUBLIC!, "favicon.ico"), webPreferences: { @@ -482,6 +481,11 @@ export function registerSubmitterHandlers( newWin.loadFile(indexHtml, { hash: "submitter" }); } + newWin.once("ready-to-show", () => { + newWin.show(); + newWin.focus(); + }); + newWin.on("closed", () => { setSubmitterWin(null); }); diff --git a/src/components/SubmitterWindow.vue b/src/components/SubmitterWindow.vue index 32537105..288fc212 100644 --- a/src/components/SubmitterWindow.vue +++ b/src/components/SubmitterWindow.vue @@ -271,6 +271,19 @@ +
+ + +
+
+ + +
+
+
+
+

+ 选择数据源 +

+ +
+ +

+ 请选择搜索历史信息的数据源: +

+ +
+
+
+ 镜像源 +
+
+ mirrors.sdu.edu.cn - 建议在中国内地使用以获得更好的网络体验 +
+
+
+
+ 主站 +
+
+ spk-json.spark-app.store - 全球可用 +
+
+
+ +
+ + +
+
+
+
@@ -546,6 +630,7 @@ const formData = reactive({ description: "", tags: "", category: "", + remark: "", }); const isSubmitting = ref(false); @@ -557,6 +642,7 @@ const showArchDialog = ref(false); const availableArchs = ref([]); const currentDebArch = ref(""); const iconPreview = ref(""); +const showMirrorConfirmDialog = ref(false); const isPackaging = ref(false); const packageSuccess = ref(false); @@ -843,12 +929,150 @@ const selectDebFile = async () => { }; const useMirror = ref(false); +let pendingSearchHistory = false; const selectMirrorSource = () => { - const useMirrorSource = window.confirm( - "是否使用镜像源搜索历史信息?\n\n镜像源:mirrors.sdu.edu.cn\n主站:spk-json.spark-app.store\n\n建议在中国内地使用镜像源以获得更好的网络体验。", - ); + showMirrorConfirmDialog.value = true; +}; + +const confirmMirrorSource = async (useMirrorSource: boolean) => { useMirror.value = useMirrorSource; + showMirrorConfirmDialog.value = false; + + if (pendingSearchHistory && formData.pkgname) { + pendingSearchHistory = false; + await searchHistoryApp(); + } +}; + +const searchHistoryApp = async () => { + console.log( + "[Submitter] ============== SEARCHING HISTORY INFO ==============", + ); + console.log( + "[Submitter] pkgname is not empty, searching history with:", + formData.pkgname, + ); + console.log("[Submitter] Using mirror:", useMirror.value); + + console.log( + "[Submitter] Calling IPC: search-history-app with pkgname:", + formData.pkgname, + ); + const historyResult = await window.ipcRenderer.invoke( + "search-history-app", + formData.pkgname, + useMirror.value, + ); + console.log( + "[Submitter] Received history search response:", + JSON.stringify(historyResult, null, 2), + ); + + if ( + historyResult?.success && + historyResult.data && + historyResult.data.length > 0 + ) { + console.log( + "[Submitter] ============== HISTORY INFO FOUND ==============", + ); + console.log( + "[Submitter] History info count:", + historyResult.data.length, + ); + console.log( + "[Submitter] Available archs data:", + JSON.stringify(historyResult.data, null, 2), + ); + + console.log( + "[Submitter] ============== BEFORE SETTING STATE ==============", + ); + console.log( + "[Submitter] availableArchs before:", + availableArchs.value, + ); + console.log( + "[Submitter] showArchDialog before:", + showArchDialog.value, + ); + + availableArchs.value = historyResult.data; + console.log( + "[Submitter] availableArchs after:", + availableArchs.value, + ); + console.log( + "[Submitter] availableArchs length:", + availableArchs.value.length, + ); + + showArchDialog.value = true; + console.log( + "[Submitter] showArchDialog after:", + showArchDialog.value, + ); + + console.log( + "[Submitter] ============== DIALOG SHOULD BE SHOWING ==============", + ); + console.log("[Submitter] Dialog visibility:", showArchDialog.value); + console.log( + "[Submitter] Available architectures to display:", + availableArchs.value.map((a) => a.store), + ); + + nextTick(() => { + console.log( + "[Submitter] ============== AFTER NEXT TICK ==============", + ); + console.log( + "[Submitter] showArchDialog in nextTick:", + showArchDialog.value, + ); + console.log( + "[Submitter] availableArchs in nextTick:", + availableArchs.value, + ); + + const dialogElement = document.querySelector( + "[data-submitter-arch-dialog]", + ); + console.log("[Submitter] Dialog element found:", !!dialogElement); + if (dialogElement) { + console.log("[Submitter] Dialog element:", dialogElement); + console.log( + "[Submitter] Dialog element style:", + window.getComputedStyle(dialogElement), + ); + } + }); + } else { + console.log( + "[Submitter] ============== NO HISTORY INFO FOUND ==============", + ); + console.log( + "[Submitter] historyResult.success:", + historyResult?.success, + ); + console.log("[Submitter] historyResult.data:", historyResult?.data); + console.log( + "[Submitter] historyResult.data.length:", + historyResult?.data?.length, + ); + + if (historyResult?.success === true && historyResult.data) { + console.log("[Submitter] Success is true but no data found"); + console.log("[Submitter] Data is:", historyResult.data); + console.log("[Submitter] Data type:", typeof historyResult.data); + } else if (!historyResult?.success) { + console.log( + "[Submitter] Search failed with message:", + historyResult?.message, + ); + } + } }; const parseDebFileAndSearchHistory = async (debPath: string) => { @@ -902,139 +1126,9 @@ const parseDebFileAndSearchHistory = async (debPath: string) => { JSON.stringify(formData, null, 2), ); - selectMirrorSource(); - console.log("[Submitter] Mirror source selected:", useMirror.value); - if (formData.pkgname) { - console.log( - "[Submitter] ============== SEARCHING HISTORY INFO ==============", - ); - console.log( - "[Submitter] pkgname is not empty, searching history with:", - formData.pkgname, - ); - console.log("[Submitter] Using mirror:", useMirror.value); - - console.log( - "[Submitter] Calling IPC: search-history-app with pkgname:", - formData.pkgname, - ); - const historyResult = await window.ipcRenderer.invoke( - "search-history-app", - formData.pkgname, - useMirror.value, - ); - console.log( - "[Submitter] Received history search response:", - JSON.stringify(historyResult, null, 2), - ); - - if ( - historyResult?.success && - historyResult.data && - historyResult.data.length > 0 - ) { - console.log( - "[Submitter] ============== HISTORY INFO FOUND ==============", - ); - console.log( - "[Submitter] History info count:", - historyResult.data.length, - ); - console.log( - "[Submitter] Available archs data:", - JSON.stringify(historyResult.data, null, 2), - ); - - console.log( - "[Submitter] ============== BEFORE SETTING STATE ==============", - ); - console.log( - "[Submitter] availableArchs before:", - availableArchs.value, - ); - console.log( - "[Submitter] showArchDialog before:", - showArchDialog.value, - ); - - availableArchs.value = historyResult.data; - console.log( - "[Submitter] availableArchs after:", - availableArchs.value, - ); - console.log( - "[Submitter] availableArchs length:", - availableArchs.value.length, - ); - - showArchDialog.value = true; - console.log( - "[Submitter] showArchDialog after:", - showArchDialog.value, - ); - - console.log( - "[Submitter] ============== DIALOG SHOULD BE SHOWING ==============", - ); - console.log("[Submitter] Dialog visibility:", showArchDialog.value); - console.log( - "[Submitter] Available architectures to display:", - availableArchs.value.map((a) => a.store), - ); - - nextTick(() => { - console.log( - "[Submitter] ============== AFTER NEXT TICK ==============", - ); - console.log( - "[Submitter] showArchDialog in nextTick:", - showArchDialog.value, - ); - console.log( - "[Submitter] availableArchs in nextTick:", - availableArchs.value, - ); - - const dialogElement = document.querySelector( - "[data-submitter-arch-dialog]", - ); - console.log("[Submitter] Dialog element found:", !!dialogElement); - if (dialogElement) { - console.log("[Submitter] Dialog element:", dialogElement); - console.log( - "[Submitter] Dialog element style:", - window.getComputedStyle(dialogElement), - ); - } - }); - } else { - console.log( - "[Submitter] ============== NO HISTORY INFO FOUND ==============", - ); - console.log( - "[Submitter] historyResult.success:", - historyResult?.success, - ); - console.log("[Submitter] historyResult.data:", historyResult?.data); - console.log( - "[Submitter] historyResult.data.length:", - historyResult?.data?.length, - ); - - if (historyResult?.success === true && historyResult.data) { - console.log("[Submitter] Success is true but no data found"); - console.log("[Submitter] Data is:", historyResult.data); - console.log("[Submitter] Data type:", typeof historyResult.data); - } else if (!historyResult?.success) { - console.log( - "[Submitter] Search failed with message:", - historyResult?.message, - ); - } - } - } else { - console.log("[Submitter] pkgname is empty, skipping history search"); + pendingSearchHistory = true; + selectMirrorSource(); } } else { console.error("[Submitter] Failed to parse deb file"); @@ -1126,6 +1220,7 @@ const handleDrop = async (event: DragEvent) => { }; const selectArch = (arch: HistoryArchInfo) => { + showArchDialog.value = false; console.log("[Submitter] selectArch called with:", arch); formData.name = arch.name || formData.name; @@ -1260,6 +1355,7 @@ const resetForm = () => { formData.description = ""; formData.tags = ""; formData.category = ""; + formData.remark = ""; submitSuccess.value = false; submitError.value = ""; debParseError.value = ""; @@ -1289,6 +1385,7 @@ const submitForm = async () => { description: formData.description, tags: formData.tags, category: formData.category, + remark: formData.remark, }; console.log("[Submitter] ============== SUBMIT FORM =============="); @@ -1344,6 +1441,7 @@ const packageApp = async (storeArch: string) => { description: formData.description, tags: formData.tags, category: formData.category, + remark: formData.remark, storeArch, };