convert ansi colors to html and html escape stuff

master
rascul 2 years ago
parent bf7e5d925e
commit 6e03d29f85

32
Cargo.lock generated

@ -263,6 +263,17 @@ dependencies = [
"alloc-no-stdlib",
]
[[package]]
name = "ansi-to-html"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19ee82de0545b181a17cbdef44fce80ecaf394e001da7ea279008bf2e0944bee"
dependencies = [
"once_cell",
"regex",
"thiserror",
]
[[package]]
name = "askama_escape"
version = "0.10.3"
@ -1163,6 +1174,7 @@ dependencies = [
"actix-files",
"actix-multipart",
"actix-web",
"ansi-to-html",
"chrono",
"clap",
"futures-util",
@ -1341,6 +1353,26 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "time"
version = "0.1.44"

@ -9,6 +9,7 @@ edition = "2021"
actix-files = "0.6.0"
actix-multipart = "0.4.0"
actix-web = "4.0.1"
ansi-to-html = { version = "0.1.0", features = ["lazy-init"] }
chrono = { version = "0.4.19", features = ["serde"] }
clap = { version = "3.1.18", features = ["derive"] }
futures-util = "0.3.21"

@ -1,5 +1,6 @@
use std::ops::Range;
use ansi_to_html::convert_escaped;
use serde_json::{Map, Value};
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
@ -76,6 +77,7 @@ pub fn parse_log(raw: &Vec<u8>) -> Result<Value> {
}
let text: String = String::from_utf8_lossy(&text_chunk).into();
let text: String = convert_escaped(&text)?;
let mut bm: Map<String, Value> = Map::new();
bm.insert("delta".into(), delta.into());

Loading…
Cancel
Save