From 475cc0d1f540a62c0d1361e1eb650f04b8f8ca20 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Sat, 25 Jun 2022 12:08:28 -0300 Subject: [PATCH] some html, fix coroutine exception handling fixes #2055 --- .../aas/handler/MinecraftHandler.kt | 4 +- .../com/viaversion/aas/web/WebServer.kt | 4 +- src/main/resources/web/index.html | 66 ++++++++++++------- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/src/main/kotlin/com/viaversion/aas/handler/MinecraftHandler.kt b/src/main/kotlin/com/viaversion/aas/handler/MinecraftHandler.kt index 62755b0..bb15545 100644 --- a/src/main/kotlin/com/viaversion/aas/handler/MinecraftHandler.kt +++ b/src/main/kotlin/com/viaversion/aas/handler/MinecraftHandler.kt @@ -10,7 +10,7 @@ import io.netty.channel.SimpleChannelInboundHandler import io.netty.handler.proxy.ProxyConnectException import io.netty.handler.proxy.ProxyHandler import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Job +import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel import java.net.SocketAddress import java.nio.channels.ClosedChannelException @@ -22,7 +22,7 @@ class MinecraftHandler( lateinit var endRemoteAddress: SocketAddress val other: Channel? get() = if (frontEnd) data.backChannel else data.frontChannel var loggedDc = false - val coroutineScope = CoroutineScope(Job()) + val coroutineScope = CoroutineScope(SupervisorJob()) override fun channelRead0(ctx: ChannelHandlerContext, packet: Packet) { if (!ctx.channel().isActive) return diff --git a/src/main/kotlin/com/viaversion/aas/web/WebServer.kt b/src/main/kotlin/com/viaversion/aas/web/WebServer.kt index 2d87771..2b09ec5 100644 --- a/src/main/kotlin/com/viaversion/aas/web/WebServer.kt +++ b/src/main/kotlin/com/viaversion/aas/web/WebServer.kt @@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit class WebServer { val clients = ConcurrentHashMap() val jwtAlgorithm = Algorithm.HMAC256(VIAaaSConfig.jwtSecret) - val coroutineScope = CoroutineScope(Job()) + val coroutineScope = CoroutineScope(SupervisorJob()) // Minecraft account -> WebClient val listeners = Multimaps.synchronizedSetMultimap( @@ -136,7 +136,7 @@ class WebServer { } } launch { - delay(20_000) + delay(10_000) future.completeExceptionally(StacklessException("No response from browser")) } } diff --git a/src/main/resources/web/index.html b/src/main/resources/web/index.html index adf7352..ff9cb77 100644 --- a/src/main/resources/web/index.html +++ b/src/main/resources/web/index.html @@ -95,31 +95,43 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"

Listening to front-end logins from:

- - -

Connecting to backend server:

-
- - - - - + +
+ +
+
+ +
+
+ +
+
+ + +

You can also use the address generator to specify the server

@@ -155,20 +167,26 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"
-
-
+ +
-
- - - + +
+ +
+
+ +
+
+ +