diff options
author | 0neGal <mail@0negal.com> | 2023-07-24 18:01:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 18:01:25 +0200 |
commit | 4e870f414cd4a85c4fca29bf4eb6f79f1aa89487 (patch) | |
tree | c9c1731b43861fcfcc7e15237a7924d8f4ecf21d /src | |
parent | 5cf79aa0847831b573a52d3c147ca1f78e712a40 (diff) | |
parent | 112610902caef019ea4af17d77079cd090d6b9b5 (diff) | |
download | Viper-4e870f414cd4a85c4fca29bf4eb6f79f1aa89487.tar.gz Viper-4e870f414cd4a85c4fca29bf4eb6f79f1aa89487.zip |
Merge branch 'main' into packages-dir
Diffstat (limited to 'src')
-rw-r--r-- | src/app/css/launcher.css | 5 | ||||
-rw-r--r-- | src/app/css/webview.css | 4 | ||||
-rw-r--r-- | src/cli.js | 1 | ||||
-rw-r--r-- | src/index.js | 2 | ||||
-rw-r--r-- | src/lang/de.json | 11 | ||||
-rw-r--r-- | src/lang/en.json | 6 | ||||
-rw-r--r-- | src/lang/es.json | 31 | ||||
-rw-r--r-- | src/lang/fr.json | 11 | ||||
-rw-r--r-- | src/modules/console.js | 27 | ||||
-rw-r--r-- | src/modules/findgame.js | 8 | ||||
-rw-r--r-- | src/modules/launch.js | 6 | ||||
-rw-r--r-- | src/modules/mods.js | 24 | ||||
-rw-r--r-- | src/modules/settings.js | 4 | ||||
-rw-r--r-- | src/modules/update.js | 28 |
14 files changed, 121 insertions, 47 deletions
diff --git a/src/app/css/launcher.css b/src/app/css/launcher.css index 9726981..58b0c18 100644 --- a/src/app/css/launcher.css +++ b/src/app/css/launcher.css @@ -46,6 +46,11 @@ transform: scale(0.9); } +.gamesContainer button.inactive:hover { + transform: scale(0.95); + filter: brightness(120%); +} + .gamesContainer button::before { content: ""; display: block; diff --git a/src/app/css/webview.css b/src/app/css/webview.css index 982ebfc..b6a536d 100644 --- a/src/app/css/webview.css +++ b/src/app/css/webview.css @@ -4,7 +4,11 @@ body { background-color: transparent !important; } +.footer, #ncmp_tool, +.bottom-ads, +.ncmp__banner, +#get-app-alert, .navbar, .bottom-padding, .card-header, .breadcrumb, .list-group, .mb-4, .my-2, .mt-2, @@ -7,6 +7,7 @@ const events = new Emitter(); const cli = app.commandLine; const lang = require("./lang"); const json = require("./modules/json"); +console = require("./modules/console"); function hasArgs() { // Makes sure the GUI isn't launched. diff --git a/src/index.js b/src/index.js index 9e2f31f..3e7e08f 100644 --- a/src/index.js +++ b/src/index.js @@ -22,7 +22,7 @@ const requests = require("./modules/requests"); const packages = require("./modules/packages"); const is_running = require("./modules/is_running"); - +console = require("./modules/console"); var log = console.log; // Starts the actual BrowserWindow, which is only run when using the diff --git a/src/lang/de.json b/src/lang/de.json index f79ed05..6ee32ae 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -169,5 +169,14 @@ "general.invalidconfig": "Deine Konfigurationsdatei ist nicht richtig formatiert, falls diese manuell verändert wurde bitte stelle sicher das alles korrekt ist.\n\nFalls du diese nicht manuell verändert hast, ist es empfohlen diese zurückzusetzen!\n\nUm sie zurückzusetzen drücke einfach auf \"Ok\".\n\nWeitere Informationen:\n", "request.viper.noReleaseNotes": "Viper Release Notes konnten nicht geladen werden.\nVersuche es erneut später!", - "request.northstar.noReleaseNotes": "Northstar Release Notes konnten nicht geladen werden.\nVersuche es erneut später!" + "request.northstar.noReleaseNotes": "Northstar Release Notes konnten nicht geladen werden.\nVersuche es erneut später!", + + "general.running": "Läuft bereits.", + + "tooltip.close": "Schließen", + "tooltip.minimize": "Minimieren", + "tooltip.settings": "Einstellungen", + "tooltip.pages.viper": "Viper", + "tooltip.pages.northstar": "Northstar", + "tooltip.pages.titanfall": "Titanfall 2" } diff --git a/src/lang/en.json b/src/lang/en.json index 5ce9407..b3823d7 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -173,9 +173,9 @@ "request.viper.noReleaseNotes": "Couldn't fetch Viper release notes.\nTry again later!", "request.northstar.noReleaseNotes": "Couldn't fetch Northstar release notes.\nTry again later!", - "tooltip.close": "Closes Viper", - "tooltip.minimize": "Minimizes the window", - "tooltip.settings": "Opens the settings popup", + "tooltip.close": "Close Viper", + "tooltip.minimize": "Minimize Viper", + "tooltip.settings": "Settings", "tooltip.pages.viper": "Viper", "tooltip.pages.northstar": "Northstar", "tooltip.pages.titanfall": "Titanfall 2" diff --git a/src/lang/es.json b/src/lang/es.json index 863a6e9..4afb2e6 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -2,7 +2,7 @@ "lang.title": "Spanish - Español", "cli.help.help": "muestra este mensaje de ayuda", - "cli.help.devtools": "habre las herramientas de desarrollador/depuración ", + "cli.help.devtools": "abre las herramientas de desarrollador/depuración ", "cli.help.version": "muestra la información de la versión", "cli.help.cli": "obliga la linea de comandos a habilitarse", "cli.help.update": "actualiza Northstar desde la ruta de juego establecida", @@ -15,7 +15,7 @@ "cli.setpath.noarg": "No se ha proporcionado ningún argumento para --setpath", - "cli.gamepath.lost": "El directorio del juego no fue encontrado, ¡asegúrate de que esté montado!", + "cli.gamepath.lost": "El directorio del juego no fue encontrado, ¡asegúrate de que esté disponible!", "cli.update.current": "Versión actual:", "cli.update.downloading": "Descargando...", @@ -39,7 +39,7 @@ "cli.mods.installed": "¡Modificiación instalada exitosamente!", "cli.mods.cantfind": "¡No se encuentra una modificación con ese nombre!", "cli.mods.notamod": "La carpeta o el archivo seleccionado no es una modificación", - "cli.mods.toggledall": "¡Estado de todas las modiciaciones ha sido cambiado exitosamente!", + "cli.mods.toggledall": "¡El estado de todas las modifiaciones ha sido cambiado exitosamente!", "cli.mods.improperjson": "%s's mod.json tiene errores de formato", "gui.welcome": "Bienvenido a Viper!", @@ -54,8 +54,8 @@ "gui.mods.count": "Modificaciones instaladas:", "gui.mods.disabledtag": "Deshabilitado", "gui.mods.install": "Instalar modificación", - "gui.mods.find": "Encontrar modificaciones", - "gui.mods.toggleall": "Alternar todo", + "gui.mods.find": "Buscar modificaciones", + "gui.mods.toggleall": "Activar / Desactivar todo", "gui.mods.removeall": "Remover todo", "gui.mods.nothingselected": "No has seleccionado una modificación.", "gui.mods.toggleall.confirm": "Alternar todo podría deshabilitar las modificaciones requeridas para que Northstar funcione. ¿Está seguro?", @@ -73,7 +73,7 @@ "gui.mods.confirm_plugins_description": "Los complementos nativos tienen mucho más acceso al sistema que un mod regular y, por lo tanto, son inherentemente menos seguros de instalar, ya que un complemento malicioso podría causar mucho más daño de esta manera. Si este complemento es de un desarrollador confiable o similar o si sabe lo que está haciendo, entonces puede ignorar completamente este mensaje.", "gui.browser.info": "Información", - "gui.browser.madeby": "por", + "gui.browser.madeby": "hecho por", "gui.browser.search": "Buscar...", "gui.browser.update": "Actualizar", "gui.browser.install": "Instalar", @@ -142,7 +142,7 @@ "gui.server.player": "jugador", "gui.server.players": "jugadores", "gui.server.servers": "servidores", - "gui.server.offline": "El servidor Master está desconectado", + "gui.server.offline": "El servidor principal está desconectado", "gui.toast.noInternet.title": "Sin Internet", "gui.toast.noInternet.desc": "Viper puede funcionar de forma incorrecta.", @@ -157,18 +157,27 @@ "viper.info.issues": "Reporta problemas de Viper:", "ns.menu.main": "Northstar Launcher", - "ns.menu.mods": "Modificiaciones", + "ns.menu.mods": "Modificaciones", "ns.menu.release": "Notas de actualización", - "general.autoupdates.gamerunning": "El juego se está ejecutando, no se puede actualizar Northstar", + "general.autoupdates.gamerunning": "El juego está en ejecución, no se puede actualizar Northstar", "general.mods.enabled": "Modificaciones habilitadas:", "general.mods.disabled": "Modificaciones deshabilitadas:", - "general.mods.installed": "Modificiaciones intaladas:", + "general.mods.installed": "Modificiaciones instaladas:", "general.missingpath": "¡La ruta del jueno no se ha podido encontrar automaticamente! ¡Por favor, elige la ruta manualmente!", "general.notinstalled": "¡Northstar no se ha instalado!", "general.launching": "Ejecutando", "general.invalidconfig": "Su archivo de configuración está formateado de forma incorrecta, si ha sido editado manualmente, por favor valide que ha sido escrito correctamente. \n\nSi no ha editado manualmente el archivo de configuración, es recomendado que simplemente restaure la configuración. \n\nPara restaurar tu configuración simplemente de click en \"OK\" a continuación. \n\nMas detalles:\n", "request.viper.noReleaseNotes": "No se pudo encontrar las notas de lanzamiento de Viper.\n¡Intenta mas tarde!", - "request.northstar.noReleaseNotes": "No se pudo encontrar las notas de lanzamiento de Northstar.\n¡Intenta mas tarde!" + "request.northstar.noReleaseNotes": "No se pudo encontrar las notas de lanzamiento de Northstar.\n¡Intenta mas tarde!", + + "general.running": "Ejecutandose", + + "tooltip.close": "Cerrar Viper", + "tooltip.minimize": "Minimizar Viper", + "tooltip.settings": "Configuraciones", + "tooltip.pages.viper": "Viper", + "tooltip.pages.northstar": "Northstar", + "tooltip.pages.titanfall": "Titanfall 2" } diff --git a/src/lang/fr.json b/src/lang/fr.json index 4eef1cf..cd168b3 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -170,5 +170,14 @@ "general.invalidconfig": "Votre fichier de configuration n'est pas formaté correctement ; si vous l'avez manuellement édité, veuillez vérifier son contenu.\n\nSinon, il est recommandé de remettre la configuration à zéro.\n\nPour cela, cliquez sur le bouton \"Ok\" en-dessous de ce message.\n\nPlus d'informations :\n", "request.viper.noReleaseNotes": "Impossible de récupérer les notes de mises à jour de Viper.\nVeuillez réessayer plus tard.", - "request.northstar.noReleaseNotes": "Impossible de récupérer les notes de mises à jour de Northstar.\nVeuillez réessayer plus tard." + "request.northstar.noReleaseNotes": "Impossible de récupérer les notes de mises à jour de Northstar.\nVeuillez réessayer plus tard.", + + "general.running": "En cours d'exécution", + + "tooltip.close": "Fermer Viper", + "tooltip.minimize": "Réduire Viper", + "tooltip.settings": "Paramètres", + "tooltip.pages.viper": "Viper", + "tooltip.pages.northstar": "Northstar", + "tooltip.pages.titanfall": "Titanfall 2" } diff --git a/src/modules/console.js b/src/modules/console.js new file mode 100644 index 0000000..7112071 --- /dev/null +++ b/src/modules/console.js @@ -0,0 +1,27 @@ +let new_console = { + ...console +} + +let orig_console = console; + +new_console.ok = (...args) => { + orig_console.log('\x1b[92m%s\x1b[0m', ...args) +} + +new_console.misc = (...args) => { + orig_console.warn('\x1b[90m%s\x1b[0m', ...args) +} + +new_console.info = (...args) => { + orig_console.warn('\x1b[94m%s\x1b[0m', ...args) +} + +new_console.warn = (...args) => { + orig_console.warn('\x1b[93m%s\x1b[0m', ...args) +} + +new_console.error = (...args) => { + orig_console.error('\x1b[91m%s\x1b[0m', ...args) +} + +module.exports = new_console; diff --git a/src/modules/findgame.js b/src/modules/findgame.js index 1c330df..505595f 100644 --- a/src/modules/findgame.js +++ b/src/modules/findgame.js @@ -6,6 +6,8 @@ const { app } = require("electron"); const util = require("util"); const exec = util.promisify(require("child_process").exec); +console = require("./console"); + module.exports = async () => { let gamepath = ""; @@ -40,10 +42,10 @@ module.exports = async () => { let data_array = Object.values(values[i]); if (fs.existsSync(data_array[0] + "/steamapps/common/Titanfall2/Titanfall2.exe")) { - console.log("Found game in:", data_array[0]); + console.ok("Found game in:", data_array[0]); return data_array[0] + "/steamapps/common/Titanfall2"; } else { - console.log("Game not in:", data_array[0]); + console.error("Game not in:", data_array[0]); } } } @@ -70,7 +72,7 @@ module.exports = async () => { // searches VDF files for (let i = 0; i < vdf_files.length; i++) { if (! fs.existsSync(vdf_files[i])) {continue} - console.log("Searching VDF file at:", vdf_files[i]); + console.info("Searching VDF file at:", vdf_files[i]); let data = fs.readFileSync(vdf_files[i]); let read_vdf = readvdf(data.toString()); diff --git a/src/modules/launch.js b/src/modules/launch.js index 82de109..af9939b 100644 --- a/src/modules/launch.js +++ b/src/modules/launch.js @@ -6,6 +6,8 @@ const lang = require("../lang"); const win = require("./window"); const settings = require("./settings"); +console = require("./console"); + // launches the game // // either Northstar or Vanilla. Linux support is not currently a thing, @@ -25,11 +27,11 @@ function launch(game_version) { // launch the requested game version switch(game_version) { case "vanilla": - console.log(lang("general.launching"), "Vanilla..."); + console.info(lang("general.launching"), "Vanilla..."); exec("Titanfall2.exe", {cwd: settings.gamepath}); break; default: - console.log(lang("general.launching"), "Northstar..."); + console.info(lang("general.launching"), "Northstar..."); exec("NorthstarLauncher.exe", {cwd: settings.gamepath}); break; } diff --git a/src/modules/mods.js b/src/modules/mods.js index 86c78f1..d3d3a50 100644 --- a/src/modules/mods.js +++ b/src/modules/mods.js @@ -10,6 +10,8 @@ const win = require("./window"); const version = require("./version"); const settings = require("./settings"); +console = require("./console"); + const cli = require("../cli"); const lang = require("../lang"); @@ -33,7 +35,7 @@ mods.list = () => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { win.log(lang("general.notinstalled")); - console.log("error: " + lang("general.notinstalled")); + console.error("error: " + lang("general.notinstalled")); cli.exit(1); return false; } @@ -178,7 +180,7 @@ mods.get = (mod) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { win.log(lang("general.notinstalled")); - console.log("error: " + lang("general.notinstalled")); + console.error("error: " + lang("general.notinstalled")); cli.exit(1); return false; } @@ -312,20 +314,20 @@ mods.install = (mod, opts) => { if (version.northstar() == "unknown") { win.log(lang("general.notinstalled")); - console.log("error: " + lang("general.notinstalled")); + console.error("error: " + lang("general.notinstalled")); cli.exit(1); return false; } let notamod = () => { win.log(lang("gui.mods.notamod")); - console.log("error: " + lang("cli.mods.notamod")); + console.error("error: " + lang("cli.mods.notamod")); cli.exit(1); return false; } let installed = () => { - console.log(lang("cli.mods.installed")); + console.ok(lang("cli.mods.installed")); cli.exit(); win.log(lang("gui.mods.installedmod")); @@ -559,7 +561,7 @@ mods.remove = (mod) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { win.log(lang("general.notinstalled")); - console.log("error: " + lang("general.notinstalled")); + console.error("error: " + lang("general.notinstalled")); cli.exit(1); return false; } @@ -577,7 +579,7 @@ mods.remove = (mod) => { let mod_name = mod_data.folder_name; if (! mod_name) { - console.log("error: " + lang("cli.mods.cantfind")); + console.error("error: " + lang("cli.mods.cantfind")); cli.exit(1); return; } @@ -606,7 +608,7 @@ mods.remove = (mod) => { // actually remove the mod itself fs.rmSync(mod_path, {recursive: true}); - console.log(lang("cli.mods.removed")); + console.ok(lang("cli.mods.removed")); cli.exit(); ipcMain.emit("gui-getmods"); // send updated list to renderer @@ -631,7 +633,7 @@ mods.toggle = (mod, fork) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { win.log(lang("general.notinstalled")); - console.log("error: " + lang("general.notinstalled")); + console.error("error: " + lang("general.notinstalled")); cli.exit(1); return false; } @@ -643,7 +645,7 @@ mods.toggle = (mod, fork) => { mods.toggle(modlist[i].name, true); // enable mod } - console.log(lang("cli.mods.toggledall")); + console.ok(lang("cli.mods.toggledall")); cli.exit(0); return } @@ -652,7 +654,7 @@ mods.toggle = (mod, fork) => { mods.modfile.toggle(mod); if (! fork) { - console.log(lang("cli.mods.toggled")); + console.ok(lang("cli.mods.toggled")); cli.exit(); } diff --git a/src/modules/settings.js b/src/modules/settings.js index 76326cc..3b60d7f 100644 --- a/src/modules/settings.js +++ b/src/modules/settings.js @@ -5,6 +5,8 @@ const app = require("electron").app; const json = require("./json"); const lang = require("../lang"); +console = require("./console"); + var invalid_settings = false; // base settings @@ -47,7 +49,7 @@ if (fs.existsSync("viper.json")) { settings.nsargs = fs.readFileSync(args, "utf8"); } } else { - console.log(lang("general.missingpath")); + console.error(lang("general.missingpath")); } // as to not have to do the same one liner a million times, this diff --git a/src/modules/update.js b/src/modules/update.js index e57faf6..02d38c6 100644 --- a/src/modules/update.js +++ b/src/modules/update.js @@ -12,6 +12,8 @@ const requests = require("./requests"); const gamepath = require("./gamepath"); const is_running = require("./is_running"); +console = require("./console"); + const unzip = require("unzipper"); const { https } = require("follow-redirects"); @@ -57,23 +59,23 @@ update.northstar_autoupdate = () => { async function _checkForUpdates() { is_auto_updating = true; - console.log(lang("cli.autoupdates.checking")); + console.info(lang("cli.autoupdates.checking")); // checks if NS is outdated if (await northstar_update_available()) { - console.log(lang("cli.autoupdates.available")); + console.ok(lang("cli.autoupdates.available")); if (await is_running.game()) { - console.log(lang("general.autoupdates.gamerunning")); + console.error(lang("general.autoupdates.gamerunning")); new Notification({ title: lang("gui.nsupdate.gaming.title"), body: lang("gui.nsupdate.gaming.body") }).show(); } else { - console.log(lang("cli.autoupdates.updatingns")); + console.status(lang("cli.autoupdates.updatingns")); update.northstar(); } } else { - console.log(lang("cli.autoupdates.noupdate")); + console.info(lang("cli.autoupdates.noupdate")); } setTimeout( @@ -150,14 +152,14 @@ update.viper = (autoinstall) => { // unzip module does not support excluding files directly. update.northstar = async () => { if (await is_running.game()) { - console.log(lang("general.autoupdates.gamerunning")); + console.error(lang("general.autoupdates.gamerunning")); return false; } if (! gamepath.exists()) {return} ipcMain.emit("ns-update-event", "cli.update.checking"); - console.log(lang("cli.update.checking")); + console.info(lang("cli.update.checking")); let ns_version = version.northstar(); const latest_version = await requests.getLatestNsVersion(); @@ -170,14 +172,14 @@ update.northstar = async () => { // Makes sure it is not already the latest version if (! await northstar_update_available()) { ipcMain.emit("ns-update-event", "cli.update.uptodate.short"); - console.log(lang("cli.update.uptodate"), ns_version); + console.ok(lang("cli.update.uptodate"), ns_version); win.log(lang("gui.update.uptodate")); cli.exit(); return; } else { if (ns_version != "unknown") { - console.log(lang("cli.update.current"), ns_version); + console.info(lang("cli.update.current"), ns_version); }; } @@ -188,11 +190,11 @@ update.northstar = async () => { // cancel out if zip can't be retrieved and or found if (res.statusCode !== 200) { ipcMain.emit("ns-update-event", "cli.update.uptodate.short"); - console.log(lang("cli.update.uptodate"), ns_version); + console.ok(lang("cli.update.uptodate"), ns_version); return false; } - console.log(lang("cli.update.downloading") + ":", latest_version); + console.info(lang("cli.update.downloading") + ":", latest_version); ipcMain.emit("ns-update-event", "cli.update.downloading"); let tmp = path.dirname(settings.zip); @@ -225,7 +227,7 @@ update.northstar = async () => { win.log(lang("gui.update.extracting")); ipcMain.emit("ns-update-event", "gui.update.extracting"); - console.log(lang("cli.update.downloaddone")); + console.ok(lang("cli.update.downloaddone")); // extracts the zip, this is the part where we're actually // installing Northstar. extract.pipe(unzip.Extract({path: settings.gamepath})) @@ -249,7 +251,7 @@ update.northstar = async () => { ipcMain.emit("get-version"); ipcMain.emit("ns-update-event", "cli.update.uptodate.short"); win.log(lang("gui.update.finished")); - console.log(lang("cli.update.finished")); + console.ok(lang("cli.update.finished")); cli.exit(); }) }) |