diff --git a/gradle.properties b/gradle.properties index 1edc6c9..ce79d6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -ktor_version=2.0.1 -kotlin_version=1.6.20 -logback_version=1.2.11 -kotlinx_html_version=0.7.5 -shadowjar_version=7.1.2 +ktor_version=2.2.4 +kotlin_version=1.8.20 +logback_version=1.4.6 +kotlinx_html_version=0.8.0 +shadowjar_version=8.1.1 kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 92f06b5..3796d3c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/de/pheerai/buzzer/Application.kt b/src/main/kotlin/de/pheerai/buzzer/Application.kt index c48ab2b..4c1f589 100644 --- a/src/main/kotlin/de/pheerai/buzzer/Application.kt +++ b/src/main/kotlin/de/pheerai/buzzer/Application.kt @@ -2,12 +2,15 @@ package de.pheerai.buzzer import de.pheerai.buzzer.routing.configureRoutes import de.pheerai.buzzer.setup.setupPlugins +import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* fun main() { - embeddedServer(Netty, port = 8888, host = "0.0.0.0") { - setupPlugins() - configureRoutes() - }.start(wait = true) + embeddedServer(Netty, port = 8888, host = "0.0.0.0", module = Application::myApplicationModule).start(wait = true) +} + +fun Application.myApplicationModule() { + setupPlugins() + configureRoutes() } diff --git a/src/main/kotlin/de/pheerai/buzzer/alpine/attributes.kt b/src/main/kotlin/de/pheerai/buzzer/alpine/Attributes.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/alpine/attributes.kt rename to src/main/kotlin/de/pheerai/buzzer/alpine/Attributes.kt diff --git a/src/main/kotlin/de/pheerai/buzzer/alpine/template.kt b/src/main/kotlin/de/pheerai/buzzer/alpine/Template.kt similarity index 88% rename from src/main/kotlin/de/pheerai/buzzer/alpine/template.kt rename to src/main/kotlin/de/pheerai/buzzer/alpine/Template.kt index 6440878..74607fc 100644 --- a/src/main/kotlin/de/pheerai/buzzer/alpine/template.kt +++ b/src/main/kotlin/de/pheerai/buzzer/alpine/Template.kt @@ -10,5 +10,6 @@ open class TEMPLATE( @HtmlTagMarker inline fun FlowContent.template(classes: String? = null, crossinline block: TEMPLATE.() -> Unit = {}): Unit = TEMPLATE( - attributesMapOf("class", classes), consumer + attributesMapOf("class", classes), + consumer, ).visit(block) diff --git a/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt b/src/main/kotlin/de/pheerai/buzzer/clients/GameMasterClient.kt similarity index 94% rename from src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt rename to src/main/kotlin/de/pheerai/buzzer/clients/GameMasterClient.kt index 238a8bc..31d99f4 100644 --- a/src/main/kotlin/de/pheerai/buzzer/clients/gameMasterClient.kt +++ b/src/main/kotlin/de/pheerai/buzzer/clients/GameMasterClient.kt @@ -10,12 +10,12 @@ fun HTML.createGameModeratorDocument() { link( href = "/assets/colors.css", rel = "stylesheet", - type = "text/css" + type = "text/css", ) link( href = "/assets/gamemoderator.css", rel = "stylesheet", - type = "text/css" + type = "text/css", ) script { src = "https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" @@ -37,7 +37,7 @@ fun HTML.createGameModeratorDocument() { receivedNames.push(ev.data) }); } - """.trimIndent() + """.trimIndent(), ) xEffect( //language=JavaScript @@ -47,7 +47,7 @@ fun HTML.createGameModeratorDocument() { } else { Alpine.data.buzzerWebSocket.send("CLEAR:"); } - """.trimIndent() + """.trimIndent(), ) div(classes = "parent") { div(classes = "player") { @@ -73,7 +73,7 @@ fun HTML.createGameModeratorDocument() { clicked = true setTimeout(() => {clicked = false}, 50) } - """.trimIndent() + """.trimIndent(), ) xOn("mousedown", "clicked = true") xOn("touchstart", "clicked = true") diff --git a/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt b/src/main/kotlin/de/pheerai/buzzer/clients/PlayerClient.kt similarity index 95% rename from src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt rename to src/main/kotlin/de/pheerai/buzzer/clients/PlayerClient.kt index 483832e..f4dff30 100644 --- a/src/main/kotlin/de/pheerai/buzzer/clients/playerClient.kt +++ b/src/main/kotlin/de/pheerai/buzzer/clients/PlayerClient.kt @@ -10,12 +10,12 @@ fun HTML.createPlayerDocument() { link( href = "/assets/colors.css", rel = "stylesheet", - type = "text/css" + type = "text/css", ) link( href = "/assets/player.css", rel = "stylesheet", - type = "text/css" + type = "text/css", ) script { src = "https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" @@ -48,7 +48,7 @@ fun HTML.createPlayerDocument() { } }); } - """.trimIndent() + """.trimIndent(), ) div(classes = "input") { label { +"Player" } @@ -78,7 +78,7 @@ fun HTML.createPlayerDocument() { clicked = false }, 50) } - """.trimMargin() + """.trimMargin(), ) xOn("mousedown", "clicked = true") xOn("touchstart", "clicked = true") diff --git a/src/main/kotlin/de/pheerai/buzzer/data/InlineClasses.kt b/src/main/kotlin/de/pheerai/buzzer/data/InlineClasses.kt index 2ea4a42..fddfef2 100644 --- a/src/main/kotlin/de/pheerai/buzzer/data/InlineClasses.kt +++ b/src/main/kotlin/de/pheerai/buzzer/data/InlineClasses.kt @@ -4,5 +4,6 @@ import io.ktor.websocket.* @JvmInline value class PlayerSocket(val session: WebSocketSession) + @JvmInline value class GameModeratorSocket(val session: WebSocketSession) diff --git a/src/main/kotlin/de/pheerai/buzzer/handlers/handleGameMasterSocket.kt b/src/main/kotlin/de/pheerai/buzzer/handlers/HandleGameMasterSocket.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/handlers/handleGameMasterSocket.kt rename to src/main/kotlin/de/pheerai/buzzer/handlers/HandleGameMasterSocket.kt diff --git a/src/main/kotlin/de/pheerai/buzzer/handlers/handlePlayerSocket.kt b/src/main/kotlin/de/pheerai/buzzer/handlers/HandlePlayerSocket.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/handlers/handlePlayerSocket.kt rename to src/main/kotlin/de/pheerai/buzzer/handlers/HandlePlayerSocket.kt diff --git a/src/main/kotlin/de/pheerai/buzzer/routing/setupRoutes.kt b/src/main/kotlin/de/pheerai/buzzer/routing/SetupRoutes.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/routing/setupRoutes.kt rename to src/main/kotlin/de/pheerai/buzzer/routing/SetupRoutes.kt diff --git a/src/main/kotlin/de/pheerai/buzzer/setup/setupPlugins.kt b/src/main/kotlin/de/pheerai/buzzer/setup/SetupPlugins.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/setup/setupPlugins.kt rename to src/main/kotlin/de/pheerai/buzzer/setup/SetupPlugins.kt diff --git a/src/main/kotlin/de/pheerai/buzzer/setup/webSockets.kt b/src/main/kotlin/de/pheerai/buzzer/setup/WebSockets.kt similarity index 100% rename from src/main/kotlin/de/pheerai/buzzer/setup/webSockets.kt rename to src/main/kotlin/de/pheerai/buzzer/setup/WebSockets.kt diff --git a/src/main/kotlin/module-info.java b/src/main/kotlin/module-info.java index 69ba8ab..4e9980a 100644 --- a/src/main/kotlin/module-info.java +++ b/src/main/kotlin/module-info.java @@ -7,4 +7,6 @@ module buzzer { requires io.ktor.server.core; requires io.ktor.server.websockets; requires io.ktor.server.html.builder; + requires io.ktor.server.host.common; + requires io.ktor.server.netty; }