diff options
author | 0neGal <mail@0negal.com> | 2023-01-28 23:31:18 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2023-01-28 23:31:18 +0100 |
commit | 542186aad67a59d54c973c8fad625ac4f7285016 (patch) | |
tree | b64dff95abcb54837269b1ca126ca13b484a4324 | |
parent | 843f9458141a2ec10c29ff349986539b64211de4 (diff) | |
download | Viper-542186aad67a59d54c973c8fad625ac4f7285016.tar.gz Viper-542186aad67a59d54c973c8fad625ac4f7285016.zip |
expose mod author with mods.list()
-rw-r--r-- | src/modules/mods.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/modules/mods.js b/src/modules/mods.js index 1cb919a..9aa2c81 100644 --- a/src/modules/mods.js +++ b/src/modules/mods.js @@ -57,6 +57,7 @@ mods.list = () => { if (! mod) {return} let obj = { + Author: false, Version: "unknown", Name: "unknown", FolderName: file, @@ -64,9 +65,9 @@ mods.list = () => { obj.Disabled = ! mods.modfile.get(obj.Name); - let manifestfile = path.join(mods.path, file, "manifest.json"); - if (fs.existsSync(manifestfile)) { - let manifest = json(manifestfile); + let manifest_file = path.join(mods.path, file, "manifest.json"); + if (fs.existsSync(manifest_file)) { + let manifest = json(manifest_file); if (manifest != false) { obj.ManifestName = manifest.name; if (obj.Version == "unknown") { @@ -75,6 +76,11 @@ mods.list = () => { } } + let author_file = path.join(mods.path, file, "thunderstore_author.txt"); + if (fs.existsSync(author_file)) { + obj.Author = fs.readFileSync(author_file, "utf8"); + } + if (obj.Disabled) { disabled.push(obj); } else { |