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 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 fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
@ -178,8 +178,11 @@ export const initGitHubApi = () => {
|
|||||||
version["frpcVersionPath"] = frpcVersionPath;
|
version["frpcVersionPath"] = frpcVersionPath;
|
||||||
insertVersion(version, (err, document) => {
|
insertVersion(version, (err, document) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
event.reply("Download.frpVersionDownloadOnCompleted", args);
|
listVersion((err, doc) => {
|
||||||
version.download_completed = true;
|
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)
|
fs.unlinkSync(absPath)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
event.reply("Download.deleteVersion.hook", {
|
listVersion((err, doc) => {
|
||||||
err: null,
|
event.reply("Config.versions.hook", { err, data: doc });
|
||||||
data: "删除成功"
|
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(() => {
|
onMounted(() => {
|
||||||
ipcRenderer.send("config.getConfig");
|
ipcRenderer.send("config.getConfig");
|
||||||
handleLoadVersions();
|
handleLoadVersions();
|
||||||
@ -197,6 +204,7 @@ onMounted(() => {
|
|||||||
const {err, data} = args;
|
const {err, data} = args;
|
||||||
if (!err) {
|
if (!err) {
|
||||||
versions.value = data;
|
versions.value = data;
|
||||||
|
checkAndResetVersion();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user