mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-08-08 02:33:56 +08:00
投稿器用自渲染对话框替换alert修复选择deb后无法编辑信息的问题
Signed-off-by: gfdgd_xi <3025613752@qq.com>
This commit is contained in:
@@ -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 path from "node:path";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
@@ -462,13 +462,12 @@ export function registerSubmitterHandlers(
|
|||||||
return { success: true };
|
return { success: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
const BrowserWindowClass = (await import("electron")).BrowserWindow;
|
const newWin = new BrowserWindow({
|
||||||
|
|
||||||
const newWin = new BrowserWindowClass({
|
|
||||||
title: "星火应用商店 - 投稿应用",
|
title: "星火应用商店 - 投稿应用",
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 900,
|
height: 900,
|
||||||
frame: false,
|
frame: false,
|
||||||
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
icon: path.join(process.env.VITE_PUBLIC!, "favicon.ico"),
|
icon: path.join(process.env.VITE_PUBLIC!, "favicon.ico"),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
@@ -482,6 +481,11 @@ export function registerSubmitterHandlers(
|
|||||||
newWin.loadFile(indexHtml, { hash: "submitter" });
|
newWin.loadFile(indexHtml, { hash: "submitter" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newWin.once("ready-to-show", () => {
|
||||||
|
newWin.show();
|
||||||
|
newWin.focus();
|
||||||
|
});
|
||||||
|
|
||||||
newWin.on("closed", () => {
|
newWin.on("closed", () => {
|
||||||
setSubmitterWin(null);
|
setSubmitterWin(null);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -271,6 +271,19 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
|
||||||
|
>测试情况</label
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
v-model="formData.remark"
|
||||||
|
type="text"
|
||||||
|
placeholder="写明在何种平台的测试情况"
|
||||||
|
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>
|
<div>
|
||||||
<label
|
<label
|
||||||
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
|
class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"
|
||||||
@@ -507,6 +520,77 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<div
|
||||||
|
v-if="showMirrorConfirmDialog"
|
||||||
|
data-submitter-mirror-confirm-dialog
|
||||||
|
class="fixed inset-0 z-50 flex items-center justify-center p-4"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="fixed inset-0 bg-black/50"
|
||||||
|
@click="showMirrorConfirmDialog = false"
|
||||||
|
></div>
|
||||||
|
<div
|
||||||
|
class="relative z-10 bg-white dark:bg-slate-900 rounded-xl shadow-2xl w-full max-w-md p-6"
|
||||||
|
>
|
||||||
|
<div class="flex items-center justify-between mb-4">
|
||||||
|
<h2
|
||||||
|
class="text-lg font-semibold text-slate-900 dark:text-slate-100"
|
||||||
|
>
|
||||||
|
选择数据源
|
||||||
|
</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
|
||||||
|
@click="showMirrorConfirmDialog = false"
|
||||||
|
>
|
||||||
|
<i class="fas fa-times"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-slate-600 dark:text-slate-400 mb-4">
|
||||||
|
请选择搜索历史信息的数据源:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="space-y-3 mb-4">
|
||||||
|
<div class="p-3 rounded-lg bg-slate-50 dark:bg-slate-800">
|
||||||
|
<div class="font-medium text-slate-900 dark:text-slate-100">
|
||||||
|
镜像源
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-slate-500 dark:text-slate-400">
|
||||||
|
mirrors.sdu.edu.cn - 建议在中国内地使用以获得更好的网络体验
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3 rounded-lg bg-slate-50 dark:bg-slate-800">
|
||||||
|
<div class="font-medium text-slate-900 dark:text-slate-100">
|
||||||
|
主站
|
||||||
|
</div>
|
||||||
|
<div class="text-sm text-slate-500 dark:text-slate-400">
|
||||||
|
spk-json.spark-app.store - 全球可用
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-3">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="flex-1 px-4 py-2 rounded-lg border-2 border-emerald-500 bg-emerald-50 text-emerald-700 font-medium hover:bg-emerald-100 dark:bg-emerald-900/20 dark:border-emerald-600 dark:text-emerald-400 dark:hover:bg-emerald-900/30"
|
||||||
|
@click="confirmMirrorSource(true)"
|
||||||
|
>
|
||||||
|
使用镜像源
|
||||||
|
</button>
|
||||||
|
<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"
|
||||||
|
@click="confirmMirrorSource(false)"
|
||||||
|
>
|
||||||
|
使用主站
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -546,6 +630,7 @@ const formData = reactive({
|
|||||||
description: "",
|
description: "",
|
||||||
tags: "",
|
tags: "",
|
||||||
category: "",
|
category: "",
|
||||||
|
remark: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const isSubmitting = ref(false);
|
const isSubmitting = ref(false);
|
||||||
@@ -557,6 +642,7 @@ const showArchDialog = ref(false);
|
|||||||
const availableArchs = ref<HistoryArchInfo[]>([]);
|
const availableArchs = ref<HistoryArchInfo[]>([]);
|
||||||
const currentDebArch = ref("");
|
const currentDebArch = ref("");
|
||||||
const iconPreview = ref("");
|
const iconPreview = ref("");
|
||||||
|
const showMirrorConfirmDialog = ref(false);
|
||||||
|
|
||||||
const isPackaging = ref(false);
|
const isPackaging = ref(false);
|
||||||
const packageSuccess = ref(false);
|
const packageSuccess = ref(false);
|
||||||
@@ -843,69 +929,23 @@ const selectDebFile = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const useMirror = ref(false);
|
const useMirror = ref(false);
|
||||||
|
let pendingSearchHistory = false;
|
||||||
|
|
||||||
const selectMirrorSource = () => {
|
const selectMirrorSource = () => {
|
||||||
const useMirrorSource = window.confirm(
|
showMirrorConfirmDialog.value = true;
|
||||||
"是否使用镜像源搜索历史信息?\n\n镜像源:mirrors.sdu.edu.cn\n主站:spk-json.spark-app.store\n\n建议在中国内地使用镜像源以获得更好的网络体验。",
|
|
||||||
);
|
|
||||||
useMirror.value = useMirrorSource;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const parseDebFileAndSearchHistory = async (debPath: string) => {
|
const confirmMirrorSource = async (useMirrorSource: boolean) => {
|
||||||
isParsingDeb.value = true;
|
useMirror.value = useMirrorSource;
|
||||||
debParseError.value = "";
|
showMirrorConfirmDialog.value = false;
|
||||||
|
|
||||||
try {
|
if (pendingSearchHistory && formData.pkgname) {
|
||||||
console.log(
|
pendingSearchHistory = false;
|
||||||
"[Submitter] ============== STARTING DEB FILE PARSING ==============",
|
await searchHistoryApp();
|
||||||
);
|
}
|
||||||
console.log("[Submitter] Input debPath:", debPath);
|
};
|
||||||
console.log("[Submitter] debPath type:", typeof debPath);
|
|
||||||
console.log("[Submitter] debPath length:", debPath.length);
|
|
||||||
|
|
||||||
console.log("[Submitter] Calling IPC: parse-deb-file with path:", debPath);
|
const searchHistoryApp = async () => {
|
||||||
const parseResult = await window.ipcRenderer.invoke(
|
|
||||||
"parse-deb-file",
|
|
||||||
debPath,
|
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
"[Submitter] Received IPC response:",
|
|
||||||
JSON.stringify(parseResult, null, 2),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (parseResult?.success && parseResult.data) {
|
|
||||||
const debInfo = parseResult.data;
|
|
||||||
console.log(
|
|
||||||
"[Submitter] Parsed debInfo successfully:",
|
|
||||||
JSON.stringify(debInfo, null, 2),
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("[Submitter] Setting form data from debInfo:");
|
|
||||||
console.log("[Submitter] pkgname:", debInfo.pkgname);
|
|
||||||
console.log("[Submitter] version:", debInfo.version);
|
|
||||||
console.log("[Submitter] author:", debInfo.author);
|
|
||||||
console.log("[Submitter] maintainer:", debInfo.maintainer);
|
|
||||||
console.log("[Submitter] homepage:", debInfo.homepage);
|
|
||||||
console.log("[Submitter] description:", debInfo.description);
|
|
||||||
console.log("[Submitter] architecture:", debInfo.architecture);
|
|
||||||
|
|
||||||
formData.pkgname = debInfo.pkgname || "";
|
|
||||||
formData.version = debInfo.version || "";
|
|
||||||
formData.author = debInfo.author || debInfo.maintainer || "";
|
|
||||||
formData.contributor = debInfo.maintainer || "";
|
|
||||||
formData.website = debInfo.homepage || "";
|
|
||||||
formData.description = debInfo.description || "";
|
|
||||||
currentDebArch.value = debInfo.architecture || "";
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
"[Submitter] Form data after setting:",
|
|
||||||
JSON.stringify(formData, null, 2),
|
|
||||||
);
|
|
||||||
|
|
||||||
selectMirrorSource();
|
|
||||||
console.log("[Submitter] Mirror source selected:", useMirror.value);
|
|
||||||
|
|
||||||
if (formData.pkgname) {
|
|
||||||
console.log(
|
console.log(
|
||||||
"[Submitter] ============== SEARCHING HISTORY INFO ==============",
|
"[Submitter] ============== SEARCHING HISTORY INFO ==============",
|
||||||
);
|
);
|
||||||
@@ -1033,8 +1073,62 @@ const parseDebFileAndSearchHistory = async (debPath: string) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
};
|
||||||
console.log("[Submitter] pkgname is empty, skipping history search");
|
|
||||||
|
const parseDebFileAndSearchHistory = async (debPath: string) => {
|
||||||
|
isParsingDeb.value = true;
|
||||||
|
debParseError.value = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(
|
||||||
|
"[Submitter] ============== STARTING DEB FILE PARSING ==============",
|
||||||
|
);
|
||||||
|
console.log("[Submitter] Input debPath:", debPath);
|
||||||
|
console.log("[Submitter] debPath type:", typeof debPath);
|
||||||
|
console.log("[Submitter] debPath length:", debPath.length);
|
||||||
|
|
||||||
|
console.log("[Submitter] Calling IPC: parse-deb-file with path:", debPath);
|
||||||
|
const parseResult = await window.ipcRenderer.invoke(
|
||||||
|
"parse-deb-file",
|
||||||
|
debPath,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
"[Submitter] Received IPC response:",
|
||||||
|
JSON.stringify(parseResult, null, 2),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (parseResult?.success && parseResult.data) {
|
||||||
|
const debInfo = parseResult.data;
|
||||||
|
console.log(
|
||||||
|
"[Submitter] Parsed debInfo successfully:",
|
||||||
|
JSON.stringify(debInfo, null, 2),
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("[Submitter] Setting form data from debInfo:");
|
||||||
|
console.log("[Submitter] pkgname:", debInfo.pkgname);
|
||||||
|
console.log("[Submitter] version:", debInfo.version);
|
||||||
|
console.log("[Submitter] author:", debInfo.author);
|
||||||
|
console.log("[Submitter] maintainer:", debInfo.maintainer);
|
||||||
|
console.log("[Submitter] homepage:", debInfo.homepage);
|
||||||
|
console.log("[Submitter] description:", debInfo.description);
|
||||||
|
console.log("[Submitter] architecture:", debInfo.architecture);
|
||||||
|
|
||||||
|
formData.pkgname = debInfo.pkgname || "";
|
||||||
|
formData.version = debInfo.version || "";
|
||||||
|
formData.author = debInfo.author || debInfo.maintainer || "";
|
||||||
|
formData.contributor = debInfo.maintainer || "";
|
||||||
|
formData.website = debInfo.homepage || "";
|
||||||
|
formData.description = debInfo.description || "";
|
||||||
|
currentDebArch.value = debInfo.architecture || "";
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"[Submitter] Form data after setting:",
|
||||||
|
JSON.stringify(formData, null, 2),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (formData.pkgname) {
|
||||||
|
pendingSearchHistory = true;
|
||||||
|
selectMirrorSource();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("[Submitter] Failed to parse deb file");
|
console.error("[Submitter] Failed to parse deb file");
|
||||||
@@ -1126,6 +1220,7 @@ const handleDrop = async (event: DragEvent) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectArch = (arch: HistoryArchInfo) => {
|
const selectArch = (arch: HistoryArchInfo) => {
|
||||||
|
showArchDialog.value = false;
|
||||||
console.log("[Submitter] selectArch called with:", arch);
|
console.log("[Submitter] selectArch called with:", arch);
|
||||||
|
|
||||||
formData.name = arch.name || formData.name;
|
formData.name = arch.name || formData.name;
|
||||||
@@ -1260,6 +1355,7 @@ const resetForm = () => {
|
|||||||
formData.description = "";
|
formData.description = "";
|
||||||
formData.tags = "";
|
formData.tags = "";
|
||||||
formData.category = "";
|
formData.category = "";
|
||||||
|
formData.remark = "";
|
||||||
submitSuccess.value = false;
|
submitSuccess.value = false;
|
||||||
submitError.value = "";
|
submitError.value = "";
|
||||||
debParseError.value = "";
|
debParseError.value = "";
|
||||||
@@ -1289,6 +1385,7 @@ const submitForm = async () => {
|
|||||||
description: formData.description,
|
description: formData.description,
|
||||||
tags: formData.tags,
|
tags: formData.tags,
|
||||||
category: formData.category,
|
category: formData.category,
|
||||||
|
remark: formData.remark,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("[Submitter] ============== SUBMIT FORM ==============");
|
console.log("[Submitter] ============== SUBMIT FORM ==============");
|
||||||
@@ -1344,6 +1441,7 @@ const packageApp = async (storeArch: string) => {
|
|||||||
description: formData.description,
|
description: formData.description,
|
||||||
tags: formData.tags,
|
tags: formData.tags,
|
||||||
category: formData.category,
|
category: formData.category,
|
||||||
|
remark: formData.remark,
|
||||||
storeArch,
|
storeArch,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user