aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/browser.js10
-rw-r--r--src/app/launcher.js14
-rw-r--r--src/app/main.js9
3 files changed, 27 insertions, 6 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index 4b9f2e3..db68d31 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -391,6 +391,16 @@ ipcRenderer.on("failed-mod", (event, modname) => {
})
})
+ipcRenderer.on("no-internet", (event, modname) => {
+ setButtons(true);
+ new Toast({
+ timeout: 10000,
+ scheme: "error",
+ title: lang("gui.toast.noInternet.title"),
+ description: lang("gui.toast.noInternet.desc")
+ })
+})
+
ipcRenderer.on("installed-mod", (event, mod) => {
setButtons(true);
Browser.setbutton(mod.name, lang("gui.browser.reinstall"));
diff --git a/src/app/launcher.js b/src/app/launcher.js
index fbeb703..e1dbbe0 100644
--- a/src/app/launcher.js
+++ b/src/app/launcher.js
@@ -26,13 +26,17 @@ function page(page) {
function formatRelease(notes) {
let content = "";
- for (let release of notes) {
- if (release.prerelease) {continue}
- content += "# " + release.name + "\n\n" + release.body + "\n\n\n";
+ if (notes.length === 1) {
+ content = notes[0];
+ } else {
+ for (let release of notes) {
+ if (release.prerelease) {continue}
+ content += "# " + release.name + "\n\n" + release.body + "\n\n\n";
+ }
+
+ content = content.replaceAll(/\@(\S+)/g, `<a href="https://github.com/$1">@$1</a>`);
}
- content = content.replaceAll(/\@(\S+)/g, `<a href="https://github.com/$1">@$1</a>`);
-
return markdown(content, {
breaks: true
});
diff --git a/src/app/main.js b/src/app/main.js
index 9fb3191..d6a57d6 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -1,6 +1,6 @@
const fs = require("fs");
const path = require("path");
-const { ipcRenderer, shell } = require("electron");
+const { ipcRenderer, shell, ipcMain } = require("electron");
const lang = require("../lang");
var modsobj = {};
@@ -62,6 +62,12 @@ if (fs.existsSync("viper.json")) {
setpath();
}
+
+// Show a toast message if no Internet connection has been detected.
+if (!navigator.onLine) {
+ ipcRenderer.send("no-internet");
+}
+
function exit() {ipcRenderer.send("exit")}
function update() {ipcRenderer.send("update")}
@@ -122,6 +128,7 @@ ipcRenderer.on("ns-update-event", (event, key) => {
console.log(lang(key));
switch(key) {
case "cli.update.uptodate.short":
+ case "cli.update.noInternet":
setButtons(true);
playNsBtn.innerText = lang("gui.launch");
break;