mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-02-10 00:41:56 +01:00
set backend username via login page
update deps
This commit is contained in:
parent
49a39eb592
commit
9b67c1468e
@ -17,7 +17,7 @@ plugins {
|
||||
id("maven-publish")
|
||||
id("com.github.ben-manes.versions") version "0.42.0"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
id("com.palantir.git-version") version "0.13.0"
|
||||
id("com.palantir.git-version") version "0.14.0"
|
||||
id("org.gradlewebtools.minify") version "1.3.0" apply false
|
||||
}
|
||||
|
||||
@ -64,9 +64,9 @@ dependencies {
|
||||
implementation("com.viaversion:viabackwards:$vbVer") { isTransitive = false }
|
||||
implementation("com.github.ViaVersion.ViaRewind:viarewind-all:$vrVer") { isTransitive = false }
|
||||
|
||||
implementation("io.netty:netty-all:4.1.74.Final")
|
||||
implementation("io.netty:netty-tcnative-boringssl-static:2.0.50.Final")
|
||||
implementation("io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.12.Final:linux-x86_64")
|
||||
implementation("io.netty:netty-all:4.1.75.Final")
|
||||
implementation("io.netty:netty-tcnative-boringssl-static:2.0.51.Final")
|
||||
implementation("io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.13.Final:linux-x86_64")
|
||||
|
||||
implementation("com.google.guava:guava:31.1-jre")
|
||||
implementation("com.velocitypowered:velocity-native:3.1.0")
|
||||
@ -101,7 +101,7 @@ dependencies {
|
||||
implementation("io.ktor:ktor-client-logging-jvm:$ktorVersion")
|
||||
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion")
|
||||
|
||||
implementation("com.auth0:java-jwt:3.18.3")
|
||||
implementation("com.auth0:java-jwt:3.19.0")
|
||||
}
|
||||
|
||||
val run: JavaExec by tasks
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -40,10 +40,6 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
private fun setupSystem() {
|
||||
// Stolen from https://github.com/VelocityPowered/Velocity/blob/dev/1.1.0/proxy/src/main/java/com/velocitypowered/proxy/Velocity.java
|
||||
if (System.getProperty("io.netty.allocator.maxOrder") == null) {
|
||||
System.setProperty("io.netty.allocator.maxOrder", "9")
|
||||
}
|
||||
// https://logging.apache.org/log4j/2.x/log4j-jul/index.html
|
||||
if (System.getProperty("java.util.logging.manager") == null) {
|
||||
System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")
|
||||
|
@ -232,6 +232,7 @@ class LoginState : ConnectionState {
|
||||
backAddress = info.backHostAndPort
|
||||
handler.data.backServerVer = info.backVersion
|
||||
frontOnline = info.frontOnline
|
||||
info.backName?.also { backName = info.backName }
|
||||
}
|
||||
if (VIAaaSConfig.forceOnlineMode) frontOnline = true
|
||||
if (frontOnline != null) {
|
||||
@ -243,7 +244,12 @@ class LoginState : ConnectionState {
|
||||
val id = callbackPlayerId.await()
|
||||
mcLogger.info("Login: ${handler.endRemoteAddress} $frontName $id")
|
||||
}
|
||||
connectBack(handler, HostAndPort.fromParts(backAddress!!.host, backAddress!!.port), State.LOGIN, extraData)
|
||||
connectBack(
|
||||
handler,
|
||||
HostAndPort.fromParts(backAddress!!.host, backAddress!!.port),
|
||||
State.LOGIN,
|
||||
extraData
|
||||
)
|
||||
loginStart.username = backName!!
|
||||
send(handler.data.backChannel!!, loginStart, true)
|
||||
} catch (e: Exception) {
|
||||
|
@ -154,7 +154,8 @@ class WebLogin : WebState {
|
||||
protocol ?: -2
|
||||
},
|
||||
backHostAndPort = HostAndPort.fromParts(obj["host"].asString, obj["port"].asInt),
|
||||
frontOnline = obj["frontOnline"].asString.toBooleanStrictOrNull()
|
||||
frontOnline = obj["frontOnline"].asString.toBooleanStrictOrNull(),
|
||||
backName = obj["backName"]?.asString
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class WebServer {
|
||||
.expireAfterWrite(30, TimeUnit.SECONDS)
|
||||
.build<UUID, CompletableFuture<AddressInfo>>(CacheLoader.from { _ -> CompletableFuture() })
|
||||
|
||||
data class AddressInfo(val backVersion: Int, val backHostAndPort: HostAndPort, var frontOnline: Boolean? = null)
|
||||
data class AddressInfo(val backVersion: Int, val backHostAndPort: HostAndPort, var frontOnline: Boolean? = null, var backName: String? = null)
|
||||
|
||||
suspend fun requestAddressInfo(frontName: String): CompletableFuture<AddressInfo> {
|
||||
var onlineId: UUID? = null
|
||||
|
@ -103,16 +103,15 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
|
||||
<p>Connecting to backend server:</p>
|
||||
<div id="connect">
|
||||
<form class="input-group">
|
||||
<input id="connect_address" type="text" class="form-control" placeholder="Address">
|
||||
<input id="connect_port" type="number" min="1" max="65535" class="form-control"
|
||||
placeholder="Port">
|
||||
<input id="connect_version" type="text" class="form-control" placeholder="Version">
|
||||
<select class="form-select" id="connect_online">
|
||||
<input id="connect_address" type="text" class="form-control" placeholder="Address:Port" aria-label="Address and Port">
|
||||
<input id="connect_version" type="text" class="form-control" placeholder="Version" aria-label="Version">
|
||||
<select class="form-select" id="connect_online" aria-label="Online Mode">
|
||||
<option value="null" selected>Front Online Mode...</option>
|
||||
<option>AUTO</option>
|
||||
<option value="true">Force online</option>
|
||||
<option value="false">Force offline (recommended for Geyser)</option>
|
||||
</select>
|
||||
<input id="connect_user" type="text" class="form-control" placeholder="Back Username" aria-label="Backend Username">
|
||||
</form>
|
||||
</div>
|
||||
<p>You can also use <a href="https://jo0001.github.io/ViaSetup/aspirin" id="viasetup_address">address
|
||||
@ -147,7 +146,7 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
|
||||
</div>
|
||||
<div id="add-account">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="login_submit_ms">Add Microsoft account</label>
|
||||
<label class="form-label" for="form_add_ms">Add Microsoft account</label>
|
||||
<form class="row" id="form_add_ms">
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-primary" id="login_submit_ms" type="submit">Login with Microsoft</button>
|
||||
@ -155,12 +154,12 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
|
||||
</form>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="email">Add Mojang account</label>
|
||||
<label class="form-label" for="form_add_mc">Add Mojang account</label>
|
||||
<form class="input-group" id="form_add_mc" action="javascript:">
|
||||
<input aria-label="Email/Username" class="form-control" id="email"
|
||||
placeholder="mc@example.com" type="text">
|
||||
<input aria-label="Password" class="form-control" id="password"
|
||||
placeholder="password" type="password">
|
||||
<input aria-label="Email/Username" class="form-control" id="mc_email"
|
||||
placeholder="Username" type="text">
|
||||
<input aria-label="Password" class="form-control" id="mc_password"
|
||||
placeholder="Password" type="password">
|
||||
<button class="btn btn-primary" id="login_submit_mc" type="submit">Login with Mojang</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -20,7 +20,6 @@ $(() => {
|
||||
let connectionStatus = document.getElementById("connection_status");
|
||||
let corsStatus = document.getElementById("cors_status");
|
||||
let listening = document.getElementById("listening");
|
||||
let actions = document.getElementById("actions");
|
||||
let accounts = document.getElementById("accounts-list");
|
||||
let cors_proxy_txt = document.getElementById("cors-proxy");
|
||||
let ws_url_txt = document.getElementById("ws-url");
|
||||
@ -50,7 +49,7 @@ $(() => {
|
||||
cors_proxy_txt.value = getCorsProxy();
|
||||
ws_url_txt.value = getWsUrl();
|
||||
|
||||
$("#form_add_mc").on("submit", () => loginMc($("#email").val(), $("#password").val()));
|
||||
$("#form_add_mc").on("submit", () => loginMc($("#mc_email").val(), $("#mc_password").val()));
|
||||
$("#form_add_ms").on("submit", () => loginMs());
|
||||
$("#form_ws_url").on("submit", () => setWsUrl($("#ws-url").val()));
|
||||
$("#form_cors_proxy").on("submit", () => setCorsProxy($("#cors-proxy").val()));
|
||||
@ -129,7 +128,7 @@ $("#listen_premium").on("click", () => {
|
||||
callbackUrl.search = "";
|
||||
callbackUrl.hash = "#username=" + encodeURIComponent(user);
|
||||
location.href = "https://api.minecraft.id/gateway/start/" + encodeURIComponent(user)
|
||||
+ "?callback=" + encodeURIComponent(callbackUrl);
|
||||
+ "?callback=" + encodeURIComponent(callbackUrl.toString());
|
||||
});
|
||||
$("#listen_offline").on("click", () => {
|
||||
let user = prompt("Offline username (case-sensitive): ", "");
|
||||
@ -248,7 +247,7 @@ function ohNo() {
|
||||
}
|
||||
})
|
||||
try {
|
||||
!BroadcastChannel
|
||||
new BroadcastChannel("test");
|
||||
} catch (e) {
|
||||
addToast("Unsupported browser", "This browser doesn't support required APIs");
|
||||
}
|
||||
@ -382,7 +381,6 @@ class McAccount {
|
||||
}
|
||||
|
||||
checkActive() {
|
||||
// todo why does this not work with MSA?
|
||||
return fetch(getCorsProxy() + "https://authserver.mojang.com/validate", {
|
||||
method: "post",
|
||||
body: JSON.stringify({
|
||||
@ -741,13 +739,15 @@ function onSocketMsg(event) {
|
||||
}
|
||||
|
||||
function handleParametersRequest(parsed) {
|
||||
let url = new URL("https://" + $("#connect_address").val());
|
||||
socket.send(JSON.stringify({
|
||||
action: "parameters_response",
|
||||
callback: parsed["callback"],
|
||||
version: $("#connect_version").val(),
|
||||
host: $("#connect_address").val(),
|
||||
port: parseInt($("#connect_port").val()) || 25565,
|
||||
frontOnline: $("#connect_online").val()
|
||||
host: url.hostname,
|
||||
port: parseInt(url.port || 25565),
|
||||
frontOnline: $("#connect_online").val(),
|
||||
backName: $("#connect_user").val() || undefined
|
||||
}));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user