diff options
author | 0neGal <mail@0negal.com> | 2024-12-20 01:49:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-20 01:49:06 +0100 |
commit | a8ba1b376ff16a69c52f223341a2ed39fd59a8ea (patch) | |
tree | 2a8c0535a22264f4f3d37d684231d2ac147ac199 /src | |
parent | 7403086ce7d2a9d3b68801dc4c2135f5766b8d60 (diff) | |
parent | bd4391f737ee4405fc390ab47c4124fe28df48d7 (diff) | |
download | Viper-a8ba1b376ff16a69c52f223341a2ed39fd59a8ea.tar.gz Viper-a8ba1b376ff16a69c52f223341a2ed39fd59a8ea.zip |
Merge branch 'main' into gamepad-supportgamepad-support
Diffstat (limited to 'src')
-rw-r--r-- | src/app/js/browser.js | 27 | ||||
-rw-r--r-- | src/cli.js | 6 | ||||
-rw-r--r-- | src/lang/de.json | 1 | ||||
-rw-r--r-- | src/lang/en.json | 1 | ||||
-rw-r--r-- | src/lang/es.json | 3 | ||||
-rw-r--r-- | src/lang/fr.json | 1 | ||||
-rw-r--r-- | src/lang/zh.json | 1 | ||||
-rw-r--r-- | src/modules/findgame.js | 2 |
8 files changed, 28 insertions, 14 deletions
diff --git a/src/app/js/browser.js b/src/app/js/browser.js index 7dc84d9..bd9506f 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -1,5 +1,5 @@ const Fuse = require("fuse.js"); -const ipcRenderer = require("electron").ipcRenderer; +const { ipcRenderer, shell } = require("electron"); const lang = require("../../lang"); @@ -414,13 +414,24 @@ browser.mod_el = (properties) => { let installicon = "downloads"; let installstr = lang("gui.browser.install"); - let normalized_mods = []; + let normalized_title = mods.normalize(properties.title) + let installcallback = () => { + browser.install(properties); + } - for (let i = 0; i < mods.list().all; i++) { - normalized_mods.push(mods.normalize(mods_list[i].name)); + let nondefault_install = { + "vanillaplus": "https://github.com/Zayveeo5e/NP.VanillaPlus/blob/main/README.md" } - if (properties.pkg.local_version) { + if (normalized_title in nondefault_install) { + installicon = "open"; + installstr = lang("gui.browser.guide"); + + installcallback = () => { + shell.openExternal(nondefault_install[normalized_title]) + } + } + else if (properties.pkg.local_version) { installicon = "redo"; installstr = lang("gui.browser.reinstall"); @@ -432,7 +443,7 @@ browser.mod_el = (properties) => { let entry = document.createElement("div"); entry.classList.add("el"); - entry.id = `mod-${mods.normalize(properties.title)}`; + entry.id = `mod-${normalized_title}`; entry.innerHTML = ` <div class="image"> @@ -459,9 +470,7 @@ browser.mod_el = (properties) => { </div> ` - entry.querySelector("button.install").addEventListener("click", () => { - browser.install(properties); - }) + entry.querySelector("button.install").addEventListener("click", installcallback) browserEntries.appendChild(entry); } @@ -115,9 +115,9 @@ async function init() { } // Mod related args, --installmod, --removemod, --togglemod - if (cli.hasSwitch("installmod") && gamepathExists()) {ipcMain.emit("installmod")} - if (cli.hasSwitch("removemod") && gamepathExists()) {ipcMain.emit("removemod", "", cli.getSwitchValue("removemod"))} - if (cli.hasSwitch("togglemod") && gamepathExists()) {ipcMain.emit("togglemod", "", cli.getSwitchValue("togglemod"))} + if (cli.hasSwitch("installmod") && gamepathExists()) {ipcMain.emit("install-mod")} + if (cli.hasSwitch("removemod") && gamepathExists()) {ipcMain.emit("remove-mod", "", cli.getSwitchValue("removemod"))} + if (cli.hasSwitch("togglemod") && gamepathExists()) {ipcMain.emit("toggle-mod", "", cli.getSwitchValue("togglemod"))} // Prints out the list of mods if (cli.hasSwitch("mods") && gamepathExists()) {ipcMain.emit("getmods")} diff --git a/src/lang/de.json b/src/lang/de.json index 9e68986..0eb17dc 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -72,6 +72,7 @@ "server": "Server-seitig", "skins": "Skins" }, + "guide": "Anleitung", "info": "Info", "install": "Installieren", "load_more": "Lade mehr...", diff --git a/src/lang/en.json b/src/lang/en.json index c705517..f968f73 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -119,6 +119,7 @@ "load_more": "Load more...", "end_of_list": "All packages have been loaded.", "no_results": "No results...", + "guide": "Guide", "filter": { "mods": "Mods", diff --git a/src/lang/es.json b/src/lang/es.json index 3da6d89..ebde5f9 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -72,6 +72,7 @@ "server": "Del lado del servidor", "skins": "Skins" }, + "guide": "Guía", "info": "Información", "install": "Instalar", "load_more": "Cargar más...", @@ -286,4 +287,4 @@ "release": "Notas de la versión" } } -} +}
\ No newline at end of file diff --git a/src/lang/fr.json b/src/lang/fr.json index 52d9703..492ba76 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -72,6 +72,7 @@ "server": "Côté serveur", "skins": "Skins" }, + "guide": "Guide", "info": "Info", "install": "Installer", "load_more": "Charger plus de mods...", diff --git a/src/lang/zh.json b/src/lang/zh.json index ae086d4..2976eed 100644 --- a/src/lang/zh.json +++ b/src/lang/zh.json @@ -72,6 +72,7 @@ "server": "服务器端", "skins": "皮肤" }, + "guide": "安装指南", "info": "详情", "install": "安装", "load_more": "加载更多...", diff --git a/src/modules/findgame.js b/src/modules/findgame.js index f8d0126..d53397b 100644 --- a/src/modules/findgame.js +++ b/src/modules/findgame.js @@ -31,7 +31,7 @@ module.exports = async () => { data = vdf.parse(data); // parse read_data // verify VDF was parsed correctly - if (! data || typeof data !== "object") { + if (! data || typeof data !== "object" || ! data.libraryfolders) { return; } |