get updated files from osu
This commit is contained in:
parent
830b1099ac
commit
2bf98db729
12
app.js
12
app.js
|
@ -22,12 +22,18 @@ const run = () => {
|
||||||
mainWindow = createWindow();
|
mainWindow = createWindow();
|
||||||
mainWindow.on('show', async () => {
|
mainWindow.on('show', async () => {
|
||||||
const osuPath = await config.get("osuPath", "");
|
const osuPath = await config.get("osuPath", "");
|
||||||
if(fs.existsSync(osuPath)){
|
if (fs.existsSync(osuPath)) {
|
||||||
tempOsuPath = osuPath;
|
tempOsuPath = osuPath;
|
||||||
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
|
||||||
console.log(osuConfig);
|
|
||||||
const lastVersion = await osuConfig.get("LastVersion");
|
const lastVersion = await osuConfig.get("LastVersion");
|
||||||
console.log(lastVersion);
|
let releaseStream = "stable40";
|
||||||
|
if (lastVersion.endsWith("cuttingedge"))
|
||||||
|
releaseStream = "cuttingedge"
|
||||||
|
else if (lastVersion.endsWith("beta"))
|
||||||
|
releaseStream = "beta";
|
||||||
|
|
||||||
|
const releaseFiles = await osuUtil.getUpdateFiles(releaseStream);
|
||||||
|
console.log(releaseFiles);
|
||||||
//Do update check
|
//Do update check
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const axios = require('axios').default;
|
||||||
|
|
||||||
|
const checkUpdateURL = "https://osu.ppy.sh/web/check-updates.php?action=check&stream=";
|
||||||
const osuEntities = [
|
const osuEntities = [
|
||||||
'avcodec-51.dll',
|
'avcodec-51.dll',
|
||||||
'avformat-52.dll',
|
'avformat-52.dll',
|
||||||
|
@ -75,8 +77,9 @@ async function getLatestConfig(osuPath) {
|
||||||
return configFileInfo;
|
return configFileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkForUpdate(path) {
|
async function getUpdateFiles(releaseStream) {
|
||||||
|
const releaseData = await axios.get(checkUpdateURL + releaseStream, {});
|
||||||
|
return releaseData.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { isValidOsuFolder, getLatestConfig }
|
module.exports = { isValidOsuFolder, getLatestConfig, getUpdateFiles }
|
Loading…
Reference in New Issue
Block a user