From f474005ea330198caa066a50c5f71ff087d4158f Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 23 Jan 2022 21:58:56 +0100 Subject: added loading, close button, element fadein etc To show the loading simply do Browser.loading(), when a BrowserEl() is made it auto removes it. The loading and BrowserEl's will fade into view instead of popping in instantly. And then now there's a tiny close button, as it may not be obvious you can click the dark overlay or click Escape. --- src/lang/en.json | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lang/en.json') diff --git a/src/lang/en.json b/src/lang/en.json index c2b6f98..ecc2cc5 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -62,6 +62,8 @@ "gui.mods.installing": "Installing mod...", "gui.mods.installedmod": "Installed mod!", + "gui.browser.loading": "Loading mods...", + "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", "gui.update.finished": "Done! Ready to play!", -- cgit v1.2.3 From 89bd545b938fb05980393a3f2ae3f0aa2cbee220 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 23 Jan 2022 22:17:59 +0100 Subject: added "Find Mods" button --- src/app/index.html | 1 + src/app/main.css | 5 ++++- src/lang/en.json | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lang/en.json') diff --git a/src/app/index.html b/src/app/index.html index e03936d..c2978bd 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -92,6 +92,7 @@ + diff --git a/src/app/main.css b/src/app/main.css index e13979a..acec007 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -513,7 +513,10 @@ code { } .modbtns button { - margin-left: calc(var(--padding) / 3); + --spacing: calc(var(--padding) / 3); + margin-left: var(--spacing); + margin-top: calc(var(--spacing) / 2); + margin-bottom: calc(var(--spacing) / 2); } /* drag control */ diff --git a/src/lang/en.json b/src/lang/en.json index ecc2cc5..5377ca2 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -49,6 +49,7 @@ "gui.mods.count": "Mods Installed:", "gui.mods.disabledtag": "Disabled", "gui.mods.install": "Install Mod", + "gui.mods.find": "Find Mods", "gui.mods.toggle": "Toggle Mod", "gui.mods.toggleall": "Toggle All", "gui.mods.remove": "Remove Mod", -- cgit v1.2.3 From 396c1f3c9499a2bb50b2b5f3760cc58acfe9b87f Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 23 Jan 2022 23:18:45 +0100 Subject: minor aesthetic changes --- src/app/browser.js | 2 +- src/app/main.css | 59 ++++++++++++++++++++++++++++++++---------------------- src/lang/en.json | 1 + 3 files changed, 37 insertions(+), 25 deletions(-) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index 8af6afe..eb18fe5 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -61,7 +61,7 @@ function BrowserEl(properties) {
${properties.title}
-
${properties.description} - by ${properties.author}
+
${properties.description} - ${lang("gui.browser.madeby")} ${properties.author}
diff --git a/src/app/main.css b/src/app/main.css index acec007..67174b8 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -26,12 +26,40 @@ background: var(--red); } +::selection { + color: black; + background: var(--red); +} + +body { + margin: 0; + overflow: hidden; + user-select: none; +} + +body, button, input {font-family: "Roboto", sans-serif} + +button {outline: none} +b, strong {font-weight: 700} +body, input, button {font-weight: 500} + +button { + border: none; + color: white; + outline: none; + cursor: pointer; + font-weight: 700; + padding: 5px 10px; + border-radius: 5px; + transition: 0.2s ease-in-out; +} + .playBtn, .gamesContainer button, #winbtns div { cursor: pointer; } #browser { - --spacing: calc(var(--padding) * 3); + --spacing: var(--padding); z-index: 2; opacity: 0.0; @@ -116,9 +144,14 @@ #browser #search { border: none; outline: none; + transition: filter 0.15s ease-in-out; width: calc(100% - var(--spacing) * 2); } +#browser #search:focus { + filter: brightness(1.5); +} + #browser #close { --height: calc(var(--padding) * 1.5); @@ -182,28 +215,6 @@ #winbtns div:hover {opacity: 1.0} #winbtns div:active {transform: scale(0.98)} -body { - margin: 0; - overflow: hidden; - user-select: none; -} - -body, button, input {font-family: "Roboto", sans-serif} - -button {outline: none} -b, strong {font-weight: 700} -body, input, button {font-weight: 500} - -button { - border: none; - color: white; - outline: none; - font-weight: 700; - padding: 5px 10px; - border-radius: 5px; - transition: 0.2s ease-in-out; -} - button:hover {filter: brightness(110%)} button:active {filter: brightness(90%)} @@ -513,8 +524,8 @@ code { } .modbtns button { - --spacing: calc(var(--padding) / 3); margin-left: var(--spacing); + --spacing: calc(var(--padding) / 3); margin-top: calc(var(--spacing) / 2); margin-bottom: calc(var(--spacing) / 2); } diff --git a/src/lang/en.json b/src/lang/en.json index 5377ca2..0d29115 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -64,6 +64,7 @@ "gui.mods.installedmod": "Installed mod!", "gui.browser.loading": "Loading mods...", + "gui.browser.madeby": "by", "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", -- cgit v1.2.3 From 18d1166b6b8beef422590607cd02d613dd02d2d0 Mon Sep 17 00:00:00 2001 From: 3top1a <57371001+3top1a@users.noreply.github.com> Date: Mon, 24 Jan 2022 14:27:29 +0100 Subject: Edge case in vdf reading (#56) * Edge case * Alert user only when automatic detection failed * extra info on not found message * support for [Free/Open]BSD Co-authored-by: 0neGal --- .github/FUNDING.yml | 2 +- src/app/main.js | 1 - src/extras/findgame.js | 6 ++++-- src/lang/en.json | 2 +- src/utils.js | 2 ++ 5 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/lang/en.json') diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 96f466a..8991fb3 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ liberapay: 0neGal -custom: ["https://github.com/R2Northstar"] +custom: ["github.com/R2Northstar"] diff --git a/src/app/main.js b/src/app/main.js index 5f0cc9a..dab584e 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -32,7 +32,6 @@ if (fs.existsSync("viper.json")) { setpath(true); } } else { - alert(lang("general.missingpath")); setpath(); } diff --git a/src/extras/findgame.js b/src/extras/findgame.js index f7da1c0..42c9b85 100644 --- a/src/extras/findgame.js +++ b/src/extras/findgame.js @@ -41,17 +41,19 @@ module.exports = async () => { } } - let folder = ""; + let folder = null; switch (process.platform) { case "win32": folder = "C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf"; break case "linux": + case "openbsd": + case "freebsd": folder = path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf"); break } - if (fs.existsSync(folder)) { + if (fs.existsSync(folder) && folder) { let data = fs.readFileSync(folder) let read_vdf = readvdf(data.toString()) if (read_vdf ) {return read_vdf} diff --git a/src/lang/en.json b/src/lang/en.json index c2b6f98..8d4daeb 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -96,7 +96,7 @@ "general.mods.enabled": "Enabled mods:", "general.mods.disabled": "Disabled mods:", "general.mods.installed": "Installed mods:", - "general.missingpath": "Game path is not set!", + "general.missingpath": "Game location could not be found automatically! Please select it manually!", "general.notinstalled": "Northstar is not installed!", "general.launching": "Launching" } diff --git a/src/utils.js b/src/utils.js index a2c61d4..ef647fe 100644 --- a/src/utils.js +++ b/src/utils.js @@ -142,6 +142,8 @@ async function setpath(win) { return; } + alert(lang("general.missingpath")); + // Fallback to manual selection dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => { if (res.canceled) { -- cgit v1.2.3 From 9c6ac295189acab7303952725755dfac87e18470 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Mon, 24 Jan 2022 18:21:13 +0100 Subject: no alert when manually changing the game path When changing the game path by clicking the button you shouldn't be told it can't find the game and you've to select one manually, as you know that already. More importantly, if it could be found automatically it'll just not do anything. With this change I also changed the "gui.setpath" string to be more logical, and to make it clear what it does. --- src/app/main.js | 1 - src/index.js | 10 +++++++--- src/lang/en.json | 2 +- src/utils.js | 30 ++++++++++++++++-------------- 4 files changed, 24 insertions(+), 19 deletions(-) (limited to 'src/lang/en.json') diff --git a/src/app/main.js b/src/app/main.js index dab584e..a3a1d04 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -26,7 +26,6 @@ if (fs.existsSync("viper.json")) { settings.zip = path.join(settings.gamepath + "/northstar.zip"); if (settings.gamepath.length === 0) { - alert(lang("general.missingpath")); setpath(false); } else { setpath(true); diff --git a/src/index.js b/src/index.js index f4207e7..c8bfc53 100644 --- a/src/index.js +++ b/src/index.js @@ -87,9 +87,13 @@ ipcMain.on("launchVanilla", (event) => {utils.launch("vanilla")}) ipcMain.on("update", (event) => {utils.update()}) ipcMain.on("setpathcli", (event) => {utils.setpath()}); ipcMain.on("setpath", (event, value) => { - if (!value) { - utils.setpath(win); - } else if (!win.isVisible()) { + if (! value) { + if (! win.isVisible()) { + utils.setpath(win); + } else { + utils.setpath(win, true); + } + } else if (! win.isVisible()) { win.show(); } }); diff --git a/src/lang/en.json b/src/lang/en.json index 8d4daeb..fe9b0b0 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -42,7 +42,7 @@ "gui.versions.northstar": "Northstar version", "gui.exit": "Exit", "gui.update": "Update", - "gui.setpath": "Game Path", + "gui.setpath": "Change Game Path", "gui.update.check": "Check for updates", "gui.mods": "Mods", diff --git a/src/utils.js b/src/utils.js index ef647fe..fb94b92 100644 --- a/src/utils.js +++ b/src/utils.js @@ -116,7 +116,7 @@ northstar_auto_updates: { // // If running with CLI it takes in the --setpath argument otherwise it // open the systems file browser for the user to select a path. -async function setpath(win) { +async function setpath(win, forcedialog) { function setGamepath(folder) { settings.gamepath = folder; settings.zip = path.join(settings.gamepath + "/northstar.zip"); @@ -128,21 +128,23 @@ async function setpath(win) { if (! win) { // CLI setGamepath(cli.param("setpath")); } else { // GUI - function setGamepath(folder) { - settings.gamepath = folder; - settings.zip = path.join(settings.gamepath + "/northstar.zip"); - saveSettings(); - win.webContents.send("newpath", settings.gamepath); - ipcMain.emit("newpath", null, settings.gamepath); - } + if (! forcedialog) { + function setGamepath(folder, forcedialog) { + settings.gamepath = folder; + settings.zip = path.join(settings.gamepath + "/northstar.zip"); + saveSettings(); + win.webContents.send("newpath", settings.gamepath); + ipcMain.emit("newpath", null, settings.gamepath); + } - let gamepath = await findgame(); - if (gamepath) { - setGamepath(gamepath); - return; - } + let gamepath = await findgame(); + if (gamepath) { + setGamepath(gamepath); + return; + } - alert(lang("general.missingpath")); + winAlert(lang("general.missingpath")); + } // Fallback to manual selection dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => { -- cgit v1.2.3 From ea671766d7589d4efdb81996237dca9290b329c1 Mon Sep 17 00:00:00 2001 From: GitExample Date: Thu, 3 Feb 2022 01:47:56 +0100 Subject: added English localizations I forgot about these before... --- src/app/browser.js | 8 ++++---- src/lang/en.json | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index 357a076..7fbae1d 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -61,9 +61,9 @@ function BrowserEl(properties) { browserEntries.innerHTML = ""; } - let installstring = "Install"; + let installstr = lang("gui.browser.install"); if (normalize(modsdiv.innerText.split("\n")).includes(normalize(properties.title))) { - installstring = "Re-Install"; + installstr = lang("gui.browser.reinstall"); } browserEntries.innerHTML += ` @@ -74,7 +74,7 @@ function BrowserEl(properties) {
${properties.title}
${properties.description} - ${lang("gui.browser.madeby")} ${properties.author}
- +
@@ -86,7 +86,7 @@ ipcRenderer.on("installedmod", (event, modname) => { modname = normalize(modname); if (document.getElementById(modname)) { - document.getElementById(modname).querySelector(".text button").innerHTML = "Re-Install"; + document.getElementById(modname).querySelector(".text button").innerHTML = lang("gui.browser.reinstall"); } }) diff --git a/src/lang/en.json b/src/lang/en.json index 0d29115..47bfacb 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -65,6 +65,8 @@ "gui.browser.loading": "Loading mods...", "gui.browser.madeby": "by", + "gui.browser.install": "Install", + "gui.browser.reinstall": "Re-Install", "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", -- cgit v1.2.3 From 5884b9a8e91ed8b2c5cfea90afa2709697b05afb Mon Sep 17 00:00:00 2001 From: GitExample Date: Thu, 3 Feb 2022 23:03:33 +0100 Subject: detection for new updates of mods --- src/app/browser.js | 9 +++++++++ src/app/main.js | 2 ++ src/lang/en.json | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index b387a6a..dda0441 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -95,8 +95,17 @@ function BrowserEl(properties) { } let installstr = lang("gui.browser.install"); + if (normalize(modsdiv.innerText.split("\n")).includes(normalize(properties.title))) { installstr = lang("gui.browser.reinstall"); + + for (let i = 0; i < modsobj.all.length; i++) { + if (normalize(modsobj.all[i].Name) == normalize(properties.title) + && "v" + modsobj.all[i].Version != properties.version) { + + installstr = lang("gui.browser.update"); + } + } } browserEntries.innerHTML += ` diff --git a/src/app/main.js b/src/app/main.js index fa7cea8..08c70c1 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -3,6 +3,7 @@ const path = require("path"); const { ipcRenderer, shell } = require("electron"); const lang = require("../lang"); +var modsobj = {}; let shouldInstallNorthstar = false; // Base settings @@ -180,6 +181,7 @@ ipcRenderer.on("alert", (event, msg) => {alert(msg)}) // Updates the installed mods ipcRenderer.on("mods", (event, mods) => { + modsobj = mods; modcount.innerHTML = `${lang("gui.mods.count")} ${mods.all.length}`; modsdiv.innerHTML = ""; diff --git a/src/lang/en.json b/src/lang/en.json index 47bfacb..59af04b 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -63,10 +63,11 @@ "gui.mods.installing": "Installing mod...", "gui.mods.installedmod": "Installed mod!", - "gui.browser.loading": "Loading mods...", "gui.browser.madeby": "by", + "gui.browser.update": "Update", "gui.browser.install": "Install", "gui.browser.reinstall": "Re-Install", + "gui.browser.loading": "Loading mods...", "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", -- cgit v1.2.3 From 392a46168971eb3a4d578cec2b8ebea533e02747 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 5 Feb 2022 18:47:46 +0100 Subject: implemented limit to loading packages I have no clue if 50 packages is too small or too, big, we'll adjust this the more mods that arrive. I also made the browser auto scroll to the top when closed, it looks far better. --- src/app/browser.js | 8 ++++++++ src/app/main.css | 7 +++++++ src/lang/en.json | 1 + 3 files changed, 16 insertions(+) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index 6d10bfb..c23f217 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -3,8 +3,10 @@ var fuse; var packages = []; var Browser = { + maxentries: 50, toggle: (state) => { if (state) { + browser.scrollTo(0, 0); overlay.classList.add("shown") browser.classList.add("shown") return @@ -16,6 +18,7 @@ var Browser = { } } + browser.scrollTo(0, 0); overlay.classList.toggle("shown") browser.classList.toggle("shown") }, @@ -31,6 +34,7 @@ var Browser = { } for (let i in packages) { + if (i == Browser.maxentries) {Browser.endoflist();break} new BrowserElFromObj(packages[i]); } }, @@ -43,6 +47,9 @@ var Browser = { browserEntries.innerHTML = `
${lang('gui.browser.loading')}
`; } }, + endoflist: () => { + browserEntries.innerHTML += `
${lang('gui.browser.endoflist')}
` + }, search: (string) => { Browser.loading(); let res = fuse.search(string); @@ -53,6 +60,7 @@ var Browser = { } for (let i = 0; i < res.length; i++) { + if (i == Browser.maxentries) {Browser.endoflist();break} new BrowserElFromObj(res[i].item); } }, diff --git a/src/app/main.css b/src/app/main.css index e48625b..b6a07eb 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -177,6 +177,13 @@ button { height: calc(100% - var(--mischeight) - var(--height)); } +#browser .message { + color: white; + text-align: center; + margin: var(--padding); + width: calc(100% - var(--padding)); +} + #browser .el .image, #browser .el .image img { width: var(--height); height: var(--height); diff --git a/src/lang/en.json b/src/lang/en.json index 59af04b..6bef99f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -65,6 +65,7 @@ "gui.browser.madeby": "by", "gui.browser.update": "Update", + "gui.browser.endoflist": "Maximum packages has been loaded.
Use the search for finding other packages!", "gui.browser.install": "Install", "gui.browser.reinstall": "Re-Install", "gui.browser.loading": "Loading mods...", -- cgit v1.2.3 From 8b97390a9e35117bd4bc2f9ceb26f090d6a67ee9 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 5 Feb 2022 19:51:20 +0100 Subject: various changes, aesthetic and functionality This should fix the window drag not working, however I cannot test that. As my WM doesn't support it, a Windows contributor will have to test it. I also added an info button that opens the mod's page in your web browser, this button is of course localized, along with that I localized the placeholder in the search input. There's also a few general aesthetic changes, like adding a tiny border around #modsdiv and #browser. --- src/app/browser.js | 2 ++ src/app/index.html | 2 +- src/app/main.css | 10 ++++++++-- src/lang/en.json | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index 5695661..7b67822 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -100,6 +100,7 @@ function BrowserElFromObj(obj) { title: pkg.name, image: pkg.icon, author: pkg.owner, + url: pkg.package_url, download: pkg.download_url, version: pkg.version_number, description: pkg.description @@ -147,6 +148,7 @@ function BrowserEl(properties) {
${properties.title}
${properties.description}
+ diff --git a/src/app/index.html b/src/app/index.html index c2978bd..b861736 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -16,7 +16,7 @@
- + diff --git a/src/app/main.css b/src/app/main.css index 4f1ddc2..2791488 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -9,7 +9,11 @@ --selbg: rgba(80, 80, 80, 0.5); --redbg: linear-gradient(45deg, var(--red), #FA4343); --bluebg: linear-gradient(45deg, var(--blue), #7380ED); +} +#browser, #modsdiv { + outline: 1px solid #444444; + border: 3px solid var(--bg); } ::-webkit-scrollbar { @@ -73,7 +77,7 @@ button { bottom: var(--spacing); transform: scale(0.98); backdrop-filter: blur(15px); - border-radius: calc(var(--padding) / 2); + border-radius: calc(var(--padding) / 3); transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out; } @@ -556,7 +560,9 @@ code { /* drag control */ -#bgHolder { +#bgHolder, +#overlay.shown + .mainContainer, +#overlay.shown + .gamesContainer { user-select: none; -webkit-app-region: drag; } diff --git a/src/lang/en.json b/src/lang/en.json index 6bef99f..c51c843 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -63,12 +63,14 @@ "gui.mods.installing": "Installing mod...", "gui.mods.installedmod": "Installed mod!", + "gui.browser.info": "Info", "gui.browser.madeby": "by", + "gui.browser.search": "Search...", "gui.browser.update": "Update", - "gui.browser.endoflist": "Maximum packages has been loaded.
Use the search for finding other packages!", "gui.browser.install": "Install", "gui.browser.reinstall": "Re-Install", "gui.browser.loading": "Loading mods...", + "gui.browser.endoflist": "Maximum packages has been loaded.
Use the search for finding other packages!", "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", -- cgit v1.2.3 From 0a317f81def6b4c041cfc340e454a9bc8f0046fb Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 8 Feb 2022 23:22:39 +0100 Subject: added toasts for installation of mods It'll notify of incorrectly formatted mods, it'll also notify on errors and on success. --- src/app/browser.js | 29 +++++++++++++++++++++++++++-- src/app/main.css | 2 +- src/lang/en.json | 7 +++++++ src/utils.js | 10 +++++++--- 4 files changed, 42 insertions(+), 6 deletions(-) (limited to 'src/lang/en.json') diff --git a/src/app/browser.js b/src/app/browser.js index e1f37e5..ded12fa 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -198,9 +198,34 @@ ipcRenderer.on("removedmod", (event, mod) => { } }) -ipcRenderer.on("installedmod", (event, modname) => { +ipcRenderer.on("failedmod", (event, modname) => { setButtons(true); - Browser.setbutton(modname, lang("gui.browser.reinstall")); + new Toast({ + timeout: 10000, + scheme: "error", + title: lang("gui.toast.title.failed"), + description: lang("gui.toast.desc.failed") + }) +}) + +ipcRenderer.on("installedmod", (event, mod) => { + setButtons(true); + Browser.setbutton(mod.name, lang("gui.browser.reinstall")); + + if (mod.malformed) { + new Toast({ + timeout: 8000, + scheme: "warning", + title: lang("gui.toast.title.malformed"), + description: mod.name + " " + lang("gui.toast.desc.malformed") + }) + } + + new Toast({ + scheme: "success", + title: lang("gui.toast.title.installed"), + description: mod.name + " " + lang("gui.toast.desc.installed") + }) }) function normalize(items) { diff --git a/src/app/main.css b/src/app/main.css index 14348bd..a532490 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -609,7 +609,7 @@ code { .toast .description { opacity: 0.8; font-size: 0.8em; - font-weight: 400; + font-weight: 600; } /* drag control */ diff --git a/src/lang/en.json b/src/lang/en.json index a9eb47f..27630ec 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -90,6 +90,13 @@ "gui.gamepath.must": "The game path must be set to start Viper.", "gui.gamepath.wrong": "This folder is not a valid game path.", + "gui.toast.title.installed": "Mod installed!", + "gui.toast.title.failed": "Failed to install", + "gui.toast.title.malformed": "Incorrect folder structure!", + "gui.toast.desc.installed": "has been installed successfully!", + "gui.toast.desc.malformed": "has an incorrect folder structure, if you're the developer, you should fix this.", + "gui.toast.desc.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.", + "viper.menu.main": "Viper", "viper.menu.release": "Release Notes", "viper.menu.info": "Extras", diff --git a/src/utils.js b/src/utils.js index b825309..7a1e333 100644 --- a/src/utils.js +++ b/src/utils.js @@ -450,7 +450,7 @@ const mods = { // Either a zip or folder is supported, we'll also try to search // inside the zip or folder to see if buried in another folder or // not, as sometimes that's the case. - install: (mod, destname, manifestfile) => { + install: (mod, destname, manifestfile, malformed = false) => { let modname = mod.replace(/^.*(\\|\/|\:)/, ""); if (getNSVersion() == "unknown") { @@ -481,7 +481,10 @@ const mods = { } } - ipcMain.emit("installedmod", "", modname); + ipcMain.emit("installedmod", "", { + name: modname, + malformed: malformed, + }); ipcMain.emit("guigetmods"); return true; } @@ -539,7 +542,7 @@ const mods = { files = fs.readdirSync(path.join(cache, "mods")); if (fs.existsSync(path.join(cache, "mods/mod.json"))) { - if (mods.install(path.join(cache, "mods"), require(manifest).name, manifest)) { + if (mods.install(path.join(cache, "mods"), require(manifest).name, manifest, true)) { return true; } } else { @@ -553,6 +556,7 @@ const mods = { } } + ipcMain.emit("failedmod", "", modname); return notamod(); } -- cgit v1.2.3