mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 12:43:17 +03:00
ForgeWrapper & Auth changes
This commit is contained in:
parent
3e276479cd
commit
6af7b10f86
7 changed files with 36 additions and 2143 deletions
|
@ -1,13 +1,13 @@
|
|||
const request = require('request')
|
||||
const uuid = require('uuid/v1')
|
||||
const uuid = require('uuid').v1
|
||||
let api_url = 'https://authserver.mojang.com'
|
||||
|
||||
module.exports.getAuth = function (username, password) {
|
||||
module.exports.getAuth = function (username, password, client_token = null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!password) {
|
||||
const user = {
|
||||
access_token: uuid(),
|
||||
client_token: uuid(),
|
||||
client_token: client_token || uuid(),
|
||||
uuid: uuid(),
|
||||
name: username,
|
||||
user_properties: '{}'
|
||||
|
@ -69,14 +69,13 @@ module.exports.validate = function (access_token, client_token) {
|
|||
})
|
||||
}
|
||||
|
||||
module.exports.refreshAuth = function (accessToken, clientToken, selectedProfile) {
|
||||
module.exports.refreshAuth = function (accessToken, clientToken) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestObject = {
|
||||
url: api_url + '/refresh',
|
||||
json: {
|
||||
accessToken: accessToken,
|
||||
clientToken: clientToken,
|
||||
selectedProfile: selectedProfile,
|
||||
requestUser: true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ class Handler {
|
|||
if (fs.existsSync(versionPath)) {
|
||||
try {
|
||||
json = JSON.parse(fs.readFileSync(versionPath))
|
||||
if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.options.fw.version)) {
|
||||
if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.options.overrides.fw.version)) {
|
||||
this.client.emit('debug', '[MCLC]: Old ForgeWrapper has generated this version JSON, re-generating')
|
||||
} else {
|
||||
// If forge is modern, add ForgeWrappers launch arguments and set forge to null so MCLC treats it as a custom json.
|
||||
|
@ -362,16 +362,16 @@ class Handler {
|
|||
// If forge is modern and above 1.12.2, we add ForgeWrapper to the libraries so MCLC includes it in the classpaths.
|
||||
if (json.inheritsFrom !== '1.12.2') {
|
||||
this.fwAddArgs()
|
||||
const fwName = `ForgeWrapper-${this.options.fw.version}.jar`
|
||||
const fwPathArr = ['io', 'github', 'zekerzhayard', 'ForgeWrapper', this.options.fw.version]
|
||||
const fwName = `ForgeWrapper-${this.options.overrides.fw.version}.jar`
|
||||
const fwPathArr = ['io', 'github', 'zekerzhayard', 'ForgeWrapper', this.options.overrides.fw.version]
|
||||
json.libraries.push({
|
||||
name: fwPathArr.join(':'),
|
||||
downloads: {
|
||||
artifact: {
|
||||
path: [...fwPathArr, fwName].join('/'),
|
||||
url: `${this.options.fw.baseUrl}${this.options.fw.version}/${fwName}`,
|
||||
sha1: this.options.fw.sh1,
|
||||
size: this.options.fw.size
|
||||
url: `${this.options.overrides.fw.baseUrl}${this.options.overrides.fw.version}/${fwName}`,
|
||||
sha1: this.options.overrides.fw.sh1,
|
||||
size: this.options.overrides.fw.size
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -20,14 +20,17 @@ class MCLCore extends EventEmitter {
|
|||
...this.options.overrides
|
||||
? this.options.overrides.url
|
||||
: undefined
|
||||
},
|
||||
fw: {
|
||||
baseUrl: 'https://github.com/ZekerZhayard/ForgeWrapper/releases/download/',
|
||||
version: '1.5.1',
|
||||
sh1: '90104e9aaa8fbedf6c3d1f6d0b90cabce080b5a9',
|
||||
size: 29892,
|
||||
...this.options.overrides
|
||||
? this.options.overrides.fw
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
this.options.fw = {
|
||||
baseUrl: 'https://github.com/ZekerZhayard/ForgeWrapper/releases/download/',
|
||||
version: '1.4.2',
|
||||
sh1: '79ff9c1530e8743450c5c3ebc6e07b535437aa6e',
|
||||
size: 22346
|
||||
}
|
||||
|
||||
this.handler = new Handler(this)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue