mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-09-27 04:32:49 +02:00
check for viaversion.github.io, updated some auth
This commit is contained in:
parent
6038b18c9a
commit
35c90c8055
@ -63,7 +63,7 @@
|
|||||||
alert("Couldn't authenticate with Minecraft.ID: " + urlParams.get("mcauth_msg"));
|
alert("Couldn't authenticate with Minecraft.ID: " + urlParams.get("mcauth_msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var wsUrl = "wss://" + window.location.host + "/ws";
|
var wsUrl = window.location.host == "viaversion.github.io" ? prompt("VIAaaS instance WS URL") : "wss://" + window.location.host + "/ws";
|
||||||
|
|
||||||
var socket = null;
|
var socket = null;
|
||||||
var connectionStatus = document.getElementById("connection_status");
|
var connectionStatus = document.getElementById("connection_status");
|
||||||
@ -81,7 +81,7 @@
|
|||||||
username: $("#email").val(),
|
username: $("#email").val(),
|
||||||
password: $("#password").val(),
|
password: $("#password").val(),
|
||||||
clientToken: clientToken,
|
clientToken: clientToken,
|
||||||
}),
|
}),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
}).done((data) => {
|
}).done((data) => {
|
||||||
@ -284,11 +284,12 @@
|
|||||||
removeToken(parsed.token);
|
removeToken(parsed.token);
|
||||||
}
|
}
|
||||||
} else if (parsed.action == "session_hash_request") {
|
} else if (parsed.action == "session_hash_request") {
|
||||||
if (confirm("Confirm auth request sent from VIAaaS instance? info: " + event.data)) {
|
if (confirm("Allow auth impersonation from VIAaaS instance? info: " + JSON.stringify(parsed))) {
|
||||||
let accounts = getMcAccounts().filter(it => it.name.toLowerCase() == parsed.user.toLowerCase());
|
let accounts = getMcAccounts().filter(it => it.name.toLowerCase() == parsed.user.toLowerCase());
|
||||||
accounts.forEach(it => {
|
accounts.forEach(it => {
|
||||||
refreshAccountIfNeeded(it, (data) => {
|
refreshAccountIfNeeded(it, (data) => {
|
||||||
$.ajax({type: "post",
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
url: localStorage.getItem("cors-proxy") + "https://sessionserver.mojang.com/session/minecraft/join",
|
url: localStorage.getItem("cors-proxy") + "https://sessionserver.mojang.com/session/minecraft/join",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
accessToken: data.accessToken,
|
accessToken: data.accessToken,
|
||||||
@ -301,17 +302,20 @@
|
|||||||
confirmJoin(parsed.session_hash);
|
confirmJoin(parsed.session_hash);
|
||||||
}).fail((e) => {
|
}).fail((e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
alert("Failed to authenticate to Minecraft backend server!");
|
confirmJoin(parsed.session_hash);
|
||||||
|
alert("Failed to contact session server!");
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
if (confirm("Couldn't refresh " + parsed.user + " account in browser. Continue without authentication (works on LAN worlds)?")) {
|
confirmJoin(parsed.session_hash);
|
||||||
confirmJoin(parsed.session_hash);
|
alert("Couldn't refresh " + parsed.user + " account in browser.");
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (accounts.length == 0 && confirm("Couldn't find " + parsed.user + " account in browser. Continue without authentication (works on LAN worlds)?")) {
|
if (accounts.length == 0) {
|
||||||
|
alert("Couldn't find " + parsed.user + " account in browser.");
|
||||||
confirmJoin(parsed.session_hash);
|
confirmJoin(parsed.session_hash);
|
||||||
}
|
}
|
||||||
|
} else if (confirm("Continue without authentication (works on LAN worlds)?")) {
|
||||||
|
confirmJoin(parsed.session_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user