Merge pull request #18 from forestxieCode/feat/xsl20240812-perf-github
perf:下载版本,自动更新下拉选择数据, 以及删除版本,取消当前选择的
This commit is contained in:
commit
71c677a193
@ -1,5 +1,5 @@
|
||||
import electron, {app, BrowserWindow, ipcMain, net, shell} from "electron";
|
||||
import {deleteVersionById, insertVersion} from "../storage/version";
|
||||
import {deleteVersionById, insertVersion, listVersion} from "../storage/version";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
@ -178,8 +178,11 @@ export const initGitHubApi = () => {
|
||||
version["frpcVersionPath"] = frpcVersionPath;
|
||||
insertVersion(version, (err, document) => {
|
||||
if (!err) {
|
||||
event.reply("Download.frpVersionDownloadOnCompleted", args);
|
||||
version.download_completed = true;
|
||||
listVersion((err, doc) => {
|
||||
event.reply("Config.versions.hook", { err, data: doc });
|
||||
event.reply("Download.frpVersionDownloadOnCompleted", args);
|
||||
version.download_completed = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -196,9 +199,9 @@ export const initGitHubApi = () => {
|
||||
fs.unlinkSync(absPath)
|
||||
})
|
||||
}
|
||||
event.reply("Download.deleteVersion.hook", {
|
||||
err: null,
|
||||
data: "删除成功"
|
||||
listVersion((err, doc) => {
|
||||
event.reply("Config.versions.hook", { err, data: doc });
|
||||
event.reply("Download.deleteVersion.hook", { err: null, data: "删除成功" });
|
||||
});
|
||||
})
|
||||
|
||||
|
@ -166,6 +166,13 @@ const handleAuthMethodChange = e => {
|
||||
}
|
||||
}
|
||||
|
||||
const checkAndResetVersion = () => {
|
||||
const currentVersion = formData.value.currentVersion;
|
||||
if (currentVersion && !versions.value.some(item => item.id === currentVersion)) {
|
||||
formData.value.currentVersion = "";
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
ipcRenderer.send("config.getConfig");
|
||||
handleLoadVersions();
|
||||
@ -197,6 +204,7 @@ onMounted(() => {
|
||||
const {err, data} = args;
|
||||
if (!err) {
|
||||
versions.value = data;
|
||||
checkAndResetVersion();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user