diff options
-rw-r--r-- | .github/workflows/localizations.yml | 21 | ||||
-rw-r--r-- | package-lock.json | 84 | ||||
-rw-r--r-- | package.json | 6 | ||||
-rw-r--r-- | scripts/langs.js | 12 | ||||
-rwxr-xr-x | scripts/publish.sh | 2 | ||||
-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 |
13 files changed, 105 insertions, 62 deletions
diff --git a/.github/workflows/localizations.yml b/.github/workflows/localizations.yml new file mode 100644 index 0000000..072d0bc --- /dev/null +++ b/.github/workflows/localizations.yml @@ -0,0 +1,21 @@ +name: Localizations +on: + push: + pull_request: + types: [opened, reopened] + +jobs: + check-localizations: + name: "Check localizations" + runs-on: "ubuntu-latest" + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Setup Node environment + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install dependencies + run: npm install + - name: Check localizations + run: npm run langs:check diff --git a/package-lock.json b/package-lock.json index 3d93f18..a25334d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "viper", - "version": "1.12.0", + "version": "1.12.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "viper", - "version": "1.12.0", + "version": "1.12.1", "license": "GPL-3.0-or-later", "dependencies": { - "electron-updater": "^4.6.1", + "electron-updater": "^6.3.0", "enquirer": "^2.4.1", "flattenizer": "^1.1.3", "follow-redirects": "^1.15.6", @@ -20,7 +20,7 @@ "minimist": "^1.2.8", "recursive-copy": "^2.0.13", "simple-vdf": "^1.1.1", - "unzip-stream": "^0.3.1" + "unzip-stream": "^0.3.2" }, "devDependencies": { "electron": "^28.2.0", @@ -480,11 +480,6 @@ "@types/node": "*" } }, - "node_modules/@types/semver": { - "version": "7.3.9", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz", - "integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==" - }, "node_modules/@types/verror": { "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", @@ -1015,11 +1010,11 @@ } }, "node_modules/builder-util-runtime": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.9.1.tgz", - "integrity": "sha512-c8a8J3wK6BIVLW7ls+7TRK9igspTbzWmUqxFbgK0m40Ggm6efUbxtWVCGIjc+dtchyr5qAMAUL6iEGRdS/6vwg==", + "version": "9.2.5", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.5.tgz", + "integrity": "sha512-HjIDfhvqx/8B3TDN4GbABQcgpewTU4LMRTQPkVpKYV3lsuxEJoIfvg09GyWTNmfVNSUAYf+fbTN//JX4TH20pg==", "dependencies": { - "debug": "^4.3.2", + "debug": "^4.3.4", "sax": "^1.2.4" }, "engines": { @@ -1659,18 +1654,18 @@ } }, "node_modules/electron-updater": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-4.6.1.tgz", - "integrity": "sha512-YsU1mHqXLrXXmBMsxhxy24PrbaB8rnpZDPmFa2gOkTYk/Ch13+R0fjsRSpPYvqtskVVY0ux8fu+HnUkVkqc7og==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.0.tgz", + "integrity": "sha512-3Xlezhk+dKaSQrOnkQNqCGiuGSSUPO9BV9TQZ4Iig6AyTJ4FzJONE5gFFc382sY53Sh9dwJfzKsA3DxRHt2btw==", "dependencies": { - "@types/semver": "^7.3.6", - "builder-util-runtime": "8.9.1", - "fs-extra": "^10.0.0", + "builder-util-runtime": "9.2.5", + "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lazy-val": "^1.0.5", "lodash.escaperegexp": "^4.1.2", "lodash.isequal": "^4.5.0", - "semver": "^7.3.5" + "semver": "^7.3.8", + "tiny-typed-emitter": "^2.1.0" } }, "node_modules/electron-updater/node_modules/semver": { @@ -3490,6 +3485,11 @@ "fs-extra": "^10.0.0" } }, + "node_modules/tiny-typed-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", + "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==" + }, "node_modules/tmp": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", @@ -3566,9 +3566,9 @@ } }, "node_modules/unzip-stream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.1.tgz", - "integrity": "sha512-RzaGXLNt+CW+T41h1zl6pGz3EaeVhYlK+rdAap+7DxW5kqsqePO8kRtWPaCiVqdhZc86EctSPVYNix30YOMzmw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.2.tgz", + "integrity": "sha512-oWhfqwjx36ULFG+krfkbtbrc/BeEzaYrlqdEWa5EPNd6x6RerzuNW8aSTM0TtNtrOfUKYdO0TwrlkzrXAE6Olg==", "dependencies": { "binary": "^0.3.0", "mkdirp": "^0.5.1" @@ -4114,11 +4114,6 @@ "@types/node": "*" } }, - "@types/semver": { - "version": "7.3.9", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz", - "integrity": "sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==" - }, "@types/verror": { "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", @@ -4549,11 +4544,11 @@ } }, "builder-util-runtime": { - "version": "8.9.1", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.9.1.tgz", - "integrity": "sha512-c8a8J3wK6BIVLW7ls+7TRK9igspTbzWmUqxFbgK0m40Ggm6efUbxtWVCGIjc+dtchyr5qAMAUL6iEGRdS/6vwg==", + "version": "9.2.5", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.5.tgz", + "integrity": "sha512-HjIDfhvqx/8B3TDN4GbABQcgpewTU4LMRTQPkVpKYV3lsuxEJoIfvg09GyWTNmfVNSUAYf+fbTN//JX4TH20pg==", "requires": { - "debug": "^4.3.2", + "debug": "^4.3.4", "sax": "^1.2.4" } }, @@ -5027,18 +5022,18 @@ } }, "electron-updater": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-4.6.1.tgz", - "integrity": "sha512-YsU1mHqXLrXXmBMsxhxy24PrbaB8rnpZDPmFa2gOkTYk/Ch13+R0fjsRSpPYvqtskVVY0ux8fu+HnUkVkqc7og==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.3.0.tgz", + "integrity": "sha512-3Xlezhk+dKaSQrOnkQNqCGiuGSSUPO9BV9TQZ4Iig6AyTJ4FzJONE5gFFc382sY53Sh9dwJfzKsA3DxRHt2btw==", "requires": { - "@types/semver": "^7.3.6", - "builder-util-runtime": "8.9.1", - "fs-extra": "^10.0.0", + "builder-util-runtime": "9.2.5", + "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", "lazy-val": "^1.0.5", "lodash.escaperegexp": "^4.1.2", "lodash.isequal": "^4.5.0", - "semver": "^7.3.5" + "semver": "^7.3.8", + "tiny-typed-emitter": "^2.1.0" }, "dependencies": { "semver": { @@ -6431,6 +6426,11 @@ "fs-extra": "^10.0.0" } }, + "tiny-typed-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz", + "integrity": "sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==" + }, "tmp": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", @@ -6485,9 +6485,9 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" }, "unzip-stream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.1.tgz", - "integrity": "sha512-RzaGXLNt+CW+T41h1zl6pGz3EaeVhYlK+rdAap+7DxW5kqsqePO8kRtWPaCiVqdhZc86EctSPVYNix30YOMzmw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.2.tgz", + "integrity": "sha512-oWhfqwjx36ULFG+krfkbtbrc/BeEzaYrlqdEWa5EPNd6x6RerzuNW8aSTM0TtNtrOfUKYdO0TwrlkzrXAE6Olg==", "requires": { "binary": "^0.3.0", "mkdirp": "^0.5.1" diff --git a/package.json b/package.json index be9ab65..95d8119 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "viper", "productName": "Viper", - "version": "1.12.0", + "version": "1.12.1", "description": "Launcher+Updater for TF|2 Northstar", "main": "src/index.js", "build": { @@ -50,7 +50,7 @@ }, "homepage": "https://github.com/0neGal/viper#readme", "dependencies": { - "electron-updater": "^4.6.1", + "electron-updater": "^6.3.0", "enquirer": "^2.4.1", "flattenizer": "^1.1.3", "follow-redirects": "^1.15.6", @@ -61,7 +61,7 @@ "minimist": "^1.2.8", "recursive-copy": "^2.0.13", "simple-vdf": "^1.1.1", - "unzip-stream": "^0.3.1" + "unzip-stream": "^0.3.2" }, "devDependencies": { "electron": "^28.2.0", diff --git a/scripts/langs.js b/scripts/langs.js index 23b9924..b2f5287 100644 --- a/scripts/langs.js +++ b/scripts/langs.js @@ -361,10 +361,18 @@ let check = (logging = true) => { // run `check()` if `--check()` is set if (args["check"]) { - let problems = check(); + let has_problems = false; + + // check localizations, and set `has_problems` depending on whether + // any localization files have problems + Object.values(check()).forEach((item) => { + if (item.length) { + has_problems = true; + } + }); // exit with the correct exit code - if (problems.length) { + if (has_problems) { process.exit(1); } else { process.exit(); diff --git a/scripts/publish.sh b/scripts/publish.sh index bff91df..0a4e51d 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -26,7 +26,7 @@ REMOTEVERSION="$(curl --silent "https://api.github.com/repos/0neGal/viper/releas } -node scripts/langs.js || { +node scripts/langs.js --check || { echo "Please fix localization errors before publishing..." exit 1 } 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; } |