From 7857d879843c4df9c3a7b577b74beb27af961871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Tue, 22 Oct 2024 20:29:27 -0300 Subject: [PATCH] WIP --- Cargo.lock | 372 +++++---- src/build.rs | 92 --- src/lib/web/endpoints.rs | 2 +- src/lib/web/mod.rs | 136 +++- src/webpage/.cargo/config.toml | 5 + src/webpage/Cargo.lock | 846 +++++++------------- src/webpage/Cargo.toml | 3 + src/webpage/src/app.rs | 494 +++++------- src/webpage/src/lib.rs | 2 + src/webpage/src/main.rs | 2 +- src/webpage/src/messages.rs | 23 + src/webpage/src/stats/drivers_stats.rs | 60 ++ src/webpage/src/stats/hub_messages_stats.rs | 58 ++ src/webpage/src/stats/hub_stats.rs | 23 + src/webpage/src/stats/mod.rs | 109 +++ 15 files changed, 1065 insertions(+), 1162 deletions(-) create mode 100644 src/webpage/.cargo/config.toml create mode 100644 src/webpage/src/messages.rs create mode 100644 src/webpage/src/stats/drivers_stats.rs create mode 100644 src/webpage/src/stats/hub_messages_stats.rs create mode 100644 src/webpage/src/stats/hub_stats.rs create mode 100644 src/webpage/src/stats/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 62ad9ff8..f6391627 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "arc-swap" @@ -128,9 +128,9 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -139,15 +139,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" dependencies = [ "async-trait", "axum-core", @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", @@ -195,7 +195,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "tower-layer", "tower-service", "tracing", @@ -218,9 +218,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -250,7 +250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "serde", ] @@ -268,9 +268,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "camino" @@ -312,9 +312,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.21" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -369,9 +369,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -379,9 +379,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -391,9 +391,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -419,6 +419,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -587,18 +597,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", @@ -608,9 +618,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", "syn", @@ -701,9 +711,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide", @@ -726,9 +736,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -741,9 +751,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -751,15 +761,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -768,15 +778,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -785,21 +795,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -836,9 +846,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gix" @@ -897,18 +907,18 @@ dependencies = [ [[package]] name = "gix-bitmap" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a371db66cbd4e13f0ed9dc4c0fea712d7276805fccc877f77e96374d317e87ae" +checksum = "10f78312288bd02052be5dbc2ecbc342c9f4eb791986d86c0a5c06b92dc72efa" dependencies = [ "thiserror", ] [[package]] name = "gix-chunk" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c8751169961ba7640b513c3b24af61aa962c967aaf04116734975cd5af0c52" +checksum = "6c28b58ba04f0c004722344390af9dbc85888fbb84be1981afb934da4114d4cf" dependencies = [ "thiserror", ] @@ -950,9 +960,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.8" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03f76169faa0dec598eac60f83d7fcdd739ec16596eca8fb144c88973dbe6f8c" +checksum = "f3de3fdca9c75fa4b83a76583d265fa49b1de6b088ebcd210749c24ceeb74660" dependencies = [ "bitflags 2.6.0", "bstr", @@ -963,9 +973,9 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c84b7af01e68daf7a6bb8bb909c1ff5edb3ce4326f1f43063a5a96d3c3c8a5" +checksum = "d10d543ac13c97292a15e8e8b7889cd006faf739777437ed95362504b8fe81a0" dependencies = [ "bstr", "itoa", @@ -1060,7 +1070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ddf80e16f3c19ac06ce415a38b8591993d3f73aede049cb561becb5b3a8e242" dependencies = [ "gix-hash", - "hashbrown", + "hashbrown 0.14.5", "parking_lot", ] @@ -1083,7 +1093,7 @@ dependencies = [ "gix-traverse", "gix-utils", "gix-validate", - "hashbrown", + "hashbrown 0.14.5", "itoa", "libc", "memmap2", @@ -1162,9 +1172,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.11" +version = "0.10.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebfc4febd088abdcbc9f1246896e57e37b7a34f6909840045a1767c6dafac7af" +checksum = "c04e5a94fdb56b1e91eb7df2658ad16832428b8eeda24ff1a0f0288de2bce554" dependencies = [ "bstr", "gix-trace", @@ -1175,9 +1185,9 @@ dependencies = [ [[package]] name = "gix-quote" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbff4f9b9ea3fa7a25a70ee62f545143abef624ac6aa5884344e70c8b0a1d9ff" +checksum = "f89f9a1525dcfd9639e282ea939f5ab0d09d93cf2b90c1fc6104f1b9582a8e49" dependencies = [ "bstr", "gix-utils", @@ -1252,9 +1262,9 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe4d52f30a737bbece5276fab5d3a8b276dc2650df963e293d0673be34e7a5f" +checksum = "a2007538eda296445c07949cf04f4a767307d887184d6b3e83e2d636533ddc6e" dependencies = [ "bitflags 2.6.0", "gix-path", @@ -1279,9 +1289,9 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cae0e8661c3ff92688ce1c8b8058b3efb312aba9492bbe93661a21705ab431b" +checksum = "04bdde120c29f1fc23a24d3e115aeeea3d60d8e65bab92cc5f9d90d9302eb952" [[package]] name = "gix-traverse" @@ -1316,9 +1326,9 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35192df7fd0fa112263bad8021e2df7167df4cc2a6e6d15892e1e55621d3d4dc" +checksum = "ba427e3e9599508ed98a6ddf8ed05493db114564e338e41f6a996d2e4790335f" dependencies = [ "fastrand", "unicode-normalization", @@ -1326,9 +1336,9 @@ dependencies = [ [[package]] name = "gix-validate" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f2badbb64e57b404593ee26b752c26991910fd0d81fe6f9a71c1a8309b6c86" +checksum = "e187b263461bc36cea17650141567753bc6207d036cedd1de6e81a52f277ff68" dependencies = [ "bstr", "thiserror", @@ -1354,6 +1364,12 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "heck" version = "0.5.0" @@ -1417,9 +1433,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -1429,9 +1445,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -1448,9 +1464,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-util", @@ -1459,6 +1475,7 @@ dependencies = [ "hyper", "pin-project-lite", "tokio", + "tower-service", ] [[package]] @@ -1521,12 +1538,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", "serde", ] @@ -1599,9 +1616,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1625,9 +1642,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libredox" @@ -1907,18 +1924,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" @@ -1969,9 +1986,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", "thiserror", @@ -1980,9 +1997,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -1990,9 +2007,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", @@ -2003,35 +2020,15 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", "sha2", ] -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2089,9 +2086,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -2104,9 +2101,9 @@ checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" [[package]] name = "quick-xml" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" dependencies = [ "memchr", ] @@ -2172,9 +2169,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2192,14 +2189,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2213,13 +2210,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2230,9 +2227,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-demangle" @@ -2255,9 +2252,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -2291,9 +2288,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] @@ -2309,9 +2306,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", @@ -2320,9 +2317,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -2354,12 +2351,13 @@ dependencies = [ [[package]] name = "serialport" -version = "4.5.0" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241ebb629ed9bf598b2b392ba42aa429f9ef2a0099001246a36ac4c084ee183f" +checksum = "7331eefcaafaa382c0df95bcd84068f0b3e3c215c300750dde2316e9b8806ed5" dependencies = [ "bitflags 2.6.0", "cfg-if", + "core-foundation", "core-foundation-sys", "io-kit-sys", "mach2", @@ -2473,9 +2471,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -2496,9 +2494,9 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -2509,18 +2507,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", @@ -2597,9 +2595,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -2639,9 +2637,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" dependencies = [ "futures-util", "log", @@ -2651,14 +2649,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.13" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" dependencies = [ "futures-core", "futures-util", - "pin-project", "pin-project-lite", + "sync_wrapper 0.1.2", "tokio", "tower-layer", "tower-service", @@ -2751,9 +2749,9 @@ dependencies = [ [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" dependencies = [ "byteorder", "bytes", @@ -2764,7 +2762,6 @@ dependencies = [ "rand", "sha1", "thiserror", - "url", "utf-8", ] @@ -2776,9 +2773,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unescaper" @@ -2791,18 +2788,15 @@ dependencies = [ [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-bom" @@ -2851,9 +2845,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -2931,9 +2925,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -2942,9 +2936,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -2957,9 +2951,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2967,9 +2961,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -2980,15 +2974,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -3184,9 +3178,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] diff --git a/src/build.rs b/src/build.rs index bb8786c3..4cd6a684 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,62 +1,5 @@ -use std::process::{exit, Command}; - use vergen_gix::{BuildBuilder, CargoBuilder, DependencyKind, GixBuilder}; -macro_rules! info { - ($($tokens: tt)*) => { - println!("cargo:warning={}", format!($($tokens)*)) - } -} - -fn is_wasm_target_installed() -> bool { - let output = Command::new("rustup") - .args(["target", "list", "--installed"]) - .output() - .expect("Failed to execute rustup"); - - let installed_targets = String::from_utf8_lossy(&output.stdout); - installed_targets.contains("wasm32-unknown-unknown") -} - -fn install_wasm_target() { - info!("Adding wasm32-unknown-unknown target..."); - let output = Command::new("rustup") - .args(["target", "add", "wasm32-unknown-unknown"]) - .output() - .expect("Failed to execute rustup"); - - if !output.status.success() { - eprintln!("T{}", String::from_utf8_lossy(&output.stderr)); - exit(1); - } -} - -fn get_trunk_version() -> Option { - Command::new("trunk") - .arg("--version") - .output() - .ok() - .and_then(|output| String::from_utf8(output.stdout).ok()) - .and_then(|version_string| version_string.split_whitespace().last().map(String::from)) -} - -fn install_trunk() -> Result<(), Box> { - info!("Installing trunk..."); - - let output = Command::new("cargo") - .arg("install") - .arg("trunk") - .arg("--force") - .output()?; - - if !output.status.success() { - eprintln!("TT{}", String::from_utf8_lossy(&output.stderr)); - exit(1); - } - - Ok(()) -} - fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=./src/webpage/"); @@ -68,40 +11,5 @@ fn main() -> Result<(), Box> { )? .emit()?; - if std::env::var("SKIP_FRONTEND").is_ok() { - return Ok(()); - } - - if !is_wasm_target_installed() { - install_wasm_target(); - } - - if get_trunk_version().is_none() { - info!("trunk not found"); - install_trunk().unwrap_or_else(|e| { - eprintln!("Error: {}", e); - exit(1); - }); - } - - let mut trunk_command = Command::new("trunk"); - trunk_command.args(["build", "./src/webpage/index.html"]); - - // Add --release argument if not in debug mode - if cfg!(not(debug_assertions)) { - trunk_command.args(["--release", "--locked"]); - } - - let trunk_output = trunk_command.output().expect("Failed to execute trunk"); - - if !trunk_output.status.success() { - eprintln!( - "Trunk build failed: {}", - String::from_utf8_lossy(&trunk_output.stderr) - ); - exit(1); - } - info!("{}", String::from_utf8_lossy(&trunk_output.stdout)); - Ok(()) } diff --git a/src/lib/web/endpoints.rs b/src/lib/web/endpoints.rs index 8ba80b6a..ef399090 100644 --- a/src/lib/web/endpoints.rs +++ b/src/lib/web/endpoints.rs @@ -81,7 +81,7 @@ pub async fn mavlink(path: Option>) -> impl IntoResponse { crate::drivers::rest::data::messages(&path) } -pub async fn driver_stats() -> impl IntoResponse { +pub async fn drivers_stats() -> impl IntoResponse { Json(stats::drivers_stats().await.unwrap()) } diff --git a/src/lib/web/mod.rs b/src/lib/web/mod.rs index 2fe83121..ab4e9315 100644 --- a/src/lib/web/mod.rs +++ b/src/lib/web/mod.rs @@ -26,17 +26,22 @@ use uuid::Uuid; use lazy_static::lazy_static; -use crate::{hub, stats}; +use crate::stats; fn default_router(state: AppState) -> Router { Router::new() .route("/", get(endpoints::root)) .route("/:path", get(endpoints::root)) .route("/info", get(endpoints::info)) - .route("/stats/driver", get(endpoints::driver_stats)) + .route("/stats/drivers", get(endpoints::drivers_stats)) .route("/stats/hub", get(endpoints::hub_stats)) .route("/stats/messages", get(endpoints::hub_messages_stats)) - .route("/stats/ws", get(stats_websocket_handler)) + .route("/stats/drivers/ws", get(drivers_stats_websocket_handler)) + .route("/stats/hub/ws", get(hub_stats_websocket_handler)) + .route( + "/stats/messages/ws", + get(hub_messages_stats_websocket_handler), + ) .route("/rest/ws", get(websocket_handler)) // We are matching all possible keys for the user .route("/rest/mavlink", get(endpoints::mavlink)) @@ -49,6 +54,8 @@ fn default_router(state: AppState) -> Router { async fn websocket_handler(ws: WebSocketUpgrade, State(state): State) -> Response { ws.on_upgrade(|socket| async { websocket_connection(socket, state).await }) } + +#[instrument(level = "debug", skip(socket, state))] async fn websocket_connection(socket: WebSocket, state: AppState) { let identifier = Uuid::new_v4(); debug!("WS client connected with ID: {identifier}"); @@ -90,20 +97,21 @@ async fn websocket_connection(socket: WebSocket, state: AppState) { send_task.await.unwrap(); } -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] struct FrequencyQuery { frequency: Option, } -async fn stats_websocket_handler( +async fn hub_messages_stats_websocket_handler( ws: WebSocketUpgrade, State(state): State, Query(freq_query): Query, ) -> Response { - ws.on_upgrade(|socket| stats_websocket_connection(socket, state, freq_query)) + ws.on_upgrade(|socket| hub_messages_stats_websocket_connection(socket, state, freq_query)) } -async fn stats_websocket_connection( +#[instrument(level = "debug", skip(socket, state))] +async fn hub_messages_stats_websocket_connection( socket: WebSocket, state: AppState, freq_query: FrequencyQuery, @@ -119,17 +127,123 @@ async fn stats_websocket_connection( let mut interval = tokio::time::interval(interval_duration); loop { interval.tick().await; - let hub_message_stats = match hub::hub_messages_stats().await { + let hub_message_stats = match stats::hub_messages_stats().await { Ok(hub_message_stats) => hub_message_stats, Err(error) => { - warn!("Failed getting hub message stats: {error:?}"); + warn!("Failed getting Hub Messages Stats: {error:?}"); continue; } }; let json = match serde_json::to_string(&hub_message_stats) { Ok(json) => json, Err(error) => { - warn!("Failed to create json from Hub Message Stats: {error:?}"); + warn!("Failed to create json from Hub Messages Stats: {error:?}"); + continue; + } + }; + if sender.send(Message::Text(json)).await.is_err() { + break; + } + } + }); + if let Err(error) = periodic_task.await { + error!("Failed finishing task Hub Messages Stats WebSocket task: {error:?}"); + } + + // Clean up when the connection is closed + state.clients.write().await.remove(&identifier); + debug!("WS client {identifier} removed"); +} + +async fn hub_stats_websocket_handler( + ws: WebSocketUpgrade, + State(state): State, + Query(freq_query): Query, +) -> Response { + ws.on_upgrade(|socket| hub_stats_websocket_connection(socket, state, freq_query)) +} + +#[instrument(level = "debug", skip(socket, state))] +async fn hub_stats_websocket_connection( + socket: WebSocket, + state: AppState, + freq_query: FrequencyQuery, +) { + let frequency = freq_query.frequency.unwrap_or(1); + let identifier = Uuid::new_v4(); + debug!("WS client connected with ID: {identifier}"); + + let (mut sender, _receiver) = socket.split(); + + let interval_duration = tokio::time::Duration::from_secs_f32(1.0 / frequency as f32); + let periodic_task = tokio::spawn(async move { + let mut interval = tokio::time::interval(interval_duration); + loop { + interval.tick().await; + let hub_message_stats = match stats::hub_stats().await { + Ok(hub_message_stats) => hub_message_stats, + Err(error) => { + warn!("Failed getting Hub Stats: {error:?}"); + continue; + } + }; + let json = match serde_json::to_string(&hub_message_stats) { + Ok(json) => json, + Err(error) => { + warn!("Failed to create json from Hub Stats: {error:?}"); + continue; + } + }; + if sender.send(Message::Text(json)).await.is_err() { + break; + } + } + }); + if let Err(error) = periodic_task.await { + error!("Failed finishing task Hub Stats WebSocket task: {error:?}"); + } + + // Clean up when the connection is closed + state.clients.write().await.remove(&identifier); + debug!("WS client {identifier} removed"); +} + +async fn drivers_stats_websocket_handler( + ws: WebSocketUpgrade, + State(state): State, + Query(freq_query): Query, +) -> Response { + ws.on_upgrade(|socket| drivers_stats_websocket_connection(socket, state, freq_query)) +} + +#[instrument(level = "debug", skip(socket, state))] +async fn drivers_stats_websocket_connection( + socket: WebSocket, + state: AppState, + freq_query: FrequencyQuery, +) { + let frequency = freq_query.frequency.unwrap_or(1); + let identifier = Uuid::new_v4(); + debug!("WS client connected with ID: {identifier}"); + + let (mut sender, _receiver) = socket.split(); + + let interval_duration = tokio::time::Duration::from_secs_f32(1.0 / frequency as f32); + let periodic_task = tokio::spawn(async move { + let mut interval = tokio::time::interval(interval_duration); + loop { + interval.tick().await; + let drivers_stats = match stats::drivers_stats().await { + Ok(drivers_stats) => drivers_stats, + Err(error) => { + warn!("Failed getting Drivers Stats: {error:?}"); + continue; + } + }; + let json = match serde_json::to_string(&drivers_stats) { + Ok(json) => json, + Err(error) => { + warn!("Failed to create json from Drivers Stats: {error:?}"); continue; } }; @@ -139,7 +253,7 @@ async fn stats_websocket_connection( } }); if let Err(error) = periodic_task.await { - error!("Failed finishing task Stats WebSocket task: {error:?}"); + error!("Failed finishing task Drivers Stats WebSocket task: {error:?}"); } // Clean up when the connection is closed diff --git a/src/webpage/.cargo/config.toml b/src/webpage/.cargo/config.toml new file mode 100644 index 00000000..c68e8b62 --- /dev/null +++ b/src/webpage/.cargo/config.toml @@ -0,0 +1,5 @@ +[build] +target = "wasm32-unknown-unknown" + +[config] +target_arch = "wasm32" diff --git a/src/webpage/Cargo.lock b/src/webpage/Cargo.lock index 247c39b7..fc1822f2 100644 --- a/src/webpage/Cargo.lock +++ b/src/webpage/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.28" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79faae4620f45232f599d9bc7b290f88247a0834162c4495ab2f02d60004adfb" +checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -20,9 +20,9 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.16.1" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef7442f1f520649b8e11ee3af6caeec24123fed4b63bc36a85b67308d8514fdf" +checksum = "99b76d84ee70e30a4a7e39ab9018e2b17a6a09e31084176cc7c0b2dec036ba45" dependencies = [ "enumn", "serde", @@ -30,23 +30,23 @@ dependencies = [ [[package]] name = "accesskit_atspi_common" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9d2b364833ae6e2eae9359a374108b1c5488877a9f43d26f0cb700560af9ae" +checksum = "f5393c75d4666f580f4cac0a968bc97c36076bb536a129f28210dac54ee127ed" dependencies = [ "accesskit", "accesskit_consumer", "atspi-common", "serde", "thiserror", - "zvariant 3.15.2", + "zvariant", ] [[package]] name = "accesskit_consumer" -version = "0.24.1" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7072a4f17b8e7440a88ce08eb657d1ec84be061b1a94be78f9699aa18e583885" +checksum = "7a12dc159d52233c43d9fe5415969433cbdd52c3d6e0df51bda7d447427b9986" dependencies = [ "accesskit", "immutable-chunkmap", @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "accesskit_macos" -version = "0.17.1" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716698a26b5113812348a9f99ec250cb7b4154c89a83bc55a8b7d8678a1ecf02" +checksum = "bfc6c1ecd82053d127961ad80a8beaa6004fb851a3a5b96506d7a6bd462403f6" dependencies = [ "accesskit", "accesskit_consumer", @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "accesskit_unix" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd552c7bae0cd2ba1131fb0cedad32f8915743e0ed086f989fd706431641f56e" +checksum = "be7f5cf6165be10a54b2655fa2e0e12b2509f38ed6fc43e11c31fdb7ee6230bb" dependencies = [ "accesskit", "accesskit_atspi_common", @@ -78,17 +78,17 @@ dependencies = [ "async-executor", "async-task", "atspi", - "futures-lite 1.13.0", + "futures-lite", "futures-util", "serde", - "zbus 3.15.2", + "zbus", ] [[package]] name = "accesskit_windows" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d134e9eb16c98b35d1ff7056a027d7482968bcab0d8b625e7e72895b748d705" +checksum = "974e96c347384d9133427167fb8a58c340cb0496988dacceebdc1ed27071023b" dependencies = [ "accesskit", "accesskit_consumer", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "accesskit_winit" -version = "0.22.1" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "156c5066e7b3ac9a82fb80fc18dcee42f79967c47e0ff431bae23e7ee8412a83" +checksum = "aea3522719f1c44564d03e9469a8e2f3a98b3a8a880bd66d0789c6b9c4a669dd" dependencies = [ "accesskit", "accesskit_macos", @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "arboard" @@ -227,11 +227,11 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" [[package]] name = "ashpd" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe7e0dd0ac5a401dc116ed9f9119cf9decc625600474cb41f0fc0a0050abc9a" +checksum = "4d43c03d9e36dd40cab48435be0b09646da362c278223ca535493877b2c1dee9" dependencies = [ - "async-fs 2.1.2", + "async-fs", "async-net", "enumflags2", "futures-channel", @@ -244,17 +244,7 @@ dependencies = [ "wayland-backend", "wayland-client", "wayland-protocols", - "zbus 4.4.0", -] - -[[package]] -name = "async-broadcast" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" -dependencies = [ - "event-listener 2.5.3", - "futures-core", + "zbus", ] [[package]] @@ -263,7 +253,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" dependencies = [ - "event-listener 5.3.1", + "event-listener", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -289,52 +279,20 @@ checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.1", - "futures-lite 2.3.0", + "fastrand", + "futures-lite", "slab", ] -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "blocking", - "futures-lite 1.13.0", -] - [[package]] name = "async-fs" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" dependencies = [ - "async-lock 3.4.0", + "async-lock", "blocking", - "futures-lite 2.3.0", -] - -[[package]] -name = "async-io" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" -dependencies = [ - "async-lock 2.8.0", - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-lite 1.13.0", - "log", - "parking", - "polling 2.8.0", - "rustix 0.37.27", - "slab", - "socket2", - "waker-fn", + "futures-lite", ] [[package]] @@ -343,35 +301,26 @@ version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ - "async-lock 3.4.0", + "async-lock", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "parking", - "polling 3.7.3", - "rustix 0.38.37", + "polling", + "rustix", "slab", "tracing", "windows-sys 0.59.0", ] -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener 2.5.3", -] - [[package]] name = "async-lock" version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 5.3.1", + "event-listener", "event-listener-strategy", "pin-project-lite", ] @@ -382,26 +331,9 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" dependencies = [ - "async-io 2.3.4", + "async-io", "blocking", - "futures-lite 2.3.0", -] - -[[package]] -name = "async-process" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" -dependencies = [ - "async-io 1.13.0", - "async-lock 2.8.0", - "async-signal", - "blocking", - "cfg-if", - "event-listener 3.1.0", - "futures-lite 1.13.0", - "rustix 0.38.37", - "windows-sys 0.48.0", + "futures-lite", ] [[package]] @@ -411,15 +343,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" dependencies = [ "async-channel", - "async-io 2.3.4", - "async-lock 3.4.0", + "async-io", + "async-lock", "async-signal", "async-task", "blocking", "cfg-if", - "event-listener 5.3.1", - "futures-lite 2.3.0", - "rustix 0.38.37", + "event-listener", + "futures-lite", + "rustix", "tracing", ] @@ -431,7 +363,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -440,13 +372,13 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ - "async-io 2.3.4", - "async-lock 3.4.0", + "async-io", + "async-lock", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.37", + "rustix", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -466,7 +398,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -477,9 +409,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "atspi" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6059f350ab6f593ea00727b334265c4dfc7fd442ee32d264794bd9bdc68e87ca" +checksum = "be534b16650e35237bb1ed189ba2aab86ce65e88cc84c66f4935ba38575cecbf" dependencies = [ "atspi-common", "atspi-connection", @@ -488,39 +420,42 @@ dependencies = [ [[package]] name = "atspi-common" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92af95f966d2431f962bc632c2e68eda7777330158bf640c4af4249349b2cdf5" +checksum = "1909ed2dc01d0a17505d89311d192518507e8a056a48148e3598fef5e7bb6ba7" dependencies = [ "enumflags2", "serde", "static_assertions", - "zbus 3.15.2", - "zbus_names 2.6.1", - "zvariant 3.15.2", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", ] [[package]] name = "atspi-connection" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c65e7d70f86d4c0e3b2d585d9bf3f979f0b19d635a336725a88d279f76b939" +checksum = "430c5960624a4baaa511c9c0fcc2218e3b58f5dbcc47e6190cafee344b873333" dependencies = [ "atspi-common", "atspi-proxies", - "futures-lite 1.13.0", - "zbus 3.15.2", + "futures-lite", + "zbus", ] [[package]] name = "atspi-proxies" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6495661273703e7a229356dcbe8c8f38223d697aacfaf0e13590a9ac9977bb52" +checksum = "a5e6c5de3e524cf967569722446bcd458d5032348554d9a17d7d72b041ab7496" dependencies = [ "atspi-common", "serde", - "zbus 3.15.2", + "zbus", + "zvariant", ] [[package]] @@ -592,7 +527,7 @@ dependencies = [ "async-channel", "async-task", "futures-io", - "futures-lite 2.3.0", + "futures-lite", "piper", ] @@ -604,22 +539,22 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -636,9 +571,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "bytesize" @@ -654,8 +589,8 @@ checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ "bitflags 2.6.0", "log", - "polling 3.7.3", - "rustix 0.38.37", + "polling", + "rustix", "slab", "thiserror", ] @@ -667,16 +602,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ "calloop", - "rustix 0.38.37", + "rustix", "wayland-backend", "wayland-client", ] [[package]] name = "cc" -version = "1.1.24" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "jobserver", "libc", @@ -861,17 +796,6 @@ dependencies = [ "regex", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.10.7" @@ -1059,7 +983,7 @@ dependencies = [ "egui", "glow", "log", - "memoffset 0.9.1", + "memoffset", "wasm-bindgen", "web-sys", ] @@ -1109,7 +1033,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1130,7 +1054,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1141,7 +1065,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1190,23 +1114,6 @@ version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "event-listener" version = "5.3.1" @@ -1224,7 +1131,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" dependencies = [ - "event-listener 5.3.1", + "event-listener", "pin-project-lite", ] @@ -1243,15 +1150,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "fastrand" version = "2.1.1" @@ -1301,7 +1199,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -1321,39 +1219,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-lite" -version = "1.13.0" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" @@ -1361,7 +1244,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.1.1", + "fastrand", "futures-core", "futures-io", "parking", @@ -1370,32 +1253,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-io", @@ -1435,15 +1318,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "gl_generator" @@ -1458,9 +1343,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4a888dbe8181a7535853469c21c67ca9a1cea9460b16808fc018ea9e55d248" +checksum = "d51fa363f025f5c111e03f13eda21162faeacb6911fe8caa0c0349f9cf0c4483" dependencies = [ "js-sys", "slotmap", @@ -1546,12 +1431,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hermit-abi" version = "0.4.0" @@ -1631,9 +1510,9 @@ dependencies = [ [[package]] name = "image" -version = "0.25.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10" +checksum = "bc144d44a31d753b02ce64093d532f55ff8dc4ebf2ffb8a63c0dda691385acae" dependencies = [ "bytemuck", "byteorder-lite", @@ -1643,9 +1522,9 @@ dependencies = [ [[package]] name = "immutable-chunkmap" -version = "2.0.5" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4419f022e55cc63d5bbd6b44b71e1d226b9c9480a47824c706e9d54e5c40c5eb" +checksum = "12f97096f508d54f8f8ab8957862eee2ccd628847b6217af1a335e1c44dee578" dependencies = [ "arrayvec", ] @@ -1658,26 +1537,7 @@ checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "windows-sys 0.48.0", + "serde", ] [[package]] @@ -1719,9 +1579,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1740,9 +1600,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libloading" @@ -1756,21 +1616,15 @@ dependencies = [ [[package]] name = "libredox" -version = "0.0.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.6.0", "libc", - "redox_syscall 0.4.1", + "redox_syscall 0.5.7", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1814,12 +1668,15 @@ dependencies = [ "egui_plot", "ewebsock", "humantime", + "indexmap", "log", "rfd", + "ringbuffer", "serde", "serde_json", "tokio_with_wasm", "url", + "uuid", "wasm-bindgen-futures", "web-sys", ] @@ -1839,15 +1696,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.1" @@ -1913,18 +1761,6 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", -] - [[package]] name = "nix" version = "0.29.0" @@ -1935,7 +1771,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", - "memoffset 0.9.1", + "memoffset", ] [[package]] @@ -1968,10 +1804,10 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2179,27 +2015,24 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "orbclient" -version = "0.3.47" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" +checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" dependencies = [ "libredox", ] @@ -2216,9 +2049,9 @@ dependencies = [ [[package]] name = "owned_ttf_parser" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490d3a563d3122bf7c911a59b0add9389e5ec0f5f0c3ac6b91ff235a0e6a7f90" +checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" dependencies = [ "ttf-parser", ] @@ -2266,22 +2099,22 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2303,7 +2136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.1", + "fastrand", "futures-io", ] @@ -2326,22 +2159,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "polling" version = "3.7.3" @@ -2350,9 +2167,9 @@ checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" dependencies = [ "cfg-if", "concurrent-queue", - "hermit-abi 0.4.0", + "hermit-abi", "pin-project-lite", - "rustix 0.38.37", + "rustix", "tracing", "windows-sys 0.59.0", ] @@ -2363,12 +2180,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "ppv-lite86" version = "0.2.20" @@ -2378,30 +2189,20 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - [[package]] name = "proc-macro-crate" version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.22.22", + "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -2414,11 +2215,21 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", "version_check", "yansi", ] +[[package]] +name = "quick-xml" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quick-xml" version = "0.36.2" @@ -2542,6 +2353,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ringbuffer" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6368f71f205ff9c33c076d170dd56ebf68e8161c733c0caa07a7a5509ed53" + [[package]] name = "ron" version = "0.8.1" @@ -2560,20 +2377,6 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - [[package]] name = "rustix" version = "0.38.37" @@ -2583,7 +2386,7 @@ dependencies = [ "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys 0.4.14", + "linux-raw-sys", "windows-sys 0.52.0", ] @@ -2616,29 +2419,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -2654,7 +2457,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2668,6 +2471,12 @@ dependencies = [ "digest", ] +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + [[package]] name = "shlex" version = "1.3.0" @@ -2726,7 +2535,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 0.38.37", + "rustix", "thiserror", "wayland-backend", "wayland-client", @@ -2758,16 +2567,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "static_assertions" version = "1.1.0" @@ -2776,20 +2575,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -2803,30 +2591,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", - "fastrand 2.1.1", + "fastrand", "once_cell", - "rustix 0.38.37", + "rustix", "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2846,9 +2634,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "pin-project-lite", @@ -2875,7 +2663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1fef2e92c3cba6bbf5b7ee3528302c01e21bd7378795bf7cc7eff17da9ecd70" dependencies = [ "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2884,17 +2672,6 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.22" @@ -2903,7 +2680,7 @@ checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", - "winnow 0.6.20", + "winnow", ] [[package]] @@ -2925,7 +2702,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -2939,9 +2716,9 @@ dependencies = [ [[package]] name = "ttf-parser" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" +checksum = "5902c5d130972a0000f60860bfbf46f7ca3db5391eddfedd1b8728bd9dc96c0e" [[package]] name = "tungstenite" @@ -2974,19 +2751,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.1", + "memoffset", "tempfile", "winapi", ] [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" @@ -3040,16 +2814,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] -name = "version_check" -version = "0.9.5" +name = "uuid" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +dependencies = [ + "getrandom", + "serde", + "sha1_smol", + "wasm-bindgen", +] [[package]] -name = "waker-fn" -version = "1.2.0" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" @@ -3069,9 +2849,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3080,24 +2860,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -3107,9 +2887,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3117,22 +2897,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wayland-backend" @@ -3142,7 +2922,7 @@ checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.37", + "rustix", "scoped-tls", "smallvec", "wayland-sys", @@ -3155,7 +2935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d" dependencies = [ "bitflags 2.6.0", - "rustix 0.38.37", + "rustix", "wayland-backend", "wayland-scanner", ] @@ -3177,7 +2957,7 @@ version = "0.31.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a94697e66e76c85923b0d28a0c251e8f0666f58fc47d316c0f4da6da75d37cb" dependencies = [ - "rustix 0.38.37", + "rustix", "wayland-client", "xcursor", ] @@ -3227,7 +3007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" dependencies = [ "proc-macro2", - "quick-xml", + "quick-xml 0.36.2", "quote", ] @@ -3245,9 +3025,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -3352,7 +3132,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -3363,7 +3143,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] [[package]] @@ -3631,7 +3411,7 @@ dependencies = [ "pin-project", "raw-window-handle", "redox_syscall 0.4.1", - "rustix 0.38.37", + "rustix", "smithay-client-toolkit", "smol_str", "tracing", @@ -3650,15 +3430,6 @@ dependencies = [ "xkbcommon-dl", ] -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.20" @@ -3690,7 +3461,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 0.38.37", + "rustix", "x11rb-protocol", ] @@ -3749,30 +3520,27 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zbus" -version = "3.15.2" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" dependencies = [ - "async-broadcast 0.5.1", + "async-broadcast", "async-executor", - "async-fs 1.6.0", - "async-io 1.13.0", - "async-lock 2.8.0", - "async-process 1.8.1", + "async-fs", + "async-io", + "async-lock", + "async-process", "async-recursion", "async-task", "async-trait", "blocking", - "byteorder", - "derivative", "enumflags2", - "event-listener 2.5.3", + "event-listener", "futures-core", "futures-sink", "futures-util", "hex", - "nix 0.26.4", - "once_cell", + "nix", "ordered-stream", "rand", "serde", @@ -3781,63 +3549,35 @@ dependencies = [ "static_assertions", "tracing", "uds_windows", - "winapi", + "windows-sys 0.52.0", "xdg-home", - "zbus_macros 3.15.2", - "zbus_names 2.6.1", - "zvariant 3.15.2", + "zbus_macros", + "zbus_names", + "zvariant", ] [[package]] -name = "zbus" -version = "4.4.0" +name = "zbus-lockstep" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +checksum = "4ca2c5dceb099bddaade154055c926bb8ae507a18756ba1d8963fd7b51d8ed1d" dependencies = [ - "async-broadcast 0.7.1", - "async-executor", - "async-fs 2.1.2", - "async-io 2.3.4", - "async-lock 3.4.0", - "async-process 2.3.0", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener 5.3.1", - "futures-core", - "futures-sink", - "futures-util", - "hex", - "nix 0.29.0", - "ordered-stream", - "rand", - "serde", - "serde_repr", - "sha1", - "static_assertions", - "tracing", - "uds_windows", - "windows-sys 0.52.0", - "xdg-home", - "zbus_macros 4.4.0", - "zbus_names 3.0.0", - "zvariant 4.2.0", + "zbus_xml", + "zvariant", ] [[package]] -name = "zbus_macros" -version = "3.15.2" +name = "zbus-lockstep-macros" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5" +checksum = "709ab20fc57cb22af85be7b360239563209258430bccf38d8b979c5a2ae3ecce" dependencies = [ - "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "regex", - "syn 1.0.109", - "zvariant_utils 1.0.1", + "syn", + "zbus-lockstep", + "zbus_xml", + "zvariant", ] [[package]] @@ -3846,33 +3586,35 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.79", - "zvariant_utils 2.1.0", + "syn", + "zvariant_utils", ] [[package]] name = "zbus_names" -version = "2.6.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", - "zvariant 3.15.2", + "zvariant", ] [[package]] -name = "zbus_names" -version = "3.0.0" +name = "zbus_xml" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +checksum = "ab3f374552b954f6abb4bd6ce979e6c9b38fb9d0cd7cc68a7d796e70c9f3a233" dependencies = [ + "quick-xml 0.30.0", "serde", "static_assertions", - "zvariant 4.2.0", + "zbus_names", + "zvariant", ] [[package]] @@ -3893,21 +3635,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", -] - -[[package]] -name = "zvariant" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db" -dependencies = [ - "byteorder", - "enumflags2", - "libc", - "serde", - "static_assertions", - "zvariant_derive 3.15.2", + "syn", ] [[package]] @@ -3921,20 +3649,7 @@ dependencies = [ "serde", "static_assertions", "url", - "zvariant_derive 4.2.0", -] - -[[package]] -name = "zvariant_derive" -version = "3.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", - "zvariant_utils 1.0.1", + "zvariant_derive", ] [[package]] @@ -3943,22 +3658,11 @@ version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" dependencies = [ - "proc-macro-crate 3.2.0", - "proc-macro2", - "quote", - "syn 2.0.79", - "zvariant_utils 2.1.0", -] - -[[package]] -name = "zvariant_utils" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" -dependencies = [ + "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn", + "zvariant_utils", ] [[package]] @@ -3969,5 +3673,5 @@ checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn", ] diff --git a/src/webpage/Cargo.toml b/src/webpage/Cargo.toml index 89a91d39..29d30c82 100644 --- a/src/webpage/Cargo.toml +++ b/src/webpage/Cargo.toml @@ -30,6 +30,9 @@ tokio_with_wasm = "0.7.1" url = "2.5.2" wasm-bindgen-futures = "0.4" web-sys = { version = "0.3", features = ["Window", "Location"] } +indexmap = { version = "2.6.0", features = [ "serde" ]} +ringbuffer = "0.15.0" +uuid = { version = "1", default-features = false, features = ["v5", "v4", "serde", "js"] } eframe = { version = "0.29", default-features = false, features = [ "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. diff --git a/src/webpage/src/app.rs b/src/webpage/src/app.rs index a82897b9..423d4e01 100644 --- a/src/webpage/src/app.rs +++ b/src/webpage/src/app.rs @@ -3,83 +3,42 @@ use std::collections::BTreeMap; use chrono::prelude::*; use eframe::egui::{CollapsingHeader, Context}; use egui_plot::{Line, Plot, PlotPoints}; -use ewebsock::{connect, WsReceiver, WsSender}; +use ewebsock::{connect, WsReceiver}; use humantime::format_duration; +use ringbuffer::RingBuffer; use url::Url; use web_sys::window; -type VehiclesMessages = BTreeMap>>; -type MessagesStats = BTreeMap>>; +use crate::{ + messages::{FieldInfo, MessageInfo, VehiclesMessages}, + stats::{ + drivers_stats::{DriversStatsHistorical, DriversStatsSample}, + hub_messages_stats::{HubMessagesStatsHistorical, HubMessagesStatsSample}, + hub_stats::{HubStatsHistorical, HubStatsSample}, + }, +}; pub struct App { now: DateTime, mavlink_receiver: WsReceiver, - mavlink_sender: WsSender, - stats_receiver: WsReceiver, - stats_sender: WsSender, + hub_messages_stats_receiver: WsReceiver, + hub_stats_receiver: WsReceiver, + drivers_stats_receiver: WsReceiver, + /// Realtime messages, grouped by Vehicle ID and Component ID vehicles_mavlink: VehiclesMessages, - messages_stats: MessagesStats, + /// Hub messages statsistics, groupbed by Vehicle ID and Component ID + hub_messages_stats: HubMessagesStatsHistorical, + /// Hub statistics + hub_stats: HubStatsHistorical, + /// Driver statistics + drivers_stats: DriversStatsHistorical, search_query: String, collapse_all: bool, expand_all: bool, } -#[derive(Clone)] -struct MessageInfo { - last_sample_time: DateTime, - fields: BTreeMap, -} - -#[derive(Clone)] -struct MessageStats { - last_message: Option, - last_update_us: DateTime, - messages: u64, - bytes: u64, - delay: u64, - fields: BTreeMap, -} - -impl MessageStats { - fn update_with(&mut self, other: &MessageStats) { - self.last_message = other.last_message.clone(); - self.last_update_us = other.last_update_us.clone(); - self.messages = other.messages; - self.bytes = other.bytes; - self.delay = other.delay; - - for (value, field) in [ - (self.messages, "messages"), - (self.bytes, "bytes"), - (self.delay, "delay"), - ] { - self.fields.get_mut(field).unwrap().latest_value = value as f64; - self.fields - .get_mut(field) - .unwrap() - .history - .push((self.last_update_us, value as f64)); - if self.fields.get_mut(field).unwrap().history.len() > 1000 { - self.fields.get_mut(field).unwrap().history.remove(0); - } - } - } -} - -#[derive(Clone)] -struct LastMessage { - origin: String, - timestamp: u64, -} - -#[derive(Clone)] -struct FieldInfo { - history: Vec<(DateTime, f64)>, - latest_value: f64, -} - -impl App { - pub fn new() -> Self { +impl Default for App { + fn default() -> Self { let location = window().unwrap().location(); let host = location.host().unwrap(); let protocol = if location.protocol().unwrap() == "https:" { @@ -89,13 +48,25 @@ impl App { }; let url = format!("{protocol}//{host}/rest/ws"); - let (mavlink_sender, mavlink_receiver) = { + let (_, mavlink_receiver) = { + let url = Url::parse(&url).unwrap().to_string(); + connect(url, ewebsock::Options::default()).expect("Can't connect") + }; + + let url = format!("{protocol}//{host}/stats/messages/ws"); + let (_, hub_messages_stats_receiver) = { + let url = Url::parse(&url).unwrap().to_string(); + connect(url, ewebsock::Options::default()).expect("Can't connect") + }; + + let url = format!("{protocol}//{host}/stats/hub/ws"); + let (_, hub_stats_receiver) = { let url = Url::parse(&url).unwrap().to_string(); connect(url, ewebsock::Options::default()).expect("Can't connect") }; - let url = format!("{protocol}//{host}/stats/ws?frequency=20"); - let (stats_sender, stats_receiver) = { + let url = format!("{protocol}//{host}/stats/drivers/ws"); + let (_, drivers_stats_receiver) = { let url = Url::parse(&url).unwrap().to_string(); connect(url, ewebsock::Options::default()).expect("Can't connect") }; @@ -103,17 +74,21 @@ impl App { Self { now: Utc::now(), mavlink_receiver, - mavlink_sender, - stats_receiver, - stats_sender, + hub_messages_stats_receiver, + hub_stats_receiver, + drivers_stats_receiver, vehicles_mavlink: Default::default(), - messages_stats: Default::default(), + hub_messages_stats: Default::default(), + hub_stats: Default::default(), + drivers_stats: Default::default(), search_query: String::new(), collapse_all: false, expand_all: false, } } +} +impl App { fn top_bar(&mut self, ctx: &Context) { eframe::egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { eframe::egui::menu::bar(ui, |ui| { @@ -182,120 +157,71 @@ impl App { let Some(num) = extract_number(value) else { continue; }; - let field_info = message_info + let new_entry = (self.now, num); + message_info .fields .entry(field_name.clone()) - .or_insert_with(|| FieldInfo { - history: Vec::new(), - latest_value: num, + .and_modify(|field| { + field.history.push(new_entry); + }) + .or_insert_with(|| { + let mut field_info = FieldInfo::default(); + field_info.history.push(new_entry); + field_info }); - field_info.latest_value = num; - field_info.history.push((self.now, num)); - if field_info.history.len() > 1000 { - field_info.history.remove(0); - } } } } - fn process_stats_websocket(&mut self) { + fn process_hub_messages_stats_websocket(&mut self) { while let Some(ewebsock::WsEvent::Message(ewebsock::WsMessage::Text(message))) = - self.stats_receiver.try_recv() + self.hub_messages_stats_receiver.try_recv() { // Parse the JSON message - let root_json = match serde_json::from_str::(&message) { - Ok(json) => json, - Err(e) => { - log::error!("Failed to parse JSON: {e}"); - continue; - } - }; - - // Extract "systems_messages_stats" - let systems_messages_stats = match root_json.get("systems_messages_stats") { - Some(value) => match value.as_object() { - Some(obj) => obj, - None => { - log::error!("'systems_messages_stats' is not an object"); + let hub_messages_stats_sample = + match serde_json::from_str::(&message) { + Ok(stats) => stats, + Err(error) => { + log::error!("Failed to parse stats message: {error:?}"); continue; } - }, - None => { - log::error!("'systems_messages_stats' key not found"); + }; + + self.hub_messages_stats.update(hub_messages_stats_sample) + } + } + + fn process_hub_stats_websocket(&mut self) { + while let Some(ewebsock::WsEvent::Message(ewebsock::WsMessage::Text(message))) = + self.hub_stats_receiver.try_recv() + { + // Parse the JSON message + let hub_stats_sample = match serde_json::from_str::(&message) { + Ok(stats) => stats, + Err(error) => { + log::error!("Failed to parse stats message: {error:?}"); continue; } }; - for (system_id_str, system_stats) in systems_messages_stats { - let system_id = match system_id_str.parse::() { - Ok(id) => id, - Err(_) => { - log::error!("Invalid system_id: {system_id_str}"); - continue; - } - }; - - let components_messages_stats = match system_stats.get("components_messages_stats") - { - Some(value) => match value.as_object() { - Some(obj) => obj, - None => { - log::error!("'components_messages_stats' is not an object"); - continue; - } - }, - None => { - log::error!("'components_messages_stats' key not found"); - continue; - } - }; + self.hub_stats.update(hub_stats_sample) + } + } - for (component_id_str, component_stats) in components_messages_stats { - let component_id = match component_id_str.parse::() { - Ok(id) => id, - Err(_) => { - log::error!("Invalid component_id: {component_id_str}"); - continue; - } - }; - - let messages_stats = match component_stats.get("messages_stats") { - Some(value) => match value.as_object() { - Some(obj) => obj, - None => { - log::error!("'messages_stats' is not an object"); - continue; - } - }, - None => { - log::error!("'messages_stats' key not found"); - continue; - } - }; - - for (message_id_str, message_stats_json) in messages_stats { - let message_id = match message_id_str.parse::() { - Ok(id) => id, - Err(_) => { - log::error!("Invalid message_id: {message_id_str}"); - continue; - } - }; - - let message_stats = parse_message_stats(message_stats_json); - self.messages_stats - .entry(system_id) - .or_default() - .entry(component_id) - .or_default() - .entry(message_id) // Now using u16 - .and_modify(|existing| { - existing.update_with(&message_stats); - }) - .or_insert(message_stats); - } + fn process_drivers_stats_websocket(&mut self) { + while let Some(ewebsock::WsEvent::Message(ewebsock::WsMessage::Text(message))) = + self.drivers_stats_receiver.try_recv() + { + // Parse the JSON message + let drivers_stats_sample = match serde_json::from_str::(&message) { + Ok(stats) => stats, + Err(error) => { + log::error!("Failed to parse stats message: {error:?}"); + continue; } - } + }; + + self.drivers_stats.update(drivers_stats_sample) } } @@ -374,21 +300,13 @@ impl App { message_header.show(ui, |ui| { for (field_name, field_info) in &matching_fields { - let field_value_str = format!( - "{field_name}: {}", - field_info.latest_value - ); - let label = ui.label(field_value_str); - - if label.hovered() { - show_stats_tooltip(ui, field_info, field_name); - } + add_label_with_graph(ui, field_info, field_name); } ui.label( format_duration( (self.now - message.last_sample_time) .to_std() - .unwrap(), + .unwrap_or_default(), ) .to_string() + " Ago", @@ -403,26 +321,26 @@ impl App { }); } - fn create_messages_stats_ui(&mut self, ui: &mut eframe::egui::Ui) { + fn create_hub_messages_stats_ui(&mut self, ui: &mut eframe::egui::Ui) { eframe::egui::ScrollArea::vertical() .id_salt("scroll_messages_stats") .show(ui, |ui| { - for (system_id, components) in &self.messages_stats { + for (system_id, components) in &self.hub_messages_stats.systems_messages_stats { let vehicle_id = ui.make_persistent_id(format!("vehicle_{system_id}")); - let vehicle_header = CollapsingHeader::new(format!("Vehicle {system_id}")) + let vehicle_header = CollapsingHeader::new(format!("Vehicle ID: {system_id}")) .id_salt(vehicle_id) .default_open(true); vehicle_header.show(ui, |ui| { - for (component_id, messages) in components { + for (component_id, messages) in &components.components_messages_stats { let component_id_str = format!("component_{system_id}_{component_id}"); let component_id_hash = ui.make_persistent_id(&component_id_str); let component_header = - CollapsingHeader::new(format!("Component {component_id}")) + CollapsingHeader::new(format!("Component ID: {component_id}")) .id_salt(component_id_hash) .default_open(true); component_header.show(ui, |ui| { - for (message_id, message_stats) in messages { + for (message_id, message_stats) in &messages.messages_stats { let message_id_str = format!("message_{system_id}_{component_id}_{message_id}"); let message_id_hash = ui.make_persistent_id(&message_id_str); @@ -438,47 +356,56 @@ impl App { } message_header.show(ui, |ui| { - let label = ui - .label(format!("Messages: {}", message_stats.messages)); - if label.hovered() { - show_stats_tooltip( - ui, - &message_stats.fields["messages"], - "Messages", - ); - } - let label = - ui.label(format!("Bytes: {}", message_stats.bytes)); - if label.hovered() { - show_stats_tooltip( - ui, - &message_stats.fields["bytes"], - "Bytes", - ); - } - let label = - ui.label(format!("Delay: {}", message_stats.delay)); - if label.hovered() { - show_stats_tooltip( - ui, - &message_stats.fields["delay"], - "Delay", - ); - } + // Messages stats + add_label_with_graph( + ui, + &message_stats.messages.total_messages, + "Messages", + ); + add_label_with_graph( + ui, + &message_stats.messages.messages_per_second, + "Messages/s", + ); - if let Some(last_message) = &message_stats.last_message { - ui.label(format!("Origin: {}", last_message.origin)); - ui.label(format!( - "Timestamp: {}", - last_message.timestamp - )); - } + // Bytes stats + add_label_with_graph( + ui, + &message_stats.bytes.total_bytes, + "Bytes:", + ); + add_label_with_graph( + ui, + &message_stats.bytes.bytes_per_second, + "Bytes/s", + ); + add_label_with_graph( + ui, + &message_stats.bytes.average_bytes_per_second, + "Avg Bytes", + ); + + // Delay stats + add_label_with_graph( + ui, + &message_stats.delay_stats.delay, + "Delay:", + ); + add_label_with_graph( + ui, + &message_stats.delay_stats.jitter, + "Jitter:", + ); ui.label( format_duration( - (self.now - message_stats.last_update_us) - .to_std() - .unwrap(), + (self.now + - chrono::DateTime::from_timestamp_micros( + message_stats.last_message_time_us as i64, + ) + .unwrap_or_default()) + .to_std() + .unwrap_or_default(), ) .to_string() + " Ago", @@ -491,13 +418,47 @@ impl App { } }); } + + fn create_hub_stats_ui(&mut self, ui: &mut eframe::egui::Ui) { + eframe::egui::ScrollArea::vertical() + .id_salt("scroll_hub_stats") + .show(ui, |ui| { + // for (system_id, components) in &self.hub_stats. + dbg!(&self.hub_stats); + }); + } + + fn create_drivers_stats_ui(&mut self, ui: &mut eframe::egui::Ui) { + eframe::egui::ScrollArea::vertical() + .id_salt("scroll_drivers_stats") + .show(ui, |ui| { + // for (driver_uuid, driver_stats) in &self.drivers_stats. + dbg!(&self.drivers_stats); + }); + } +} + +fn add_label_with_graph(ui: &mut egui::Ui, field_info: &FieldInfo, field_name: &str) +where + f64: std::convert::From, + T: Copy + std::fmt::Display + std::fmt::Debug, +{ + let label = ui.label(format!( + "{field_name}: {:.2}", + field_info.history.back().unwrap().1 + )); + if label.hovered() { + show_stats_tooltip(ui, field_info, field_name); + } } impl eframe::App for App { fn update(&mut self, ctx: &Context, _frame: &mut eframe::Frame) { self.now = Utc::now(); self.process_mavlink_websocket(); - self.process_stats_websocket(); + self.process_hub_messages_stats_websocket(); + self.process_hub_stats_websocket(); + self.process_drivers_stats_websocket(); self.top_bar(ctx); @@ -523,7 +484,7 @@ impl eframe::App for App { }); self.create_messages_ui(ui); - //self.create_messages_stats_ui(ui); + // Reset collapse and expand flags if self.expand_all || self.collapse_all { self.expand_all = false; @@ -532,7 +493,12 @@ impl eframe::App for App { }); eframe::egui::CentralPanel::default().show(ctx, |ui| { - self.create_messages_stats_ui(ui); + self.create_hub_messages_stats_ui(ui); + }); + + eframe::egui::SidePanel::right("right_panel").show(ctx, |ui| { + self.create_hub_stats_ui(ui); + self.create_drivers_stats_ui(ui); }); ctx.request_repaint(); @@ -544,27 +510,29 @@ fn extract_number(value: &serde_json::Value) -> Option { Some(num) } else if let Some(num) = value.as_i64() { Some(num as f64) - } else if let Some(num) = value.as_u64() { - Some(num as f64) } else { - None + value.as_u64().map(|num| num as f64) } } -fn show_stats_tooltip(ui: &mut eframe::egui::Ui, field_info: &FieldInfo, field_name: &str) { +fn show_stats_tooltip(ui: &mut eframe::egui::Ui, field_info: &FieldInfo, field_name: &str) +where + f64: std::convert::From, + T: Copy + std::fmt::Debug, +{ eframe::egui::show_tooltip(ui.ctx(), ui.layer_id(), ui.id(), |ui| { let points: PlotPoints = field_info .history .iter() .map(|(time, value)| { let timestamp = time.timestamp_millis() as f64; - [timestamp, *value] + [timestamp, f64::from(*value)] }) .collect(); - let line = Line::new(points).name(field_name.clone()); + let line = Line::new(points).name(field_name); - Plot::new(field_name.clone()) + Plot::new(field_name) .view_aspect(2.0) .x_axis_formatter(|x, _range| { let datetime = DateTime::from_timestamp_millis(x.value as i64); @@ -587,71 +555,3 @@ fn show_stats_tooltip(ui: &mut eframe::egui::Ui, field_info: &FieldInfo, field_n }); }); } - -fn parse_message_stats(message_stats_json: &serde_json::Value) -> MessageStats { - let last_message = message_stats_json.get("last_message").and_then(|lm| { - Some(LastMessage { - origin: lm - .get("origin") - .and_then(|o| o.as_str()) - .unwrap_or("") - .to_string(), - timestamp: lm.get("timestamp").and_then(|t| t.as_u64()).unwrap_or(0), - }) - }); - - let last_time_us = message_stats_json - .get("last_update_us") - .and_then(|v| v.as_u64()) - .unwrap_or(0); - let last_update_us = us_since_epoch_to_utc(last_time_us); - let messages = message_stats_json - .get("messages") - .and_then(|v| v.as_u64()) - .unwrap_or(0); - let bytes = message_stats_json - .get("bytes") - .and_then(|v| v.as_u64()) - .unwrap_or(0); - let delay = message_stats_json - .get("delay") - .and_then(|v| v.as_u64()) - .unwrap_or(0); - - MessageStats { - last_message, - last_update_us: last_update_us, - messages, - bytes, - delay, - fields: BTreeMap::from([ - ( - "messages".to_string(), - FieldInfo { - history: vec![(last_update_us, messages as f64)], - latest_value: messages as f64, - }, - ), - ( - "bytes".to_string(), - FieldInfo { - history: vec![(last_update_us, bytes as f64)], - latest_value: bytes as f64, - }, - ), - ( - "delay".to_string(), - FieldInfo { - history: vec![(last_update_us, delay as f64)], - latest_value: delay as f64, - }, - ), - ]), - } -} - -fn us_since_epoch_to_utc(us: u64) -> DateTime { - let sec = (us / 1_000_000) as i64; - let nsec = ((us % 1_000_000) * 1_000) as u32; - Utc.timestamp_opt(sec, nsec).unwrap() -} diff --git a/src/webpage/src/lib.rs b/src/webpage/src/lib.rs index 27de78f4..4d4a3037 100644 --- a/src/webpage/src/lib.rs +++ b/src/webpage/src/lib.rs @@ -1,4 +1,6 @@ #![warn(clippy::all, rust_2018_idioms)] mod app; +mod messages; +mod stats; pub use app::App; diff --git a/src/webpage/src/main.rs b/src/webpage/src/main.rs index be2f8122..81fa9959 100644 --- a/src/webpage/src/main.rs +++ b/src/webpage/src/main.rs @@ -22,7 +22,7 @@ fn main() { .start( canvas, web_options, - Box::new(|_cc| Ok(Box::new(mavlink_server_frontend::App::new()))), + Box::new(|_cc| Ok(Box::new(mavlink_server_frontend::App::default()))), ) .await .expect("failed to start eframe"); diff --git a/src/webpage/src/messages.rs b/src/webpage/src/messages.rs new file mode 100644 index 00000000..2d3d4abd --- /dev/null +++ b/src/webpage/src/messages.rs @@ -0,0 +1,23 @@ +use std::collections::BTreeMap; + +use chrono::{DateTime, Utc}; +use ringbuffer::ConstGenericRingBuffer; + +const BUFFERS_CAPACITY: usize = 128; + +pub type VehiclesMessages = BTreeMap>>; + +#[derive(Clone)] +pub struct MessageInfo { + pub last_sample_time: DateTime, + pub fields: BTreeMap>, +} + +#[derive(Clone, Default, Debug)] +pub struct FieldInfo +where + f64: std::convert::From, + T: Copy + std::fmt::Debug, +{ + pub history: ConstGenericRingBuffer<(DateTime, T), BUFFERS_CAPACITY>, +} diff --git a/src/webpage/src/stats/drivers_stats.rs b/src/webpage/src/stats/drivers_stats.rs new file mode 100644 index 00000000..5031b8fd --- /dev/null +++ b/src/webpage/src/stats/drivers_stats.rs @@ -0,0 +1,60 @@ +use indexmap::IndexMap; +use serde::Deserialize; + +use super::{ + ByteStatsHistorical, ByteStatsSample, DelayStatsHistorical, DelayStatsSample, + MessageStatsHistorical, MessageStatsSample, StatsInner, +}; + +pub type DriverUuid = uuid::Uuid; + +pub type DriversStatsSample = DriversStats; +pub type DriversStatsHistorical = + DriversStats; + +#[derive(Default, Clone, Debug, Deserialize)] +pub struct DriversStats { + pub drivers_stats: IndexMap>, +} + +#[derive(Default, Debug, Clone, Deserialize)] +pub struct DriverStats { + pub name: String, + pub driver_type: String, + pub stats: DriverStatsInner, +} + +#[derive(Default, Debug, Clone, Deserialize)] +pub struct DriverStatsInner { + pub input: Option>, + pub output: Option>, +} + +impl DriversStatsHistorical { + pub fn update(&mut self, sample: DriversStatsSample) { + let now = chrono::Utc::now(); + + for (driver_uuid, sample_driver_stats) in sample.drivers_stats { + let driver_stats = &mut self + .drivers_stats + .entry(driver_uuid) + .or_insert(DriverStats { + name: sample_driver_stats.name, + driver_type: sample_driver_stats.driver_type, + stats: Default::default(), + }); + + if let Some(sample_input_stats) = sample_driver_stats.stats.input { + if let Some(input_stats) = driver_stats.stats.input.as_mut() { + input_stats.update(now, sample_input_stats); + } + } + + if let Some(sample_output_stats) = sample_driver_stats.stats.output { + if let Some(output_stats) = driver_stats.stats.input.as_mut() { + output_stats.update(now, sample_output_stats); + } + } + } + } +} diff --git a/src/webpage/src/stats/hub_messages_stats.rs b/src/webpage/src/stats/hub_messages_stats.rs new file mode 100644 index 00000000..8c7ad44a --- /dev/null +++ b/src/webpage/src/stats/hub_messages_stats.rs @@ -0,0 +1,58 @@ +use indexmap::IndexMap; +use serde::Deserialize; + +use super::{ + ByteStatsHistorical, ByteStatsSample, ComponentId, DelayStatsHistorical, DelayStatsSample, + MessageId, MessageStatsHistorical, MessageStatsSample, StatsInner, SystemId, +}; + +pub type HubMessagesStatsSample = + HubMessagesStats; +pub type HubMessagesStatsHistorical = + HubMessagesStats; + +#[derive(Default, Clone, Debug, Deserialize)] +pub struct HubMessagesStats { + pub systems_messages_stats: IndexMap>, +} + +#[derive(Default, Clone, Debug, Deserialize)] +pub struct SystemMessagesStats { + pub components_messages_stats: IndexMap>, +} + +#[derive(Default, Clone, Debug, Deserialize)] +pub struct ComponentMessageStats { + pub messages_stats: IndexMap>, +} + +impl HubMessagesStatsHistorical { + pub fn update(&mut self, sample: HubMessagesStatsSample) { + let now = chrono::Utc::now(); + + for (system_id, sample_system_stats) in sample.systems_messages_stats { + // System stats + let system_stats = self.systems_messages_stats.entry(system_id).or_default(); + + for (component_id, sample_component_stats) in + sample_system_stats.components_messages_stats + { + // Component stats + let component_stats = system_stats + .components_messages_stats + .entry(component_id) + .or_default(); + + for (message_id, sample_message_stats) in sample_component_stats.messages_stats { + // Message stats + let message_stats = component_stats + .messages_stats + .entry(message_id) + .or_default(); + + message_stats.update(now, sample_message_stats); + } + } + } + } +} diff --git a/src/webpage/src/stats/hub_stats.rs b/src/webpage/src/stats/hub_stats.rs new file mode 100644 index 00000000..e041b80a --- /dev/null +++ b/src/webpage/src/stats/hub_stats.rs @@ -0,0 +1,23 @@ +use serde::Deserialize; + +use super::{ + ByteStatsHistorical, ByteStatsSample, DelayStatsHistorical, DelayStatsSample, + MessageStatsHistorical, MessageStatsSample, StatsInner, +}; + +pub type HubStatsSample = HubStats; +pub type HubStatsHistorical = + HubStats; + +#[derive(Default, Clone, Debug, Deserialize)] +pub struct HubStats { + pub stats: StatsInner, +} + +impl HubStatsHistorical { + pub fn update(&mut self, sample: HubStatsSample) { + let now = chrono::Utc::now(); + + self.stats.update(now, sample.stats); + } +} diff --git a/src/webpage/src/stats/mod.rs b/src/webpage/src/stats/mod.rs new file mode 100644 index 00000000..e48d5655 --- /dev/null +++ b/src/webpage/src/stats/mod.rs @@ -0,0 +1,109 @@ +use chrono::{DateTime, Utc}; +use ringbuffer::RingBuffer; +use serde::Deserialize; + +use crate::messages::FieldInfo; + +pub mod drivers_stats; +pub mod hub_messages_stats; +pub mod hub_stats; + +pub type SystemId = u8; +pub type ComponentId = u8; +pub type MessageId = u32; + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct StatsInner { + pub last_message_time_us: u64, + pub bytes: B, + pub messages: M, + pub delay_stats: D, +} + +impl StatsInner { + fn update( + &mut self, + now: DateTime, + sample_stats: StatsInner, + ) { + // Update ByteStats + self.bytes + .total_bytes + .history + .push((now, sample_stats.bytes.total_bytes)); + self.bytes + .bytes_per_second + .history + .push((now, sample_stats.bytes.bytes_per_second)); + self.bytes + .average_bytes_per_second + .history + .push((now, sample_stats.bytes.average_bytes_per_second)); + + // // Update MessageStats + self.messages + .total_messages + .history + .push((now, sample_stats.messages.total_messages)); + self.messages + .messages_per_second + .history + .push((now, sample_stats.messages.messages_per_second)); + self.messages + .average_messages_per_second + .history + .push((now, sample_stats.messages.average_messages_per_second)); + + // // Update DelayStats + self.delay_stats + .delay + .history + .push((now, sample_stats.delay_stats.delay)); + self.delay_stats + .jitter + .history + .push((now, sample_stats.delay_stats.jitter)); + + self.last_message_time_us = sample_stats.last_message_time_us; + } +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct ByteStatsSample { + pub total_bytes: u32, + pub bytes_per_second: f64, + pub average_bytes_per_second: f64, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct MessageStatsSample { + pub total_messages: u32, + pub messages_per_second: f64, + pub average_messages_per_second: f64, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct DelayStatsSample { + pub delay: f64, + pub jitter: f64, +} + +#[derive(Debug, Clone, Default)] +pub struct ByteStatsHistorical { + pub total_bytes: FieldInfo, + pub bytes_per_second: FieldInfo, + pub average_bytes_per_second: FieldInfo, +} + +#[derive(Debug, Clone, Default)] +pub struct MessageStatsHistorical { + pub total_messages: FieldInfo, + pub messages_per_second: FieldInfo, + pub average_messages_per_second: FieldInfo, +} + +#[derive(Debug, Clone, Default)] +pub struct DelayStatsHistorical { + pub delay: FieldInfo, + pub jitter: FieldInfo, +}