update via

This commit is contained in:
creeper123123321 2020-10-30 21:09:24 -03:00
parent 3fd93699e4
commit 2ead4ba5c1
4 changed files with 27 additions and 15 deletions

View File

@ -24,10 +24,9 @@ repositories {
}
dependencies {
implementation("us.myles:viaversion:3.1.1")
implementation("nl.matsv:viabackwards-all:3.1.1")
implementation("de.gerrygames:viarewind-all:1.5.1")
implementation("net.md-5:bungeecord-chat:1.16-R0.3")
implementation("us.myles:viaversion:3.2.0-1.16.4-rc1")
implementation("nl.matsv:viabackwards-all:3.2.0-SNAPSHOT")
implementation("de.gerrygames:viarewind-all:1.5.2-SNAPSHOT")
implementation("io.netty:netty-all:4.1.53.Final")
implementation("org.apache.logging.log4j:log4j-core:2.13.3")

View File

@ -35,7 +35,7 @@ import java.util.concurrent.Future
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
object CloudBackwards: ViaBackwardsPlatform {
object CloudBackwards : ViaBackwardsPlatform {
val log = LoggerWrapper(LoggerFactory.getLogger("ViaBackwards"))
override fun getDataFolder() = File("config/viabackwards")
override fun getLogger(): Logger = log
@ -43,7 +43,7 @@ object CloudBackwards: ViaBackwardsPlatform {
}
}
object CloudRewind: ViaRewindPlatform {
object CloudRewind : ViaRewindPlatform {
val log = LoggerWrapper(LoggerFactory.getLogger("ViaRewind"))
override fun getLogger(): Logger = log
}
@ -104,6 +104,11 @@ object CloudPlatform : ViaPlatform<Unit> {
val connMan = ViaConnectionManager()
val executor = Executors.newCachedThreadPool(ThreadFactoryBuilder().setNameFormat("VIAaaS").setDaemon(true).build())
val eventLoop = DefaultEventLoop(executor)
init {
eventLoop.execute(initFuture::join)
}
override fun sendMessage(p0: UUID, p1: String) {
// todo
}
@ -129,9 +134,7 @@ object CloudPlatform : ViaPlatform<Unit> {
}
override fun isPluginEnabled(): Boolean = true
override fun getConfigurationProvider(): ConfigurationProvider {
TODO("Not yet implemented")
}
override fun getConfigurationProvider(): ConfigurationProvider = CloudConfig
override fun getPlatformName(): String = "VIAaaS"
override fun getPluginVersion(): String = VersionInfo.VERSION

View File

@ -26,9 +26,10 @@ import java.io.File
import java.net.InetAddress
import java.security.KeyPairGenerator
import java.util.*
import java.util.concurrent.CompletableFuture
var runningServer = true
var viaaasLogger = LoggerFactory.getLogger("VIAaaS")
val viaaasLogger = LoggerFactory.getLogger("VIAaaS")
val httpClient = HttpClient {
defaultRequest {
@ -39,6 +40,8 @@ val httpClient = HttpClient {
}
}
val initFuture = CompletableFuture<Unit>()
// Minecraft doesn't have forward secrecy
val mcCryptoKey = KeyPairGenerator.getInstance("RSA").let {
it.initialize(4096) // https://stackoverflow.com/questions/1904516/is-1024-bit-rsa-secure
@ -69,15 +72,23 @@ fun main(args: Array<String>) {
.childOption(ChannelOption.IP_TOS, 0x18)
.childOption(ChannelOption.TCP_NODELAY, true)
.bind(InetAddress.getByName(VIAaaSConfig.bindAddress), VIAaaSConfig.port)
viaaasLogger.info("Binded minecraft into " + future.sync().channel().localAddress())
val ktorServer = embeddedServer(Netty, commandLineEnvironment(args)) {}.start(false)
var ktorServer: NettyApplicationEngine? = null
try {
viaaasLogger.info("Binded minecraft into " + future.sync().channel().localAddress())
ktorServer = embeddedServer(Netty, commandLineEnvironment(args)) {}.start(false)
} catch (e: Exception) {
runningServer = false
e.printStackTrace()
}
initFuture.complete(Unit)
while (runningServer) {
VIAaaSConsole().start()
}
ktorServer.stop(1000, 1000)
ktorServer?.stop(1000, 1000)
httpClient.close()
listOf<Future<*>>(future.channel().close(), boss.shutdownGracefully(), worker.shutdownGracefully())
.forEach { it.sync() }

View File

@ -16,7 +16,6 @@ WIP TODO - authenticate to backend server via browser, proxy the Mojang Login AP
<script>
let urlParams = new URLSearchParams();
window.location.search.split("?").map(it => new URLSearchParams(it).forEach((a, b) => urlParams.append(b, a)));
history.replaceState(null, null, "auth.html");
var username = urlParams.get("username");
var mcauth_code = urlParams.get("mcauth_code");
if (urlParams.get("mcauth_success") == "false") {
@ -105,4 +104,4 @@ WIP TODO - authenticate to backend server via browser, proxy the Mojang Login AP
connect();
</script>
</body>
</html>
</html>