diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4201363 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "cSpell.words": [ + "Expt", + "Lexi", + "lexipacks", + "mcjs", + "MCJWT", + "mclc", + "mojang", + "nwjs", + "rlogin", + "rxboxlive", + "rxsts", + "signin", + "xsts", + "xuid", + "yuid" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 6ee0481..c4db17b 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ At the moment you can get support via Discord (link above). ```js import { Client } from "minecraft-launcher-core"; const launcher = new Client(); -//Import the auth class -import { auth } from "msmc"; -//Create a new auth manager -const authManager = new auth("select_account"); +//Import the Auth class +import { Auth } from "msmc"; +//Create a new Auth manager +const authManager = new Auth("select_account"); //Launch using the 'raw' gui framework (can be 'electron' or 'nwjs') const xboxManager = await authManager.launch("raw") -//Generate the minecraft login token +//Generate the Minecraft login token const token = await xboxManager.getMinecraft(); // Pulled from the Minecraft Launcher core docs. let opts = { @@ -51,18 +51,18 @@ launcher.on('data', (e) => console.log(e)); ```js const { Client } = require("minecraft-launcher-core"); const launcher = new Client(); -//Import the auth class -const { auth } = require("msmc"); -//Create a new auth manager -const authManager = new auth("select_account"); +//Import the Auth class +const { Auth } = require("msmc"); +//Create a new Auth manager +const authManager = new Auth("select_account"); //Launch using the 'raw' gui framework (can be 'electron' or 'nwjs') authManager.launch("raw").then(async xboxManager => { - //Generate the minecraft login token + //Generate the Minecraft login token const token = await xboxManager.getMinecraft(); // Pulled from the Minecraft Launcher core docs. let opts = { clientPackage: null, - // Simply call this function to convert the msmc minecraft object into a mclc authorization object + // Simply call this function to convert the msmc Minecraft object into a mclc authorization object authorization: token.mclc(), root: "./.minecraft", version: { @@ -85,15 +85,15 @@ authManager.launch("raw").then(async xboxManager => { ```js const gmll = require("gmll"); -//Import the auth class -const { auth } = require("msmc"); +//Import the Auth class +const { Auth } = require("msmc"); gmll.init().then(async () => { - //Create a new auth manager - const authManager = new auth("select_account"); + //Create a new Auth manager + const authManager = new Auth("select_account"); //Launch using the 'raw' gui framework (can be 'electron' or 'nwjs') const xboxManager = await authManager.launch("raw") - //Generate the minecraft login token + //Generate the Minecraft login token const token = await xboxManager.getMinecraft() var int = new gmll.instance() @@ -104,15 +104,15 @@ gmll.init().then(async () => { ## A basic ES6 example with [GMLL](https://github.com/Hanro50/GMLL) ```js import { init, instance } from "gmll"; -//Import the auth class -import { auth } from "msmc"; +//Import the Auth class +import { Auth } from "msmc"; await init() -//Create a new auth manager -const authManager = new auth("select_account"); +//Create a new Auth manager +const authManager = new Auth("select_account"); //Launch using the 'raw' gui framework (can be 'electron' or 'nwjs') const xboxManager = await authManager.launch("raw") -//Generate the minecraft login token +//Generate the Minecraft login token const token = await xboxManager.getMinecraft() var int = new instance() @@ -121,18 +121,18 @@ int.launch(token.gmll()); ``` # Modules -## auth +## Auth This module is the starting point of msmc. It will be the first msmc object you create. It is also the object that'll handle all of msmc's events for you. Mainly the load event. ```ts -class auth extends EventEmitter { +class Auth extends EventEmitter { token: MStoken; constructor(prompt?: prompt); constructor(token: MStoken); createLink(): string; - login(code: string): Promise; - refresh(MS: msAuthToken): Promise; - refresh(refreshToken: string): Promise; - launch(framework: framework, windowProperties?: windowProperties): Promise; + login(code: string): Promise; + refresh(MS: msAuthToken): Promise; + refresh(refreshToken: string): Promise; + launch(framework: framework, windowProperties?: windowProperties): Promise; server(port?: number): Promise; on(event: "load", listener: (asset: lexcodes, message: string) => void): this; @@ -140,7 +140,7 @@ class auth extends EventEmitter { } ``` >### `constructor(prompt?: prompt)` -This version of the constructor will generate an auth object with the vanilla Minecraft launcher token. The prompt variable is a string that provides the prompt field in the vanilla token as that is not provided by default. +This version of the constructor will generate an Auth object with the vanilla Minecraft launcher token. The prompt variable is a string that provides the prompt field in the vanilla token as that is not provided by default. ```ts type prompt = "login" | "none" | "consent" | "select_account"; @@ -165,12 +165,12 @@ Resources: 3) https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps >### `createLink(): string` \ Creates a login link using the given Token. Can be used if you're forgoing msmc's default gui based login flow for something custom. In essence you should use this link as a redirect, then capture the returning code url-parameter and feed it into the login function ->### `login(code: string): Promise` \ -The low level login function msmc uses. The returning promise is for the next stage in the login chain. Mainly the xbox module. I'd refer you to the next module to learn more! +>### `login(code: string): Promise` \ +The low level login function msmc uses. The returning promise is for the next stage in the login chain. Mainly the Xbox module. I'd refer you to the next module to learn more! -returns an instance of the [xbox](#xbox) module or throws an error ->### `refresh(MS: msAuthToken): Promise` -The low level refresh function msmc uses. This will attempt to refresh the Microsoft token at the core of msmc and return an xbox object as a result. Please see the msToken variable under the xbox module. +returns an instance of the [Xbox](#Xbox) module or throws an error +>### `refresh(MS: msAuthToken): Promise` +The low level refresh function msmc uses. This will attempt to refresh the Microsoft token at the core of msmc and return an Xbox object as a result. Please see the msToken variable under the Xbox module. ```ts interface msAuthToken { token_type: string, @@ -184,14 +184,14 @@ interface msAuthToken { ``` The 'refresh_token' and the 'access_token' are the only two fields of note to this project. -returns an instance of the [xbox](#xbox) module or throws an error +returns an instance of the [Xbox](#Xbox) module or throws an error ->### `refresh(refreshToken: string): Promise` -Refreshes a user solely based on the refresh token of a set user's refresh_token. See the [save](#save-string) function in the [xbox](#xbox) for more information. +>### `refresh(refreshToken: string): Promise` +Refreshes a user solely based on the refresh token of a set user's refresh_token. See the [save](#save-string) function in the [Xbox](#Xbox) for more information. -returns an instance of the [xbox](#xbox) module or throws an error +returns an instance of the [Xbox](#Xbox) module or throws an error ->### ` launch(framework: framework, windowProperties?: windowProperties): Promise` +>### ` launch(framework: framework, windowProperties?: windowProperties): Promise` Launches a pop-up window prompting the user to login to their Microsoft account. ```ts type framework = "electron" | "nwjs" | "raw"; @@ -211,42 +211,42 @@ interface windowProperties { ``` This is the properties msmc passes through to the function of a set framework that spawns a pop-up. For more information of which properties are available depending on your preferred GUI framework of choice. Click here for nwjs and here for electron. The raw framework only uses the properties "width","height" and "suppress" -returns an instance of the [xbox](#xbox) module or throws an error +returns an instance of the [Xbox](#Xbox) module or throws an error > ### `server(port?: number): Promise` \ WIP, not implemented yet -returns an instance of the [xbox](#xbox) module or throws an error +returns an instance of the [Xbox](#Xbox) module or throws an error > ### `on(event: "load", listener: (asset: lexcodes, message: string) => void): this` Event handler. Fires on a load event. Can be used for loading indicators similar to the update function in previous versions on msmc. > ### `once(event: "load", listener: (asset: lexcodes, message: string) => void): this` The same as the "on" function, but only fires once.
-## xbox +## Xbox The second stage of the authentication phase. In this phase the user has been logged in with their Microsoft account, but they haven't been logged into Minecraft nor have they been authenticated to the degree needed to access social features yet. This being said, you now potentially have the ability to do both if you have made it this far. -Please see [auth](#auth) module for more information on how to spawn this object +Please see [Auth](#Auth) module for more information on how to spawn this object ```ts -class xbox { - readonly parent: auth; +class Xbox { + readonly parent: Auth; readonly msToken: msAuthToken; readonly xblToken: xblAuthToken; readonly exp: number; xAuth(RelyingParty?: string): Promise; refresh(force?: boolean): Promise; - getSocial(): Promise; - getMinecraft(): Promise; + getSocial(): Promise; + getMinecraft(): Promise; validate(): boolean; save(): string; } ``` > ### properties \ ```ts -parent: auth; +parent: Auth; ``` -The auth object that was used to create this Xbox object. +The Auth object that was used to create this Xbox object. ```ts interface msAuthToken { token_type: string; @@ -274,7 +274,7 @@ interface xblAuthToken { xblToken: xblAuthToken; ``` -This is the token that was generated when msmc authenticated against a user's microsoft account to gain xbox live authentication access. +This is the token that was generated when msmc authenticated against a user's microsoft account to gain Xbox live authentication access. ```ts exp: number; @@ -282,28 +282,28 @@ exp: number; The time in milliseconds the provided tokens are valid till. If this date is surpassed it can be assumed the provided tokens need to be refreshed. > ### `xAuth(RelyingParty?: string): Promise` \ -Retrieves the auth header for a set replying party. In theory it could be expanded to be used with more services that work with Xbox live endpoints. Right now this is mainly an internal function that happens to be exposed +Retrieves the Auth header for a set replying party. In theory it could be expanded to be used with more services that work with Xbox live endpoints. Right now this is mainly an internal function that happens to be exposed > ### `refresh(force?: boolean): Promise` Refreshes the tokens of this Xbox object. This function should be called once per hour. This being said, msmc does check if the tokens need to be refreshed before refreshing them. The exception being when the "force" property is set to true. In that case it will force all tokens to be refreshed. -> ### `getSocial(): Promise` -Gets an instance of the [social](#social) module. Can be used to implement friend lists. -> ### `getMinecraft(): Promise` -Gets an instance of the [Minecraft](#minecraft) module. Can be used to obtain the needed information to launch Minecraft. +> ### `getSocial(): Promise` +Gets an instance of the [Social](#Social) module. Can be used to implement friend lists. +> ### `getMinecraft(): Promise` +Gets an instance of the [Minecraft](#Minecraft) module. Can be used to obtain the needed information to launch Minecraft. NB: There is an additional internal check that will be done to determine if a user got Minecraft Java edition via game pass. This is experimental at the moment so please report any issues you observe with this. It may also not function with older versions of the game just yet. > ### `validate(): boolean` -Checks if the internal tokens in this object are still valid and usable. If this returns false then it is a good idea to call the [refresh](#refreshforce-boolean-promisethis) function listed earlier (This also gets called by that funtion btw). +Checks if the internal tokens in this object are still valid and usable. If this returns false then it is a good idea to call the [refresh](#refreshforce-boolean-promisethis) function listed earlier (This also gets called by that function btw). > ### `save(): string` -Returns a token that can be fed into a [refresh](#refreshrefreshtoken-string-promisexbox) function in an instance of the auth module. Useful if you want to save the information needed to recreate a set Xbox object to file. +Returns a token that can be fed into a [refresh](#refreshrefreshtoken-string-promisexbox) function in an instance of the Auth module. Useful if you want to save the information needed to recreate a set Xbox object to file.
-## minecraft +## Minecraft The module needed to obtain the information required to launch Minecraft. ```ts -minecraft { +Minecraft { mcToken: string; profile: mcProfile; - parent: xbox; + parent: Xbox; xuid: string; entitlements(): Promise; @@ -317,7 +317,7 @@ minecraft { ```ts mcToken: string; ``` -The minecraft authentication token. This is needed to launch the game in online mode +The Minecraft authentication token. This is needed to launch the game in online mode ```ts interface mcProfile { id: string, @@ -342,9 +342,9 @@ profile: mcProfile; The raw Minecraft profile object. Do note that the skins and capes arrays may be empty. Generally this contains everything you need to launch Minecraft. ```ts -parent: xbox; +parent: Xbox; ``` -The [xbox](#xbox) object that spawned this instance of the Minecraft module. +The [Xbox](#Xbox) object that spawned this instance of the Minecraft module. ```ts xuid: string; ``` @@ -357,63 +357,63 @@ type entitlements = "game_minecraft" | "game_minecraft_bedrock" | "game_dungeons > ### `mclc(): mclcUser` Creates a Mincraft Launcher core user object. Usefull if you wish to use msmc with that library. > ### `refresh(force?: boolean): Promise` -Refreshes the minecraft and xbox tokens. Like the [refresh](#refreshforce-boolean-promisethis) function in the [xbox](#xbox) module. +Refreshes the Minecraft and Xbox tokens. Like the [refresh](#refreshforce-boolean-promisethis) function in the [Xbox](#Xbox) module. > ### `validate(): boolean` -Like the Like the [validate](#validate-boolean) function in the [xbox](#xbox) module, but just for the Minecraft token. Which remains valid for 24 hours +Like the Like the [validate](#validate-boolean) function in the [Xbox](#Xbox) module, but just for the Minecraft token. Which remains valid for 24 hours
-## social -The social module is unique. Partly because it is expected to be ran server side in some settings. This is done to allow for features such as allowing you to create screens where players may be able to see which of their friends are online and such. +## Social +The Social module is unique. Partly because it is expected to be ran server side in some settings. This is done to allow for features such as allowing you to create screens where players may be able to see which of their friends are online and such. If you have deeper access to the game, such as in the scenario where your launcher is a front end for some type of custom client. Then I foresee the possibility of even implementing a kind of "click to join" function. In the end this is merely here to serve as a bases for something substantially more complex that is beyond the scope of msmc. ```ts -class social { - auth: string; - constructor(auth: string); - getProfile(xuid?: string): Promise; - getFriends(xuid?: string): Promise; - xGet(enpoint: string, xuid?: string): Promise; +class Social { + Auth: string; + constructor(Auth: string); + getProfile(xuid?: string): Promise; + getFriends(xuid?: string): Promise; + xGet(endpoint: string, xuid?: string): Promise; } ``` -> ### `class xplayer` +> ### `class XPlayer` ```ts -class xplayer { - auth: social; +class XPlayer { + Auth: Social; score: number; xuid: string; gamerTag: string; name: string; profilePictureURL: string; - getFriends(): Promise; + getFriends(): Promise; } ``` -auth=> The instance of the [social](#social) module that spawned this xplayer object
+Auth=> The instance of the [Social](#Social) module that spawned this XPlayer object
score=> The user's player score....not sure what it does, but the endpoint provides it
-xuid=>The xbox user id of the player this instance of xplayer represents.
-gamerTag=>The gamer tag of the user this instance of xplayer represents.
-name=>The name of the user this instance of xplayer represents.
-profilePictureURL=>The profile picture url of the user this instance of xplayer represents.
-getFriends=>This function returns a list of xplayer modules that represents everyone on a give user's friend list. +xuid=>The Xbox user id of the player this instance of XPlayer represents.
+gamerTag=>The gamer tag of the user this instance of XPlayer represents.
+name=>The name of the user this instance of XPlayer represents.
+profilePictureURL=>The profile picture url of the user this instance of XPlayer represents.
+getFriends=>This function returns a list of XPlayer modules that represents everyone on a give user's friend list. -> ### `constructor(auth: string)` \ -The auth header is needed to use the underlying endpoints that make this function. To get this header, run [xAuth](#xauthrelyingparty-string-promisestring-advanced) function in the [xbox](#xbox) module. This header can potentially be sent as an authentication string for an endpoint of your launcher's back end server. +> ### `constructor(Auth: string)` \ +The Auth header is needed to use the underlying endpoints that make this function. To get this header, run [xAuth](#xauthrelyingparty-string-promisestring-advanced) function in the [Xbox](#Xbox) module. This header can potentially be sent as an authentication string for an endpoint of your launcher's back end server. -> ### `getProfile(xuid?: string): Promise` -Gets the user profile of a given user. If the xuid field is missing it will return the profile of the user the auth header belongs to. +> ### `getProfile(xuid?: string): Promise` +Gets the user profile of a given user. If the xuid field is missing it will return the profile of the user the Auth header belongs to. -> ### `getFriends(xuid?: string): Promise` -Gets the friend list of a given user. If the xuid field is missing it will return the friend list of the user the auth header belongs to. +> ### `getFriends(xuid?: string): Promise` +Gets the friend list of a given user. If the xuid field is missing it will return the friend list of the user the Auth header belongs to. -> ### `xGet(enpoint: string, xuid?: string): Promise` \ -The raw back end function used to obtain information related to a given user based on the xuid provided. If a xuid is not provided the information returned will instead be based on the profile the auth header belongs to. +> ### `xGet(endpoint: string, xuid?: string): Promise` \ +The raw back end function used to obtain information related to a given user based on the xuid provided. If a xuid is not provided the information returned will instead be based on the profile the Auth header belongs to.
## assets A collection of helper functions to aid in using msmc. > ### Languages and you -See our premade [lexipacks here](/lexipacks) and see the [loadLexiPack](#function-loadlexipackfile-string-typeof-lexicon) function for more information on how to load it. +See our premade [lexiPacks here](/lexipacks) and see the [loadLexiPack](#function-loadlexipackfile-string-typeof-lexicon) function for more information on how to load it. I've noticed that a fair amount of the people in the mcjs café discord tend to maintain launchers that by default aren't set to English. While older versions of msmc made efforts to address this. I'm happy to announce that we switched over to a solution that isn't just hacked onto existing code this time. @@ -423,22 +423,22 @@ Introducing the lexicon property. By overriding this object with your own code y ```ts export let lexicon = { //Error - "error": "An unknown error has occured", - "error.auth": "An unknown authentication error has occured", + "error": "An unknown error has occurred", + "error.auth": "An unknown authentication error has occurred", "error.auth.microsoft": "Failed to login to Microsoft account", "error.auth.xboxLive": "Failed to login to Xbox Live", - "error.auth.xsts": "Unknown error occured when attempting to optain an Xbox Live Security Token", + "error.auth.xsts": "Unknown error occurred when attempting to optain an Xbox Live Security Token", "error.auth.xsts.userNotFound": "The given Microsoft account doesn't have an Xbox account", "error.auth.xsts.bannedCountry": "The given Microsoft account is from a country where Xbox live is not available", "error.auth.xsts.child": "The account is a child (under 18) and cannot proceed unless the account is added to a Family account by an adult", "error.auth.xsts.child.SK": "South Korean law: Go to the Xbox page and grant parental rights to continue logging in.", - "error.auth.minecraft": "Unknown error occured when attempting to login to Minecraft", + "error.auth.minecraft": "Unknown error occurred when attempting to login to Minecraft", "error.auth.minecraft.login": "Failed to authenticate with Mojang with given Xbox account", "error.auth.minecraft.profile": "Failed to fetch minecraft profile", "error.auth.minecraft.entitlements": "Failed to fetch player entitlements", - "error.gui": "An unknown gui framework error has occured", + "error.gui": "An unknown gui framework error has occurred", "error.gui.closed": "Gui closed by user", "error.gui.raw.noBrowser": "no chromium browser was set, cannot continue!", @@ -452,7 +452,7 @@ export let lexicon = { "load.auth.microsoft": "Logging into Microsoft account", "load.auth.xboxLive": "Logging into Xbox Live", "load.auth.xboxLive.1": "Logging into Xbox Live", - "load.auth.xboxLive.2": "Authenticating with xbox live", + "load.auth.xboxLive.2": "Authenticating with Xbox live", "load.auth.xsts": "Generating Xbox Live Security Token", "load.auth.minecraft": "Generic Minecraft login flow event", @@ -471,12 +471,12 @@ function lst(lexcodes: lexcodes): any; This function will translate lexcodes into readable text based on the [lexicon](#lexicon) object. #### `function loadLexiPack(...file: string[]): typeof lexicon;` -Loads a set lexipack and returns it when it finishes loading it. +Loads a set lexiPack and returns it when it finishes loading it. Usage: ```js import {assets} from "msmc"; -assets.loadLexiPack(path,to,lexipack,here); +assets.loadLexiPack(path,to,lexiPack,here); ``` > ### Error handling Handling errors in msmc changed a little. Since we moved back to a throw on error model last seen when we moved to an async architecture. The issue of error typing has propped up again. If an msmc object throws an error. It will be in one of two formats. diff --git a/lexipacks/english.json b/lexipacks/english.json index fcf61a5..bc362fb 100644 --- a/lexipacks/english.json +++ b/lexipacks/english.json @@ -31,7 +31,7 @@ "load.auth.microsoft": "Logging into Microsoft account", "load.auth.xboxLive": "Logging into Xbox Live", "load.auth.xboxLive.1": "Logging into Xbox Live", - "load.auth.xboxLive.2": "Authenticating with xbox live", + "load.auth.xboxLive.2": "Authenticating with Xbox live", "load.auth.xsts": "Generating Xbox Live Security Token", "load.auth.minecraft": "Generic Minecraft login flow event", diff --git a/src/assets.ts b/src/assets.ts index 053a64b..7461583 100644 --- a/src/assets.ts +++ b/src/assets.ts @@ -1,7 +1,6 @@ import { readFileSync } from "fs"; import type { Response } from "node-fetch"; import { join } from "path"; -import { MCToken } from "./auth/minecraft"; /** * A copy of the user object mclc uses */ @@ -22,7 +21,7 @@ export type MclcUser = { }; /** - * If the exact code isn't founnd. The lexicon string is split up and shaved down till it finds a description for the code. + * If the exact code isn't found. The lexicon string is split up and shaved down till it finds a description for the code. * * For example; error.auth.microsoft will be shortend to error.auth if error.auth.microsoft isn't found */ @@ -40,7 +39,7 @@ export let lexicon = { "error.auth.minecraft": "Unknown error occurred when attempting to login to Minecraft", "error.auth.minecraft.login": "Failed to authenticate with Mojang with given Xbox account", - "error.auth.minecraft.profile": "Failed to fetch minecraft profile", + "error.auth.minecraft.profile": "Failed to fetch Minecraft profile", "error.auth.minecraft.entitlements": "Failed to fetch player entitlements", "error.gui": "An unknown gui framework error has occurred", @@ -58,7 +57,7 @@ export let lexicon = { "load.auth.microsoft": "Logging into Microsoft account", "load.auth.xboxLive": "Logging into Xbox Live", "load.auth.xboxLive.1": "Logging into Xbox Live", - "load.auth.xboxLive.2": "Authenticating with xbox live", + "load.auth.xboxLive.2": "Authenticating with Xbox live", "load.auth.xsts": "Generating Xbox Live Security Token", "load.auth.minecraft": "Generic Minecraft login flow event", diff --git a/src/auth/minecraft.ts b/src/auth/minecraft.ts index 6f12338..bef4213 100644 --- a/src/auth/minecraft.ts +++ b/src/auth/minecraft.ts @@ -37,13 +37,13 @@ export function validate(token: MCToken | Minecraft | MclcUser) { } /** - * Gets a minecraft token from a saved mcToken. - * @param auth A new instance of the auth object + * Gets a Minecraft token from a saved mcToken. + * @param auth A new instance of the Auth object * @param token The mcToken * @param refresh Set to true if we should try refreshing the token - * @returns A newly serialized minecraft Token. + * @returns A newly serialized Minecraft Token. * - * @warning The xbox object may not be restored using this method! + * @warning The Xbox object may not be restored using this method! */ export function fromToken(auth: Auth, token: MCToken): null | Minecraft; export function fromToken(auth: Auth, token: MCToken, refresh?: boolean): Promise; @@ -58,12 +58,12 @@ export function fromToken(auth: Auth, token: MCToken, refresh?: boolean): null | } /** - * Gets a minecraft token from a saved mcToken. - * @param auth A new instance of the auth object + * Gets a Minecraft token from a saved mcToken. + * @param auth A new instance of the Auth object * @param token The mcToken - * @returns A newly serialized minecraft Token. + * @returns A newly serialized Minecraft Token. * - * @warning The xbox object may not be restored using this method! + * @warning The Xbox object may not be restored using this method! */ export function fromMclcToken(auth: Auth, token: MclcUser, refresh?: boolean): null | Minecraft | Promise { return fromToken( diff --git a/src/auth/xbox.ts b/src/auth/xbox.ts index fe1ef73..092f28e 100644 --- a/src/auth/xbox.ts +++ b/src/auth/xbox.ts @@ -70,7 +70,7 @@ export default class Xbox { console.log(XSTS.DisplayClaims); return `XBL3.0 x=${XSTS.DisplayClaims.xui[0].uhs};${XSTS.Token}`; } - //infxbox + async refresh(force?: boolean) { if (this.validate() && !force) return this; let tkn = await this.parent.refresh(this.msToken); @@ -125,7 +125,7 @@ export default class Xbox { return this.exp > Date.now(); } /** - * Feed this into the refresh funtion in the auth object that generated it. + * Feed this into the refresh function in the Auth object that generated it. * @returns The refresh token */ save() { diff --git a/tests/console/package.json b/tests/console/package.json index 19119a3..a3387a5 100755 --- a/tests/console/package.json +++ b/tests/console/package.json @@ -1,5 +1,6 @@ { - "name": "launcher", + "private":true, + "name": "test-console", "version": "0.0.1", "main": "index.mjs", "devDependencies": { diff --git a/tests/electron/main.js b/tests/electron/main.js index ae81b58..e609b70 100755 --- a/tests/electron/main.js +++ b/tests/electron/main.js @@ -18,14 +18,14 @@ function createWindow() { // Open the DevTools. // mainWindow.webContents.openDevTools() } -const { auth, wrapError } = require('msmc'); +const { Auth, wrapError } = require('msmc'); // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.whenReady().then(() => { createWindow() console.log("Testing Electron. This should test most of the underlying code") - const msmc = new auth('select_account'); + const msmc = new Auth('select_account'); msmc.on('load', console.log).launch('electron').then(async e => { const t = await e.getMinecraft() console.log(t.mclc()) diff --git a/tests/electron/package.json b/tests/electron/package.json index 5ea163f..0b57b83 100755 --- a/tests/electron/package.json +++ b/tests/electron/package.json @@ -1,5 +1,6 @@ { - "name": "electron-quick-start", + "private":true, + "name": "test-console-electron", "version": "1.0.0", "description": "A minimal Electron application", "main": "main.js", diff --git a/tests/nwjs/index.js b/tests/nwjs/index.js index d09e137..276b5fc 100755 --- a/tests/nwjs/index.js +++ b/tests/nwjs/index.js @@ -1,5 +1,5 @@ const { readFileSync } = require("fs"); -const { auth, wrapError } = require("msmc"); +const { Auth, wrapError } = require("msmc"); const { assets } = require("msmc"); assets.loadLexiPack("../../lexipacks/french.json") diff --git a/tests/nwjs/package.json b/tests/nwjs/package.json index 3e375fa..63ca76f 100755 --- a/tests/nwjs/package.json +++ b/tests/nwjs/package.json @@ -1,5 +1,6 @@ { - "name": "launcher", + "private":true, + "name": "test-nwjs", "version": "0.0.1", "main": "index.html", "devDependencies": { diff --git a/tests/raw/package.json b/tests/raw/package.json index 5fc82fb..912af3e 100755 --- a/tests/raw/package.json +++ b/tests/raw/package.json @@ -1,5 +1,6 @@ { - "name": "launcher", + "private":true, + "name": "test-raw", "version": "0.0.1", "main": "index.js", "devDependencies": { diff --git a/tests/raw/test2.mjs b/tests/raw/test2.mjs index ca1703f..a13fd69 100644 --- a/tests/raw/test2.mjs +++ b/tests/raw/test2.mjs @@ -6,12 +6,12 @@ import msmc from "msmc"; const authManager = new msmc.Auth("select_account"); //Launch using the 'raw' gui framework (can be 'electron' or 'nwjs') const xboxManager = await authManager.launch("raw") -//Generate the minecraft login token +//Generate the Minecraft login token const token = await xboxManager.getMinecraft(); // Pulled from the Minecraft Launcher core docs. let opts = { clientPackage: null, - // Simply call this function to convert the msmc minecraft object into a mclc authorization object + // Simply call this function to convert the msmc Minecraft object into a mclc authorization object authorization: token.mclc(), root: "./.minecraft", version: { diff --git a/webpage/index.html b/webpage/index.html index 32fb717..8f5d52c 100755 --- a/webpage/index.html +++ b/webpage/index.html @@ -41,7 +41,7 @@

Xbox Live Integration

profiles as well as the friend-lists of a set user. You can use this to build an interactive launcher that can notify you when your user's friends are online. Custom client creators could even go a step further and potentially use - this to setup a one click join system. MSMC's social module can run independently meaning you can even + this to setup a one click join system. MSMC's Social module can run independently meaning you can even potentially run it seperately on a remote server!

Fine controll over refreshes and Logins