From c3652b72b7bb3bcce207139ebc718e15f6746e43 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 22 Jul 2023 01:23:04 +0200 Subject: mostly support installing packages through GUI Install toasts, installing overall, dependencies and so forth, all seem to be fully functional, however more bug testing is probably required to concluce whether that is actually the case or not... This also doesn't break `src/modules/mods.js`, i.e dragging mods in to manually install them still functions the same as always. --- src/modules/packages.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/packages.js b/src/modules/packages.js index 12659fe..317f0b0 100644 --- a/src/modules/packages.js +++ b/src/modules/packages.js @@ -1,7 +1,7 @@ const path = require("path"); const fs = require("fs-extra"); const unzip = require("unzipper"); -const app = require("electron").app; +const { app, ipcMain } = require("electron"); const https = require("follow-redirects").https; const json = require("./json"); @@ -203,6 +203,8 @@ packages.install = async (url, author, package_name, version) => { } break; default: + ipcMain.emit("failed-mod", name); + // other unhandled error return console.log( "Verification of package failed:", name, @@ -233,10 +235,16 @@ packages.install = async (url, author, package_name, version) => { let moved = packages.move(package_path); if (! moved) { + ipcMain.emit("failed-mod", name); console.log("Moving package failed:", name); return false; } + ipcMain.emit("installed-mod", "", { + name: name, + fancy_name: package_name + }) + console.log("Installed package:", name); return true; } -- cgit v1.2.3