aboutsummaryrefslogtreecommitdiff
path: root/src/app/main.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-05-12 01:34:07 +0200
committer0neGal <mail@0negal.com>2022-05-12 01:34:07 +0200
commit72f85aa2297f5c46d029f1e25193aa98ced884c3 (patch)
tree44815685bbd4c9f5514b015616d0c2629b5e2274 /src/app/main.js
parent108c7b97100d2a40e82f8196109c99d1d59b59ee (diff)
downloadViper-72f85aa2297f5c46d029f1e25193aa98ced884c3.tar.gz
Viper-72f85aa2297f5c46d029f1e25193aa98ced884c3.zip
initial draft for supporting dependencies
This should allow you to install packages that have dependencies, however maybe not with the best UI/UX experience, as currently there's only an English localization, and we also install dependencies even if the dependency is already installed.
Diffstat (limited to 'src/app/main.js')
-rw-r--r--src/app/main.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 95b6f4c..109ca61 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -190,6 +190,8 @@ function selected(all) {
}
}
+let installqueue = [];
+
// Tells the main process to install a mod through the file selector
function installmod() {
setButtons(false);
@@ -203,9 +205,40 @@ function installFromPath(path) {
}
// Tells the main process to install a mod from a URL
-function installFromURL(url) {
+function installFromURL(url, dependencies, clearqueue) {
+ if (clearqueue) {installqueue = []};
+ console.log(installqueue)
+
+ let prettydepends = [];
+
+ if (dependencies) {
+ let newdepends = [];
+ for (let i = 0; i < dependencies.length; i++) {
+ let depend = dependencies[i].toLowerCase();
+ console.log(depend)
+ if (! depend.match(/northstar-northstar-.*/)) {
+ newdepends.push(dependencies[i].replaceAll("-", "/"));
+ let pkg = newdepends[newdepends.length - 1].split("/");
+ prettydepends.push(`${pkg[1]} v${pkg[2]} - ${lang("gui.browser.madeby")} ${pkg[0]}`);
+ }
+ }
+
+ dependencies = newdepends;
+ }
+
+ if (dependencies && dependencies.length != 0) {
+ let confirminstall = confirm(lang("gui.mods.confirmdependencies") + prettydepends.join("\n"));
+ if (! confirminstall) {
+ return
+ }
+ }
+
setButtons(false);
- ipcRenderer.send("installfromurl", url)
+ ipcRenderer.send("installfromurl", url, dependencies)
+
+ if (dependencies) {
+ installqueue = dependencies;
+ }
}
// Frontend part of settings a new game path