This commit is contained in:
Pierce 2021-05-05 10:48:52 -07:00
parent c5a0a6c72c
commit 7a7c19af0c
2 changed files with 20 additions and 4 deletions

View file

@ -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 '{}'
}
}

View file

@ -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": {