diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt index 41d9e83..756f10e 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt @@ -129,6 +129,7 @@ val server = embeddedServer(Netty, port = 8080, ) { allowMethod(HttpMethod.Get) allowHost(dotenv["FRONTEND"] ?: "localhost:3000", schemes=listOf("https")) allowCredentials = true + allowNonSimpleContentTypes = true } } diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt index 13dd42f..3fbc073 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/ApiRoutes.kt @@ -43,7 +43,7 @@ data class RegisterChzzkUserDTO( ) fun Routing.apiRoutes() { - val chzzkIDRegex = """(?:.+chzzk\.naver\.com/)?([a-f0-9]{32})?(?:/live)?${'$'}""".toRegex() + val chzzkIDRegex = """(?:.+chzzk\.naver\.com/)?([a-f0-9]{32})?(?:/live)?${'$'}/.+""".toRegex() val dispatcher: CoroutinesEventBus by inject(CoroutinesEventBus::class.java) route("/") { @@ -97,10 +97,11 @@ fun Routing.apiRoutes() { if(status?.content == null) { call.respondText(user.naverId, status = HttpStatusCode.NotFound) + return@get } call.respond(HttpStatusCode.OK, GetSessionDTO( - status!!.content!!.channel.channelId, + status.content!!.channel.channelId, status.content!!.channel.channelName, status.content!!.status == "OPEN", status.content!!.channel.channelImageUrl,