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