aboutsummaryrefslogtreecommitdiff
path: root/src/modules/packages.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-07-22 01:23:04 +0200
committer0neGal <mail@0negal.com>2023-07-22 01:23:04 +0200
commitc3652b72b7bb3bcce207139ebc718e15f6746e43 (patch)
treef3ba70e7ccbee09c1f61a7100886be1a75e93c8c /src/modules/packages.js
parent73a651b63c29e24774c1ba3952a2d6c977101047 (diff)
downloadViper-c3652b72b7bb3bcce207139ebc718e15f6746e43.tar.gz
Viper-c3652b72b7bb3bcce207139ebc718e15f6746e43.zip
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.
Diffstat (limited to 'src/modules/packages.js')
-rw-r--r--src/modules/packages.js10
1 files changed, 9 insertions, 1 deletions
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;
}