diff --git a/package.json b/package.json index 3479555..13a0742 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "altarik-launcher", "author": "Altarik", - "version": "2.0.1", + "version": "2.0.2", "description": "Altarik Launcher", "main": "src/server/main.js", "homepage": "https://altarik.fr/", diff --git a/src/client/assets/js/checkingUpdate.js b/src/client/assets/js/checkingUpdate.js index b1977f5..f5386f4 100644 --- a/src/client/assets/js/checkingUpdate.js +++ b/src/client/assets/js/checkingUpdate.js @@ -3,7 +3,8 @@ app = vue.createApp({ data() { return { displayFullscreen: "block", - fullscreenText: "Recherche de mise à jour..." + fullscreenText: "Recherche de mise à jour...", + downloadLink: null } }, mounted() { @@ -12,16 +13,20 @@ app = vue.createApp({ methods: { sendCheckingUpdate() { ipcRenderer.send("checking-update"); + }, + openLinkExternal() { + shell.openExternal(this.downloadLink) } }, }); -app.mount("#vue"); +let root = app.mount("#vue"); ipcRenderer.on("update-available", (event, arg) => { - app.fullscreenText = "Mise à jour disponible, téléchargement..." + root.fullscreenText = "Mise à jour disponible, téléchargement..." }); ipcRenderer.on("please-download-update", (event, args) => { - app.fullscreenText = `Veuillez télécharger la mise à jour en cliquant sur le lien suivant: ${args.url}` + root.fullscreenText = `Veuillez télécharger la mise à jour en cliquant sur le lien suivant :` + root.downloadLink = `${args.url}` }) \ No newline at end of file diff --git a/src/client/assets/js/preload.js b/src/client/assets/js/preload.js index 4fd6d9a..feb32a5 100644 --- a/src/client/assets/js/preload.js +++ b/src/client/assets/js/preload.js @@ -1,5 +1,5 @@ 'use strict'; -const { ipcRenderer } = require('electron'); +const { ipcRenderer, shell } = require('electron'); let app; window.addEventListener("DOMContentLoaded", () => { const minimizeButton = document.getElementById("minimize-btn") diff --git a/src/client/checkingUpdate.html b/src/client/checkingUpdate.html index ecd3e3a..1075d1d 100644 --- a/src/client/checkingUpdate.html +++ b/src/client/checkingUpdate.html @@ -23,7 +23,7 @@
-

{{ fullscreenText }}

+

{{ fullscreenText }}
{{ downloadLink }}

diff --git a/src/server/main.js b/src/server/main.js index a001ac9..8f2ac01 100644 --- a/src/server/main.js +++ b/src/server/main.js @@ -28,7 +28,7 @@ function createWindow () { }, frame: false }) - Menu.setApplicationMenu(null) + //Menu.setApplicationMenu(null) win.loadFile('src/client/checkingUpdate.html') win.on("close", () => { app.quit() diff --git a/src/server/updater.js b/src/server/updater.js index 0019424..8c7dc3b 100644 --- a/src/server/updater.js +++ b/src/server/updater.js @@ -67,16 +67,19 @@ class Updater { if(response.status === 200) { response.json().then(json => { if(json.tag_name !== pkg.version) { - let asset = json.assets.filter(el => el.browser_download_url.inludes(".zip")) - if(asset.length ===1) { + let asset = json.assets.filter(el => el.browser_download_url.includes(".zip")) + if(asset.length === 1) { let downloadUrl = asset[0].browser_download_url win.webContents.send("please-download-update", { url: downloadUrl} ) + this.logger.info("update available, please download") } else { this.displayError(win, showNotification, "Can't find right asset in last update") } + } else { + this.logger.info("update not available") + win.loadFile('src/client/login.html') } - }).catch(err => this.displayError(win, showNotification, err) - ) + }).catch(err => this.displayError(win, showNotification, err)) } else { this.displayError(win, showNotification, "Server unavailable") }