Skip to content

Commit

Permalink
use altair. maybe?
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Jan 6, 2025
1 parent bba616a commit c17752a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
29 changes: 27 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ arc-swap = "1.7.1"
argh = "0.1.13"
argon2 = { version = "0.5.3", features = ["std"] }
async-graphql = { version = "7.0.13", default-features = false, features = [
"graphiql",
"altair",
"tempfile",
"time",
"tracing",
Expand Down
14 changes: 11 additions & 3 deletions kitsune/src/http/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use self::{mutation::RootMutation, query::RootQuery};
use super::extractor::{AuthExtractor, UserData};
use crate::state::Zustand;
use async_graphql::{
extensions::Tracing, http::GraphiQLSource, Context, EmptySubscription, Error, Result, Schema,
extensions::Tracing,
http::{AltairConfigOptions, AltairSource, AltairWindowOptions},
Context, EmptySubscription, Error, Result, Schema,
};
use async_graphql_axum::{GraphQLBatchRequest, GraphQLResponse};
use axum::{debug_handler, response::Html, Extension};
Expand Down Expand Up @@ -45,9 +47,15 @@ pub async fn graphql(

#[allow(clippy::unused_async)]
pub async fn explorer() -> Html<String> {
let source = GraphiQLSource::build()
.endpoint("/graphql")
let source = AltairSource::build()
.title(concat!(env!("CARGO_PKG_NAME"), " - GraphiQL"))
.options(AltairConfigOptions {
window_options: Some(AltairWindowOptions {
endpoint_url: Some("/graphql".into()),
..AltairWindowOptions::default()
}),
..AltairConfigOptions::default()
})
.finish();

Html(source)
Expand Down

0 comments on commit c17752a

Please sign in to comment.