diff options
author | 0neGal <mail@0negal.com> | 2023-07-24 20:38:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 20:38:21 +0200 |
commit | b18038892db6567acb56822d1d7a1fe35f1c225f (patch) | |
tree | afeac6f0d804be5d4f812afcbadc63ff8d2854fa /src/app/main.js | |
parent | 112610902caef019ea4af17d77079cd090d6b9b5 (diff) | |
parent | 55040f6808f4aef3cd7ba86a45290d03963c37bd (diff) | |
download | Viper-b18038892db6567acb56822d1d7a1fe35f1c225f.tar.gz Viper-b18038892db6567acb56822d1d7a1fe35f1c225f.zip |
Merge pull request #191 from 0neGal/packages-dir
feat: Support for the new packages folder
Diffstat (limited to 'src/app/main.js')
-rw-r--r-- | src/app/main.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/app/main.js b/src/app/main.js index 1dbff40..51d9e73 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -3,7 +3,12 @@ const path = require("path"); const { app, ipcRenderer, shell } = require("electron"); const lang = require("../lang"); -var modsobj = {}; +var modsobj = { + all: [], + enabled: [], + disabled: [] +} + let shouldInstallNorthstar = false; // Base settings @@ -168,7 +173,7 @@ function installFromPath(path) { } // Tells the main process to install a mod from a URL -function installFromURL(url, dependencies, clearqueue, author) { +function installFromURL(url, dependencies, clearqueue, author, package_name, version) { if (clearqueue) {installqueue = []}; let prettydepends = []; @@ -183,7 +188,9 @@ function installFromURL(url, dependencies, clearqueue, author) { if (! isModInstalled(pkg[1])) { newdepends.push({ pkg: depend, - author: pkg[0] + author: pkg[0], + version: pkg[2], + package_name: pkg[1] }); prettydepends.push(`${pkg[1]} v${pkg[2]} - ${lang("gui.browser.madeby")} ${pkg[0]}`); @@ -202,7 +209,7 @@ function installFromURL(url, dependencies, clearqueue, author) { } setButtons(false); - ipcRenderer.send("install-from-url", url, author); + ipcRenderer.send("install-from-url", url, author, package_name, version); if (dependencies) { installqueue = dependencies; @@ -212,11 +219,11 @@ function installFromURL(url, dependencies, clearqueue, author) { function isModInstalled(modname) { for (let i = 0; i < modsobj.all.length; i++) { let mod = modsobj.all[i]; - if (mod.ManifestName) { - if (mod.ManifestName.match(modname)) { + if (mod.manifest_name) { + if (mod.manifest_name.match(modname)) { return true; } - } else if (mod.Name.match(modname)) { + } else if (mod.name.match(modname)) { return true; } } |