diff --git a/package-lock.json b/package-lock.json index 25d9340..eaf44cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3386,9 +3386,9 @@ "dev": true }, "minecraft-launcher-core": { - "version": "3.16.6", - "resolved": "https://registry.npmjs.org/minecraft-launcher-core/-/minecraft-launcher-core-3.16.6.tgz", - "integrity": "sha512-AQ9t3Gb86c8ju37ZSkhfHqxJQ6rv1I9mnxgrALqawpC0IuelykUF7So9k2QUzoD+sbwRxXMgllj9YymNkreL4A==", + "version": "3.16.8", + "resolved": "https://registry.npmjs.org/minecraft-launcher-core/-/minecraft-launcher-core-3.16.8.tgz", + "integrity": "sha512-0amflttrl/Ad+Q7DSPXbWYRdUdTCquZB+H/K/JbU6ZAx4VwfjSa08ancEYDktAlEBUwswzhiEpkf+Xgs0PWWng==", "requires": { "adm-zip": "^0.4.13", "checksum": "^0.1.1", @@ -3460,9 +3460,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "msmc": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/msmc/-/msmc-2.1.3.tgz", - "integrity": "sha512-g2X/VbdarLfT76reSKGgBKmnllliZnEx2KSxBTt53Y/BWek3WD6e1WfsYb3AOpNV34O9FEO2kbgelUb9FLmviQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/msmc/-/msmc-2.2.0.tgz", + "integrity": "sha512-nUvxPXpy/tnVcLbx4zUyEn88bAvWVJhhYNavnGVd4cebGMgiRv0SAxVE5pVMJAr5mtAqb9klxqZPNurIfvYdcg==", "requires": { "node-fetch": "^2.6.1" } @@ -3944,9 +3944,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-type": { diff --git a/package.json b/package.json index 6974a30..0878d2c 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "electron-squirrel-startup": "^1.0.0", "extract-zip": "^2.0.1", "hasha": "^5.2.2", - "minecraft-launcher-core": "^3.16.6", - "msmc": "^2.1.3" + "minecraft-launcher-core": "^3.16.7", + "msmc": "^2.2.0" }, "config": { "forge": "./config.forge.js" diff --git a/src/client/index.html b/src/client/index.html index 1ef3b2c..8b5f349 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -2,7 +2,7 @@ - Launcher Projet Secret + Altarik Launcher diff --git a/src/client/login.html b/src/client/login.html index 902bd22..50f4247 100644 --- a/src/client/login.html +++ b/src/client/login.html @@ -2,7 +2,7 @@ - Launcher Projet Secret + Altarik Launcher diff --git a/src/server/main.js b/src/server/main.js index 02cd20d..393fb01 100644 --- a/src/server/main.js +++ b/src/server/main.js @@ -80,7 +80,7 @@ ipcMain.on("launch", (event, args) => { }) 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) => { diff --git a/src/server/minecraft.js b/src/server/minecraft.js index 051d7ec..c9464d6 100644 --- a/src/server/minecraft.js +++ b/src/server/minecraft.js @@ -30,7 +30,7 @@ class Minecraft { }) }).catch((err) => { event.sender.send("loginError") - logger.error(err) + logger.error("[MJ login] User haven't purchase the game") showNotification("Erreur de connexion") }) } else { @@ -42,36 +42,37 @@ class Minecraft { * Used to login through a Microsoft account */ microsoftLogin(event, win, showNotification) { - msmc.getElectron().FastLaunch( - (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) => { + msmc.fastLaunch("electron", + (update) => { + switch (update.type) { + case "Error": event.sender.send("loginError") - logger.error(err) - showNotification("Erreur de connexion") - }) - }, - (update) => { - switch (update.type) { - case "Rejection": - event.sender.send("loginError") - showNotification("Connexion rejetée") - logger.error("Fetch rejected!", update.data); - break; - case "Error": - event.sender.send("loginError") - showNotification("Une erreur est survenue", update.data) - logger.error("MC-Account error:", update.data); - break; - case "Cancelled": - logger.warn("Connexion annulée"); - event.sender.send("loginError") - } - }, "login") + showNotification("Une erreur est survenue", update.data) + logger.error("MC-Account error:", update.data); + break; + } + }).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) {