mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-05 21:23:59 +03:00
Added launch hooks needed by Microsoft authentication (#77)
* Added launch hooks needed by Microsoft authentication Added a meta field to the interface IUser that implements a new interface called IMeta IMeta contains information about if the account is a mojang or microsoft account. It also contains information stating if a set account is a demo account (I just thought it could be useful) I also added checks to components/handler.js to use the new field. If the field is absent, a filler value will be used that will make mclc behave as it did before this change. * Moved the meta field inline Just a typescript change for better consistency with the rest of the type files. * Update index.d.ts Properly managed to debug the vanilla launcher and fixed this oversight It marks it with xbox as the type in the vanilla launcher's files, but the real arg pushed is msa.
This commit is contained in:
parent
335c5df755
commit
3e276479cd
2 changed files with 12 additions and 2 deletions
|
@ -551,14 +551,14 @@ class Handler {
|
|||
if (args.length < minArgs) args = args.concat(this.version.minecraftArguments ? this.version.minecraftArguments.split(' ') : this.version.arguments.game)
|
||||
|
||||
this.options.authorization = await Promise.resolve(this.options.authorization)
|
||||
|
||||
this.options.authorization.meta = this.options.authorization.meta ? this.options.authorization.meta : { type: 'mojang' }
|
||||
const fields = {
|
||||
'${auth_access_token}': this.options.authorization.access_token,
|
||||
'${auth_session}': this.options.authorization.access_token,
|
||||
'${auth_player_name}': this.options.authorization.name,
|
||||
'${auth_uuid}': this.options.authorization.uuid,
|
||||
'${user_properties}': this.options.authorization.user_properties,
|
||||
'${user_type}': 'mojang',
|
||||
'${user_type}': this.options.authorization.meta.type,
|
||||
'${version_name}': this.options.version.number,
|
||||
'${assets_index_name}': this.version.assetIndex.id,
|
||||
'${game_directory}': this.options.overrides.gameDirectory || this.options.root,
|
||||
|
@ -567,6 +567,10 @@ class Handler {
|
|||
'${version_type}': this.options.version.type
|
||||
}
|
||||
|
||||
if (this.options.authorization.meta.demo) {
|
||||
args.push('--demo')
|
||||
}
|
||||
|
||||
for (let index = 0; index < args.length; index++) {
|
||||
if (typeof args[index] === 'object') args.splice(index, 2)
|
||||
if (Object.keys(fields).includes(args[index])) {
|
||||
|
|
6
index.d.ts
vendored
6
index.d.ts
vendored
|
@ -143,12 +143,18 @@ declare module "minecraft-launcher-core" {
|
|||
authorization: Promise<IUser>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface IUser {
|
||||
access_token: string;
|
||||
client_token: string;
|
||||
uuid: string;
|
||||
name: string;
|
||||
user_properties: Partial<any>;
|
||||
meta?: {
|
||||
type: "mojang" | "msa",
|
||||
demo?: boolean
|
||||
};
|
||||
}
|
||||
|
||||
interface IProfile {
|
||||
|
|
Loading…
Reference in a new issue