this commit should fix all the previous issues, also peppy fixed osu!.exe patch update

This commit is contained in:
HorizonCode 2024-01-22 12:00:50 +01:00
parent 397c2255c1
commit 705e47a1b8
3 changed files with 32 additions and 19 deletions

View File

@ -9,7 +9,6 @@ const checkUpdateURL =
"https://osu.ppy.sh/web/check-updates.php?action=check&stream="; "https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
const ignoredOsuEntities = [ const ignoredOsuEntities = [
"osu!auth.dll", "osu!auth.dll",
"osu!.exe"
]; ];
const osuEntities = [ const osuEntities = [
"avcodec-51.dll", "avcodec-51.dll",
@ -417,8 +416,6 @@ async function findOsuInstallation() {
return undefined; return undefined;
} }
async function updateOsuConfigHashes(osuPath) { async function updateOsuConfigHashes(osuPath) {
const osuCfg = path.join(osuPath, "osu!.cfg"); const osuCfg = path.join(osuPath, "osu!.cfg");
const fileStream = await fs.promises.readFile(osuCfg, "utf-8"); const fileStream = await fs.promises.readFile(osuCfg, "utf-8");
@ -435,7 +432,9 @@ async function updateOsuConfigHashes(osuPath) {
const filePath = path.join(osuPath, fileName); const filePath = path.join(osuPath, fileName);
if (!fs.existsSync(filePath)) continue; if (!fs.existsSync(filePath)) continue;
const binaryFileContents = await fs.promises.readFile(filePath); const binaryFileContents = await fs.promises.readFile(filePath);
const existingFileMD5 = crypto.createHash("md5").update(binaryFileContents).digest("hex"); const existingFileMD5 = crypto.createHash("md5").update(
binaryFileContents,
).digest("hex");
if (value == existingFileMD5) newLines.push(line); if (value == existingFileMD5) newLines.push(line);
else newLines.push(`${key} = ${existingFileMD5}`); else newLines.push(`${key} = ${existingFileMD5}`);
} else if (line.startsWith("u_UpdaterAutoStart")) { } else if (line.startsWith("u_UpdaterAutoStart")) {
@ -448,7 +447,7 @@ async function updateOsuConfigHashes(osuPath) {
} }
} }
await fs.promises.writeFile(osuCfg, newLines.join("\n"), 'utf-8'); await fs.promises.writeFile(osuCfg, newLines.join("\n"), "utf-8");
} }
module.exports = { module.exports = {
@ -465,5 +464,5 @@ module.exports = {
getUIFiles, getUIFiles,
replaceUIFile, replaceUIFile,
findOsuInstallation, findOsuInstallation,
updateOsuConfigHashes updateOsuConfigHashes,
}; };

20
main.js
View File

@ -369,7 +369,8 @@ function registerIPCPipes() {
progress: Math.ceil(data.progress), progress: Math.ceil(data.progress),
}); });
mainWindow.webContents.send("ezpplauncher:launchstatus", { mainWindow.webContents.send("ezpplauncher:launchstatus", {
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total) status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
formatBytes(data.total)
})...`, })...`,
}); });
}); });
@ -399,7 +400,8 @@ function registerIPCPipes() {
progress: Math.ceil(data.progress), progress: Math.ceil(data.progress),
}); });
mainWindow.webContents.send("ezpplauncher:launchstatus", { mainWindow.webContents.send("ezpplauncher:launchstatus", {
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total) status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
formatBytes(data.total)
})...`, })...`,
}); });
}); });
@ -445,7 +447,8 @@ function registerIPCPipes() {
progress: Math.ceil(data.progress), progress: Math.ceil(data.progress),
}); });
mainWindow.webContents.send("ezpplauncher:launchstatus", { mainWindow.webContents.send("ezpplauncher:launchstatus", {
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total) status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${
formatBytes(data.total)
})...`, })...`,
}); });
}); });
@ -477,7 +480,11 @@ function registerIPCPipes() {
const userConfig = getUserConfig(osuPath); const userConfig = getUserConfig(osuPath);
richPresence.updateVersion(await userConfig.get("LastVersion")); richPresence.updateVersion(await userConfig.get("LastVersion"));
richPresence.update(); richPresence.update();
await userConfig.set("ShowInterfaceDuringRelax", "1");
if (currentUser) { if (currentUser) {
await userConfig.set("CredentialEndpoint", "ez-pp.farm");
await userConfig.set("SavePassword", "1");
await userConfig.set("SaveUsername", "1");
await userConfig.set("Username", currentUser.username); await userConfig.set("Username", currentUser.username);
await userConfig.set("Password", currentUser.password); await userConfig.set("Password", currentUser.password);
} }
@ -559,13 +566,14 @@ function createWindow() {
registerIPCPipes(); registerIPCPipes();
const presenceEnabled = config.get("presence"); const presenceEnabled = config.get("presence");
if (presenceEnabled == undefined) if (presenceEnabled == undefined) {
richPresence.connect(); richPresence.connect();
else { } else {
console.log(presenceEnabled); console.log(presenceEnabled);
if (presenceEnabled == "true") if (presenceEnabled == "true") {
richPresence.connect(); richPresence.connect();
} }
}
// Uncomment the following line of code when app is ready to be packaged. // Uncomment the following line of code when app is ready to be packaged.
// loadURL(mainWindow); // loadURL(mainWindow);

View File

@ -150,9 +150,15 @@
/> />
<!-- TODO: if user has donator, display heart indicator--> <!-- TODO: if user has donator, display heart indicator-->
{#if $currentUser && $currentUser.id == 1001} {#if $currentUser && $currentUser.id == 1001}
<Indicator color="red" border size="xl" placement="top-right"> <Indicator
class="pointer-events-none"
color="red"
border
size="xl"
placement="top-right"
>
<span class="text-red-300 text-xs font-bold"> <span class="text-red-300 text-xs font-bold">
<HeartSolid size="xs" /> <HeartSolid class="select-none pointer-events-none" size="xs" />
</span> </span>
</Indicator> </Indicator>
{/if} {/if}