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 433b64d6..3c0c4e03 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/controller/GraphQLController.kt @@ -25,18 +25,10 @@ object GraphQLController { } fun playground(ctx: Context) { - val playgroundHtml = javaClass.getResource("/graphql-playground.html") - - val body = playgroundHtml.openStream().bufferedReader().use { reader -> - val graphQLEndpoint = "graphql" - val subscriptionsEndpoint = "graphql" - + val body = javaClass.getResourceAsStream("/graphql-playground.html")!!.bufferedReader().use { reader -> reader.readText() - .replace("\${graphQLEndpoint}", graphQLEndpoint) - .replace("\${subscriptionsEndpoint}", subscriptionsEndpoint) } - - ctx.html(body ?: "Could not load playground") + ctx.html(body) } fun webSocket(ws: WsConfig) { diff --git a/server/src/main/resources/graphql-playground.html b/server/src/main/resources/graphql-playground.html index 894ff66f..76407218 100644 --- a/server/src/main/resources/graphql-playground.html +++ b/server/src/main/resources/graphql-playground.html @@ -1,60 +1,84 @@ - - + - - - GraphQL Playground - - - + GraphiQL + + + + + + + + + -
- - -
Loading - GraphQL Playground -
-
- + ReactDOM.render( + React.createElement(GraphiQLWithExplorer), + document.getElementById('graphiql'), + ); + -