diff --git a/Cargo.lock b/Cargo.lock index 02a6bb881782ea42194d76b937bd7ee842407f6c..03859976f5c284b812b0c055100a8e759f627c69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1847,7 +1847,6 @@ dependencies = [ "toml", "update-informer", "utoipa", - "utoipa-rapidoc", "utoipa-swagger-ui", ] @@ -3267,17 +3266,6 @@ dependencies = [ "syn 2.0.74", ] -[[package]] -name = "utoipa-rapidoc" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d331839f6de584865f20c8138b73868d515ba62349ae4c8c1f78ffa54069e78" -dependencies = [ - "serde", - "serde_json", - "utoipa", -] - [[package]] name = "utoipa-swagger-ui" version = "5.0.0" diff --git a/Cargo.toml b/Cargo.toml index 48984c335141f31c12c8da59d32e09154c9932f3..c4fc3d931d3a095545eb732d3025e5b21a7c7ee1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,6 @@ prometheus = "0.13.4" include_dir = "0.7.4" serde_json = "1.0.125" simple-logging = "2.0.2" -utoipa-rapidoc = "2.0.0" update-informer = "1.1.0" pretty_env_logger = "0.5.0" utoipa-swagger-ui = "5.0.0" diff --git a/src/daemon/api/docs.rs b/src/daemon/api/docs.rs new file mode 100644 index 0000000000000000000000000000000000000000..847ce447b7e05f44240368e0f64f0de0a015d0ea --- /dev/null +++ b/src/daemon/api/docs.rs @@ -0,0 +1,19 @@ +use pmc::config; +use std::borrow::Cow; + +const INDEX: &str = include_str!("../static/index.html"); + +#[derive(Clone)] +pub struct Docs { + html: Cow<'static, str>, + s_path: String, +} + +impl Docs { + pub fn new() -> Self { + let s_path = config::read().get_path().trim_end_matches('/').to_string(); + Self { s_path, html: Cow::Borrowed(INDEX) } + } + + pub fn render(&self) -> String { self.html.replace("$s_path", &self.s_path) } +} diff --git a/src/daemon/api/docs/index.html b/src/daemon/api/docs/index.html deleted file mode 100644 index ec1f2f8b0985a9cd47ffb5203903999a7908f4d2..0000000000000000000000000000000000000000 --- a/src/daemon/api/docs/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - -
- - - - - -