From f59e329533d785695c5286104e01103c942849f8 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sun, 4 Aug 2024 23:45:49 +0200 Subject: lang: add english keys for unzip error handling --- src/lang/en.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/lang') diff --git a/src/lang/en.json b/src/lang/en.json index f968f73..e95d890 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -28,6 +28,7 @@ "checking": "Checking for updates...", "download_done": "Download done! Extracting...", "finished": "Installation/Update finished!", + "failed": "Installation/Update failed!", "uptodate": "Latest version (%s) is already installed, skipping update.", "uptodate_short": "Up-to-date", "no_internet": "No Internet connection" @@ -275,7 +276,8 @@ "missing_launch_command": "There's currently no custom launch command set, one has to be configured to launch", "missing_steam": "Can't launch with Steam directly, as it doesn't seem to be installed", "missing_flatpak": "Can't launch with Flatpak, as it doesn't seem to be installed", - "missing_flatpak_steam": "Can't launch with the Flatpak version of Steam, as it doesn't seem to be installed" + "missing_flatpak_steam": "Can't launch with the Flatpak version of Steam, as it doesn't seem to be installed", + "permission_denied": "Unable to extract Northstar to your game directory" } } }, -- cgit v1.2.3 From 846b7c915e96402da4c3b12e1d02276b4f158634 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 10 Aug 2024 19:58:44 +0200 Subject: revert some localization changes --- src/lang/en.json | 3 +-- src/modules/update.js | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src/lang') diff --git a/src/lang/en.json b/src/lang/en.json index e95d890..bf147ab 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -276,8 +276,7 @@ "missing_launch_command": "There's currently no custom launch command set, one has to be configured to launch", "missing_steam": "Can't launch with Steam directly, as it doesn't seem to be installed", "missing_flatpak": "Can't launch with Flatpak, as it doesn't seem to be installed", - "missing_flatpak_steam": "Can't launch with the Flatpak version of Steam, as it doesn't seem to be installed", - "permission_denied": "Unable to extract Northstar to your game directory" + "missing_flatpak_steam": "Can't launch with the Flatpak version of Steam, as it doesn't seem to be installed" } } }, diff --git a/src/modules/update.js b/src/modules/update.js index c792217..7469e02 100644 --- a/src/modules/update.js +++ b/src/modules/update.js @@ -415,10 +415,6 @@ update.northstar = async (force_install) => { let description = lang("gui.toast.desc.unknown_error") + " (" + err.code + ")"; - if (err.code == "EACCES") { - description = lang("gui.toast.desc.permission_denied"); - } - win().toast({ scheme: "error", title: lang("gui.toast.title.failed"), -- cgit v1.2.3 From 2a62e6fe423fa2e9a3bf6b17ebb06958567b2bf3 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 10 Aug 2024 20:00:46 +0200 Subject: lang: add german translation for update failure --- src/lang/de.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lang') diff --git a/src/lang/de.json b/src/lang/de.json index 0eb17dc..5a5ab4d 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -43,7 +43,8 @@ "current": "Jetzige Version:", "download_done": "Herunterladen abgeschlossen! Extrahiere...", "downloading": "Wird heruntergeladen...", - "finished": "Installation/Aktualisierung abeschlossen!", + "failed": "Installation/Aktualisierung fehlgeschlagen!", + "finished": "Installation/Aktualisierung abgeschlossen!", "no_internet": "Keine Internetverbindung", "uptodate": "Installation ist bereits auf dem neusten Stand (%s), aktualisieren wird übersprungen.", "uptodate_short": "Auf dem neusten stand" -- cgit v1.2.3 From fbc4c6070c20d249c29961ab66b54d84a65161f9 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 10 Aug 2024 20:13:28 +0200 Subject: lang: add chinese translation for update failure --- src/lang/zh.json | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lang') diff --git a/src/lang/zh.json b/src/lang/zh.json index 2976eed..be8cfbb 100644 --- a/src/lang/zh.json +++ b/src/lang/zh.json @@ -43,6 +43,7 @@ "current": "当前版本:", "download_done": "下载完毕!解压中...", "downloading": "下载中...", + "failed": "安装/更新 失败!", "finished": "安装/更新 完成!", "no_internet": "无互联网连接", "uptodate": "最新版本 (%s) 已安装, 跳过更新.", -- cgit v1.2.3 From 60f0935e173751805634f887c9ac9640a5e51e68 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 14 Aug 2024 19:38:59 +0200 Subject: feat: display alert when Viper is already running and no args are given --- src/index.js | 20 ++++++++++++++------ src/lang/en.json | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/lang') diff --git a/src/index.js b/src/index.js index ab15039..c6a7ba8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ const path = require("path"); -const { app, BrowserWindow } = require("electron"); +const { app, BrowserWindow, dialog } = require("electron"); // makes it so Electron cache doesn't get stored in your system's config // folder, and instead changing it over to using the system's cache @@ -10,6 +10,7 @@ app.setPath("userData", path.join(app.getPath("cache"), app.name)); process.chdir(app.getPath("appData")); const cli = require("./cli"); +const lang = require("./lang"); const mods = require("./modules/mods"); const update = require("./modules/update"); @@ -119,13 +120,20 @@ if (cli.hasArgs()) { const app_lock = app.requestSingleInstanceLock() - if (!app_lock) { - // Viper is already running - app.quit(); - } - // start the window/GUI app.on("ready", () => { + if (!app_lock) { + // Viper is already running + if (process.argv.length <= (app.isPackaged ? 1 : 2)) + { + dialog.showMessageBoxSync({ + title: lang("viper.menu.main"), + message: lang("viper.already_running") + }); + } + app.quit(); + } + start(); }) diff --git a/src/lang/en.json b/src/lang/en.json index f968f73..d07d60f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -281,6 +281,8 @@ }, "viper": { + "already_running": "Viper is already running", + "menu": { "main": "Viper", "release": "Release Notes", -- cgit v1.2.3 From b578362de216142959ef9511510c06d5446e355f Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 14 Aug 2024 19:57:47 +0200 Subject: chore: display alert when mod install via protocol cannot be resolved --- src/app/js/mods.js | 5 +++-- src/lang/en.json | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lang') diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 349f5b9..bca417e 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -1,3 +1,4 @@ +const util = require('util'); const ipcRenderer = require("electron").ipcRenderer; const lang = require("../../lang"); @@ -338,13 +339,13 @@ ipcRenderer.on("protocol-install-mod", async (event, data) => { const package = packages.find((package) => { return package.owner == author && package.name == package_name; }) if (!package) { - console.error("Couldn't find package") + alert(util.format(lang("gui.mods.cant_find_specific"), author, package_name)); return; } const package_obj = package.versions.find((package_version) => { return package_version.version_number == version; }) if (!package_obj) { - console.error("Couldn't find package_version") + alert(util.format(lang("gui.mods.cant_find_version"), version, author, package_name)) return; } diff --git a/src/lang/en.json b/src/lang/en.json index d07d60f..0c44198 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -101,6 +101,8 @@ "installed_mod": "Installed mod!", "drag_n_drop": "Drag and drop a mod to install", "confirm_dependencies": "This package has dependencies, shown below, clicking \"Ok\" will install the package and the dependencies.\n\n", + "cant_find_specific": "Can't find mod %s-%s!", + "cant_find_version": "Can't find version %s of mod %s-%s!", "confirm_plugins": { "title": "The following package has native plugins:", -- cgit v1.2.3 From 9c97e16b85a55cb770d74fa7e44d338a3ad9ce88 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 14 Aug 2024 20:05:11 +0200 Subject: feat: show toast when installing mod through ror2mm protocol --- src/app/js/mods.js | 8 +++++++- src/app/js/toasts.js | 4 ++++ src/lang/en.json | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/lang') diff --git a/src/app/js/mods.js b/src/app/js/mods.js index bca417e..326b8b9 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -4,6 +4,7 @@ const ipcRenderer = require("electron").ipcRenderer; const lang = require("../../lang"); const version = require("./version"); +const toasts = require("./toasts"); const set_buttons = require("./set_buttons"); let mods = {}; @@ -349,7 +350,12 @@ ipcRenderer.on("protocol-install-mod", async (event, data) => { return; } - console.log(package_obj); + toasts.show({ + timeout: 3000, + scheme: "info", + title: lang("gui.mods.installing"), + description: lang("gui.toast.desc.installing") + " " + package_obj.full_name + }) mods.install_from_url( package_obj.download_url, diff --git a/src/app/js/toasts.js b/src/app/js/toasts.js index 83ddf6a..3fd6899 100644 --- a/src/app/js/toasts.js +++ b/src/app/js/toasts.js @@ -24,6 +24,10 @@ toasts.show = (properties) => { toast.fg = "#FFFFFF"; toast.bg = "#FF9B85"; break + case "info": + toast.fg = "#FFFFFF"; + toast.bg = "rgb(var(--blue))"; + break } diff --git a/src/lang/en.json b/src/lang/en.json index 0c44198..1c3b4b4 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -268,6 +268,7 @@ "desc": { "installed": "has been installed successfully!", + "installing": "Installing", "malformed": "has an incorrect folder structure, if you're the developer, you should fix this.", "failed": "An unknown error occurred while trying to install the mod. This may be the author's fault, and it may also be Viper's fault.", "duped": "has multiple mod folders in it, with the same name, causing duplicate folders, if you're the developer, you should fix this.", -- cgit v1.2.3 From 7fb97f07c1f6e3818edf8651d26d9600849e5521 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 15 Aug 2024 22:41:18 +0200 Subject: chore: remove installing translation description its a bit redundant since the title already states that we are installing --- src/app/js/mods.js | 2 +- src/lang/en.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lang') diff --git a/src/app/js/mods.js b/src/app/js/mods.js index 326b8b9..2408548 100644 --- a/src/app/js/mods.js +++ b/src/app/js/mods.js @@ -354,7 +354,7 @@ ipcRenderer.on("protocol-install-mod", async (event, data) => { timeout: 3000, scheme: "info", title: lang("gui.mods.installing"), - description: lang("gui.toast.desc.installing") + " " + package_obj.full_name + description: package_obj.full_name }) mods.install_from_url( diff --git a/src/lang/en.json b/src/lang/en.json index 1c3b4b4..0c44198 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -268,7 +268,6 @@ "desc": { "installed": "has been installed successfully!", - "installing": "Installing", "malformed": "has an incorrect folder structure, if you're the developer, you should fix this.", "failed": "An unknown error occurred while trying to install the mod. This may be the author's fault, and it may also be Viper's fault.", "duped": "has multiple mod folders in it, with the same name, causing duplicate folders, if you're the developer, you should fix this.", -- cgit v1.2.3 From 850c91d759018e4e65c7008e75a507d353a3de01 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 15 Aug 2024 22:43:53 +0200 Subject: chore: add german translation --- src/lang/de.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lang') diff --git a/src/lang/de.json b/src/lang/de.json index 0eb17dc..eefaccb 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -95,6 +95,8 @@ "install": "Installieren", "launch": "Starten", "mods": { + "cant_find_specific": "Mod %s-%s kann nicht gefunden werden!", + "cant_find_version": "Version %s von Mod %s-%s kann nicht gefunden werden!", "confirm_dependencies": "Dieser Mod benötigt weitere Mods, diese werden unter dieser Nachricht angezeigt. Beim drücken auf \"Ok\" stimmst du zu da diese Installiert werden.\n\n", "confirm_plugins": { "description": "Native plugins haben sehr viel mehr Rechte als reguläre Mods, da durch ist das nutzen dieser um einiges unsicherer denn es ist einfacher ihnen zuschaden! Bitte installieren sie nur native plugins von vertrauten Entwicklern oder ähnliches, falls dir bewusst ist was du machst kannst du diese Nachricht ignorieren.", @@ -283,6 +285,7 @@ "settings": "Einstellungen" }, "viper": { + "already_running": "Viper läuft bereits", "info": { "credits": "Credits", "discord": "Tritt dem Discord bei:", -- cgit v1.2.3 From b94949cde461de501815968e0467254c346bc432 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 15 Aug 2024 22:46:09 +0200 Subject: chore: add french translation by CyanPickle --- src/lang/fr.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lang') diff --git a/src/lang/fr.json b/src/lang/fr.json index 492ba76..742153d 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -95,6 +95,8 @@ "install": "Installer", "launch": "Jouer", "mods": { + "cant_find_specific": "Incapable de trouver le mod %s-%s!", + "cant_find_version": "Incapable de trouver la version %s du mod %s-%s!", "confirm_dependencies": "Ce mod a des dépendances (affichées ci-dessous), cliquer \"Ok\" les installera en même temps que le mod.\n\n", "confirm_plugins": { "description": "Les plugins ont des accès à votre système, comparés aux mods classiques, et sont de fait plus dangereux à l'installation, comme pourrait l'être un plugin contenant un malware. Si ce plugin provient d'un tiers de confiance ou si vous savez ce que vous faites, ne tenez pas compte de ce message.", @@ -283,6 +285,7 @@ "settings": "Paramètres" }, "viper": { + "already_running": "Viper est déjà en cours d'éxecution", "info": { "credits": "Remerciements", "discord": "Rejoingnez le serveur Discord :", -- cgit v1.2.3 From 52c7f69ab02f7f204c0b3d546e18df144d4f538e Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Thu, 15 Aug 2024 22:48:22 +0200 Subject: lang: add french translation by CyanPickle --- src/lang/fr.json | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lang') diff --git a/src/lang/fr.json b/src/lang/fr.json index 492ba76..e43e70a 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -43,6 +43,7 @@ "current": "Version actuelle :", "download_done": "Téléchargement terminé ! Extraction des fichiers...", "downloading": "Téléchargement en cours...", + "failed": "Mise à jour échoué !", "finished": "Mise à jour terminée !", "no_internet": "Pas de connexion Internet", "uptodate": "La dernière version (%s) est déjà installée.", -- cgit v1.2.3 From b9c0243d6433550784116fac7eec462cc5ae2a79 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 17 Aug 2024 12:03:37 +0200 Subject: chore: add chinese translation by xwii --- src/lang/zh.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lang') diff --git a/src/lang/zh.json b/src/lang/zh.json index 2976eed..dbdc330 100644 --- a/src/lang/zh.json +++ b/src/lang/zh.json @@ -95,6 +95,8 @@ "install": "安装", "launch": "启动", "mods": { + "cant_find_specific": "无法找到模组%s-%s!", + "cant_find_version": "无法找到%s版的模组%s-%s!", "confirm_dependencies": "此包含有依赖项, 以下展示, 点击 \"Ok\" 将会安装此包和它的依赖项.\n\n", "confirm_plugins": { "description": "Native插件比普通的模组拥有更多对系统的访问权限, 如果安装了恶意插件可能会导致您的计算机受到损害. 如果这个插件是来自于一位信任的开发者或您知道自己在干什么, 那么请忽略这条信息.", @@ -283,6 +285,7 @@ "settings": "设置" }, "viper": { + "already_running": "Viper已在运行中", "info": { "credits": "鸣谢", "discord": "加入Discord:", -- cgit v1.2.3 From 4ae37f2f520c8082a00cc52f33ea0c1877709d6f Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 19 Aug 2024 15:45:18 +0200 Subject: Update src/lang/fr.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rémy Raes --- src/lang/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lang') diff --git a/src/lang/fr.json b/src/lang/fr.json index e43e70a..c98e143 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -43,7 +43,7 @@ "current": "Version actuelle :", "download_done": "Téléchargement terminé ! Extraction des fichiers...", "downloading": "Téléchargement en cours...", - "failed": "Mise à jour échoué !", + "failed": "Échec de la mise à jour !", "finished": "Mise à jour terminée !", "no_internet": "Pas de connexion Internet", "uptodate": "La dernière version (%s) est déjà installée.", -- cgit v1.2.3 From fab59ba8b8b1c567ee158b9681c5b373fb7303e4 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Fri, 20 Dec 2024 18:22:12 +0100 Subject: added sorting to mod browser fixes #251 --- src/app/css/grid.css | 18 ++++++++++++++++++ src/app/icons/sort.png | Bin 0 -> 1225 bytes src/app/index.html | 9 +++++++++ src/app/js/browser.js | 38 +++++++++++++++++++++++++++++++++++++- src/lang/en.json | 7 +++++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/app/icons/sort.png (limited to 'src/lang') diff --git a/src/app/css/grid.css b/src/app/css/grid.css index 188f32a..be405e0 100644 --- a/src/app/css/grid.css +++ b/src/app/css/grid.css @@ -77,6 +77,24 @@ width: var(--height) !important; } +.popup .misc button.long { + width: max-content !important; + padding-right: var(--spacing) !important; +} + +.popup .misc button select { + color: white; + border: none; + opacity: 0.6; + outline: none; + background: transparent; +} + +.popup .misc button select option { + color: white; + background: var(--selbg); +} + .popup .misc button img { margin: 0px; opacity: 0.6; diff --git a/src/app/icons/sort.png b/src/app/icons/sort.png new file mode 100644 index 0000000..3dd80d6 Binary files /dev/null and b/src/app/icons/sort.png differ diff --git a/src/app/index.html b/src/app/index.html index 9e97810..98c59d4 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -254,6 +254,15 @@
+ diff --git a/src/app/js/browser.js b/src/app/js/browser.js index aaca6a8..88e8017 100644 --- a/src/app/js/browser.js +++ b/src/app/js/browser.js @@ -153,10 +153,19 @@ var browser = { return browser.install({...properties}); } + packages[i].unix_created = new Date(packages[i].date_created).getTime(); + packages[i].unix_updated = new Date(packages[i].date_updated).getTime(); + packages[i].install = install; packages[i].has_update = has_update; packages[i].local_version = local_version; + packages[i].downloads = 0; + + for (let version of packages[i].versions) { + packages[i].downloads += version.downloads || 0; + } + if (local_version) { browser.mod_versions[normalized] = { install: install, @@ -169,6 +178,28 @@ var browser = { } } }, + // sorts `pkgs` based on `property` in package object + sort: (pkgs, property) => { + // get property from sort selector, if not specified + if (! property) { + property = sort.querySelector("select").value; + + // if we somehow still don't have a property, just return + if (! property) { + return pkgs; + } + } + + // if `property` doesn't even exist, just return + if (typeof pkgs[0][property] == "undefined") { + return pkgs; + } + + // sort in descending order + return pkgs.sort((a, b) => { + return b[property] - a[property]; + }) + }, loadfront: async () => { browser.loading(); @@ -198,7 +229,8 @@ var browser = { }) } - let pkgs = browser.filters.getpkgs(); + let pkgs = browser.sort(browser.filters.getpkgs()); + for (let i in pkgs) { if (packagecount >= browser.maxentries) { browser.endoflist(); @@ -349,6 +381,10 @@ var browser = { } } +sort.querySelector("select").addEventListener("change", () => { + browser.loadfront(); +}) + setInterval(browser.add_pkg_properties, 1500); if (navigator.onLine) { diff --git a/src/lang/en.json b/src/lang/en.json index c6a4946..5d622e2 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -124,6 +124,13 @@ "no_results": "No results...", "guide": "Guide", + "sort": { + "newest": "Newest", + "last_updated": "Last Updated", + "highest_rating": "Highest Rated", + "most_downloads": "Most Downloaded" + }, + "filter": { "mods": "Mods", "skins": "Skins", -- cgit v1.2.3