From 39d8f10c282c409d5fa2d62b0d39c33d183e90c8 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Mon, 7 Feb 2022 21:46:04 +0100 Subject: added support for more obscure mod structure If a developer for some reason decides to put their mod inside mods/ instead of putting it inside a folder in mods/, it used to fail the install, now that's fixed. However since there's no folder to directly copy the name from we take it from the manifest.json provided by Thunderstore. It of course also has the proper status in the browser UI (update/reinstall etc) --- src/app/browser.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/app') diff --git a/src/app/browser.js b/src/app/browser.js index 7b67822..c266b41 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -77,10 +77,15 @@ var Browser = { setTimeout(() => { for (let i = 0; i < modsobj.all.length; i++) { let modname = normalize(modsobj.all[i].Name); + let modfolder = normalize(modsobj.all[i].FolderName); if (mod.includes(modname)) { if (document.getElementById(modname)) { Browser.setbutton(modname, string); } + } else if (mod.includes(modfolder)) { + if (document.getElementById(modfolder)) { + Browser.setbutton(modfolder, string); + } } } }, 1501) @@ -137,6 +142,20 @@ function BrowserEl(properties) { installstr = lang("gui.browser.update"); } } + } else { + for (let i = 0; i < modsobj.all.length; i++) { + let title = normalize(properties.title); + let folder = normalize(modsobj.all[i].FolderName); + if (title.includes(folder)) { + installstr = lang("gui.browser.reinstall"); + + if (folder == title + && "v" + modsobj.all[i].Version != properties.version) { + + installstr = lang("gui.browser.update"); + } + } + } } browserEntries.innerHTML += ` -- cgit v1.2.3