Skip to content

Commit

Permalink
General improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanro50 committed Jun 21, 2022
1 parent 62e3dd9 commit 650769d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msmc",
"version": "4.0.0-pre3",
"version": "4.0.0-pre4",
"description": "A bare bones login library for Minecraft based projects to authenticate individuals with a Microsoft account.",
"license": "MIT",
"exports": {
Expand Down Expand Up @@ -42,7 +42,7 @@
"@types/node": "^17.0.35",
"@types/node-fetch": "^2.6.1",
"@types/webpack": "^5.28.0",
"electron": "^18.2.4",
"electron": "^18",
"typescript": "^4.7.2"
},
"dependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export class auth extends EventEmitter {
constructor(token: MStoken)
constructor(token?: MStoken | prompt) {
super();
this.token = (!token || typeof token == "string") ? mojangAuthToken(token as prompt) : token;
if (!token)
console.warn("[MSMC]: Just a note. No prompt variable was specified. Assuming value to be 'login' to remain consistent with older releases")
this.token = (!token || typeof token == "string") ? mojangAuthToken(token as prompt || "login") : token;


}
createLink() {
return (
Expand Down Expand Up @@ -126,7 +130,7 @@ export class auth extends EventEmitter {
}

async server(port = 0) {
if (this.token.redirect.startsWith('http://localhost/')) err("error.state.invalid.redirect")
if (this.token.redirect.startsWith('http://localhost/') || this.token.redirect.startsWith('http://127.')) err("error.state.invalid.redirect")
throw "error.state.invalid"
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ switch (os.type()) {
case 'Linux':
default:
const pathsL = process.env.PATH.split(":");
const edd = ["", "-stable", "-beta", "-dev", "-g4"];
const edd = ["", "-stable", "-beta", "-dev", "-g4","-browser"];
const compatibleL = ["chromium", "google-chrome", "microsoft-edge", "vivaldi", "brave-browser", "blisk-browser", "yandex-browser", "waterfox", "firefox"]
const ffox = ["firefox", "waterfox"]
LE: {
Expand Down
4 changes: 2 additions & 2 deletions tests/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const { auth, wrapError } = require('msmc');
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow()
console.log("Testing NWJS. This should test most of the underlying code")
console.log("Testing Electron. This should test most of the underlying code")
const msmc = new auth('select_account');
msmc.on('load', console.log).luanch('electron').then(async e => {
msmc.on('load', console.log).launch('electron').then(async e => {
const t = await e.getMinecraft()
console.log(t.mclc())
const a = await t.refresh(true)
Expand Down
2 changes: 1 addition & 1 deletion tests/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^13.0.1"
"electron": "^18"
},
"dependencies": {
"msmc": "file:../../.",
Expand Down
2 changes: 1 addition & 1 deletion tests/nwjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { assets } = require("msmc");

assets.loadLexiPack("../../lexipacks/french.json")
console.log("Testing NWJS. This should test most of the underlying code")
new auth('select_account').on('load',console.log).luanch('nwjs').then(async e => {
new auth('select_account').on('load', console.log).launch('nwjs').then(async e => {
const t = await e.getMinecraft()
console.log(t.mclc())
const a = await t.refresh(true)
Expand Down

0 comments on commit 650769d

Please sign in to comment.