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

fix ms login + updated msmc

This commit is contained in:
Quentin Legot 2021-08-29 14:11:34 +02:00
parent cac1afbd31
commit c8f598897d
6 changed files with 45 additions and 44 deletions

18
package-lock.json generated
View File

@ -3386,9 +3386,9 @@
"dev": true "dev": true
}, },
"minecraft-launcher-core": { "minecraft-launcher-core": {
"version": "3.16.6", "version": "3.16.8",
"resolved": "https://registry.npmjs.org/minecraft-launcher-core/-/minecraft-launcher-core-3.16.6.tgz", "resolved": "https://registry.npmjs.org/minecraft-launcher-core/-/minecraft-launcher-core-3.16.8.tgz",
"integrity": "sha512-AQ9t3Gb86c8ju37ZSkhfHqxJQ6rv1I9mnxgrALqawpC0IuelykUF7So9k2QUzoD+sbwRxXMgllj9YymNkreL4A==", "integrity": "sha512-0amflttrl/Ad+Q7DSPXbWYRdUdTCquZB+H/K/JbU6ZAx4VwfjSa08ancEYDktAlEBUwswzhiEpkf+Xgs0PWWng==",
"requires": { "requires": {
"adm-zip": "^0.4.13", "adm-zip": "^0.4.13",
"checksum": "^0.1.1", "checksum": "^0.1.1",
@ -3460,9 +3460,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}, },
"msmc": { "msmc": {
"version": "2.1.3", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/msmc/-/msmc-2.1.3.tgz", "resolved": "https://registry.npmjs.org/msmc/-/msmc-2.2.0.tgz",
"integrity": "sha512-g2X/VbdarLfT76reSKGgBKmnllliZnEx2KSxBTt53Y/BWek3WD6e1WfsYb3AOpNV34O9FEO2kbgelUb9FLmviQ==", "integrity": "sha512-nUvxPXpy/tnVcLbx4zUyEn88bAvWVJhhYNavnGVd4cebGMgiRv0SAxVE5pVMJAr5mtAqb9klxqZPNurIfvYdcg==",
"requires": { "requires": {
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1"
} }
@ -3944,9 +3944,9 @@
"dev": true "dev": true
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true "dev": true
}, },
"path-type": { "path-type": {

View File

@ -35,8 +35,8 @@
"electron-squirrel-startup": "^1.0.0", "electron-squirrel-startup": "^1.0.0",
"extract-zip": "^2.0.1", "extract-zip": "^2.0.1",
"hasha": "^5.2.2", "hasha": "^5.2.2",
"minecraft-launcher-core": "^3.16.6", "minecraft-launcher-core": "^3.16.7",
"msmc": "^2.1.3" "msmc": "^2.2.0"
}, },
"config": { "config": {
"forge": "./config.forge.js" "forge": "./config.forge.js"

View File

@ -2,7 +2,7 @@
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Launcher Projet Secret</title> <title>Altarik Launcher</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="assets/css/fonts.css" rel="stylesheet" /> <link href="assets/css/fonts.css" rel="stylesheet" />
<link href="assets/css/index.css" rel="stylesheet" /> <link href="assets/css/index.css" rel="stylesheet" />

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Launcher Projet Secret</title> <title>Altarik Launcher</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<link href="assets/css/fonts.css" rel="stylesheet" /> <link href="assets/css/fonts.css" rel="stylesheet" />
<link href="assets/css/login.css" rel="stylesheet" /> <link href="assets/css/login.css" rel="stylesheet" />

View File

@ -80,7 +80,7 @@ ipcMain.on("launch", (event, args) => {
}) })
function showNotification(title, body="") { function showNotification(title, body="") {
new Notification({ title: title, body: body }).show() new Notification({ title: title, body: body, silent: false, icon: "../../icon.ico"}).show()
} }
ipcMain.on("notification", (event, args) => { ipcMain.on("notification", (event, args) => {

View File

@ -30,7 +30,7 @@ class Minecraft {
}) })
}).catch((err) => { }).catch((err) => {
event.sender.send("loginError") event.sender.send("loginError")
logger.error(err) logger.error("[MJ login] User haven't purchase the game")
showNotification("Erreur de connexion") showNotification("Erreur de connexion")
}) })
} else { } else {
@ -42,36 +42,37 @@ class Minecraft {
* Used to login through a Microsoft account * Used to login through a Microsoft account
*/ */
microsoftLogin(event, win, showNotification) { microsoftLogin(event, win, showNotification) {
msmc.getElectron().FastLaunch( msmc.fastLaunch("electron",
(callback) => {
this.auth = msmc.getMCLC().getAuth(callback)
this.auth.then(v => {
win.loadFile('src/client/index.html').then(() => {
event.sender.send("nick", { name: v.name })
})
}).catch((err) => {
event.sender.send("loginError")
logger.error(err)
showNotification("Erreur de connexion")
})
},
(update) => { (update) => {
switch (update.type) { switch (update.type) {
case "Rejection":
event.sender.send("loginError")
showNotification("Connexion rejetée")
logger.error("Fetch rejected!", update.data);
break;
case "Error": case "Error":
event.sender.send("loginError") event.sender.send("loginError")
showNotification("Une erreur est survenue", update.data) showNotification("Une erreur est survenue", update.data)
logger.error("MC-Account error:", update.data); logger.error("MC-Account error:", update.data);
break; break;
case "Cancelled":
logger.warn("Connexion annulée");
event.sender.send("loginError")
} }
}, "login") }).then(result => {
if(msmc.errorCheck(result)) {
event.sender.send("loginError")
logger.error(result.reason)
showNotification("Erreur de connexion", result.reason)
} else {
if(!msmc.isDemoUser(result)) {
this.auth = msmc.getMCLC().getAuth(result)
win.loadFile('src/client/index.html').then(() => {
event.sender.send("nick", { name: this.auth.name })
})
} else {
event.sender.send("loginError")
logger.error("[MS login] User haven't purchase the game")
showNotification("Erreur de connexion", "Vous ne possèdez pas de licence Minecraft sur ce compte")
}
}
}).catch(reason => {
event.sender.send("loginError")
logger.error(reason)
showNotification("Erreur de connexion")
})
} }
launch(event, showNotification, args) { launch(event, showNotification, args) {