From 04a671382afe70a70d9a2c63337fc7ab965b4859 Mon Sep 17 00:00:00 2001 From: Mitchell Syer Date: Fri, 26 May 2023 06:14:18 -0400 Subject: [PATCH] Improve GQL Playground (#558) --- .../graphql/controller/GraphQLController.kt | 7 +++---- .../src/main/resources/graphql-playground.html | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt index 3c0c4e03..d190746c 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt @@ -7,6 +7,7 @@ package suwayomi.tachidesk.graphql.controller +import io.javalin.http.ContentType import io.javalin.http.Context import io.javalin.websocket.WsConfig import suwayomi.tachidesk.graphql.server.TachideskGraphQLServer @@ -25,10 +26,8 @@ object GraphQLController { } fun playground(ctx: Context) { - val body = javaClass.getResourceAsStream("/graphql-playground.html")!!.bufferedReader().use { reader -> - reader.readText() - } - ctx.html(body) + ctx.contentType(ContentType.TEXT_HTML) + ctx.result(javaClass.getResourceAsStream("/graphql-playground.html")!!) } fun webSocket(ws: WsConfig) { diff --git a/server/src/main/resources/graphql-playground.html b/server/src/main/resources/graphql-playground.html index a6ba496e..f26cb14c 100644 --- a/server/src/main/resources/graphql-playground.html +++ b/server/src/main/resources/graphql-playground.html @@ -41,6 +41,22 @@