From 7a7c19af0c8bd2f65f1a65bc11dde56c89c8a37c Mon Sep 17 00:00:00 2001 From: Pierce Date: Wed, 5 May 2021 10:48:52 -0700 Subject: [PATCH] Closes #69 --- components/authenticator.js | 22 +++++++++++++++++++--- package.json | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/authenticator.js b/components/authenticator.js index 5a3a8d2..907eca8 100644 --- a/components/authenticator.js +++ b/components/authenticator.js @@ -10,7 +10,7 @@ module.exports.getAuth = function (username, password) { client_token: uuid(), uuid: uuid(), name: username, - user_properties: JSON.stringify({}) + user_properties: '{}' } return resolve(user) @@ -42,7 +42,7 @@ module.exports.getAuth = function (username, password) { uuid: body.selectedProfile.id, name: body.selectedProfile.name, selected_profile: body.selectedProfile, - user_properties: JSON.stringify(body.user.properties || {}) + user_properties: parsePropts(body.user.properties) } resolve(userProfile) @@ -92,7 +92,7 @@ module.exports.refreshAuth = function (accessToken, clientToken, selectedProfile client_token: uuid(), uuid: body.selectedProfile.id, name: body.selectedProfile.name, - user_properties: JSON.stringify(body.user.properties || {}) + user_properties: parsePropts(body.user.properties) } resolve(userProfile) @@ -141,3 +141,19 @@ module.exports.signOut = function (username, password) { module.exports.changeApiUrl = function (url) { api_url = url } + +function parsePropts (array) { + if (array) { + const newObj = {} + for (const entry of array) { + if (newObj[entry.name]) { + newObj[entry.name].push(entry.value) + } else { + newObj[entry.name] = [entry.value] + } + } + return JSON.stringify(newObj) + } else { + return '{}' + } +} diff --git a/package.json b/package.json index 6f45508..e8a7dae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-launcher-core", - "version": "3.16.2", + "version": "3.16.3", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "main": "index.js", "dependencies": {