diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | assets/preview.png | bin | 257265 -> 266728 bytes | |||
-rw-r--r-- | package-lock.json | 42 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | src/app/browser.js | 78 | ||||
-rw-r--r-- | src/app/icons/check.png | bin | 0 -> 373 bytes | |||
-rw-r--r-- | src/app/icons/filter.png | bin | 0 -> 1074 bytes | |||
-rw-r--r-- | src/app/index.html | 12 | ||||
-rw-r--r-- | src/app/main.css | 47 | ||||
-rw-r--r-- | src/cli.js | 21 | ||||
-rw-r--r-- | src/index.js | 8 | ||||
-rw-r--r-- | src/lang/en.json | 6 | ||||
-rw-r--r-- | src/lang/es.json | 6 | ||||
-rw-r--r-- | src/lang/fr.json | 6 | ||||
-rw-r--r-- | src/utils.js | 2 |
15 files changed, 195 insertions, 43 deletions
@@ -1,6 +1,6 @@ <p align="center"> <img src="src/assets/icons/512x512.png" width="200px"><br> - <a href="https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-Setup-1.2.5.exe"><img src="assets/download.png" width="300px"></a><br> + <a href="https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-Setup-1.3.0.exe"><img src="assets/download.png" width="300px"></a><br> <a href="https://github.com/0neGal/viper/projects/1">Overview</a> | <a href="https://github.com/0neGal/viper/releases">Releases</a><br> </p> @@ -15,9 +15,9 @@ Downloads are available on the [releases page](https://github.com/0neGal/viper/r Please note that some versions will update themselves automatically when a new release is available (just like Origin or Steam) and some will NOT, so choose it accordingly. Only the AppImage and Windows Setup/Installer can auto-update. -**Windows:** [`Viper Setup [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-Setup-1.2.5.exe) (auto-updates, and is recommanded), [`Viper [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-1.2.5.exe) (single executable, no fuss) +**Windows:** [`Viper Setup [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-Setup-1.3.0.exe) (auto-updates, and is recommanded), [`Viper [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-1.3.0.exe) (single executable, no fuss) -**Linux:** [`.AppImage`](https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-1.2.5.AppImage) (auto-updates), [`.deb`](https://github.com/0neGal/viper/releases/download/v1.2.5/viper-1.2.5_amd64.deb), [`.rpm`](https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-1.2.5.x86_64.rpm), [`.tar.gz`](https://github.com/0neGal/viper/releases/download/v1.2.5/Viper-1.2.5.tar.gz) +**Linux:** [`.AppImage`](https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-1.3.0.AppImage) (auto-updates), [`.deb`](https://github.com/0neGal/viper/releases/download/v1.3.0/viper-1.3.0_amd64.deb), [`.rpm`](https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-1.3.0.x86_64.rpm), [`.tar.gz`](https://github.com/0neGal/viper/releases/download/v1.3.0/Viper-1.3.0.tar.gz) ## What can it do specifically? diff --git a/assets/preview.png b/assets/preview.png Binary files differindex 572bd04..50dba2c 100644 --- a/assets/preview.png +++ b/assets/preview.png diff --git a/package-lock.json b/package-lock.json index 651b93e..4239bde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "viper", - "version": "1.2.5", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "viper", - "version": "1.2.5", + "version": "1.3.0", "license": "GPL-3.0-or-later", "dependencies": { "electron-updater": "^4.6.1", @@ -20,7 +20,7 @@ "unzipper": "^0.10.11" }, "devDependencies": { - "electron": "^16.0.5", + "electron": "^16.0.6", "electron-builder": "^22.14.5" } }, @@ -1166,9 +1166,9 @@ } }, "node_modules/electron": { - "version": "16.0.5", - "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.5.tgz", - "integrity": "sha512-TgQXWmEGQ3uH2P2JDq5GyJDEu/fimRgqp1iNisARtGreU1k3630PqWlR+4SPnSEHN9NuSv92ng6NWxtefeFzxg==", + "version": "16.0.6", + "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.6.tgz", + "integrity": "sha512-Xs9dYLYhcJf3wXn8m2gDqFTb1L862KEhMxOx9swfFBHj6NoUPPtUgw/RyPQ0tXN1XPxG9vnBkoI0BdcKwrLKuQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -2239,9 +2239,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mkdirp": { "version": "0.5.5", @@ -2390,9 +2390,9 @@ } }, "node_modules/plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "dev": true, "dependencies": { "base64-js": "^1.5.1", @@ -4123,9 +4123,9 @@ } }, "electron": { - "version": "16.0.5", - "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.5.tgz", - "integrity": "sha512-TgQXWmEGQ3uH2P2JDq5GyJDEu/fimRgqp1iNisARtGreU1k3630PqWlR+4SPnSEHN9NuSv92ng6NWxtefeFzxg==", + "version": "16.0.6", + "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.6.tgz", + "integrity": "sha512-Xs9dYLYhcJf3wXn8m2gDqFTb1L862KEhMxOx9swfFBHj6NoUPPtUgw/RyPQ0tXN1XPxG9vnBkoI0BdcKwrLKuQ==", "dev": true, "requires": { "@electron/get": "^1.13.0", @@ -4948,9 +4948,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mkdirp": { "version": "0.5.5", @@ -5063,9 +5063,9 @@ } }, "plist": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz", - "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", + "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", "dev": true, "requires": { "base64-js": "^1.5.1", diff --git a/package.json b/package.json index cc0f2f3..ee9c8b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "viper", "productName": "Viper", - "version": "1.2.5", + "version": "1.3.0", "description": "Launcher+Updater for TF|2 Northstar", "main": "src/index.js", "build": { @@ -59,7 +59,7 @@ "unzipper": "^0.10.11" }, "devDependencies": { - "electron": "^16.0.5", + "electron": "^16.0.6", "electron-builder": "^22.14.5" } } diff --git a/src/app/browser.js b/src/app/browser.js index 8a8c6e4..40670bc 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -4,6 +4,58 @@ var packages = []; var Browser = { maxentries: 50, + filters: { + get: () => { + let filtered = []; + let unfiltered = []; + let checks = browser.querySelectorAll("#filters .check"); + + for (let i = 0; i < checks.length; i++) { + if (! checks[i].classList.contains("checked")) { + filtered.push(checks[i].getAttribute("value")); + } else { + unfiltered.push(checks[i].getAttribute("value")); + } + } + + return { + filtered, + unfiltered + }; + }, + isfiltered: (categories) => { + let filtered = Browser.filters.get().filtered; + let unfiltered = Browser.filters.get().unfiltered; + let state = false; + if (categories.length == 0) {return true} + for (let i = 0; i < categories.length; i++) { + if (filtered.includes(categories[i])) { + state = true; + continue + } else if (unfiltered.includes(categories[i])) { + state = false; + continue + } + + state = true; + } + + return state; + }, + toggle: (state) => { + if (state == false) { + filters.classList.remove("shown"); + return + } + + filters.classList.toggle("shown"); + let filterRect = filter.getBoundingClientRect(); + let spacing = parseInt(getComputedStyle(filters).getPropertyValue("--spacing")); + + filters.style.top = filterRect.bottom - spacing; + filters.style.right = filterRect.right - filterRect.left + filterRect.width; + }, + }, toggle: (state) => { if (state) { browser.scrollTo(0, 0); @@ -16,6 +68,7 @@ var Browser = { return } else if (! state) { if (state != undefined) { + Browser.filters.toggle(false); overlay.classList.remove("shown") browser.classList.remove("shown") return @@ -38,11 +91,14 @@ var Browser = { } for (let i in packages) { - if (i == Browser.maxentries) {Browser.endoflist();break} new BrowserElFromObj(packages[i]); } }, loading: (string) => { + if (Browser.filters.get().unfiltered.length == 0) { + string = lang("gui.browser.noresults"); + } + if (string) { browserEntries.innerHTML = `<div class="loading">${string}</div>`; } @@ -52,6 +108,7 @@ var Browser = { } }, endoflist: () => { + if (browserEntries.querySelector(".message")) {return} browserEntries.innerHTML += `<div class="message">${lang('gui.browser.endoflist')}</div>` }, search: (string) => { @@ -59,12 +116,11 @@ var Browser = { let res = fuse.search(string); if (res.length < 1) { - Browser.loading("No results...") + Browser.loading(lang("gui.browser.noresults")) return } for (let i = 0; i < res.length; i++) { - if (i == Browser.maxentries) {Browser.endoflist();break} new BrowserElFromObj(res[i].item); } }, @@ -114,11 +170,17 @@ function BrowserElFromObj(obj) { url: pkg.package_url, download: pkg.download_url, version: pkg.version_number, + categories: pkg.categories, description: pkg.description }) } function BrowserEl(properties) { + if (Browser.filters.isfiltered(properties.categories)) {return} + + let entries = browser.querySelectorAll(".el").length; + if (entries == Browser.maxentries) {Browser.endoflist();return} + properties = { title: "No name", version: "1.0.0", @@ -243,6 +305,7 @@ function normalize(items) { let searchtimeout; let searchstr = ""; search.addEventListener("keyup", () => { + Browser.filters.toggle(false); clearTimeout(searchtimeout); if (searchstr != search.value) { @@ -258,3 +321,12 @@ search.addEventListener("keyup", () => { }, 500) } }) + +browser.addEventListener("scroll", () => { + Browser.filters.toggle(false); +}) + +let checks = document.querySelectorAll(".check"); +for (let i = 0; i < checks.length; i++) { + checks[i].setAttribute("onclick", "this.classList.toggle('checked');Browser.loadfront();search.value = ''") +} diff --git a/src/app/icons/check.png b/src/app/icons/check.png Binary files differnew file mode 100644 index 0000000..6c7f43f --- /dev/null +++ b/src/app/icons/check.png diff --git a/src/app/icons/filter.png b/src/app/icons/filter.png Binary files differnew file mode 100644 index 0000000..ade45ef --- /dev/null +++ b/src/app/icons/filter.png diff --git a/src/app/index.html b/src/app/index.html index ac1e276..8ad5ecf 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -86,8 +86,20 @@ </div> <div class="popup" id="browser"> + <div class="overlay" id="filters"> + <div class="checks"> + <div class="check checked" value="Mods">%%gui.browser.filter.mods%%</div> + <div class="check checked" value="Skins">%%gui.browser.filter.skins%%</div> + <div class="check checked" value="Client-side">%%gui.browser.filter.client%%</div> + <div class="check" value="Server-side">%%gui.browser.filter.server%%</div> + </div> + </div> + <div class="misc"> <input id="search" placeholder="%%gui.browser.search%%"> + <button id="filter" onclick="Browser.filters.toggle()"> + <img src="icons/filter.png"> + </button> <button id="close" onclick="Browser.toggle(false)"> <img src="icons/close.png"> </button> diff --git a/src/app/main.css b/src/app/main.css index 18afc41..3f542ec 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -236,6 +236,53 @@ button { justify-content: space-between; } +.popup .overlay { + z-index: 1; + color: white; + opacity: 0.0; + position: fixed; + pointer-events: none; + transform: scale(0.9); + background: var(--selbg); + backdrop-filter: blur(15px); + transition: 0.15s ease-in-out; + padding: calc(var(--spacing) / 2); + border-radius: calc(var(--spacing) / 2); +} + +.popup .overlay.shown { + opacity: 1.0; + pointer-events: all; + transform: scale(1.0); +} + +.checks { +} + +.check { + display:flex; + cursor: pointer; +} + +.check::before { + width: 1em; + height: 1em; + content: " "; + background-size: 75%; + filter: brightness(1.3); + background-position: center; + background-repeat: no-repeat; + transition: 0.15s ease-in-out; + background-color: var(--selbg); + margin-right: calc(var(--spacing) / 3); + border-radius: calc(var(--spacing) / 4); +} + +.check.checked::before { + background-color: rgb(var(--red)); + background-image: url(icons/check.png); +} + .option .text {font-weight: 600} .option .text .desc { opacity: 0.8; @@ -43,18 +43,19 @@ async function init() { // --help menu/argument if (cli.hasSwitch("help")) { console.log(`options: - --help ${lang("cli.help.help")} - --debug ${lang("cli.help.debug")} - --version ${lang("cli.help.version")} + --help ${lang("cli.help.help")} + --debug ${lang("cli.help.debug")} + --version ${lang("cli.help.version")} - --cli ${lang("cli.help.cli")} - --update ${lang("cli.help.update")} - --updatevp ${lang("cli.help.updatevp")} - --setpath ${lang("cli.help.setpath")} + --cli ${lang("cli.help.cli")} + --update ${lang("cli.help.update")} + --updatevp ${lang("cli.help.updatevp")} + --setpath ${lang("cli.help.setpath")} + --no-vp-updates ${lang("cli.help.novpupdates")} - --installmod ${lang("cli.help.installmod")} - --removemod ${lang("cli.help.removemod")} - --togglemod ${lang("cli.help.togglemod")}`) + --installmod ${lang("cli.help.installmod")} + --removemod ${lang("cli.help.removemod")} + --togglemod ${lang("cli.help.togglemod")}`) // In the future --setpath should be able to understand // relative paths, instead of just absolute ones. exit(); diff --git a/src/index.js b/src/index.js index 265e13d..752410e 100644 --- a/src/index.js +++ b/src/index.js @@ -56,7 +56,7 @@ function start() { ipcMain.on("savesettings", (event, obj) => {utils.saveSettings(obj)}) ipcMain.on("can-autoupdate", (event) => { - if (! require("electron-updater").autoUpdater.isUpdaterActive()) { + if (! require("electron-updater").autoUpdater.isUpdaterActive() || cli.hasParam("no-vp-updates")) { win.webContents.send("cant-autoupdate") } }) @@ -66,7 +66,11 @@ function start() { }); if (utils.settings.autoupdate) { - utils.updatevp(false) + if (cli.hasParam("no-vp-updates")) { + utils.handleNorthstarUpdating(); + } else { + utils.updatevp(false) + } } else { utils.handleNorthstarUpdating(); } diff --git a/src/lang/en.json b/src/lang/en.json index 47e18c0..8defc7d 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -6,6 +6,7 @@ "cli.help.update": "updates Northstar from your set game path", "cli.help.setpath": "sets your game path", "cli.help.updatevp": "updates Viper itself, if supported.", + "cli.help.novpupdates": "overwrites viper.json and disables Viper updates", "cli.help.installmod": "installs a mod, folder or zip", "cli.help.removemod": "removes a mod", "cli.help.togglemod": "toggles a mod", @@ -72,6 +73,11 @@ "gui.browser.reinstall": "Re-Install", "gui.browser.loading": "Loading mods...", "gui.browser.endoflist": "Maximum packages has been loaded.<br>Use the search for finding other packages!", + "gui.browser.noresults": "No results...", + "gui.browser.filter.mods": "Mods", + "gui.browser.filter.skins": "Skins", + "gui.browser.filter.client": "Client-side", + "gui.browser.filter.server": "Server-side", "gui.settings.save": "Save", "gui.settings.discard": "Discard", diff --git a/src/lang/es.json b/src/lang/es.json index b570a8d..a5b3685 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -6,6 +6,7 @@ "cli.help.update": "actualiza Northstar desde la ruta de juego establecida", "cli.help.setpath": "establece la ruta del juego", "cli.help.updatevp": "actualiza Viper si es soportado", + "cli.help.novpupdates": "sobrescribe viper.json y deshabilita las actualizaciones de Viper", "cli.help.installmod": "instala una modificación, desde una carpeta o zip", "cli.help.removemod": "remueve una modificación", "cli.help.togglemod": "alterna el estado de la modificación", @@ -72,6 +73,11 @@ "gui.browser.reinstall": "Re-Instalar", "gui.browser.loading": "Cargando modificaciones...", "gui.browser.endoflist": "Se ha cargado el máximo de paquetes.<br>¡Usa la búsqueda para encontrar otros paquetes!", + "gui.browser.noresults": "Sin resultados...", + "gui.browser.filter.mods": "Modificaciones", + "gui.browser.filter.skins": "Skins", + "gui.browser.filter.client": "Del lado del cliente", + "gui.browser.filter.server": "Del lado del servidor", "gui.settings.save": "Guardar", "gui.settings.discard": "Descartar", diff --git a/src/lang/fr.json b/src/lang/fr.json index 86ec763..c1797e4 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -6,6 +6,7 @@ "cli.help.update": "met à jour Northstar sur le chemin du jeu précisé", "cli.help.setpath": "enregistre le chemin du client de jeu", "cli.help.updatevp": "met à jour le client Viper, si le format actuel le permet.", + "cli.help.novpupdates": "écrase viper.json et désactive les mises à jour de Viper", "cli.help.installmod": "Installe un mod, dossier ou zip", "cli.help.removemod": "Supprime un mod", "cli.help.togglemod": "Active/désactive un mod", @@ -72,6 +73,11 @@ "gui.browser.reinstall": "Réinstaller", "gui.browser.loading": "Chargement des mods...", "gui.browser.endoflist": "Fin de la liste de mods.<br>Utilisez la barre de recherche pour en trouver davantage !", + "gui.browser.noresults": "Pas de résultat", + "gui.browser.filter.mods": "Mods", + "gui.browser.filter.skins": "Skins", + "gui.browser.filter.client": "Côté client", + "gui.browser.filter.server": "Côté serveur", "gui.settings.save": "Sauvegarder", "gui.settings.discard": "Annuler", diff --git a/src/utils.js b/src/utils.js index 57c0289..7c1c22b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -769,8 +769,6 @@ setInterval(() => { ipcMain.emit("guigetmods"); }, 1500) -console.log(findgame()) - module.exports = { mods, lang, |