diff --git a/src-tauri/src/core/server/proxy.rs b/src-tauri/src/core/server/proxy.rs index 9b33d4ba55..d6056e1263 100644 --- a/src-tauri/src/core/server/proxy.rs +++ b/src-tauri/src/core/server/proxy.rs @@ -215,7 +215,14 @@ async fn proxy_request( let path = get_destination_path(original_path, &config.prefix); let method = parts.method.clone(); - let whitelisted_paths = ["/", "/openapi.json", "/favicon.ico"]; + let whitelisted_paths = [ + "/", + "/openapi.json", + "/favicon.ico", + "/docs/swagger-ui.css", + "/docs/swagger-ui-bundle.js", + "/docs/swagger-ui-standalone-preset.js", + ]; let is_whitelisted_path = whitelisted_paths.contains(&path.as_str()); if !is_whitelisted_path { @@ -448,6 +455,82 @@ async fn proxy_request( return Ok(response_builder.body(Body::from(body_str)).unwrap()); } + + (hyper::Method::GET, "/openapi.json") => { + let body = include_str!("../../../static/openapi.json"); // relative to src-tauri/src/ + return Ok(Response::builder() + .status(StatusCode::OK) + .header(hyper::header::CONTENT_TYPE, "application/json") + .body(Body::from(body)) + .unwrap()); + } + + // DOCS route + (hyper::Method::GET, "/") => { + let html = r#" + + +
+ +