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 155e6e0..4d0d446 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 @@ -20,7 +20,6 @@ import io.ktor.server.sessions.* import io.ktor.server.websocket.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json -import space.mori.chzzk_bot.common.dotenv import space.mori.chzzk_bot.webserver.routes.* import java.time.Duration @@ -48,8 +47,13 @@ val server = embeddedServer(Netty, port = 8080, ) { }) } install(CORS) { - anyHost() - allowHeader(HttpHeaders.ContentType) + allowMethod(HttpMethod.Options) + allowMethod(HttpMethod.Put) + allowMethod(HttpMethod.Patch) + allowMethod(HttpMethod.Delete) + allowMethod(HttpMethod.Get) + allowHost("http://localhost:8080") + allowHost(dotenv["FRONTEND"]) } install(Sessions) { cookie("user_session", storage = SessionStorageMemory()) {} diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/WSSongListRoutes.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/WSSongListRoutes.kt index 06aedd7..b2c063f 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/WSSongListRoutes.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/routes/WSSongListRoutes.kt @@ -13,7 +13,6 @@ import kotlinx.serialization.json.Json import org.koin.java.KoinJavaComponent.inject import org.slf4j.LoggerFactory import space.mori.chzzk_bot.common.events.* -import space.mori.chzzk_bot.common.models.Counters.withDefinition import space.mori.chzzk_bot.common.services.SongConfigService import space.mori.chzzk_bot.common.services.SongListService import space.mori.chzzk_bot.common.services.UserService