4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00

Update minecraft.js to make it work with last msmc update

This commit is contained in:
Quentin Legot 2023-03-22 19:35:10 +01:00
parent 210c75d6fa
commit f2056293e8

View File

@ -7,7 +7,7 @@ const { join } = require('path')
const constants = require("constants") const constants = require("constants")
const zip = require('extract-zip') const zip = require('extract-zip')
const logger = require('electron-log') const logger = require('electron-log')
const msmc = require('msmc') const { auth, lst } = require('msmc')
const decompress = require('decompress') const decompress = require('decompress')
const decompressTar = require('decompress-targz') const decompressTar = require('decompress-targz')
@ -49,34 +49,28 @@ class Minecraft {
* Used to login through a Microsoft account * Used to login through a Microsoft account
*/ */
microsoftLogin(event, win) { microsoftLogin(event, win) {
msmc.fastLaunch("electron", const authManager = new auth("select_account")
(update) => { authManager.launch("electron").then(async xboxManager => {
switch (update.type) { xboxManager.getMinecraft().then(async token => {
case "Error": if(!token.isDemo()) {
event.sender.send("loginError") this.auth = token.mclc()
this.showNotification("Une erreur est survenue", update.data, "error")
logger.error("MC-Account error:", update.data);
break;
}
}).then(result => {
if(msmc.errorCheck(result)) {
event.sender.send("loginError")
logger.error(result.reason)
this.showNotification("Erreur de connexion", result.reason, "error")
} else {
if(!msmc.isDemoUser(result)) {
this.auth = msmc.getMCLC().getAuth(result)
win.loadFile('src/client/index.html') win.loadFile('src/client/index.html')
} else { } else {
event.sender.send("loginError") event.sender.send("loginError")
logger.error("[MS login] User haven't purchase the game") logger.error("[MS login] User haven't purchase the game")
this.showNotification("Erreur de connexion", "Vous ne possèdez pas de licence Minecraft sur ce compte", "error") this.showNotification("Erreur de connexion", "Vous ne possèdez pas de licence Minecraft sur ce compte", "error")
} }
} }).catch(err => {
}).catch(reason => {
event.sender.send("loginError") event.sender.send("loginError")
logger.error(reason) logger.error("[MS login] " + lst(err))
this.showNotification("Erreur de connexion", "Erreur inconnue", "error") this.showNotification("Erreur de connexion à Mojang", lst(err), "error")
})
}).catch(err => {
event.sender.send("loginError")
if(err != "error.gui.closed") {
logger.error("[MS login] " + lst(err))
this.showNotification("Une erreur de connexion à Xbox est survenue", lst(err), "error")
}
}) })
} }