mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-21 06:09:51 +01:00
Merge pull request #184 from AltarikMC/fix-updater
Fix updater on linux, should display download text on windows, dump to 2.0.2
This commit is contained in:
commit
f4b037d85f
@ -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/",
|
||||
|
@ -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: <a href="${args.url}">${args.url}</a>`
|
||||
root.fullscreenText = `Veuillez télécharger la mise à jour en cliquant sur le lien suivant :`
|
||||
root.downloadLink = `${args.url}`
|
||||
})
|
@ -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")
|
||||
|
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
<div id="fullscreen" :style="{ display: displayFullscreen }">
|
||||
<div id="fullscreen-content">
|
||||
<p>{{ fullscreenText }}</p>
|
||||
<p>{{ fullscreenText }} <br /><a @click="openLinkExternal" v-if="downloadLink !== null" href="#">{{ downloadLink }}</a></p>
|
||||
<div class="dots-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user