diff --git a/Cargo.lock b/Cargo.lock index fc8d1657..5392ae9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1743,6 +1743,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "similar" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" + [[package]] name = "slab" version = "0.4.9" @@ -2077,6 +2083,7 @@ dependencies = [ "serde_json", "serde_qs", "sha1", + "similar", "time", "wasm-bindgen", "wasm-logger", diff --git a/Cargo.toml b/Cargo.toml index af003c83..069c8313 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,8 +32,6 @@ log = "0.4.17" # utils hex = "0.4.3" gloo-timers = "0.2.4" -rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } -rand_chacha = "0.3.1" serde = { version = "1.0.162", features = ["derive"] } serde_qs = "0.12.0" serde_json = "1.0.89" @@ -50,8 +48,13 @@ hmac-sha512 = { version = "1.1.2", features = ["sha384"] } rsa = "0.7.2" bcrypt = "0.14.0" flate2 = { version = "1.0.26", features = ["zlib"] } +rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } +rand_chacha = "0.3.1" # asn1 asn1-parser = { path = "./crates/asn1-parser", features = ["std"] } oid = { version = "0.2.1", default-features = false } paste = "1.0.14" + +# diff +similar = "2.4.0" \ No newline at end of file diff --git a/index.html b/index.html index 7cdf592a..878295b5 100644 --- a/index.html +++ b/index.html @@ -29,5 +29,8 @@ + + + \ No newline at end of file diff --git a/public/styles/diff/styles.scss b/public/styles/diff/styles.scss new file mode 100644 index 00000000..ef2c1e73 --- /dev/null +++ b/public/styles/diff/styles.scss @@ -0,0 +1,36 @@ + +.diff-changes-container { + display: flex; + flex-direction: row; + gap: 0; + justify-content: flex-start; + align-items: center; + width: 100%; + flex-wrap: wrap; + //background-color: #edd5ce; + //border-radius: 0.2em; + //padding: 0.5em; +} + +.diff-insert { + white-space: pre-wrap; + background-color: #97e0bd; + color: #016939; +} + +.diff-remove { + white-space: pre-wrap; + background-color: #d38693; + color: #9d0620; +} + +.diff-new-line { + height: 0; + flex-basis: 100%; +} + +.diff-line-number { + background-color: #edd5ce; + padding-right: 0.3em; + padding-left: 0.3em; +} \ No newline at end of file diff --git a/src/about.rs b/src/about.rs index 86a0e576..8ac328ba 100644 --- a/src/about.rs +++ b/src/about.rs @@ -26,6 +26,8 @@ pub fn about() -> Html {
  • {"ES384"}
  • {"ES512"}
  • +
  • {"ASN1 decoder"}
  • +
  • {"Diff checker"}
  • {"Ability to share the sample by url"}
  • {"All computations are performed on the client side."} diff --git a/src/asn1.rs b/src/asn1.rs index 0db67ab6..84993c23 100644 --- a/src/asn1.rs +++ b/src/asn1.rs @@ -83,10 +83,7 @@ pub fn asn1_parser_page() -> Html { let asn1_setter = parsed_asn1.setter(); let raw_data = (*raw_asn1).clone(); let parse_asn1 = Callback::from(move |_| match Asn1::decode_buff(&raw_data) { - Ok(asn1) => { - debug!("parsed!"); - asn1_setter.set(asn1.to_owned_with_asn1(asn1.inner_asn1().to_owned())); - } + Ok(asn1) => asn1_setter.set(asn1.to_owned_with_asn1(asn1.inner_asn1().to_owned())), Err(error) => notifications.spawn(Notification::new( NotificationType::Error, "Invalid asn1 data", @@ -197,7 +194,7 @@ pub fn asn1_parser_page() -> Html {
    - + {"(ctrl+enter)"}