From aa26dbc1170529b49f3d99ba2a2c73a147b6a17f Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Fri, 4 Oct 2024 14:39:02 +0200 Subject: [PATCH] better filtering --- Cargo.lock | 627 +++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 8 +- input.css | 17 +- src/main.rs | 153 ++++++++++--- 4 files changed, 769 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2f976c4..0e54e13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,6 +44,21 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.15" @@ -99,6 +114,18 @@ version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +[[package]] +name = "anymap" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33954243bd79057c2de7338850b85983a44588021f8a5fee574a8888c6de4344" + +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "ashpd" version = "0.8.1" @@ -117,6 +144,12 @@ dependencies = [ "zbus", ] +[[package]] +name = "askama_escape" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" + [[package]] name = "async-broadcast" version = "0.7.1" @@ -306,6 +339,77 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "axum" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +dependencies = [ + "async-trait", + "axum-core", + "axum-macros", + "base64 0.22.1", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-util", + "itoa 1.0.11", + "matchit", + "memchr", + "mime", + "multer", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper 1.0.1", + "tokio", + "tokio-tungstenite", + "tower 0.5.1", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 1.0.1", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "backtrace" version = "0.3.74" @@ -333,6 +437,15 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -499,6 +612,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets 0.52.6", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -835,6 +962,12 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "derivative" version = "2.2.0" @@ -883,8 +1016,12 @@ dependencies = [ "dioxus-hooks", "dioxus-hot-reload", "dioxus-html", + "dioxus-liveview", "dioxus-router", "dioxus-signals", + "dioxus-ssr", + "dioxus-web", + "serde", ] [[package]] @@ -993,20 +1130,37 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b80f0ac18166302341164e681322e0385131c08a11c3cc1c51ee8df799ab0d3d" dependencies = [ + "anymap", "async-trait", + "axum", "base64 0.21.7", "bytes", "ciborium", + "dioxus-cli-config", "dioxus-desktop", "dioxus-hot-reload", "dioxus-lib", + "dioxus-ssr", + "dioxus-web", "dioxus_server_macro", "futures-util", + "http 1.1.0", + "hyper 1.4.1", "once_cell", + "pin-project", "serde", "serde_json", "server_fn", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tower 0.4.13", + "tower-http", + "tower-layer", "tracing", + "tracing-futures", + "web-sys", ] [[package]] @@ -1060,6 +1214,7 @@ dependencies = [ "serde_repr", "tokio", "tracing", + "wasm-bindgen", "web-sys", ] @@ -1083,9 +1238,13 @@ checksum = "351fad098c657d14f3ac2900362d2b86e83c22c4c620a404839e1ab628f3395b" dependencies = [ "dioxus-core", "dioxus-html", + "js-sys", "md5", "sledgehammer_bindgen", "sledgehammer_utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] @@ -1102,6 +1261,32 @@ dependencies = [ "dioxus-signals", ] +[[package]] +name = "dioxus-liveview" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ada18a8fe0764f492fd4fb169b818877799e887dbb6ffb19289801d924faf18" +dependencies = [ + "axum", + "dioxus-cli-config", + "dioxus-core", + "dioxus-hot-reload", + "dioxus-html", + "dioxus-interpreter-js", + "futures-channel", + "futures-util", + "generational-box", + "rustc-hash", + "serde", + "serde_json", + "slab", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", +] + [[package]] name = "dioxus-logger" version = "0.5.1" @@ -1121,11 +1306,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c235c5dbeb528c0c2b0424763da812e7500df69b82eddac54db6f4975e065c5f" dependencies = [ "dioxus-cli-config", + "dioxus-fullstack", "dioxus-lib", "dioxus-router-macro", + "dioxus-ssr", + "gloo", + "gloo-utils 0.1.7", + "js-sys", + "tokio", "tracing", "url", "urlencoding", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -1171,6 +1364,52 @@ dependencies = [ "tracing", ] +[[package]] +name = "dioxus-ssr" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "753b1eb29372bb3afcdbc0ac603893802a8b7b70fa94b86a1641408e2b87173b" +dependencies = [ + "askama_escape", + "async-trait", + "chrono", + "dioxus-core", + "dioxus-html", + "generational-box", + "http 1.1.0", + "lru", + "rustc-hash", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "dioxus-web" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0855ac81fcc9252a0863930a7a7cbb2504fc1b6efe893489c8d0e23aaeb2cb9" +dependencies = [ + "async-trait", + "console_error_panic_hook", + "dioxus-core", + "dioxus-html", + "dioxus-interpreter-js", + "futures-channel", + "futures-util", + "generational-box", + "js-sys", + "rustc-hash", + "serde", + "serde-wasm-bindgen", + "serde_json", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "dioxus_server_macro" version = "0.5.6" @@ -1810,6 +2049,107 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net 0.3.1", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils 0.1.7", + "gloo-worker", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events", + "gloo-utils 0.1.7", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.1.7", + "http 0.2.12", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "gloo-net" version = "0.6.0" @@ -1819,7 +2159,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-sink", - "gloo-utils", + "gloo-utils 0.2.0", "http 1.1.0", "js-sys", "pin-project", @@ -1831,6 +2171,54 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils 0.1.7", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-utils" version = "0.2.0" @@ -1844,6 +2232,23 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "gobject-sys" version = "0.18.0" @@ -2067,6 +2472,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-range-header" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" + [[package]] name = "httparse" version = "1.9.5" @@ -2115,6 +2526,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "httparse", + "httpdate", "itoa 1.0.11", "pin-project-lite", "smallvec", @@ -2154,6 +2566,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core 0.52.0", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -2244,6 +2679,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae52f28f45ac2bc96edb7714de995cffc174a395fb0abf5bff453587c980d7b9" +[[package]] +name = "inventory" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" + [[package]] name = "ipnet" version = "2.10.0" @@ -2502,6 +2943,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + [[package]] name = "md5" version = "0.7.0" @@ -2579,6 +3026,23 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "multer" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" +dependencies = [ + "bytes", + "encoding_rs", + "futures-util", + "http 1.1.0", + "httparse", + "memchr", + "mime", + "spin", + "version_check", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -3434,6 +3898,12 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + [[package]] name = "ryu" version = "1.0.18" @@ -3544,6 +4014,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" version = "1.0.210" @@ -3567,6 +4048,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa 1.0.11", + "serde", +] + [[package]] name = "serde_qs" version = "0.12.0" @@ -3616,12 +4107,16 @@ version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fae7a3038a32e5a34ba32c6c45eb4852f8affaf8b794ebfcd4b1099e2d62ebe" dependencies = [ + "axum", "bytes", "const_format", "dashmap", "futures", - "gloo-net", + "gloo-net 0.6.0", "http 1.1.0", + "http-body-util", + "hyper 1.4.1", + "inventory", "js-sys", "once_cell", "reqwest 0.12.8", @@ -3631,6 +4126,8 @@ dependencies = [ "serde_qs", "server_fn_macro_default", "thiserror", + "tower 0.4.13", + "tower-layer", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -3757,6 +4254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcfaf791ff02f48f3518ce825d32cf419c13a43c1d8b1232f74ac89f339c46d2" dependencies = [ "sledgehammer_bindgen_macro", + "wasm-bindgen", ] [[package]] @@ -3832,6 +4330,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spinning" version = "0.1.0" @@ -4102,7 +4606,9 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -4129,6 +4635,30 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.7.12" @@ -4138,6 +4668,8 @@ dependencies = [ "bytes", "futures-core", "futures-sink", + "futures-util", + "hashbrown 0.14.5", "pin-project-lite", "tokio", ] @@ -4201,6 +4733,68 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags 2.6.0", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" version = "0.3.3" @@ -4213,6 +4807,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4239,6 +4834,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -4281,6 +4886,24 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.1.0", + "httparse", + "log", + "rand 0.8.5", + "sha1", + "thiserror", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" diff --git a/Cargo.toml b/Cargo.toml index 4792cdb..c4cd78a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,10 +6,14 @@ edition = "2021" [dependencies] clap = { version = "4.5.19", features = ["derive"] } -dioxus = { version = "0.5", features = ["desktop", "router"] } +dioxus = { version = "0.5", features = ["router"] } dioxus-logger = "0.5.1" manganis = "0.2.2" regex = "1.11.0" [features] -bundle = [] +default = ["desktop"] +desktop = ["dioxus/desktop"] +fullstack = ["dioxus/fullstack"] +server = ["dioxus/axum"] +web = ["dioxus/web"] diff --git a/input.css b/input.css index cdfc2d5..1607efb 100644 --- a/input.css +++ b/input.css @@ -12,12 +12,13 @@ td { @apply text-ellipsis overflow-hidden; } -td div{ +td div { @apply text-ellipsis overflow-hidden; } /* Ensure the body and html take up the full height */ -html, body { +html, +body { height: 100vh; margin: 0; } @@ -26,21 +27,25 @@ html, body { .p-4 { display: flex; flex-direction: column; - overflow: hidden; /* Prevents scrollbar on the body */ + overflow: hidden; + /* Prevents scrollbar on the body */ } /* Header stays at the top */ .header { position: fixed; /* Set height as needed */ - max-height: 80px; /* Adjust to your header's height */ - background-color: white; /* Optional */ + max-height: 80px; + /* Adjust to your header's height */ + background-color: white; + /* Optional */ } /* Content area fills the remaining space and is scrollable */ .content { position: fixed; - max-height: calc(100vh - 90px); /* Adjust to your header's height */ + max-height: calc(100vh - 90px); + /* Adjust to your header's height */ max-width: calc(100vw - 20px); overflow-y: scroll; overflow-x: scroll; diff --git a/src/main.rs b/src/main.rs index 23af62a..9089af9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,37 @@ #![allow(non_snake_case)] #![cfg_attr(target_os = "windows", windows_subsystem = "windows")] -use std::{fs::File, io::Read}; +use std::{ + fs::File, + io::Read, + path::{Path, PathBuf}, +}; use clap::Parser; -use dioxus::{desktop::WindowBuilder, prelude::*}; +#[cfg(feature = "desktop")] +use dioxus::desktop::WindowBuilder; +use dioxus::prelude::*; use dioxus_logger::tracing::{info, Level}; use regex::RegexBuilder; #[derive(Clone, Parser)] struct Args { - log_file: Option, + log_file: Option, +} + +#[derive(Clone, Debug)] +struct Source { + loc: String, + addr: Option, +} + +impl Source { + fn full(&self) -> String { + match &self.addr { + Some(addr) => format!("{}@{addr}", self.loc), + None => format!("{}", self.loc), + } + } } #[derive(Clone, Debug)] @@ -19,8 +40,8 @@ struct LogEntry { level: LogLevel, category: String, thread: String, - source: String, - message: String, + source: Source, + message: Vec, } impl LogEntry { @@ -42,8 +63,17 @@ impl LogEntry { || self.level.as_str().to_lowercase().contains(&query) || self.category.to_lowercase().contains(&query) || self.thread.to_lowercase().contains(&query) - || self.source.to_lowercase().contains(&query) - || self.message.to_lowercase().contains(&query) + || self.source.loc.to_lowercase().contains(&query) + || self + .source + .addr + .as_ref() + .map(|v| v.to_lowercase().contains(&query)) + .unwrap_or_default() + || self + .message + .iter() + .any(|m| m.to_lowercase().contains(&query)) } } @@ -74,7 +104,7 @@ fn highlight_matches<'a>(text: &'a str, query: &str) -> Vec<(&'a str, bool)> { result } -#[derive(Clone, Copy, PartialEq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] enum LogLevel { Trace, Debug, @@ -104,11 +134,17 @@ impl From<&str> for LogLevel { "DEBUG" => LogLevel::Debug, "INFO" => LogLevel::Info, "WARNING" => LogLevel::Warning, + "WARN" => LogLevel::Warning, "ERROR" => LogLevel::Error, _ => LogLevel::Unknown, } } } +impl From for LogLevel { + fn from(s: String) -> Self { + From::from(s.as_str()) + } +} #[derive(Clone, Routable, Debug, PartialEq)] enum Route { @@ -116,6 +152,7 @@ enum Route { Home {}, } +#[cfg(feature = "desktop")] fn make_config() -> dioxus::desktop::Config { // dioxus::desktop::Config::new() // .with_custom_head(r#""#.to_string()) @@ -130,16 +167,27 @@ fn make_config() -> dioxus::desktop::Config { fn make_window() -> WindowBuilder { WindowBuilder::new() + .with_maximized(true) .with_resizable(true) .with_always_on_top(false) } fn main() { + #[cfg(feature = "desktop")] + if let Ok(exe) = std::env::current_exe() { + if let Some(parent) = exe.parent() { + std::env::set_current_dir(parent).expect("could not set cwd"); + } + } + // Init logger dioxus_logger::init(Level::ERROR).expect("failed to init logger"); info!("starting app"); + #[cfg(feature = "desktop")] LaunchBuilder::desktop().with_cfg(make_config()).launch(App); + + launch(App); } #[component] @@ -152,24 +200,42 @@ fn App() -> Element { fn parse_log_file(content: &str) -> Vec { let mut entries = Vec::new(); for line in content.lines() { + let line = line.trim(); let parts: Vec<&str> = line.split('\t').collect(); - if parts.len() >= 6 { + if parts.len() >= 5 { entries.push(LogEntry { timestamp: parts[0].to_string(), level: LogLevel::from(parts[1]), category: parts[2].to_string(), thread: parts[3].to_string(), - source: parts[4].to_string(), - message: parts[5..].join(" "), + source: parts[4] + .split_once('@') + .map(|(s, a)| Source { + loc: s.to_owned(), + addr: Some(a.to_owned()), + }) + .unwrap_or_else(|| Source { + loc: parts[4].to_owned(), + addr: None, + }), + message: if parts.len() >= 5 { + vec![parts[5..].join(" ")] + } else { + Vec::new() + }, }); + } else if !line.contains("*** NEW LOG FILE ***") { + if let Some(last_entry) = entries.last_mut() { + last_entry.message.push(line.to_owned()); + } } } entries } -fn read_log_file(filename: &str) -> Vec { +fn read_log_file>(file_path: P) -> Vec { let mut entries = Vec::new(); - if let Ok(mut file) = File::open(filename) { + if let Ok(mut file) = File::open(file_path) { let mut contents = String::new(); if file.read_to_string(&mut contents).is_ok() { entries = parse_log_file(&contents); @@ -182,19 +248,26 @@ fn read_log_file(filename: &str) -> Vec { fn Home() -> Element { let mut log_entries = use_signal(|| { let Args { log_file } = Args::parse(); - log_file + if cfg!(not(debug_assertions)) { + log_file + .map(|log_file| read_log_file(&log_file)) + .unwrap_or_default() + } else { + log_file .map(|log_file| read_log_file(&log_file)) - .unwrap_or_default() + .unwrap_or_else(|| read_log_file("c:/Users/SBidermann/AppData/Local/fastviewer/apps/adhoc_launcher/logs/adhoc_launcher_1.log")) + } }); let mut search_query = use_signal(String::new); let mut highlight = use_signal(String::new); + let mut log_level = use_signal(|| LogLevel::Trace); // State for column widths - let column_widths = [150.0, 80.0, 100.0, 140.0, 300.0, 150.0]; // Initial widths for 6 columns + let column_widths = [150.0, 80.0, 100.0, 140.0, 150.0, 110.0]; // Initial widths for 6 columns // Columns visibility - let mut column_visibility = use_signal(|| vec![true; 6]); // All columns visible by default + let mut column_visibility = use_signal(|| vec![true, true, true, true, true, false, true]); // All columns visible by default // Column titles let column_titles = [ @@ -203,6 +276,7 @@ fn Home() -> Element { "Category", "Thread", "Source", + "Address", "Message", ]; @@ -273,6 +347,16 @@ fn Home() -> Element { } " {title} " } + }, + select { class: "mr-4", + name: "level", + id: "level", + onchange: move |e| log_level.set(LogLevel::from(e.value())), + for level in [LogLevel::Trace, LogLevel::Debug,LogLevel::Info,LogLevel::Warning,LogLevel::Error,LogLevel::Unknown] { + option { + value: "{level.as_str()}", "{level.as_str()}" + } + } } } } @@ -297,10 +381,10 @@ fn Home() -> Element { } tbody { for entry in log_entries().iter().filter(|entry| { - entry.matches_query(&search_query()) + entry.level >= log_level() && entry.matches_query(&search_query()) }) { tr { class: "hover:bg-gray-100", - for i in 0..6 { + for i in 0..column_titles.len() { if column_visibility()[i] { match i { 0 => rsx! { td { @@ -348,16 +432,33 @@ fn Home() -> Element { } } }, 4 => rsx! { td { - for (text, is_highlighted) in highlight_matches(&entry.source, &highlight()) { - if is_highlighted { - span { class: "bg-yellow-200", "{text}" } - } else { - "{text}" + class: "resize-null text-right select-all", + style: "direction: rtl; width: {column_widths[i]}px;min-width: {column_widths[i]}px;max-width: {column_widths[i]}px;", + title: "{entry.source.full()}", + for (text, is_highlighted) in highlight_matches(&entry.source.loc, &highlight()) { + if is_highlighted { + span { class: "bg-yellow-200", "{text}" } + } else { + "{text}" + } } - } } }, 5 => rsx! { td { - for (text, is_highlighted) in highlight_matches(&entry.message, &highlight()) { + class: "resize-null select-all", + style: "direction: rtl; width: {column_widths[i]}px;min-width: {column_widths[i]}px;max-width: {column_widths[i]}px;", + title: "{entry.source.full()}", + if let Some(addr) = &entry.source.addr { + for (text, is_highlighted) in highlight_matches(addr, &highlight()) { + if is_highlighted { + span { class: "bg-yellow-200", "{text}" } + } else { + "{text}" + } + } + } + } }, + 6 => rsx! { td { + for (text, is_highlighted) in highlight_matches(&entry.message.join("\n"), &highlight()) { if is_highlighted { span { class: "bg-yellow-200", "{text}" } } else {