From 00d04db553eb53abb48f0b4e3649a6912fdc10df Mon Sep 17 00:00:00 2001 From: 0neGal Date: Fri, 20 Dec 2024 20:21:28 +0100 Subject: added request.check_with_toasts() and use it This makes it very simple to check if some endpoints are available, and show a toast if not, with an error message saying exactly what isn't available. Currently made use for updates with GitHub and installs with Thunderstore. --- src/app/js/update.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/app/js/update.js') diff --git a/src/app/js/update.js b/src/app/js/update.js index d03db02..3732f89 100644 --- a/src/app/js/update.js +++ b/src/app/js/update.js @@ -125,7 +125,15 @@ let update = { // updates Northstar, `force_update` forcefully updates Northstar, // causing it to update, even if its already up-to-date - ns: (force_update) => { + ns: async (force_update) => { + let can_connect = await request.check_with_toasts( + "GitHub", "https://github.com" + ) + + if (! can_connect) { + return; + } + update.ns.last_checked = new Date().getTime(); ipcRenderer.send("update-northstar", force_update); update.ns.should_install = false; -- cgit v1.2.3