mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-21 06:09:51 +01:00
Merge pull request #364 from AltarikMC/dev
Add a notification in case of microsoft login error, update discord link
This commit is contained in:
commit
7242c71c52
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "altarik-launcher",
|
||||
"author": "Altarik",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"description": "Altarik Launcher",
|
||||
"main": "src/server/main.js",
|
||||
"type": "module",
|
||||
@ -44,7 +44,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"decompress": "^4.2.1",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"electron-is-dev": "^3.0.1",
|
||||
"electron-log": "^5.0.3",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"extract-zip": "^2.0.1",
|
||||
|
@ -2,8 +2,8 @@ const vue = require('vue/dist/vue.cjs.js')
|
||||
app = vue.createApp({
|
||||
data () {
|
||||
return {
|
||||
displayFullscreen: "block",
|
||||
fullscreenText: "Recherche de mise à jour...",
|
||||
displayFullscreen: 'block',
|
||||
fullscreenText: 'Recherche de mise à jour...',
|
||||
downloadLink: null
|
||||
}
|
||||
},
|
||||
@ -12,21 +12,21 @@ app = vue.createApp({
|
||||
},
|
||||
methods: {
|
||||
sendCheckingUpdate () {
|
||||
ipcRenderer.send("checking-update");
|
||||
ipcRenderer.send('checking-update')
|
||||
},
|
||||
openLinkExternal () {
|
||||
shell.openExternal(this.downloadLink)
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
let root = app.mount("#vue");
|
||||
const root = app.mount('#vue')
|
||||
|
||||
ipcRenderer.on("update-available", (event, arg) => {
|
||||
root.fullscreenText = "Mise à jour disponible, téléchargement..."
|
||||
});
|
||||
ipcRenderer.on('update-available', (event, arg) => {
|
||||
root.fullscreenText = 'Mise à jour disponible, téléchargement...'
|
||||
})
|
||||
|
||||
ipcRenderer.on("please-download-update", (event, args) => {
|
||||
root.fullscreenText = `Veuillez télécharger la mise à jour en cliquant sur le lien suivant :`
|
||||
ipcRenderer.on('please-download-update', (event, args) => {
|
||||
root.fullscreenText = 'Veuillez télécharger la mise à jour en cliquant sur le lien suivant :'
|
||||
root.downloadLink = `${args.url}`
|
||||
})
|
@ -5,30 +5,29 @@ const vue = require('vue/dist/vue.cjs.js')
|
||||
app = vue.createApp({
|
||||
data () {
|
||||
return {
|
||||
minMemValue: localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : 1024 ,
|
||||
maxMemValue: localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : 2048,
|
||||
minMemValue: localStorage.getItem('minMem') != null ? localStorage.getItem('minMem') : 1024,
|
||||
maxMemValue: localStorage.getItem('maxMem') != null ? localStorage.getItem('maxMem') : 2048,
|
||||
memStep: 128,
|
||||
memMax: totalMem,
|
||||
invalidateButtonText: "Supprimer et retélécharger les bibliothèques",
|
||||
invalidateButtonText: 'Supprimer et retélécharger les bibliothèques',
|
||||
invalidateButtonDisabled: false,
|
||||
displayFullscreen: "none",
|
||||
displaySettings: "none",
|
||||
displayCredits: "none",
|
||||
nick: "Chargement",
|
||||
launchBtnText: "Selectionnez un chapitre",
|
||||
displayFullscreen: 'none',
|
||||
displaySettings: 'none',
|
||||
displayCredits: 'none',
|
||||
nick: 'Chargement',
|
||||
launchBtnText: 'Selectionnez un chapitre',
|
||||
launchBtnDisable: true,
|
||||
launchBtnHidden: false,
|
||||
loadingMessageHidden: true,
|
||||
loadingMessageText: "Téléchargement de Minecraft en cours...",
|
||||
loadingMessageText: 'Téléchargement de Minecraft en cours...',
|
||||
fullprogressbarHidden: true,
|
||||
progressbarWidth: 0,
|
||||
sidebarContent: "<hr><p>Chargement en cours</p>",
|
||||
sidebarContent: '<hr><p>Chargement en cours</p>',
|
||||
modsInformations: [],
|
||||
modsInformationsLoaded: true,
|
||||
selectedChapter: -1,
|
||||
gameLaunching: false
|
||||
}
|
||||
|
||||
},
|
||||
mounted () {
|
||||
iziToast.settings({
|
||||
@ -36,17 +35,17 @@ app = vue.createApp({
|
||||
closeOnClick: true,
|
||||
timeout: 5000,
|
||||
position: 'topRight',
|
||||
resetOnHover: true,
|
||||
resetOnHover: true
|
||||
})
|
||||
setInterval(() => {
|
||||
ipcRenderer.send("pageReady")
|
||||
ipcRenderer.send('pageReady')
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
invalidateData () {
|
||||
this.invalidateButtonDisabled = true
|
||||
this.invalidateButtonText = "Opération en cours"
|
||||
this.showInfo("Opération en cours", "Suppression des données du jeu en cours")
|
||||
this.invalidateButtonText = 'Opération en cours'
|
||||
this.showInfo('Opération en cours', 'Suppression des données du jeu en cours')
|
||||
ipcRenderer.send('invalidateData')
|
||||
},
|
||||
launchBtnClick () {
|
||||
@ -55,21 +54,21 @@ app = vue.createApp({
|
||||
this.loadingMessageHidden = false
|
||||
if (Number(this.minMemValue) <= Number(this.maxMemValue)) {
|
||||
ipcRenderer.send('launch', {
|
||||
minMem: this.minMemValue + "M",
|
||||
maxMem: this.maxMemValue + "M",
|
||||
minMem: this.minMemValue + 'M',
|
||||
maxMem: this.maxMemValue + 'M',
|
||||
chapter: this.selectedChapter
|
||||
})
|
||||
this.launchBtnDisable = true
|
||||
localStorage.setItem("minMem", this.minMemValue)
|
||||
localStorage.setItem("maxMem", this.maxMemValue)
|
||||
localStorage.setItem('minMem', this.minMemValue)
|
||||
localStorage.setItem('maxMem', this.maxMemValue)
|
||||
this.gameLaunching = true
|
||||
} else {
|
||||
this.showError("Erreur de lancement", "La mémoire minimale doit être inférieure ou égale à la mémoire maximale.")
|
||||
this.showError('Erreur de lancement', 'La mémoire minimale doit être inférieure ou égale à la mémoire maximale.')
|
||||
}
|
||||
},
|
||||
changeSelectedChapter (index) {
|
||||
this.selectedChapter = parseInt(index)
|
||||
root.launchBtnText = "JOUER"
|
||||
root.launchBtnText = 'JOUER'
|
||||
root.launchBtnDisable = false
|
||||
},
|
||||
disconnectBtn () {
|
||||
@ -77,26 +76,26 @@ app = vue.createApp({
|
||||
},
|
||||
options () {
|
||||
if (!this.gameLaunching) {
|
||||
this.displayFullscreen = "block"
|
||||
this.displaySettings = "block"
|
||||
this.displayCredits = "none"
|
||||
this.displayFullscreen = 'block'
|
||||
this.displaySettings = 'block'
|
||||
this.displayCredits = 'none'
|
||||
}
|
||||
},
|
||||
discord () {
|
||||
shell.openExternal("https://discord.gg/b923tMhmRE")
|
||||
shell.openExternal('https://discord.gg/p3EnE6Jumg')
|
||||
},
|
||||
web () {
|
||||
shell.openExternal("https://altarik.fr")
|
||||
shell.openExternal('https://altarik.fr')
|
||||
},
|
||||
closeFullscreen () {
|
||||
this.displayFullscreen = "none"
|
||||
this.displaySettings = "none"
|
||||
this.displayCredits = "none"
|
||||
this.displayFullscreen = 'none'
|
||||
this.displaySettings = 'none'
|
||||
this.displayCredits = 'none'
|
||||
},
|
||||
credits () {
|
||||
this.displayFullscreen = "block"
|
||||
this.displaySettings = "none"
|
||||
this.displayCredits = "block"
|
||||
this.displayFullscreen = 'block'
|
||||
this.displaySettings = 'none'
|
||||
this.displayCredits = 'block'
|
||||
},
|
||||
updateModsInformations (content) {
|
||||
this.modsInformations = content
|
||||
@ -106,28 +105,28 @@ app = vue.createApp({
|
||||
},
|
||||
showInfo (title, body) {
|
||||
iziToast.info({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'blue'
|
||||
})
|
||||
},
|
||||
showError (title, body) {
|
||||
iziToast.error({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'red',
|
||||
color: 'red'
|
||||
})
|
||||
},
|
||||
showWarning (title, body) {
|
||||
iziToast.warning({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'yellow'
|
||||
})
|
||||
},
|
||||
showSuccess (title, body) {
|
||||
iziToast.success({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'green'
|
||||
})
|
||||
@ -138,24 +137,24 @@ app = vue.createApp({
|
||||
}
|
||||
})
|
||||
|
||||
let root = app.mount("#vue")
|
||||
const root = app.mount('#vue')
|
||||
|
||||
ipcRenderer.on("invalidated", () => {
|
||||
ipcRenderer.on('invalidated', () => {
|
||||
root.invalidateButtonDisabled = false
|
||||
root.invalidateButtonText = "Supprimer et retélécharger les bibliothèques"
|
||||
root.showSuccess("Opération terminée", "Les données du jeu ont été supprimé avec succès")
|
||||
root.invalidateButtonText = 'Supprimer et retélécharger les bibliothèques'
|
||||
root.showSuccess('Opération terminée', 'Les données du jeu ont été supprimé avec succès')
|
||||
})
|
||||
|
||||
ipcRenderer.on("progress", (e, args) => {
|
||||
ipcRenderer.on('progress', (e, args) => {
|
||||
root.progressbarWidth = (args.task / Math.max(args.total, args.task)) * 100
|
||||
root.loadingMessageText = "Téléchargement de " + args.type + ": " + args.task + " sur " + Math.max(args.total, args.task)
|
||||
root.loadingMessageText = 'Téléchargement de ' + args.type + ': ' + args.task + ' sur ' + Math.max(args.total, args.task)
|
||||
})
|
||||
|
||||
ipcRenderer.on("close", (_e, _args) => {
|
||||
ipcRenderer.on('close', (_e, _args) => {
|
||||
root.launchBtnHidden = false
|
||||
root.fullprogressbarHidden = true
|
||||
root.loadingMessageHidden = true
|
||||
root.loadingMessageText = "Chargement de Minecraft en cours..."
|
||||
root.loadingMessageText = 'Chargement de Minecraft en cours...'
|
||||
root.progressbarWidth = 0
|
||||
root.launchBtnDisable = false
|
||||
root.gameLaunching = false
|
||||
@ -166,7 +165,7 @@ ipcRenderer.on('launch', (_e, _args) => {
|
||||
root.loadingMessageHidden = true
|
||||
})
|
||||
|
||||
ipcRenderer.on("modsInformations", (_e, args) => {
|
||||
ipcRenderer.on('modsInformations', (_e, args) => {
|
||||
if (args === null) {
|
||||
root.modsInformationsLoaded = false
|
||||
} else {
|
||||
@ -175,4 +174,4 @@ ipcRenderer.on("modsInformations", (_e, args) => {
|
||||
root.updateModsInformations(args)
|
||||
})
|
||||
|
||||
ipcRenderer.on("nick", (_e, args) => root.nick = args.name)
|
||||
ipcRenderer.on('nick', (_e, args) => root.nick = args.name)
|
||||
|
@ -2,11 +2,11 @@ const vue = require('vue/dist/vue.cjs.js')
|
||||
app = vue.createApp({
|
||||
data () {
|
||||
return {
|
||||
login: "Connexion",
|
||||
email: "Email",
|
||||
password: "Mot de passe",
|
||||
send_credentials: "Se connecter",
|
||||
microsoft_button: "Connexion avec un compte Microsoft",
|
||||
login: 'Connexion',
|
||||
email: 'Email',
|
||||
password: 'Mot de passe',
|
||||
send_credentials: 'Se connecter',
|
||||
microsoft_button: 'Connexion avec un compte Microsoft'
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -15,7 +15,7 @@ app = vue.createApp({
|
||||
closeOnClick: true,
|
||||
timeout: 5000,
|
||||
position: 'topRight',
|
||||
resetOnHover: true,
|
||||
resetOnHover: true
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@ -24,12 +24,12 @@ app = vue.createApp({
|
||||
if (!microsoftButton.disabled) {
|
||||
form.disabled = true
|
||||
if (user.value) {
|
||||
ipcRenderer.send("login", {
|
||||
ipcRenderer.send('login', {
|
||||
user: user.value,
|
||||
pass: password.value
|
||||
})
|
||||
} else {
|
||||
this.showWarning("Erreur de connexion", "Veuillez entrer des identifiants")
|
||||
this.showWarning('Erreur de connexion', 'Veuillez entrer des identifiants')
|
||||
form.disabled = false
|
||||
}
|
||||
}
|
||||
@ -39,51 +39,49 @@ app = vue.createApp({
|
||||
if (!form.disabled) {
|
||||
microsoftButton.disabled = true
|
||||
form.disabled = true
|
||||
ipcRenderer.send("microsoft-login")
|
||||
ipcRenderer.send('microsoft-login')
|
||||
}
|
||||
},
|
||||
showInfo (title, body) {
|
||||
iziToast.info({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'blue'
|
||||
})
|
||||
},
|
||||
showError (title, body) {
|
||||
iziToast.error({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'red',
|
||||
color: 'red'
|
||||
})
|
||||
},
|
||||
showWarning (title, body) {
|
||||
iziToast.warning({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'yellow'
|
||||
})
|
||||
},
|
||||
showSuccess (title, body) {
|
||||
iziToast.success({
|
||||
title: title,
|
||||
title,
|
||||
message: body,
|
||||
color: 'green'
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
app.mount("#vue");
|
||||
app.mount('#vue')
|
||||
|
||||
// theirs const are declared after vue cause vue modify them when declaring new vue instance
|
||||
const form = document.querySelector('#login-form')
|
||||
const user = document.querySelector('#nickname')
|
||||
const password = document.querySelector('#password')
|
||||
const microsoftButton = document.querySelector("#microsoft-button")
|
||||
const microsoftButton = document.querySelector('#microsoft-button')
|
||||
|
||||
|
||||
|
||||
ipcRenderer.on("loginError", () => {
|
||||
ipcRenderer.on('loginError', () => {
|
||||
form.disabled = false
|
||||
microsoftButton.disabled = false
|
||||
})
|
||||
|
@ -1,29 +1,29 @@
|
||||
'use strict';
|
||||
const { ipcRenderer, shell } = require('electron');
|
||||
let app;
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const minimizeButton = document.getElementById("minimize-btn")
|
||||
const closeButton = document.getElementById("close-btn")
|
||||
'use strict'
|
||||
const { ipcRenderer, shell } = require('electron')
|
||||
let app
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const minimizeButton = document.getElementById('minimize-btn')
|
||||
const closeButton = document.getElementById('close-btn')
|
||||
|
||||
minimizeButton.addEventListener("click", () => ipcRenderer.send('minimizeWindow'))
|
||||
minimizeButton.addEventListener('click', () => ipcRenderer.send('minimizeWindow'))
|
||||
|
||||
closeButton.addEventListener("click", () => ipcRenderer.send('closeWindow'))
|
||||
closeButton.addEventListener('click', () => ipcRenderer.send('closeWindow'))
|
||||
})
|
||||
|
||||
ipcRenderer.on('notification', (_e, args) => {
|
||||
app.notificationTitle = args.title
|
||||
app.notificationMessage = args.body
|
||||
switch (args.class) {
|
||||
case "success":
|
||||
case 'success':
|
||||
app._component.methods.showSuccess(args.title, args.body)
|
||||
break;
|
||||
case "warning":
|
||||
break
|
||||
case 'warning':
|
||||
app._component.methods.showWarning(args.title, args.body)
|
||||
break;
|
||||
case "error":
|
||||
break
|
||||
case 'error':
|
||||
app._component.methods.showError(args.title, args.body)
|
||||
break;
|
||||
case "info":default:
|
||||
break
|
||||
case 'info':default:
|
||||
app._component.methods.showInfo(args.title, args.body)
|
||||
}
|
||||
})
|
||||
|
@ -69,6 +69,8 @@ export default class Minecraft {
|
||||
})
|
||||
}).catch(err => {
|
||||
event.sender.send('loginError')
|
||||
logger.error('[MS login]' + lst(err))
|
||||
this.showNotification('Une erreur de connexion à Xbox est survenue', lst(err), 'error')
|
||||
if (err !== 'error.gui.closed') {
|
||||
logger.error('[MS login] ' + lst(err))
|
||||
this.showNotification('Une erreur de connexion à Xbox est survenue', lst(err), 'error')
|
||||
|
@ -1572,10 +1572,10 @@ ecc-jsbn@~0.1.1:
|
||||
jsbn "~0.1.0"
|
||||
safer-buffer "^2.1.0"
|
||||
|
||||
electron-is-dev@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-2.0.0.tgz#833487a069b8dad21425c67a19847d9064ab19bd"
|
||||
integrity sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA==
|
||||
electron-is-dev@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-3.0.1.tgz#1cbc79b1dd046787903acd357efdfab6549dc17a"
|
||||
integrity sha512-8TjjAh8Ec51hUi3o4TaU0mD3GMTOESi866oRNavj9A3IQJ7pmv+MJVmdZBFGw4GFT36X7bkqnuDNYvkQgvyI8Q==
|
||||
|
||||
electron-log@^5.0.3:
|
||||
version "5.0.3"
|
||||
|
Loading…
Reference in New Issue
Block a user