WIP
This commit is contained in:
@@ -85,16 +85,20 @@ where
|
||||
impl<F> UnwindSafe for Cont<F> {}
|
||||
|
||||
macro_rules! static_http {
|
||||
($path:expr, $tgt:expr, $tgtex:expr) => {
|
||||
($path:expr, $tgt:expr, $tgtex:expr, $ctype:expr) => {
|
||||
if $path == concat!("/api/4/documentation/", $tgt) {
|
||||
let c = include_bytes!(concat!("../static/documentation/", $tgtex));
|
||||
return Ok(response(StatusCode::OK).body(Body::from(&c[..]))?);
|
||||
return Ok(response(StatusCode::OK)
|
||||
.header("content-type", $ctype)
|
||||
.body(Body::from(&c[..]))?);
|
||||
}
|
||||
};
|
||||
($path:expr, $tgt:expr) => {
|
||||
($path:expr, $tgt:expr, $ctype:expr) => {
|
||||
if $path == concat!("/api/4/documentation/", $tgt) {
|
||||
let c = include_bytes!(concat!("../static/documentation/", $tgt));
|
||||
return Ok(response(StatusCode::OK).body(Body::from(&c[..]))?);
|
||||
return Ok(response(StatusCode::OK)
|
||||
.header("content-type", $ctype)
|
||||
.body(Body::from(&c[..]))?);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -140,10 +144,10 @@ async fn data_api_proxy_try(req: Request<Body>, node_config: &NodeConfigCached)
|
||||
}
|
||||
} else if path.starts_with("/api/4/documentation/") {
|
||||
if req.method() == Method::GET {
|
||||
static_http!(path, "", "index.html");
|
||||
static_http!(path, "style.css");
|
||||
static_http!(path, "script.js");
|
||||
static_http!(path, "status-main.html");
|
||||
static_http!(path, "", "index.html", "text/html");
|
||||
static_http!(path, "style.css", "text/stylesheet");
|
||||
static_http!(path, "script.js", "text/javascript");
|
||||
static_http!(path, "status-main.html", "text/html");
|
||||
Ok(response(StatusCode::NOT_FOUND).body(Body::empty())?)
|
||||
} else {
|
||||
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
|
||||
|
||||
Reference in New Issue
Block a user