👀
This commit is contained in:
parent
42777c9e0c
commit
47f86501b8
5
app.js
5
app.js
|
@ -120,7 +120,6 @@ const run = () => {
|
|||
|
||||
rpc.connect();
|
||||
|
||||
|
||||
let mainWindow;
|
||||
let tray = null
|
||||
app.whenReady().then(async () => {
|
||||
|
@ -195,18 +194,15 @@ const run = () => {
|
|||
} else linuxWMCtrlFound = true;
|
||||
} else {
|
||||
const osuFolder = await config.get("osuPath");
|
||||
console.log(osuFolder, !osuFolder || osuFolder == "");
|
||||
if (!osuFolder || osuFolder == "") {
|
||||
const foundFolder = await osuUtil.findOsuInstallation();
|
||||
if (foundFolder && osuUtil.isValidOsuFolder(foundFolder)) {
|
||||
mainWindow.webContents.send('alert_message', foundFolder);
|
||||
}
|
||||
console.log("osu! Installation located at: ", foundFolder);
|
||||
}
|
||||
}
|
||||
});
|
||||
ipcMain.on("alert_response", async (event, path) => {
|
||||
console.log("yes");
|
||||
await config.set("osuPath", path);
|
||||
})
|
||||
app.on('activate', function () {
|
||||
|
@ -358,7 +354,6 @@ async function tryLogin(window) {
|
|||
|
||||
async function doUpdateCheck(window) {
|
||||
const osuPath = await config.get("osuPath");
|
||||
console.log("osuPath:", osuPath);
|
||||
if (!osuPath || osuPath.trim == "") {
|
||||
window.webContents.send('status_update', {
|
||||
type: "missing-folder"
|
||||
|
|
29
osuUtil.js
29
osuUtil.js
|
@ -8,7 +8,8 @@ const { EventEmitter } = require('events');
|
|||
const { DownloaderHelper } = require('node-downloader-helper');
|
||||
|
||||
const checkUpdateURL = "https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
|
||||
const customUIDLLPath = "";
|
||||
const customUIDLLPath = "https://ez-pp.farm/assets/ezpp!ui.dll";
|
||||
const customUIDLLHash = "https://ez-pp.farm/assets/ezpp!ui.md5";
|
||||
const customUIDLLName = "ezpp!ui.dll";
|
||||
const ignoredOsuEntities = [
|
||||
'osu!auth.dll',
|
||||
|
@ -85,6 +86,11 @@ async function getUpdateFiles(releaseStream) {
|
|||
return releaseData.data;
|
||||
}
|
||||
|
||||
async function getEZPPUIMD5() {
|
||||
const releaseData = await axios.get(customUIDLLHash, {});
|
||||
return releaseData.data;
|
||||
}
|
||||
|
||||
async function filesThatNeedUpdate(osuPath, updateFiles) {
|
||||
const filesToDownload = [];
|
||||
for (const updatedFile of updateFiles) {
|
||||
|
@ -111,6 +117,24 @@ async function filesThatNeedUpdate(osuPath, updateFiles) {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
const ezppUI = path.join(osuPath, customUIDLLName);
|
||||
if (fs.existsSync(ezppUI)) {
|
||||
const latestMd5Hash = await getEZPPUIMD5();
|
||||
const binaryUIContents = await fs.promises.readFile(ezppUI);
|
||||
const existingUIMD5 = crypto.createHash("md5").update(binaryUIContents).digest("hex");
|
||||
if (existingUIMD5 != latestMd5Hash) {
|
||||
filesToDownload.push({
|
||||
fileName: "ezpp!ui.dll",
|
||||
fileURL: customUIDLLPath
|
||||
})
|
||||
}
|
||||
} else
|
||||
filesToDownload.push({
|
||||
fileName: "ezpp!ui.dll",
|
||||
fileURL: customUIDLLPath
|
||||
})
|
||||
|
||||
return filesToDownload;
|
||||
}
|
||||
|
||||
|
@ -119,7 +143,6 @@ async function downloadUpdateFiles(osuPath, filesToUpdate) {
|
|||
let completedIndex = 0;
|
||||
filesToUpdate.forEach(async (fileToUpdate) => {
|
||||
const filePath = path.join(osuPath, fileToUpdate.fileName);
|
||||
console.log(filePath);
|
||||
if (await fu.existsAsync(filePath))
|
||||
await fs.promises.rm(filePath);
|
||||
|
||||
|
@ -240,5 +263,5 @@ async function replaceUI(folder, isStart) {
|
|||
module.exports = {
|
||||
isValidOsuFolder, getLatestConfig, getUpdateFiles, filesThatNeedUpdate,
|
||||
downloadUpdateFiles, startOsuWithDevServer: startWithDevServer, setConfigValue,
|
||||
findOsuInstallation, replaceUI, updateOsuCfg
|
||||
findOsuInstallation, replaceUI, updateOsuCfg, getEZPPUIMD5
|
||||
}
|
Loading…
Reference in New Issue
Block a user