diff --git a/Cargo.lock b/Cargo.lock index c1bb9ec..3f51793 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3787,9 +3787,11 @@ dependencies = [ "headers", "http", "http-body-util", + "httpdate", "hyper", "hyper-util", "mime", + "mime_guess", "multer", "nix", "parking_lot", diff --git a/slingshot/Cargo.toml b/slingshot/Cargo.toml index 0e0cdfa..06a97a5 100644 --- a/slingshot/Cargo.toml +++ b/slingshot/Cargo.toml @@ -17,7 +17,7 @@ links = { path = "../links" } log = "0.4.27" metrics = "0.24.2" metrics-exporter-prometheus = { version = "0.17.1", features = ["http-listener"] } -poem = { version = "3.1.12", features = ["acme"] } +poem = { version = "3.1.12", features = ["acme", "static-files"] } poem-openapi = { version = "5.1.16", features = ["scalar"] } reqwest = { version = "0.12.22", features = ["json"] } rustls = "0.23.31" diff --git a/slingshot/src/server.rs b/slingshot/src/server.rs index 049c021..247cbe5 100644 --- a/slingshot/src/server.rs +++ b/slingshot/src/server.rs @@ -13,7 +13,7 @@ use tokio_util::sync::CancellationToken; use poem::{ Endpoint, EndpointExt, Route, Server, - endpoint::make_sync, + endpoint::{StaticFileEndpoint, make_sync}, http::Method, listener::{ Listener, TcpListener, @@ -712,8 +712,8 @@ pub async fn serve( )); let mut app = Route::new() - .nest("/", api_service.scalar()) - .nest("/openapi.json", api_service.spec_endpoint()) + .at("/", StaticFileEndpoint::new("./static/index.html")) + .nest("/openapi", api_service.spec_endpoint()) .nest("/xrpc/", api_service); if let Some(host) = host { diff --git a/slingshot/static/index.html b/slingshot/static/index.html new file mode 100644 index 0000000..38ad65f --- /dev/null +++ b/slingshot/static/index.html @@ -0,0 +1,53 @@ + + +
+ ++ TODO: thing +
+ +