mirror of
https://github.com/Gabi-Zar/Silk-Fly-Launcher.git
synced 2026-06-15 03:47:11 +02:00
Compare commits
2 Commits
378108bd34
...
dbad325ca9
| Author | SHA1 | Date | |
|---|---|---|---|
| dbad325ca9 | |||
| 7fe89ff2ab |
@@ -6,6 +6,7 @@ import stylistic from "@stylistic/eslint-plugin";
|
||||
export default defineConfig([
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs}"],
|
||||
ignores: ["node_modules/**", "out/**"],
|
||||
plugins: { js, "@stylistic": stylistic },
|
||||
extends: ["js/recommended"],
|
||||
languageOptions: { globals: { ...globals.browser, ...globals.node } },
|
||||
|
||||
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"));
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
"make:msi": "cross-env BUILD_TARGET=msi electron-forge make",
|
||||
"make:zip": "cross-env BUILD_TARGET=zip electron-forge make",
|
||||
"make:deb": "cross-env BUILD_TARGET=deb electron-forge make",
|
||||
"make:appimage": "cross-env BUILD_TARGET=appimage electron-forge make"
|
||||
"make:appimage": "cross-env BUILD_TARGET=appimage electron-forge make",
|
||||
"lint": "npx eslint"
|
||||
},
|
||||
"author": "GabiZar",
|
||||
"license": "GPL-3.0",
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
<p class="transparent-text" id="bepinex-version-text"></p>
|
||||
<br />
|
||||
<div class="horizontal-div">
|
||||
<button class="default-button" onclick="installBepinex()">Install</button>
|
||||
<button id="install-bepinex-button" class="default-button" onclick="installBepinex()">Install</button>
|
||||
<button class="important-button" onclick="uninstallBepinex()">Uninstall</button>
|
||||
<button class="default-button" onclick="backupBepinex()">Backup</button>
|
||||
<button class="important-button" onclick="deleteBepinexBackup()">Delete Backup</button>
|
||||
|
||||
@@ -589,6 +589,7 @@ async function deleteBepinexBackup() {
|
||||
|
||||
async function setBepinexVersion() {
|
||||
const bepinexVersionText = document.getElementById("bepinex-version-text");
|
||||
const bepinexInstallButton = document.getElementById("install-bepinex-button");
|
||||
if (bepinexVersionText == undefined) {
|
||||
return;
|
||||
}
|
||||
@@ -601,8 +602,10 @@ async function setBepinexVersion() {
|
||||
} else {
|
||||
bepinexVersionText.innerText = `BepInEx ${bepinexBackupVersion} is backed up`;
|
||||
}
|
||||
bepinexInstallButton.innerText = "Install";
|
||||
} else {
|
||||
bepinexVersionText.innerText = `BepInEx ${bepinexVersion} is installed`;
|
||||
bepinexInstallButton.innerText = "Update";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user