Skip to content

Commit

Permalink
Improve GQL Playground (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
Syer10 authored May 26, 2023
1 parent 945ec81 commit 04a6713
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
16 changes: 16 additions & 0 deletions server/src/main/resources/graphql-playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet"/>
<link href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.min.css" rel="stylesheet"/>
<style>
.docExplorerWrap {
width: 100% !important;
padding-bottom: 20px;
}
.docExplorerHide {
display: none;
}

/*noinspection CssUnresolvedCustomProperty*/
.doc-explorer-title {
font-weight: var(--font-weight-medium);
font-size: var(--font-size-h2);
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.doc-explorer-contents {
height: 100%;
padding-bottom: 40px;
Expand Down

0 comments on commit 04a6713

Please sign in to comment.