Compare commits
10 Commits
ecf329dd69
...
2.1.6
Author | SHA1 | Date | |
---|---|---|---|
86c9bc4a60 | |||
3bd1fb9edb | |||
8a8856772e | |||
80343bd929 | |||
9da481b991 | |||
70643c4287 | |||
db03ed552f | |||
6ccc285c61 | |||
a72ae1df5f | |||
9fbab69206 |
@@ -1,4 +1,4 @@
|
|||||||
const appName = "EZPPLauncher";
|
const appName = "EZPPLauncher";
|
||||||
const appVersion = "2.1.5";
|
const appVersion = "2.1.6";
|
||||||
|
|
||||||
module.exports = { appName, appVersion };
|
module.exports = { appName, appVersion };
|
||||||
|
@@ -271,6 +271,21 @@ async function downloadEZPPLauncherUpdateFiles(osuPath, updateFiles) {
|
|||||||
const eventEmitter = new EventEmitter();
|
const eventEmitter = new EventEmitter();
|
||||||
|
|
||||||
const startDownload = async () => {
|
const startDownload = async () => {
|
||||||
|
//NOTE: delete files that are not in the updateFiles array
|
||||||
|
const foldersToPrune = updateFiles.map(file => path.dirname(path.join(osuPath, ...file.folder.split("/"), file.name))).filter((folder, index, self) => self.indexOf(folder) === index);
|
||||||
|
for (const pruneFolder of foldersToPrune) {
|
||||||
|
//NOTE: check if the folder is not the osu root folder.
|
||||||
|
if (path.basename(pruneFolder) == "osu!")
|
||||||
|
continue;
|
||||||
|
for (const files of await fs.promises.readdir(pruneFolder)) {
|
||||||
|
const filePath = path.join(pruneFolder, files);
|
||||||
|
if (!updateFiles.some(file => path.join(osuPath, ...file.folder.split("/"), file.name) === filePath)) {
|
||||||
|
|
||||||
|
await fs.promises.rm(filePath, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const updateFile of updateFiles) {
|
for (const updateFile of updateFiles) {
|
||||||
try {
|
try {
|
||||||
const filePath = path.join(
|
const filePath = path.join(
|
||||||
|
24
main.js
24
main.js
@@ -116,7 +116,7 @@ function startOsuStatus() {
|
|||||||
const windowTitle = firstInstance.processTitle;
|
const windowTitle = firstInstance.processTitle;
|
||||||
lastOsuStatus = windowTitle;
|
lastOsuStatus = windowTitle;
|
||||||
const currentStatusRequest = await fetch(
|
const currentStatusRequest = await fetch(
|
||||||
"https://api.ez-pp.farm/get_player_status?name=" + currentUser.username,
|
"https://api.ez-pp.farm/v1/get_player_status?name=" + currentUser.username,
|
||||||
);
|
);
|
||||||
const currentStatus = await currentStatusRequest.json();
|
const currentStatus = await currentStatusRequest.json();
|
||||||
|
|
||||||
@@ -127,8 +127,7 @@ function startOsuStatus() {
|
|||||||
const currentModeString = gamemodes[currentMode];
|
const currentModeString = gamemodes[currentMode];
|
||||||
|
|
||||||
const currentInfoRequest = await fetch(
|
const currentInfoRequest = await fetch(
|
||||||
"https://api.ez-pp.farm/get_player_info?name=" + currentUser.username +
|
"https://api.ez-pp.farm/v1/get_player_info?name=" + currentUser.username + "&scope=all",
|
||||||
"&scope=all",
|
|
||||||
);
|
);
|
||||||
const currentInfo = await currentInfoRequest.json();
|
const currentInfo = await currentInfoRequest.json();
|
||||||
let currentUsername = currentInfo.player.info.name;
|
let currentUsername = currentInfo.player.info.name;
|
||||||
@@ -431,6 +430,12 @@ function registerIPCPipes() {
|
|||||||
return config.all();
|
return config.all();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("ezpplauncher:checkUpdate", async (e) => {
|
||||||
|
const updateInfo = await updateAvailable();
|
||||||
|
if (updateInfo.update)
|
||||||
|
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.handle("ezpplauncher:exitAndUpdate", async (e) => {
|
ipcMain.handle("ezpplauncher:exitAndUpdate", async (e) => {
|
||||||
await shell.openExternal(releasesUrl);
|
await shell.openExternal(releasesUrl);
|
||||||
app.exit();
|
app.exit();
|
||||||
@@ -524,8 +529,7 @@ 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)}/${
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)}/${formatBytes(data.total)
|
||||||
formatBytes(data.total)
|
|
||||||
})...`,
|
})...`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -579,8 +583,7 @@ 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}(${
|
status: `Downloading ${data.fileName}(${formatBytes(data.loaded)
|
||||||
formatBytes(data.loaded)
|
|
||||||
}/${formatBytes(data.total)})...`,
|
}/${formatBytes(data.total)})...`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -715,8 +718,7 @@ function registerIPCPipes() {
|
|||||||
const osuGameplayFile = path.join(osuPath, "osu!gameplay.dll");
|
const osuGameplayFile = path.join(osuPath, "osu!gameplay.dll");
|
||||||
if (isWritable(osuUIFile) && isWritable(osuGameplayFile)) {
|
if (isWritable(osuUIFile) && isWritable(osuGameplayFile)) {
|
||||||
logger.log(
|
logger.log(
|
||||||
`Cleanup complete, took ${
|
`Cleanup complete, took ${((performance.now() - timeStart) / 1000).toFixed(3)
|
||||||
((performance.now() - timeStart) / 1000).toFixed(3)
|
|
||||||
} seconds.`,
|
} seconds.`,
|
||||||
);
|
);
|
||||||
clearInterval(cleanup);
|
clearInterval(cleanup);
|
||||||
@@ -820,10 +822,6 @@ function createWindow() {
|
|||||||
// Emitted when the window is ready to be shown
|
// Emitted when the window is ready to be shown
|
||||||
// This helps in showing the window gracefully.
|
// This helps in showing the window gracefully.
|
||||||
mainWindow.once("ready-to-show", async () => {
|
mainWindow.once("ready-to-show", async () => {
|
||||||
const updateInfo = await updateAvailable();
|
|
||||||
if (updateInfo.update) {
|
|
||||||
mainWindow.webContents.send("ezpplauncher:update", updateInfo.release);
|
|
||||||
}
|
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
});
|
});
|
||||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@@ -24,7 +24,7 @@
|
|||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
"sweetalert2": "^11.10.3",
|
"sweetalert2": "^11.10.8",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -8533,9 +8533,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/sweetalert2": {
|
"node_modules/sweetalert2": {
|
||||||
"version": "11.10.7",
|
"version": "11.10.8",
|
||||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.7.tgz",
|
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.10.8.tgz",
|
||||||
"integrity": "sha512-5Jlzrmaitay6KzU+2+LhYu9q+L4v/dZ8oZyEDH14ep0C/QilCnFLHmqAyD/Lhq/lm5DiwsOs6Tr58iv8k3wyGg==",
|
"integrity": "sha512-oAkYROBfXBY+4sVbQEIcN+ZxAx69lsmz5WEBwdEpyS4m59vOBNlRU5/fJpAI1MVfiDwFZiGwVzB/KBpOyfLNtg==",
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
"url": "https://github.com/sponsors/limonte"
|
"url": "https://github.com/sponsors/limonte"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ezpplauncher-next",
|
"name": "ezpplauncher-next",
|
||||||
"version": "2.1.5",
|
"version": "2.1.6",
|
||||||
"description": "EZPPLauncher rewritten with Svelte.",
|
"description": "EZPPLauncher rewritten with Svelte.",
|
||||||
"private": false,
|
"private": false,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
"regedit-rs": "^1.0.2",
|
"regedit-rs": "^1.0.2",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"svelte-french-toast": "^1.2.0",
|
"svelte-french-toast": "^1.2.0",
|
||||||
"sweetalert2": "^11.10.3",
|
"sweetalert2": "^11.10.8",
|
||||||
"systeminformation": "^5.21.22"
|
"systeminformation": "^5.21.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@@ -82,6 +82,10 @@ window.addEventListener("settings-set", async (e) => {
|
|||||||
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
await ipcRenderer.invoke("ezpplauncher:settings-set", e.detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("updateCheck", async () => {
|
||||||
|
await ipcRenderer.invoke("ezpplauncher:checkUpdate");
|
||||||
|
})
|
||||||
|
|
||||||
window.addEventListener("updateExit", async () => {
|
window.addEventListener("updateExit", async () => {
|
||||||
await ipcRenderer.invoke("ezpplauncher:exitAndUpdate");
|
await ipcRenderer.invoke("ezpplauncher:exitAndUpdate");
|
||||||
});
|
});
|
||||||
|
@@ -66,6 +66,8 @@
|
|||||||
window.dispatchEvent(new CustomEvent("updateExit"));
|
window.dispatchEvent(new CustomEvent("updateExit"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.dispatchEvent(new CustomEvent("updateCheck"));
|
||||||
|
|
||||||
window.addEventListener("open-settings", (e) => {
|
window.addEventListener("open-settings", (e) => {
|
||||||
currentPage.set(Page.Settings);
|
currentPage.set(Page.Settings);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user