mirror of
https://github.com/Gabi-Zar/Silk-Fly-Launcher.git
synced 2026-06-15 03:47:11 +02:00
Add the ability to update BepInEx
This commit is contained in:
16
main.js
16
main.js
@@ -208,9 +208,13 @@ function saveBepinexVersion(version) {
|
||||
}
|
||||
|
||||
ipcMain.handle("load-bepinex-version", () => {
|
||||
return loadBepinexVersion();
|
||||
});
|
||||
|
||||
function loadBepinexVersion() {
|
||||
bepinexVersion = bepinexStore.get("bepinex-version");
|
||||
return bepinexVersion;
|
||||
});
|
||||
}
|
||||
|
||||
function saveBepinexBackupVersion(version) {
|
||||
bepinexBackupVersion = version;
|
||||
@@ -377,8 +381,6 @@ async function installBepinex() {
|
||||
saveBepinexVersion(bepinexBackupVersion);
|
||||
saveBepinexBackupVersion(undefined);
|
||||
} else {
|
||||
mainWindow.webContents.send("showToast", "Installing Bepinex from Github");
|
||||
|
||||
const GITHUB_URL = "https://api.github.com/repos/bepinex/bepinex/releases/latest";
|
||||
|
||||
const res = await fetch(GITHUB_URL, {
|
||||
@@ -397,6 +399,14 @@ async function installBepinex() {
|
||||
|
||||
const release = await res.json();
|
||||
|
||||
if (loadBepinexVersion() == release.tag_name) {
|
||||
mainWindow.webContents.send("showToast", "No new BepInEx update.");
|
||||
return;
|
||||
}
|
||||
mainWindow.webContents.send("showToast", "Installing Bepinex from Github");
|
||||
|
||||
await uninstallBepinex();
|
||||
|
||||
let asset;
|
||||
if (process.platform === "win32") {
|
||||
asset = release.assets.find((a) => a.name.endsWith(".zip") && a.name.toLowerCase().includes("win_x64"));
|
||||
|
||||
Reference in New Issue
Block a user