aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-01-12 18:51:02 +0100
committer0neGal <mail@0negal.com>2023-01-12 18:51:02 +0100
commitbb25cfe318da51cec0ea8cafff09461ba3117443 (patch)
tree96cea8de0dc5bd2841018393811890991bd06a91 /src/app
parent25940f0bba1f207afaad8bb395e440852fadc83b (diff)
downloadViper-bb25cfe318da51cec0ea8cafff09461ba3117443.tar.gz
Viper-bb25cfe318da51cec0ea8cafff09461ba3117443.zip
basically support thunderstore_author.txt
This doesn't entirely uphold support, as it doesn't use the author file for anything, however it does write it as intended.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/browser.js16
-rw-r--r--src/app/main.js10
2 files changed, 21 insertions, 5 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 995a276..dee263b 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -363,13 +363,21 @@ function BrowserEl(properties) {
<div class="text">
<div class="title">${properties.title}</div>
<div class="description">${properties.description}</div>
- <button class="install" onclick='installFromURL("${properties.download}", ${JSON.stringify(properties.dependencies)}, true)'>${installstr}</button>
+ <button class="install" onclick=''>${installstr}</button>
<button class="info" onclick="Preview.set('${properties.url}')">${lang('gui.browser.view')}</button>
<button class="visual">${properties.version}</button>
<button class="visual">${lang("gui.browser.madeby")} ${properties.author}</button>
</div>
`
+ entry.querySelector("button.install").addEventListener("click", () => {
+ installFromURL(
+ properties.download,
+ JSON.stringify(properties.dependencies),
+ true, properties.author
+ )
+ })
+
browserEntries.appendChild(entry);
}
@@ -451,7 +459,11 @@ ipcRenderer.on("installed-mod", (event, mod) => {
})
if (installqueue.length != 0) {
- installFromURL("https://thunderstore.io/package/download/" + installqueue[0]);
+ installFromURL(
+ "https://thunderstore.io/package/download/" + installqueue[0].pkg,
+ false, false, installqueue[0].author
+ )
+
installqueue.shift();
}
})
diff --git a/src/app/main.js b/src/app/main.js
index 9d59cbc..50160d0 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -235,7 +235,7 @@ function installFromPath(path) {
}
// Tells the main process to install a mod from a URL
-function installFromURL(url, dependencies, clearqueue) {
+function installFromURL(url, dependencies, clearqueue, author) {
if (clearqueue) {installqueue = []};
let prettydepends = [];
@@ -248,7 +248,11 @@ function installFromURL(url, dependencies, clearqueue) {
depend = dependencies[i].replaceAll("-", "/");
let pkg = depend.split("/");
if (! isModInstalled(pkg[1])) {
- newdepends.push(depend);
+ newdepends.push({
+ pkg: depend,
+ author: pkg[0]
+ });
+
prettydepends.push(`${pkg[1]} v${pkg[2]} - ${lang("gui.browser.madeby")} ${pkg[0]}`);
}
}
@@ -265,7 +269,7 @@ function installFromURL(url, dependencies, clearqueue) {
}
setButtons(false);
- ipcRenderer.send("install-from-url", url, dependencies);
+ ipcRenderer.send("install-from-url", url, author);
if (dependencies) {
installqueue = dependencies;