From 39a4f29a2a4d07c9e4672898acf25d38de834b57 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 28 Dec 2023 20:05:18 +0100 Subject: [PATCH 001/109] Update dependencies --- Cargo.lock | 817 +++++++++++++++++++---------------------- Cargo.toml | 4 +- cove-config/Cargo.toml | 2 +- cove-input/Cargo.toml | 2 +- cove-macro/Cargo.toml | 4 +- cove/Cargo.toml | 28 +- 6 files changed, 406 insertions(+), 451 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b029739..1ed64bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,20 +19,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -45,9 +46,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -59,49 +60,49 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2", "quote", @@ -131,15 +132,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.1" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bitflags" @@ -149,9 +144,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -162,23 +157,17 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "case" @@ -213,20 +202,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.1" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.1" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstream", "anstyle", @@ -236,9 +224,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", @@ -248,9 +236,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -260,9 +248,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "cookie" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "time", "version_check", @@ -270,9 +258,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -280,9 +268,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cove" @@ -307,7 +295,7 @@ dependencies = [ "thiserror", "time", "tokio", - "tokio-tungstenite 0.20.0", + "tokio-tungstenite", "toss", "unicode-segmentation", "unicode-width", @@ -351,9 +339,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -364,7 +352,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "crossterm_winapi", "libc", "mio", @@ -395,16 +383,17 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ + "powerfmt", "serde", ] @@ -436,14 +425,14 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "edit" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c562aa71f7bc691fde4c6bf5f93ae5a5298b617c2eb44c76c87832299a17fbb4" +checksum = "f364860e764787163c8c8f58231003839be31276e821e2ad2092ddf496b1aa09" dependencies = [ "tempfile", "which", @@ -463,29 +452,18 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] name = "euphoxide" -version = "0.4.0" -source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.4.0#fa6c8cdce9dd7e5f38e333e35ca975cfcdd60cd2" +version = "0.5.0" +source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.5.0#276ff685127c4c392a2ab001f80f7a053e58746b" dependencies = [ "async-trait", "caseless", @@ -498,15 +476,15 @@ dependencies = [ "time", "tokio", "tokio-stream", - "tokio-tungstenite 0.18.0", + "tokio-tungstenite", "unicode-normalization", ] [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fallible-streaming-iterator" @@ -516,9 +494,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fnv" @@ -528,36 +506,36 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-sink", @@ -579,9 +557,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -590,15 +568,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", @@ -621,15 +599,24 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] [[package]] name = "http" -version = "0.2.9" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" dependencies = [ "bytes", "fnv", @@ -644,9 +631,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -654,9 +641,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown", @@ -683,30 +670,32 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall", +] [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "cc", "pkg-config", @@ -724,15 +713,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -746,9 +735,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.2" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "miniz_oxide" @@ -761,21 +750,21 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -792,24 +781,24 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "open" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8" +checksum = "90878fb664448b54c4e592455ad02831e23a3f7e157374a8b95654731aac7349" dependencies = [ "is-wsl", "libc", @@ -830,9 +819,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" dependencies = [ "num-traits", ] @@ -849,15 +838,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -868,9 +857,9 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" @@ -886,9 +875,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -898,9 +893,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -946,38 +941,29 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.9.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -987,9 +973,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -998,32 +984,31 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "ring" -version = "0.16.20" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "rusqlite" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" +checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1040,85 +1025,84 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.10" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.20.9" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "fe6b63262c9fcac8659abfaa96cac103d28166d3ff3eaf8f412e19f3ae9e5a48" dependencies = [ "log", "ring", + "rustls-pki-types", "rustls-webpki", - "sct", + "subtle", + "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.6.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", "rustls-pemfile", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" dependencies = [ - "base64 0.21.3", + "base64", + "rustls-pki-types", ] [[package]] -name = "rustls-webpki" -version = "0.101.4" +name = "rustls-pki-types" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" + +[[package]] +name = "rustls-webpki" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de2635c8bc2b88d367767c5de8ea1d8db9af3f6219eba28442242d9ab81d1b89" dependencies = [ "ring", + "rustls-pki-types", "untrusted", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1127,16 +1111,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -1162,9 +1136,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -1181,9 +1155,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -1202,9 +1176,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -1213,18 +1187,18 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -1272,25 +1246,25 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" @@ -1299,10 +1273,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "syn" -version = "2.0.29" +name = "subtle" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "2.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2", "quote", @@ -1311,31 +1291,31 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" dependencies = [ "proc-macro2", "quote", @@ -1344,12 +1324,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -1357,15 +1338,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -1387,9 +1368,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -1401,14 +1382,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -1417,22 +1398,12 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.20.9", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.7", + "rustls", + "rustls-pki-types", "tokio", ] @@ -1449,40 +1420,25 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.18.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" dependencies = [ "futures-util", "log", - "rustls 0.20.9", + "rustls", "rustls-native-certs", + "rustls-pki-types", "tokio", - "tokio-rustls 0.23.4", - "tungstenite 0.18.0", - "webpki", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" -dependencies = [ - "futures-util", - "log", - "rustls 0.21.7", - "rustls-native-certs", - "tokio", - "tokio-rustls 0.24.1", - "tungstenite 0.20.0", + "tokio-rustls", + "tungstenite", ] [[package]] name = "toml" -version = "0.7.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", @@ -1492,18 +1448,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap", "serde", @@ -1526,30 +1482,9 @@ dependencies = [ [[package]] name = "tungstenite" -version = "0.18.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" -dependencies = [ - "base64 0.13.1", - "byteorder", - "bytes", - "http", - "httparse", - "log", - "rand", - "rustls 0.20.9", - "sha1", - "thiserror", - "url", - "utf-8", - "webpki", -] - -[[package]] -name = "tungstenite" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" dependencies = [ "byteorder", "bytes", @@ -1558,7 +1493,8 @@ dependencies = [ "httparse", "log", "rand", - "rustls 0.21.7", + "rustls", + "rustls-pki-types", "sha1", "thiserror", "url", @@ -1567,21 +1503,21 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-linebreak" @@ -1606,21 +1542,21 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -1641,8 +1577,8 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "vault" -version = "0.2.0" -source = "git+https://github.com/Garmelon/vault.git?tag=v0.2.0#6fd284fed71ece886db9b8aab659f454ba4858b6" +version = "0.3.0" +source = "git+https://github.com/Garmelon/vault.git?tag=v0.3.0#6640f601f3b4eef4ed7201e9fc197cbac3228dad" dependencies = [ "rusqlite", "tokio", @@ -1666,89 +1602,16 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "which" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -1779,7 +1642,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -1788,13 +1660,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -1803,36 +1690,72 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -1840,10 +1763,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] -name = "winnow" -version = "0.5.15" +name = "windows_x86_64_msvc" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" dependencies = [ "memchr", ] + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index b9cff62..b9284b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,9 @@ edition = "2021" [workspace.dependencies] crossterm = "0.27.0" parking_lot = "0.12.1" -serde = { version = "1.0.188", features = ["derive"] } +serde = { version = "1.0.193", features = ["derive"] } serde_either = "0.2.1" -thiserror = "1.0.47" +thiserror = "1.0.52" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" diff --git a/cove-config/Cargo.toml b/cove-config/Cargo.toml index 37ef5bd..c05257d 100644 --- a/cove-config/Cargo.toml +++ b/cove-config/Cargo.toml @@ -10,4 +10,4 @@ cove-macro = { path = "../cove-macro" } serde = { workspace = true } thiserror = { workspace = true } -toml = "0.7.6" +toml = "0.8.8" diff --git a/cove-input/Cargo.toml b/cove-input/Cargo.toml index f3dcc64..dd6d23d 100644 --- a/cove-input/Cargo.toml +++ b/cove-input/Cargo.toml @@ -13,4 +13,4 @@ serde_either = { workspace = true } thiserror = { workspace = true } toss = { workspace = true } -edit = "0.1.4" +edit = "0.1.5" diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index 07541a9..637722e 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -5,9 +5,9 @@ edition = { workspace = true } [dependencies] case = "1.0.0" -proc-macro2 = "1.0.66" +proc-macro2 = "1.0.71" quote = "1.0.33" -syn = "2.0.29" +syn = "2.0.43" [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index ca556a2..9687080 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -12,35 +12,35 @@ parking_lot = { workspace = true } thiserror = { workspace = true } toss = { workspace = true } -anyhow = "1.0.75" -async-trait = "0.1.73" -clap = { version = "4.4.1", features = ["derive", "deprecated"] } -cookie = "0.17.0" +anyhow = "1.0.77" +async-trait = "0.1.75" +clap = { version = "4.4.12", features = ["derive", "deprecated"] } +cookie = "0.18.0" directories = "5.0.1" linkify = "0.10.0" log = { version = "0.4.20", features = ["std"] } -once_cell = "1.18.0" -open = "5.0.0" -rusqlite = { version = "0.29.0", features = ["bundled", "time"] } -serde_json = "1.0.105" -tokio = { version = "1.32.0", features = ["full"] } +once_cell = "1.19.0" +open = "5.0.1" +rusqlite = { version = "0.30.0", features = ["bundled", "time"] } +serde_json = "1.0.108" +tokio = { version = "1.35.1", features = ["full"] } unicode-segmentation = "1.10.1" -unicode-width = "0.1.10" +unicode-width = "0.1.11" [dependencies.time] -version = "0.3.28" +version = "0.3.31" features = ["macros", "formatting", "parsing", "serde"] [dependencies.tokio-tungstenite] -version = "0.20.0" +version = "0.21.0" features = ["rustls-tls-native-roots"] [dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -tag = "v0.4.0" +tag = "v0.5.0" features = ["bot"] [dependencies.vault] git = "https://github.com/Garmelon/vault.git" -tag = "v0.2.0" +tag = "v0.3.0" features = ["tokio"] From c6a1dd863212357db7a8899b063f47a8b8a8bd54 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 29 Dec 2023 00:51:47 +0100 Subject: [PATCH 002/109] Migrate vault identify rooms by their name and domain --- cove/src/vault/migrate.rs | 150 +++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 3 deletions(-) diff --git a/cove/src/vault/migrate.rs b/cove/src/vault/migrate.rs index e5d16da..85b9309 100644 --- a/cove/src/vault/migrate.rs +++ b/cove/src/vault/migrate.rs @@ -1,10 +1,14 @@ use rusqlite::Transaction; use vault::Migration; -pub const MIGRATIONS: [Migration; 2] = [m1, m2]; +pub const MIGRATIONS: [Migration; 3] = [m1, m2, m3]; + +fn eprint_status(nr: usize, total: usize) { + eprintln!("Migrating vault from {} to {} (out of {total})", nr, nr + 1); +} fn m1(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> { - eprintln!("Migrating vault from {} to {} (out of {total})", nr, nr + 1); + eprint_status(nr, total); tx.execute_batch( " CREATE TABLE euph_rooms ( @@ -67,7 +71,7 @@ fn m1(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> } fn m2(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> { - eprintln!("Migrating vault from {} to {} (out of {total})", nr, nr + 1); + eprint_status(nr, total); tx.execute_batch( " ALTER TABLE euph_msgs @@ -78,3 +82,143 @@ fn m2(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> ", ) } + +fn m3(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> { + eprint_status(nr, total); + println!(" This migration might take quite a while."); + println!(" Aborting it will not corrupt your vault."); + + // Rooms should be identified not just via their name but also their domain. + // The domain should be required but there should be no default value. + // + // To accomplish this, we need to recreate and repopulate all euph related + // tables because SQLite's ALTER TABLE is not powerful enough. + + eprintln!(" Preparing tables..."); + tx.execute_batch( + " + DROP INDEX euph_idx_msgs_room_id_parent; + DROP INDEX euph_idx_msgs_room_parent_id; + DROP INDEX euph_idx_msgs_room_id_seen; + + ALTER TABLE euph_rooms RENAME TO old_euph_rooms; + ALTER TABLE euph_msgs RENAME TO old_euph_msgs; + ALTER TABLE euph_spans RENAME TO old_euph_spans; + ALTER TABLE euph_cookies RENAME TO old_euph_cookies; + + CREATE TABLE euph_rooms ( + domain TEXT NOT NULL, + room TEXT NOT NULL, + first_joined INT NOT NULL, + last_joined INT NOT NULL, + + PRIMARY KEY (domain, room) + ) STRICT; + + CREATE TABLE euph_msgs ( + domain TEXT NOT NULL, + room TEXT NOT NULL, + seen INT NOT NULL, + + -- Message + id INT NOT NULL, + parent INT, + previous_edit_id INT, + time INT NOT NULL, + content TEXT NOT NULL, + encryption_key_id TEXT, + edited INT, + deleted INT, + truncated INT NOT NULL, + + -- SessionView + user_id TEXT NOT NULL, + name TEXT, + server_id TEXT NOT NULL, + server_era TEXT NOT NULL, + session_id TEXT NOT NULL, + is_staff INT NOT NULL, + is_manager INT NOT NULL, + client_address TEXT, + real_client_address TEXT, + + PRIMARY KEY (domain, room, id), + FOREIGN KEY (domain, room) REFERENCES euph_rooms (domain, room) + ON DELETE CASCADE + ) STRICT; + + CREATE TABLE euph_spans ( + domain TEXT NOT NULL, + room TEXT NOT NULL, + start INT, + end INT, + + UNIQUE (room, domain, start, end), + FOREIGN KEY (domain, room) REFERENCES euph_rooms (domain, room) + ON DELETE CASCADE, + CHECK (start IS NULL OR end IS NOT NULL) + ) STRICT; + + CREATE TABLE euph_cookies ( + domain TEXT NOT NULL, + cookie TEXT NOT NULL + ) STRICT; + ", + )?; + + eprintln!(" Migrating data..."); + tx.execute_batch( + " + INSERT INTO euph_rooms (domain, room, first_joined, last_joined) + SELECT 'euphoria.io', room, first_joined, last_joined + FROM old_euph_rooms; + + INSERT INTO euph_msgs ( + domain, room, seen, + id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, + user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address + ) + SELECT + 'euphoria.io', room, seen, + id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, + user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address + FROM old_euph_msgs; + + INSERT INTO euph_spans (domain, room, start, end) + SELECT 'euphoria.io', room, start, end + FROM old_euph_spans; + + INSERT INTO euph_cookies (domain, cookie) + SELECT 'euphoria.io', cookie + FROM old_euph_cookies; + ", + )?; + + eprintln!(" Recreating indices..."); + tx.execute_batch( + " + CREATE INDEX euph_idx_msgs_domain_room_id_parent + ON euph_msgs (domain, room, id, parent); + + CREATE INDEX euph_idx_msgs_domain_room_parent_id + ON euph_msgs (domain, room, parent, id); + + CREATE INDEX euph_idx_msgs_domain_room_id_seen + ON euph_msgs (domain, room, id, seen); + ", + )?; + + eprintln!(" Cleaning up loose ends..."); + tx.execute_batch( + " + DROP TABLE old_euph_rooms; + DROP TABLE old_euph_msgs; + DROP TABLE old_euph_spans; + DROP TABLE old_euph_cookies; + + ANALYZE; + ", + )?; + + Ok(()) +} From 076c8f1a72c9d62b7c5019b02986e27756318dda Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 29 Dec 2023 00:51:57 +0100 Subject: [PATCH 003/109] Include domain in temporary tables --- cove/src/vault.rs | 2 -- cove/src/vault/prepare.rs | 57 +++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 921ad4d..7a7e4ba 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -50,8 +50,6 @@ fn launch_from_connection(conn: Connection, ephemeral: bool) -> rusqlite::Result conn.pragma_update(None, "foreign_keys", true)?; conn.pragma_update(None, "trusted_schema", false)?; - eprintln!("Opening vault"); - let tokio_vault = TokioVault::launch_and_prepare(conn, &migrate::MIGRATIONS, prepare::prepare)?; Ok(Vault { tokio_vault, diff --git a/cove/src/vault/prepare.rs b/cove/src/vault/prepare.rs index c990e26..8bbcb2b 100644 --- a/cove/src/vault/prepare.rs +++ b/cove/src/vault/prepare.rs @@ -1,28 +1,32 @@ use rusqlite::Connection; pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { + eprintln!("Preparing vault"); + // Cache ids of tree roots. conn.execute_batch( " CREATE TEMPORARY TABLE euph_trees ( + domain TEXT NOT NULL, room TEXT NOT NULL, id INT NOT NULL, - PRIMARY KEY (room, id) + PRIMARY KEY (domain, room, id) ) STRICT; - INSERT INTO euph_trees (room, id) - SELECT room, id + INSERT INTO euph_trees (domain, room, id) + SELECT domain, room, id FROM euph_msgs WHERE parent IS NULL UNION - SELECT room, parent + SELECT domain, room, parent FROM euph_msgs WHERE parent IS NOT NULL AND NOT EXISTS( SELECT * FROM euph_msgs AS parents - WHERE parents.room = euph_msgs.room + WHERE parents.domain = euph_msgs.domain + AND parents.room = euph_msgs.room AND parents.id = euph_msgs.parent ); @@ -30,15 +34,16 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { AFTER DELETE ON main.euph_rooms BEGIN DELETE FROM euph_trees - WHERE room = old.room; + WHERE domain = old.domain + AND room = old.room; END; CREATE TEMPORARY TRIGGER et_insert_msg_without_parent AFTER INSERT ON main.euph_msgs WHEN new.parent IS NULL BEGIN - INSERT OR IGNORE INTO euph_trees (room, id) - VALUES (new.room, new.id); + INSERT OR IGNORE INTO euph_trees (domain, room, id) + VALUES (new.domain, new.room, new.id); END; CREATE TEMPORARY TRIGGER et_insert_msg_with_parent @@ -46,16 +51,18 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { WHEN new.parent IS NOT NULL BEGIN DELETE FROM euph_trees - WHERE room = new.room + WHERE domain = new.domain + AND room = new.room AND id = new.id; - INSERT OR IGNORE INTO euph_trees (room, id) + INSERT OR IGNORE INTO euph_trees (domain, room, id) SELECT * - FROM (VALUES (new.room, new.parent)) + FROM (VALUES (new.domain, new.room, new.parent)) WHERE NOT EXISTS( SELECT * FROM euph_msgs - WHERE room = new.room + WHERE domain = new.domain + AND room = new.room AND id = new.parent AND parent IS NOT NULL ); @@ -67,35 +74,37 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { conn.execute_batch( " CREATE TEMPORARY TABLE euph_unseen_counts ( + domain TEXT NOT NULL, room TEXT NOT NULL, amount INTEGER NOT NULL, - PRIMARY KEY (room) + PRIMARY KEY (domain, room) ) STRICT; -- There must be an entry for every existing room. - INSERT INTO euph_unseen_counts (room, amount) - SELECT room, 0 + INSERT INTO euph_unseen_counts (domain, room, amount) + SELECT domain, room, 0 FROM euph_rooms; - INSERT OR REPLACE INTO euph_unseen_counts (room, amount) - SELECT room, COUNT(*) + INSERT OR REPLACE INTO euph_unseen_counts (domain, room, amount) + SELECT domain, room, COUNT(*) FROM euph_msgs WHERE NOT seen - GROUP BY room; + GROUP BY domain, room; CREATE TEMPORARY TRIGGER euc_insert_room AFTER INSERT ON main.euph_rooms BEGIN - INSERT INTO euph_unseen_counts (room, amount) - VALUES (new.room, 0); + INSERT INTO euph_unseen_counts (domain, room, amount) + VALUES (new.domain, new.room, 0); END; CREATE TEMPORARY TRIGGER euc_delete_room AFTER DELETE ON main.euph_rooms BEGIN DELETE FROM euph_unseen_counts - WHERE room = old.room; + WHERE domain = old.domain + AND room = old.room; END; CREATE TEMPORARY TRIGGER euc_insert_msg @@ -104,7 +113,8 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { BEGIN UPDATE euph_unseen_counts SET amount = amount + 1 - WHERE room = new.room; + WHERE domain = new.domain + AND room = new.room; END; CREATE TEMPORARY TRIGGER euc_update_msg @@ -113,7 +123,8 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { BEGIN UPDATE euph_unseen_counts SET amount = CASE WHEN new.seen THEN amount - 1 ELSE amount + 1 END - WHERE room = new.room; + WHERE domain = new.domain + AND room = new.room; END; ", )?; From 6b7ab3584aa051ddc491312a97cb52812e714b7c Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Dec 2023 20:15:13 +0100 Subject: [PATCH 004/109] Switch domain mentions to euphoria.leet.nu --- CHANGELOG.md | 6 ++++++ README.md | 2 +- flake.nix | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d75a8..366a11a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ Procedure when bumping the version number: ## Unreleased +### Added +- Support for multiple euph domains + +### Changed +- Switch default euph domain to https://euphoria.leet.nu/ + ## v0.7.1 - 2023-08-31 ### Changed diff --git a/README.md b/README.md index e5ee2c8..e99e545 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cove -Cove is a TUI client for [euphoria.io](https://euphoria.io/), a threaded +Cove is a TUI client for [euphoria.leet.nu](https://euphoria.leet.nu/), a threaded real-time chat platform. ![A very meta screenshot](screenshot.png) diff --git a/flake.nix b/flake.nix index 707e335..286f9b7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "TUI client for euphoria.io, a threaded real-time chat platform"; + description = "TUI client for euphoria.leet.nu, a threaded real-time chat platform"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; From da1d23646a8774dd812b8627b6bd07d636bb550d Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Dec 2023 20:16:16 +0100 Subject: [PATCH 005/109] Migrate euph vault to respect domain --- cove/src/vault.rs | 2 +- cove/src/vault/euph.rs | 358 +++++++++++++++++++++++++---------------- 2 files changed, 221 insertions(+), 139 deletions(-) diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 7a7e4ba..6861901 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -9,7 +9,7 @@ use rusqlite::Connection; use vault::tokio::TokioVault; use vault::Action; -pub use self::euph::{EuphRoomVault, EuphVault}; +pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; #[derive(Debug, Clone)] pub struct Vault { diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index e9f363e..6f23261 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -1,5 +1,5 @@ -use std::mem; use std::str::FromStr; +use std::{fmt, mem}; use async_trait::async_trait; use cookie::{Cookie, CookieJar}; @@ -12,10 +12,6 @@ use vault::Action; use crate::euph::SmallMessage; use crate::store::{MsgStore, Path, Tree}; -/////////////////// -// Wrapper types // -/////////////////// - /// Wrapper for [`Snowflake`] that implements useful rusqlite traits. struct WSnowflake(Snowflake); @@ -50,6 +46,24 @@ impl FromSql for WTime { } } +#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct RoomIdentifier { + pub domain: String, + pub name: String, +} + +impl fmt::Display for RoomIdentifier { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "&{}@{}", self.name, self.domain) + } +} + +impl RoomIdentifier { + pub fn new(domain: String, name: String) -> Self { + Self { domain, name } + } +} + /////////////// // EuphVault // /////////////// @@ -68,10 +82,10 @@ impl EuphVault { &self.vault } - pub fn room(&self, name: String) -> EuphRoomVault { + pub fn room(&self, room: RoomIdentifier) -> EuphRoomVault { EuphRoomVault { vault: self.clone(), - room: name, + room, } } } @@ -97,9 +111,9 @@ macro_rules! euph_vault_actions { } euph_vault_actions! { - GetCookies : cookies() -> CookieJar; - SetCookies : set_cookies(cookies: CookieJar) -> (); - GetRooms : rooms() -> Vec; + GetCookies : cookies(domain: String) -> CookieJar; + SetCookies : set_cookies(domain: String, cookies: CookieJar) -> (); + GetRooms : rooms() -> Vec; } impl Action for GetCookies { @@ -112,9 +126,10 @@ impl Action for GetCookies { " SELECT cookie FROM euph_cookies + WHERE domain = ? ", )? - .query_map([], |row| { + .query_map([self.domain], |row| { let cookie_str: String = row.get(0)?; Ok(Cookie::from_str(&cookie_str).expect("cookie in db is valid")) })? @@ -137,16 +152,21 @@ impl Action for SetCookies { // Since euphoria sets all cookies on every response, we can just delete // all previous cookies. - tx.execute_batch("DELETE FROM euph_cookies")?; + tx.execute( + " + DELETE FROM euph_cookies + WHERE domain = ?", + [&self.domain], + )?; let mut insert_cookie = tx.prepare( " - INSERT INTO euph_cookies (cookie) - VALUES (?) + INSERT INTO euph_cookies (domain, cookie) + VALUES (?, ?) ", )?; for cookie in self.cookies.iter() { - insert_cookie.execute([format!("{cookie}")])?; + insert_cookie.execute([self.domain, format!("{cookie}")])?; } drop(insert_cookie); @@ -156,17 +176,22 @@ impl Action for SetCookies { } impl Action for GetRooms { - type Output = Vec; + type Output = Vec; type Error = rusqlite::Error; fn run(self, conn: &mut Connection) -> Result { conn.prepare( " - SELECT room + SELECT room, domain FROM euph_rooms ", )? - .query_map([], |row| row.get(0))? + .query_map([], |row| { + Ok(RoomIdentifier { + domain: row.get(0)?, + name: row.get(1)?, + }) + })? .collect::>() } } @@ -178,7 +203,7 @@ impl Action for GetRooms { #[derive(Debug, Clone)] pub struct EuphRoomVault { vault: EuphVault, - room: String, + room: RoomIdentifier, } impl EuphRoomVault { @@ -186,7 +211,7 @@ impl EuphRoomVault { &self.vault } - pub fn room(&self) -> &str { + pub fn room(&self) -> &RoomIdentifier { &self.room } } @@ -197,7 +222,7 @@ macro_rules! euph_room_vault_actions { )* ) => { $( struct $struct { - room: String, + room: RoomIdentifier, $( $arg: $arg_ty, )* } )* @@ -253,12 +278,16 @@ impl Action for Join { fn run(self, conn: &mut Connection) -> Result { conn.execute( " - INSERT INTO euph_rooms (room, first_joined, last_joined) - VALUES (:room, :time, :time) - ON CONFLICT (room) DO UPDATE + INSERT INTO euph_rooms (domain, room, first_joined, last_joined) + VALUES (:domain, :room, :time, :time) + ON CONFLICT (domain, room) DO UPDATE SET last_joined = :time ", - named_params! {":room": self.room, ":time": WTime(self.time)}, + named_params! { + ":domain": self.room.domain, + ":room": self.room.name, + ":time": WTime(self.time), + }, )?; Ok(()) } @@ -272,9 +301,10 @@ impl Action for Delete { conn.execute( " DELETE FROM euph_rooms - WHERE room = ? + WHERE domain = ? + AND room = ? ", - [&self.room], + [&self.room.domain, &self.room.name], )?; Ok(()) } @@ -282,29 +312,33 @@ impl Action for Delete { fn insert_msgs( tx: &Transaction<'_>, - room: &str, + room: &RoomIdentifier, own_user_id: &Option, msgs: Vec, ) -> rusqlite::Result<()> { let mut insert_msg = tx.prepare( " INSERT INTO euph_msgs ( - room, id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, + domain, room, + id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address, seen ) VALUES ( - :room, :id, :parent, :previous_edit_id, :time, :content, :encryption_key_id, :edited, :deleted, :truncated, + :domain, :room, + :id, :parent, :previous_edit_id, :time, :content, :encryption_key_id, :edited, :deleted, :truncated, :user_id, :name, :server_id, :server_era, :session_id, :is_staff, :is_manager, :client_address, :real_client_address, (:user_id == :own_user_id OR EXISTS( SELECT 1 FROM euph_rooms - WHERE room = :room + WHERE domain = :domain + AND room = :room AND :time < first_joined )) ) - ON CONFLICT (room, id) DO UPDATE + ON CONFLICT (domain, room, id) DO UPDATE SET + domain = :domain, room = :room, id = :id, parent = :parent, @@ -331,7 +365,8 @@ fn insert_msgs( let own_user_id = own_user_id.as_ref().map(|u| &u.0); for msg in msgs { insert_msg.execute(named_params! { - ":room": room, + ":domain": room.domain, + ":room": room.name, ":id": WSnowflake(msg.id.0), ":parent": msg.parent.map(|id| WSnowflake(id.0)), ":previous_edit_id": msg.previous_edit_id.map(WSnowflake), @@ -359,7 +394,7 @@ fn insert_msgs( fn add_span( tx: &Transaction<'_>, - room: &str, + room: &RoomIdentifier, start: Option, end: Option, ) -> rusqlite::Result<()> { @@ -369,10 +404,11 @@ fn add_span( " SELECT start, end FROM euph_spans - WHERE room = ? + WHERE domain = ? + AND room = ? ", )? - .query_map([room], |row| { + .query_map([&room.domain, &room.name], |row| { let start = row.get::<_, Option>(0)?.map(|s| MessageId(s.0)); let end = row.get::<_, Option>(1)?.map(|s| MessageId(s.0)); Ok((start, end)) @@ -412,21 +448,23 @@ fn add_span( tx.execute( " DELETE FROM euph_spans - WHERE room = ? + WHERE domain = ? + AND room = ? ", - [room], + [&room.domain, &room.name], )?; // Re-insert combined spans for the room let mut stmt = tx.prepare( " - INSERT INTO euph_spans (room, start, end) - VALUES (?, ?, ?) + INSERT INTO euph_spans (domain, room, start, end) + VALUES (?, ?, ?, ?) ", )?; for (start, end) in result { stmt.execute(params![ - room, + room.domain, + room.name, start.map(|id| WSnowflake(id.0)), end.map(|id| WSnowflake(id.0)) ])?; @@ -485,12 +523,13 @@ impl Action for GetLastSpan { " SELECT start, end FROM euph_spans - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY start DESC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { Ok(( row.get::<_, Option>(0)?.map(|s| MessageId(s.0)), row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), @@ -510,12 +549,12 @@ impl Action for GetPath { .prepare( " WITH RECURSIVE - path (room, id) AS ( - VALUES (?, ?) + path (domain, room, id) AS ( + VALUES (?, ?, ?) UNION - SELECT room, parent + SELECT domain, room, parent FROM euph_msgs - JOIN path USING (room, id) + JOIN path USING (domain, room, id) ) SELECT id FROM path @@ -523,9 +562,10 @@ impl Action for GetPath { ORDER BY id ASC ", )? - .query_map(params![self.room, WSnowflake(self.id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - })? + .query_map( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + )? .collect::>()?; Ok(Path::new(path)) } @@ -541,10 +581,11 @@ impl Action for GetMsg { " SELECT id, parent, time, name, content, seen FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND id = ? ", - params![self.room, WSnowflake(self.id.0)], + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], |row| { Ok(SmallMessage { id: MessageId(row.get::<_, WSnowflake>(0)?.0), @@ -572,36 +613,40 @@ impl Action for GetFullMsg { id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND id = ? " )?; let msg = query - .query_row(params![self.room, WSnowflake(self.id.0)], |row| { - Ok(Message { - id: MessageId(row.get::<_, WSnowflake>(0)?.0), - parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), - previous_edit_id: row.get::<_, Option>(2)?.map(|s| s.0), - time: row.get::<_, WTime>(3)?.0, - content: row.get(4)?, - encryption_key_id: row.get(5)?, - edited: row.get::<_, Option>(6)?.map(|t| t.0), - deleted: row.get::<_, Option>(7)?.map(|t| t.0), - truncated: row.get(8)?, - sender: SessionView { - id: UserId(row.get(9)?), - name: row.get(10)?, - server_id: row.get(11)?, - server_era: row.get(12)?, - session_id: SessionId(row.get(13)?), - is_staff: row.get(14)?, - is_manager: row.get(15)?, - client_address: row.get(16)?, - real_client_address: row.get(17)?, - }, - }) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| { + Ok(Message { + id: MessageId(row.get::<_, WSnowflake>(0)?.0), + parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), + previous_edit_id: row.get::<_, Option>(2)?.map(|s| s.0), + time: row.get::<_, WTime>(3)?.0, + content: row.get(4)?, + encryption_key_id: row.get(5)?, + edited: row.get::<_, Option>(6)?.map(|t| t.0), + deleted: row.get::<_, Option>(7)?.map(|t| t.0), + truncated: row.get(8)?, + sender: SessionView { + id: UserId(row.get(9)?), + name: row.get(10)?, + server_id: row.get(11)?, + server_era: row.get(12)?, + session_id: SessionId(row.get(13)?), + is_staff: row.get(14)?, + is_manager: row.get(15)?, + client_address: row.get(16)?, + real_client_address: row.get(17)?, + }, + }) + }, + ) .optional()?; Ok(msg) } @@ -616,31 +661,35 @@ impl Action for GetTree { .prepare( " WITH RECURSIVE - tree (room, id) AS ( - VALUES (?, ?) + tree (domain, room, id) AS ( + VALUES (?, ?, ?) UNION - SELECT euph_msgs.room, euph_msgs.id + SELECT euph_msgs.domain, euph_msgs.room, euph_msgs.id FROM euph_msgs JOIN tree - ON tree.room = euph_msgs.room + ON tree.domain = euph_msgs.domain + AND tree.room = euph_msgs.room AND tree.id = euph_msgs.parent ) SELECT id, parent, time, name, content, seen FROM euph_msgs - JOIN tree USING (room, id) + JOIN tree USING (domain, room, id) ORDER BY id ASC ", )? - .query_map(params![self.room, WSnowflake(self.root_id.0)], |row| { - Ok(SmallMessage { - id: MessageId(row.get::<_, WSnowflake>(0)?.0), - parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), - time: row.get::<_, WTime>(2)?.0, - nick: row.get(3)?, - content: row.get(4)?, - seen: row.get(5)?, - }) - })? + .query_map( + params![self.room.domain, self.room.name, WSnowflake(self.root_id.0)], + |row| { + Ok(SmallMessage { + id: MessageId(row.get::<_, WSnowflake>(0)?.0), + parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), + time: row.get::<_, WTime>(2)?.0, + nick: row.get(3)?, + content: row.get(4)?, + seen: row.get(5)?, + }) + }, + )? .collect::>()?; Ok(Tree::new(self.root_id, msgs)) } @@ -656,12 +705,13 @@ impl Action for GetFirstRootId { " SELECT id FROM euph_trees - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY id ASC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -679,12 +729,13 @@ impl Action for GetLastRootId { " SELECT id FROM euph_trees - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY id DESC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -702,15 +753,17 @@ impl Action for GetPrevRootId { " SELECT id FROM euph_trees - WHERE room = ? + WHERE domain = ? + AND room = ? AND id < ? ORDER BY id DESC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.root_id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.root_id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(root_id) } @@ -726,15 +779,17 @@ impl Action for GetNextRootId { " SELECT id FROM euph_trees - WHERE room = ? + WHERE domain = ? + AND room = ? AND id > ? ORDER BY id ASC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.root_id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.root_id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(root_id) } @@ -750,12 +805,13 @@ impl Action for GetOldestMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY id ASC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -773,12 +829,13 @@ impl Action for GetNewestMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY id DESC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -796,15 +853,17 @@ impl Action for GetOlderMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND id < ? ORDER BY id DESC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(msg_id) } @@ -819,15 +878,17 @@ impl Action for GetNewerMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND id > ? ORDER BY id ASC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(msg_id) } @@ -843,13 +904,14 @@ impl Action for GetOldestUnseenMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND NOT seen ORDER BY id ASC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -867,13 +929,14 @@ impl Action for GetNewestUnseenMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND NOT seen ORDER BY id DESC LIMIT 1 ", )? - .query_row([self.room], |row| { + .query_row([&self.room.domain, &self.room.name], |row| { row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) }) .optional()?; @@ -891,16 +954,18 @@ impl Action for GetOlderUnseenMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND NOT seen AND id < ? ORDER BY id DESC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(msg_id) } @@ -916,16 +981,18 @@ impl Action for GetNewerUnseenMsgId { " SELECT id FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND NOT seen AND id > ? ORDER BY id ASC LIMIT 1 ", )? - .query_row(params![self.room, WSnowflake(self.id.0)], |row| { - row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)) - }) + .query_row( + params![self.room.domain, self.room.name, WSnowflake(self.id.0)], + |row| row.get::<_, WSnowflake>(0).map(|s| MessageId(s.0)), + ) .optional()?; Ok(msg_id) } @@ -941,10 +1008,11 @@ impl Action for GetUnseenMsgsCount { " SELECT amount FROM euph_unseen_counts - WHERE room = ? + WHERE domain = ? + AND room = ? ", )? - .query_row(params![self.room], |row| row.get(0)) + .query_row(params![self.room.domain, self.room.name], |row| row.get(0)) .optional()? .unwrap_or(0); Ok(amount) @@ -960,10 +1028,16 @@ impl Action for SetSeen { " UPDATE euph_msgs SET seen = :seen - WHERE room = :room + WHERE domain = :domain + AND room = :room AND id = :id ", - named_params! { ":room": self.room, ":id": WSnowflake(self.id.0), ":seen": self.seen }, + named_params! { + ":domain": self.room.domain, + ":room": self.room.name, + ":id": WSnowflake(self.id.0), + ":seen": self.seen, + }, )?; Ok(()) } @@ -978,11 +1052,17 @@ impl Action for SetOlderSeen { " UPDATE euph_msgs SET seen = :seen - WHERE room = :room + WHERE domain = :domain + AND room = :room AND id <= :id AND seen != :seen ", - named_params! { ":room": self.room, ":id": WSnowflake(self.id.0), ":seen": self.seen }, + named_params! { + ":domain": self.room.domain, + ":room": self.room.name, + ":id": WSnowflake(self.id.0), + ":seen": self.seen, + }, )?; Ok(()) } @@ -1024,12 +1104,13 @@ impl Action for GetChunkAfter { id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? AND id > ? ORDER BY id ASC LIMIT ? ")? - .query_map(params![self.room, WSnowflake(id.0), self.amount], row2msg)? + .query_map(params![self.room.domain, self.room.name, WSnowflake(id.0), self.amount], row2msg)? .collect::>()? } else { conn.prepare(" @@ -1037,11 +1118,12 @@ impl Action for GetChunkAfter { id, parent, previous_edit_id, time, content, encryption_key_id, edited, deleted, truncated, user_id, name, server_id, server_era, session_id, is_staff, is_manager, client_address, real_client_address FROM euph_msgs - WHERE room = ? + WHERE domain = ? + AND room = ? ORDER BY id ASC LIMIT ? ")? - .query_map(params![self.room, self.amount], row2msg)? + .query_map(params![self.room.domain, self.room.name, self.amount], row2msg)? .collect::>()? }; From 2bbfca7002f7d46a027d0f500865ce480d7bf0dd Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Dec 2023 20:17:12 +0100 Subject: [PATCH 006/109] Respect domain in euph room --- cove/src/euph/room.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 2b7d861..22bebb1 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -1,4 +1,5 @@ // TODO Stop if room does not exist (e.g. 404) +// TODO Remove rl2dev-specific code use std::convert::Infallible; use std::time::Duration; @@ -19,6 +20,7 @@ use crate::vault::EuphRoomVault; const LOG_INTERVAL: Duration = Duration::from_secs(10); +#[allow(clippy::large_enum_variant)] #[derive(Debug)] pub enum State { Disconnected, @@ -69,7 +71,8 @@ impl Room { // a certain point results in errors. Cove should not keep retrying log // requests when hitting that limit, so &rl2dev is always opened in // ephemeral mode. - let ephemeral = vault.vault().vault().ephemeral() || vault.room() == "rl2dev"; + let is_rl2dev = vault.room().domain == "euphoria.io" && vault.room().name == "rl2dev"; + let ephemeral = vault.vault().vault().ephemeral() || is_rl2dev; Self { vault, @@ -125,7 +128,8 @@ impl Room { let cookies = &*self.instance.config().server.cookies; let cookies = cookies.lock().unwrap().clone(); - logging_unwrap!(self.vault.vault().set_cookies(cookies).await); + let domain = self.vault.room().domain.clone(); + logging_unwrap!(self.vault.vault().set_cookies(domain, cookies).await); } Event::Packet(_, packet, ConnSnapshot { conn_tx, state }) => { self.state = State::Connected(conn_tx, state); @@ -189,7 +193,8 @@ impl Room { // a certain point results in errors. By reducing the amount of messages // in each log request, we can get closer to this point. Since &rl2dev // is fairly low in activity, this should be fine. - let n = if vault.room() == "rl2dev" { 50 } else { 1000 }; + let is_rl2dev = vault.room().domain == "euphoria.io" && vault.room().name == "rl2dev"; + let n = if is_rl2dev { 50 } else { 1000 }; let _ = conn_tx.send(Log { n, before }).await; // The code handling incoming events and replies also handles From 1f1795f11188f63904e383a2f9974e0e75735bf4 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Dec 2023 20:20:28 +0100 Subject: [PATCH 007/109] Support domain when exporting room logs --- cove/src/export.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cove/src/export.rs b/cove/src/export.rs index 545f48b..9d9c60b 100644 --- a/cove/src/export.rs +++ b/cove/src/export.rs @@ -6,7 +6,7 @@ mod text; use std::fs::File; use std::io::{self, BufWriter, Write}; -use crate::vault::{EuphRoomVault, EuphVault}; +use crate::vault::{EuphRoomVault, EuphVault, RoomIdentifier}; #[derive(Debug, Clone, Copy, clap::ValueEnum)] pub enum Format { @@ -43,6 +43,10 @@ pub struct Args { #[arg(long, short)] all: bool, + /// Domain to resolve the room names with. + #[arg(long, short, default_value = "euphoria.leet.nu")] + domain: String, + /// Format of the output file. #[arg(long, short, value_enum, default_value_t = Format::Text)] format: Format, @@ -85,7 +89,12 @@ pub async fn export(vault: &EuphVault, mut args: Args) -> anyhow::Result<()> { } let rooms = if args.all { - let mut rooms = vault.rooms().await?; + let mut rooms = vault + .rooms() + .await? + .into_iter() + .map(|id| id.name) + .collect::>(); rooms.sort_unstable(); rooms } else { @@ -101,14 +110,14 @@ pub async fn export(vault: &EuphVault, mut args: Args) -> anyhow::Result<()> { for room in rooms { if args.out == "-" { eprintln!("Exporting &{room} as {} to stdout", args.format.name()); - let vault = vault.room(room); + let vault = vault.room(RoomIdentifier::new(args.domain.clone(), room)); let mut stdout = BufWriter::new(io::stdout()); export_room(&vault, &mut stdout, args.format).await?; stdout.flush()?; } else { let out = format_out(&args.out, &room, args.format); eprintln!("Exporting &{room} as {} to {out}", args.format.name()); - let vault = vault.room(room); + let vault = vault.room(RoomIdentifier::new(args.domain.clone(), room)); let mut file = BufWriter::new(File::create(out)?); export_room(&vault, &mut file, args.format).await?; file.flush()?; From 708d66b256d7a1853d2ee15def71087d2fc53da1 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 31 Dec 2023 20:27:01 +0100 Subject: [PATCH 008/109] Support domain when clearing cookies --- cove/src/main.rs | 17 ++++++++++++----- cove/src/vault/euph.rs | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/cove/src/main.rs b/cove/src/main.rs index e9dc920..cc5ae63 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -26,7 +26,6 @@ mod vault; use std::path::PathBuf; use clap::Parser; -use cookie::CookieJar; use cove_config::doc::Document; use cove_config::Config; use directories::{BaseDirs, ProjectDirs}; @@ -47,7 +46,11 @@ enum Command { /// Compact and clean up vault. Gc, /// Clear euphoria session cookies. - ClearCookies, + ClearCookies { + /// Clear cookies for a specific domain only. + #[arg(long, short)] + domain: Option, + }, /// Print config documentation as markdown. HelpConfig, } @@ -154,7 +157,7 @@ async fn main() -> anyhow::Result<()> { Command::Run => run(logger, logger_rx, config, &dirs).await?, Command::Export(args) => export(config, &dirs, args).await?, Command::Gc => gc(config, &dirs).await?, - Command::ClearCookies => clear_cookies(config, &dirs).await?, + Command::ClearCookies { domain } => clear_cookies(config, &dirs, domain).await?, Command::HelpConfig => help_config(), } @@ -214,11 +217,15 @@ async fn gc(config: &'static Config, dirs: &ProjectDirs) -> anyhow::Result<()> { Ok(()) } -async fn clear_cookies(config: &'static Config, dirs: &ProjectDirs) -> anyhow::Result<()> { +async fn clear_cookies( + config: &'static Config, + dirs: &ProjectDirs, + domain: Option, +) -> anyhow::Result<()> { let vault = open_vault(config, dirs)?; eprintln!("Clearing cookies"); - vault.euph().set_cookies(CookieJar::new()).await?; + vault.euph().clear_cookies(domain).await?; vault.close().await; Ok(()) diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 6f23261..7a5ec3f 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -113,6 +113,7 @@ macro_rules! euph_vault_actions { euph_vault_actions! { GetCookies : cookies(domain: String) -> CookieJar; SetCookies : set_cookies(domain: String, cookies: CookieJar) -> (); + ClearCookies : clear_cookies(domain: Option) -> (); GetRooms : rooms() -> Vec; } @@ -166,7 +167,7 @@ impl Action for SetCookies { ", )?; for cookie in self.cookies.iter() { - insert_cookie.execute([self.domain, format!("{cookie}")])?; + insert_cookie.execute(params![self.domain, format!("{cookie}")])?; } drop(insert_cookie); @@ -175,6 +176,21 @@ impl Action for SetCookies { } } +impl Action for ClearCookies { + type Output = (); + type Error = rusqlite::Error; + + fn run(self, conn: &mut Connection) -> Result { + if let Some(domain) = self.domain { + conn.execute("DELETE FROM euph_cookies WHERE domain = ?", [domain])?; + } else { + conn.execute_batch("DELETE FROM euph_cookies")?; + } + + Ok(()) + } +} + impl Action for GetRooms { type Output = Vec; type Error = rusqlite::Error; From 78bbfac2f3a4419c7f8cd410c98750b0daa2de2d Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 01:38:41 +0100 Subject: [PATCH 009/109] Fix domain errors in UI --- cove/src/ui/euph/room.rs | 8 +- cove/src/ui/rooms.rs | 199 ++++++++++++++++++++++++++------------- 2 files changed, 141 insertions(+), 66 deletions(-) diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 5f26304..30d40a8 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -87,8 +87,12 @@ impl EuphRoom { self.chat.store() } + fn domain(&self) -> &str { + &self.vault().room().domain + } + fn name(&self) -> &str { - self.vault().room() + &self.vault().room().name } pub fn connect(&mut self, next_instance_id: &mut usize) { @@ -307,6 +311,8 @@ impl EuphRoom { } }; + info = info.then(format!(" - {}", self.domain()), Style::new().grey()); + let unseen = self.unseen_msgs_count().await; if unseen > 0 { info = info diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 3dfc7e1..c0816c6 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -1,3 +1,4 @@ +use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::iter; use std::sync::{Arc, Mutex}; @@ -14,7 +15,7 @@ use toss::{Style, Styled, Widget, WidgetExt}; use crate::euph; use crate::macros::logging_unwrap; -use crate::vault::Vault; +use crate::vault::{EuphVault, RoomIdentifier, Vault}; use super::euph::room::EuphRoom; use super::widgets::{ListBuilder, ListState, Popup}; @@ -22,9 +23,9 @@ use super::{key_bindings, util, UiError, UiEvent}; enum State { ShowList, - ShowRoom(String), + ShowRoom(RoomIdentifier), Connect(EditorState), - Delete(String, EditorState), + Delete(RoomIdentifier, EditorState), } #[derive(Clone, Copy)] @@ -42,6 +43,24 @@ impl Order { } } +struct EuphServer { + config: ServerConfig, + next_instance_id: usize, +} + +impl EuphServer { + async fn new(vault: &EuphVault, domain: String) -> Self { + let cookies = logging_unwrap!(vault.cookies(domain.clone()).await); + let config = ServerConfig::default() + .domain(domain) + .cookies(Arc::new(Mutex::new(cookies))); + Self { + config, + next_instance_id: 0, + } + } +} + pub struct Rooms { config: &'static Config, @@ -50,12 +69,11 @@ pub struct Rooms { state: State, - list: ListState, + list: ListState, order: Order, - euph_server_config: ServerConfig, - euph_next_instance_id: usize, - euph_rooms: HashMap, + euph_servers: HashMap, + euph_rooms: HashMap, } impl Rooms { @@ -64,9 +82,6 @@ impl Rooms { vault: Vault, ui_event_tx: mpsc::UnboundedSender, ) -> Self { - let cookies = logging_unwrap!(vault.euph().cookies().await); - let euph_server_config = ServerConfig::default().cookies(Arc::new(Mutex::new(cookies))); - let mut result = Self { config, vault, @@ -74,15 +89,20 @@ impl Rooms { state: State::ShowList, list: ListState::new(), order: Order::from_rooms_sort_order(config.rooms_sort_order), - euph_server_config, - euph_next_instance_id: 0, + euph_servers: HashMap::new(), euph_rooms: HashMap::new(), }; if !config.offline { for (name, config) in &config.euph.rooms { if config.autojoin { - result.connect_to_room(name.clone()); + result + .connect_to_room(RoomIdentifier { + // TODO Remove hardcoded domain + domain: "euphoria.leet.nu".to_string(), + name: name.clone(), + }) + .await; } } } @@ -90,39 +110,66 @@ impl Rooms { result } - fn get_or_insert_room(&mut self, name: String) -> &mut EuphRoom { - self.euph_rooms.entry(name.clone()).or_insert_with(|| { + async fn get_or_insert_server<'a>( + vault: &Vault, + euph_servers: &'a mut HashMap, + domain: String, + ) -> &'a mut EuphServer { + match euph_servers.entry(domain.clone()) { + Entry::Occupied(entry) => entry.into_mut(), + Entry::Vacant(entry) => { + let server = EuphServer::new(&vault.euph(), domain).await; + entry.insert(server) + } + } + } + + async fn get_or_insert_room(&mut self, room: RoomIdentifier) -> &mut EuphRoom { + let server = + Self::get_or_insert_server(&self.vault, &mut self.euph_servers, room.domain.clone()) + .await; + + self.euph_rooms.entry(room.clone()).or_insert_with(|| { EuphRoom::new( self.config, - self.euph_server_config.clone(), - self.config.euph_room(&name), - self.vault.euph().room(name), + server.config.clone(), + self.config.euph_room(&room.name), + self.vault.euph().room(room), self.ui_event_tx.clone(), ) }) } - fn connect_to_room(&mut self, name: String) { - let room = self.euph_rooms.entry(name.clone()).or_insert_with(|| { + async fn connect_to_room(&mut self, room: RoomIdentifier) { + let server = + Self::get_or_insert_server(&self.vault, &mut self.euph_servers, room.domain.clone()) + .await; + + let room = self.euph_rooms.entry(room.clone()).or_insert_with(|| { EuphRoom::new( self.config, - self.euph_server_config.clone(), - self.config.euph_room(&name), - self.vault.euph().room(name), + server.config.clone(), + self.config.euph_room(&room.name), + self.vault.euph().room(room), self.ui_event_tx.clone(), ) }); - room.connect(&mut self.euph_next_instance_id); + + room.connect(&mut server.next_instance_id); } - fn connect_to_all_rooms(&mut self) { - for room in self.euph_rooms.values_mut() { - room.connect(&mut self.euph_next_instance_id); + async fn connect_to_all_rooms(&mut self) { + for (id, room) in &mut self.euph_rooms { + let server = + Self::get_or_insert_server(&self.vault, &mut self.euph_servers, id.domain.clone()) + .await; + + room.connect(&mut server.next_instance_id); } } - fn disconnect_from_room(&mut self, name: &str) { - if let Some(room) = self.euph_rooms.get_mut(name) { + fn disconnect_from_room(&mut self, room: &RoomIdentifier) { + if let Some(room) = self.euph_rooms.get_mut(room) { room.disconnect(); } } @@ -145,7 +192,11 @@ impl Rooms { let rooms = logging_unwrap!(self.vault.euph().rooms().await); let mut rooms_set = rooms .into_iter() - .chain(self.config.euph.rooms.keys().cloned()) + .chain(self.config.euph.rooms.keys().map(|name| RoomIdentifier { + // TODO Remove hardcoded domain + domain: "euphoria.leet.nu".to_string(), + name: name.clone(), + })) .collect::>(); // Prevent room that is currently being shown from being removed. This @@ -161,7 +212,7 @@ impl Rooms { .retain(|n, r| !r.stopped() || rooms_set.contains(n)); for room in rooms_set { - self.get_or_insert_room(room).retain(); + self.get_or_insert_room(room).await.retain(); } } @@ -179,9 +230,9 @@ impl Rooms { .boxed_async() } - State::ShowRoom(name) => { + State::ShowRoom(id) => { self.euph_rooms - .get_mut(name) + .get_mut(id) .expect("room exists after stabilization") .widget() .await @@ -195,10 +246,11 @@ impl Rooms { .boxed_async() } - State::Delete(name, editor) => { + State::Delete(id, editor) => { Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) .await - .below(Self::delete_room_widget(name, editor)) + // TODO Respect domain + .below(Self::delete_room_widget(&id.name, editor)) .desync() .boxed_async() } @@ -345,20 +397,20 @@ impl Rooms { } } - fn sort_rooms(rooms: &mut [(&String, Option<&euph::State>, usize)], order: Order) { + fn sort_rooms(rooms: &mut [(&RoomIdentifier, Option<&euph::State>, usize)], order: Order) { match order { - Order::Alphabet => rooms.sort_unstable_by_key(|(name, _, _)| *name), - Order::Importance => rooms.sort_unstable_by_key(|(name, state, unseen)| { - (state.is_none(), *unseen == 0, *name) + Order::Alphabet => rooms.sort_unstable_by_key(|(id, _, _)| (&id.name, &id.domain)), + Order::Importance => rooms.sort_unstable_by_key(|(id, state, unseen)| { + (state.is_none(), *unseen == 0, &id.name, &id.domain) }), } } async fn render_rows( config: &Config, - list_builder: &mut ListBuilder<'_, String, Text>, + list_builder: &mut ListBuilder<'_, RoomIdentifier, Text>, order: Order, - euph_rooms: &HashMap, + euph_rooms: &HashMap, ) { if euph_rooms.is_empty() { let style = Style::new().grey().italic(); @@ -370,23 +422,25 @@ impl Rooms { } let mut rooms = vec![]; - for (name, room) in euph_rooms { + for (id, room) in euph_rooms { let state = room.room_state(); let unseen = room.unseen_msgs_count().await; - rooms.push((name, state, unseen)); + rooms.push((id, state, unseen)); } Self::sort_rooms(&mut rooms, order); - for (name, state, unseen) in rooms { - let name = name.clone(); + for (id, state, unseen) in rooms { + let id = id.clone(); let info = Self::format_room_info(state, unseen); - list_builder.add_sel(name.clone(), move |selected| { + list_builder.add_sel(id.clone(), move |selected| { let style = if selected { Style::new().bold().black().on_white() } else { Style::new().bold().blue() }; - let text = Styled::new(format!("&{name}"), style).and_then(info); + let text = Styled::new(format!("&{}", id.name), style) + .and_then(info) + .then(format!(" - {}", id.domain), Style::new().grey()); Text::new(text) }); @@ -395,9 +449,9 @@ impl Rooms { async fn rooms_widget<'a>( config: &Config, - list: &'a mut ListState, + list: &'a mut ListState, order: Order, - euph_rooms: &HashMap, + euph_rooms: &HashMap, ) -> impl Widget + 'a { let heading_style = Style::new().bold(); let heading_text = @@ -416,7 +470,11 @@ impl Rooms { c.is_ascii_alphanumeric() || c == '_' } - fn handle_showlist_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> bool { + async fn handle_showlist_input_event( + &mut self, + event: &mut InputEvent<'_>, + keys: &Keys, + ) -> bool { // Open room if event.matches(&keys.general.confirm) { if let Some(name) = self.list.selected() { @@ -433,17 +491,17 @@ impl Rooms { // Room actions if event.matches(&keys.rooms.action.connect) { if let Some(name) = self.list.selected() { - self.connect_to_room(name.clone()); + self.connect_to_room(name.clone()).await; } return true; } if event.matches(&keys.rooms.action.connect_all) { - self.connect_to_all_rooms(); + self.connect_to_all_rooms().await; return true; } if event.matches(&keys.rooms.action.disconnect) { - if let Some(name) = self.list.selected() { - self.disconnect_from_room(&name.clone()); + if let Some(room) = self.list.selected() { + self.disconnect_from_room(&room.clone()); } return true; } @@ -454,18 +512,23 @@ impl Rooms { if event.matches(&keys.rooms.action.connect_autojoin) { for (name, options) in &self.config.euph.rooms { if options.autojoin { - self.connect_to_room(name.clone()); + let room = RoomIdentifier { + // TODO Remove hardcoded domain + domain: "euphoria.leet.nu".to_string(), + name: name.clone(), + }; + self.connect_to_room(room).await; } } return true; } if event.matches(&keys.rooms.action.disconnect_non_autojoin) { - for (name, room) in &mut self.euph_rooms { + for (id, room) in &mut self.euph_rooms { let autojoin = self .config .euph .rooms - .get(name) + .get(&id.name) // TODO Respect domain .map(|r| r.autojoin) .unwrap_or(false); if !autojoin { @@ -479,8 +542,8 @@ impl Rooms { return true; } if event.matches(&keys.rooms.action.delete) { - if let Some(name) = self.list.selected() { - self.state = State::Delete(name.clone(), EditorState::new()); + if let Some(room) = self.list.selected() { + self.state = State::Delete(room.clone(), EditorState::new()); } return true; } @@ -500,7 +563,7 @@ impl Rooms { match &mut self.state { State::ShowList => { - if self.handle_showlist_input_event(event, keys) { + if self.handle_showlist_input_event(event, keys).await { return true; } } @@ -523,8 +586,13 @@ impl Rooms { if event.matches(&keys.general.confirm) { let name = editor.text().to_string(); if !name.is_empty() { - self.connect_to_room(name.clone()); - self.state = State::ShowRoom(name); + let room = RoomIdentifier { + // TODO Remove hardcoded domain + domain: "euphoria.leet.nu".to_string(), + name, + }; + self.connect_to_room(room.clone()).await; + self.state = State::ShowRoom(room); } return true; } @@ -553,15 +621,16 @@ impl Rooms { } pub async fn handle_euph_event(&mut self, event: Event) -> bool { - let room_name = event.config().room.clone(); - let Some(room) = self.euph_rooms.get_mut(&room_name) else { + let config = event.config(); + let room_id = RoomIdentifier::new(config.server.domain.clone(), config.room.clone()); + let Some(room) = self.euph_rooms.get_mut(&room_id) else { return false; }; let handled = room.handle_event(event).await; let room_visible = match &self.state { - State::ShowRoom(name) => *name == room_name, + State::ShowRoom(id) => *id == room_id, _ => true, }; handled && room_visible From 60fdc40a21426a12f239cb3f58ab417ec2fc3a66 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 01:49:11 +0100 Subject: [PATCH 010/109] Fix incorrect room name in url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I naïvely implemented Display for RoomIdentifier, which lead to me passing room names like "&test@euphoria.leet.nu" to euphoxide instead of "test". Of course, no room of that name exists, so every attempted connection failed. To figure this out, I manually relaxed the verbosity filters to let through all euphoxide log messages and recompiled. Only implementing Debug led to compile errors whereever I misused the Disply instance, so at least the bug fix was nice and easy once I knew what happened. --- cove/src/euph/room.rs | 2 +- cove/src/ui/euph/room.rs | 4 ++-- cove/src/vault/euph.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 22bebb1..6ae3a17 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -187,7 +187,7 @@ impl Room { None => None, }; - debug!("{}: requesting logs", vault.room()); + debug!("{:?}: requesting logs", vault.room()); // &rl2dev's message history is broken and requesting old messages past // a certain point results in errors. By reducing the amount of messages diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 30d40a8..e27e2b6 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -101,8 +101,8 @@ impl EuphRoom { let instance_config = self .server_config .clone() - .room(self.vault().room().to_string()) - .name(format!("{room}-{}", next_instance_id)) + .room(self.vault().room().name.clone()) + .name(format!("{room:?}-{}", next_instance_id)) .human(true) .username(self.room_config.username.clone()) .force_username(self.room_config.force_username) diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 7a5ec3f..0e84ba1 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -46,13 +46,13 @@ impl FromSql for WTime { } } -#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct RoomIdentifier { pub domain: String, pub name: String, } -impl fmt::Display for RoomIdentifier { +impl fmt::Debug for RoomIdentifier { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "&{}@{}", self.name, self.domain) } From c094f526a5bc41f84c27ea91febbf14ae22eb240 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 13:06:48 +0100 Subject: [PATCH 011/109] Fix room names and domains being swapped in room list --- cove/src/vault/euph.rs | 2 +- cove/src/vault/migrate.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 0e84ba1..4664446 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -198,7 +198,7 @@ impl Action for GetRooms { fn run(self, conn: &mut Connection) -> Result { conn.prepare( " - SELECT room, domain + SELECT domain, room FROM euph_rooms ", )? diff --git a/cove/src/vault/migrate.rs b/cove/src/vault/migrate.rs index 85b9309..ed26db6 100644 --- a/cove/src/vault/migrate.rs +++ b/cove/src/vault/migrate.rs @@ -153,7 +153,7 @@ fn m3(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> start INT, end INT, - UNIQUE (room, domain, start, end), + UNIQUE (domain, room, start, end), FOREIGN KEY (domain, room) REFERENCES euph_rooms (domain, room) ON DELETE CASCADE, CHECK (start IS NULL OR end IS NOT NULL) From 5995d06cad31f63617c61747e9d11c703b166f64 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 19:35:46 +0100 Subject: [PATCH 012/109] Support domain in config file --- cove-config/src/euph.rs | 8 +++++- cove-config/src/lib.rs | 9 +++++-- cove/src/ui/rooms.rs | 60 +++++++++++++++++++---------------------- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/cove-config/src/euph.rs b/cove-config/src/euph.rs index 0584933..5b1f12a 100644 --- a/cove-config/src/euph.rs +++ b/cove-config/src/euph.rs @@ -35,7 +35,13 @@ pub struct EuphRoom { } #[derive(Debug, Default, Deserialize, Document)] -pub struct Euph { +pub struct EuphServer { #[document(metavar = "room")] pub rooms: HashMap, } + +#[derive(Debug, Default, Deserialize, Document)] +pub struct Euph { + #[document(metavar = "domain")] + pub servers: HashMap, +} diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index d2a773a..5aa6522 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -107,7 +107,12 @@ impl Config { }) } - pub fn euph_room(&self, name: &str) -> EuphRoom { - self.euph.rooms.get(name).cloned().unwrap_or_default() + pub fn euph_room(&self, domain: &str, name: &str) -> EuphRoom { + if let Some(server) = self.euph.servers.get(domain) { + if let Some(room) = server.rooms.get(name) { + return room.clone(); + } + } + EuphRoom::default() } } diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index c0816c6..23537eb 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -94,15 +94,12 @@ impl Rooms { }; if !config.offline { - for (name, config) in &config.euph.rooms { - if config.autojoin { - result - .connect_to_room(RoomIdentifier { - // TODO Remove hardcoded domain - domain: "euphoria.leet.nu".to_string(), - name: name.clone(), - }) - .await; + for (domain, server) in &config.euph.servers { + for (name, room) in &server.rooms { + if room.autojoin { + let id = RoomIdentifier::new(domain.clone(), name.clone()); + result.connect_to_room(id).await; + } } } } @@ -133,7 +130,7 @@ impl Rooms { EuphRoom::new( self.config, server.config.clone(), - self.config.euph_room(&room.name), + self.config.euph_room(&room.domain, &room.name), self.vault.euph().room(room), self.ui_event_tx.clone(), ) @@ -149,7 +146,7 @@ impl Rooms { EuphRoom::new( self.config, server.config.clone(), - self.config.euph_room(&room.name), + self.config.euph_room(&room.domain, &room.name), self.vault.euph().room(room), self.ui_event_tx.clone(), ) @@ -189,14 +186,21 @@ impl Rooms { /// - rooms that were deleted from the db. async fn stabilize_rooms(&mut self) { // Collect all rooms from the db and config file - let rooms = logging_unwrap!(self.vault.euph().rooms().await); - let mut rooms_set = rooms + let rooms_from_db = logging_unwrap!(self.vault.euph().rooms().await); + let rooms_from_config = self + .config + .euph + .servers + .iter() + .flat_map(|(domain, server)| { + server + .rooms + .keys() + .map(|name| RoomIdentifier::new(domain.clone(), name.clone())) + }); + let mut rooms_set = rooms_from_db .into_iter() - .chain(self.config.euph.rooms.keys().map(|name| RoomIdentifier { - // TODO Remove hardcoded domain - domain: "euphoria.leet.nu".to_string(), - name: name.clone(), - })) + .chain(rooms_from_config) .collect::>(); // Prevent room that is currently being shown from being removed. This @@ -510,27 +514,17 @@ impl Rooms { return true; } if event.matches(&keys.rooms.action.connect_autojoin) { - for (name, options) in &self.config.euph.rooms { - if options.autojoin { - let room = RoomIdentifier { - // TODO Remove hardcoded domain - domain: "euphoria.leet.nu".to_string(), - name: name.clone(), - }; - self.connect_to_room(room).await; + for (domain, server) in &self.config.euph.servers { + for name in server.rooms.keys() { + let id = RoomIdentifier::new(domain.clone(), name.clone()); + self.connect_to_room(id).await; } } return true; } if event.matches(&keys.rooms.action.disconnect_non_autojoin) { for (id, room) in &mut self.euph_rooms { - let autojoin = self - .config - .euph - .rooms - .get(&id.name) // TODO Respect domain - .map(|r| r.autojoin) - .unwrap_or(false); + let autojoin = self.config.euph_room(&id.domain, &id.name).autojoin; if !autojoin { room.disconnect(); } From fdbd6e0c553c06b4b76b7c8047e849c759e584a2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 1 Jan 2024 19:45:32 +0100 Subject: [PATCH 013/109] Simplify getting Joined room state --- cove/src/ui/euph/room.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index e27e2b6..862d902 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -132,7 +132,12 @@ impl EuphRoom { } } - // TODO fn room_state_joined(&self) -> Option<&Joined> {} + pub fn room_state_joined(&self) -> Option<&Joined> { + match self.room_state() { + Some(euph::State::Connected(_, conn::State::Joined(ref joined))) => Some(joined), + _ => None, + } + } pub fn stopped(&self) -> bool { self.room.as_ref().map(|r| r.stopped()).unwrap_or(true) @@ -167,9 +172,8 @@ impl EuphRoom { } fn stabilize_focus(&mut self) { - match self.room_state() { - Some(euph::State::Connected(_, conn::State::Joined(_))) => {} - _ => self.focus = Focus::Chat, // There is no nick list to focus on + if self.room_state_joined().is_none() { + self.focus = Focus::Chat; // There is no nick list to focus on } } @@ -325,10 +329,7 @@ impl EuphRoom { } async fn handle_chat_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> bool { - let can_compose = matches!( - self.room_state(), - Some(euph::State::Connected(_, conn::State::Joined(_))) - ); + let can_compose = self.room_state_joined().is_some(); let reaction = self.chat.handle_input_event(event, keys, can_compose).await; let reaction = logging_unwrap!(reaction); @@ -448,8 +449,7 @@ impl EuphRoom { } if event.matches(&keys.tree.action.inspect) { - if let Some(euph::State::Connected(_, conn::State::Joined(joined))) = self.room_state() - { + if let Some(joined) = self.room_state_joined() { if let Some(id) = self.nick_list.selected() { if *id == joined.session.session_id { self.state = @@ -472,11 +472,9 @@ impl EuphRoom { return true; } - if let Some(euph::State::Connected(_, conn::State::Joined(_))) = self.room_state() { - if event.matches(&keys.general.focus) { - self.focus = Focus::NickList; - return true; - } + if self.room_state_joined().is_some() && event.matches(&keys.general.focus) { + self.focus = Focus::NickList; + return true; } } Focus::NickList => { From 6a2f9de85b20835f8d4915bb052a6f60bcfb1d0b Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 12:35:31 +0100 Subject: [PATCH 014/109] Update changelog --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366a11a..e296137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Procedure when bumping the version number: -1. Update dependencies in a separate commit +1. Update dependencies and flake in a separate commit 2. Set version number in `Cargo.toml` 3. Add new section in this changelog 4. Run `cargo run help-config > CONFIG.md` @@ -17,9 +17,13 @@ Procedure when bumping the version number: ### Added - Support for multiple euph domains + - Room domain names are now visible in the UI +- `--domain` option to `cove export` command ### Changed -- Switch default euph domain to https://euphoria.leet.nu/ +- The default euph domain is now https://euphoria.leet.nu/ +- The config file format was changed to support multiple euph servers with different domains. + Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. ## v0.7.1 - 2023-08-31 From 2a10a7a39f29a20b6faee9a943d8a5594aeae2ee Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 12:36:54 +0100 Subject: [PATCH 015/109] Add todos --- Cargo.toml | 2 ++ cove/src/ui/euph/room.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b9284b9..fbd9231 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,5 @@ +# TODO Configure lints in here + [workspace] resolver = "2" members = ["cove", "cove-*"] diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 862d902..7fa266f 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -98,6 +98,7 @@ impl EuphRoom { pub fn connect(&mut self, next_instance_id: &mut usize) { if self.room.is_none() { let room = self.vault().room(); + // TODO Decrease ping timeout let instance_config = self .server_config .clone() From 13a4fa09384fe1e3ed9a15133c2f24a068d1b30c Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 12:53:59 +0100 Subject: [PATCH 016/109] Support domain in room deletion popup --- cove/src/ui/rooms.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 23537eb..fe7a6f3 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -254,7 +254,7 @@ impl Rooms { Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) .await // TODO Respect domain - .below(Self::delete_room_widget(&id.name, editor)) + .below(Self::delete_room_widget(id, editor)) .desync() .boxed_async() } @@ -276,15 +276,17 @@ impl Rooms { } fn delete_room_widget<'a>( - name: &str, + id: &RoomIdentifier, editor: &'a mut EditorState, ) -> impl Widget + 'a { let warn_style = Style::new().bold().red(); let room_style = Style::new().bold().blue(); let text = Styled::new_plain("Are you sure you want to delete ") .then("&", room_style) - .then(name, room_style) - .then_plain("?\n\n") + .then(&id.name, room_style) + .then_plain(" on the ") + .then(&id.domain, Style::new().grey()) + .then_plain(" server?\n\n") .then_plain("This will delete the entire room history from your vault. ") .then_plain("To shrink your vault afterwards, run ") .then("cove gc", Style::new().italic().grey()) From f4967731a1a16a07e45f95c8b45ebb2c323d04ce Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 12:56:37 +0100 Subject: [PATCH 017/109] Fix room deletion popup not checking entered name From the looks of it, I accidentally broke it in v0.7.0 in commit 9bc6931fae84769c2fba35ec06b48d3dfea0d8c2. --- CHANGELOG.md | 3 +++ cove/src/ui/rooms.rs | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e296137..e34f128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ Procedure when bumping the version number: - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. +### Fixed +- Room deletion popup accepting any room name + ## v0.7.1 - 2023-08-31 ### Changed diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index fe7a6f3..57b5aca 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -596,14 +596,14 @@ impl Rooms { return true; } } - State::Delete(name, editor) => { + State::Delete(id, editor) => { if event.matches(&keys.general.abort) { self.state = State::ShowList; return true; } - if event.matches(&keys.general.confirm) { - self.euph_rooms.remove(name); - logging_unwrap!(self.vault.euph().room(name.clone()).delete().await); + if event.matches(&keys.general.confirm) && editor.text() == id.name { + self.euph_rooms.remove(id); + logging_unwrap!(self.vault.euph().room(id.clone()).delete().await); self.state = State::ShowList; return true; } From 970bc07ed9154247555613a6d89f991a6567373b Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 13:51:51 +0100 Subject: [PATCH 018/109] Support choosing domain in room connection popup --- cove/src/ui/rooms.rs | 55 +++++----------- cove/src/ui/rooms/connect.rs | 120 +++++++++++++++++++++++++++++++++++ cove/src/ui/util.rs | 5 ++ 3 files changed, 142 insertions(+), 38 deletions(-) create mode 100644 cove/src/ui/rooms/connect.rs diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 57b5aca..3521318 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -1,3 +1,5 @@ +mod connect; + use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::iter; @@ -17,6 +19,8 @@ use crate::euph; use crate::macros::logging_unwrap; use crate::vault::{EuphVault, RoomIdentifier, Vault}; +use self::connect::{ConnectResult, ConnectState}; + use super::euph::room::EuphRoom; use super::widgets::{ListBuilder, ListState, Popup}; use super::{key_bindings, util, UiError, UiEvent}; @@ -24,7 +28,7 @@ use super::{key_bindings, util, UiError, UiEvent}; enum State { ShowList, ShowRoom(RoomIdentifier), - Connect(EditorState), + Connect(ConnectState), Delete(RoomIdentifier, EditorState), } @@ -242,10 +246,10 @@ impl Rooms { .await } - State::Connect(editor) => { + State::Connect(connect) => { Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) .await - .below(Self::new_room_widget(editor)) + .below(connect.widget()) .desync() .boxed_async() } @@ -261,20 +265,6 @@ impl Rooms { } } - fn new_room_widget(editor: &mut EditorState) -> impl Widget + '_ { - let room_style = Style::new().bold().blue(); - - let inner = Join2::horizontal( - Text::new(("&", room_style)).segment().with_fixed(true), - editor - .widget() - .with_highlight(|s| Styled::new(s, room_style)) - .segment(), - ); - - Popup::new(inner, "Connect to") - } - fn delete_room_widget<'a>( id: &RoomIdentifier, editor: &'a mut EditorState, @@ -472,10 +462,6 @@ impl Rooms { ) } - fn room_char(c: char) -> bool { - c.is_ascii_alphanumeric() || c == '_' - } - async fn handle_showlist_input_event( &mut self, event: &mut InputEvent<'_>, @@ -534,7 +520,7 @@ impl Rooms { return true; } if event.matches(&keys.rooms.action.new) { - self.state = State::Connect(EditorState::new()); + self.state = State::Connect(ConnectState::new()); return true; } if event.matches(&keys.rooms.action.delete) { @@ -574,28 +560,21 @@ impl Rooms { } } } - State::Connect(editor) => { - if event.matches(&keys.general.abort) { + State::Connect(connect) => match connect.handle_input_event(event, keys) { + ConnectResult::Close => { self.state = State::ShowList; return true; } - if event.matches(&keys.general.confirm) { - let name = editor.text().to_string(); - if !name.is_empty() { - let room = RoomIdentifier { - // TODO Remove hardcoded domain - domain: "euphoria.leet.nu".to_string(), - name, - }; - self.connect_to_room(room.clone()).await; - self.state = State::ShowRoom(room); - } + ConnectResult::Connect(room) => { + self.connect_to_room(room.clone()).await; + self.state = State::ShowRoom(room); return true; } - if util::handle_editor_input_event(editor, event, keys, Self::room_char) { + ConnectResult::Handled => { return true; } - } + ConnectResult::Unhandled => {} + }, State::Delete(id, editor) => { if event.matches(&keys.general.abort) { self.state = State::ShowList; @@ -607,7 +586,7 @@ impl Rooms { self.state = State::ShowList; return true; } - if util::handle_editor_input_event(editor, event, keys, Self::room_char) { + if util::handle_editor_input_event(editor, event, keys, util::is_room_char) { return true; } } diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs new file mode 100644 index 0000000..fed584b --- /dev/null +++ b/cove/src/ui/rooms/connect.rs @@ -0,0 +1,120 @@ +use cove_config::Keys; +use cove_input::InputEvent; +use crossterm::style::Stylize; +use toss::widgets::{EditorState, Empty, Join2, Join3, Text}; +use toss::{Style, Styled, Widget, WidgetExt}; + +use crate::ui::widgets::Popup; +use crate::ui::{util, UiError}; +use crate::vault::RoomIdentifier; + +#[derive(Clone, Copy, PartialEq, Eq)] +enum Focus { + Name, + Domain, +} + +impl Focus { + fn advance(self) -> Self { + match self { + Self::Name => Self::Domain, + Self::Domain => Self::Name, + } + } +} + +pub struct ConnectState { + focus: Focus, + name: EditorState, + domain: EditorState, +} + +pub enum ConnectResult { + Close, + Connect(RoomIdentifier), + Handled, + Unhandled, +} + +impl ConnectState { + pub fn new() -> Self { + Self { + focus: Focus::Name, + name: EditorState::new(), + domain: EditorState::with_initial_text("euphoria.leet.nu".to_string()), + } + } + + pub fn handle_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> ConnectResult { + if event.matches(&keys.general.abort) { + return ConnectResult::Close; + } + + if event.matches(&keys.general.focus) { + self.focus = self.focus.advance(); + return ConnectResult::Handled; + } + + if event.matches(&keys.general.confirm) { + let id = RoomIdentifier { + domain: self.domain.text().to_string(), + name: self.name.text().to_string(), + }; + if !id.domain.is_empty() && !id.name.is_empty() { + return ConnectResult::Connect(id); + } + } + + let handled = match self.focus { + Focus::Name => { + util::handle_editor_input_event(&mut self.name, event, keys, util::is_room_char) + } + Focus::Domain => { + util::handle_editor_input_event(&mut self.domain, event, keys, util::is_room_char) + } + }; + + if handled { + return ConnectResult::Handled; + } + + ConnectResult::Unhandled + } + + pub fn widget(&mut self) -> impl Widget + '_ { + let room_style = Style::new().bold().blue(); + let domain_style = Style::new().grey(); + + let name = Join2::horizontal( + Text::new(Styled::new_plain("Room: ").then("&", room_style)) + .with_wrap(false) + .segment() + .with_fixed(true), + self.name + .widget() + .with_highlight(|s| Styled::new(s, room_style)) + .with_focus(self.focus == Focus::Name) + .segment(), + ); + + let domain = Join3::horizontal( + Text::new("Domain:") + .with_wrap(false) + .segment() + .with_fixed(true), + Empty::new().with_width(1).segment().with_fixed(true), + self.domain + .widget() + .with_highlight(|s| Styled::new(s, domain_style)) + .with_focus(self.focus == Focus::Domain) + .segment(), + ); + + let inner = Join2::vertical( + name.segment().with_fixed(true), + domain.segment().with_fixed(true), + ); + + Popup::new(inner, "Connect to") + } +} diff --git a/cove/src/ui/util.rs b/cove/src/ui/util.rs index fa434fe..b358588 100644 --- a/cove/src/ui/util.rs +++ b/cove/src/ui/util.rs @@ -5,6 +5,11 @@ use toss::widgets::EditorState; use super::widgets::ListState; +/// Test if a character is allowed to be typed in a room name. +pub fn is_room_char(c: char) -> bool { + c.is_ascii_alphanumeric() || c == '_' +} + ////////// // List // ////////// From 85cf99387e49cedd1bb707440f81162f66b11df5 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 13:58:49 +0100 Subject: [PATCH 019/109] Extract room deletion popup into module --- cove/src/ui/rooms.rs | 74 +++++++------------------------ cove/src/ui/rooms/delete.rs | 87 +++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 58 deletions(-) create mode 100644 cove/src/ui/rooms/delete.rs diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 3521318..914bf7e 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -1,4 +1,5 @@ mod connect; +mod delete; use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; @@ -12,7 +13,7 @@ use euphoxide::api::SessionType; use euphoxide::bot::instance::{Event, ServerConfig}; use euphoxide::conn::{self, Joined}; use tokio::sync::mpsc; -use toss::widgets::{BoxedAsync, EditorState, Empty, Join2, Text}; +use toss::widgets::{BoxedAsync, Join2, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::euph; @@ -20,16 +21,17 @@ use crate::macros::logging_unwrap; use crate::vault::{EuphVault, RoomIdentifier, Vault}; use self::connect::{ConnectResult, ConnectState}; +use self::delete::{DeleteResult, DeleteState}; use super::euph::room::EuphRoom; -use super::widgets::{ListBuilder, ListState, Popup}; +use super::widgets::{ListBuilder, ListState}; use super::{key_bindings, util, UiError, UiEvent}; enum State { ShowList, ShowRoom(RoomIdentifier), Connect(ConnectState), - Delete(RoomIdentifier, EditorState), + Delete(DeleteState), } #[derive(Clone, Copy)] @@ -254,61 +256,16 @@ impl Rooms { .boxed_async() } - State::Delete(id, editor) => { + State::Delete(delete) => { Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) .await - // TODO Respect domain - .below(Self::delete_room_widget(id, editor)) + .below(delete.widget()) .desync() .boxed_async() } } } - fn delete_room_widget<'a>( - id: &RoomIdentifier, - editor: &'a mut EditorState, - ) -> impl Widget + 'a { - let warn_style = Style::new().bold().red(); - let room_style = Style::new().bold().blue(); - let text = Styled::new_plain("Are you sure you want to delete ") - .then("&", room_style) - .then(&id.name, room_style) - .then_plain(" on the ") - .then(&id.domain, Style::new().grey()) - .then_plain(" server?\n\n") - .then_plain("This will delete the entire room history from your vault. ") - .then_plain("To shrink your vault afterwards, run ") - .then("cove gc", Style::new().italic().grey()) - .then_plain(".\n\n") - .then_plain("To confirm the deletion, ") - .then_plain("enter the full name of the room and press enter:"); - - let inner = Join2::vertical( - // The Join prevents the text from filling up the entire available - // space if the editor is wider than the text. - Join2::horizontal( - Text::new(text) - .resize() - .with_max_width(54) - .segment() - .with_growing(false), - Empty::new().segment(), - ) - .segment(), - Join2::horizontal( - Text::new(("&", room_style)).segment().with_fixed(true), - editor - .widget() - .with_highlight(|s| Styled::new(s, room_style)) - .segment(), - ) - .segment(), - ); - - Popup::new(inner, "Delete room").with_border_style(warn_style) - } - fn format_pbln(joined: &Joined) -> String { let mut p = 0_usize; let mut b = 0_usize; @@ -525,7 +482,7 @@ impl Rooms { } if event.matches(&keys.rooms.action.delete) { if let Some(room) = self.list.selected() { - self.state = State::Delete(room.clone(), EditorState::new()); + self.state = State::Delete(DeleteState::new(room.clone())); } return true; } @@ -575,21 +532,22 @@ impl Rooms { } ConnectResult::Unhandled => {} }, - State::Delete(id, editor) => { - if event.matches(&keys.general.abort) { + State::Delete(delete) => match delete.handle_input_event(event, keys) { + DeleteResult::Close => { self.state = State::ShowList; return true; } - if event.matches(&keys.general.confirm) && editor.text() == id.name { - self.euph_rooms.remove(id); - logging_unwrap!(self.vault.euph().room(id.clone()).delete().await); + DeleteResult::Delete(room) => { + self.euph_rooms.remove(&room); + logging_unwrap!(self.vault.euph().room(room).delete().await); self.state = State::ShowList; return true; } - if util::handle_editor_input_event(editor, event, keys, util::is_room_char) { + DeleteResult::Handled => { return true; } - } + DeleteResult::Unhandled => {} + }, } false diff --git a/cove/src/ui/rooms/delete.rs b/cove/src/ui/rooms/delete.rs new file mode 100644 index 0000000..5a20415 --- /dev/null +++ b/cove/src/ui/rooms/delete.rs @@ -0,0 +1,87 @@ +use cove_config::Keys; +use cove_input::InputEvent; +use crossterm::style::Stylize; +use toss::widgets::{EditorState, Empty, Join2, Text}; +use toss::{Style, Styled, Widget, WidgetExt}; + +use crate::ui::widgets::Popup; +use crate::ui::{util, UiError}; +use crate::vault::RoomIdentifier; + +pub struct DeleteState { + id: RoomIdentifier, + name: EditorState, +} + +pub enum DeleteResult { + Close, + Delete(RoomIdentifier), + Handled, + Unhandled, +} + +impl DeleteState { + pub fn new(id: RoomIdentifier) -> Self { + Self { + id, + name: EditorState::new(), + } + } + + pub fn handle_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> DeleteResult { + if event.matches(&keys.general.abort) { + return DeleteResult::Close; + } + + if event.matches(&keys.general.confirm) && self.name.text() == self.id.name { + return DeleteResult::Delete(self.id.clone()); + } + + if util::handle_editor_input_event(&mut self.name, event, keys, util::is_room_char) { + return DeleteResult::Handled; + } + + DeleteResult::Unhandled + } + + pub fn widget(&mut self) -> impl Widget + '_ { + let warn_style = Style::new().bold().red(); + let room_style = Style::new().bold().blue(); + let text = Styled::new_plain("Are you sure you want to delete ") + .then("&", room_style) + .then(&self.id.name, room_style) + .then_plain(" on the ") + .then(&self.id.domain, Style::new().grey()) + .then_plain(" server?\n\n") + .then_plain("This will delete the entire room history from your vault. ") + .then_plain("To shrink your vault afterwards, run ") + .then("cove gc", Style::new().italic().grey()) + .then_plain(".\n\n") + .then_plain("To confirm the deletion, ") + .then_plain("enter the full name of the room and press enter:"); + + let inner = Join2::vertical( + // The Join prevents the text from filling up the entire available + // space if the editor is wider than the text. + Join2::horizontal( + Text::new(text) + .resize() + .with_max_width(54) + .segment() + .with_growing(false), + Empty::new().segment(), + ) + .segment(), + Join2::horizontal( + Text::new(("&", room_style)).segment().with_fixed(true), + self.name + .widget() + .with_highlight(|s| Styled::new(s, room_style)) + .segment(), + ) + .segment(), + ); + + Popup::new(inner, "Delete room").with_border_style(warn_style) + } +} From 72310d87f5fb46c40222e3fc7c826c291b79d1c9 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 15:02:15 +0100 Subject: [PATCH 020/109] Update changelog --- CHANGELOG.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e34f128..e881bbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,12 +16,13 @@ Procedure when bumping the version number: ## Unreleased ### Added -- Support for multiple euph domains - - Room domain names are now visible in the UI +- Support for multiple euph server domains +- Room domains are visible in the UI +- Domain field to "connect to new room" popup - `--domain` option to `cove export` command ### Changed -- The default euph domain is now https://euphoria.leet.nu/ +- The default euph domain is now https://euphoria.leet.nu/ everywhere - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. From 4e6e413f3d9284c0e3291c6babb386ec0db53c25 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 15:27:30 +0100 Subject: [PATCH 021/109] Fix not being able to enter . in domain field --- cove/src/ui/rooms/connect.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs index fed584b..2bf90c5 100644 --- a/cove/src/ui/rooms/connect.rs +++ b/cove/src/ui/rooms/connect.rs @@ -70,7 +70,7 @@ impl ConnectState { util::handle_editor_input_event(&mut self.name, event, keys, util::is_room_char) } Focus::Domain => { - util::handle_editor_input_event(&mut self.domain, event, keys, util::is_room_char) + util::handle_editor_input_event(&mut self.domain, event, keys, |c| c != '\n') } }; From a522b09f790e17387de9f8faa40a9094f322bcc6 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 15:43:47 +0100 Subject: [PATCH 022/109] Use let-else in some more places --- cove/src/ui.rs | 5 ++--- cove/src/ui/euph/room.rs | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cove/src/ui.rs b/cove/src/ui.rs index cb85876..95cc4d1 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -181,9 +181,8 @@ impl Ui { } // Handle events (in batches) - let mut event = match event_rx.recv().await { - Some(event) => event, - None => return Ok(()), + let Some(mut event) = event_rx.recv().await else { + return Ok(()); }; let end_time = Instant::now() + EVENT_PROCESSING_TIME; loop { diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 7fa266f..defb955 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -532,10 +532,7 @@ impl EuphRoom { } pub async fn handle_event(&mut self, event: Event) -> bool { - let room = match &self.room { - None => return false, - Some(room) => room, - }; + let Some(room) = &self.room else { return false }; if event.config().name != room.instance().config().name { // If we allowed names other than the current one, old instances From 2deecc2084d15e17c5bf6f52011c243a43642099 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:01:33 +0100 Subject: [PATCH 023/109] Add welcome info box next to room list --- CHANGELOG.md | 2 +- cove/src/main.rs | 8 +++----- cove/src/ui/rooms.rs | 46 +++++++++++++++++++++++++++----------------- cove/src/version.rs | 2 ++ 4 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 cove/src/version.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index e881bbf..b1532cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,9 @@ Procedure when bumping the version number: ### Added - Support for multiple euph server domains -- Room domains are visible in the UI - Domain field to "connect to new room" popup - `--domain` option to `cove export` command +- Welcome info box next to room list ### Changed - The default euph domain is now https://euphoria.leet.nu/ everywhere diff --git a/cove/src/main.rs b/cove/src/main.rs index cc5ae63..e5eeb5c 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -22,6 +22,7 @@ mod store; mod ui; mod util; mod vault; +mod version; use std::path::PathBuf; @@ -36,6 +37,7 @@ use toss::Terminal; use crate::logger::Logger; use crate::ui::Ui; use crate::vault::Vault; +use crate::version::{NAME, VERSION}; #[derive(Debug, clap::Parser)] enum Command { @@ -176,11 +178,7 @@ async fn run( config: &'static Config, dirs: &ProjectDirs, ) -> anyhow::Result<()> { - info!( - "Welcome to {} {}", - env!("CARGO_PKG_NAME"), - env!("CARGO_PKG_VERSION") - ); + info!("Welcome to {NAME} {VERSION}",); let vault = open_vault(config, dirs)?; diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 914bf7e..a2319f9 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -13,12 +13,13 @@ use euphoxide::api::SessionType; use euphoxide::bot::instance::{Event, ServerConfig}; use euphoxide::conn::{self, Joined}; use tokio::sync::mpsc; -use toss::widgets::{BoxedAsync, Join2, Text}; +use toss::widgets::{BoxedAsync, Empty, Join2, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::euph; use crate::macros::logging_unwrap; use crate::vault::{EuphVault, RoomIdentifier, Vault}; +use crate::version::{NAME, VERSION}; use self::connect::{ConnectResult, ConnectState}; use self::delete::{DeleteResult, DeleteState}; @@ -360,20 +361,10 @@ impl Rooms { } async fn render_rows( - config: &Config, list_builder: &mut ListBuilder<'_, RoomIdentifier, Text>, order: Order, euph_rooms: &HashMap, ) { - if euph_rooms.is_empty() { - let style = Style::new().grey().italic(); - list_builder.add_unsel(Text::new( - Styled::new("Press ", style) - .and_then(key_bindings::format_binding(&config.keys.general.help)) - .then(" for key bindings", style), - )); - } - let mut rooms = vec![]; for (id, room) in euph_rooms { let state = room.room_state(); @@ -406,16 +397,35 @@ impl Rooms { order: Order, euph_rooms: &HashMap, ) -> impl Widget + 'a { - let heading_style = Style::new().bold(); - let heading_text = - Styled::new("Rooms", heading_style).then_plain(format!(" ({})", euph_rooms.len())); + let version_info = Styled::new_plain("Welcome to ") + .then(format!("{NAME} {VERSION}"), Style::new().yellow().bold()) + .then_plain("!"); + let help_info = Styled::new("Press ", Style::new().grey()) + .and_then(key_bindings::format_binding(&config.keys.general.help)) + .then(" for key bindings.", Style::new().grey()); + let info = Join2::vertical( + Text::new(version_info).float().with_center_h().segment(), + Text::new(help_info).segment(), + ) + .padding() + .with_horizontal(1) + .border(); + + let heading = Styled::new("Rooms", Style::new().bold()) + .then_plain(format!(" ({})", euph_rooms.len())); let mut list_builder = ListBuilder::new(); - Self::render_rows(config, &mut list_builder, order, euph_rooms).await; + Self::render_rows(&mut list_builder, order, euph_rooms).await; - Join2::vertical( - Text::new(heading_text).segment().with_fixed(true), - list_builder.build(list).segment(), + Join2::horizontal( + Join2::vertical( + Text::new(heading).segment().with_fixed(true), + list_builder.build(list).segment(), + ) + .segment(), + Join2::vertical(info.segment().with_growing(false), Empty::new().segment()) + .segment() + .with_growing(false), ) } diff --git a/cove/src/version.rs b/cove/src/version.rs new file mode 100644 index 0000000..2a4c731 --- /dev/null +++ b/cove/src/version.rs @@ -0,0 +1,2 @@ +pub const NAME: &str = env!("CARGO_PKG_NAME"); +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); From b302229d7c98133f57b25cea9b7e0cd580945769 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:17:30 +0100 Subject: [PATCH 024/109] Mention that F1 popup can be scrolled --- CHANGELOG.md | 1 + cove/src/ui/key_bindings.rs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1532cc..0e2bb08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Procedure when bumping the version number: - The default euph domain is now https://euphoria.leet.nu/ everywhere - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. +- Tweaked F1 popup ### Fixed - Room deletion popup accepting any room name diff --git a/cove/src/ui/key_bindings.rs b/cove/src/ui/key_bindings.rs index 679c929..8fceda6 100644 --- a/cove/src/ui/key_bindings.rs +++ b/cove/src/ui/key_bindings.rs @@ -79,7 +79,23 @@ pub fn widget<'a>( render_group_info(&mut list_builder, group_info); } - Popup::new(list_builder.build(list), "Key bindings") + let scroll_info_style = Style::new().grey().italic(); + let scroll_info = Styled::new("(Scroll with ", scroll_info_style) + .and_then(format_binding(&config.keys.cursor.down)) + .then(" and ", scroll_info_style) + .and_then(format_binding(&config.keys.cursor.up)) + .then(")", scroll_info_style); + + let inner = Join2::vertical( + list_builder.build(list).segment(), + Text::new(scroll_info) + .float() + .with_center_h() + .segment() + .with_growing(false), + ); + + Popup::new(inner, "Key bindings") } pub fn handle_input_event( From 5bbf389dbe8172343d10916387c159b3e28dd8ae Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:26:18 +0100 Subject: [PATCH 025/109] Remove some old todos --- cove-config/src/keys.rs | 1 - cove/src/euph/room.rs | 2 -- cove/src/macros.rs | 1 - 3 files changed, 4 deletions(-) diff --git a/cove-config/src/keys.rs b/cove-config/src/keys.rs index 3ecbb5b..1f8a818 100644 --- a/cove-config/src/keys.rs +++ b/cove-config/src/keys.rs @@ -122,7 +122,6 @@ pub struct General { #[serde(default = "default::general::confirm")] pub confirm: KeyBinding, /// Advance focus. - // TODO Mention examples where this is used #[serde(default = "default::general::focus")] pub focus: KeyBinding, /// Show this help. diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 6ae3a17..2831bc6 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -1,4 +1,3 @@ -// TODO Stop if room does not exist (e.g. 404) // TODO Remove rl2dev-specific code use std::convert::Infallible; @@ -141,7 +140,6 @@ impl Room { self.log_request_canary = None; } Event::Stopped(_) => { - // TODO Remove room somewhere if this happens? If it doesn't already happen during stabilization self.state = State::Stopped; } } diff --git a/cove/src/macros.rs b/cove/src/macros.rs index a20cec9..bb5834c 100644 --- a/cove/src/macros.rs +++ b/cove/src/macros.rs @@ -1,4 +1,3 @@ -// TODO Get rid of this macro as much as possible macro_rules! logging_unwrap { ($e:expr) => { match $e { From cc1a2866eb08d8c733a20373d14da3d462f49742 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:32:59 +0100 Subject: [PATCH 026/109] Simplify retrieving Joined from room::State --- cove/src/euph/room.rs | 9 ++++++++- cove/src/ui/euph/room.rs | 15 +++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 2831bc6..64ddfe6 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -9,7 +9,7 @@ use euphoxide::api::{ UserId, }; use euphoxide::bot::instance::{ConnSnapshot, Event, Instance, InstanceConfig}; -use euphoxide::conn::{self, ConnTx}; +use euphoxide::conn::{self, ConnTx, Joined}; use log::{debug, error, info, warn}; use tokio::select; use tokio::sync::oneshot; @@ -36,6 +36,13 @@ impl State { None } } + + pub fn joined(&self) -> Option<&Joined> { + match self { + Self::Connected(_, conn::State::Joined(joined)) => Some(joined), + _ => None, + } + } } #[derive(Debug, thiserror::Error)] diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index defb955..8240ba5 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -134,10 +134,7 @@ impl EuphRoom { } pub fn room_state_joined(&self) -> Option<&Joined> { - match self.room_state() { - Some(euph::State::Connected(_, conn::State::Joined(ref joined))) => Some(joined), - _ => None, - } + self.room_state().and_then(|s| s.joined()) } pub fn stopped(&self) -> bool { @@ -216,17 +213,15 @@ impl EuphRoom { let room_state = self.room.as_ref().map(|room| room.state()); let status_widget = self.status_widget(room_state).await; - let chat = if let Some(euph::State::Connected(_, conn::State::Joined(joined))) = room_state - { - Self::widget_with_nick_list( + let chat = match room_state.and_then(|s| s.joined()) { + Some(joined) => Self::widget_with_nick_list( &mut self.chat, status_widget, &mut self.nick_list, joined, self.focus, - ) - } else { - Self::widget_without_nick_list(&mut self.chat, status_widget) + ), + None => Self::widget_without_nick_list(&mut self.chat, status_widget), }; let mut layers = vec![chat]; From 1bf4035c575952cd733c20e608c41bd856017c6b Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 17:52:32 +0100 Subject: [PATCH 027/109] Remove message editor cursor when unfocused --- CHANGELOG.md | 1 + cove/src/ui/chat/tree/renderer.rs | 9 ++++++--- cove/src/ui/chat/tree/widgets.rs | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e2bb08..d0c101c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Procedure when bumping the version number: - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. - Tweaked F1 popup +- Tweaked chat message editor when nick list is foused ### Fixed - Room deletion popup accepting any room name diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index e6753c7..945f77c 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -148,8 +148,12 @@ where None => TreeBlockId::Bottom, }; - // TODO Unhighlighted version when focusing on nick list - let widget = widgets::editor::(indent, &self.context.nick, self.editor); + let widget = widgets::editor::( + indent, + &self.context.nick, + self.context.focused, + self.editor, + ); let widget = Self::predraw(widget, self.context.size, self.widthdb); let mut block = Block::new(id, widget, false); @@ -167,7 +171,6 @@ where None => TreeBlockId::Bottom, }; - // TODO Unhighlighted version when focusing on nick list let widget = widgets::pseudo::(indent, &self.context.nick, self.editor); let widget = Self::predraw(widget, self.context.size, self.widthdb); Block::new(id, widget, false) diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index ecdb7f4..e52704e 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -116,10 +116,14 @@ pub fn msg_placeholder( pub fn editor<'a, M: ChatMsg>( indent: usize, nick: &str, + focus: bool, editor: &'a mut EditorState, ) -> Boxed<'a, Infallible> { let (nick, content) = M::edit(nick, editor.text()); - let editor = editor.widget().with_highlight(|_| content); + let editor = editor + .widget() + .with_highlight(|_| content) + .with_focus(focus); Join5::horizontal( Seen::new(true).segment().with_fixed(true), From a1b0e151ff966fea2aeb089520d71caa1add477f Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 18:21:55 +0100 Subject: [PATCH 028/109] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0c101c..c4d7166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,9 @@ Procedure when bumping the version number: ### Added - Support for multiple euph server domains -- Domain field to "connect to new room" popup - `--domain` option to `cove export` command +- `--domain` option to `cove clear-cookies` command +- Domain field to "connect to new room" popup - Welcome info box next to room list ### Changed From 956d3013ea8f9fb52a7af161c44630653798909e Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 18:25:31 +0100 Subject: [PATCH 029/109] Remove unused code --- cove/src/store.rs | 4 ---- cove/src/ui/chat/blocks.rs | 8 -------- cove/src/ui/chat/renderer.rs | 21 --------------------- 3 files changed, 33 deletions(-) diff --git a/cove/src/store.rs b/cove/src/store.rs index 35e02a6..a3601a8 100644 --- a/cove/src/store.rs +++ b/cove/src/store.rs @@ -27,10 +27,6 @@ impl Path { self.0.iter().take(self.0.len() - 1) } - pub fn push(&mut self, segment: I) { - self.0.push(segment) - } - pub fn first(&self) -> &I { self.0.first().expect("path is empty") } diff --git a/cove/src/ui/chat/blocks.rs b/cove/src/ui/chat/blocks.rs index 2a9eb0a..1b91864 100644 --- a/cove/src/ui/chat/blocks.rs +++ b/cove/src/ui/chat/blocks.rs @@ -161,14 +161,6 @@ impl Blocks { pub fn shift(&mut self, delta: i32) { self.range = self.range.shifted(delta); } - - pub fn set_top(&mut self, top: i32) { - self.shift(top - self.range.top); - } - - pub fn set_bottom(&mut self, bottom: i32) { - self.shift(bottom - self.range.bottom); - } } pub struct Iter<'a, Id> { diff --git a/cove/src/ui/chat/renderer.rs b/cove/src/ui/chat/renderer.rs index 1edde46..ae0ad8f 100644 --- a/cove/src/ui/chat/renderer.rs +++ b/cove/src/ui/chat/renderer.rs @@ -275,27 +275,6 @@ where } } -pub fn clamp_scroll_biased_upwards(r: &mut R) -where - R: Renderer, -{ - let area = visible_area(r); - let blocks = r.blocks().range(); - - // Delta that moves blocks.top to the top of the screen. If this is - // negative, we need to move the blocks because they're too low. - let move_to_top = blocks.top - area.top; - - // Delta that moves blocks.bottom to the bottom of the screen. If this is - // positive, we need to move the blocks because they're too high. - let move_to_bottom = blocks.bottom - area.bottom; - - // If the screen is higher, the blocks should rather be moved to the top - // than the bottom because of the upwards bias. - let delta = 0.max(move_to_bottom).min(move_to_top); - r.blocks_mut().shift(delta); -} - pub fn clamp_scroll_biased_downwards(r: &mut R) where R: Renderer, From c286e0244c289f7139a06787f5e91bab635f258b Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 02:05:49 +0100 Subject: [PATCH 030/109] Add time_zone config option --- CHANGELOG.md | 1 + cove-config/src/lib.rs | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4d7166..6a22b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Procedure when bumping the version number: ### Added - Support for multiple euph server domains +- `time_zone` config option - `--domain` option to `cove export` command - `--domain` option to `cove clear-cookies` command - Domain field to "connect to new room" popup diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 5aa6522..5d88867 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -77,18 +77,40 @@ pub struct Config { /// Initial sort order of rooms list. /// - /// `alphabet` sorts rooms in alphabetic order. + /// `"alphabet"` sorts rooms in alphabetic order. /// - /// `importance` sorts rooms by the following criteria (in descending order - /// of priority): + /// `"importance"` sorts rooms by the following criteria (in descending + /// order of priority): /// /// 1. connected rooms before unconnected rooms /// 2. rooms with unread messages before rooms without /// 3. alphabetic order #[serde(default)] - #[document(default = "`alphabet`")] + #[document(default = "`\"alphabet\"`")] pub rooms_sort_order: RoomsSortOrder, + /// Time zone that chat timestamps should be displayed in. + /// + /// This option is interpreted as a POSIX TZ string. It is described here in + /// further detail: + /// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html + /// + /// On a normal system, the string `"localtime"` as well as any value from + /// the "TZ identifier" column of the following wikipedia article should be + /// valid TZ strings: + /// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + /// + /// If the option is not specified, cove uses the contents of the `TZ` + /// environment variable instead. If the `TZ` environment variable does not + /// exist, cove uses the system's local time zone. + /// + /// **Warning:** On Windows, cove can't get the local time zone and uses UTC + /// instead. However, you can still specify a path to a tz data file or a + /// custom time zone string. + #[serde(default)] + #[document(default = "$TZ or local time zone")] + pub time_zone: Option, + #[serde(default)] #[document(no_default)] pub euph: Euph, @@ -115,4 +137,8 @@ impl Config { } EuphRoom::default() } + + pub fn time_zone_ref(&self) -> Option<&str> { + self.time_zone.as_ref().map(|s| s as &str) + } } From 43a8b91dca9eccaab27f2fd0597afccc0d63cbfb Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 02:06:33 +0100 Subject: [PATCH 031/109] Load time zone when opening vault --- Cargo.lock | 16 ++++++++++++++++ cove/Cargo.toml | 1 + cove/src/main.rs | 14 +++++++++----- cove/src/util.rs | 22 ++++++++++++++++++++++ cove/src/vault.rs | 17 ++++++++++++----- 5 files changed, 60 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ed64bb..4cdb574 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,6 +246,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + [[package]] name = "cookie" version = "0.18.0" @@ -297,6 +303,7 @@ dependencies = [ "tokio", "tokio-tungstenite", "toss", + "tz-rs", "unicode-segmentation", "unicode-width", "vault", @@ -1507,6 +1514,15 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "tz-rs" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" +dependencies = [ + "const_fn", +] + [[package]] name = "unicode-bidi" version = "0.3.14" diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 9687080..b764a4a 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -24,6 +24,7 @@ open = "5.0.1" rusqlite = { version = "0.30.0", features = ["bundled", "time"] } serde_json = "1.0.108" tokio = { version = "1.35.1", features = ["full"] } +tz-rs = "0.6.14" unicode-segmentation = "1.10.1" unicode-width = "0.1.11" diff --git a/cove/src/main.rs b/cove/src/main.rs index e5eeb5c..0308604 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -129,14 +129,18 @@ fn update_config_with_args(config: &mut Config, args: &Args) { config.offline |= args.offline; } -fn open_vault(config: &Config, dirs: &ProjectDirs) -> rusqlite::Result { - if config.ephemeral { - vault::launch_in_memory() +fn open_vault(config: &Config, dirs: &ProjectDirs) -> anyhow::Result { + let time_zone = util::load_time_zone(config.time_zone_ref())?; + + let vault = if config.ephemeral { + vault::launch_in_memory(time_zone)? } else { let data_dir = data_dir(config, dirs); eprintln!("Data dir: {}", data_dir.to_string_lossy()); - vault::launch(&data_dir.join("vault.db")) - } + vault::launch(&data_dir.join("vault.db"), time_zone)? + }; + + Ok(vault) } #[tokio::main] diff --git a/cove/src/util.rs b/cove/src/util.rs index b6e7c97..67c0e68 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -1,4 +1,7 @@ use std::convert::Infallible; +use std::env; + +use tz::{TimeZone, TzError}; pub trait InfallibleExt { type Inner; @@ -13,3 +16,22 @@ impl InfallibleExt for Result { self.expect("infallible") } } + +/// Load a [`TimeZone`] specified by a string, or by the `TZ` environment +/// variable if no string is provided. +/// +/// If a string is provided, it is interpreted in the same format that the `TZ` +/// environment variable uses. +/// +/// If no string and no `TZ` environment variable could be found, the system +/// local time is used. +pub fn load_time_zone(tz_string: Option<&str>) -> Result { + let env_tz = env::var("TZ").ok(); + let tz_string = tz_string.or(env_tz.as_ref().map(|s| s as &str)); + + match &tz_string { + // At the moment, TimeZone::from_posix_tz does not support "localtime" on windows, but other time zon + Some("localtime") | None => TimeZone::local(), + Some(tz_string) => TimeZone::from_posix_tz(tz_string), + } +} diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 6861901..250456d 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -6,6 +6,7 @@ use std::fs; use std::path::Path; use rusqlite::Connection; +use tz::TimeZone; use vault::tokio::TokioVault; use vault::Action; @@ -14,6 +15,7 @@ pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; #[derive(Debug, Clone)] pub struct Vault { tokio_vault: TokioVault, + time_zone: TimeZone, ephemeral: bool, } @@ -46,18 +48,23 @@ impl Vault { } } -fn launch_from_connection(conn: Connection, ephemeral: bool) -> rusqlite::Result { +fn launch_from_connection( + conn: Connection, + time_zone: TimeZone, + ephemeral: bool, +) -> rusqlite::Result { conn.pragma_update(None, "foreign_keys", true)?; conn.pragma_update(None, "trusted_schema", false)?; let tokio_vault = TokioVault::launch_and_prepare(conn, &migrate::MIGRATIONS, prepare::prepare)?; Ok(Vault { tokio_vault, + time_zone, ephemeral, }) } -pub fn launch(path: &Path) -> rusqlite::Result { +pub fn launch(path: &Path, time_zone: TimeZone) -> rusqlite::Result { // If this fails, rusqlite will complain about not being able to open the db // file, which saves me from adding a separate vault error type. let _ = fs::create_dir_all(path.parent().expect("path to file")); @@ -72,10 +79,10 @@ pub fn launch(path: &Path) -> rusqlite::Result { conn.pragma_update(None, "locking_mode", "exclusive")?; conn.pragma_update(None, "journal_mode", "wal")?; - launch_from_connection(conn, false) + launch_from_connection(conn, time_zone, false) } -pub fn launch_in_memory() -> rusqlite::Result { +pub fn launch_in_memory(time_zone: TimeZone) -> rusqlite::Result { let conn = Connection::open_in_memory()?; - launch_from_connection(conn, true) + launch_from_connection(conn, time_zone, true) } From 1189e3eb7b12cea9c6e2ce36067d4048d8ead337 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 02:20:59 +0100 Subject: [PATCH 032/109] Display chat time stamps in configured time zone --- cove/src/euph/small_message.rs | 6 ++++-- cove/src/logger.rs | 4 ++-- cove/src/main.rs | 1 + cove/src/ui/chat.rs | 2 +- cove/src/ui/chat/tree/widgets.rs | 2 +- cove/src/util.rs | 12 ++++++++++++ cove/src/vault.rs | 8 ++++---- cove/src/vault/euph.rs | 5 +++++ 8 files changed, 30 insertions(+), 10 deletions(-) diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 2751058..0642801 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -4,6 +4,7 @@ use crossterm::style::Stylize; use euphoxide::api::{MessageId, Snowflake, Time}; use time::OffsetDateTime; use toss::{Style, Styled}; +use tz::TimeZone; use crate::store::Msg; use crate::ui::ChatMsg; @@ -207,6 +208,7 @@ pub struct SmallMessage { pub id: MessageId, pub parent: Option, pub time: Time, + pub time_zone: &'static TimeZone, pub nick: String, pub content: String, pub seen: bool, @@ -270,8 +272,8 @@ impl Msg for SmallMessage { } impl ChatMsg for SmallMessage { - fn time(&self) -> OffsetDateTime { - self.time.0 + fn time(&self) -> Option { + crate::util::convert_to_time_zone(self.time_zone, self.time.0) } fn styled(&self) -> (Styled, Styled) { diff --git a/cove/src/logger.rs b/cove/src/logger.rs index 731a000..b8b696b 100644 --- a/cove/src/logger.rs +++ b/cove/src/logger.rs @@ -42,8 +42,8 @@ impl Msg for LogMsg { } impl ChatMsg for LogMsg { - fn time(&self) -> OffsetDateTime { - self.time + fn time(&self) -> Option { + Some(self.time) } fn styled(&self) -> (Styled, Styled) { diff --git a/cove/src/main.rs b/cove/src/main.rs index 0308604..338642c 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -131,6 +131,7 @@ fn update_config_with_args(config: &mut Config, args: &Args) { fn open_vault(config: &Config, dirs: &ProjectDirs) -> anyhow::Result { let time_zone = util::load_time_zone(config.time_zone_ref())?; + let time_zone = Box::leak(Box::new(time_zone)); let vault = if config.ephemeral { vault::launch_in_memory(time_zone)? diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 24ea82e..6a9c9c2 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -18,7 +18,7 @@ use self::tree::TreeViewState; use super::UiError; pub trait ChatMsg { - fn time(&self) -> OffsetDateTime; + fn time(&self) -> Option; fn styled(&self) -> (Styled, Styled); fn edit(nick: &str, content: &str) -> (Styled, Styled); fn pseudo(nick: &str, content: &str) -> (Styled, Styled); diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index e52704e..2f1a1ff 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -58,7 +58,7 @@ pub fn msg( Join5::horizontal( Seen::new(msg.seen()).segment().with_fixed(true), - Time::new(Some(msg.time()), style_time(highlighted)) + Time::new(msg.time(), style_time(highlighted)) .padding() .with_right(1) .with_stretch(true) diff --git a/cove/src/util.rs b/cove/src/util.rs index 67c0e68..1bc9d6b 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -1,6 +1,7 @@ use std::convert::Infallible; use std::env; +use time::{OffsetDateTime, UtcOffset}; use tz::{TimeZone, TzError}; pub trait InfallibleExt { @@ -35,3 +36,14 @@ pub fn load_time_zone(tz_string: Option<&str>) -> Result { Some(tz_string) => TimeZone::from_posix_tz(tz_string), } } + +pub fn convert_to_time_zone(tz: &TimeZone, time: OffsetDateTime) -> Option { + let utc_offset_in_seconds = tz + .find_local_time_type(time.unix_timestamp()) + .ok()? + .ut_offset(); + + let utc_offset = UtcOffset::from_whole_seconds(utc_offset_in_seconds).ok()?; + + Some(time.to_offset(utc_offset)) +} diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 250456d..55abbf0 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -15,7 +15,7 @@ pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; #[derive(Debug, Clone)] pub struct Vault { tokio_vault: TokioVault, - time_zone: TimeZone, + time_zone: &'static TimeZone, ephemeral: bool, } @@ -50,7 +50,7 @@ impl Vault { fn launch_from_connection( conn: Connection, - time_zone: TimeZone, + time_zone: &'static TimeZone, ephemeral: bool, ) -> rusqlite::Result { conn.pragma_update(None, "foreign_keys", true)?; @@ -64,7 +64,7 @@ fn launch_from_connection( }) } -pub fn launch(path: &Path, time_zone: TimeZone) -> rusqlite::Result { +pub fn launch(path: &Path, time_zone: &'static TimeZone) -> rusqlite::Result { // If this fails, rusqlite will complain about not being able to open the db // file, which saves me from adding a separate vault error type. let _ = fs::create_dir_all(path.parent().expect("path to file")); @@ -82,7 +82,7 @@ pub fn launch(path: &Path, time_zone: TimeZone) -> rusqlite::Result { launch_from_connection(conn, time_zone, false) } -pub fn launch_in_memory(time_zone: TimeZone) -> rusqlite::Result { +pub fn launch_in_memory(time_zone: &'static TimeZone) -> rusqlite::Result { let conn = Connection::open_in_memory()?; launch_from_connection(conn, time_zone, true) } diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 4664446..8091613 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -239,6 +239,8 @@ macro_rules! euph_room_vault_actions { $( struct $struct { room: RoomIdentifier, + #[allow(unused)] + time_zone: &'static tz::TimeZone, $( $arg: $arg_ty, )* } )* @@ -248,6 +250,7 @@ macro_rules! euph_room_vault_actions { pub async fn $fn(&self, $( $arg: $arg_ty, )* ) -> Result<$res, vault::tokio::Error> { self.vault.vault.tokio_vault.execute($struct { room: self.room.clone(), + time_zone: self.vault.vault.time_zone, $( $arg, )* }).await } @@ -607,6 +610,7 @@ impl Action for GetMsg { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, + time_zone: self.time_zone, nick: row.get(3)?, content: row.get(4)?, seen: row.get(5)?, @@ -700,6 +704,7 @@ impl Action for GetTree { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, + time_zone: self.time_zone, nick: row.get(3)?, content: row.get(4)?, seen: row.get(5)?, From f555414716666197e021d1038c9bae9af3027785 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 02:53:04 +0100 Subject: [PATCH 033/109] Improve tz load error message very slightly --- cove/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cove/src/main.rs b/cove/src/main.rs index 338642c..5bce993 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -26,6 +26,7 @@ mod version; use std::path::PathBuf; +use anyhow::Context; use clap::Parser; use cove_config::doc::Document; use cove_config::Config; @@ -130,7 +131,8 @@ fn update_config_with_args(config: &mut Config, args: &Args) { } fn open_vault(config: &Config, dirs: &ProjectDirs) -> anyhow::Result { - let time_zone = util::load_time_zone(config.time_zone_ref())?; + let time_zone = + util::load_time_zone(config.time_zone_ref()).context("failed to load time zone")?; let time_zone = Box::leak(Box::new(time_zone)); let vault = if config.ephemeral { From f94eb00dcd068878223306a90efc81348bddaa09 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 16:30:01 +0100 Subject: [PATCH 034/109] Clean up config docs --- cove-config/src/doc.rs | 25 +++++-------------------- cove-config/src/lib.rs | 6 +----- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/cove-config/src/doc.rs b/cove-config/src/doc.rs index 3221eb5..16ed3ac 100644 --- a/cove-config/src/doc.rs +++ b/cove-config/src/doc.rs @@ -17,15 +17,11 @@ Here is an example config that changes a few different options: measure_widths = true rooms_sort_order = "importance" -[euph.rooms.welcome] -autojoin = true - -[euph.rooms.test] -username = "badingle" -force_username = true - -[euph.rooms.private] -password = "foobar" +[euph.servers."euphoria.leet.nu".rooms] +welcome.autojoin = true +test.username = "badingle" +test.force_username = true +private.password = "foobar" [keys] general.abort = ["esc", "ctrl+c"] @@ -33,17 +29,6 @@ general.exit = "ctrl+q" tree.action.fold_tree = "f" ``` -If you want to configure lots of rooms, TOML lets you write this in a more -compact way: - -```toml -[euph.rooms] -foo = { autojoin = true } -bar = { autojoin = true } -baz = { autojoin = true } -private = { autojoin = true, password = "foobar" } -``` - ## Key bindings Key bindings are specified as strings or lists of strings. Each string specifies diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 5d88867..4b5e2fe 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -49,7 +49,6 @@ pub struct Config { /// /// See also the `--ephemeral` command line option. #[serde(default)] - #[document(default = "`false`")] pub ephemeral: bool, /// Whether to measure the width of characters as displayed by the terminal @@ -61,7 +60,6 @@ pub struct Config { /// /// See also the `--measure-graphemes` command line option. #[serde(default)] - #[document(default = "`false`")] pub measure_widths: bool, /// Whether to start in offline mode. @@ -72,7 +70,6 @@ pub struct Config { /// /// See also the `--offline` command line option. #[serde(default)] - #[document(default = "`false`")] pub offline: bool, /// Initial sort order of rooms list. @@ -86,7 +83,6 @@ pub struct Config { /// 2. rooms with unread messages before rooms without /// 3. alphabetic order #[serde(default)] - #[document(default = "`\"alphabet\"`")] pub rooms_sort_order: RoomsSortOrder, /// Time zone that chat timestamps should be displayed in. @@ -108,7 +104,7 @@ pub struct Config { /// instead. However, you can still specify a path to a tz data file or a /// custom time zone string. #[serde(default)] - #[document(default = "$TZ or local time zone")] + #[document(default = "`$TZ` or local system time zone")] pub time_zone: Option, #[serde(default)] From a8570cf9c5ac71ce350a83a3f47e31b8c3059cf2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 17:02:57 +0100 Subject: [PATCH 035/109] Make TZ env var override time_zone config option --- cove-config/src/lib.rs | 5 ++--- cove/src/util.rs | 15 ++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 4b5e2fe..22fc332 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -96,9 +96,8 @@ pub struct Config { /// valid TZ strings: /// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones /// - /// If the option is not specified, cove uses the contents of the `TZ` - /// environment variable instead. If the `TZ` environment variable does not - /// exist, cove uses the system's local time zone. + /// If the `TZ` environment variable exists, it overrides this option. If + /// neither exist, cove uses the system's local time zone. /// /// **Warning:** On Windows, cove can't get the local time zone and uses UTC /// instead. However, you can still specify a path to a tz data file or a diff --git a/cove/src/util.rs b/cove/src/util.rs index 1bc9d6b..6bcbf3e 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -18,20 +18,21 @@ impl InfallibleExt for Result { } } -/// Load a [`TimeZone`] specified by a string, or by the `TZ` environment -/// variable if no string is provided. +/// Load a [`TimeZone`] specified by the `TZ` environment varible, or by the +/// provided string if the environment variable does not exist. /// /// If a string is provided, it is interpreted in the same format that the `TZ` /// environment variable uses. /// -/// If no string and no `TZ` environment variable could be found, the system -/// local time is used. +/// If no `TZ` environment variable could be found and no string is provided, +/// the system local time (or UTC on Windows) is used. pub fn load_time_zone(tz_string: Option<&str>) -> Result { - let env_tz = env::var("TZ").ok(); - let tz_string = tz_string.or(env_tz.as_ref().map(|s| s as &str)); + let env_string = env::var("TZ").ok(); + let tz_string = env_string.as_ref().map(|s| s as &str).or(tz_string); match &tz_string { - // At the moment, TimeZone::from_posix_tz does not support "localtime" on windows, but other time zon + // At the moment, TimeZone::from_posix_tz does not support "localtime" + // on Windows, so we handle that case manually. Some("localtime") | None => TimeZone::local(), Some(tz_string) => TimeZone::from_posix_tz(tz_string), } From 2d2dab11ba869d98f7df500893cb6e0f19850073 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 18:13:15 +0100 Subject: [PATCH 036/109] Reduce connection timout to 10 seconds --- CHANGELOG.md | 1 + cove/src/ui/euph/room.rs | 1 - cove/src/ui/rooms.rs | 5 ++++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a22b86..cfc6a53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Procedure when bumping the version number: Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. - Tweaked F1 popup - Tweaked chat message editor when nick list is foused +- Reduced connection timeout from 30 seconds to 10 seconds ### Fixed - Room deletion popup accepting any room name diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 8240ba5..c1c4fec 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -98,7 +98,6 @@ impl EuphRoom { pub fn connect(&mut self, next_instance_id: &mut usize) { if self.room.is_none() { let room = self.vault().room(); - // TODO Decrease ping timeout let instance_config = self .server_config .clone() diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index a2319f9..48e3ad3 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -5,6 +5,7 @@ use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::iter; use std::sync::{Arc, Mutex}; +use std::time::Duration; use cove_config::{Config, Keys, RoomsSortOrder}; use cove_input::InputEvent; @@ -60,7 +61,9 @@ impl EuphServer { let cookies = logging_unwrap!(vault.cookies(domain.clone()).await); let config = ServerConfig::default() .domain(domain) - .cookies(Arc::new(Mutex::new(cookies))); + .cookies(Arc::new(Mutex::new(cookies))) + .timeout(Duration::from_secs(10)); + Self { config, next_instance_id: 0, From 88ba77b95575ed2cd3396813eefb9b497421714e Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 18:24:17 +0100 Subject: [PATCH 037/109] Move domains in front of room names in the UI The reasoning behind this change in the room list is that putting the domain (which rarely changes) in front of the room name (which often changes) is a lot more readable. It also moves it away from the status info parentheses, making them more obvious again. The reasoning for the individual room view is consistency. Putting the domain at the end here looked fine, but putting it in front matches the room list and still looks fine. --- cove-config/CONFIG.md | 0 cove/src/ui/euph/room.rs | 5 ++--- cove/src/ui/rooms.rs | 21 +++++++++++++-------- 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 cove-config/CONFIG.md diff --git a/cove-config/CONFIG.md b/cove-config/CONFIG.md new file mode 100644 index 0000000..e69de29 diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index c1c4fec..b226b75 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -287,7 +287,8 @@ impl EuphRoom { async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget { let room_style = Style::new().bold().blue(); - let mut info = Styled::new(format!("&{}", self.name()), room_style); + let mut info = Styled::new(format!("{} ", self.domain()), Style::new().grey()) + .then(format!("&{}", self.name()), room_style); info = match state { None | Some(euph::State::Stopped) => info.then_plain(", archive"), @@ -310,8 +311,6 @@ impl EuphRoom { } }; - info = info.then(format!(" - {}", self.domain()), Style::new().grey()); - let unseen = self.unseen_msgs_count().await; if unseen > 0 { info = info diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 48e3ad3..4275b48 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -356,10 +356,9 @@ impl Rooms { fn sort_rooms(rooms: &mut [(&RoomIdentifier, Option<&euph::State>, usize)], order: Order) { match order { - Order::Alphabet => rooms.sort_unstable_by_key(|(id, _, _)| (&id.name, &id.domain)), - Order::Importance => rooms.sort_unstable_by_key(|(id, state, unseen)| { - (state.is_none(), *unseen == 0, &id.name, &id.domain) - }), + Order::Alphabet => rooms.sort_unstable_by_key(|(id, _, _)| *id), + Order::Importance => rooms + .sort_unstable_by_key(|(id, state, unseen)| (state.is_none(), *unseen == 0, *id)), } } @@ -379,15 +378,21 @@ impl Rooms { let id = id.clone(); let info = Self::format_room_info(state, unseen); list_builder.add_sel(id.clone(), move |selected| { - let style = if selected { + let domain_style = if selected { + Style::new().black().on_white() + } else { + Style::new().grey() + }; + + let room_style = if selected { Style::new().bold().black().on_white() } else { Style::new().bold().blue() }; - let text = Styled::new(format!("&{}", id.name), style) - .and_then(info) - .then(format!(" - {}", id.domain), Style::new().grey()); + let text = Styled::new(format!("{} ", id.domain), domain_style) + .then(format!("&{}", id.name), room_style) + .and_then(info); Text::new(text) }); From e0948c4f1ceabcf16b6cc5c6688af976ac4bd3f0 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 23:51:20 +0100 Subject: [PATCH 038/109] Fix duplicated key presses on windows --- CHANGELOG.md | 1 + cove-input/src/lib.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfc6a53..c4c3968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Procedure when bumping the version number: ### Fixed - Room deletion popup accepting any room name +- Duplicated key presses on Windows ## v0.7.1 - 2023-08-31 diff --git a/cove-input/src/lib.rs b/cove-input/src/lib.rs index b42fdcb..ba3bd63 100644 --- a/cove-input/src/lib.rs +++ b/cove-input/src/lib.rs @@ -4,7 +4,7 @@ use std::io; use std::sync::Arc; pub use cove_macro::KeyGroup; -use crossterm::event::{Event, KeyEvent}; +use crossterm::event::{Event, KeyEvent, KeyEventKind}; use parking_lot::FairMutex; use toss::{Frame, Terminal, WidthDb}; @@ -58,11 +58,15 @@ impl<'a> InputEvent<'a> { } } + /// If the current event represents a key press, returns the [`KeyEvent`] + /// associated with that key press. pub fn key_event(&self) -> Option { - match &self.event { - Event::Key(event) => Some(*event), - _ => None, + if let Event::Key(event) = &self.event { + if matches!(event.kind, KeyEventKind::Press | KeyEventKind::Repeat) { + return Some(*event); + } } + None } pub fn paste_event(&self) -> Option<&str> { From dadbb205e51ce43a69fc57e27f00fd7e7dde2766 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 3 Jan 2024 23:51:27 +0100 Subject: [PATCH 039/109] Fix cargo doc warnings --- cove-config/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 22fc332..fc1e6af 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -89,12 +89,12 @@ pub struct Config { /// /// This option is interpreted as a POSIX TZ string. It is described here in /// further detail: - /// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html + /// /// /// On a normal system, the string `"localtime"` as well as any value from /// the "TZ identifier" column of the following wikipedia article should be /// valid TZ strings: - /// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + /// /// /// If the `TZ` environment variable exists, it overrides this option. If /// neither exist, cove uses the system's local time zone. From a0b029b353bc80692c90513244bf9371297ebc7b Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 4 Jan 2024 13:52:18 +0100 Subject: [PATCH 040/109] Update dependencies --- Cargo.lock | 60 +++++++++++++++++++++---------------------- Cargo.toml | 4 +-- cove-macro/Cargo.toml | 6 ++--- cove/Cargo.toml | 6 ++--- flake.lock | 12 ++++----- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4cdb574..9061b62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", @@ -94,15 +94,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", @@ -396,9 +396,9 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -742,9 +742,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" @@ -900,18 +900,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1088,9 +1088,9 @@ checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" [[package]] name = "rustls-webpki" -version = "0.102.0" +version = "0.102.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2635c8bc2b88d367767c5de8ea1d8db9af3f6219eba28442242d9ab81d1b89" +checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" dependencies = [ "ring", "rustls-pki-types", @@ -1143,9 +1143,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] @@ -1162,9 +1162,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", @@ -1183,9 +1183,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -1287,9 +1287,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.43" +version = "2.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" dependencies = [ "proc-macro2", "quote", @@ -1311,18 +1311,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", @@ -1786,9 +1786,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.31" +version = "0.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index fbd9231..19a2d92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,9 @@ edition = "2021" [workspace.dependencies] crossterm = "0.27.0" parking_lot = "0.12.1" -serde = { version = "1.0.193", features = ["derive"] } +serde = { version = "1.0.194", features = ["derive"] } serde_either = "0.2.1" -thiserror = "1.0.52" +thiserror = "1.0.56" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index 637722e..f0ab3fe 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -5,9 +5,9 @@ edition = { workspace = true } [dependencies] case = "1.0.0" -proc-macro2 = "1.0.71" -quote = "1.0.33" -syn = "2.0.43" +proc-macro2 = "1.0.75" +quote = "1.0.35" +syn = "2.0.47" [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index b764a4a..15d5233 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -12,8 +12,8 @@ parking_lot = { workspace = true } thiserror = { workspace = true } toss = { workspace = true } -anyhow = "1.0.77" -async-trait = "0.1.75" +anyhow = "1.0.79" +async-trait = "0.1.77" clap = { version = "4.4.12", features = ["derive", "deprecated"] } cookie = "0.18.0" directories = "5.0.1" @@ -22,7 +22,7 @@ log = { version = "0.4.20", features = ["std"] } once_cell = "1.19.0" open = "5.0.1" rusqlite = { version = "0.30.0", features = ["bundled", "time"] } -serde_json = "1.0.108" +serde_json = "1.0.111" tokio = { version = "1.35.1", features = ["full"] } tz-rs = "0.6.14" unicode-segmentation = "1.10.1" diff --git a/flake.lock b/flake.lock index bc5ec53..4a3030f 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1679567394, - "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", "owner": "nix-community", "repo": "naersk", - "rev": "88cd22380154a2c36799fe8098888f0f59861a15", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1680643271, - "narHash": "sha256-m76rYcvqs+NzTyETfxh1o/9gKdBuJ/Hl+PI/kp73mDw=", + "lastModified": 1704371841, + "narHash": "sha256-ScUTxDRvgEK6W0hJqzodk4VZM1pqVJO3o/Ru99Oc7mI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "246567a3ad88e3119c2001e2fe78be233474cde0", + "rev": "526411af967efacb9f1efefe9c8664bede47b8b8", "type": "github" }, "original": { From 6352fcf6390cf21fa324331939d0b9f5333faf99 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 4 Jan 2024 13:54:03 +0100 Subject: [PATCH 041/109] Bump version to v0.8.0 --- CHANGELOG.md | 3 +++ CONFIG.md | 65 ++++++++++++++++++++++++++++++---------------------- Cargo.lock | 8 +++---- Cargo.toml | 2 +- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4c3968..6d9b50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,11 @@ Procedure when bumping the version number: ## Unreleased +## v0.8.0 - 2024-01-04 + ### Added - Support for multiple euph server domains +- Support for `TZ` environment variable - `time_zone` config option - `--domain` option to `cove export` command - `--domain` option to `cove clear-cookies` command diff --git a/CONFIG.md b/CONFIG.md index a3f25ac..fca0589 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -8,15 +8,11 @@ Here is an example config that changes a few different options: measure_widths = true rooms_sort_order = "importance" -[euph.rooms.welcome] -autojoin = true - -[euph.rooms.test] -username = "badingle" -force_username = true - -[euph.rooms.private] -password = "foobar" +[euph.servers."euphoria.leet.nu".rooms] +welcome.autojoin = true +test.username = "badingle" +test.force_username = true +private.password = "foobar" [keys] general.abort = ["esc", "ctrl+c"] @@ -24,17 +20,6 @@ general.exit = "ctrl+q" tree.action.fold_tree = "f" ``` -If you want to configure lots of rooms, TOML lets you write this in a more -compact way: - -```toml -[euph.rooms] -foo = { autojoin = true } -bar = { autojoin = true } -baz = { autojoin = true } -private = { autojoin = true, password = "foobar" } -``` - ## Key bindings Key bindings are specified as strings or lists of strings. Each string specifies @@ -94,7 +79,7 @@ any options related to the data dir. See also the `--ephemeral` command line option. -### `euph.rooms..autojoin` +### `euph.servers..rooms..autojoin` **Required:** yes **Type:** boolean @@ -102,7 +87,7 @@ See also the `--ephemeral` command line option. Whether to automatically join this room on startup. -### `euph.rooms..force_username` +### `euph.servers..rooms..force_username` **Required:** yes **Type:** boolean @@ -112,7 +97,7 @@ If `euph.rooms..username` is set, this will force cove to set the username even if there is already a different username associated with the current session. -### `euph.rooms..password` +### `euph.servers..rooms..password` **Required:** no **Type:** string @@ -120,7 +105,7 @@ the current session. If set, cove will try once to use this password to authenticate, should the room be password-protected. -### `euph.rooms..username` +### `euph.servers..rooms..username` **Required:** no **Type:** string @@ -642,15 +627,39 @@ See also the `--offline` command line option. **Required:** yes **Type:** string **Values:** `"alphabet"`, `"importance"` -**Default:** `alphabet` +**Default:** `"alphabet"` Initial sort order of rooms list. -`alphabet` sorts rooms in alphabetic order. +`"alphabet"` sorts rooms in alphabetic order. -`importance` sorts rooms by the following criteria (in descending order -of priority): +`"importance"` sorts rooms by the following criteria (in descending +order of priority): 1. connected rooms before unconnected rooms 2. rooms with unread messages before rooms without 3. alphabetic order + +### `time_zone` + +**Required:** no +**Type:** string +**Default:** `$TZ` or local system time zone + +Time zone that chat timestamps should be displayed in. + +This option is interpreted as a POSIX TZ string. It is described here in +further detail: + + +On a normal system, the string `"localtime"` as well as any value from +the "TZ identifier" column of the following wikipedia article should be +valid TZ strings: + + +If the `TZ` environment variable exists, it overrides this option. If +neither exist, cove uses the system's local time zone. + +**Warning:** On Windows, cove can't get the local time zone and uses UTC +instead. However, you can still specify a path to a tz data file or a +custom time zone string. diff --git a/Cargo.lock b/Cargo.lock index 9061b62..4e31d05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cove" -version = "0.7.1" +version = "0.8.0" dependencies = [ "anyhow", "async-trait", @@ -311,7 +311,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.7.1" +version = "0.8.0" dependencies = [ "cove-input", "cove-macro", @@ -322,7 +322,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.7.1" +version = "0.8.0" dependencies = [ "cove-macro", "crossterm", @@ -336,7 +336,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.7.1" +version = "0.8.0" dependencies = [ "case", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 19a2d92..f7b582f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" members = ["cove", "cove-*"] [workspace.package] -version = "0.7.1" +version = "0.8.0" edition = "2021" [workspace.dependencies] From ed7bd3ddb442ef85b94d3b5c749a267494dc08bf Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 4 Jan 2024 23:50:35 +0100 Subject: [PATCH 042/109] Remove key binding to open present page --- CHANGELOG.md | 3 +++ cove-config/src/keys.rs | 4 ---- cove/src/ui/euph/room.rs | 12 ------------ 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9b50e..0392309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Procedure when bumping the version number: ## Unreleased +### Removed +- Key binding to open present page + ## v0.8.0 - 2024-01-04 ### Added diff --git a/cove-config/src/keys.rs b/cove-config/src/keys.rs index 1f8a818..422798e 100644 --- a/cove-config/src/keys.rs +++ b/cove-config/src/keys.rs @@ -81,7 +81,6 @@ default_bindings! { pub fn nick => ["n"]; pub fn more_messages => ["m"]; pub fn account => ["A"]; - pub fn present => ["ctrl+p"]; } pub mod tree_cursor { @@ -286,9 +285,6 @@ pub struct RoomAction { /// Manage account. #[serde(default = "default::room_action::account")] pub account: KeyBinding, - /// Open room's plugh.de/present page. - #[serde(default = "default::room_action::present")] - pub present: KeyBinding, } #[derive(Debug, Default, Deserialize, Document)] diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index b226b75..d79ab3d 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -382,18 +382,6 @@ impl EuphRoom { _ => {} } - // Always applicable - if event.matches(&keys.room.action.present) { - let link = format!("https://plugh.de/present/{}/", self.name()); - if let Err(error) = open::that(&link) { - self.popups.push_front(RoomPopup::Error { - description: format!("Failed to open link: {link}"), - reason: format!("{error}"), - }); - } - return true; - } - false } From ab81c89854199306c00bcc5c1c30d497d34033c7 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 5 Jan 2024 14:25:09 +0100 Subject: [PATCH 043/109] Set window title The title includes the amount of unseen messages in the room or room list. The room list heading also now contains the amount of connected rooms as well as the amount of unseen messages in total (if any). --- CHANGELOG.md | 4 +++ Cargo.lock | 4 +-- Cargo.toml | 2 +- cove/src/ui/euph/room.rs | 12 ++++++- cove/src/ui/rooms.rs | 74 ++++++++++++++++++++++++++++------------ cove/src/vault/euph.rs | 16 +++++++++ 6 files changed, 86 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0392309..0ac199d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Added +- Support for setting window title +- More information to room list heading + ### Removed - Key binding to open present page diff --git a/Cargo.lock b/Cargo.lock index 4e31d05..f6f8d1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1477,8 +1477,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.2.0" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.0#2c7888fa413c9b12bec7d55a73051aa96d59386f" +version = "0.2.1" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.1#b01ee297d5bdbb3b28cafe2b5b130c2767667974" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index f7b582f..aa6a315 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ thiserror = "1.0.56" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.2.0" +tag = "v0.2.1" [profile.dev.package."*"] opt-level = 3 diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index d79ab3d..8fc2fe5 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -319,7 +319,17 @@ impl EuphRoom { .then_plain(")"); } - Text::new(info).padding().with_horizontal(1).border() + let title = if unseen > 0 { + format!("&{} ({unseen})", self.name()) + } else { + format!("&{}", self.name()) + }; + + Text::new(info) + .padding() + .with_horizontal(1) + .border() + .title(title) } async fn handle_chat_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> bool { diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 4275b48..f40bfc5 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -237,12 +237,16 @@ impl Rooms { } match &mut self.state { - State::ShowList => { - Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) - .await - .desync() - .boxed_async() - } + State::ShowList => Self::rooms_widget( + &self.vault, + self.config, + &mut self.list, + self.order, + &self.euph_rooms, + ) + .await + .desync() + .boxed_async(), State::ShowRoom(id) => { self.euph_rooms @@ -252,21 +256,29 @@ impl Rooms { .await } - State::Connect(connect) => { - Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) - .await - .below(connect.widget()) - .desync() - .boxed_async() - } + State::Connect(connect) => Self::rooms_widget( + &self.vault, + self.config, + &mut self.list, + self.order, + &self.euph_rooms, + ) + .await + .below(connect.widget()) + .desync() + .boxed_async(), - State::Delete(delete) => { - Self::rooms_widget(self.config, &mut self.list, self.order, &self.euph_rooms) - .await - .below(delete.widget()) - .desync() - .boxed_async() - } + State::Delete(delete) => Self::rooms_widget( + &self.vault, + self.config, + &mut self.list, + self.order, + &self.euph_rooms, + ) + .await + .below(delete.widget()) + .desync() + .boxed_async(), } } @@ -400,6 +412,7 @@ impl Rooms { } async fn rooms_widget<'a>( + vault: &Vault, config: &Config, list: &'a mut ListState, order: Order, @@ -419,8 +432,24 @@ impl Rooms { .with_horizontal(1) .border(); - let heading = Styled::new("Rooms", Style::new().bold()) - .then_plain(format!(" ({})", euph_rooms.len())); + let mut heading = Styled::new("Rooms", Style::new().bold()); + let mut title = "Rooms".to_string(); + + let total_rooms = euph_rooms.len(); + let connected_rooms = euph_rooms + .iter() + .filter(|r| r.1.room_state().is_some()) + .count(); + let total_unseen = logging_unwrap!(vault.euph().total_unseen_msgs_count().await); + if total_unseen > 0 { + heading = heading + .then_plain(format!(" ({connected_rooms}/{total_rooms}, ")) + .then(format!("{total_unseen}"), Style::new().bold().green()) + .then_plain(")"); + title.push_str(&format!(" ({total_unseen})")); + } else { + heading = heading.then_plain(format!(" ({connected_rooms}/{total_rooms})")) + } let mut list_builder = ListBuilder::new(); Self::render_rows(&mut list_builder, order, euph_rooms).await; @@ -435,6 +464,7 @@ impl Rooms { .segment() .with_growing(false), ) + .title(title) } async fn handle_showlist_input_event( diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 8091613..f922345 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -115,6 +115,7 @@ euph_vault_actions! { SetCookies : set_cookies(domain: String, cookies: CookieJar) -> (); ClearCookies : clear_cookies(domain: Option) -> (); GetRooms : rooms() -> Vec; + GetTotalUnseenMsgsCount : total_unseen_msgs_count() -> usize; } impl Action for GetCookies { @@ -212,6 +213,21 @@ impl Action for GetRooms { } } +impl Action for GetTotalUnseenMsgsCount { + type Output = usize; + type Error = rusqlite::Error; + + fn run(self, conn: &mut Connection) -> Result { + conn.prepare( + " + SELECT COALESCE(SUM(amount), 0) + FROM euph_unseen_counts + ", + )? + .query_row([], |row| row.get(0)) + } +} + /////////////////// // EuphRoomVault // /////////////////// From ee7121b04e1c0fb9ba09d68aa1e4e670cced877f Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 5 Jan 2024 23:21:06 +0100 Subject: [PATCH 044/109] Implement live caesar cipher --- CHANGELOG.md | 1 + cove-config/src/keys.rs | 8 +++++++ cove/src/ui/chat.rs | 36 +++++++++++++++++++++++++++---- cove/src/ui/chat/tree.rs | 4 ++++ cove/src/ui/chat/tree/renderer.rs | 3 ++- cove/src/ui/chat/tree/scroll.rs | 1 + cove/src/ui/chat/tree/widgets.rs | 14 ++++++++++++ cove/src/util.rs | 19 ++++++++++++++++ 8 files changed, 81 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac199d..51bbdc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Procedure when bumping the version number: ### Added - Support for setting window title - More information to room list heading +- Key bindings for live caesar cipher de- and encoding ### Removed - Key binding to open present page diff --git a/cove-config/src/keys.rs b/cove-config/src/keys.rs index 422798e..8b5adeb 100644 --- a/cove-config/src/keys.rs +++ b/cove-config/src/keys.rs @@ -104,6 +104,8 @@ default_bindings! { pub fn mark_older_seen => ["ctrl+s"]; pub fn info => ["i"]; pub fn links => ["I"]; + pub fn increase_caesar => ["c"]; + pub fn decrease_caesar => ["C"]; } } @@ -354,6 +356,12 @@ pub struct TreeAction { /// List links found in message. #[serde(default = "default::tree_action::links")] pub links: KeyBinding, + /// Increase caesar cipher rotation. + #[serde(default = "default::tree_action::increase_caesar")] + pub increase_caesar: KeyBinding, + /// Decrease caesar cipher rotation. + #[serde(default = "default::tree_action::decrease_caesar")] + pub decrease_caesar: KeyBinding, } #[derive(Debug, Default, Deserialize, Document)] diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 6a9c9c2..c8a310c 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -11,6 +11,7 @@ use toss::widgets::{BoxedAsync, EditorState}; use toss::{Styled, WidgetExt}; use crate::store::{Msg, MsgStore}; +use crate::util; use self::cursor::Cursor; use self::tree::TreeViewState; @@ -33,6 +34,7 @@ pub struct ChatState> { cursor: Cursor, editor: EditorState, + caesar: i8, mode: Mode, tree: TreeViewState, @@ -43,6 +45,7 @@ impl + Clone> ChatState { Self { cursor: Cursor::Bottom, editor: EditorState::new(), + caesar: 0, mode: Mode::Tree, tree: TreeViewState::new(store.clone()), @@ -68,7 +71,13 @@ impl> ChatState { match self.mode { Mode::Tree => self .tree - .widget(&mut self.cursor, &mut self.editor, nick, focused) + .widget( + &mut self.cursor, + &mut self.editor, + nick, + focused, + self.caesar, + ) .boxed_async(), } } @@ -85,7 +94,7 @@ impl> ChatState { S: Send + Sync, S::Error: Send, { - match self.mode { + let reaction = match self.mode { Mode::Tree => { self.tree .handle_input_event( @@ -95,9 +104,28 @@ impl> ChatState { &mut self.editor, can_compose, ) - .await + .await? } - } + }; + + Ok(match reaction { + Reaction::Composed { parent, content } if self.caesar != 0 => { + let content = util::caesar(&content, self.caesar); + Reaction::Composed { parent, content } + } + + Reaction::NotHandled if event.matches(&keys.tree.action.increase_caesar) => { + self.caesar = (self.caesar + 1).rem_euclid(26); + Reaction::Handled + } + + Reaction::NotHandled if event.matches(&keys.tree.action.decrease_caesar) => { + self.caesar = (self.caesar - 1).rem_euclid(26); + Reaction::Handled + } + + reaction => reaction, + }) } pub fn cursor(&self) -> Option<&M::Id> { diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index 772363f..37972e5 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -386,6 +386,7 @@ impl> TreeViewState { editor: &'a mut EditorState, nick: String, focused: bool, + caesar: i8, ) -> TreeView<'a, M, S> { TreeView { state: self, @@ -393,6 +394,7 @@ impl> TreeViewState { editor, nick, focused, + caesar, } } } @@ -405,6 +407,7 @@ pub struct TreeView<'a, M: Msg, S: MsgStore> { nick: String, focused: bool, + caesar: i8, } #[async_trait] @@ -432,6 +435,7 @@ where size, nick: self.nick.clone(), focused: self.focused, + caesar: self.caesar, last_cursor: self.state.last_cursor.clone(), last_cursor_top: self.state.last_cursor_top, }; diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 945f77c..99f32b5 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -72,6 +72,7 @@ pub struct TreeContext { pub size: Size, pub nick: String, pub focused: bool, + pub caesar: i8, pub last_cursor: Cursor, pub last_cursor_top: i32, } @@ -190,7 +191,7 @@ where }; let highlighted = highlighted && self.context.focused; - let widget = widgets::msg(highlighted, indent, msg, folded_info); + let widget = widgets::msg(highlighted, indent, msg, self.context.caesar, folded_info); let widget = Self::predraw(widget, self.context.size, self.widthdb); Block::new(TreeBlockId::Msg(msg_id), widget, true) } diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index 482c7ca..822b0b5 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -20,6 +20,7 @@ where size: self.last_size, nick: self.last_nick.clone(), focused: true, + caesar: 0, last_cursor: self.last_cursor.clone(), last_cursor_top: self.last_cursor_top, } diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index 2f1a1ff..9eb6690 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -7,6 +7,7 @@ use toss::{Style, Styled, WidgetExt}; use crate::store::Msg; use crate::ui::chat::widgets::{Indent, Seen, Time}; use crate::ui::ChatMsg; +use crate::util; pub const PLACEHOLDER: &str = "[...]"; @@ -30,6 +31,10 @@ fn style_indent(highlighted: bool) -> Style { } } +fn style_caesar() -> Style { + Style::new().green() +} + fn style_info() -> Style { Style::new().italic().dark_grey() } @@ -46,10 +51,19 @@ pub fn msg( highlighted: bool, indent: usize, msg: &M, + caesar: i8, folded_info: Option, ) -> Boxed<'static, Infallible> { let (nick, mut content) = msg.styled(); + if caesar != 0 { + // Apply caesar in inverse because we're decoding + let rotated = util::caesar(content.text(), -caesar); + content = content + .then_plain("\n") + .then(format!("{rotated} [rot{caesar}]"), style_caesar()); + } + if let Some(amount) = folded_info { content = content .then_plain("\n") diff --git a/cove/src/util.rs b/cove/src/util.rs index 6bcbf3e..4844d68 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -48,3 +48,22 @@ pub fn convert_to_time_zone(tz: &TimeZone, time: OffsetDateTime) -> Option String { + let by = by.rem_euclid(26) as u8; + text.chars() + .map(|c| { + if c.is_ascii_lowercase() { + let c = c as u8 - b'a'; + let c = (c + by) % 26; + (c + b'a') as char + } else if c.is_ascii_uppercase() { + let c = c as u8 - b'A'; + let c = (c + by) % 26; + (c + b'A') as char + } else { + c + } + }) + .collect() +} From 37e4c6b845b9c8eb7603dc7c642621f29d987a0c Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 11 Jan 2024 11:22:34 +0100 Subject: [PATCH 045/109] Update dependencies --- Cargo.lock | 48 +++++++++++++++++++++---------------------- Cargo.toml | 2 +- cove-macro/Cargo.toml | 4 ++-- cove/Cargo.toml | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6f8d1c..fd1c572 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" [[package]] name = "bitflags" @@ -202,9 +202,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.12" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" dependencies = [ "clap_builder", "clap_derive", @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" dependencies = [ "anstream", "anstyle", @@ -346,9 +346,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -564,9 +564,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -683,9 +683,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libredox" @@ -900,9 +900,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -1045,9 +1045,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6b63262c9fcac8659abfaa96cac103d28166d3ff3eaf8f412e19f3ae9e5a48" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "log", "ring", @@ -1143,9 +1143,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -1162,9 +1162,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -1287,9 +1287,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.47" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1786,9 +1786,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.32" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index aa6a315..8d469eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" [workspace.dependencies] crossterm = "0.27.0" parking_lot = "0.12.1" -serde = { version = "1.0.194", features = ["derive"] } +serde = { version = "1.0.195", features = ["derive"] } serde_either = "0.2.1" thiserror = "1.0.56" diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index f0ab3fe..dcfc17b 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -5,9 +5,9 @@ edition = { workspace = true } [dependencies] case = "1.0.0" -proc-macro2 = "1.0.75" +proc-macro2 = "1.0.76" quote = "1.0.35" -syn = "2.0.47" +syn = "2.0.48" [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 15d5233..d1e41aa 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -14,7 +14,7 @@ toss = { workspace = true } anyhow = "1.0.79" async-trait = "0.1.77" -clap = { version = "4.4.12", features = ["derive", "deprecated"] } +clap = { version = "4.4.14", features = ["derive", "deprecated"] } cookie = "0.18.0" directories = "5.0.1" linkify = "0.10.0" From 133681fc621540a95443d5b09af704b57e24c857 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 11 Jan 2024 11:25:45 +0100 Subject: [PATCH 046/109] Bump version to v0.8.1 --- CHANGELOG.md | 2 ++ CONFIG.md | 24 ++++++++++++++++-------- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51bbdc8..2ea84d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Procedure when bumping the version number: ## Unreleased +## v0.8.1 - 2024-01-11 + ### Added - Support for setting window title - More information to room list heading diff --git a/CONFIG.md b/CONFIG.md index fca0589..af50003 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -321,14 +321,6 @@ Download more messages. Change nick. -### `keys.room.action.present` - -**Required:** yes -**Type:** key binding -**Default:** `"ctrl+p"` - -Open room's plugh.de/present page. - ### `keys.rooms.action.change_sort_order` **Required:** yes @@ -457,6 +449,14 @@ Scroll up half a screen. Scroll up one line. +### `keys.tree.action.decrease_caesar` + +**Required:** yes +**Type:** key binding +**Default:** `"C"` + +Decrease caesar cipher rotation. + ### `keys.tree.action.fold_tree` **Required:** yes @@ -465,6 +465,14 @@ Scroll up one line. Fold current message's subtree. +### `keys.tree.action.increase_caesar` + +**Required:** yes +**Type:** key binding +**Default:** `"c"` + +Increase caesar cipher rotation. + ### `keys.tree.action.inspect` **Required:** yes diff --git a/Cargo.lock b/Cargo.lock index fd1c572..9be7313 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cove" -version = "0.8.0" +version = "0.8.1" dependencies = [ "anyhow", "async-trait", @@ -311,7 +311,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.8.0" +version = "0.8.1" dependencies = [ "cove-input", "cove-macro", @@ -322,7 +322,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.8.0" +version = "0.8.1" dependencies = [ "cove-macro", "crossterm", @@ -336,7 +336,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.8.0" +version = "0.8.1" dependencies = [ "case", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 8d469eb..9117885 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" members = ["cove", "cove-*"] [workspace.package] -version = "0.8.0" +version = "0.8.1" edition = "2021" [workspace.dependencies] From a5b33440c5f9c4724954d17294957aaa2c9eb82c Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 12 Jan 2024 22:21:42 +0100 Subject: [PATCH 047/109] Fix spelling of "indexes" --- cove/src/vault/migrate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove/src/vault/migrate.rs b/cove/src/vault/migrate.rs index ed26db6..cc85c2c 100644 --- a/cove/src/vault/migrate.rs +++ b/cove/src/vault/migrate.rs @@ -194,7 +194,7 @@ fn m3(tx: &mut Transaction<'_>, nr: usize, total: usize) -> rusqlite::Result<()> ", )?; - eprintln!(" Recreating indices..."); + eprintln!(" Recreating indexes..."); tx.execute_batch( " CREATE INDEX euph_idx_msgs_domain_room_id_parent From 998a2f2ffdf248bd0d0b378330cc2e25a568a60c Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 14 Jan 2024 12:41:48 +0100 Subject: [PATCH 048/109] Fix crash when window too small with msg editor visible --- CHANGELOG.md | 3 +++ Cargo.lock | 4 ++-- Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ea84d9..8f5a49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ Procedure when bumping the version number: ### Removed - Key binding to open present page +### Fixed +- Crash when window is too small while empty message editor is visible + ## v0.8.0 - 2024-01-04 ### Added diff --git a/Cargo.lock b/Cargo.lock index 9be7313..62cfe27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1477,8 +1477,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.2.1" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.1#b01ee297d5bdbb3b28cafe2b5b130c2767667974" +version = "0.2.2" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.2#761e8baeba09b923e2a409ea7df7bb363fc77fd5" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 9117885..da87015 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ thiserror = "1.0.56" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.2.1" +tag = "v0.2.2" [profile.dev.package."*"] opt-level = 3 From 50be653244492fcd1d3c6f486446b180739e9944 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 27 Jan 2024 13:21:59 +0100 Subject: [PATCH 049/109] Fix incorrect cli option reference --- CHANGELOG.md | 7 ++++--- cove-config/src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f5a49a..a792d9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Fixed +- Crash when window is too small while empty message editor is visible +- Mistakes in output and docs + ## v0.8.1 - 2024-01-11 ### Added @@ -25,9 +29,6 @@ Procedure when bumping the version number: ### Removed - Key binding to open present page -### Fixed -- Crash when window is too small while empty message editor is visible - ## v0.8.0 - 2024-01-04 ### Added diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index fc1e6af..76f56e1 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -58,7 +58,7 @@ pub struct Config { /// might also flash when encountering new characters (or, more accurately, /// graphemes). /// - /// See also the `--measure-graphemes` command line option. + /// See also the `--measure-widths` command line option. #[serde(default)] pub measure_widths: bool, From 131b5818802328f23aca2050f43e16949f4bcedf Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 8 Mar 2024 22:19:21 +0100 Subject: [PATCH 050/109] Change json-stream export format to json-lines --- CHANGELOG.md | 4 ++++ cove/src/export.rs | 12 +++++++----- cove/src/export/json.rs | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a792d9e..614d940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Changed +- Renamed `json-stream` export format to `json-lines` (see ) +- Changed `json-lines` file extension from `.json` to `.jsonl` + ### Fixed - Crash when window is too small while empty message editor is visible - Mistakes in output and docs diff --git a/cove/src/export.rs b/cove/src/export.rs index 9d9c60b..0ad9414 100644 --- a/cove/src/export.rs +++ b/cove/src/export.rs @@ -14,8 +14,9 @@ pub enum Format { Text, /// Array of message objects in the same format as the euphoria API uses. Json, - /// Message objects in the same format as the euphoria API uses, one per line. - JsonStream, + /// Message objects in the same format as the euphoria API uses, one per + /// line (https://jsonlines.org/). + JsonLines, } impl Format { @@ -23,14 +24,15 @@ impl Format { match self { Self::Text => "text", Self::Json => "json", - Self::JsonStream => "json stream", + Self::JsonLines => "json lines", } } fn extension(&self) -> &'static str { match self { Self::Text => "txt", - Self::Json | Self::JsonStream => "json", + Self::Json => "json", + Self::JsonLines => "jsonl", } } } @@ -78,7 +80,7 @@ async fn export_room( match format { Format::Text => text::export(vault, out).await?, Format::Json => json::export(vault, out).await?, - Format::JsonStream => json::export_stream(vault, out).await?, + Format::JsonLines => json::export_lines(vault, out).await?, } Ok(()) } diff --git a/cove/src/export/json.rs b/cove/src/export/json.rs index e72a0b8..9c16e46 100644 --- a/cove/src/export/json.rs +++ b/cove/src/export/json.rs @@ -37,7 +37,7 @@ pub async fn export(vault: &EuphRoomVault, file: &mut W) -> anyhow::Re Ok(()) } -pub async fn export_stream(vault: &EuphRoomVault, file: &mut W) -> anyhow::Result<()> { +pub async fn export_lines(vault: &EuphRoomVault, file: &mut W) -> anyhow::Result<()> { let mut total = 0; let mut last_msg_id = None; loop { From db529688e97cb3bc1177f28ccdf628474cb41d9c Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Apr 2024 20:36:14 +0200 Subject: [PATCH 051/109] Use cargo workspace lints --- Cargo.toml | 9 +++++++++ cove-config/Cargo.toml | 3 +++ cove-config/src/lib.rs | 11 ----------- cove-input/Cargo.toml | 3 +++ cove-macro/Cargo.toml | 3 +++ cove-macro/src/lib.rs | 11 ----------- cove/Cargo.toml | 3 +++ cove/src/main.rs | 11 ----------- 8 files changed, 21 insertions(+), 33 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da87015..a6d5cec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,5 +19,14 @@ thiserror = "1.0.56" git = "https://github.com/Garmelon/toss.git" tag = "v0.2.2" +[workspace.lints] +rust.unsafe_code = "forbid" +rust.future_incompatible = "warn" +rust.rust_2018_idioms = "warn" +rust.unused = "warn" +rust.noop_method_call = "warn" +rust.single_use_lifetimes = "warn" +clippy.use_self = "warn" + [profile.dev.package."*"] opt-level = 3 diff --git a/cove-config/Cargo.toml b/cove-config/Cargo.toml index c05257d..296899f 100644 --- a/cove-config/Cargo.toml +++ b/cove-config/Cargo.toml @@ -11,3 +11,6 @@ serde = { workspace = true } thiserror = { workspace = true } toml = "0.8.8" + +[lints] +workspace = true diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 76f56e1..086e372 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -1,14 +1,3 @@ -#![forbid(unsafe_code)] -// Rustc lint groups -#![warn(future_incompatible)] -#![warn(rust_2018_idioms)] -#![warn(unused)] -// Rustc lints -#![warn(noop_method_call)] -#![warn(single_use_lifetimes)] -// Clippy lints -#![warn(clippy::use_self)] - pub mod doc; mod euph; mod keys; diff --git a/cove-input/Cargo.toml b/cove-input/Cargo.toml index dd6d23d..428060f 100644 --- a/cove-input/Cargo.toml +++ b/cove-input/Cargo.toml @@ -14,3 +14,6 @@ thiserror = { workspace = true } toss = { workspace = true } edit = "0.1.5" + +[lints] +workspace = true diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index dcfc17b..bd11d13 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -11,3 +11,6 @@ syn = "2.0.48" [lib] proc-macro = true + +[lints] +workspace = true diff --git a/cove-macro/src/lib.rs b/cove-macro/src/lib.rs index 82ef61a..fd09f5f 100644 --- a/cove-macro/src/lib.rs +++ b/cove-macro/src/lib.rs @@ -1,14 +1,3 @@ -#![forbid(unsafe_code)] -// Rustc lint groups -#![warn(future_incompatible)] -#![warn(rust_2018_idioms)] -#![warn(unused)] -// Rustc lints -#![warn(noop_method_call)] -#![warn(single_use_lifetimes)] -// Clippy lints -#![warn(clippy::use_self)] - use syn::{parse_macro_input, DeriveInput}; mod document; diff --git a/cove/Cargo.toml b/cove/Cargo.toml index d1e41aa..7783bbb 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -45,3 +45,6 @@ features = ["bot"] git = "https://github.com/Garmelon/vault.git" tag = "v0.3.0" features = ["tokio"] + +[lints] +workspace = true diff --git a/cove/src/main.rs b/cove/src/main.rs index 5bce993..8f51b40 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -1,14 +1,3 @@ -#![forbid(unsafe_code)] -// Rustc lint groups -#![warn(future_incompatible)] -#![warn(rust_2018_idioms)] -#![warn(unused)] -// Rustc lints -#![warn(noop_method_call)] -#![warn(single_use_lifetimes)] -// Clippy lints -#![warn(clippy::use_self)] - // TODO Enable warn(unreachable_pub)? // TODO Remove unnecessary Debug impls and compare compile times // TODO Time zones other than UTC From 3a3d42bcf3dcf985b17649232eb40d878050922d Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Apr 2024 20:36:34 +0200 Subject: [PATCH 052/109] Fix clippy warning --- cove-input/src/keys.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove-input/src/keys.rs b/cove-input/src/keys.rs index 4ede713..337a5f3 100644 --- a/cove-input/src/keys.rs +++ b/cove-input/src/keys.rs @@ -151,7 +151,7 @@ impl FromStr for KeyPress { let mut parts = s.split('+'); let code = parts.next_back().ok_or(ParseKeysError::NoKeyCode)?; - let mut keys = KeyPress::parse_key_code(code)?; + let mut keys = Self::parse_key_code(code)?; let shift_allowed = !conflicts_with_shift(keys.code); for modifier in parts { keys.parse_modifier(modifier, shift_allowed)?; From c2cfa6e527b65458094bed1a4da0e8fb7908823b Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Apr 2024 20:37:42 +0200 Subject: [PATCH 053/109] Remove todos --- Cargo.toml | 2 -- cove/src/main.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a6d5cec..f0bb211 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ -# TODO Configure lints in here - [workspace] resolver = "2" members = ["cove", "cove-*"] diff --git a/cove/src/main.rs b/cove/src/main.rs index 8f51b40..fc14b56 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -1,6 +1,4 @@ -// TODO Enable warn(unreachable_pub)? // TODO Remove unnecessary Debug impls and compare compile times -// TODO Time zones other than UTC // TODO Invoke external notification command? mod euph; From d3666674b254c4926d567bf3dc44690aa36d4859 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Apr 2024 20:32:41 +0200 Subject: [PATCH 054/109] Update dependencies --- CHANGELOG.md | 1 + Cargo.lock | 399 +++++++++++++++++++++-------------------- Cargo.toml | 6 +- cove-config/Cargo.toml | 2 +- cove-macro/Cargo.toml | 6 +- cove/Cargo.toml | 24 +-- flake.lock | 12 +- 7 files changed, 231 insertions(+), 219 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 614d940..595d8fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Procedure when bumping the version number: ### Fixed - Crash when window is too small while empty message editor is visible - Mistakes in output and docs +- Cove not cleaning up terminal state properly ## v0.8.1 - 2024-01-11 diff --git a/Cargo.lock b/Cargo.lock index 62cfe27..08bbc62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -31,24 +31,24 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -60,9 +60,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -94,15 +94,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", @@ -111,15 +111,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.6" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "bitflags" @@ -144,9 +144,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block-buffer" @@ -165,9 +165,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "case" @@ -187,12 +187,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" [[package]] name = "cfg-if" @@ -202,9 +199,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.14" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -212,9 +209,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.14" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", @@ -224,9 +221,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck", "proc-macro2", @@ -236,9 +233,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -248,15 +245,15 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const_fn" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" +checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d" [[package]] name = "cookie" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "time", "version_check", @@ -359,7 +356,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "crossterm_winapi", "libc", "mio", @@ -447,9 +444,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "equivalent" @@ -501,9 +498,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fnv" @@ -564,9 +561,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", @@ -591,24 +588,24 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.4" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "692eaaf7f7607518dd3cef090f1474b61edc5301d8012f09579920df68b725ee" dependencies = [ "hashbrown", ] [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "home" @@ -621,9 +618,9 @@ dependencies = [ [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -648,9 +645,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -677,32 +674,31 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" dependencies = [ "cc", "pkg-config", @@ -720,9 +716,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -736,30 +732,30 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", @@ -768,10 +764,16 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.17" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -803,9 +805,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "open" -version = "5.0.1" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90878fb664448b54c4e592455ad02831e23a3f7e157374a8b95654731aac7349" +checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32" dependencies = [ "is-wsl", "libc", @@ -870,9 +872,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -882,9 +884,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "powerfmt" @@ -900,18 +902,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -957,9 +959,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", @@ -968,9 +970,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -980,9 +982,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -991,31 +993,32 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rusqlite" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" +checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1032,11 +1035,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -1045,9 +1048,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", @@ -1072,9 +1075,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ "base64", "rustls-pki-types", @@ -1082,15 +1085,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.1.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9d979b3ce68192e42760c7810125eb6cf2ea10efae545a156063e61f314e2a" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" [[package]] name = "rustls-webpki" -version = "0.102.1" +version = "0.102.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4ca26037c909dedb327b48c3327d0ba91d3dd3c4e05dad328f210ffb68e95b" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ "ring", "rustls-pki-types", @@ -1099,9 +1102,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" @@ -1120,9 +1123,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1133,9 +1136,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -1143,9 +1146,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] @@ -1162,9 +1165,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", @@ -1183,9 +1186,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -1235,9 +1238,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -1253,18 +1256,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1275,9 +1278,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" @@ -1287,9 +1290,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -1298,31 +1301,30 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", @@ -1331,12 +1333,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -1351,10 +1354,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -1375,9 +1379,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -1416,9 +1420,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -1443,9 +1447,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", @@ -1464,9 +1468,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" dependencies = [ "indexmap", "serde", @@ -1477,8 +1481,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.2.2" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.2#761e8baeba09b923e2a409ea7df7bb363fc77fd5" +version = "0.2.3" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.3#b1d7221bae9e1bb57d8e5b49c315dc3ca56e947a" dependencies = [ "async-trait", "crossterm", @@ -1525,9 +1529,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -1543,18 +1547,18 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -1593,8 +1597,8 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "vault" -version = "0.3.0" -source = "git+https://github.com/Garmelon/vault.git?tag=v0.3.0#6640f601f3b4eef4ed7201e9fc197cbac3228dad" +version = "0.4.0" +source = "git+https://github.com/Garmelon/vault.git?tag=v0.4.0#a53254d2e787d15fd2d00584fddf9b84e79572ee" dependencies = [ "rusqlite", "tokio", @@ -1667,7 +1671,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1687,17 +1691,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1708,9 +1713,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -1720,9 +1725,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -1732,9 +1737,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -1744,9 +1755,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -1756,9 +1767,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -1768,9 +1779,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -1780,15 +1791,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.5.34" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index f0bb211..c3b37a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,13 +9,13 @@ edition = "2021" [workspace.dependencies] crossterm = "0.27.0" parking_lot = "0.12.1" -serde = { version = "1.0.195", features = ["derive"] } +serde = { version = "1.0.198", features = ["derive"] } serde_either = "0.2.1" -thiserror = "1.0.56" +thiserror = "1.0.59" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.2.2" +tag = "v0.2.3" [workspace.lints] rust.unsafe_code = "forbid" diff --git a/cove-config/Cargo.toml b/cove-config/Cargo.toml index 296899f..b9c7300 100644 --- a/cove-config/Cargo.toml +++ b/cove-config/Cargo.toml @@ -10,7 +10,7 @@ cove-macro = { path = "../cove-macro" } serde = { workspace = true } thiserror = { workspace = true } -toml = "0.8.8" +toml = "0.8.12" [lints] workspace = true diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index bd11d13..acd55fd 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -5,9 +5,9 @@ edition = { workspace = true } [dependencies] case = "1.0.0" -proc-macro2 = "1.0.76" -quote = "1.0.35" -syn = "2.0.48" +proc-macro2 = "1.0.81" +quote = "1.0.36" +syn = "2.0.60" [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 7783bbb..7ea2b12 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -12,24 +12,24 @@ parking_lot = { workspace = true } thiserror = { workspace = true } toss = { workspace = true } -anyhow = "1.0.79" -async-trait = "0.1.77" -clap = { version = "4.4.14", features = ["derive", "deprecated"] } -cookie = "0.18.0" +anyhow = "1.0.82" +async-trait = "0.1.80" +clap = { version = "4.5.4", features = ["derive", "deprecated"] } +cookie = "0.18.1" directories = "5.0.1" linkify = "0.10.0" -log = { version = "0.4.20", features = ["std"] } +log = { version = "0.4.21", features = ["std"] } once_cell = "1.19.0" -open = "5.0.1" -rusqlite = { version = "0.30.0", features = ["bundled", "time"] } -serde_json = "1.0.111" -tokio = { version = "1.35.1", features = ["full"] } +open = "5.1.2" +rusqlite = { version = "0.31.0", features = ["bundled", "time"] } +serde_json = "1.0.116" +tokio = { version = "1.37.0", features = ["full"] } tz-rs = "0.6.14" -unicode-segmentation = "1.10.1" +unicode-segmentation = "1.11.0" unicode-width = "0.1.11" [dependencies.time] -version = "0.3.31" +version = "0.3.36" features = ["macros", "formatting", "parsing", "serde"] [dependencies.tokio-tungstenite] @@ -43,7 +43,7 @@ features = ["bot"] [dependencies.vault] git = "https://github.com/Garmelon/vault.git" -tag = "v0.3.0" +tag = "v0.4.0" features = ["tokio"] [lints] diff --git a/flake.lock b/flake.lock index 4a3030f..1e52d47 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1698420672, - "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "lastModified": 1713520724, + "narHash": "sha256-CO8MmVDmqZX2FovL75pu5BvwhW+Vugc7Q6ze7Hj8heI=", "owner": "nix-community", "repo": "naersk", - "rev": "aeb58d5e8faead8980a807c840232697982d47b9", + "rev": "c5037590290c6c7dae2e42e7da1e247e54ed2d49", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704371841, - "narHash": "sha256-ScUTxDRvgEK6W0hJqzodk4VZM1pqVJO3o/Ru99Oc7mI=", + "lastModified": 1714068967, + "narHash": "sha256-jfQUewdwBVs0HHLH10qxyn0+J53e1aQoPSkuBnYf15s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "526411af967efacb9f1efefe9c8664bede47b8b8", + "rev": "10b682b6e5ed139ee2bef863ada3043f2d79c1cc", "type": "github" }, "original": { From db734c57406d5b42ca07a020e385fc349551932d Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 25 Apr 2024 20:45:00 +0200 Subject: [PATCH 055/109] Bump version to 0.8.2 --- CHANGELOG.md | 2 ++ CONFIG.md | 2 +- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595d8fb..d9f1927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Procedure when bumping the version number: ## Unreleased +## v0.8.2 - 2024-04-25 + ### Changed - Renamed `json-stream` export format to `json-lines` (see ) - Changed `json-lines` file extension from `.json` to `.jsonl` diff --git a/CONFIG.md b/CONFIG.md index af50003..66625d0 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -614,7 +614,7 @@ Enabling this makes rendering a bit slower but more accurate. The screen might also flash when encountering new characters (or, more accurately, graphemes). -See also the `--measure-graphemes` command line option. +See also the `--measure-widths` command line option. ### `offline` diff --git a/Cargo.lock b/Cargo.lock index 08bbc62..441e80e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -277,7 +277,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cove" -version = "0.8.1" +version = "0.8.2" dependencies = [ "anyhow", "async-trait", @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.8.1" +version = "0.8.2" dependencies = [ "cove-input", "cove-macro", @@ -319,7 +319,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.8.1" +version = "0.8.2" dependencies = [ "cove-macro", "crossterm", @@ -333,7 +333,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.8.1" +version = "0.8.2" dependencies = [ "case", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index c3b37a1..178b652 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["cove", "cove-*"] [workspace.package] -version = "0.8.1" +version = "0.8.2" edition = "2021" [workspace.dependencies] From 19242a658ecdd45438b0852cff53c8fb9ec6e379 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 20 May 2024 19:12:41 +0200 Subject: [PATCH 056/109] Update dependencies --- Cargo.lock | 230 ++++++++++++++++++++--------------------- Cargo.toml | 6 +- cove-config/Cargo.toml | 2 +- cove-macro/Cargo.toml | 4 +- cove/Cargo.toml | 10 +- 5 files changed, 123 insertions(+), 129 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 441e80e..40f6699 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,55 +38,50 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -94,9 +89,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" @@ -111,9 +106,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" @@ -132,15 +127,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -187,9 +176,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.95" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" [[package]] name = "cfg-if" @@ -239,9 +228,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "const_fn" @@ -356,7 +345,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.5.0", + "bitflags", "crossterm_winapi", "libc", "mio", @@ -387,9 +376,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "deranged" @@ -444,9 +433,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "equivalent" @@ -456,9 +445,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -466,8 +455,8 @@ dependencies = [ [[package]] name = "euphoxide" -version = "0.5.0" -source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.5.0#276ff685127c4c392a2ab001f80f7a053e58746b" +version = "0.5.1" +source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.5.1#0256329f65f3ed853092cc210ae2a4a8c526a4bf" dependencies = [ "async-trait", "caseless", @@ -498,9 +487,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fnv" @@ -561,9 +550,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -578,19 +567,18 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", - "allocator-api2", ] [[package]] name = "hashlink" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692eaaf7f7607518dd3cef090f1474b61edc5301d8012f09579920df68b725ee" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ "hashbrown", ] @@ -672,6 +660,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itoa" version = "1.0.11" @@ -680,9 +674,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libredox" @@ -690,7 +684,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags", "libc", ] @@ -716,15 +710,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -744,9 +738,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -771,9 +765,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -805,9 +799,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "open" -version = "5.1.2" +version = "5.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32" +checksum = "2eb49fbd5616580e9974662cb96a3463da4476e649a7e4b258df0de065db0657" dependencies = [ "is-wsl", "libc", @@ -837,9 +831,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -847,15 +841,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -902,9 +896,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" dependencies = [ "unicode-ident", ] @@ -950,11 +944,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -1018,7 +1012,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.5.0", + "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -1029,9 +1023,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" @@ -1039,7 +1033,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -1085,15 +1079,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "ring", "rustls-pki-types", @@ -1102,9 +1096,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" @@ -1123,11 +1117,11 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -1136,9 +1130,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -1146,9 +1140,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] @@ -1165,9 +1159,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -1186,9 +1180,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1197,9 +1191,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -1262,9 +1256,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1290,9 +1284,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.60" +version = "2.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" dependencies = [ "proc-macro2", "quote", @@ -1313,18 +1307,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -1447,9 +1441,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.12" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" dependencies = [ "serde", "serde_spanned", @@ -1459,18 +1453,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.12" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" dependencies = [ "indexmap", "serde", @@ -1562,9 +1556,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "untrusted" @@ -1797,27 +1791,27 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" dependencies = [ "memchr", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 178b652..f9538c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,10 @@ edition = "2021" [workspace.dependencies] crossterm = "0.27.0" -parking_lot = "0.12.1" -serde = { version = "1.0.198", features = ["derive"] } +parking_lot = "0.12.2" +serde = { version = "1.0.202", features = ["derive"] } serde_either = "0.2.1" -thiserror = "1.0.59" +thiserror = "1.0.61" [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" diff --git a/cove-config/Cargo.toml b/cove-config/Cargo.toml index b9c7300..f860469 100644 --- a/cove-config/Cargo.toml +++ b/cove-config/Cargo.toml @@ -10,7 +10,7 @@ cove-macro = { path = "../cove-macro" } serde = { workspace = true } thiserror = { workspace = true } -toml = "0.8.12" +toml = "0.8.13" [lints] workspace = true diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index acd55fd..e550ae5 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -5,9 +5,9 @@ edition = { workspace = true } [dependencies] case = "1.0.0" -proc-macro2 = "1.0.81" +proc-macro2 = "1.0.83" quote = "1.0.36" -syn = "2.0.60" +syn = "2.0.65" [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 7ea2b12..ed44f0b 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -12,7 +12,7 @@ parking_lot = { workspace = true } thiserror = { workspace = true } toss = { workspace = true } -anyhow = "1.0.82" +anyhow = "1.0.86" async-trait = "0.1.80" clap = { version = "4.5.4", features = ["derive", "deprecated"] } cookie = "0.18.1" @@ -20,13 +20,13 @@ directories = "5.0.1" linkify = "0.10.0" log = { version = "0.4.21", features = ["std"] } once_cell = "1.19.0" -open = "5.1.2" +open = "5.1.3" rusqlite = { version = "0.31.0", features = ["bundled", "time"] } -serde_json = "1.0.116" +serde_json = "1.0.117" tokio = { version = "1.37.0", features = ["full"] } tz-rs = "0.6.14" unicode-segmentation = "1.11.0" -unicode-width = "0.1.11" +unicode-width = "0.1.12" [dependencies.time] version = "0.3.36" @@ -38,7 +38,7 @@ features = ["rustls-tls-native-roots"] [dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -tag = "v0.5.0" +tag = "v0.5.1" features = ["bot"] [dependencies.vault] From 7aba041c9f90dda045c50ac36276d2843002f44a Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 20 May 2024 19:18:13 +0200 Subject: [PATCH 057/109] Bump version to 0.8.3 --- CHANGELOG.md | 5 +++++ Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9f1927..ec5600e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ Procedure when bumping the version number: ## Unreleased +## v0.8.3 - 2024-05-20 + +### Changed +- Updated list of emoji names + ## v0.8.2 - 2024-04-25 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 40f6699..da7fbb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -266,7 +266,7 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cove" -version = "0.8.2" +version = "0.8.3" dependencies = [ "anyhow", "async-trait", @@ -297,7 +297,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.8.2" +version = "0.8.3" dependencies = [ "cove-input", "cove-macro", @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.8.2" +version = "0.8.3" dependencies = [ "cove-macro", "crossterm", @@ -322,7 +322,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.8.2" +version = "0.8.3" dependencies = [ "case", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index f9538c7..fb3b90b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["cove", "cove-*"] [workspace.package] -version = "0.8.2" +version = "0.8.3" edition = "2021" [workspace.dependencies] From 106a047b785384e7f6758ea88209193880672c7c Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 6 Nov 2024 22:01:54 +0100 Subject: [PATCH 058/109] Fix clippy lint about lints --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fb3b90b..7438604 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ git = "https://github.com/Garmelon/toss.git" tag = "v0.2.3" [workspace.lints] -rust.unsafe_code = "forbid" +rust.unsafe_code = { level = "forbid", priority = 1 } rust.future_incompatible = "warn" rust.rust_2018_idioms = "warn" rust.unused = "warn" From 461cc37d8800c858175aa62ba27ca7ff99bfed89 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 6 Nov 2024 22:01:41 +0100 Subject: [PATCH 059/109] Remove unused method --- cove/src/ui/chat/renderer.rs | 1 - cove/src/ui/chat/tree/renderer.rs | 4 ---- 2 files changed, 5 deletions(-) diff --git a/cove/src/ui/chat/renderer.rs b/cove/src/ui/chat/renderer.rs index ae0ad8f..a619e7c 100644 --- a/cove/src/ui/chat/renderer.rs +++ b/cove/src/ui/chat/renderer.rs @@ -14,7 +14,6 @@ pub trait Renderer { fn blocks(&self) -> &Blocks; fn blocks_mut(&mut self) -> &mut Blocks; - fn into_blocks(self) -> Blocks; async fn expand_top(&mut self) -> Result<(), Self::Error>; async fn expand_bottom(&mut self) -> Result<(), Self::Error>; diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 99f32b5..8b7b192 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -460,10 +460,6 @@ where &mut self.blocks } - fn into_blocks(self) -> TreeBlocks { - self.blocks - } - async fn expand_top(&mut self) -> Result<(), Self::Error> { let prev_root_id = if let Some(top_root_id) = &self.top_root_id { self.store.prev_root_id(top_root_id).await? From e43b27acfda653ac8f432e21f7b506450247b729 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 6 Nov 2024 22:04:57 +0100 Subject: [PATCH 060/109] Satisfy clippy lint --- cove/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/cove/src/store.rs b/cove/src/store.rs index a3601a8..f6c85b7 100644 --- a/cove/src/store.rs +++ b/cove/src/store.rs @@ -130,6 +130,7 @@ impl Tree { } } +#[allow(dead_code)] #[async_trait] pub trait MsgStore { type Error; From cff933b0bf7d1e0b72228320dd9660b62b629359 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 4 Dec 2024 20:12:44 +0100 Subject: [PATCH 061/109] Add and fix more lints --- Cargo.lock | 11 +---------- Cargo.toml | 16 +++++++++++++++- cove-input/src/lib.rs | 2 +- cove-macro/Cargo.toml | 1 - cove-macro/src/key_group.rs | 4 ++-- cove/Cargo.toml | 5 ----- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da7fbb2..e31a89c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -158,12 +158,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" -[[package]] -name = "case" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" - [[package]] name = "caseless" version = "0.2.1" @@ -287,10 +281,8 @@ dependencies = [ "thiserror", "time", "tokio", - "tokio-tungstenite", "toss", "tz-rs", - "unicode-segmentation", "unicode-width", "vault", ] @@ -324,7 +316,6 @@ dependencies = [ name = "cove-macro" version = "0.8.3" dependencies = [ - "case", "proc-macro2", "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index 7438604..bda342f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,12 +19,26 @@ tag = "v0.2.3" [workspace.lints] rust.unsafe_code = { level = "forbid", priority = 1 } +# Lint groups +rust.deprecated_safe = "warn" rust.future_incompatible = "warn" +rust.keyword_idents = "warn" rust.rust_2018_idioms = "warn" rust.unused = "warn" -rust.noop_method_call = "warn" +# Individual lints +rust.non_local_definitions = "warn" +rust.redundant_imports = "warn" +rust.redundant_lifetimes = "warn" rust.single_use_lifetimes = "warn" +rust.unit_bindings = "warn" +rust.unnameable_types = "warn" +rust.unused_crate_dependencies = "warn" +rust.unused_import_braces = "warn" +rust.unused_lifetimes = "warn" +rust.unused_qualifications = "warn" +# Clippy clippy.use_self = "warn" + [profile.dev.package."*"] opt-level = 3 diff --git a/cove-input/src/lib.rs b/cove-input/src/lib.rs index ba3bd63..c15c4c3 100644 --- a/cove-input/src/lib.rs +++ b/cove-input/src/lib.rs @@ -40,7 +40,7 @@ impl<'a> KeyGroupInfo<'a> { } pub struct InputEvent<'a> { - event: crossterm::event::Event, + event: Event, terminal: &'a mut Terminal, crossterm_lock: Arc>, } diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index e550ae5..0bda727 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -4,7 +4,6 @@ version = { workspace = true } edition = { workspace = true } [dependencies] -case = "1.0.0" proc-macro2 = "1.0.83" quote = "1.0.36" syn = "2.0.65" diff --git a/cove-macro/src/key_group.rs b/cove-macro/src/key_group.rs index bc7bdea..84d8cff 100644 --- a/cove-macro/src/key_group.rs +++ b/cove-macro/src/key_group.rs @@ -3,7 +3,7 @@ use quote::quote; use syn::spanned::Spanned; use syn::{Data, DeriveInput}; -use crate::util::{self, bail}; +use crate::util; fn decapitalize(s: &str) -> String { let mut chars = s.chars(); @@ -34,7 +34,7 @@ pub fn derive_impl(input: DeriveInput) -> syn::Result { let default = util::serde_default(field)?; let Some(default) = default else { - return bail(field_ident.span(), "must have serde default"); + return util::bail(field_ident.span(), "must have serde default"); }; let default_value = default.value(); diff --git a/cove/Cargo.toml b/cove/Cargo.toml index ed44f0b..8b9f85a 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -25,17 +25,12 @@ rusqlite = { version = "0.31.0", features = ["bundled", "time"] } serde_json = "1.0.117" tokio = { version = "1.37.0", features = ["full"] } tz-rs = "0.6.14" -unicode-segmentation = "1.11.0" unicode-width = "0.1.12" [dependencies.time] version = "0.3.36" features = ["macros", "formatting", "parsing", "serde"] -[dependencies.tokio-tungstenite] -version = "0.21.0" -features = ["rustls-tls-native-roots"] - [dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" tag = "v0.5.1" From 2ecc4825334de9db880836c958c9e410241d9d0f Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 4 Dec 2024 20:20:07 +0100 Subject: [PATCH 062/109] Configure all deps in workspace --- Cargo.toml | 33 ++++++++++++++++++++++++ cove-config/Cargo.toml | 11 ++++---- cove-input/Cargo.toml | 19 +++++++------- cove-macro/Cargo.toml | 10 ++++---- cove/Cargo.toml | 58 +++++++++++++++++------------------------- 5 files changed, 75 insertions(+), 56 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bda342f..ffb4919 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,16 +7,49 @@ version = "0.8.3" edition = "2021" [workspace.dependencies] +anyhow = "1.0.86" +async-trait = "0.1.80" +clap = { version = "4.5.4", features = ["derive", "deprecated"] } +cookie = "0.18.1" crossterm = "0.27.0" +directories = "5.0.1" +edit = "0.1.5" +linkify = "0.10.0" +log = { version = "0.4.21", features = ["std"] } +once_cell = "1.19.0" +open = "5.1.3" parking_lot = "0.12.2" +proc-macro2 = "1.0.83" +quote = "1.0.36" +rusqlite = { version = "0.31.0", features = ["bundled", "time"] } serde = { version = "1.0.202", features = ["derive"] } serde_either = "0.2.1" +serde_json = "1.0.117" +syn = "2.0.65" thiserror = "1.0.61" +tokio = { version = "1.37.0", features = ["full"] } +toml = "0.8.13" +tz-rs = "0.6.14" +unicode-width = "0.1.12" + +[workspace.dependencies.euphoxide] +git = "https://github.com/Garmelon/euphoxide.git" +tag = "v0.5.1" +features = ["bot"] + +[workspace.dependencies.time] +version = "0.3.36" +features = ["macros", "formatting", "parsing", "serde"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" tag = "v0.2.3" +[workspace.dependencies.vault] +git = "https://github.com/Garmelon/vault.git" +tag = "v0.4.0" +features = ["tokio"] + [workspace.lints] rust.unsafe_code = { level = "forbid", priority = 1 } # Lint groups diff --git a/cove-config/Cargo.toml b/cove-config/Cargo.toml index f860469..9102bfd 100644 --- a/cove-config/Cargo.toml +++ b/cove-config/Cargo.toml @@ -1,16 +1,15 @@ [package] name = "cove-config" -version = { workspace = true } -edition = { workspace = true } +version.workspace = true +edition.workspace = true [dependencies] cove-input = { path = "../cove-input" } cove-macro = { path = "../cove-macro" } -serde = { workspace = true } -thiserror = { workspace = true } - -toml = "0.8.13" +serde.workspace = true +thiserror.workspace = true +toml.workspace = true [lints] workspace = true diff --git a/cove-input/Cargo.toml b/cove-input/Cargo.toml index 428060f..5005be2 100644 --- a/cove-input/Cargo.toml +++ b/cove-input/Cargo.toml @@ -1,19 +1,18 @@ [package] name = "cove-input" -version = { workspace = true } -edition = { workspace = true } +version.workspace = true +edition.workspace = true [dependencies] cove-macro = { path = "../cove-macro" } -crossterm = { workspace = true } -parking_lot = { workspace = true } -serde = { workspace = true } -serde_either = { workspace = true } -thiserror = { workspace = true } -toss = { workspace = true } - -edit = "0.1.5" +crossterm.workspace = true +edit.workspace = true +parking_lot.workspace = true +serde.workspace = true +serde_either.workspace = true +thiserror.workspace = true +toss.workspace = true [lints] workspace = true diff --git a/cove-macro/Cargo.toml b/cove-macro/Cargo.toml index 0bda727..6c01b7d 100644 --- a/cove-macro/Cargo.toml +++ b/cove-macro/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "cove-macro" -version = { workspace = true } -edition = { workspace = true } +version.workspace = true +edition.workspace = true [dependencies] -proc-macro2 = "1.0.83" -quote = "1.0.36" -syn = "2.0.65" +proc-macro2.workspace = true +quote.workspace = true +syn.workspace = true [lib] proc-macro = true diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 8b9f85a..ad0e7f9 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -1,45 +1,33 @@ [package] name = "cove" -version = { workspace = true } -edition = { workspace = true } +version.workspace = true +edition.workspace = true [dependencies] cove-config = { path = "../cove-config" } cove-input = { path = "../cove-input" } -crossterm = { workspace = true } -parking_lot = { workspace = true } -thiserror = { workspace = true } -toss = { workspace = true } - -anyhow = "1.0.86" -async-trait = "0.1.80" -clap = { version = "4.5.4", features = ["derive", "deprecated"] } -cookie = "0.18.1" -directories = "5.0.1" -linkify = "0.10.0" -log = { version = "0.4.21", features = ["std"] } -once_cell = "1.19.0" -open = "5.1.3" -rusqlite = { version = "0.31.0", features = ["bundled", "time"] } -serde_json = "1.0.117" -tokio = { version = "1.37.0", features = ["full"] } -tz-rs = "0.6.14" -unicode-width = "0.1.12" - -[dependencies.time] -version = "0.3.36" -features = ["macros", "formatting", "parsing", "serde"] - -[dependencies.euphoxide] -git = "https://github.com/Garmelon/euphoxide.git" -tag = "v0.5.1" -features = ["bot"] - -[dependencies.vault] -git = "https://github.com/Garmelon/vault.git" -tag = "v0.4.0" -features = ["tokio"] +anyhow.workspace = true +async-trait.workspace = true +clap.workspace = true +cookie.workspace = true +crossterm.workspace = true +directories.workspace = true +euphoxide.workspace = true +linkify.workspace = true +log.workspace = true +once_cell.workspace = true +open.workspace = true +parking_lot.workspace = true +rusqlite.workspace = true +serde_json.workspace = true +thiserror.workspace = true +time.workspace = true +tokio.workspace = true +toss.workspace = true +tz-rs.workspace = true +unicode-width.workspace = true +vault.workspace = true [lints] workspace = true From f471b9ce00dbe553604ed50948a3d9e908600116 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 4 Dec 2024 20:56:39 +0100 Subject: [PATCH 063/109] Switch to jiff from time --- Cargo.lock | 275 ++++++++++++------------------ Cargo.toml | 7 +- cove/Cargo.toml | 3 +- cove/src/euph/small_message.rs | 8 +- cove/src/export/text.rs | 11 +- cove/src/logger.rs | 8 +- cove/src/main.rs | 12 +- cove/src/ui.rs | 6 +- cove/src/ui/chat.rs | 9 +- cove/src/ui/chat/tree.rs | 6 +- cove/src/ui/chat/tree/renderer.rs | 13 +- cove/src/ui/chat/tree/scroll.rs | 2 + cove/src/ui/chat/tree/widgets.rs | 4 +- cove/src/ui/chat/widgets.rs | 10 +- cove/src/ui/euph/room.rs | 4 +- cove/src/ui/rooms.rs | 6 + cove/src/util.rs | 34 ++-- cove/src/vault.rs | 17 +- cove/src/vault/euph.rs | 12 +- 19 files changed, 194 insertions(+), 253 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e31a89c..a0c630d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" @@ -95,9 +95,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -125,17 +125,11 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -182,9 +176,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.4" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" dependencies = [ "clap_builder", "clap_derive", @@ -192,9 +186,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" dependencies = [ "anstream", "anstyle", @@ -204,9 +198,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -226,12 +220,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" -[[package]] -name = "const_fn" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d" - [[package]] name = "cookie" version = "0.18.1" @@ -244,9 +232,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" dependencies = [ "core-foundation-sys", "libc", @@ -254,9 +242,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" @@ -271,6 +259,7 @@ dependencies = [ "crossterm", "directories", "euphoxide", + "jiff", "linkify", "log", "once_cell", @@ -279,10 +268,8 @@ dependencies = [ "rusqlite", "serde_json", "thiserror", - "time", "tokio", "toss", - "tz-rs", "unicode-width", "vault", ] @@ -339,7 +326,7 @@ dependencies = [ "bitflags", "crossterm_winapi", "libc", - "mio", + "mio 0.8.11", "parking_lot", "signal-hook", "signal-hook-mio", @@ -378,7 +365,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -447,17 +433,17 @@ dependencies = [ [[package]] name = "euphoxide" version = "0.5.1" -source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.5.1#0256329f65f3ed853092cc210ae2a4a8c526a4bf" +source = "git+https://github.com/Garmelon/euphoxide.git#fe6869493225abb1229631816ffdc2fdae5d32e3" dependencies = [ "async-trait", "caseless", "clap", "cookie", "futures-util", + "jiff", "log", "serde", "serde_json", - "time", "tokio", "tokio-stream", "tokio-tungstenite", @@ -488,38 +474,29 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - [[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-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-sink", @@ -580,12 +557,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 = "home" version = "0.5.9" @@ -612,16 +583,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indexmap" version = "2.2.6" @@ -664,10 +625,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "libc" -version = "0.2.155" +name = "jiff" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "db69f08d4fb10524cacdb074c10b296299d71274ddbc830a8ee65666867002e9" +dependencies = [ + "jiff-tzdb-platform", + "serde", + "windows-sys 0.52.0", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "libc" +version = "0.2.167" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libredox" @@ -717,9 +704,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" @@ -748,6 +735,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -763,16 +761,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -849,12 +837,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1033,12 +1015,11 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ - "log", - "ring", + "once_cell", "rustls-pki-types", "rustls-webpki", "subtle", @@ -1047,38 +1028,27 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" dependencies = [ "openssl-probe", - "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" -dependencies = [ - "base64", - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -1108,9 +1078,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.11.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" dependencies = [ "bitflags", "core-foundation", @@ -1121,9 +1091,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -1131,9 +1101,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.202" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] @@ -1150,9 +1120,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -1171,11 +1141,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1217,7 +1188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio", + "mio 0.8.11", "signal-hook", ] @@ -1275,9 +1246,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.65" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1364,28 +1335,27 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", + "mio 1.0.3", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", @@ -1394,9 +1364,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ "rustls", "rustls-pki-types", @@ -1405,9 +1375,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -1416,9 +1386,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", @@ -1478,9 +1448,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", @@ -1493,7 +1463,6 @@ dependencies = [ "rustls-pki-types", "sha1", "thiserror", - "url", "utf-8", ] @@ -1503,21 +1472,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "tz-rs" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" -dependencies = [ - "const_fn", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" @@ -1532,9 +1486,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -1557,17 +1511,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - [[package]] name = "utf-8" version = "0.7.6" diff --git a/Cargo.toml b/Cargo.toml index ffb4919..8ec7185 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ cookie = "0.18.1" crossterm = "0.27.0" directories = "5.0.1" edit = "0.1.5" +jiff = "0.1.15" linkify = "0.10.0" log = { version = "0.4.21", features = ["std"] } once_cell = "1.19.0" @@ -29,18 +30,12 @@ syn = "2.0.65" thiserror = "1.0.61" tokio = { version = "1.37.0", features = ["full"] } toml = "0.8.13" -tz-rs = "0.6.14" unicode-width = "0.1.12" [workspace.dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -tag = "v0.5.1" features = ["bot"] -[workspace.dependencies.time] -version = "0.3.36" -features = ["macros", "formatting", "parsing", "serde"] - [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" tag = "v0.2.3" diff --git a/cove/Cargo.toml b/cove/Cargo.toml index ad0e7f9..115d781 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -14,6 +14,7 @@ cookie.workspace = true crossterm.workspace = true directories.workspace = true euphoxide.workspace = true +jiff.workspace = true linkify.workspace = true log.workspace = true once_cell.workspace = true @@ -22,10 +23,8 @@ parking_lot.workspace = true rusqlite.workspace = true serde_json.workspace = true thiserror.workspace = true -time.workspace = true tokio.workspace = true toss.workspace = true -tz-rs.workspace = true unicode-width.workspace = true vault.workspace = true diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 0642801..994b0ae 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -2,9 +2,8 @@ use std::mem; use crossterm::style::Stylize; use euphoxide::api::{MessageId, Snowflake, Time}; -use time::OffsetDateTime; +use jiff::Timestamp; use toss::{Style, Styled}; -use tz::TimeZone; use crate::store::Msg; use crate::ui::ChatMsg; @@ -208,7 +207,6 @@ pub struct SmallMessage { pub id: MessageId, pub parent: Option, pub time: Time, - pub time_zone: &'static TimeZone, pub nick: String, pub content: String, pub seen: bool, @@ -272,8 +270,8 @@ impl Msg for SmallMessage { } impl ChatMsg for SmallMessage { - fn time(&self) -> Option { - crate::util::convert_to_time_zone(self.time_zone, self.time.0) + fn time(&self) -> Option { + Some(self.time.as_timestamp()) } fn styled(&self) -> (Styled, Styled) { diff --git a/cove/src/export/text.rs b/cove/src/export/text.rs index bb3cfa1..23a75d8 100644 --- a/cove/src/export/text.rs +++ b/cove/src/export/text.rs @@ -1,16 +1,13 @@ use std::io::Write; use euphoxide::api::MessageId; -use time::format_description::FormatItem; -use time::macros::format_description; use unicode_width::UnicodeWidthStr; use crate::euph::SmallMessage; use crate::store::Tree; use crate::vault::EuphRoomVault; -const TIME_FORMAT: &[FormatItem<'_>] = - format_description!("[year]-[month]-[day] [hour]:[minute]:[second]"); +const TIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; const TIME_EMPTY: &str = " "; pub async fn export(vault: &EuphRoomVault, out: &mut W) -> anyhow::Result<()> { @@ -67,11 +64,7 @@ fn write_msg( for (i, line) in msg.content.lines().enumerate() { if i == 0 { - let time = msg - .time - .0 - .format(TIME_FORMAT) - .expect("time can be formatted"); + let time = msg.time.as_timestamp().strftime(TIME_FORMAT); writeln!(file, "{time} {indent_string}[{nick}] {line}")?; } else { writeln!(file, "{TIME_EMPTY} {indent_string}| {nick_empty} {line}")?; diff --git a/cove/src/logger.rs b/cove/src/logger.rs index b8b696b..5574960 100644 --- a/cove/src/logger.rs +++ b/cove/src/logger.rs @@ -4,9 +4,9 @@ use std::vec; use async_trait::async_trait; use crossterm::style::Stylize; +use jiff::Timestamp; use log::{Level, LevelFilter, Log}; use parking_lot::Mutex; -use time::OffsetDateTime; use tokio::sync::mpsc; use toss::{Style, Styled}; @@ -16,7 +16,7 @@ use crate::ui::ChatMsg; #[derive(Debug, Clone)] pub struct LogMsg { id: usize, - time: OffsetDateTime, + time: Timestamp, level: Level, content: String, } @@ -42,7 +42,7 @@ impl Msg for LogMsg { } impl ChatMsg for LogMsg { - fn time(&self) -> Option { + fn time(&self) -> Option { Some(self.time) } @@ -209,7 +209,7 @@ impl Log for Logger { let mut guard = self.messages.lock(); let msg = LogMsg { id: guard.len(), - time: OffsetDateTime::now_utc(), + time: Timestamp::now(), level: record.level(), content: format!("<{}> {}", record.target(), record.args()), }; diff --git a/cove/src/main.rs b/cove/src/main.rs index fc14b56..4a3ce9e 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -118,16 +118,12 @@ fn update_config_with_args(config: &mut Config, args: &Args) { } fn open_vault(config: &Config, dirs: &ProjectDirs) -> anyhow::Result { - let time_zone = - util::load_time_zone(config.time_zone_ref()).context("failed to load time zone")?; - let time_zone = Box::leak(Box::new(time_zone)); - let vault = if config.ephemeral { - vault::launch_in_memory(time_zone)? + vault::launch_in_memory()? } else { let data_dir = data_dir(config, dirs); eprintln!("Data dir: {}", data_dir.to_string_lossy()); - vault::launch(&data_dir.join("vault.db"), time_zone)? + vault::launch(&data_dir.join("vault.db"))? }; Ok(vault) @@ -174,11 +170,13 @@ async fn run( ) -> anyhow::Result<()> { info!("Welcome to {NAME} {VERSION}",); + let tz = util::load_time_zone(config.time_zone_ref()).context("failed to load time zone")?; + let vault = open_vault(config, dirs)?; let mut terminal = Terminal::new()?; terminal.set_measuring(config.measure_widths); - Ui::run(config, &mut terminal, vault.clone(), logger, logger_rx).await?; + Ui::run(config, tz, &mut terminal, vault.clone(), logger, logger_rx).await?; drop(terminal); vault.close().await; diff --git a/cove/src/ui.rs b/cove/src/ui.rs index 95cc4d1..0263325 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -12,6 +12,7 @@ use std::time::{Duration, Instant}; use cove_config::Config; use cove_input::InputEvent; +use jiff::tz::TimeZone; use parking_lot::FairMutex; use tokio::sync::mpsc::error::TryRecvError; use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; @@ -84,6 +85,7 @@ impl Ui { pub async fn run( config: &'static Config, + tz: TimeZone, terminal: &mut Terminal, vault: Vault, logger: Logger, @@ -112,8 +114,8 @@ impl Ui { config, event_tx: event_tx.clone(), mode: Mode::Main, - rooms: Rooms::new(config, vault, event_tx.clone()).await, - log_chat: ChatState::new(logger), + rooms: Rooms::new(config, tz.clone(), vault, event_tx.clone()).await, + log_chat: ChatState::new(logger, tz), key_bindings_visible: false, key_bindings_list: ListState::new(), }; diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index c8a310c..cc7acc7 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -6,7 +6,8 @@ mod widgets; use cove_config::Keys; use cove_input::InputEvent; -use time::OffsetDateTime; +use jiff::tz::TimeZone; +use jiff::Timestamp; use toss::widgets::{BoxedAsync, EditorState}; use toss::{Styled, WidgetExt}; @@ -19,7 +20,7 @@ use self::tree::TreeViewState; use super::UiError; pub trait ChatMsg { - fn time(&self) -> Option; + fn time(&self) -> Option; fn styled(&self) -> (Styled, Styled); fn edit(nick: &str, content: &str) -> (Styled, Styled); fn pseudo(nick: &str, content: &str) -> (Styled, Styled); @@ -41,14 +42,14 @@ pub struct ChatState> { } impl + Clone> ChatState { - pub fn new(store: S) -> Self { + pub fn new(store: S, tz: TimeZone) -> Self { Self { cursor: Cursor::Bottom, editor: EditorState::new(), caesar: 0, mode: Mode::Tree, - tree: TreeViewState::new(store.clone()), + tree: TreeViewState::new(store.clone(), tz), store, } diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index 37972e5..b01602c 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -11,6 +11,7 @@ use std::collections::HashSet; use async_trait::async_trait; use cove_config::Keys; use cove_input::InputEvent; +use jiff::tz::TimeZone; use toss::widgets::EditorState; use toss::{AsyncWidget, Frame, Pos, Size, WidgetExt, WidthDb}; @@ -25,6 +26,7 @@ use super::Reaction; pub struct TreeViewState> { store: S, + tz: TimeZone, last_size: Size, last_nick: String, @@ -36,9 +38,10 @@ pub struct TreeViewState> { } impl> TreeViewState { - pub fn new(store: S) -> Self { + pub fn new(store: S, tz: TimeZone) -> Self { Self { store, + tz, last_size: Size::ZERO, last_nick: String::new(), last_cursor: Cursor::Bottom, @@ -443,6 +446,7 @@ where let mut renderer = TreeRenderer::new( context, &self.state.store, + &self.state.tz, &mut self.state.folded, self.cursor, self.editor, diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 8b7b192..845e803 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -4,6 +4,7 @@ use std::collections::HashSet; use std::convert::Infallible; use async_trait::async_trait; +use jiff::tz::TimeZone; use toss::widgets::{EditorState, Empty, Predrawn, Resize}; use toss::{Size, Widget, WidthDb}; @@ -81,6 +82,7 @@ pub struct TreeRenderer<'a, M: Msg, S: MsgStore> { context: TreeContext, store: &'a S, + tz: &'a TimeZone, folded: &'a mut HashSet, cursor: &'a mut Cursor, editor: &'a mut EditorState, @@ -108,6 +110,7 @@ where pub fn new( context: TreeContext, store: &'a S, + tz: &'a TimeZone, folded: &'a mut HashSet, cursor: &'a mut Cursor, editor: &'a mut EditorState, @@ -116,6 +119,7 @@ where Self { context, store, + tz, folded, cursor, editor, @@ -191,7 +195,14 @@ where }; let highlighted = highlighted && self.context.focused; - let widget = widgets::msg(highlighted, indent, msg, self.context.caesar, folded_info); + let widget = widgets::msg( + highlighted, + self.tz.clone(), + indent, + msg, + self.context.caesar, + folded_info, + ); let widget = Self::predraw(widget, self.context.size, self.widthdb); Block::new(TreeBlockId::Msg(msg_id), widget, true) } diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index 822b0b5..b02c4a1 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -37,6 +37,7 @@ where let mut renderer = TreeRenderer::new( context, &self.store, + &self.tz, &mut self.folded, cursor, editor, @@ -64,6 +65,7 @@ where let mut renderer = TreeRenderer::new( context, &self.store, + &self.tz, &mut self.folded, cursor, editor, diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index 9eb6690..b302670 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -1,6 +1,7 @@ use std::convert::Infallible; use crossterm::style::Stylize; +use jiff::tz::TimeZone; use toss::widgets::{Boxed, EditorState, Join2, Join4, Join5, Text}; use toss::{Style, Styled, WidgetExt}; @@ -49,6 +50,7 @@ fn style_pseudo_highlight() -> Style { pub fn msg( highlighted: bool, + tz: TimeZone, indent: usize, msg: &M, caesar: i8, @@ -72,7 +74,7 @@ pub fn msg( Join5::horizontal( Seen::new(msg.seen()).segment().with_fixed(true), - Time::new(msg.time(), style_time(highlighted)) + Time::new(msg.time().map(|t| t.to_zoned(tz)), style_time(highlighted)) .padding() .with_right(1) .with_stretch(true) diff --git a/cove/src/ui/chat/widgets.rs b/cove/src/ui/chat/widgets.rs index 5d35e9c..43ad29e 100644 --- a/cove/src/ui/chat/widgets.rs +++ b/cove/src/ui/chat/widgets.rs @@ -1,9 +1,7 @@ use std::convert::Infallible; use crossterm::style::Stylize; -use time::format_description::FormatItem; -use time::macros::format_description; -use time::OffsetDateTime; +use jiff::Zoned; use toss::widgets::{Boxed, Empty, Text}; use toss::{Frame, Pos, Size, Style, Widget, WidgetExt, WidthDb}; @@ -46,15 +44,15 @@ impl Widget for Indent { } } -const TIME_FORMAT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day] [hour]:[minute]"); +const TIME_FORMAT: &str = "%Y-%m-%d %H:%M"; const TIME_WIDTH: u16 = 16; pub struct Time(Boxed<'static, Infallible>); impl Time { - pub fn new(time: Option, style: Style) -> Self { + pub fn new(time: Option, style: Style) -> Self { let widget = if let Some(time) = time { - let text = time.format(TIME_FORMAT).expect("could not format time"); + let text = time.strftime(TIME_FORMAT).to_string(); Text::new((text, style)) .background() .with_style(style) diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 8fc2fe5..15da008 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -6,6 +6,7 @@ use crossterm::style::Stylize; use euphoxide::api::{Data, Message, MessageId, PacketType, SessionId}; use euphoxide::bot::instance::{Event, ServerConfig}; use euphoxide::conn::{self, Joined, Joining, SessionInfo}; +use jiff::tz::TimeZone; use tokio::sync::oneshot::error::TryRecvError; use tokio::sync::{mpsc, oneshot}; use toss::widgets::{BoxedAsync, EditorState, Join2, Layer, Text}; @@ -66,6 +67,7 @@ impl EuphRoom { server_config: ServerConfig, room_config: cove_config::EuphRoom, vault: EuphRoomVault, + tz: TimeZone, ui_event_tx: mpsc::UnboundedSender, ) -> Self { Self { @@ -77,7 +79,7 @@ impl EuphRoom { focus: Focus::Chat, state: State::Normal, popups: VecDeque::new(), - chat: ChatState::new(vault), + chat: ChatState::new(vault, tz), last_msg_sent: None, nick_list: ListState::new(), } diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index f40bfc5..0157b01 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -13,6 +13,7 @@ use crossterm::style::Stylize; use euphoxide::api::SessionType; use euphoxide::bot::instance::{Event, ServerConfig}; use euphoxide::conn::{self, Joined}; +use jiff::tz::TimeZone; use tokio::sync::mpsc; use toss::widgets::{BoxedAsync, Empty, Join2, Text}; use toss::{Style, Styled, Widget, WidgetExt}; @@ -73,6 +74,7 @@ impl EuphServer { pub struct Rooms { config: &'static Config, + tz: TimeZone, vault: Vault, ui_event_tx: mpsc::UnboundedSender, @@ -89,11 +91,13 @@ pub struct Rooms { impl Rooms { pub async fn new( config: &'static Config, + tz: TimeZone, vault: Vault, ui_event_tx: mpsc::UnboundedSender, ) -> Self { let mut result = Self { config, + tz, vault, ui_event_tx, state: State::ShowList, @@ -142,6 +146,7 @@ impl Rooms { server.config.clone(), self.config.euph_room(&room.domain, &room.name), self.vault.euph().room(room), + self.tz.clone(), self.ui_event_tx.clone(), ) }) @@ -158,6 +163,7 @@ impl Rooms { server.config.clone(), self.config.euph_room(&room.domain, &room.name), self.vault.euph().room(room), + self.tz.clone(), self.ui_event_tx.clone(), ) }); diff --git a/cove/src/util.rs b/cove/src/util.rs index 4844d68..ff8a05a 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -1,8 +1,7 @@ use std::convert::Infallible; use std::env; -use time::{OffsetDateTime, UtcOffset}; -use tz::{TimeZone, TzError}; +use jiff::tz::TimeZone; pub trait InfallibleExt { type Inner; @@ -26,27 +25,30 @@ impl InfallibleExt for Result { /// /// If no `TZ` environment variable could be found and no string is provided, /// the system local time (or UTC on Windows) is used. -pub fn load_time_zone(tz_string: Option<&str>) -> Result { +pub fn load_time_zone(tz_string: Option<&str>) -> Result { let env_string = env::var("TZ").ok(); let tz_string = env_string.as_ref().map(|s| s as &str).or(tz_string); - match &tz_string { - // At the moment, TimeZone::from_posix_tz does not support "localtime" - // on Windows, so we handle that case manually. - Some("localtime") | None => TimeZone::local(), - Some(tz_string) => TimeZone::from_posix_tz(tz_string), + let Some(tz_string) = tz_string else { + return Ok(TimeZone::system()); + }; + + if tz_string == "localtime" { + return Ok(TimeZone::system()); } -} -pub fn convert_to_time_zone(tz: &TimeZone, time: OffsetDateTime) -> Option { - let utc_offset_in_seconds = tz - .find_local_time_type(time.unix_timestamp()) - .ok()? - .ut_offset(); + if let Some(tz_string) = tz_string.strip_prefix(':') { + return TimeZone::get(tz_string); + } - let utc_offset = UtcOffset::from_whole_seconds(utc_offset_in_seconds).ok()?; + // The time zone is either a manually specified string or a file in the tz + // database. We'll try to parse it as a manually specified string first + // because that doesn't require a fs lookup. + if let Ok(tz) = TimeZone::posix(tz_string) { + return Ok(tz); + } - Some(time.to_offset(utc_offset)) + TimeZone::get(tz_string) } pub fn caesar(text: &str, by: i8) -> String { diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 55abbf0..6861901 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -6,7 +6,6 @@ use std::fs; use std::path::Path; use rusqlite::Connection; -use tz::TimeZone; use vault::tokio::TokioVault; use vault::Action; @@ -15,7 +14,6 @@ pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; #[derive(Debug, Clone)] pub struct Vault { tokio_vault: TokioVault, - time_zone: &'static TimeZone, ephemeral: bool, } @@ -48,23 +46,18 @@ impl Vault { } } -fn launch_from_connection( - conn: Connection, - time_zone: &'static TimeZone, - ephemeral: bool, -) -> rusqlite::Result { +fn launch_from_connection(conn: Connection, ephemeral: bool) -> rusqlite::Result { conn.pragma_update(None, "foreign_keys", true)?; conn.pragma_update(None, "trusted_schema", false)?; let tokio_vault = TokioVault::launch_and_prepare(conn, &migrate::MIGRATIONS, prepare::prepare)?; Ok(Vault { tokio_vault, - time_zone, ephemeral, }) } -pub fn launch(path: &Path, time_zone: &'static TimeZone) -> rusqlite::Result { +pub fn launch(path: &Path) -> rusqlite::Result { // If this fails, rusqlite will complain about not being able to open the db // file, which saves me from adding a separate vault error type. let _ = fs::create_dir_all(path.parent().expect("path to file")); @@ -79,10 +72,10 @@ pub fn launch(path: &Path, time_zone: &'static TimeZone) -> rusqlite::Result rusqlite::Result { +pub fn launch_in_memory() -> rusqlite::Result { let conn = Connection::open_in_memory()?; - launch_from_connection(conn, time_zone, true) + launch_from_connection(conn, true) } diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index f922345..c7d6410 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -6,7 +6,6 @@ use cookie::{Cookie, CookieJar}; use euphoxide::api::{Message, MessageId, SessionId, SessionView, Snowflake, Time, UserId}; use rusqlite::types::{FromSql, FromSqlError, ToSqlOutput, Value, ValueRef}; use rusqlite::{named_params, params, Connection, OptionalExtension, Row, ToSql, Transaction}; -use time::OffsetDateTime; use vault::Action; use crate::euph::SmallMessage; @@ -32,7 +31,7 @@ struct WTime(Time); impl ToSql for WTime { fn to_sql(&self) -> rusqlite::Result> { - let timestamp = self.0 .0.unix_timestamp(); + let timestamp = self.0 .0; Ok(ToSqlOutput::Owned(Value::Integer(timestamp))) } } @@ -40,9 +39,7 @@ impl ToSql for WTime { impl FromSql for WTime { fn column_result(value: ValueRef<'_>) -> rusqlite::types::FromSqlResult { let timestamp = i64::column_result(value)?; - Ok(Self(Time( - OffsetDateTime::from_unix_timestamp(timestamp).expect("timestamp in range"), - ))) + Ok(Self(Time(timestamp))) } } @@ -255,8 +252,6 @@ macro_rules! euph_room_vault_actions { $( struct $struct { room: RoomIdentifier, - #[allow(unused)] - time_zone: &'static tz::TimeZone, $( $arg: $arg_ty, )* } )* @@ -266,7 +261,6 @@ macro_rules! euph_room_vault_actions { pub async fn $fn(&self, $( $arg: $arg_ty, )* ) -> Result<$res, vault::tokio::Error> { self.vault.vault.tokio_vault.execute($struct { room: self.room.clone(), - time_zone: self.vault.vault.time_zone, $( $arg, )* }).await } @@ -626,7 +620,6 @@ impl Action for GetMsg { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - time_zone: self.time_zone, nick: row.get(3)?, content: row.get(4)?, seen: row.get(5)?, @@ -720,7 +713,6 @@ impl Action for GetTree { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - time_zone: self.time_zone, nick: row.get(3)?, content: row.get(4)?, seen: row.get(5)?, From e80d41cc47699e457c050dea13b0a97d006dd689 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 4 Dec 2024 21:13:19 +0100 Subject: [PATCH 064/109] Fix panic due to rustls --- Cargo.lock | 200 ++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + cove/Cargo.toml | 1 + cove/src/main.rs | 5 ++ 4 files changed, 205 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0c630d..365b6e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,6 +110,33 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "aws-lc-rs" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -125,6 +152,29 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + [[package]] name = "bitflags" version = "2.6.0" @@ -164,9 +214,23 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.98" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] [[package]] name = "cfg-if" @@ -174,6 +238,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.5.22" @@ -214,6 +289,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "cmake" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.1" @@ -266,6 +350,7 @@ dependencies = [ "open", "parking_lot", "rusqlite", + "rustls", "serde_json", "thiserror", "tokio", @@ -398,6 +483,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "edit" version = "0.1.5" @@ -474,6 +565,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-core" version = "0.3.31" @@ -533,6 +630,12 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "hashbrown" version = "0.14.5" @@ -618,6 +721,15 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -650,12 +762,43 @@ dependencies = [ "jiff-tzdb", ] +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + [[package]] name = "libredox" version = "0.1.3" @@ -714,6 +857,12 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.3" @@ -746,6 +895,22 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -831,6 +996,12 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "pathdiff" version = "0.2.1" @@ -867,6 +1038,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.83" @@ -1000,6 +1181,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustix" version = "0.38.34" @@ -1019,6 +1206,8 @@ version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ + "aws-lc-rs", + "log", "once_cell", "rustls-pki-types", "rustls-webpki", @@ -1050,6 +1239,7 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -1171,6 +1361,12 @@ dependencies = [ "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook" version = "0.3.17" diff --git a/Cargo.toml b/Cargo.toml index 8ec7185..e273b84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ parking_lot = "0.12.2" proc-macro2 = "1.0.83" quote = "1.0.36" rusqlite = { version = "0.31.0", features = ["bundled", "time"] } +rustls = "0.23.19" serde = { version = "1.0.202", features = ["derive"] } serde_either = "0.2.1" serde_json = "1.0.117" diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 115d781..0ca2a2f 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -27,6 +27,7 @@ tokio.workspace = true toss.workspace = true unicode-width.workspace = true vault.workspace = true +rustls.workspace = true [lints] workspace = true diff --git a/cove/src/main.rs b/cove/src/main.rs index 4a3ce9e..6596eab 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -136,6 +136,11 @@ async fn main() -> anyhow::Result<()> { let (logger, logger_guard, logger_rx) = Logger::init(args.verbose); let dirs = ProjectDirs::from("de", "plugh", "cove").expect("failed to find config directory"); + // https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455247837 + rustls::crypto::aws_lc_rs::default_provider() + .install_default() + .unwrap(); + // Locate config let config_path = config_path(&args, &dirs); eprintln!("Config file: {}", config_path.to_string_lossy()); From 55d43217700ba8fc5ebacae89a2809f4331a3a40 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 20 Feb 2025 19:40:29 +0100 Subject: [PATCH 065/109] Fix outdated reference in config docs Thanks, JRF! --- cove-config/src/euph.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cove-config/src/euph.rs b/cove-config/src/euph.rs index 5b1f12a..5ed0fb5 100644 --- a/cove-config/src/euph.rs +++ b/cove-config/src/euph.rs @@ -23,9 +23,9 @@ pub struct EuphRoom { /// associated with the current session. pub username: Option, - /// If `euph.rooms..username` is set, this will force cove to set the - /// username even if there is already a different username associated with - /// the current session. + /// If `euph.servers..rooms..username` is set, this will force + /// cove to set the username even if there is already a different username + /// associated with the current session. #[serde(default)] pub force_username: bool, From edc4219258a8625ec4e1034fa344e9fc4c7894d4 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 20 Feb 2025 20:58:00 +0100 Subject: [PATCH 066/109] Update euphoxide and jiff --- Cargo.lock | 223 ++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 2 +- 2 files changed, 153 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 365b6e3..18a0db8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,7 +26,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy", + "zerocopy 0.7.34", ] [[package]] @@ -95,9 +95,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d" dependencies = [ "proc-macro2", "quote", @@ -190,25 +190,18 @@ dependencies = [ "generic-array", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" -version = "1.6.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" [[package]] name = "caseless" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f" +checksum = "8b6fd507454086c8edfd769ca6ada439193cdb209c7681712ef6275cccbfe5d8" dependencies = [ - "regex", "unicode-normalization", ] @@ -251,9 +244,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.22" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" +checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d" dependencies = [ "clap_builder", "clap_derive", @@ -261,9 +254,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.22" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" +checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c" dependencies = [ "anstream", "anstyle", @@ -273,9 +266,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" dependencies = [ "heck", "proc-macro2", @@ -285,9 +278,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cmake" @@ -352,7 +345,7 @@ dependencies = [ "rusqlite", "rustls", "serde_json", - "thiserror", + "thiserror 1.0.61", "tokio", "toss", "unicode-width", @@ -366,7 +359,7 @@ dependencies = [ "cove-input", "cove-macro", "serde", - "thiserror", + "thiserror 1.0.61", "toml", ] @@ -380,7 +373,7 @@ dependencies = [ "parking_lot", "serde", "serde_either", - "thiserror", + "thiserror 1.0.61", "toss", ] @@ -524,7 +517,7 @@ dependencies = [ [[package]] name = "euphoxide" version = "0.5.1" -source = "git+https://github.com/Garmelon/euphoxide.git#fe6869493225abb1229631816ffdc2fdae5d32e3" +source = "git+https://github.com/Garmelon/euphoxide.git#1d444684f7f292183c1ab5c89fef3872dadf96fd" dependencies = [ "async-trait", "caseless", @@ -621,7 +614,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.5", ] [[package]] @@ -738,26 +743,29 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jiff" -version = "0.1.15" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db69f08d4fb10524cacdb074c10b296299d71274ddbc830a8ee65666867002e9" +checksum = "3590fea8e9e22d449600c9bbd481a8163bef223e4ff938e5f55899f8cf1adb93" dependencies = [ "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", "serde", "windows-sys 0.52.0", ] [[package]] name = "jiff-tzdb" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" +checksum = "cf2cec2f5d266af45a071ece48b1fb89f3b00b2421ac3a5fe10285a6caaa60d3" [[package]] name = "jiff-tzdb-platform" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +checksum = "a63c62e404e7b92979d2792352d885a7f8f83fd1d0d31eea582d77b2ceca697e" dependencies = [ "jiff-tzdb", ] @@ -785,9 +793,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.167" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libloading" @@ -796,7 +804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] @@ -847,9 +855,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "memchr" @@ -880,7 +888,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -891,7 +899,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -1026,6 +1034,21 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "portable-atomic" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -1068,20 +1091,20 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ - "libc", "rand_chacha", "rand_core", + "zerocopy 0.8.20", ] [[package]] name = "rand_chacha" -version = "0.3.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core", @@ -1089,11 +1112,12 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" dependencies = [ - "getrandom", + "getrandom 0.3.1", + "zerocopy 0.8.20", ] [[package]] @@ -1111,9 +1135,9 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ - "getrandom", + "getrandom 0.2.15", "libredox", - "thiserror", + "thiserror 1.0.61", ] [[package]] @@ -1153,7 +1177,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", "spin", "untrusted", @@ -1291,9 +1315,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.215" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" dependencies = [ "serde_derive", ] @@ -1310,9 +1334,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" dependencies = [ "proc-macro2", "quote", @@ -1331,9 +1355,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" dependencies = [ "itoa", "memchr", @@ -1469,7 +1493,16 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.61", +] + +[[package]] +name = "thiserror" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +dependencies = [ + "thiserror-impl 2.0.11", ] [[package]] @@ -1483,6 +1516,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" version = "0.3.36" @@ -1531,9 +1575,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -1549,9 +1593,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -1571,9 +1615,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -1582,9 +1626,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.24.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", @@ -1644,11 +1688,10 @@ dependencies = [ [[package]] name = "tungstenite" -version = "0.24.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ - "byteorder", "bytes", "data-encoding", "http", @@ -1658,7 +1701,7 @@ dependencies = [ "rustls", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 2.0.11", "utf-8", ] @@ -1746,6 +1789,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "which" version = "4.4.2" @@ -1928,13 +1980,31 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags", +] + [[package]] name = "zerocopy" version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ - "zerocopy-derive", + "zerocopy-derive 0.7.34", +] + +[[package]] +name = "zerocopy" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde3bb8c68a8f3f1ed4ac9221aad6b10cece3e60a8e2ea54a6a2dec806d0084c" +dependencies = [ + "zerocopy-derive 0.8.20", ] [[package]] @@ -1948,6 +2018,17 @@ dependencies = [ "syn", ] +[[package]] +name = "zerocopy-derive" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eea57037071898bf96a6da35fd626f4f27e9cee3ead2a6c703cf09d472b2e700" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index e273b84..a4bbb26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ cookie = "0.18.1" crossterm = "0.27.0" directories = "5.0.1" edit = "0.1.5" -jiff = "0.1.15" +jiff = "0.2.1" linkify = "0.10.0" log = { version = "0.4.21", features = ["std"] } once_cell = "1.19.0" From e1ba15cb9e0ae51fb0900d34eee46907000e0151 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 00:32:44 +0100 Subject: [PATCH 067/109] Update time_zone docs --- CHANGELOG.md | 3 +++ cove-config/src/lib.rs | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec5600e..6864032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Procedure when bumping the version number: ## Unreleased +### Updated +- Documentation for `time_zone` config option + ## v0.8.3 - 2024-05-20 ### Changed diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 086e372..026ce9e 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -76,21 +76,21 @@ pub struct Config { /// Time zone that chat timestamps should be displayed in. /// - /// This option is interpreted as a POSIX TZ string. It is described here in - /// further detail: - /// + /// This option can either be the string `"localtime"`, a [POSIX TZ string], + /// or a [tz identifier] from the [tz database]. /// - /// On a normal system, the string `"localtime"` as well as any value from - /// the "TZ identifier" column of the following wikipedia article should be - /// valid TZ strings: - /// + /// When not set or when set to `"localtime"`, cove attempts to use your + /// system's configured time zone, falling back to UTC. /// - /// If the `TZ` environment variable exists, it overrides this option. If - /// neither exist, cove uses the system's local time zone. + /// When the string begins with a colon or doesn't match the a POSIX TZ + /// string format, it is interpreted as a tz identifier and looked up in + /// your system's tz database (or a bundled tz database on Windows). /// - /// **Warning:** On Windows, cove can't get the local time zone and uses UTC - /// instead. However, you can still specify a path to a tz data file or a - /// custom time zone string. + /// If the `TZ` environment variable exists, it overrides this option. + /// + /// [POSIX TZ string]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03 + /// [tz identifier]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + /// [tz database]: https://en.wikipedia.org/wiki/Tz_database #[serde(default)] #[document(default = "`$TZ` or local system time zone")] pub time_zone: Option, From bd43fe060b6a0ab85b8ff28e92dd36820500e5a3 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 20 Feb 2025 22:35:09 +0100 Subject: [PATCH 068/109] Update dependencies Except rusqlite and vault, because newer sqlite versions appear to result in a *very* big performance drop. I suspect the query planner, though I really have no idea. --- Cargo.lock | 597 +++++++++++++++++++++++------------------------------ Cargo.toml | 41 ++-- 2 files changed, 277 insertions(+), 361 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18a0db8..e77a3ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -26,7 +26,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.34", + "zerocopy 0.7.35", ] [[package]] @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -61,37 +61,38 @@ checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4" [[package]] name = "async-trait" @@ -106,50 +107,48 @@ 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 = "aws-lc-rs" -version = "1.9.0" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" +checksum = "4cd755adf9707cf671e31d944a189be3deaaeee11c8bc1d669bb8022ac90fbd0" dependencies = [ "aws-lc-sys", - "mirai-annotations", "paste", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.21.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" +checksum = "0f9dd2e03ee80ca2822dd6ea431163d2ef259f2066a4d6ccaca6d9dcb386aa43" dependencies = [ "bindgen", "cc", "cmake", "dunce", "fs_extra", - "libc", "paste", ] [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] @@ -177,9 +176,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "block-buffer" @@ -190,6 +189,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.10.0" @@ -207,9 +212,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.2" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" dependencies = [ "jobserver", "libc", @@ -284,18 +289,18 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cmake" -version = "0.1.52" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" dependencies = [ "cc", ] [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "cookie" @@ -345,7 +350,7 @@ dependencies = [ "rusqlite", "rustls", "serde_json", - "thiserror 1.0.61", + "thiserror", "tokio", "toss", "unicode-width", @@ -359,7 +364,7 @@ dependencies = [ "cove-input", "cove-macro", "serde", - "thiserror 1.0.61", + "thiserror", "toml", ] @@ -373,7 +378,7 @@ dependencies = [ "parking_lot", "serde", "serde_either", - "thiserror 1.0.61", + "thiserror", "toss", ] @@ -388,24 +393,24 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crossterm" -version = "0.27.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags", "crossterm_winapi", - "libc", - "mio 0.8.11", + "mio", "parking_lot", + "rustix", "signal-hook", "signal-hook-mio", "winapi", @@ -432,9 +437,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[package]] name = "deranged" @@ -457,23 +462,23 @@ dependencies = [ [[package]] name = "directories" -version = "5.0.1" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -494,30 +499,30 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "euphoxide" -version = "0.5.1" -source = "git+https://github.com/Garmelon/euphoxide.git#1d444684f7f292183c1ab5c89fef3872dadf96fd" +version = "0.6.0" +source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.6.0#4f7cc49b636301ce9beea9324a0a1390f8391009" dependencies = [ "async-trait", "caseless", @@ -548,9 +553,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fnv" @@ -626,20 +631,20 @@ dependencies = [ "cfg-if", "libc", "wasi 0.13.3+wasi-0.2.2", - "windows-targets 0.52.5", + "windows-targets", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "hashbrown" @@ -650,13 +655,19 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + [[package]] name = "hashlink" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -667,18 +678,18 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -687,18 +698,18 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -722,9 +733,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -737,9 +748,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jiff" @@ -752,7 +763,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -804,7 +815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -839,9 +850,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "lock_api" @@ -861,9 +872,9 @@ checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -873,23 +884,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "adler2", ] [[package]] @@ -899,16 +898,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", + "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "nom" version = "7.1.3" @@ -936,24 +930,24 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "open" -version = "5.1.3" +version = "5.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb49fbd5616580e9974662cb96a3463da4476e649a7e4b258df0de065db0657" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" dependencies = [ "is-wsl", "libc", @@ -962,9 +956,9 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "option-ext" @@ -983,9 +977,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1001,7 +995,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets", ] [[package]] @@ -1012,15 +1006,15 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1030,9 +1024,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" @@ -1057,15 +1051,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy 0.7.35", +] [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" dependencies = [ "proc-macro2", "syn", @@ -1073,18 +1070,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.83" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -1122,29 +1119,29 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ "getrandom 0.2.15", "libredox", - "thiserror 1.0.61", + "thiserror", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -1154,9 +1151,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -1165,21 +1162,20 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] @@ -1213,22 +1209,22 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" dependencies = [ "aws-lc-rs", "log", @@ -1253,9 +1249,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" [[package]] name = "rustls-webpki" @@ -1271,17 +1267,17 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1292,9 +1288,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "3.0.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ "bitflags", "core-foundation", @@ -1305,9 +1301,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -1367,9 +1363,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -1403,12 +1399,12 @@ dependencies = [ [[package]] name = "signal-hook-mio" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", - "mio 0.8.11", + "mio", "signal-hook", ] @@ -1432,26 +1428,20 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "strsim" version = "0.11.1" @@ -1460,15 +1450,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.87" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -1477,23 +1467,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" dependencies = [ "cfg-if", "fastrand", + "getrandom 0.3.1", + "once_cell", "rustix", - "windows-sys 0.52.0", -] - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl 1.0.61", + "windows-sys 0.59.0", ] [[package]] @@ -1502,18 +1485,7 @@ version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.11", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "thiserror-impl", ] [[package]] @@ -1529,9 +1501,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -1550,9 +1522,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -1560,9 +1532,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -1582,7 +1554,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.3", + "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", @@ -1604,12 +1576,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] @@ -1642,9 +1613,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -1654,18 +1625,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "serde", @@ -1676,8 +1647,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.2.3" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.2.3#b1d7221bae9e1bb57d8e5b49c315dc3ca56e947a" +version = "0.3.1" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.1#be7eff0979e0e95d070e7c9cea42c328ffd04cc4" dependencies = [ "async-trait", "crossterm", @@ -1701,21 +1672,21 @@ dependencies = [ "rustls", "rustls-pki-types", "sha1", - "thiserror 2.0.11", + "thiserror", "utf-8", ] [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" [[package]] name = "unicode-linebreak" @@ -1734,15 +1705,15 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "untrusted" @@ -1758,9 +1729,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vault" @@ -1779,9 +1750,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -1832,150 +1803,93 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.8" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1" dependencies = [ "memchr", ] @@ -1991,11 +1905,12 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive 0.7.34", + "byteorder", + "zerocopy-derive 0.7.35", ] [[package]] @@ -2009,9 +1924,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", @@ -2031,6 +1946,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index a4bbb26..10e1968 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,39 +7,40 @@ version = "0.8.3" edition = "2021" [workspace.dependencies] -anyhow = "1.0.86" -async-trait = "0.1.80" -clap = { version = "4.5.4", features = ["derive", "deprecated"] } +anyhow = "1.0.96" +async-trait = "0.1.86" +clap = { version = "4.5.30", features = ["derive", "deprecated"] } cookie = "0.18.1" -crossterm = "0.27.0" -directories = "5.0.1" +crossterm = "0.28.1" +directories = "6.0.0" edit = "0.1.5" jiff = "0.2.1" linkify = "0.10.0" -log = { version = "0.4.21", features = ["std"] } -once_cell = "1.19.0" -open = "5.1.3" -parking_lot = "0.12.2" -proc-macro2 = "1.0.83" -quote = "1.0.36" +log = { version = "0.4.25", features = ["std"] } +once_cell = "1.20.2" +open = "5.3.2" +parking_lot = "0.12.3" +proc-macro2 = "1.0.93" +quote = "1.0.38" rusqlite = { version = "0.31.0", features = ["bundled", "time"] } -rustls = "0.23.19" -serde = { version = "1.0.202", features = ["derive"] } +rustls = "0.23.23" +serde = { version = "1.0.218", features = ["derive"] } serde_either = "0.2.1" -serde_json = "1.0.117" -syn = "2.0.65" -thiserror = "1.0.61" -tokio = { version = "1.37.0", features = ["full"] } -toml = "0.8.13" -unicode-width = "0.1.12" +serde_json = "1.0.139" +syn = "2.0.98" +thiserror = "2.0.11" +tokio = { version = "1.43.0", features = ["full"] } +toml = "0.8.20" +unicode-width = "0.2.0" [workspace.dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" +tag = "v0.6.0" features = ["bot"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.2.3" +tag = "v0.3.1" [workspace.dependencies.vault] git = "https://github.com/Garmelon/vault.git" From f45e66f572e10b993bbec6db4e36519143c07a94 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 12:11:58 +0100 Subject: [PATCH 069/109] Fix or ignore 2024 edition migration lints --- Cargo.toml | 6 +++++- cove/src/ui/chat/tree/renderer.rs | 2 +- cove/src/ui/euph/account.rs | 2 +- cove/src/ui/euph/inspect.rs | 4 ++-- cove/src/ui/euph/nick_list.rs | 2 +- cove/src/ui/euph/popup.rs | 4 ++-- cove/src/ui/euph/room.rs | 2 +- cove/src/ui/key_bindings.rs | 2 +- cove/src/ui/rooms.rs | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 10e1968..96c02c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,11 @@ rust.unused_lifetimes = "warn" rust.unused_qualifications = "warn" # Clippy clippy.use_self = "warn" - +# Migrating to the 2024 edition +rust.rust_2024_compatibility = "warn" +rust.edition_2024_expr_fragment_specifier = { level = "allow", priority = 1 } +rust.if_let_rescope = { level = "allow", priority = 1 } +rust.tail_expr_drop_order = { level = "allow", priority = 1 } [profile.dev.package."*"] opt-level = 3 diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 845e803..3aeadb1 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -437,7 +437,7 @@ where pub fn into_visible_blocks( self, - ) -> impl Iterator, Block>)> { + ) -> impl Iterator, Block>)> + use { let area = renderer::visible_area(&self); self.blocks .into_iter() diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index 359e9d5..b97f014 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -66,7 +66,7 @@ impl LoggedOut { pub struct LoggedIn(PersonalAccountView); impl LoggedIn { - fn widget(&self) -> impl Widget { + fn widget(&self) -> impl Widget + use<> { let bold = Style::new().bold(); Join5::vertical( Text::new(("Logged in", bold.green())).segment(), diff --git a/cove/src/ui/euph/inspect.rs b/cove/src/ui/euph/inspect.rs index 25620a2..d1e2380 100644 --- a/cove/src/ui/euph/inspect.rs +++ b/cove/src/ui/euph/inspect.rs @@ -91,7 +91,7 @@ fn message_lines(mut text: Styled, msg: &Message) -> Styled { text } -pub fn session_widget(session: &SessionInfo) -> impl Widget { +pub fn session_widget(session: &SessionInfo) -> impl Widget + use<> { let heading_style = Style::new().bold(); let text = match session { @@ -108,7 +108,7 @@ pub fn session_widget(session: &SessionInfo) -> impl Widget { Popup::new(Text::new(text), "Inspect session") } -pub fn message_widget(msg: &Message) -> impl Widget { +pub fn message_widget(msg: &Message) -> impl Widget + use<> { let heading_style = Style::new().bold(); let mut text = Styled::new("Message", heading_style).then_plain("\n"); diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index 23160bd..47f09c7 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -14,7 +14,7 @@ pub fn widget<'a>( list: &'a mut ListState, joined: &Joined, focused: bool, -) -> impl Widget + 'a { +) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); render_rows(&mut list_builder, joined, focused); list_builder.build(list) diff --git a/cove/src/ui/euph/popup.rs b/cove/src/ui/euph/popup.rs index f70e999..61b3ad5 100644 --- a/cove/src/ui/euph/popup.rs +++ b/cove/src/ui/euph/popup.rs @@ -12,7 +12,7 @@ pub enum RoomPopup { } impl RoomPopup { - fn server_error_widget(description: &str, reason: &str) -> impl Widget { + fn server_error_widget(description: &str, reason: &str) -> impl Widget + use<> { let border_style = Style::new().red().bold(); let text = Styled::new_plain(description) .then_plain("\n\n") @@ -23,7 +23,7 @@ impl RoomPopup { Popup::new(Text::new(text), ("Error", border_style)).with_border_style(border_style) } - pub fn widget(&self) -> impl Widget { + pub fn widget(&self) -> impl Widget + use<> { match self { Self::Error { description, diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 15da008..0b36535 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -287,7 +287,7 @@ impl EuphRoom { .boxed_async() } - async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget { + async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget + use<> { let room_style = Style::new().bold().blue(); let mut info = Styled::new(format!("{} ", self.domain()), Style::new().grey()) .then(format!("&{}", self.name()), room_style); diff --git a/cove/src/ui/key_bindings.rs b/cove/src/ui/key_bindings.rs index 8fceda6..f5fa714 100644 --- a/cove/src/ui/key_bindings.rs +++ b/cove/src/ui/key_bindings.rs @@ -69,7 +69,7 @@ fn render_group_info(builder: &mut Builder, group_info: KeyGroupInfo<'_>) { pub fn widget<'a>( list: &'a mut ListState, config: &Config, -) -> impl Widget + 'a { +) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); for group_info in config.keys.groups() { diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 0157b01..a7bb6f8 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -423,7 +423,7 @@ impl Rooms { list: &'a mut ListState, order: Order, euph_rooms: &HashMap, - ) -> impl Widget + 'a { + ) -> impl Widget + use<'a> { let version_info = Styled::new_plain("Welcome to ") .then(format!("{NAME} {VERSION}"), Style::new().yellow().bold()) .then_plain("!"); From 25d2cc7c9826295ea535e47863b26a18efe349ef Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 12:15:13 +0100 Subject: [PATCH 070/109] Migrate to 2024 edition --- Cargo.toml | 9 ++------- rustfmt.toml | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 rustfmt.toml diff --git a/Cargo.toml b/Cargo.toml index 96c02c1..a58b43d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [workspace] -resolver = "2" +resolver = "3" members = ["cove", "cove-*"] [workspace.package] version = "0.8.3" -edition = "2021" +edition = "2024" [workspace.dependencies] anyhow = "1.0.96" @@ -68,11 +68,6 @@ rust.unused_lifetimes = "warn" rust.unused_qualifications = "warn" # Clippy clippy.use_self = "warn" -# Migrating to the 2024 edition -rust.rust_2024_compatibility = "warn" -rust.edition_2024_expr_fragment_specifier = { level = "allow", priority = 1 } -rust.if_let_rescope = { level = "allow", priority = 1 } -rust.tail_expr_drop_order = { level = "allow", priority = 1 } [profile.dev.package."*"] opt-level = 3 diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..8153a3d --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +style_edition = "2021" From 816d8f86a3034b7fccd871e9f6dcfaabf046c123 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 12:17:43 +0100 Subject: [PATCH 071/109] Migrate rustfmt style to 2024 edition --- cove-input/src/keys.rs | 4 ++-- cove-macro/src/lib.rs | 2 +- cove/src/main.rs | 2 +- cove/src/ui/chat.rs | 2 +- cove/src/ui/chat/blocks.rs | 2 +- cove/src/ui/chat/tree.rs | 4 ++-- cove/src/ui/chat/tree/renderer.rs | 4 ++-- cove/src/ui/chat/tree/scroll.rs | 6 +++--- cove/src/ui/chat/tree/widgets.rs | 2 +- cove/src/ui/euph/account.rs | 2 +- cove/src/ui/euph/auth.rs | 4 ++-- cove/src/ui/euph/inspect.rs | 2 +- cove/src/ui/euph/links.rs | 2 +- cove/src/ui/euph/nick.rs | 2 +- cove/src/ui/euph/nick_list.rs | 2 +- cove/src/ui/euph/popup.rs | 2 +- cove/src/ui/euph/room.rs | 2 +- cove/src/ui/key_bindings.rs | 2 +- cove/src/ui/rooms.rs | 2 +- cove/src/ui/rooms/connect.rs | 2 +- cove/src/ui/rooms/delete.rs | 2 +- cove/src/vault.rs | 2 +- cove/src/vault/euph.rs | 6 +++--- rustfmt.toml | 1 - 24 files changed, 31 insertions(+), 32 deletions(-) delete mode 100644 rustfmt.toml diff --git a/cove-input/src/keys.rs b/cove-input/src/keys.rs index 337a5f3..7e5cfa0 100644 --- a/cove-input/src/keys.rs +++ b/cove-input/src/keys.rs @@ -3,7 +3,7 @@ use std::num::ParseIntError; use std::str::FromStr; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; -use serde::{de::Error, Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, de::Error}; use serde::{Serialize, Serializer}; use serde_either::SingleOrVec; @@ -117,7 +117,7 @@ impl KeyPress { "alt" if !self.alt => self.alt = true, "any" if !self.shift && !self.ctrl && !self.alt => self.any = true, m @ ("shift" | "ctrl" | "alt" | "any") => { - return Err(ParseKeysError::ConflictingModifier(m.to_string())) + return Err(ParseKeysError::ConflictingModifier(m.to_string())); } m => return Err(ParseKeysError::UnknownModifier(m.to_string())), } diff --git a/cove-macro/src/lib.rs b/cove-macro/src/lib.rs index fd09f5f..c655f2a 100644 --- a/cove-macro/src/lib.rs +++ b/cove-macro/src/lib.rs @@ -1,4 +1,4 @@ -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; mod document; mod key_group; diff --git a/cove/src/main.rs b/cove/src/main.rs index 6596eab..fe9a9c1 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -15,8 +15,8 @@ use std::path::PathBuf; use anyhow::Context; use clap::Parser; -use cove_config::doc::Document; use cove_config::Config; +use cove_config::doc::Document; use directories::{BaseDirs, ProjectDirs}; use log::info; use tokio::sync::mpsc; diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index cc7acc7..69f5e2b 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -6,8 +6,8 @@ mod widgets; use cove_config::Keys; use cove_input::InputEvent; -use jiff::tz::TimeZone; use jiff::Timestamp; +use jiff::tz::TimeZone; use toss::widgets::{BoxedAsync, EditorState}; use toss::{Styled, WidgetExt}; diff --git a/cove/src/ui/chat/blocks.rs b/cove/src/ui/chat/blocks.rs index 1b91864..8360e83 100644 --- a/cove/src/ui/chat/blocks.rs +++ b/cove/src/ui/chat/blocks.rs @@ -1,6 +1,6 @@ //! Common rendering logic. -use std::collections::{vec_deque, VecDeque}; +use std::collections::{VecDeque, vec_deque}; use toss::widgets::Predrawn; diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index b01602c..9ac31f8 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -16,13 +16,13 @@ use toss::widgets::EditorState; use toss::{AsyncWidget, Frame, Pos, Size, WidgetExt, WidthDb}; use crate::store::{Msg, MsgStore}; -use crate::ui::{util, ChatMsg, UiError}; +use crate::ui::{ChatMsg, UiError, util}; use crate::util::InfallibleExt; use self::renderer::{TreeContext, TreeRenderer}; -use super::cursor::Cursor; use super::Reaction; +use super::cursor::Cursor; pub struct TreeViewState> { store: S, diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 3aeadb1..192e46c 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -9,10 +9,10 @@ use toss::widgets::{EditorState, Empty, Predrawn, Resize}; use toss::{Size, Widget, WidthDb}; use crate::store::{Msg, MsgStore, Tree}; +use crate::ui::ChatMsg; use crate::ui::chat::blocks::{Block, Blocks, Range}; use crate::ui::chat::cursor::Cursor; -use crate::ui::chat::renderer::{self, overlaps, Renderer}; -use crate::ui::ChatMsg; +use crate::ui::chat::renderer::{self, Renderer, overlaps}; use crate::util::InfallibleExt; use super::widgets; diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index b02c4a1..73e0e71 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -1,12 +1,12 @@ -use toss::widgets::EditorState; use toss::WidthDb; +use toss::widgets::EditorState; use crate::store::{Msg, MsgStore}; -use crate::ui::chat::cursor::Cursor; use crate::ui::ChatMsg; +use crate::ui::chat::cursor::Cursor; -use super::renderer::{TreeContext, TreeRenderer}; use super::TreeViewState; +use super::renderer::{TreeContext, TreeRenderer}; impl TreeViewState where diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index b302670..bc807d7 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -6,8 +6,8 @@ use toss::widgets::{Boxed, EditorState, Join2, Join4, Join5, Text}; use toss::{Style, Styled, WidgetExt}; use crate::store::Msg; -use crate::ui::chat::widgets::{Indent, Seen, Time}; use crate::ui::ChatMsg; +use crate::ui::chat::widgets::{Indent, Seen, Time}; use crate::util; pub const PLACEHOLDER: &str = "[...]"; diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index b97f014..a982711 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -8,7 +8,7 @@ use toss::{Style, Widget, WidgetExt}; use crate::euph::{self, Room}; use crate::ui::widgets::Popup; -use crate::ui::{util, UiError}; +use crate::ui::{UiError, util}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/auth.rs b/cove/src/ui/euph/auth.rs index b938ff1..2fbc1c0 100644 --- a/cove/src/ui/euph/auth.rs +++ b/cove/src/ui/euph/auth.rs @@ -1,11 +1,11 @@ use cove_config::Keys; use cove_input::InputEvent; -use toss::widgets::EditorState; use toss::Widget; +use toss::widgets::EditorState; use crate::euph::Room; use crate::ui::widgets::Popup; -use crate::ui::{util, UiError}; +use crate::ui::{UiError, util}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/inspect.rs b/cove/src/ui/euph/inspect.rs index d1e2380..e2bcf33 100644 --- a/cove/src/ui/euph/inspect.rs +++ b/cove/src/ui/euph/inspect.rs @@ -6,8 +6,8 @@ use euphoxide::conn::SessionInfo; use toss::widgets::Text; use toss::{Style, Styled, Widget}; -use crate::ui::widgets::Popup; use crate::ui::UiError; +use crate::ui::widgets::Popup; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index 8e3f535..b3e5fb4 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -7,7 +7,7 @@ use toss::widgets::{Join2, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::ui::widgets::{ListBuilder, ListState, Popup}; -use crate::ui::{key_bindings, util, UiError}; +use crate::ui::{UiError, key_bindings, util}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/nick.rs b/cove/src/ui/euph/nick.rs index 0bb1062..91bdd10 100644 --- a/cove/src/ui/euph/nick.rs +++ b/cove/src/ui/euph/nick.rs @@ -6,7 +6,7 @@ use toss::{Style, Widget}; use crate::euph::{self, Room}; use crate::ui::widgets::Popup; -use crate::ui::{util, UiError}; +use crate::ui::{UiError, util}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index 47f09c7..8401c80 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -7,8 +7,8 @@ use toss::widgets::{Background, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::euph; -use crate::ui::widgets::{ListBuilder, ListState}; use crate::ui::UiError; +use crate::ui::widgets::{ListBuilder, ListState}; pub fn widget<'a>( list: &'a mut ListState, diff --git a/cove/src/ui/euph/popup.rs b/cove/src/ui/euph/popup.rs index 61b3ad5..e9d4671 100644 --- a/cove/src/ui/euph/popup.rs +++ b/cove/src/ui/euph/popup.rs @@ -4,8 +4,8 @@ use crossterm::style::Stylize; use toss::widgets::Text; use toss::{Style, Styled, Widget}; -use crate::ui::widgets::Popup; use crate::ui::UiError; +use crate::ui::widgets::Popup; pub enum RoomPopup { Error { description: String, reason: String }, diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 0b36535..eafd789 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -16,7 +16,7 @@ use crate::euph; use crate::macros::logging_unwrap; use crate::ui::chat::{ChatState, Reaction}; use crate::ui::widgets::ListState; -use crate::ui::{util, UiError, UiEvent}; +use crate::ui::{UiError, UiEvent, util}; use crate::vault::EuphRoomVault; use super::account::AccountUiState; diff --git a/cove/src/ui/key_bindings.rs b/cove/src/ui/key_bindings.rs index f5fa714..de3c889 100644 --- a/cove/src/ui/key_bindings.rs +++ b/cove/src/ui/key_bindings.rs @@ -9,7 +9,7 @@ use toss::widgets::{Either2, Join2, Padding, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use super::widgets::{ListBuilder, ListState, Popup}; -use super::{util, UiError}; +use super::{UiError, util}; type Line = Either2, Text>>; type Builder = ListBuilder<'static, Infallible, Line>; diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index a7bb6f8..f26defa 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -28,7 +28,7 @@ use self::delete::{DeleteResult, DeleteState}; use super::euph::room::EuphRoom; use super::widgets::{ListBuilder, ListState}; -use super::{key_bindings, util, UiError, UiEvent}; +use super::{UiError, UiEvent, key_bindings, util}; enum State { ShowList, diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs index 2bf90c5..4ad3c39 100644 --- a/cove/src/ui/rooms/connect.rs +++ b/cove/src/ui/rooms/connect.rs @@ -5,7 +5,7 @@ use toss::widgets::{EditorState, Empty, Join2, Join3, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::ui::widgets::Popup; -use crate::ui::{util, UiError}; +use crate::ui::{UiError, util}; use crate::vault::RoomIdentifier; #[derive(Clone, Copy, PartialEq, Eq)] diff --git a/cove/src/ui/rooms/delete.rs b/cove/src/ui/rooms/delete.rs index 5a20415..d5b6884 100644 --- a/cove/src/ui/rooms/delete.rs +++ b/cove/src/ui/rooms/delete.rs @@ -5,7 +5,7 @@ use toss::widgets::{EditorState, Empty, Join2, Text}; use toss::{Style, Styled, Widget, WidgetExt}; use crate::ui::widgets::Popup; -use crate::ui::{util, UiError}; +use crate::ui::{UiError, util}; use crate::vault::RoomIdentifier; pub struct DeleteState { diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 6861901..512dfd2 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -6,8 +6,8 @@ use std::fs; use std::path::Path; use rusqlite::Connection; -use vault::tokio::TokioVault; use vault::Action; +use vault::tokio::TokioVault; pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index c7d6410..3e98590 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use cookie::{Cookie, CookieJar}; use euphoxide::api::{Message, MessageId, SessionId, SessionView, Snowflake, Time, UserId}; use rusqlite::types::{FromSql, FromSqlError, ToSqlOutput, Value, ValueRef}; -use rusqlite::{named_params, params, Connection, OptionalExtension, Row, ToSql, Transaction}; +use rusqlite::{Connection, OptionalExtension, Row, ToSql, Transaction, named_params, params}; use vault::Action; use crate::euph::SmallMessage; @@ -16,7 +16,7 @@ struct WSnowflake(Snowflake); impl ToSql for WSnowflake { fn to_sql(&self) -> rusqlite::Result> { - self.0 .0.to_sql() + self.0.0.to_sql() } } @@ -31,7 +31,7 @@ struct WTime(Time); impl ToSql for WTime { fn to_sql(&self) -> rusqlite::Result> { - let timestamp = self.0 .0; + let timestamp = self.0.0; Ok(ToSqlOutput::Owned(Value::Integer(timestamp))) } } diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 8153a3d..0000000 --- a/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -style_edition = "2021" From fbc64de60713c8e7f065ad36ca055be9bf4f1b8d Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 12:42:51 +0100 Subject: [PATCH 072/109] Merge and reorder imports This change brings them in-line with the default settings of rust-analyzer. Originally, I disliked this style, but by now, I've grown used to it and prefer it slightly. Also, I like staying on the default path since I usually don't need to check the imports to see if rust-analyzer messed anything up (except for omitting the self:: when importing modules defined in the current module, grr :D). I've also come around to the idea of trailing mod definitions instead of putting them at the top: I would also put module definitions that contain code instead of referencing another file below the imports. It feels weird to have code above imports. So it just makes sense to do the same for all types of mod definitions. If rustfmt ever gains stable support for grouping imports, I'll probably use that instead. --- .vscode/settings.json | 2 +- cove-config/src/doc.rs | 3 +- cove-config/src/lib.rs | 19 ++++++----- cove-input/src/keys.rs | 7 ++-- cove-input/src/lib.rs | 7 ++-- cove-macro/src/document.rs | 3 +- cove-macro/src/key_group.rs | 3 +- cove-macro/src/util.rs | 7 ++-- cove/src/euph.rs | 8 ++--- cove/src/euph/room.rs | 24 ++++++------- cove/src/euph/small_message.rs | 3 +- cove/src/export.rs | 12 ++++--- cove/src/export/text.rs | 4 +-- cove/src/logger.rs | 10 +++--- cove/src/main.rs | 33 +++++++++--------- cove/src/store.rs | 5 +-- cove/src/ui.rs | 52 ++++++++++++++-------------- cove/src/ui/chat.rs | 32 +++++++++--------- cove/src/ui/chat/cursor.rs | 3 +- cove/src/ui/chat/tree.rs | 22 ++++++------ cove/src/ui/chat/tree/renderer.rs | 27 +++++++++------ cove/src/ui/chat/tree/scroll.rs | 16 +++++---- cove/src/ui/chat/tree/widgets.rs | 18 ++++++---- cove/src/ui/chat/widgets.rs | 6 ++-- cove/src/ui/euph/account.rs | 16 +++++---- cove/src/ui/euph/auth.rs | 10 +++--- cove/src/ui/euph/inspect.rs | 12 +++---- cove/src/ui/euph/links.rs | 15 +++++---- cove/src/ui/euph/nick.rs | 10 +++--- cove/src/ui/euph/nick_list.rs | 22 ++++++++---- cove/src/ui/euph/popup.rs | 6 ++-- cove/src/ui/euph/room.rs | 48 ++++++++++++++++---------- cove/src/ui/key_bindings.rs | 12 ++++--- cove/src/ui/rooms.rs | 56 +++++++++++++++++++------------ cove/src/ui/rooms/connect.rs | 13 ++++--- cove/src/ui/rooms/delete.rs | 13 ++++--- cove/src/ui/widgets.rs | 6 ++-- cove/src/ui/widgets/popup.rs | 6 ++-- cove/src/util.rs | 3 +- cove/src/vault.rs | 16 ++++----- cove/src/vault/euph.rs | 15 +++++---- 41 files changed, 332 insertions(+), 273 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a89179..4e428aa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "files.insertFinalNewline": true, "rust-analyzer.cargo.features": "all", "rust-analyzer.imports.granularity.enforce": true, - "rust-analyzer.imports.granularity.group": "module", + "rust-analyzer.imports.granularity.group": "crate", "rust-analyzer.imports.group.enable": true, "evenBetterToml.formatter.columnWidth": 100, } diff --git a/cove-config/src/doc.rs b/cove-config/src/doc.rs index 16ed3ac..35f6074 100644 --- a/cove-config/src/doc.rs +++ b/cove-config/src/doc.rs @@ -1,7 +1,6 @@ //! Auto-generate markdown documentation. -use std::collections::HashMap; -use std::path::PathBuf; +use std::{collections::HashMap, path::PathBuf}; use cove_input::KeyBinding; pub use cove_macro::Document; diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 026ce9e..0d350ed 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -1,16 +1,17 @@ -pub mod doc; -mod euph; -mod keys; - -use std::io::ErrorKind; -use std::path::{Path, PathBuf}; -use std::{fs, io}; +use std::{ + fs, + io::{self, ErrorKind}, + path::{Path, PathBuf}, +}; use doc::Document; use serde::Deserialize; -pub use crate::euph::*; -pub use crate::keys::*; +pub use crate::{euph::*, keys::*}; + +pub mod doc; +mod euph; +mod keys; #[derive(Debug, thiserror::Error)] pub enum Error { diff --git a/cove-input/src/keys.rs b/cove-input/src/keys.rs index 7e5cfa0..8d2fdf1 100644 --- a/cove-input/src/keys.rs +++ b/cove-input/src/keys.rs @@ -1,10 +1,7 @@ -use std::fmt; -use std::num::ParseIntError; -use std::str::FromStr; +use std::{fmt, num::ParseIntError, str::FromStr}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; -use serde::{Deserialize, Deserializer, de::Error}; -use serde::{Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error}; use serde_either::SingleOrVec; #[derive(Debug, thiserror::Error)] diff --git a/cove-input/src/lib.rs b/cove-input/src/lib.rs index c15c4c3..f6b2e92 100644 --- a/cove-input/src/lib.rs +++ b/cove-input/src/lib.rs @@ -1,7 +1,4 @@ -mod keys; - -use std::io; -use std::sync::Arc; +use std::{io, sync::Arc}; pub use cove_macro::KeyGroup; use crossterm::event::{Event, KeyEvent, KeyEventKind}; @@ -10,6 +7,8 @@ use toss::{Frame, Terminal, WidthDb}; pub use crate::keys::*; +mod keys; + pub struct KeyBindingInfo<'a> { pub name: &'static str, pub binding: &'a KeyBinding, diff --git a/cove-macro/src/document.rs b/cove-macro/src/document.rs index e8e248e..afec84d 100644 --- a/cove-macro/src/document.rs +++ b/cove-macro/src/document.rs @@ -1,7 +1,6 @@ use proc_macro2::TokenStream; use quote::quote; -use syn::spanned::Spanned; -use syn::{Data, DataEnum, DataStruct, DeriveInput, Field, Ident, LitStr}; +use syn::{Data, DataEnum, DataStruct, DeriveInput, Field, Ident, LitStr, spanned::Spanned}; use crate::util::{self, SerdeDefault}; diff --git a/cove-macro/src/key_group.rs b/cove-macro/src/key_group.rs index 84d8cff..832bfd3 100644 --- a/cove-macro/src/key_group.rs +++ b/cove-macro/src/key_group.rs @@ -1,7 +1,6 @@ use proc_macro2::TokenStream; use quote::quote; -use syn::spanned::Spanned; -use syn::{Data, DeriveInput}; +use syn::{Data, DeriveInput, spanned::Spanned}; use crate::util; diff --git a/cove-macro/src/util.rs b/cove-macro/src/util.rs index b7bf62a..d73b7ca 100644 --- a/cove-macro/src/util.rs +++ b/cove-macro/src/util.rs @@ -1,8 +1,9 @@ use proc_macro2::{Span, TokenStream}; use quote::quote; -use syn::parse::Parse; -use syn::punctuated::Punctuated; -use syn::{Attribute, Expr, ExprLit, ExprPath, Field, Lit, LitStr, Path, Token, Type}; +use syn::{ + Attribute, Expr, ExprLit, ExprPath, Field, Lit, LitStr, Path, Token, Type, parse::Parse, + punctuated::Punctuated, +}; pub fn bail(span: Span, message: &str) -> syn::Result { Err(syn::Error::new(span, message)) diff --git a/cove/src/euph.rs b/cove/src/euph.rs index ab93753..d1fd872 100644 --- a/cove/src/euph.rs +++ b/cove/src/euph.rs @@ -1,7 +1,7 @@ -mod room; -mod small_message; -mod util; - pub use room::*; pub use small_message::*; pub use util::*; + +mod room; +mod small_message; +mod util; diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 64ddfe6..17aafe4 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -1,21 +1,19 @@ // TODO Remove rl2dev-specific code -use std::convert::Infallible; -use std::time::Duration; +use std::{convert::Infallible, time::Duration}; -use euphoxide::api::packet::ParsedPacket; -use euphoxide::api::{ - Auth, AuthOption, Data, Log, Login, Logout, MessageId, Nick, Send, SendEvent, SendReply, Time, - UserId, +use euphoxide::{ + api::{ + Auth, AuthOption, Data, Log, Login, Logout, MessageId, Nick, Send, SendEvent, SendReply, + Time, UserId, packet::ParsedPacket, + }, + bot::instance::{ConnSnapshot, Event, Instance, InstanceConfig}, + conn::{self, ConnTx, Joined}, }; -use euphoxide::bot::instance::{ConnSnapshot, Event, Instance, InstanceConfig}; -use euphoxide::conn::{self, ConnTx, Joined}; -use log::{debug, error, info, warn}; -use tokio::select; -use tokio::sync::oneshot; +use log::{debug, info, warn}; +use tokio::{select, sync::oneshot}; -use crate::macros::logging_unwrap; -use crate::vault::EuphRoomVault; +use crate::{macros::logging_unwrap, vault::EuphRoomVault}; const LOG_INTERVAL: Duration = Duration::from_secs(10); diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 994b0ae..20596fa 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -5,8 +5,7 @@ use euphoxide::api::{MessageId, Snowflake, Time}; use jiff::Timestamp; use toss::{Style, Styled}; -use crate::store::Msg; -use crate::ui::ChatMsg; +use crate::{store::Msg, ui::ChatMsg}; use super::util; diff --git a/cove/src/export.rs b/cove/src/export.rs index 0ad9414..80db7b6 100644 --- a/cove/src/export.rs +++ b/cove/src/export.rs @@ -1,13 +1,15 @@ //! Export logs from the vault to plain text files. +use std::{ + fs::File, + io::{self, BufWriter, Write}, +}; + +use crate::vault::{EuphRoomVault, EuphVault, RoomIdentifier}; + mod json; mod text; -use std::fs::File; -use std::io::{self, BufWriter, Write}; - -use crate::vault::{EuphRoomVault, EuphVault, RoomIdentifier}; - #[derive(Debug, Clone, Copy, clap::ValueEnum)] pub enum Format { /// Human-readable tree-structured messages. diff --git a/cove/src/export/text.rs b/cove/src/export/text.rs index 23a75d8..2ca6687 100644 --- a/cove/src/export/text.rs +++ b/cove/src/export/text.rs @@ -3,9 +3,7 @@ use std::io::Write; use euphoxide::api::MessageId; use unicode_width::UnicodeWidthStr; -use crate::euph::SmallMessage; -use crate::store::Tree; -use crate::vault::EuphRoomVault; +use crate::{euph::SmallMessage, store::Tree, vault::EuphRoomVault}; const TIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; const TIME_EMPTY: &str = " "; diff --git a/cove/src/logger.rs b/cove/src/logger.rs index 5574960..940e1a9 100644 --- a/cove/src/logger.rs +++ b/cove/src/logger.rs @@ -1,6 +1,4 @@ -use std::convert::Infallible; -use std::sync::Arc; -use std::vec; +use std::{convert::Infallible, sync::Arc, vec}; use async_trait::async_trait; use crossterm::style::Stylize; @@ -10,8 +8,10 @@ use parking_lot::Mutex; use tokio::sync::mpsc; use toss::{Style, Styled}; -use crate::store::{Msg, MsgStore, Path, Tree}; -use crate::ui::ChatMsg; +use crate::{ + store::{Msg, MsgStore, Path, Tree}, + ui::ChatMsg, +}; #[derive(Debug, Clone)] pub struct LogMsg { diff --git a/cove/src/main.rs b/cove/src/main.rs index fe9a9c1..642b62e 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -1,6 +1,23 @@ // TODO Remove unnecessary Debug impls and compare compile times // TODO Invoke external notification command? +use std::path::PathBuf; + +use anyhow::Context; +use clap::Parser; +use cove_config::{Config, doc::Document}; +use directories::{BaseDirs, ProjectDirs}; +use log::info; +use tokio::sync::mpsc; +use toss::Terminal; + +use crate::{ + logger::Logger, + ui::Ui, + vault::Vault, + version::{NAME, VERSION}, +}; + mod euph; mod export; mod logger; @@ -11,22 +28,6 @@ mod util; mod vault; mod version; -use std::path::PathBuf; - -use anyhow::Context; -use clap::Parser; -use cove_config::Config; -use cove_config::doc::Document; -use directories::{BaseDirs, ProjectDirs}; -use log::info; -use tokio::sync::mpsc; -use toss::Terminal; - -use crate::logger::Logger; -use crate::ui::Ui; -use crate::vault::Vault; -use crate::version::{NAME, VERSION}; - #[derive(Debug, clap::Parser)] enum Command { /// Run the client interactively (default). diff --git a/cove/src/store.rs b/cove/src/store.rs index f6c85b7..f64f71e 100644 --- a/cove/src/store.rs +++ b/cove/src/store.rs @@ -1,7 +1,4 @@ -use std::collections::HashMap; -use std::fmt::Debug; -use std::hash::Hash; -use std::vec; +use std::{collections::HashMap, fmt::Debug, hash::Hash, vec}; use async_trait::async_trait; diff --git a/cove/src/ui.rs b/cove/src/ui.rs index 0263325..1c03834 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -1,3 +1,30 @@ +use std::{ + convert::Infallible, + io, + sync::{Arc, Weak}, + time::{Duration, Instant}, +}; + +use cove_config::Config; +use cove_input::InputEvent; +use jiff::tz::TimeZone; +use parking_lot::FairMutex; +use tokio::{ + sync::mpsc::{self, UnboundedReceiver, UnboundedSender, error::TryRecvError}, + task, +}; +use toss::{Terminal, WidgetExt, widgets::BoxedAsync}; + +use crate::{ + logger::{LogMsg, Logger}, + macros::logging_unwrap, + util::InfallibleExt, + vault::Vault, +}; + +pub use self::chat::ChatMsg; +use self::{chat::ChatState, rooms::Rooms, widgets::ListState}; + mod chat; mod euph; mod key_bindings; @@ -5,31 +32,6 @@ mod rooms; mod util; mod widgets; -use std::convert::Infallible; -use std::io; -use std::sync::{Arc, Weak}; -use std::time::{Duration, Instant}; - -use cove_config::Config; -use cove_input::InputEvent; -use jiff::tz::TimeZone; -use parking_lot::FairMutex; -use tokio::sync::mpsc::error::TryRecvError; -use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; -use tokio::task; -use toss::widgets::BoxedAsync; -use toss::{Terminal, WidgetExt}; - -use crate::logger::{LogMsg, Logger}; -use crate::macros::logging_unwrap; -use crate::util::InfallibleExt; -use crate::vault::Vault; - -pub use self::chat::ChatMsg; -use self::chat::ChatState; -use self::rooms::Rooms; -use self::widgets::ListState; - /// Time to spend batch processing events before redrawing the screen. const EVENT_PROCESSING_TIME: Duration = Duration::from_millis(1000 / 15); // 15 fps diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 69f5e2b..405339b 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -1,24 +1,26 @@ +use cove_config::Keys; +use cove_input::InputEvent; +use jiff::{Timestamp, tz::TimeZone}; +use toss::{ + Styled, WidgetExt, + widgets::{BoxedAsync, EditorState}, +}; + +use crate::{ + store::{Msg, MsgStore}, + util, +}; + +use super::UiError; + +use self::{cursor::Cursor, tree::TreeViewState}; + mod blocks; mod cursor; mod renderer; mod tree; mod widgets; -use cove_config::Keys; -use cove_input::InputEvent; -use jiff::Timestamp; -use jiff::tz::TimeZone; -use toss::widgets::{BoxedAsync, EditorState}; -use toss::{Styled, WidgetExt}; - -use crate::store::{Msg, MsgStore}; -use crate::util; - -use self::cursor::Cursor; -use self::tree::TreeViewState; - -use super::UiError; - pub trait ChatMsg { fn time(&self) -> Option; fn styled(&self) -> (Styled, Styled); diff --git a/cove/src/ui/chat/cursor.rs b/cove/src/ui/chat/cursor.rs index 561f4ed..87bd8fc 100644 --- a/cove/src/ui/chat/cursor.rs +++ b/cove/src/ui/chat/cursor.rs @@ -1,7 +1,6 @@ //! Common cursor movement logic. -use std::collections::HashSet; -use std::hash::Hash; +use std::{collections::HashSet, hash::Hash}; use crate::store::{Msg, MsgStore, Tree}; diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index 9ac31f8..043e109 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -2,27 +2,27 @@ // TODO Focusing on sub-trees -mod renderer; -mod scroll; -mod widgets; - use std::collections::HashSet; use async_trait::async_trait; use cove_config::Keys; use cove_input::InputEvent; use jiff::tz::TimeZone; -use toss::widgets::EditorState; -use toss::{AsyncWidget, Frame, Pos, Size, WidgetExt, WidthDb}; +use toss::{AsyncWidget, Frame, Pos, Size, WidgetExt, WidthDb, widgets::EditorState}; -use crate::store::{Msg, MsgStore}; -use crate::ui::{ChatMsg, UiError, util}; -use crate::util::InfallibleExt; +use crate::{ + store::{Msg, MsgStore}, + ui::{UiError, util}, + util::InfallibleExt, +}; + +use super::{ChatMsg, Reaction, cursor::Cursor}; use self::renderer::{TreeContext, TreeRenderer}; -use super::Reaction; -use super::cursor::Cursor; +mod renderer; +mod scroll; +mod widgets; pub struct TreeViewState> { store: S, diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 192e46c..142624e 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -1,19 +1,26 @@ //! A [`Renderer`] for message trees. -use std::collections::HashSet; -use std::convert::Infallible; +use std::{collections::HashSet, convert::Infallible}; use async_trait::async_trait; use jiff::tz::TimeZone; -use toss::widgets::{EditorState, Empty, Predrawn, Resize}; -use toss::{Size, Widget, WidthDb}; +use toss::{ + Size, Widget, WidthDb, + widgets::{EditorState, Empty, Predrawn, Resize}, +}; -use crate::store::{Msg, MsgStore, Tree}; -use crate::ui::ChatMsg; -use crate::ui::chat::blocks::{Block, Blocks, Range}; -use crate::ui::chat::cursor::Cursor; -use crate::ui::chat::renderer::{self, Renderer, overlaps}; -use crate::util::InfallibleExt; +use crate::{ + store::{Msg, MsgStore, Tree}, + ui::{ + ChatMsg, + chat::{ + blocks::{Block, Blocks, Range}, + cursor::Cursor, + renderer::{self, Renderer, overlaps}, + }, + }, + util::InfallibleExt, +}; use super::widgets; diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index 73e0e71..ab3ddae 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -1,12 +1,14 @@ -use toss::WidthDb; -use toss::widgets::EditorState; +use toss::{WidthDb, widgets::EditorState}; -use crate::store::{Msg, MsgStore}; -use crate::ui::ChatMsg; -use crate::ui::chat::cursor::Cursor; +use crate::{ + store::{Msg, MsgStore}, + ui::{ChatMsg, chat::cursor::Cursor}, +}; -use super::TreeViewState; -use super::renderer::{TreeContext, TreeRenderer}; +use super::{ + TreeViewState, + renderer::{TreeContext, TreeRenderer}, +}; impl TreeViewState where diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index bc807d7..d46920e 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -2,13 +2,19 @@ use std::convert::Infallible; use crossterm::style::Stylize; use jiff::tz::TimeZone; -use toss::widgets::{Boxed, EditorState, Join2, Join4, Join5, Text}; -use toss::{Style, Styled, WidgetExt}; +use toss::{ + Style, Styled, WidgetExt, + widgets::{Boxed, EditorState, Join2, Join4, Join5, Text}, +}; -use crate::store::Msg; -use crate::ui::ChatMsg; -use crate::ui::chat::widgets::{Indent, Seen, Time}; -use crate::util; +use crate::{ + store::Msg, + ui::{ + ChatMsg, + chat::widgets::{Indent, Seen, Time}, + }, + util, +}; pub const PLACEHOLDER: &str = "[...]"; diff --git a/cove/src/ui/chat/widgets.rs b/cove/src/ui/chat/widgets.rs index 43ad29e..e0e2fe5 100644 --- a/cove/src/ui/chat/widgets.rs +++ b/cove/src/ui/chat/widgets.rs @@ -2,8 +2,10 @@ use std::convert::Infallible; use crossterm::style::Stylize; use jiff::Zoned; -use toss::widgets::{Boxed, Empty, Text}; -use toss::{Frame, Pos, Size, Style, Widget, WidgetExt, WidthDb}; +use toss::{ + Frame, Pos, Size, Style, Widget, WidgetExt, WidthDb, + widgets::{Boxed, Empty, Text}, +}; use crate::util::InfallibleExt; diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index a982711..48731d9 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -1,14 +1,16 @@ use cove_config::Keys; use cove_input::InputEvent; use crossterm::style::Stylize; -use euphoxide::api::PersonalAccountView; -use euphoxide::conn; -use toss::widgets::{EditorState, Empty, Join3, Join4, Join5, Text}; -use toss::{Style, Widget, WidgetExt}; +use euphoxide::{api::PersonalAccountView, conn}; +use toss::{ + Style, Widget, WidgetExt, + widgets::{EditorState, Empty, Join3, Join4, Join5, Text}, +}; -use crate::euph::{self, Room}; -use crate::ui::widgets::Popup; -use crate::ui::{UiError, util}; +use crate::{ + euph::{self, Room}, + ui::{UiError, util, widgets::Popup}, +}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/auth.rs b/cove/src/ui/euph/auth.rs index 2fbc1c0..259e204 100644 --- a/cove/src/ui/euph/auth.rs +++ b/cove/src/ui/euph/auth.rs @@ -1,11 +1,11 @@ use cove_config::Keys; use cove_input::InputEvent; -use toss::Widget; -use toss::widgets::EditorState; +use toss::{Widget, widgets::EditorState}; -use crate::euph::Room; -use crate::ui::widgets::Popup; -use crate::ui::{UiError, util}; +use crate::{ + euph::Room, + ui::{UiError, util, widgets::Popup}, +}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/inspect.rs b/cove/src/ui/euph/inspect.rs index e2bcf33..b3c4e0e 100644 --- a/cove/src/ui/euph/inspect.rs +++ b/cove/src/ui/euph/inspect.rs @@ -1,13 +1,13 @@ use cove_config::Keys; use cove_input::InputEvent; use crossterm::style::Stylize; -use euphoxide::api::{Message, NickEvent, SessionView}; -use euphoxide::conn::SessionInfo; -use toss::widgets::Text; -use toss::{Style, Styled, Widget}; +use euphoxide::{ + api::{Message, NickEvent, SessionView}, + conn::SessionInfo, +}; +use toss::{Style, Styled, Widget, widgets::Text}; -use crate::ui::UiError; -use crate::ui::widgets::Popup; +use crate::ui::{UiError, widgets::Popup}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index b3e5fb4..14496a6 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -1,13 +1,16 @@ use cove_config::{Config, Keys}; use cove_input::InputEvent; -use crossterm::event::KeyCode; -use crossterm::style::Stylize; +use crossterm::{event::KeyCode, style::Stylize}; use linkify::{LinkFinder, LinkKind}; -use toss::widgets::{Join2, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{Join2, Text}, +}; -use crate::ui::widgets::{ListBuilder, ListState, Popup}; -use crate::ui::{UiError, key_bindings, util}; +use crate::ui::{ + UiError, key_bindings, util, + widgets::{ListBuilder, ListState, Popup}, +}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/nick.rs b/cove/src/ui/euph/nick.rs index 91bdd10..1940fac 100644 --- a/cove/src/ui/euph/nick.rs +++ b/cove/src/ui/euph/nick.rs @@ -1,12 +1,12 @@ use cove_config::Keys; use cove_input::InputEvent; use euphoxide::conn::Joined; -use toss::widgets::EditorState; -use toss::{Style, Widget}; +use toss::{Style, Widget, widgets::EditorState}; -use crate::euph::{self, Room}; -use crate::ui::widgets::Popup; -use crate::ui::{UiError, util}; +use crate::{ + euph::{self, Room}, + ui::{UiError, util, widgets::Popup}, +}; use super::popup::PopupResult; diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index 8401c80..e1e4e3d 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -1,14 +1,22 @@ use std::iter; use crossterm::style::{Color, Stylize}; -use euphoxide::api::{NickEvent, SessionId, SessionType, SessionView, UserId}; -use euphoxide::conn::{Joined, SessionInfo}; -use toss::widgets::{Background, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use euphoxide::{ + api::{NickEvent, SessionId, SessionType, SessionView, UserId}, + conn::{Joined, SessionInfo}, +}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{Background, Text}, +}; -use crate::euph; -use crate::ui::UiError; -use crate::ui::widgets::{ListBuilder, ListState}; +use crate::{ + euph, + ui::{ + UiError, + widgets::{ListBuilder, ListState}, + }, +}; pub fn widget<'a>( list: &'a mut ListState, diff --git a/cove/src/ui/euph/popup.rs b/cove/src/ui/euph/popup.rs index e9d4671..3f8caaa 100644 --- a/cove/src/ui/euph/popup.rs +++ b/cove/src/ui/euph/popup.rs @@ -1,11 +1,9 @@ use std::io; use crossterm::style::Stylize; -use toss::widgets::Text; -use toss::{Style, Styled, Widget}; +use toss::{Style, Styled, Widget, widgets::Text}; -use crate::ui::UiError; -use crate::ui::widgets::Popup; +use crate::ui::{UiError, widgets::Popup}; pub enum RoomPopup { Error { description: String, reason: String }, diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index eafd789..7d4b49c 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -3,26 +3,40 @@ use std::collections::VecDeque; use cove_config::{Config, Keys}; use cove_input::InputEvent; use crossterm::style::Stylize; -use euphoxide::api::{Data, Message, MessageId, PacketType, SessionId}; -use euphoxide::bot::instance::{Event, ServerConfig}; -use euphoxide::conn::{self, Joined, Joining, SessionInfo}; +use euphoxide::{ + api::{Data, Message, MessageId, PacketType, SessionId}, + bot::instance::{Event, ServerConfig}, + conn::{self, Joined, Joining, SessionInfo}, +}; use jiff::tz::TimeZone; -use tokio::sync::oneshot::error::TryRecvError; -use tokio::sync::{mpsc, oneshot}; -use toss::widgets::{BoxedAsync, EditorState, Join2, Layer, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use tokio::sync::{ + mpsc, + oneshot::{self, error::TryRecvError}, +}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{BoxedAsync, EditorState, Join2, Layer, Text}, +}; -use crate::euph; -use crate::macros::logging_unwrap; -use crate::ui::chat::{ChatState, Reaction}; -use crate::ui::widgets::ListState; -use crate::ui::{UiError, UiEvent, util}; -use crate::vault::EuphRoomVault; +use crate::{ + euph, + macros::logging_unwrap, + ui::{ + UiError, UiEvent, + chat::{ChatState, Reaction}, + util, + widgets::ListState, + }, + vault::EuphRoomVault, +}; -use super::account::AccountUiState; -use super::links::LinksState; -use super::popup::{PopupResult, RoomPopup}; -use super::{auth, inspect, nick, nick_list}; +use super::{ + account::AccountUiState, + auth, inspect, + links::LinksState, + nick, nick_list, + popup::{PopupResult, RoomPopup}, +}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Focus { diff --git a/cove/src/ui/key_bindings.rs b/cove/src/ui/key_bindings.rs index de3c889..daedc16 100644 --- a/cove/src/ui/key_bindings.rs +++ b/cove/src/ui/key_bindings.rs @@ -5,11 +5,15 @@ use std::convert::Infallible; use cove_config::{Config, Keys}; use cove_input::{InputEvent, KeyBinding, KeyBindingInfo, KeyGroupInfo}; use crossterm::style::Stylize; -use toss::widgets::{Either2, Join2, Padding, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{Either2, Join2, Padding, Text}, +}; -use super::widgets::{ListBuilder, ListState, Popup}; -use super::{UiError, util}; +use super::{ + UiError, util, + widgets::{ListBuilder, ListState, Popup}, +}; type Line = Either2, Text>>; type Builder = ListBuilder<'static, Infallible, Line>; diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index f26defa..a6e7b34 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -1,34 +1,46 @@ -mod connect; -mod delete; - -use std::collections::hash_map::Entry; -use std::collections::{HashMap, HashSet}; -use std::iter; -use std::sync::{Arc, Mutex}; -use std::time::Duration; +use std::{ + collections::{HashMap, HashSet, hash_map::Entry}, + iter, + sync::{Arc, Mutex}, + time::Duration, +}; use cove_config::{Config, Keys, RoomsSortOrder}; use cove_input::InputEvent; use crossterm::style::Stylize; -use euphoxide::api::SessionType; -use euphoxide::bot::instance::{Event, ServerConfig}; -use euphoxide::conn::{self, Joined}; +use euphoxide::{ + api::SessionType, + bot::instance::{Event, ServerConfig}, + conn::{self, Joined}, +}; use jiff::tz::TimeZone; use tokio::sync::mpsc; -use toss::widgets::{BoxedAsync, Empty, Join2, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{BoxedAsync, Empty, Join2, Text}, +}; -use crate::euph; -use crate::macros::logging_unwrap; -use crate::vault::{EuphVault, RoomIdentifier, Vault}; -use crate::version::{NAME, VERSION}; +use crate::{ + euph, + macros::logging_unwrap, + vault::{EuphVault, RoomIdentifier, Vault}, + version::{NAME, VERSION}, +}; -use self::connect::{ConnectResult, ConnectState}; -use self::delete::{DeleteResult, DeleteState}; +use super::{ + UiError, UiEvent, + euph::room::EuphRoom, + key_bindings, util, + widgets::{ListBuilder, ListState}, +}; -use super::euph::room::EuphRoom; -use super::widgets::{ListBuilder, ListState}; -use super::{UiError, UiEvent, key_bindings, util}; +use self::{ + connect::{ConnectResult, ConnectState}, + delete::{DeleteResult, DeleteState}, +}; + +mod connect; +mod delete; enum State { ShowList, diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs index 4ad3c39..ce53775 100644 --- a/cove/src/ui/rooms/connect.rs +++ b/cove/src/ui/rooms/connect.rs @@ -1,12 +1,15 @@ use cove_config::Keys; use cove_input::InputEvent; use crossterm::style::Stylize; -use toss::widgets::{EditorState, Empty, Join2, Join3, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{EditorState, Empty, Join2, Join3, Text}, +}; -use crate::ui::widgets::Popup; -use crate::ui::{UiError, util}; -use crate::vault::RoomIdentifier; +use crate::{ + ui::{UiError, util, widgets::Popup}, + vault::RoomIdentifier, +}; #[derive(Clone, Copy, PartialEq, Eq)] enum Focus { diff --git a/cove/src/ui/rooms/delete.rs b/cove/src/ui/rooms/delete.rs index d5b6884..aafaad8 100644 --- a/cove/src/ui/rooms/delete.rs +++ b/cove/src/ui/rooms/delete.rs @@ -1,12 +1,15 @@ use cove_config::Keys; use cove_input::InputEvent; use crossterm::style::Stylize; -use toss::widgets::{EditorState, Empty, Join2, Text}; -use toss::{Style, Styled, Widget, WidgetExt}; +use toss::{ + Style, Styled, Widget, WidgetExt, + widgets::{EditorState, Empty, Join2, Text}, +}; -use crate::ui::widgets::Popup; -use crate::ui::{UiError, util}; -use crate::vault::RoomIdentifier; +use crate::{ + ui::{UiError, util, widgets::Popup}, + vault::RoomIdentifier, +}; pub struct DeleteState { id: RoomIdentifier, diff --git a/cove/src/ui/widgets.rs b/cove/src/ui/widgets.rs index aed063a..c00d26e 100644 --- a/cove/src/ui/widgets.rs +++ b/cove/src/ui/widgets.rs @@ -1,5 +1,5 @@ -mod list; -mod popup; - pub use self::list::*; pub use self::popup::*; + +mod list; +mod popup; diff --git a/cove/src/ui/widgets/popup.rs b/cove/src/ui/widgets/popup.rs index 40b41cb..559e283 100644 --- a/cove/src/ui/widgets/popup.rs +++ b/cove/src/ui/widgets/popup.rs @@ -1,5 +1,7 @@ -use toss::widgets::{Background, Border, Desync, Float, Layer2, Padding, Text}; -use toss::{Frame, Size, Style, Styled, Widget, WidgetExt, WidthDb}; +use toss::{ + Frame, Size, Style, Styled, Widget, WidgetExt, WidthDb, + widgets::{Background, Border, Desync, Float, Layer2, Padding, Text}, +}; type Body = Background>>; type Title = Float>>>; diff --git a/cove/src/util.rs b/cove/src/util.rs index ff8a05a..c6a572c 100644 --- a/cove/src/util.rs +++ b/cove/src/util.rs @@ -1,5 +1,4 @@ -use std::convert::Infallible; -use std::env; +use std::{convert::Infallible, env}; use jiff::tz::TimeZone; diff --git a/cove/src/vault.rs b/cove/src/vault.rs index 512dfd2..05bd1a5 100644 --- a/cove/src/vault.rs +++ b/cove/src/vault.rs @@ -1,16 +1,14 @@ +use std::{fs, path::Path}; + +use rusqlite::Connection; +use vault::{Action, tokio::TokioVault}; + +pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; + mod euph; mod migrate; mod prepare; -use std::fs; -use std::path::Path; - -use rusqlite::Connection; -use vault::Action; -use vault::tokio::TokioVault; - -pub use self::euph::{EuphRoomVault, EuphVault, RoomIdentifier}; - #[derive(Debug, Clone)] pub struct Vault { tokio_vault: TokioVault, diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 3e98590..931091c 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -1,15 +1,18 @@ -use std::str::FromStr; -use std::{fmt, mem}; +use std::{fmt, mem, str::FromStr}; use async_trait::async_trait; use cookie::{Cookie, CookieJar}; use euphoxide::api::{Message, MessageId, SessionId, SessionView, Snowflake, Time, UserId}; -use rusqlite::types::{FromSql, FromSqlError, ToSqlOutput, Value, ValueRef}; -use rusqlite::{Connection, OptionalExtension, Row, ToSql, Transaction, named_params, params}; +use rusqlite::{ + Connection, OptionalExtension, Row, ToSql, Transaction, named_params, params, + types::{FromSql, FromSqlError, ToSqlOutput, Value, ValueRef}, +}; use vault::Action; -use crate::euph::SmallMessage; -use crate::store::{MsgStore, Path, Tree}; +use crate::{ + euph::SmallMessage, + store::{MsgStore, Path, Tree}, +}; /// Wrapper for [`Snowflake`] that implements useful rusqlite traits. struct WSnowflake(Snowflake); From d29e3e6651cf3a62c419c324a225e6202ffebfcf Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 13:24:04 +0100 Subject: [PATCH 073/109] Set up GitHub CI --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f02d5dd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +# What software is installed by default: +# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources + +name: build + +on: + push: + pull_request: + +defaults: + run: + shell: bash + +jobs: + build: + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + - macos-latest + - macos-13 + runs-on: ${{ matrix.os }} + steps: + - name: Check out repo + uses: actions/checkout@v4 + + - name: Set up rust + run: rustup update + + - name: Build + run: cargo build --release + + - name: Record target triple + run: rustc -vV | awk '/^host/ { print $2 }' > target/release/host + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: cove-${{ matrix.os }} + path: | + target/release/cove + target/release/cove.exe + target/release/host + + release: + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + needs: + - build + permissions: + contents: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + + - name: Zip artifacts + run: | + chmod +x cove-ubuntu-latest/cove + chmod +x cove-windows-latest/cove.exe + chmod +x cove-macos-latest/cove + chmod +x cove-macos-13/cove + zip -jr "cove-$(cat cove-ubuntu-latest/host).zip" cove-ubuntu-latest/cove + zip -jr "cove-$(cat cove-windows-latest/host).zip" cove-windows-latest/cove.exe + zip -jr "cove-$(cat cove-macos-latest/host).zip" cove-macos-latest/cove + zip -jr "cove-$(cat cove-macos-13/host).zip" cove-macos-13/cove + + - name: Create new release + uses: softprops/action-gh-release@v2 + with: + body: Automated release, see [CHANGELOG.md](CHANGELOG.md) for more details. + files: "*.zip" From 6c884f3077e9f951c63b58fcbf6864f3065f6036 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 21 Feb 2025 19:15:33 +0100 Subject: [PATCH 074/109] Update RPIT lifetime bounds for the 2024 edition When the bound matches the implicit bound, i.e. when you'd just write impl ... + use<'_> then it can be omitted. My gut instinct is to always write the bound explicitly, but maybe that'll harm readability once I'm more used to how bounds work now. Anyways, always try to keep the bound as small as possible, ideally just impl ... + use<> --- cove/src/ui/euph/account.rs | 4 ++-- cove/src/ui/euph/auth.rs | 2 +- cove/src/ui/euph/links.rs | 2 +- cove/src/ui/euph/nick.rs | 2 +- cove/src/ui/rooms/connect.rs | 2 +- cove/src/ui/rooms/delete.rs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cove/src/ui/euph/account.rs b/cove/src/ui/euph/account.rs index 48731d9..7aa776f 100644 --- a/cove/src/ui/euph/account.rs +++ b/cove/src/ui/euph/account.rs @@ -35,7 +35,7 @@ impl LoggedOut { } } - fn widget(&mut self) -> impl Widget + '_ { + fn widget(&mut self) -> impl Widget { let bold = Style::new().bold(); Join4::vertical( Text::new(("Not logged in", bold.yellow())).segment(), @@ -111,7 +111,7 @@ impl AccountUiState { } } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let inner = match self { Self::LoggedOut(logged_out) => logged_out.widget().first2(), Self::LoggedIn(logged_in) => logged_in.widget().second2(), diff --git a/cove/src/ui/euph/auth.rs b/cove/src/ui/euph/auth.rs index 259e204..15f8fe1 100644 --- a/cove/src/ui/euph/auth.rs +++ b/cove/src/ui/euph/auth.rs @@ -13,7 +13,7 @@ pub fn new() -> EditorState { EditorState::new() } -pub fn widget(editor: &mut EditorState) -> impl Widget + '_ { +pub fn widget(editor: &mut EditorState) -> impl Widget { Popup::new( editor.widget().with_hidden_default_placeholder(), "Enter password", diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index 14496a6..a452669 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -38,7 +38,7 @@ impl LinksState { } } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let style_selected = Style::new().black().on_white(); let mut list_builder = ListBuilder::new(); diff --git a/cove/src/ui/euph/nick.rs b/cove/src/ui/euph/nick.rs index 1940fac..707e992 100644 --- a/cove/src/ui/euph/nick.rs +++ b/cove/src/ui/euph/nick.rs @@ -14,7 +14,7 @@ pub fn new(joined: Joined) -> EditorState { EditorState::with_initial_text(joined.session.name) } -pub fn widget(editor: &mut EditorState) -> impl Widget + '_ { +pub fn widget(editor: &mut EditorState) -> impl Widget { let inner = editor .widget() .with_highlight(|s| euph::style_nick_exact(s, Style::new())); diff --git a/cove/src/ui/rooms/connect.rs b/cove/src/ui/rooms/connect.rs index ce53775..83a359e 100644 --- a/cove/src/ui/rooms/connect.rs +++ b/cove/src/ui/rooms/connect.rs @@ -84,7 +84,7 @@ impl ConnectState { ConnectResult::Unhandled } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let room_style = Style::new().bold().blue(); let domain_style = Style::new().grey(); diff --git a/cove/src/ui/rooms/delete.rs b/cove/src/ui/rooms/delete.rs index aafaad8..baa96b1 100644 --- a/cove/src/ui/rooms/delete.rs +++ b/cove/src/ui/rooms/delete.rs @@ -47,7 +47,7 @@ impl DeleteState { DeleteResult::Unhandled } - pub fn widget(&mut self) -> impl Widget + '_ { + pub fn widget(&mut self) -> impl Widget { let warn_style = Style::new().bold().red(); let room_style = Style::new().bold().blue(); let text = Styled::new_plain("Are you sure you want to delete ") From bf11e055b6fff0e51f2c5f71d3b9e0ae2db26782 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 12:33:59 +0100 Subject: [PATCH 075/109] Reformat changelog There should always be space around headlines and lists in markdown documents. --- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6864032..f365f7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Procedure when bumping the version number: + 1. Update dependencies and flake in a separate commit 2. Set version number in `Cargo.toml` 3. Add new section in this changelog @@ -16,20 +17,24 @@ Procedure when bumping the version number: ## Unreleased ### Updated + - Documentation for `time_zone` config option ## v0.8.3 - 2024-05-20 ### Changed + - Updated list of emoji names ## v0.8.2 - 2024-04-25 ### Changed + - Renamed `json-stream` export format to `json-lines` (see ) - Changed `json-lines` file extension from `.json` to `.jsonl` ### Fixed + - Crash when window is too small while empty message editor is visible - Mistakes in output and docs - Cove not cleaning up terminal state properly @@ -37,16 +42,19 @@ Procedure when bumping the version number: ## v0.8.1 - 2024-01-11 ### Added + - Support for setting window title - More information to room list heading - Key bindings for live caesar cipher de- and encoding ### Removed + - Key binding to open present page ## v0.8.0 - 2024-01-04 ### Added + - Support for multiple euph server domains - Support for `TZ` environment variable - `time_zone` config option @@ -56,6 +64,7 @@ Procedure when bumping the version number: - Welcome info box next to room list ### Changed + - The default euph domain is now https://euphoria.leet.nu/ everywhere - The config file format was changed to support multiple euph servers with different domains. Options previously located at `euph.rooms.*` should be reviewed and moved to `euph.servers."euphoria.leet.nu".rooms.*`. @@ -64,17 +73,20 @@ Procedure when bumping the version number: - Reduced connection timeout from 30 seconds to 10 seconds ### Fixed + - Room deletion popup accepting any room name - Duplicated key presses on Windows ## v0.7.1 - 2023-08-31 ### Changed + - Updated dependencies ## v0.7.0 - 2023-05-14 ### Added + - Auto-generated config documentation - in [CONFIG.md](CONFIG.md) - via `help-config` CLI command @@ -82,6 +94,7 @@ Procedure when bumping the version number: - `measure_widths` config option ### Changed + - Overhauled widget system and extracted generic widgets to [toss](https://github.com/Garmelon/toss) - Overhauled config system to support auto-generating documentation - Overhauled key binding system to make key bindings configurable @@ -95,15 +108,18 @@ Procedure when bumping the version number: ## v0.6.1 - 2023-04-10 ### Changed + - Improved JSON export performance - Always show rooms from config file in room list ### Fixed + - Rooms reconnecting instead of showing error popups ## v0.6.0 - 2023-04-04 ### Added + - Emoji support - `flake.nix`, making cove available as a nix flake - `json-stream` room export format @@ -111,31 +127,37 @@ Procedure when bumping the version number: - `--verbose` flag ### Changed + - Non-export info is now printed to stderr instead of stdout - Recognizes links without scheme (e.g. `euphoria.io` instead of `https://euphoria.io`) - Rooms waiting for reconnect are no longer sorted to bottom in default sort order ### Fixed + - Mentions not being stopped by `>` ## v0.5.2 - 2023-01-14 ### Added + - Key binding to open present page ### Changed + - Always connect to &rl2dev in ephemeral mode - Reduce amount of messages per &rl2dev log request ## v0.5.1 - 2022-11-27 ### Changed + - Increase reconnect delay to one minute - Print errors that occurred while cove was running more compactly ## v0.5.0 - 2022-09-26 ### Added + - Key bindings to navigate nick list - Room deletion confirmation popup - Message inspection popup @@ -144,10 +166,12 @@ Procedure when bumping the version number: - `rooms_sort_order` config option ### Changed + - Use nick changes to detect sessions for nick list - Support Unicode 15 ### Fixed + - Cursor being visible through popups - Cursor in lists when highlighted item moves off-screen - User disappearing from nick list when only one of their sessions disconnects @@ -155,6 +179,7 @@ Procedure when bumping the version number: ## v0.4.0 - 2022-09-01 ### Added + - Config file and `--config` cli option - `data_dir` config option - `ephemeral` config option @@ -170,14 +195,17 @@ Procedure when bumping the version number: - Key bindings to view and open links in a message ### Changed + - Some key bindings in the rooms list ### Fixed + - Rooms being stuck in "Connecting" state ## v0.3.0 - 2022-08-22 ### Added + - Account login and logout - Authentication dialog for password-protected rooms - Error popups in rooms when something goes wrong @@ -185,10 +213,12 @@ Procedure when bumping the version number: - Key binding to download more logs ### Changed + - Reduced amount of unnecessary redraws - Description of `export` CLI command ### Fixed + - Crash when connecting to nonexistent rooms - Crash when connecting to rooms that require authentication - Pasting multi-line strings into the editor @@ -196,15 +226,18 @@ Procedure when bumping the version number: ## v0.2.1 - 2022-08-11 ### Added + - Support for modifiers on special keys via the [kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) ### Fixed + - Joining new rooms no longer crashes cove - Scrolling when exiting message editor ## v0.2.0 - 2022-08-10 ### Added + - New messages are now marked as unseen - Sub-trees can now be folded - Support for pasting text into editors @@ -217,10 +250,12 @@ Procedure when bumping the version number: - Support for exporting multiple/all rooms at once ### Changed + - Reorganized export command - Slowed down room history download speed ### Fixed + - Chat rendering when deleting and re-joining a room - Spacing in some popups From 866176dab64fc2a08b393dcc33076d05da38eafa Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 12:30:38 +0100 Subject: [PATCH 076/109] Move cursor to new room in room list --- CHANGELOG.md | 1 + cove/src/ui/rooms.rs | 1 + cove/src/ui/widgets/list.rs | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f365f7b..fb950a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Procedure when bumping the version number: ### Updated - Documentation for `time_zone` config option +- When connecting to a room using `n` in the room list, the cursor now moves to that room ## v0.8.3 - 2024-05-20 diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index a6e7b34..04bce02 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -589,6 +589,7 @@ impl Rooms { return true; } ConnectResult::Connect(room) => { + self.list.move_cursor_to_id(&room); self.connect_to_room(room.clone()).await; self.state = State::ShowRoom(room); return true; diff --git a/cove/src/ui/widgets/list.rs b/cove/src/ui/widgets/list.rs index bb27540..3d7c6c8 100644 --- a/cove/src/ui/widgets/list.rs +++ b/cove/src/ui/widgets/list.rs @@ -239,6 +239,12 @@ impl ListState { }) } + pub fn move_cursor_to_id(&mut self, id: &Id) { + if let Some(new_cursor) = self.selectable_of_id(id) { + self.move_cursor_to(new_cursor); + } + } + fn fix_cursor(&mut self) { let new_cursor = if let Some(cursor) = &self.cursor { self.selectable_of_id(&cursor.id) From e750f81b11395843da3ee0e44b477dfd9d1e67bb Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 16:42:26 +0100 Subject: [PATCH 077/109] Drop once_cell dependency It's now part of the standard library :D --- Cargo.lock | 1 - Cargo.toml | 1 - cove/Cargo.toml | 1 - cove/src/euph/util.rs | 5 +++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e77a3ad..6b262c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,7 +344,6 @@ dependencies = [ "jiff", "linkify", "log", - "once_cell", "open", "parking_lot", "rusqlite", diff --git a/Cargo.toml b/Cargo.toml index a58b43d..93e13c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ edit = "0.1.5" jiff = "0.2.1" linkify = "0.10.0" log = { version = "0.4.25", features = ["std"] } -once_cell = "1.20.2" open = "5.3.2" parking_lot = "0.12.3" proc-macro2 = "1.0.93" diff --git a/cove/Cargo.toml b/cove/Cargo.toml index 0ca2a2f..3a60a5d 100644 --- a/cove/Cargo.toml +++ b/cove/Cargo.toml @@ -17,7 +17,6 @@ euphoxide.workspace = true jiff.workspace = true linkify.workspace = true log.workspace = true -once_cell.workspace = true open.workspace = true parking_lot.workspace = true rusqlite.workspace = true diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index fdf11a3..aff2192 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -1,9 +1,10 @@ +use std::sync::LazyLock; + use crossterm::style::{Color, Stylize}; use euphoxide::Emoji; -use once_cell::sync::Lazy; use toss::{Style, Styled}; -pub static EMOJI: Lazy = Lazy::new(Emoji::load); +pub static EMOJI: LazyLock = LazyLock::new(Emoji::load); /// Convert HSL to RGB following [this approach from wikipedia][1]. /// From 2fa1bec421ec9c9f621cf660bd7684924e6cf206 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 04:24:06 +0100 Subject: [PATCH 078/109] Remove special rl2dev code --- CHANGELOG.md | 4 ++++ cove/src/euph/room.rs | 22 +++------------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb950a5..2335f41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ Procedure when bumping the version number: - Documentation for `time_zone` config option - When connecting to a room using `n` in the room list, the cursor now moves to that room +### Removed + +- Special handling of &rl2dev + ## v0.8.3 - 2024-05-20 ### Changed diff --git a/cove/src/euph/room.rs b/cove/src/euph/room.rs index 17aafe4..a4e29cf 100644 --- a/cove/src/euph/room.rs +++ b/cove/src/euph/room.rs @@ -1,5 +1,3 @@ -// TODO Remove rl2dev-specific code - use std::{convert::Infallible, time::Duration}; use euphoxide::{ @@ -71,20 +69,13 @@ impl Room { where F: Fn(Event) + std::marker::Send + Sync + 'static, { - // &rl2dev's message history is broken and requesting old messages past - // a certain point results in errors. Cove should not keep retrying log - // requests when hitting that limit, so &rl2dev is always opened in - // ephemeral mode. - let is_rl2dev = vault.room().domain == "euphoria.io" && vault.room().name == "rl2dev"; - let ephemeral = vault.vault().vault().ephemeral() || is_rl2dev; - Self { - vault, - ephemeral, + ephemeral: vault.vault().vault().ephemeral(), instance: instance_config.build(on_event), state: State::Disconnected, last_msg_id: None, log_request_canary: None, + vault, } } @@ -192,14 +183,7 @@ impl Room { debug!("{:?}: requesting logs", vault.room()); - // &rl2dev's message history is broken and requesting old messages past - // a certain point results in errors. By reducing the amount of messages - // in each log request, we can get closer to this point. Since &rl2dev - // is fairly low in activity, this should be fine. - let is_rl2dev = vault.room().domain == "euphoria.io" && vault.room().name == "rl2dev"; - let n = if is_rl2dev { 50 } else { 1000 }; - - let _ = conn_tx.send(Log { n, before }).await; + let _ = conn_tx.send(Log { n: 1000, before }).await; // The code handling incoming events and replies also handles // `LogReply`s, so we don't need to do anything special here. } From 900a686d0deab4ce64b1b4a4f78824af8eea0f71 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 04:28:21 +0100 Subject: [PATCH 079/109] Fix changelog heading "Updated" does not conform to Keep a Changelog. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2335f41..a4339bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,9 +16,9 @@ Procedure when bumping the version number: ## Unreleased -### Updated +### Changed -- Documentation for `time_zone` config option +- Updated documentation for `time_zone` config option - When connecting to a room using `n` in the room list, the cursor now moves to that room ### Removed From 17185ea5362c8f9b46f9a12a3e55a51faffc5840 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 18:31:20 +0100 Subject: [PATCH 080/109] Add unicode-based grapheme width estimation method --- CHANGELOG.md | 6 ++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- cove-config/src/lib.rs | 32 +++++++++++++++++++++++++++----- cove/src/main.rs | 21 +++++++++++++++++++++ 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4339bb..433634a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ Procedure when bumping the version number: ## Unreleased +### Added + +- Unicode-based grapheme width estimation method + - `width_estimation_method` config option + - `--width-estimation-method` option + ### Changed - Updated documentation for `time_zone` config option diff --git a/Cargo.lock b/Cargo.lock index 6b262c4..86ebb73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1647,7 +1647,7 @@ dependencies = [ [[package]] name = "toss" version = "0.3.1" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.1#be7eff0979e0e95d070e7c9cea42c328ffd04cc4" +source = "git+https://github.com/Garmelon/toss.git?rev=423dd100c1360decffc5107ea4757d751ac0f4db#423dd100c1360decffc5107ea4757d751ac0f4db" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 93e13c4..f8445e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ features = ["bot"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.3.1" +rev = "423dd100c1360decffc5107ea4757d751ac0f4db" [workspace.dependencies.vault] git = "https://github.com/Garmelon/vault.git" diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 0d350ed..85b418e 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -5,7 +5,7 @@ use std::{ }; use doc::Document; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; pub use crate::{euph::*, keys::*}; @@ -21,6 +21,14 @@ pub enum Error { Toml(#[from] toml::de::Error), } +#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, Document)] +#[serde(rename_all = "snake_case")] +pub enum WidthEstimationMethod { + #[default] + Legacy, + Unicode, +} + #[derive(Debug, Default, Deserialize, Document)] pub struct Config { /// The directory that cove stores its data in when not running in ephemeral @@ -41,12 +49,26 @@ pub struct Config { #[serde(default)] pub ephemeral: bool, - /// Whether to measure the width of characters as displayed by the terminal - /// emulator instead of guessing the width. + /// How to estimate the width of graphemes (i.e. characters) as displayed by + /// the terminal emulator. + /// + /// `"legacy"`: Use a legacy method that should mostly work on most terminal + /// emulators. This method will never be correct in all cases since every + /// terminal emulator handles grapheme widths slightly differently. However, + /// those cases are usually rare (unless you view a lot of emoji). + /// + /// `"unicode"`: Use the unicode standard in a best-effort manner to + /// determine grapheme widths. + /// + /// This method is used when `measure_widths` is set to `false`. + #[serde(default)] + pub width_estimation_method: WidthEstimationMethod, + + /// Whether to measure the width of graphemes (i.e. characters) as displayed + /// by the terminal emulator instead of estimating the width. /// /// Enabling this makes rendering a bit slower but more accurate. The screen - /// might also flash when encountering new characters (or, more accurately, - /// graphemes). + /// might also flash when encountering new graphemes. /// /// See also the `--measure-widths` command line option. #[serde(default)] diff --git a/cove/src/main.rs b/cove/src/main.rs index 642b62e..51bc502 100644 --- a/cove/src/main.rs +++ b/cove/src/main.rs @@ -46,6 +46,12 @@ enum Command { HelpConfig, } +#[derive(Debug, Clone, Copy, clap::ValueEnum)] +enum WidthEstimationMethod { + Legacy, + Unicode, +} + impl Default for Command { fn default() -> Self { Self::Run @@ -79,6 +85,11 @@ struct Args { #[arg(long, short)] offline: bool, + /// Method for estimating the width of characters as displayed by the + /// terminal emulator. + #[arg(long, short)] + width_estimation_method: Option, + /// Measure the width of characters as displayed by the terminal emulator /// instead of guessing the width. #[arg(long, short)] @@ -114,6 +125,12 @@ fn update_config_with_args(config: &mut Config, args: &Args) { } config.ephemeral |= args.ephemeral; + if let Some(method) = args.width_estimation_method { + config.width_estimation_method = match method { + WidthEstimationMethod::Legacy => cove_config::WidthEstimationMethod::Legacy, + WidthEstimationMethod::Unicode => cove_config::WidthEstimationMethod::Unicode, + } + } config.measure_widths |= args.measure_widths; config.offline |= args.offline; } @@ -182,6 +199,10 @@ async fn run( let mut terminal = Terminal::new()?; terminal.set_measuring(config.measure_widths); + terminal.set_width_estimation_method(match config.width_estimation_method { + cove_config::WidthEstimationMethod::Legacy => toss::WidthEstimationMethod::Legacy, + cove_config::WidthEstimationMethod::Unicode => toss::WidthEstimationMethod::Unicode, + }); Ui::run(config, tz, &mut terminal, vault.clone(), logger, logger_rx).await?; drop(terminal); From 8040b82ff15909aa2b6f169b9feb017e00105167 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 20:22:04 +0100 Subject: [PATCH 081/109] Refactor euph message content highlighting --- cove/src/euph.rs | 2 + cove/src/euph/highlight.rs | 203 ++++++++++++++++++++++++++++++++ cove/src/euph/small_message.rs | 206 +-------------------------------- 3 files changed, 210 insertions(+), 201 deletions(-) create mode 100644 cove/src/euph/highlight.rs diff --git a/cove/src/euph.rs b/cove/src/euph.rs index d1fd872..77bf1db 100644 --- a/cove/src/euph.rs +++ b/cove/src/euph.rs @@ -1,7 +1,9 @@ +pub use highlight::*; pub use room::*; pub use small_message::*; pub use util::*; +mod highlight; mod room; mod small_message; mod util; diff --git a/cove/src/euph/highlight.rs b/cove/src/euph/highlight.rs new file mode 100644 index 0000000..e60a302 --- /dev/null +++ b/cove/src/euph/highlight.rs @@ -0,0 +1,203 @@ +use std::ops::Range; + +use crossterm::style::Stylize; +use toss::{Style, Styled}; + +use crate::euph::util; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum SpanType { + Mention, + Room, + Emoji, +} + +fn nick_char(ch: char) -> bool { + // Closely following the heim mention regex: + // https://github.com/euphoria-io/heim/blob/978c921063e6b06012fc8d16d9fbf1b3a0be1191/client/lib/stores/chat.js#L14-L15 + // `>` has been experimentally confirmed to delimit mentions as well. + match ch { + ',' | '.' | '!' | '?' | ';' | '&' | '<' | '>' | '\'' | '"' => false, + _ => !ch.is_whitespace(), + } +} + +fn room_char(ch: char) -> bool { + // Basically just \w, see also + // https://github.com/euphoria-io/heim/blob/978c921063e6b06012fc8d16d9fbf1b3a0be1191/client/lib/ui/MessageText.js#L66 + ch.is_ascii_alphanumeric() || ch == '_' +} + +struct SpanFinder<'a> { + content: &'a str, + + span: Option<(SpanType, usize)>, + room_or_mention_possible: bool, + + result: Vec<(SpanType, Range)>, +} + +impl<'a> SpanFinder<'a> { + fn is_valid_span(&self, span: SpanType, range: Range) -> bool { + let text = &self.content[range.start..range.end]; + match span { + SpanType::Mention => range.len() > 1 && text.starts_with('@'), + SpanType::Room => range.len() > 1 && text.starts_with('&'), + SpanType::Emoji => { + if range.len() <= 2 { + return false; + } + + let Some(name) = Some(text) + .and_then(|it| it.strip_prefix(':')) + .and_then(|it| it.strip_suffix(':')) + else { + return false; + }; + + util::EMOJI.get(name).is_some() + } + } + } + + fn close_span(&mut self, end: usize) { + let Some((span, start)) = self.span else { + return; + }; + if self.is_valid_span(span, start..end) { + self.result.push((span, start..end)); + } + self.span = None; + } + + fn open_span(&mut self, span: SpanType, start: usize) { + self.close_span(start); + self.span = Some((span, start)) + } + + fn step(&mut self, idx: usize, char: char) { + match (char, self.span) { + ('@', _) if self.room_or_mention_possible => self.open_span(SpanType::Mention, idx), + ('&', _) if self.room_or_mention_possible => self.open_span(SpanType::Room, idx), + (':', None) => self.open_span(SpanType::Emoji, idx), + (':', Some((SpanType::Emoji, _))) => self.close_span(idx + 1), + (c, Some((SpanType::Mention, _))) if !nick_char(c) => self.close_span(idx), + (c, Some((SpanType::Room, _))) if !room_char(c) => self.close_span(idx), + _ => {} + } + + // More permissive than the heim web client + self.room_or_mention_possible = !char.is_alphanumeric(); + } + + fn find(content: &'a str) -> Vec<(SpanType, Range)> { + let mut this = Self { + content, + span: None, + room_or_mention_possible: true, + result: vec![], + }; + + for (idx, char) in content.char_indices() { + this.step(idx, char); + } + + this.close_span(content.len()); + + this.result + } +} + +pub fn find_spans(content: &str) -> Vec<(SpanType, Range)> { + SpanFinder::find(content) +} + +/// Highlight spans in a string. +/// +/// The list of spans must be non-overlapping and in ascending order. +/// +/// If `exact` is specified, colon-delimited emoji are not replaced with their +/// unicode counterparts. +pub fn apply_spans( + content: &str, + spans: &[(SpanType, Range)], + base: Style, + exact: bool, +) -> Styled { + let mut result = Styled::default(); + let mut i = 0; + + for (span, range) in spans { + assert!(i <= range.start); + assert!(range.end <= content.len()); + + if i < range.start { + result = result.then_plain(&content[i..range.start]); + } + + let text = &content[range.start..range.end]; + result = match span { + SpanType::Mention if exact => result.and_then(util::style_nick_exact(text, base)), + SpanType::Mention => result.and_then(util::style_nick(text, base)), + SpanType::Room => result.then(text, base.blue().bold()), + SpanType::Emoji if exact => result.then(text, base.magenta()), + SpanType::Emoji => { + let name = text.strip_prefix(':').unwrap_or(text); + let name = name.strip_suffix(':').unwrap_or(name); + if let Some(Some(replacement)) = util::EMOJI.get(name) { + result.then_plain(replacement) + } else { + result.then(name, base.magenta()) + } + } + }; + + i = range.end; + } + + if i < content.len() { + result = result.then_plain(&content[i..]); + } + + result +} + +/// Highlight an euphoria message's content. +/// +/// If `exact` is specified, colon-delimited emoji are not replaced with their +/// unicode counterparts. +pub fn highlight(content: &str, base: Style, exact: bool) -> Styled { + apply_spans(content, &find_spans(content), base, exact) +} + +#[cfg(test)] +mod tests { + + use crate::euph::SpanType; + + use super::find_spans; + + #[test] + fn mentions() { + assert_eq!(find_spans("@foo"), vec![(SpanType::Mention, 0..4)]); + assert_eq!(find_spans("a @foo b"), vec![(SpanType::Mention, 2..6)]); + assert_eq!(find_spans("@@foo@"), vec![(SpanType::Mention, 1..6)]); + assert_eq!(find_spans("a @b@c d"), vec![(SpanType::Mention, 2..6)]); + assert_eq!( + find_spans("a @b @c d"), + vec![(SpanType::Mention, 2..4), (SpanType::Mention, 5..7)] + ); + } + + #[test] + fn rooms() { + assert_eq!(find_spans("&foo"), vec![(SpanType::Room, 0..4)]); + assert_eq!(find_spans("a &foo b"), vec![(SpanType::Room, 2..6)]); + assert_eq!(find_spans("&&foo&"), vec![(SpanType::Room, 1..5)]); + assert_eq!(find_spans("a &b&c d"), vec![(SpanType::Room, 2..4)]); + assert_eq!( + find_spans("a &b &c d"), + vec![(SpanType::Room, 2..4), (SpanType::Room, 5..7)] + ); + } +} diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 20596fa..003cd40 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -1,5 +1,3 @@ -use std::mem; - use crossterm::style::Stylize; use euphoxide::api::{MessageId, Snowflake, Time}; use jiff::Timestamp; @@ -7,200 +5,6 @@ use toss::{Style, Styled}; use crate::{store::Msg, ui::ChatMsg}; -use super::util; - -fn nick_char(ch: char) -> bool { - // Closely following the heim mention regex: - // https://github.com/euphoria-io/heim/blob/978c921063e6b06012fc8d16d9fbf1b3a0be1191/client/lib/stores/chat.js#L14-L15 - // `>` has been experimentally confirmed to delimit mentions as well. - match ch { - ',' | '.' | '!' | '?' | ';' | '&' | '<' | '>' | '\'' | '"' => false, - _ => !ch.is_whitespace(), - } -} - -fn room_char(ch: char) -> bool { - // Basically just \w, see also - // https://github.com/euphoria-io/heim/blob/978c921063e6b06012fc8d16d9fbf1b3a0be1191/client/lib/ui/MessageText.js#L66 - ch.is_ascii_alphanumeric() || ch == '_' -} - -enum Span { - Nothing, - Mention, - Room, - Emoji, -} - -struct Highlighter<'a> { - content: &'a str, - base_style: Style, - exact: bool, - - span: Span, - span_start: usize, - room_or_mention_possible: bool, - - result: Styled, -} - -impl<'a> Highlighter<'a> { - /// Does *not* guarantee `self.span_start == idx` after running! - fn close_mention(&mut self, idx: usize) { - let span_length = idx.saturating_sub(self.span_start); - if span_length <= 1 { - // We can repurpose the current span - self.span = Span::Nothing; - return; - } - - let text = &self.content[self.span_start..idx]; // Includes @ - self.result = mem::take(&mut self.result).and_then(if self.exact { - util::style_nick_exact(text, self.base_style) - } else { - util::style_nick(text, self.base_style) - }); - - self.span = Span::Nothing; - self.span_start = idx; - } - - /// Does *not* guarantee `self.span_start == idx` after running! - fn close_room(&mut self, idx: usize) { - let span_length = idx.saturating_sub(self.span_start); - if span_length <= 1 { - // We can repurpose the current span - self.span = Span::Nothing; - return; - } - - self.result = mem::take(&mut self.result).then( - &self.content[self.span_start..idx], - self.base_style.blue().bold(), - ); - - self.span = Span::Nothing; - self.span_start = idx; - } - - // Warning: `idx` is the index of the closing colon. - fn close_emoji(&mut self, idx: usize) { - let name = &self.content[self.span_start + 1..idx]; - if let Some(replace) = util::EMOJI.get(name) { - match replace { - Some(replace) if !self.exact => { - self.result = mem::take(&mut self.result).then(replace, self.base_style); - } - _ => { - let text = &self.content[self.span_start..=idx]; - let style = self.base_style.magenta(); - self.result = mem::take(&mut self.result).then(text, style); - } - } - - self.span = Span::Nothing; - self.span_start = idx + 1; - } else { - self.close_plain(idx); - self.span = Span::Emoji; - } - } - - /// Guarantees `self.span_start == idx` after running. - fn close_plain(&mut self, idx: usize) { - if self.span_start == idx { - // Span has length 0 - return; - } - - self.result = - mem::take(&mut self.result).then(&self.content[self.span_start..idx], self.base_style); - - self.span = Span::Nothing; - self.span_start = idx; - } - - fn close_span_before_current_char(&mut self, idx: usize, char: char) { - match self.span { - Span::Mention if !nick_char(char) => self.close_mention(idx), - Span::Room if !room_char(char) => self.close_room(idx), - Span::Emoji if char == '&' || char == '@' => { - self.span = Span::Nothing; - } - _ => {} - } - } - - fn update_span_with_current_char(&mut self, idx: usize, char: char) { - match self.span { - Span::Nothing if char == '@' && self.room_or_mention_possible => { - self.close_plain(idx); - self.span = Span::Mention; - } - Span::Nothing if char == '&' && self.room_or_mention_possible => { - self.close_plain(idx); - self.span = Span::Room; - } - Span::Nothing if char == ':' => { - self.close_plain(idx); - self.span = Span::Emoji; - } - Span::Emoji if char == ':' => self.close_emoji(idx), - _ => {} - } - } - - fn close_final_span(&mut self) { - let idx = self.content.len(); - if self.span_start >= idx { - return; // Span has no contents - } - - match self.span { - Span::Mention => self.close_mention(idx), - Span::Room => self.close_room(idx), - _ => {} - } - - self.close_plain(idx); - } - - fn step(&mut self, idx: usize, char: char) { - if self.span_start < idx { - self.close_span_before_current_char(idx, char); - } - - self.update_span_with_current_char(idx, char); - - // More permissive than the heim web client - self.room_or_mention_possible = !char.is_alphanumeric(); - } - - fn highlight(content: &'a str, base_style: Style, exact: bool) -> Styled { - let mut this = Self { - content: if exact { content } else { content.trim() }, - base_style, - exact, - span: Span::Nothing, - span_start: 0, - room_or_mention_possible: true, - result: Styled::default(), - }; - - for (idx, char) in (if exact { content } else { content.trim() }).char_indices() { - this.step(idx, char); - } - - this.close_final_span(); - - this.result - } -} - -fn highlight_content(content: &str, base_style: Style, exact: bool) -> Styled { - Highlighter::highlight(content, base_style, exact) -} - #[derive(Debug, Clone)] pub struct SmallMessage { pub id: MessageId, @@ -221,22 +25,22 @@ fn style_me() -> Style { fn styled_nick(nick: &str) -> Styled { Styled::new_plain("[") - .and_then(util::style_nick(nick, Style::new())) + .and_then(super::style_nick(nick, Style::new())) .then_plain("]") } fn styled_nick_me(nick: &str) -> Styled { let style = style_me(); - Styled::new("*", style).and_then(util::style_nick(nick, style)) + Styled::new("*", style).and_then(super::style_nick(nick, style)) } fn styled_content(content: &str) -> Styled { - highlight_content(content.trim(), Style::new(), false) + super::highlight(content.trim(), Style::new(), false) } fn styled_content_me(content: &str) -> Styled { let style = style_me(); - highlight_content(content.trim(), style, false).then("*", style) + super::highlight(content.trim(), style, false).then("*", style) } fn styled_editor_content(content: &str) -> Styled { @@ -245,7 +49,7 @@ fn styled_editor_content(content: &str) -> Styled { } else { Style::new() }; - highlight_content(content, style, true) + super::highlight(content, style, true) } impl Msg for SmallMessage { From bf9a9d640ba7a15d37dc906bfabbb21b4e316629 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 21:32:44 +0100 Subject: [PATCH 082/109] Navigate to rooms using message links list --- CHANGELOG.md | 1 + cove/src/ui/euph/links.rs | 117 +++++++++++++++++++++++++------------- cove/src/ui/euph/popup.rs | 1 + cove/src/ui/euph/room.rs | 43 +++++++++++--- cove/src/ui/rooms.rs | 13 ++++- 5 files changed, 123 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 433634a..f75a3d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Procedure when bumping the version number: - Unicode-based grapheme width estimation method - `width_estimation_method` config option - `--width-estimation-method` option +- Room links are now included in the `I` message links list ### Changed diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index a452669..20e2219 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -7,16 +7,25 @@ use toss::{ widgets::{Join2, Text}, }; -use crate::ui::{ - UiError, key_bindings, util, - widgets::{ListBuilder, ListState, Popup}, +use crate::{ + euph::{self, SpanType}, + ui::{ + UiError, key_bindings, util, + widgets::{ListBuilder, ListState, Popup}, + }, }; use super::popup::PopupResult; +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +enum Link { + Url(String), + Room(String), +} + pub struct LinksState { config: &'static Config, - links: Vec, + links: Vec, list: ListState, } @@ -24,12 +33,34 @@ const NUMBER_KEYS: [char; 10] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0 impl LinksState { pub fn new(config: &'static Config, content: &str) -> Self { - let links = LinkFinder::new() + let mut links = vec![]; + + // Collect URL-like links + for link in LinkFinder::new() .url_must_have_scheme(false) .kinds(&[LinkKind::Url]) .links(content) - .map(|l| l.as_str().to_string()) - .collect(); + { + links.push(( + link.start(), + link.end(), + Link::Url(link.as_str().to_string()), + )); + } + + // Collect room links + for (span, range) in euph::find_spans(content) { + if span == SpanType::Room { + let name = &content[range.start + 1..range.end]; + links.push((range.start, range.end, Link::Room(name.to_string()))); + } + } + + links.sort(); + let links = links + .into_iter() + .map(|(_, _, link)| link) + .collect::>(); Self { config, @@ -49,29 +80,29 @@ impl LinksState { for (id, link) in self.links.iter().enumerate() { let link = link.clone(); - if let Some(&number_key) = NUMBER_KEYS.get(id) { - list_builder.add_sel(id, move |selected| { - let text = if selected { - Styled::new(format!("[{number_key}]"), style_selected.bold()) - .then(" ", style_selected) - .then(link, style_selected) - } else { - Styled::new(format!("[{number_key}]"), Style::new().dark_grey().bold()) - .then_plain(" ") - .then_plain(link) - }; - Text::new(text) - }); - } else { - list_builder.add_sel(id, move |selected| { - let text = if selected { - Styled::new(format!(" {link}"), style_selected) - } else { - Styled::new_plain(format!(" {link}")) - }; - Text::new(text) - }); - } + list_builder.add_sel(id, move |selected| { + let mut text = Styled::default(); + + // Number key indicator + text = match NUMBER_KEYS.get(id) { + None if selected => text.then(" ", style_selected), + None => text.then_plain(" "), + Some(key) if selected => text.then(format!("[{key}] "), style_selected.bold()), + Some(key) => text.then(format!("[{key}] "), Style::new().dark_grey().bold()), + }; + + // The link itself + text = match link { + Link::Url(url) if selected => text.then(url, style_selected), + Link::Url(url) => text.then_plain(url), + Link::Room(name) if selected => { + text.then(format!("&{name}"), style_selected.bold()) + } + Link::Room(name) => text.then(format!("&{name}"), Style::new().blue().bold()), + }; + + Text::new(text) + }); } let hint_style = Style::new().grey().italic(); @@ -95,18 +126,24 @@ impl LinksState { } fn open_link_by_id(&self, id: usize) -> PopupResult { - if let Some(link) = self.links.get(id) { - // The `http://` or `https://` schema is necessary for open::that to - // successfully open the link in the browser. - let link = if link.starts_with("http://") || link.starts_with("https://") { - link.clone() - } else { - format!("https://{link}") - }; + match self.links.get(id) { + Some(Link::Url(url)) => { + // The `http://` or `https://` schema is necessary for + // open::that to successfully open the link in the browser. + let link = if url.starts_with("http://") || url.starts_with("https://") { + url.clone() + } else { + format!("https://{url}") + }; - if let Err(error) = open::that(&link) { - return PopupResult::ErrorOpeningLink { link, error }; + if let Err(error) = open::that(&link) { + return PopupResult::ErrorOpeningLink { link, error }; + } } + + Some(Link::Room(name)) => return PopupResult::SwitchToRoom { name: name.clone() }, + + _ => {} } PopupResult::Handled } diff --git a/cove/src/ui/euph/popup.rs b/cove/src/ui/euph/popup.rs index 3f8caaa..c434fb6 100644 --- a/cove/src/ui/euph/popup.rs +++ b/cove/src/ui/euph/popup.rs @@ -35,5 +35,6 @@ pub enum PopupResult { NotHandled, Handled, Close, + SwitchToRoom { name: String }, ErrorOpeningLink { link: String, error: io::Error }, } diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 7d4b49c..83d7e96 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -27,7 +27,7 @@ use crate::{ util, widgets::ListState, }, - vault::EuphRoomVault, + vault::{EuphRoomVault, RoomIdentifier}, }; use super::{ @@ -500,18 +500,22 @@ impl EuphRoom { false } - pub async fn handle_input_event(&mut self, event: &mut InputEvent<'_>, keys: &Keys) -> bool { + pub async fn handle_input_event( + &mut self, + event: &mut InputEvent<'_>, + keys: &Keys, + ) -> RoomResult { if !self.popups.is_empty() { if event.matches(&keys.general.abort) { self.popups.pop_back(); - return true; + return RoomResult::Handled; } // Prevent event from reaching anything below the popup - return false; + return RoomResult::NotHandled; } let result = match &mut self.state { - State::Normal => return self.handle_normal_input_event(event, keys).await, + State::Normal => return self.handle_normal_input_event(event, keys).await.into(), State::Auth(editor) => auth::handle_input_event(event, keys, &self.room, editor), State::Nick(editor) => nick::handle_input_event(event, keys, &self.room, editor), State::Account(account) => account.handle_input_event(event, keys, &self.room), @@ -522,18 +526,24 @@ impl EuphRoom { }; match result { - PopupResult::NotHandled => false, - PopupResult::Handled => true, + PopupResult::NotHandled => RoomResult::NotHandled, + PopupResult::Handled => RoomResult::Handled, PopupResult::Close => { self.state = State::Normal; - true + RoomResult::Handled } + PopupResult::SwitchToRoom { name } => RoomResult::SwitchToRoom { + room: RoomIdentifier { + domain: self.vault().room().domain.clone(), + name, + }, + }, PopupResult::ErrorOpeningLink { link, error } => { self.popups.push_front(RoomPopup::Error { description: format!("Failed to open link: {link}"), reason: format!("{error}"), }); - true + RoomResult::Handled } } } @@ -638,3 +648,18 @@ impl EuphRoom { true } } + +pub enum RoomResult { + NotHandled, + Handled, + SwitchToRoom { room: RoomIdentifier }, +} + +impl From for RoomResult { + fn from(value: bool) -> Self { + match value { + true => Self::Handled, + false => Self::NotHandled, + } + } +} diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 04bce02..80089da 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -29,7 +29,7 @@ use crate::{ use super::{ UiError, UiEvent, - euph::room::EuphRoom, + euph::room::{EuphRoom, RoomResult}, key_bindings, util, widgets::{ListBuilder, ListState}, }; @@ -574,8 +574,15 @@ impl Rooms { } State::ShowRoom(name) => { if let Some(room) = self.euph_rooms.get_mut(name) { - if room.handle_input_event(event, keys).await { - return true; + match room.handle_input_event(event, keys).await { + RoomResult::NotHandled => {} + RoomResult::Handled => return true, + RoomResult::SwitchToRoom { room } => { + self.list.move_cursor_to_id(&room); + self.connect_to_room(room.clone()).await; + self.state = State::ShowRoom(room); + return true; + } } if event.matches(&keys.general.abort) { self.state = State::ShowList; From 24c8c92070a067c2aac0c107a30a93bae0e5c27a Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 21:42:13 +0100 Subject: [PATCH 083/109] Update emoji --- CHANGELOG.md | 1 + Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f75a3d8..ccf0f11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Procedure when bumping the version number: - Updated documentation for `time_zone` config option - When connecting to a room using `n` in the room list, the cursor now moves to that room +- Updated list of emoji names ### Removed diff --git a/Cargo.lock b/Cargo.lock index 86ebb73..b289bd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "euphoxide" version = "0.6.0" -source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.6.0#4f7cc49b636301ce9beea9324a0a1390f8391009" +source = "git+https://github.com/Garmelon/euphoxide.git?rev=6eea194d52fb63d7fb260d06e61d0625addf8c67#6eea194d52fb63d7fb260d06e61d0625addf8c67" dependencies = [ "async-trait", "caseless", diff --git a/Cargo.toml b/Cargo.toml index f8445e5..a0de23f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ unicode-width = "0.2.0" [workspace.dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -tag = "v0.6.0" +rev = "6eea194d52fb63d7fb260d06e61d0625addf8c67" features = ["bot"] [workspace.dependencies.toss] From 315db430105b58a9cdfbededc06876257df56992 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 21:46:32 +0100 Subject: [PATCH 084/109] Fix /me not being grey and italic --- cove/src/euph/highlight.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cove/src/euph/highlight.rs b/cove/src/euph/highlight.rs index e60a302..e7892a8 100644 --- a/cove/src/euph/highlight.rs +++ b/cove/src/euph/highlight.rs @@ -132,7 +132,7 @@ pub fn apply_spans( assert!(range.end <= content.len()); if i < range.start { - result = result.then_plain(&content[i..range.start]); + result = result.then(&content[i..range.start], base); } let text = &content[range.start..range.end]; @@ -145,7 +145,7 @@ pub fn apply_spans( let name = text.strip_prefix(':').unwrap_or(text); let name = name.strip_suffix(':').unwrap_or(name); if let Some(Some(replacement)) = util::EMOJI.get(name) { - result.then_plain(replacement) + result.then(replacement, base) } else { result.then(name, base.magenta()) } @@ -156,7 +156,7 @@ pub fn apply_spans( } if i < content.len() { - result = result.then_plain(&content[i..]); + result = result.then(&content[i..], base); } result From 9435fbece6abecd148d0937283abb315cbfcb659 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 21:56:18 +0100 Subject: [PATCH 085/109] Fix mention highlighting --- cove/src/euph/highlight.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cove/src/euph/highlight.rs b/cove/src/euph/highlight.rs index e7892a8..e69fd10 100644 --- a/cove/src/euph/highlight.rs +++ b/cove/src/euph/highlight.rs @@ -77,6 +77,7 @@ impl<'a> SpanFinder<'a> { fn step(&mut self, idx: usize, char: char) { match (char, self.span) { + ('@', Some((SpanType::Mention, _))) => {} // Continue the mention ('@', _) if self.room_or_mention_possible => self.open_span(SpanType::Mention, idx), ('&', _) if self.room_or_mention_possible => self.open_span(SpanType::Room, idx), (':', None) => self.open_span(SpanType::Emoji, idx), @@ -180,8 +181,9 @@ mod tests { #[test] fn mentions() { assert_eq!(find_spans("@foo"), vec![(SpanType::Mention, 0..4)]); + assert_eq!(find_spans("&@foo"), vec![(SpanType::Mention, 1..5)]); assert_eq!(find_spans("a @foo b"), vec![(SpanType::Mention, 2..6)]); - assert_eq!(find_spans("@@foo@"), vec![(SpanType::Mention, 1..6)]); + assert_eq!(find_spans("@@foo@@"), vec![(SpanType::Mention, 0..7)]); assert_eq!(find_spans("a @b@c d"), vec![(SpanType::Mention, 2..6)]); assert_eq!( find_spans("a @b @c d"), @@ -192,12 +194,18 @@ mod tests { #[test] fn rooms() { assert_eq!(find_spans("&foo"), vec![(SpanType::Room, 0..4)]); + assert_eq!(find_spans("@&foo"), vec![(SpanType::Room, 1..5)]); assert_eq!(find_spans("a &foo b"), vec![(SpanType::Room, 2..6)]); - assert_eq!(find_spans("&&foo&"), vec![(SpanType::Room, 1..5)]); + assert_eq!(find_spans("&&foo&&"), vec![(SpanType::Room, 1..5)]); assert_eq!(find_spans("a &b&c d"), vec![(SpanType::Room, 2..4)]); assert_eq!( find_spans("a &b &c d"), vec![(SpanType::Room, 2..4), (SpanType::Room, 5..7)] ); } + + #[test] + fn emoji_in_mentions() { + assert_eq!(find_spans(" @a:b:c "), vec![(SpanType::Mention, 1..7)]); + } } From b4c4a89625b50a3c723146435b4c253980e8476f Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 22:03:42 +0100 Subject: [PATCH 086/109] Fix mention color of non-ascii nicks The old code included the @ in mention color computations. If the nick consisted only of weird unicode characters, this resulted in an incorrect color being computed. --- cove/src/euph/highlight.rs | 4 ++-- cove/src/euph/util.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cove/src/euph/highlight.rs b/cove/src/euph/highlight.rs index e69fd10..0e7fb56 100644 --- a/cove/src/euph/highlight.rs +++ b/cove/src/euph/highlight.rs @@ -138,8 +138,8 @@ pub fn apply_spans( let text = &content[range.start..range.end]; result = match span { - SpanType::Mention if exact => result.and_then(util::style_nick_exact(text, base)), - SpanType::Mention => result.and_then(util::style_nick(text, base)), + SpanType::Mention if exact => result.and_then(util::style_mention_exact(text, base)), + SpanType::Mention => result.and_then(util::style_mention(text, base)), SpanType::Room => result.then(text, base.blue().bold()), SpanType::Emoji if exact => result.then(text, base.magenta()), SpanType::Emoji => { diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index aff2192..c2928ab 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -55,3 +55,17 @@ pub fn style_nick(nick: &str, base: Style) -> Styled { pub fn style_nick_exact(nick: &str, base: Style) -> Styled { Styled::new(nick, nick_style(nick, base)) } + +pub fn style_mention(mention: &str, base: Style) -> Styled { + let nick = mention + .strip_prefix('@') + .expect("mention must start with @"); + Styled::new(EMOJI.replace(mention), nick_style(nick, base)) +} + +pub fn style_mention_exact(mention: &str, base: Style) -> Styled { + let nick = mention + .strip_prefix('@') + .expect("mention must start with @"); + Styled::new(mention, nick_style(nick, base)) +} From b64f56fce54219c60b2e27591951b6c963f93711 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 22:41:25 +0100 Subject: [PATCH 087/109] Fix nick color in rare edge cases --- CHANGELOG.md | 4 ++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccf0f11..86159d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,10 @@ Procedure when bumping the version number: - Special handling of &rl2dev +### Fixed + +- Nick color in rare edge cases + ## v0.8.3 - 2024-05-20 ### Changed diff --git a/Cargo.lock b/Cargo.lock index b289bd3..98db605 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "euphoxide" version = "0.6.0" -source = "git+https://github.com/Garmelon/euphoxide.git?rev=6eea194d52fb63d7fb260d06e61d0625addf8c67#6eea194d52fb63d7fb260d06e61d0625addf8c67" +source = "git+https://github.com/Garmelon/euphoxide.git?rev=095d2cea86a574732e82385e217381b35cf65e4d#095d2cea86a574732e82385e217381b35cf65e4d" dependencies = [ "async-trait", "caseless", diff --git a/Cargo.toml b/Cargo.toml index a0de23f..6fbcf0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ unicode-width = "0.2.0" [workspace.dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -rev = "6eea194d52fb63d7fb260d06e61d0625addf8c67" +rev = "095d2cea86a574732e82385e217381b35cf65e4d" features = ["bot"] [workspace.dependencies.toss] From 972e4938aab8b8a7cc8c2fe5b89f9ddbf2cca618 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 22:46:09 +0100 Subject: [PATCH 088/109] Run tests in CI --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f02d5dd..012c48e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,9 @@ jobs: - name: Build run: cargo build --release + - name: Test + run: cargo test --release + - name: Record target triple run: rustc -vV | awk '/^host/ { print $2 }' > target/release/host From 967293db379d4ba962cfb851d5cf4750b54d2101 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 22:54:03 +0100 Subject: [PATCH 089/109] Fix links wrapping into oblivion --- CHANGELOG.md | 1 + cove/src/ui/euph/links.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86159d0..e2344ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Procedure when bumping the version number: ### Fixed - Nick color in rare edge cases +- Message link list rendering bug ## v0.8.3 - 2024-05-20 diff --git a/cove/src/ui/euph/links.rs b/cove/src/ui/euph/links.rs index 20e2219..c64830d 100644 --- a/cove/src/ui/euph/links.rs +++ b/cove/src/ui/euph/links.rs @@ -101,7 +101,7 @@ impl LinksState { Link::Room(name) => text.then(format!("&{name}"), Style::new().blue().bold()), }; - Text::new(text) + Text::new(text).with_wrap(false) }); } From cab37cb633961ff1b791e2ea5a79bae03576f477 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 22:55:47 +0100 Subject: [PATCH 090/109] Fix non-replaceable emoji being rendered without colons --- cove/src/euph/highlight.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove/src/euph/highlight.rs b/cove/src/euph/highlight.rs index 0e7fb56..1c9abd0 100644 --- a/cove/src/euph/highlight.rs +++ b/cove/src/euph/highlight.rs @@ -148,7 +148,7 @@ pub fn apply_spans( if let Some(Some(replacement)) = util::EMOJI.get(name) { result.then(replacement, base) } else { - result.then(name, base.magenta()) + result.then(text, base.magenta()) } } }; From 03b91ec1cdf871370208d03dd1e86faf789f41cc Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:08:17 +0100 Subject: [PATCH 091/109] Mention ghostty in config docs --- cove-config/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 85b418e..24ffcd3 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -58,7 +58,8 @@ pub struct Config { /// those cases are usually rare (unless you view a lot of emoji). /// /// `"unicode"`: Use the unicode standard in a best-effort manner to - /// determine grapheme widths. + /// determine grapheme widths. Some terminals (e.g. ghostty) can make use of + /// this. /// /// This method is used when `measure_widths` is set to `false`. #[serde(default)] From 56896a861e33e6d546fb00fa040942b13ec84863 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:08:29 +0100 Subject: [PATCH 092/109] Mention release binaries in readme --- README.md | 63 +++++-------------------------------------------------- 1 file changed, 5 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index e99e545..22fef83 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,11 @@ real-time chat platform. It runs on Linux, Windows, and macOS. +## Installing cove + +Download a binary of your choice from the +[latest release on GitHub](https://github.com/Garmelon/cove/releases/latest). + ## Using cove To start cove, simply run `cove` in your terminal. For more info about the @@ -26,61 +31,3 @@ file or via `cove help-config`. When launched, cove prints the location it is loading its config file from. To configure cove, create a config file at that location. This location can be changed via the `--config` command line option. - -## Installation - -At this point, cove is not available via any package manager. - -Cove is available as a Nix Flake. To try it out, you can use -```bash -$ nix run --override-input nixpkgs nixpkgs github:Garmelon/cove/latest -``` - -## Manual installation - -This section contains instructions on how to install cove by compiling it yourself. -It doesn't assume you know how to program, but it does assume basic familiarity with the command line on your platform of choice. -Cove runs in the terminal, after all. - -### Installing rustup - -Cove is written in Rust, so the first step is to install rustup. Either install -it from your package manager of choice (if you have one) or use the -[installer](https://rustup.rs/). - -Test your installation by running `rustup --version` and `cargo --version`. If -rustup is installed correctly, both of these should show a version number. - -Cove is designed on the current version of the stable toolchain. If cove doesn't -compile, you can try switching to the stable toolchain and updating it using the -following commands: -```bash -$ rustup default stable -$ rustup update -``` - -### Installing cove - -To install or update to the latest release of cove, run the following command: - -```bash -$ cargo install --force --git https://github.com/Garmelon/cove --branch latest -``` - -If you like to live dangerously and want to install or update to the latest, -bleeding-edge, possibly-broken commit from the repo's main branch, run the -following command. - -**Warning:** This could corrupt your vault. Make sure to make a backup before -running the command. - -```bash -$ cargo install --force --git https://github.com/Garmelon/cove -``` - -To install a specific version of cove, run the following command and substitute -in the full version you want to install: - -```bash -$ cargo install --force --git https://github.com/Garmelon/cove --tag v0.1.0 -``` From cc436bbb3a1332bde383b7e5b440e45ecd0144a4 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:40:58 +0100 Subject: [PATCH 093/109] Mention --width-estimation-method in config docs --- cove-config/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index 24ffcd3..a2a5cb9 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -62,6 +62,8 @@ pub struct Config { /// this. /// /// This method is used when `measure_widths` is set to `false`. + /// + /// See also the `--width-estimation-method` command line option. #[serde(default)] pub width_estimation_method: WidthEstimationMethod, From 676c92752df7070b1fb6c874d4978c65fc8571a9 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:39:22 +0100 Subject: [PATCH 094/109] Remove flake A bit annoying to keep up-to-date since I don't use it myself. --- flake.lock | 47 ----------------------------------------------- flake.nix | 29 ----------------------------- 2 files changed, 76 deletions(-) delete mode 100644 flake.lock delete mode 100644 flake.nix diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 1e52d47..0000000 --- a/flake.lock +++ /dev/null @@ -1,47 +0,0 @@ -{ - "nodes": { - "naersk": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1713520724, - "narHash": "sha256-CO8MmVDmqZX2FovL75pu5BvwhW+Vugc7Q6ze7Hj8heI=", - "owner": "nix-community", - "repo": "naersk", - "rev": "c5037590290c6c7dae2e42e7da1e247e54ed2d49", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1714068967, - "narHash": "sha256-jfQUewdwBVs0HHLH10qxyn0+J53e1aQoPSkuBnYf15s=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "10b682b6e5ed139ee2bef863ada3043f2d79c1cc", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "naersk": "naersk", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 286f9b7..0000000 --- a/flake.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - description = "TUI client for euphoria.leet.nu, a threaded real-time chat platform"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs"; - - naersk.url = "github:nix-community/naersk"; - naersk.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { self, nixpkgs, naersk }: - let forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; - in { - packages = forAllSystems (system: - let - pkgs = import nixpkgs { inherit system; }; - naersk' = pkgs.callPackage naersk { }; - cargoToml = pkgs.lib.importTOML ./Cargo.toml; - in - { - default = naersk'.buildPackage { - name = "cove"; - version = cargoToml.workspace.package.version; - root = ./.; - }; - } - ); - }; -} From b207e91c256046691e1e450419129c61ea74db69 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:38:02 +0100 Subject: [PATCH 095/109] Update dependencies --- Cargo.lock | 12 ++++++------ Cargo.toml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98db605..0f41db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,8 +520,8 @@ dependencies = [ [[package]] name = "euphoxide" -version = "0.6.0" -source = "git+https://github.com/Garmelon/euphoxide.git?rev=095d2cea86a574732e82385e217381b35cf65e4d#095d2cea86a574732e82385e217381b35cf65e4d" +version = "0.6.1" +source = "git+https://github.com/Garmelon/euphoxide.git?tag=v0.6.1#7a292c429ad44aa6aa52fc381e3168841d6303b0" dependencies = [ "async-trait", "caseless", @@ -865,9 +865,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "memchr" @@ -1646,8 +1646,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.3.1" -source = "git+https://github.com/Garmelon/toss.git?rev=423dd100c1360decffc5107ea4757d751ac0f4db#423dd100c1360decffc5107ea4757d751ac0f4db" +version = "0.3.2" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.2#d28ce90ec7590778e6035a7b00b1d85064f03dbf" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 6fbcf0c..119f98e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ directories = "6.0.0" edit = "0.1.5" jiff = "0.2.1" linkify = "0.10.0" -log = { version = "0.4.25", features = ["std"] } +log = { version = "0.4.26", features = ["std"] } open = "5.3.2" parking_lot = "0.12.3" proc-macro2 = "1.0.93" @@ -34,12 +34,12 @@ unicode-width = "0.2.0" [workspace.dependencies.euphoxide] git = "https://github.com/Garmelon/euphoxide.git" -rev = "095d2cea86a574732e82385e217381b35cf65e4d" +tag = "v0.6.1" features = ["bot"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -rev = "423dd100c1360decffc5107ea4757d751ac0f4db" +tag = "v0.3.2" [workspace.dependencies.vault] git = "https://github.com/Garmelon/vault.git" From 4cf6a15577ad5abd31550f5b23a72ab979a865dd Mon Sep 17 00:00:00 2001 From: Joscha Date: Sun, 23 Feb 2025 23:43:38 +0100 Subject: [PATCH 096/109] Bump version to 0.9.0 --- CHANGELOG.md | 5 +++-- CONFIG.md | 60 +++++++++++++++++++++++++++++++++++----------------- Cargo.lock | 8 +++---- Cargo.toml | 2 +- 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2344ff..ed799ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,12 @@ Procedure when bumping the version number: 4. Run `cargo run help-config > CONFIG.md` 5. Commit with message `Bump version to X.Y.Z` 6. Create tag named `vX.Y.Z` -7. Fast-forward branch `latest` -8. Push `master`, `latest` and the new tag +7. Push `master` and the new tag ## Unreleased +## v0.9.0 - 2025-02-23 + ### Added - Unicode-based grapheme width estimation method diff --git a/CONFIG.md b/CONFIG.md index 66625d0..feec645 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -93,9 +93,9 @@ Whether to automatically join this room on startup. **Type:** boolean **Default:** `false` -If `euph.rooms..username` is set, this will force cove to set the -username even if there is already a different username associated with -the current session. +If `euph.servers..rooms..username` is set, this will force +cove to set the username even if there is already a different username +associated with the current session. ### `euph.servers..rooms..password` @@ -607,12 +607,11 @@ Move to root. **Type:** boolean **Default:** `false` -Whether to measure the width of characters as displayed by the terminal -emulator instead of guessing the width. +Whether to measure the width of graphemes (i.e. characters) as displayed +by the terminal emulator instead of estimating the width. Enabling this makes rendering a bit slower but more accurate. The screen -might also flash when encountering new characters (or, more accurately, -graphemes). +might also flash when encountering new graphemes. See also the `--measure-widths` command line option. @@ -656,18 +655,41 @@ order of priority): Time zone that chat timestamps should be displayed in. -This option is interpreted as a POSIX TZ string. It is described here in -further detail: - +This option can either be the string `"localtime"`, a [POSIX TZ string], +or a [tz identifier] from the [tz database]. -On a normal system, the string `"localtime"` as well as any value from -the "TZ identifier" column of the following wikipedia article should be -valid TZ strings: - +When not set or when set to `"localtime"`, cove attempts to use your +system's configured time zone, falling back to UTC. -If the `TZ` environment variable exists, it overrides this option. If -neither exist, cove uses the system's local time zone. +When the string begins with a colon or doesn't match the a POSIX TZ +string format, it is interpreted as a tz identifier and looked up in +your system's tz database (or a bundled tz database on Windows). -**Warning:** On Windows, cove can't get the local time zone and uses UTC -instead. However, you can still specify a path to a tz data file or a -custom time zone string. +If the `TZ` environment variable exists, it overrides this option. + +[POSIX TZ string]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03 +[tz identifier]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones +[tz database]: https://en.wikipedia.org/wiki/Tz_database + +### `width_estimation_method` + +**Required:** yes +**Type:** string +**Values:** `"legacy"`, `"unicode"` +**Default:** `"legacy"` + +How to estimate the width of graphemes (i.e. characters) as displayed by +the terminal emulator. + +`"legacy"`: Use a legacy method that should mostly work on most terminal +emulators. This method will never be correct in all cases since every +terminal emulator handles grapheme widths slightly differently. However, +those cases are usually rare (unless you view a lot of emoji). + +`"unicode"`: Use the unicode standard in a best-effort manner to +determine grapheme widths. Some terminals (e.g. ghostty) can make use of +this. + +This method is used when `measure_widths` is set to `false`. + +See also the `--width-estimation-method` command line option. diff --git a/Cargo.lock b/Cargo.lock index 0f41db7..cc86a84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,7 +330,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" -version = "0.8.3" +version = "0.9.0" dependencies = [ "anyhow", "async-trait", @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.8.3" +version = "0.9.0" dependencies = [ "cove-input", "cove-macro", @@ -369,7 +369,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.8.3" +version = "0.9.0" dependencies = [ "cove-macro", "crossterm", @@ -383,7 +383,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.8.3" +version = "0.9.0" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 119f98e..26aa29d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["cove", "cove-*"] [workspace.package] -version = "0.8.3" +version = "0.9.0" edition = "2024" [workspace.dependencies] From 30c344031a9f5d7f45ec8311902aca84d7484e42 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 28 Feb 2025 14:32:30 +0100 Subject: [PATCH 097/109] Fix rendering glitches with unicode-based width estimation --- CHANGELOG.md | 4 ++++ Cargo.lock | 4 ++-- Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed799ba..41d2586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Fixed + +- Rendering glitches with unicode-based width estimation + ## v0.9.0 - 2025-02-23 ### Added diff --git a/Cargo.lock b/Cargo.lock index cc86a84..e9ceb10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,8 +1646,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.3.2" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.2#d28ce90ec7590778e6035a7b00b1d85064f03dbf" +version = "0.3.3" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.3#96b2e13c4a4b0174601d90246d92d148c4230eeb" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 26aa29d..322724f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ features = ["bot"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.3.2" +tag = "v0.3.3" [workspace.dependencies.vault] git = "https://github.com/Garmelon/vault.git" From 6157ca5088ac4d6e6ebc6452d0704d2d6f48ff7a Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 1 Mar 2025 14:26:18 +0100 Subject: [PATCH 098/109] Update dependencies --- Cargo.lock | 62 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9ceb10..5e5b86a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,9 +113,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-lc-rs" -version = "1.12.4" +version = "1.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd755adf9707cf671e31d944a189be3deaaeee11c8bc1d669bb8022ac90fbd0" +checksum = "5e4e8200b9a4a5801a769d50eeabc05670fec7e959a8cb7a63a93e4e519942ae" dependencies = [ "aws-lc-sys", "paste", @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "block-buffer" @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.14" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "jobserver", "libc", @@ -249,9 +249,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.30" +version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d" +checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767" dependencies = [ "clap_builder", "clap_derive", @@ -259,9 +259,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.30" +version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c" +checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863" dependencies = [ "anstream", "anstyle", @@ -498,9 +498,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d" [[package]] name = "equivalent" @@ -803,9 +803,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" [[package]] name = "libloading" @@ -883,9 +883,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", ] @@ -1029,9 +1029,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" [[package]] name = "portable-atomic-util" @@ -1093,7 +1093,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha", "rand_core", - "zerocopy 0.8.20", + "zerocopy 0.8.21", ] [[package]] @@ -1108,19 +1108,19 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88e0da7a2c97baa202165137c158d0a2e824ac465d13d81046727b34cb247d3" +checksum = "7a509b1a2ffbe92afab0e55c8fd99dea1c280e8171bd2d88682bb20bc41cbc2c" dependencies = [ "getrandom 0.3.1", - "zerocopy 0.8.20", + "zerocopy 0.8.21", ] [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f" dependencies = [ "bitflags", ] @@ -1167,9 +1167,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" -version = "0.17.9" +version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" +checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73" dependencies = [ "cc", "cfg-if", @@ -1914,11 +1914,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde3bb8c68a8f3f1ed4ac9221aad6b10cece3e60a8e2ea54a6a2dec806d0084c" +checksum = "dcf01143b2dd5d134f11f545cf9f1431b13b749695cb33bcce051e7568f99478" dependencies = [ - "zerocopy-derive 0.8.20", + "zerocopy-derive 0.8.21", ] [[package]] @@ -1934,9 +1934,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eea57037071898bf96a6da35fd626f4f27e9cee3ead2a6c703cf09d472b2e700" +checksum = "712c8386f4f4299382c9abee219bee7084f78fb939d88b6840fcc1320d5f6da2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 322724f..cd023a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2024" [workspace.dependencies] anyhow = "1.0.96" async-trait = "0.1.86" -clap = { version = "4.5.30", features = ["derive", "deprecated"] } +clap = { version = "4.5.31", features = ["derive", "deprecated"] } cookie = "0.18.1" crossterm = "0.28.1" directories = "6.0.0" From 496cdde18d33cd898e6628ba0636dc03761cf9c8 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 1 Mar 2025 14:38:41 +0100 Subject: [PATCH 099/109] Bump version to 0.9.1 --- CHANGELOG.md | 2 ++ Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41d2586..de7a07e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Procedure when bumping the version number: ## Unreleased +## v0.9.1 - 2025-03-01 + ### Fixed - Rendering glitches with unicode-based width estimation diff --git a/Cargo.lock b/Cargo.lock index 5e5b86a..60c89b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,7 +330,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" -version = "0.9.0" +version = "0.9.1" dependencies = [ "anyhow", "async-trait", @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.9.0" +version = "0.9.1" dependencies = [ "cove-input", "cove-macro", @@ -369,7 +369,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.9.0" +version = "0.9.1" dependencies = [ "cove-macro", "crossterm", @@ -383,7 +383,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.9.0" +version = "0.9.1" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index cd023a1..2937074 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["cove", "cove-*"] [workspace.package] -version = "0.9.0" +version = "0.9.1" edition = "2024" [workspace.dependencies] From a17630aeaaa902ead46de58d87ceb1ec8703fcfc Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 8 Mar 2025 19:21:01 +0100 Subject: [PATCH 100/109] Ring bell when mentioned --- CHANGELOG.md | 4 ++++ Cargo.lock | 4 ++-- Cargo.toml | 2 +- cove-config/src/lib.rs | 4 ++++ cove/src/ui/euph/room.rs | 44 +++++++++++++++++++++++++++++++++++++--- cove/src/ui/rooms.rs | 16 ++++++++++++--- 6 files changed, 65 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de7a07e..4136ab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Added + +- `bell_on_mention` config option + ## v0.9.1 - 2025-03-01 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 60c89b6..58a545e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,8 +1646,8 @@ dependencies = [ [[package]] name = "toss" -version = "0.3.3" -source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.3#96b2e13c4a4b0174601d90246d92d148c4230eeb" +version = "0.3.4" +source = "git+https://github.com/Garmelon/toss.git?tag=v0.3.4#57aa8c59308f6f0aa82bde415a42b56c3d6f7c4d" dependencies = [ "async-trait", "crossterm", diff --git a/Cargo.toml b/Cargo.toml index 2937074..a4278ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ features = ["bot"] [workspace.dependencies.toss] git = "https://github.com/Garmelon/toss.git" -tag = "v0.3.3" +tag = "v0.3.4" [workspace.dependencies.vault] git = "https://github.com/Garmelon/vault.git" diff --git a/cove-config/src/lib.rs b/cove-config/src/lib.rs index a2a5cb9..0cb6cc7 100644 --- a/cove-config/src/lib.rs +++ b/cove-config/src/lib.rs @@ -100,6 +100,10 @@ pub struct Config { #[serde(default)] pub rooms_sort_order: RoomsSortOrder, + /// Ring the bell (character 0x07) when you are mentioned in a room. + #[serde(default)] + pub bell_on_mention: bool, + /// Time zone that chat timestamps should be displayed in. /// /// This option can either be the string `"localtime"`, a [POSIX TZ string], diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 83d7e96..ebae5a8 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -4,8 +4,8 @@ use cove_config::{Config, Keys}; use cove_input::InputEvent; use crossterm::style::Stylize; use euphoxide::{ - api::{Data, Message, MessageId, PacketType, SessionId}, - bot::instance::{Event, ServerConfig}, + api::{Data, Message, MessageId, PacketType, SessionId, packet::ParsedPacket}, + bot::instance::{ConnSnapshot, Event, ServerConfig}, conn::{self, Joined, Joining, SessionInfo}, }; use jiff::tz::TimeZone; @@ -19,7 +19,7 @@ use toss::{ }; use crate::{ - euph, + euph::{self, SpanType}, macros::logging_unwrap, ui::{ UiError, UiEvent, @@ -73,6 +73,8 @@ pub struct EuphRoom { last_msg_sent: Option>, nick_list: ListState, + + mentioned: bool, } impl EuphRoom { @@ -96,6 +98,7 @@ impl EuphRoom { chat: ChatState::new(vault, tz), last_msg_sent: None, nick_list: ListState::new(), + mentioned: false, } } @@ -164,6 +167,12 @@ impl EuphRoom { } } + pub fn retrieve_mentioned(&mut self) -> bool { + let mentioned = self.mentioned; + self.mentioned = false; + mentioned + } + pub async fn unseen_msgs_count(&self) -> usize { logging_unwrap!(self.vault().unseen_msgs_count().await) } @@ -557,6 +566,35 @@ impl EuphRoom { return false; } + if let Event::Packet( + _, + ParsedPacket { + content: Ok(Data::SendEvent(send)), + .. + }, + ConnSnapshot { + state: conn::State::Joined(joined), + .. + }, + ) = &event + { + let normalized_name = euphoxide::nick::normalize(&joined.session.name); + let content = &*send.0.content; + for (rtype, rspan) in euph::find_spans(content) { + if rtype != SpanType::Mention { + continue; + } + let Some(mention) = content[rspan].strip_prefix('@') else { + continue; + }; + let normalized_mention = euphoxide::nick::normalize(mention); + if normalized_name == normalized_mention { + self.mentioned = true; + break; + } + } + } + // We handle the packet internally first because the room event handling // will consume it while we only need a reference. let handled = if let Event::Packet(_, packet, _) = &event { diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index 80089da..f901f30 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -17,7 +17,7 @@ use jiff::tz::TimeZone; use tokio::sync::mpsc; use toss::{ Style, Styled, Widget, WidgetExt, - widgets::{BoxedAsync, Empty, Join2, Text}, + widgets::{BellState, BoxedAsync, Empty, Join2, Text}, }; use crate::{ @@ -95,6 +95,7 @@ pub struct Rooms { list: ListState, order: Order, + bell: BellState, euph_servers: HashMap, euph_rooms: HashMap, @@ -115,6 +116,7 @@ impl Rooms { state: State::ShowList, list: ListState::new(), order: Order::from_rooms_sort_order(config.rooms_sort_order), + bell: BellState::new(), euph_servers: HashMap::new(), euph_rooms: HashMap::new(), }; @@ -244,7 +246,9 @@ impl Rooms { .retain(|n, r| !r.stopped() || rooms_set.contains(n)); for room in rooms_set { - self.get_or_insert_room(room).await.retain(); + let room = self.get_or_insert_room(room).await; + room.retain(); + self.bell.ring |= room.retrieve_mentioned(); } } @@ -254,7 +258,7 @@ impl Rooms { _ => self.stabilize_rooms().await, } - match &mut self.state { + let widget = match &mut self.state { State::ShowList => Self::rooms_widget( &self.vault, self.config, @@ -297,6 +301,12 @@ impl Rooms { .below(delete.widget()) .desync() .boxed_async(), + }; + + if self.config.bell_on_mention { + widget.above(self.bell.widget().desync()).boxed_async() + } else { + widget } } From 74fbf386b2e1769821a5f0bbdc4175a61ef63310 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 14 Mar 2025 15:08:00 +0100 Subject: [PATCH 101/109] Update dependencies --- CHANGELOG.md | 2 +- Cargo.lock | 236 +++++++++++++++++++++++++++------------------------ Cargo.toml | 22 ++--- 3 files changed, 137 insertions(+), 123 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4136ab3..a14ead2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Procedure when bumping the version number: -1. Update dependencies and flake in a separate commit +1. Update dependencies in a separate commit 2. Set version number in `Cargo.toml` 3. Add new section in this changelog 4. Run `cargo run help-config > CONFIG.md` diff --git a/Cargo.lock b/Cargo.lock index 58a545e..6a83e5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,15 +90,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "async-trait" -version = "0.1.86" +version = "0.1.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d" +checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97" dependencies = [ "proc-macro2", "quote", @@ -113,27 +113,25 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "aws-lc-rs" -version = "1.12.5" +version = "1.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4e8200b9a4a5801a769d50eeabc05670fec7e959a8cb7a63a93e4e519942ae" +checksum = "dabb68eb3a7aa08b46fddfd59a3d55c978243557a90ab804769f7e20e67d2b01" dependencies = [ "aws-lc-sys", - "paste", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9dd2e03ee80ca2822dd6ea431163d2ef259f2066a4d6ccaca6d9dcb386aa43" +checksum = "6bbe221bbf523b625a4dd8585c7f38166e31167ec2ca98051dbcb4c3b6e825d2" dependencies = [ "bindgen", "cc", "cmake", "dunce", "fs_extra", - "paste", ] [[package]] @@ -189,17 +187,11 @@ dependencies = [ "generic-array", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "caseless" @@ -249,9 +241,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.31" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", "clap_derive", @@ -259,9 +251,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.31" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstream", "anstyle", @@ -271,9 +263,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.28" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck", "proc-macro2", @@ -409,7 +401,7 @@ dependencies = [ "crossterm_winapi", "mio", "parking_lot", - "rustix", + "rustix 0.38.44", "signal-hook", "signal-hook-mio", "winapi", @@ -498,9 +490,9 @@ dependencies = [ [[package]] name = "either" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "equivalent" @@ -686,9 +678,9 @@ dependencies = [ [[package]] name = "http" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -697,15 +689,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "indexmap" -version = "2.7.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -747,16 +739,17 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jiff" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3590fea8e9e22d449600c9bbd481a8163bef223e4ff938e5f55899f8cf1adb93" +checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e" dependencies = [ + "jiff-static", "jiff-tzdb-platform", "log", "portable-atomic", @@ -766,10 +759,21 @@ dependencies = [ ] [[package]] -name = "jiff-tzdb" -version = "0.1.2" +name = "jiff-static" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2cec2f5d266af45a071ece48b1fb89f3b00b2421ac3a5fe10285a6caaa60d3" +checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962e1dfe9b2d75a84536cf5bf5eaaa4319aa7906c7160134a22883ac316d5f31" [[package]] name = "jiff-tzdb-platform" @@ -803,9 +807,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.170" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libloading" @@ -853,6 +857,12 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" + [[package]] name = "lock_api" version = "0.4.12" @@ -938,9 +948,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.3" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "open" @@ -997,12 +1007,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "pathdiff" version = "0.2.3" @@ -1023,9 +1027,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" @@ -1050,18 +1054,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.7.35", + "zerocopy 0.8.23", ] [[package]] name = "prettyplease" -version = "0.2.29" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6924ced06e1f7dfe3fa48d57b9f74f55d8915f5036121bef647ef4b204895fac" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", "syn", @@ -1069,18 +1073,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -1093,7 +1097,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha", "rand_core", - "zerocopy 0.8.21", + "zerocopy 0.8.23", ] [[package]] @@ -1108,19 +1112,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a509b1a2ffbe92afab0e55c8fd99dea1c280e8171bd2d88682bb20bc41cbc2c" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.1", - "zerocopy 0.8.21", ] [[package]] name = "redox_syscall" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ "bitflags", ] @@ -1167,9 +1170,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "ring" -version = "0.17.11" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", @@ -1215,7 +1218,20 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.3", "windows-sys 0.59.0", ] @@ -1266,9 +1282,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "schannel" @@ -1310,9 +1326,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.218" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] @@ -1329,9 +1345,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.218" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -1350,9 +1366,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.139" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1455,9 +1471,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.98" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -1466,32 +1482,31 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.17.1" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" +checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600" dependencies = [ - "cfg-if", "fastrand", "getrandom 0.3.1", "once_cell", - "rustix", + "rustix 1.0.2", "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -1500,9 +1515,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.37" +version = "0.3.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" dependencies = [ "deranged", "itoa", @@ -1515,15 +1530,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" [[package]] name = "time-macros" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" dependencies = [ "num-conv", "time-core", @@ -1531,9 +1546,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -1546,9 +1561,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.43.0" +version = "1.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" +checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", "bytes", @@ -1575,9 +1590,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ "rustls", "tokio", @@ -1683,9 +1698,9 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicode-ident" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-linebreak" @@ -1777,7 +1792,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.44", ] [[package]] @@ -1886,9 +1901,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] @@ -1908,17 +1923,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "byteorder", "zerocopy-derive 0.7.35", ] [[package]] name = "zerocopy" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf01143b2dd5d134f11f545cf9f1431b13b749695cb33bcce051e7568f99478" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" dependencies = [ - "zerocopy-derive 0.8.21", + "zerocopy-derive 0.8.23", ] [[package]] @@ -1934,9 +1948,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712c8386f4f4299382c9abee219bee7084f78fb939d88b6840fcc1320d5f6da2" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index a4278ed..f4f81a5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,28 +7,28 @@ version = "0.9.1" edition = "2024" [workspace.dependencies] -anyhow = "1.0.96" -async-trait = "0.1.86" -clap = { version = "4.5.31", features = ["derive", "deprecated"] } +anyhow = "1.0.97" +async-trait = "0.1.87" +clap = { version = "4.5.32", features = ["derive", "deprecated"] } cookie = "0.18.1" crossterm = "0.28.1" directories = "6.0.0" edit = "0.1.5" -jiff = "0.2.1" +jiff = "0.2.4" linkify = "0.10.0" log = { version = "0.4.26", features = ["std"] } open = "5.3.2" parking_lot = "0.12.3" -proc-macro2 = "1.0.93" -quote = "1.0.38" +proc-macro2 = "1.0.94" +quote = "1.0.40" rusqlite = { version = "0.31.0", features = ["bundled", "time"] } rustls = "0.23.23" -serde = { version = "1.0.218", features = ["derive"] } +serde = { version = "1.0.219", features = ["derive"] } serde_either = "0.2.1" -serde_json = "1.0.139" -syn = "2.0.98" -thiserror = "2.0.11" -tokio = { version = "1.43.0", features = ["full"] } +serde_json = "1.0.140" +syn = "2.0.100" +thiserror = "2.0.12" +tokio = { version = "1.44.1", features = ["full"] } toml = "0.8.20" unicode-width = "0.2.0" From ca0f0b6c31d78420ad1599fb3f9d61052cb580da Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 14 Mar 2025 15:09:01 +0100 Subject: [PATCH 102/109] Bump version to 0.9.2 --- CHANGELOG.md | 2 ++ CONFIG.md | 8 ++++++++ Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a14ead2..1f06e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Procedure when bumping the version number: ## Unreleased +## v0.9.2 - 2025-03-14 + ### Added - `bell_on_mention` config option diff --git a/CONFIG.md b/CONFIG.md index feec645..e537310 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -53,6 +53,14 @@ Available modifiers: ## Available options +### `bell_on_mention` + +**Required:** yes +**Type:** boolean +**Default:** `false` + +Ring the bell (character 0x07) when you are mentioned in a room. + ### `data_dir` **Required:** no diff --git a/Cargo.lock b/Cargo.lock index 6a83e5d..157b640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -322,7 +322,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" -version = "0.9.1" +version = "0.9.2" dependencies = [ "anyhow", "async-trait", @@ -350,7 +350,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.9.1" +version = "0.9.2" dependencies = [ "cove-input", "cove-macro", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.9.1" +version = "0.9.2" dependencies = [ "cove-macro", "crossterm", @@ -375,7 +375,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.9.1" +version = "0.9.2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index f4f81a5..0fa473f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["cove", "cove-*"] [workspace.package] -version = "0.9.1" +version = "0.9.2" edition = "2024" [workspace.dependencies] From 8b928184e89b9ac5aee23eed4c9d084d5416c55d Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 8 Apr 2025 23:51:39 +0200 Subject: [PATCH 103/109] Fix autojoin key connecting to non-autojoin rooms --- CHANGELOG.md | 4 ++++ cove/src/ui/rooms.rs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f06e21..3682c75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Fixed + +- `keys.rooms.action.connect_autojoin` connecting to non-autojoin rooms + ## v0.9.2 - 2025-03-14 ### Added diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index f901f30..c3d6a40 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -536,7 +536,10 @@ impl Rooms { } if event.matches(&keys.rooms.action.connect_autojoin) { for (domain, server) in &self.config.euph.servers { - for name in server.rooms.keys() { + for (name, room) in &server.rooms { + if !room.autojoin { + continue; + } let id = RoomIdentifier::new(domain.clone(), name.clone()); self.connect_to_room(id).await; } From 40de073799666aa3c4b2e00c078d38c638f29bd2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 31 May 2025 13:11:50 +0200 Subject: [PATCH 104/109] Silence clippy warning --- cove/src/ui.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/cove/src/ui.rs b/cove/src/ui.rs index 1c03834..5ebd540 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -50,6 +50,7 @@ impl From for UiError { } } +#[expect(clippy::large_enum_variant)] pub enum UiEvent { GraphemeWidthsChanged, LogChanged, From 732d4627754b5d8ccad6b26a065fbef27761ba5e Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 31 May 2025 13:38:54 +0200 Subject: [PATCH 105/109] Add user id based emoji hash Helpful in scenarios where you want to disambiguate people based on their user id at a glance. --- CHANGELOG.md | 4 ++++ cove-config/src/keys.rs | 4 ++++ cove/src/euph/small_message.rs | 15 ++++++++++++++- cove/src/euph/util.rs | 15 ++++++++++++++- cove/src/store.rs | 4 ++++ cove/src/ui/chat.rs | 8 ++++++++ cove/src/ui/chat/tree.rs | 5 +++++ cove/src/ui/chat/tree/renderer.rs | 2 ++ cove/src/ui/chat/tree/scroll.rs | 1 + cove/src/ui/chat/tree/widgets.rs | 9 ++++++++- cove/src/vault/euph.rs | 18 ++++++++++-------- 11 files changed, 74 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3682c75..e92f49b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Added + +- Key bindings for emoji-based user id hashing + ### Fixed - `keys.rooms.action.connect_autojoin` connecting to non-autojoin rooms diff --git a/cove-config/src/keys.rs b/cove-config/src/keys.rs index 8b5adeb..47c171c 100644 --- a/cove-config/src/keys.rs +++ b/cove-config/src/keys.rs @@ -104,6 +104,7 @@ default_bindings! { pub fn mark_older_seen => ["ctrl+s"]; pub fn info => ["i"]; pub fn links => ["I"]; + pub fn toggle_nick_emoji => ["e"]; pub fn increase_caesar => ["c"]; pub fn decrease_caesar => ["C"]; } @@ -356,6 +357,9 @@ pub struct TreeAction { /// List links found in message. #[serde(default = "default::tree_action::links")] pub links: KeyBinding, + /// Toggle agent id based nick emoji. + #[serde(default = "default::tree_action::toggle_nick_emoji")] + pub toggle_nick_emoji: KeyBinding, /// Increase caesar cipher rotation. #[serde(default = "default::tree_action::increase_caesar")] pub increase_caesar: KeyBinding, diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 003cd40..d306226 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -1,15 +1,20 @@ +use std::hash::{DefaultHasher, Hash, Hasher}; + use crossterm::style::Stylize; -use euphoxide::api::{MessageId, Snowflake, Time}; +use euphoxide::api::{MessageId, Snowflake, Time, UserId}; use jiff::Timestamp; use toss::{Style, Styled}; use crate::{store::Msg, ui::ChatMsg}; +use super::util; + #[derive(Debug, Clone)] pub struct SmallMessage { pub id: MessageId, pub parent: Option, pub time: Time, + pub user_id: UserId, pub nick: String, pub content: String, pub seen: bool, @@ -70,6 +75,14 @@ impl Msg for SmallMessage { fn last_possible_id() -> Self::Id { MessageId(Snowflake::MAX) } + + fn nick_emoji(&self) -> Option { + let mut hasher = DefaultHasher::new(); + self.user_id.0.hash(&mut hasher); + let hash = hasher.finish(); + let emoji = &util::EMOJI_LIST[hash as usize % util::EMOJI_LIST.len()]; + Some(emoji.clone()) + } } impl ChatMsg for SmallMessage { diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index c2928ab..ecea304 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -1,4 +1,4 @@ -use std::sync::LazyLock; +use std::{collections::HashSet, sync::LazyLock}; use crossterm::style::{Color, Stylize}; use euphoxide::Emoji; @@ -6,6 +6,19 @@ use toss::{Style, Styled}; pub static EMOJI: LazyLock = LazyLock::new(Emoji::load); +pub static EMOJI_LIST: LazyLock> = LazyLock::new(|| { + let mut list = EMOJI + .0 + .values() + .flatten() + .cloned() + .collect::>() + .into_iter() + .collect::>(); + list.sort_unstable(); + list +}); + /// Convert HSL to RGB following [this approach from wikipedia][1]. /// /// `h` must be in the range `[0, 360]`, `s` and `l` in the range `[0, 1]`. diff --git a/cove/src/store.rs b/cove/src/store.rs index f64f71e..b7031c1 100644 --- a/cove/src/store.rs +++ b/cove/src/store.rs @@ -8,6 +8,10 @@ pub trait Msg { fn parent(&self) -> Option; fn seen(&self) -> bool; + fn nick_emoji(&self) -> Option { + None + } + fn last_possible_id() -> Self::Id; } diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 405339b..02adeb7 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -37,6 +37,7 @@ pub struct ChatState> { cursor: Cursor, editor: EditorState, + nick_emoji: bool, caesar: i8, mode: Mode, @@ -48,6 +49,7 @@ impl + Clone> ChatState { Self { cursor: Cursor::Bottom, editor: EditorState::new(), + nick_emoji: false, caesar: 0, mode: Mode::Tree, @@ -79,6 +81,7 @@ impl> ChatState { &mut self.editor, nick, focused, + self.nick_emoji, self.caesar, ) .boxed_async(), @@ -117,6 +120,11 @@ impl> ChatState { Reaction::Composed { parent, content } } + Reaction::NotHandled if event.matches(&keys.tree.action.toggle_nick_emoji) => { + self.nick_emoji = !self.nick_emoji; + Reaction::Handled + } + Reaction::NotHandled if event.matches(&keys.tree.action.increase_caesar) => { self.caesar = (self.caesar + 1).rem_euclid(26); Reaction::Handled diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index 043e109..d9905fc 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -389,6 +389,7 @@ impl> TreeViewState { editor: &'a mut EditorState, nick: String, focused: bool, + nick_emoji: bool, caesar: i8, ) -> TreeView<'a, M, S> { TreeView { @@ -397,6 +398,7 @@ impl> TreeViewState { editor, nick, focused, + nick_emoji, caesar, } } @@ -410,6 +412,8 @@ pub struct TreeView<'a, M: Msg, S: MsgStore> { nick: String, focused: bool, + + nick_emoji: bool, caesar: i8, } @@ -438,6 +442,7 @@ where size, nick: self.nick.clone(), focused: self.focused, + nick_emoji: self.nick_emoji, caesar: self.caesar, last_cursor: self.state.last_cursor.clone(), last_cursor_top: self.state.last_cursor_top, diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 142624e..225191b 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -80,6 +80,7 @@ pub struct TreeContext { pub size: Size, pub nick: String, pub focused: bool, + pub nick_emoji: bool, pub caesar: i8, pub last_cursor: Cursor, pub last_cursor_top: i32, @@ -207,6 +208,7 @@ where self.tz.clone(), indent, msg, + self.context.nick_emoji, self.context.caesar, folded_info, ); diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index ab3ddae..a8a1305 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -22,6 +22,7 @@ where size: self.last_size, nick: self.last_nick.clone(), focused: true, + nick_emoji: false, caesar: 0, last_cursor: self.last_cursor.clone(), last_cursor_top: self.last_cursor_top, diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index d46920e..dd7fa89 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -59,10 +59,17 @@ pub fn msg( tz: TimeZone, indent: usize, msg: &M, + nick_emoji: bool, caesar: i8, folded_info: Option, ) -> Boxed<'static, Infallible> { - let (nick, mut content) = msg.styled(); + let (mut nick, mut content) = msg.styled(); + + if nick_emoji { + if let Some(emoji) = msg.nick_emoji() { + nick = nick.then_plain("(").then_plain(emoji).then_plain(")"); + } + } if caesar != 0 { // Apply caesar in inverse because we're decoding diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 931091c..4a4109e 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -611,7 +611,7 @@ impl Action for GetMsg { let msg = conn .query_row( " - SELECT id, parent, time, name, content, seen + SELECT id, parent, time, user_id, name, content, seen FROM euph_msgs WHERE domain = ? AND room = ? @@ -623,9 +623,10 @@ impl Action for GetMsg { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - nick: row.get(3)?, - content: row.get(4)?, - seen: row.get(5)?, + user_id: UserId(row.get(3)?), + nick: row.get(4)?, + content: row.get(5)?, + seen: row.get(6)?, }) }, ) @@ -703,7 +704,7 @@ impl Action for GetTree { AND tree.room = euph_msgs.room AND tree.id = euph_msgs.parent ) - SELECT id, parent, time, name, content, seen + SELECT id, parent, time, user_id, name, content, seen FROM euph_msgs JOIN tree USING (domain, room, id) ORDER BY id ASC @@ -716,9 +717,10 @@ impl Action for GetTree { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - nick: row.get(3)?, - content: row.get(4)?, - seen: row.get(5)?, + user_id: UserId(row.get(3)?), + nick: row.get(4)?, + content: row.get(5)?, + seen: row.get(6)?, }) }, )? From b70d7548da28ff89966eae52595cacb930b315ad Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 31 May 2025 13:54:07 +0200 Subject: [PATCH 106/109] Bump version to 0.9.3 --- CHANGELOG.md | 2 ++ CONFIG.md | 8 ++++++++ Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e92f49b..7d87d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Procedure when bumping the version number: ## Unreleased +## v0.9.3 - 2025-05-31 + ### Added - Key bindings for emoji-based user id hashing diff --git a/CONFIG.md b/CONFIG.md index e537310..82a7242 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -537,6 +537,14 @@ Reply to message, inline if possible. Reply opposite to normal reply. +### `keys.tree.action.toggle_nick_emoji` + +**Required:** yes +**Type:** key binding +**Default:** `"e"` + +Toggle agent id based nick emoji. + ### `keys.tree.action.toggle_seen` **Required:** yes diff --git a/Cargo.lock b/Cargo.lock index 157b640..2f45a5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -322,7 +322,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" -version = "0.9.2" +version = "0.9.3" dependencies = [ "anyhow", "async-trait", @@ -350,7 +350,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.9.2" +version = "0.9.3" dependencies = [ "cove-input", "cove-macro", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.9.2" +version = "0.9.3" dependencies = [ "cove-macro", "crossterm", @@ -375,7 +375,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.9.2" +version = "0.9.3" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 0fa473f..33f245f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["cove", "cove-*"] [workspace.package] -version = "0.9.2" +version = "0.9.3" edition = "2024" [workspace.dependencies] From 67e77c88800c02305ad2464380f38e4ff27d797d Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 31 May 2025 15:04:17 +0200 Subject: [PATCH 107/109] Show emoji hash in nick list --- CHANGELOG.md | 4 +++ cove/src/euph/small_message.rs | 8 +---- cove/src/euph/util.rs | 16 ++++++++-- cove/src/ui/chat.rs | 4 +++ cove/src/ui/euph/nick_list.rs | 56 +++++++++++++++++++++++++++++----- cove/src/ui/euph/room.rs | 15 ++++++--- 6 files changed, 81 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d87d77..76fa94a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Procedure when bumping the version number: ## Unreleased +### Changed + +- Display emoji user id hashes in the nick list + ## v0.9.3 - 2025-05-31 ### Added diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index d306226..5db1790 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -1,5 +1,3 @@ -use std::hash::{DefaultHasher, Hash, Hasher}; - use crossterm::style::Stylize; use euphoxide::api::{MessageId, Snowflake, Time, UserId}; use jiff::Timestamp; @@ -77,11 +75,7 @@ impl Msg for SmallMessage { } fn nick_emoji(&self) -> Option { - let mut hasher = DefaultHasher::new(); - self.user_id.0.hash(&mut hasher); - let hash = hasher.finish(); - let emoji = &util::EMOJI_LIST[hash as usize % util::EMOJI_LIST.len()]; - Some(emoji.clone()) + Some(util::user_id_emoji(&self.user_id)) } } diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index ecea304..ea1782a 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -1,7 +1,11 @@ -use std::{collections::HashSet, sync::LazyLock}; +use std::{ + collections::HashSet, + hash::{DefaultHasher, Hash, Hasher}, + sync::LazyLock, +}; use crossterm::style::{Color, Stylize}; -use euphoxide::Emoji; +use euphoxide::{Emoji, api::UserId}; use toss::{Style, Styled}; pub static EMOJI: LazyLock = LazyLock::new(Emoji::load); @@ -82,3 +86,11 @@ pub fn style_mention_exact(mention: &str, base: Style) -> Styled { .expect("mention must start with @"); Styled::new(mention, nick_style(nick, base)) } + +pub fn user_id_emoji(user_id: &UserId) -> String { + let mut hasher = DefaultHasher::new(); + user_id.0.hash(&mut hasher); + let hash = hasher.finish(); + let emoji = &EMOJI_LIST[hash as usize % EMOJI_LIST.len()]; + emoji.clone() +} diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 02adeb7..1116935 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -58,6 +58,10 @@ impl + Clone> ChatState { store, } } + + pub fn nick_emoji(&self) -> bool { + self.nick_emoji + } } impl> ChatState { diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index e1e4e3d..8fbdb7b 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -22,9 +22,10 @@ pub fn widget<'a>( list: &'a mut ListState, joined: &Joined, focused: bool, + nick_emoji: bool, ) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); - render_rows(&mut list_builder, joined, focused); + render_rows(&mut list_builder, joined, focused, nick_emoji); list_builder.build(list) } @@ -70,6 +71,7 @@ fn render_rows( list_builder: &mut ListBuilder<'_, SessionId, Background>, joined: &Joined, focused: bool, + nick_emoji: bool, ) { let mut people = vec![]; let mut bots = vec![]; @@ -95,10 +97,38 @@ fn render_rows( lurkers.sort_unstable(); nurkers.sort_unstable(); - render_section(list_builder, "People", &people, &joined.session, focused); - render_section(list_builder, "Bots", &bots, &joined.session, focused); - render_section(list_builder, "Lurkers", &lurkers, &joined.session, focused); - render_section(list_builder, "Nurkers", &nurkers, &joined.session, focused); + render_section( + list_builder, + "People", + &people, + &joined.session, + focused, + nick_emoji, + ); + render_section( + list_builder, + "Bots", + &bots, + &joined.session, + focused, + nick_emoji, + ); + render_section( + list_builder, + "Lurkers", + &lurkers, + &joined.session, + focused, + nick_emoji, + ); + render_section( + list_builder, + "Nurkers", + &nurkers, + &joined.session, + focused, + nick_emoji, + ); } fn render_section( @@ -107,6 +137,7 @@ fn render_section( sessions: &[HalfSession], own_session: &SessionView, focused: bool, + nick_emoji: bool, ) { if sessions.is_empty() { return; @@ -124,7 +155,7 @@ fn render_section( list_builder.add_unsel(Text::new(row).background()); for session in sessions { - render_row(list_builder, session, own_session, focused); + render_row(list_builder, session, own_session, focused, nick_emoji); } } @@ -133,6 +164,7 @@ fn render_row( session: &HalfSession, own_session: &SessionView, focused: bool, + nick_emoji: bool, ) { let (name, style, style_inv, perms_style_inv) = if session.name.is_empty() { let name = "lurk".to_string(); @@ -166,16 +198,24 @@ fn render_row( " " }; + let emoji = if nick_emoji { + format!(" ({})", euph::user_id_emoji(&session.id)) + } else { + "".to_string() + }; + list_builder.add_sel(session.session_id.clone(), move |selected| { if focused && selected { let text = Styled::new_plain(owner) .then(name, style_inv) - .then(perms, perms_style_inv); + .then(perms, perms_style_inv) + .then(emoji, perms_style_inv); Text::new(text).background().with_style(style_inv) } else { let text = Styled::new_plain(owner) .then(&name, style) - .then_plain(perms); + .then_plain(perms) + .then_plain(emoji); Text::new(text).background() } }); diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index ebae5a8..fe1f768 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -291,11 +291,16 @@ impl EuphRoom { joined: &Joined, focus: Focus, ) -> BoxedAsync<'a, UiError> { - let nick_list_widget = nick_list::widget(nick_list, joined, focus == Focus::NickList) - .padding() - .with_right(1) - .border() - .desync(); + let nick_list_widget = nick_list::widget( + nick_list, + joined, + focus == Focus::NickList, + chat.nick_emoji(), + ) + .padding() + .with_right(1) + .border() + .desync(); let chat_widget = chat.widget(joined.session.name.clone(), focus == Focus::Chat); From 2ca6190d97fb9ae7da4189720f89ba0b7579b02b Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 31 May 2025 15:08:24 +0200 Subject: [PATCH 108/109] Use older ubuntu runner for older glibc version --- .github/workflows/build.yml | 6 +++--- CHANGELOG.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 012c48e..4660d0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: - - ubuntu-latest + - ubuntu-22.04 - windows-latest - macos-latest - macos-13 @@ -59,11 +59,11 @@ jobs: - name: Zip artifacts run: | - chmod +x cove-ubuntu-latest/cove + chmod +x cove-ubuntu-22.04/cove chmod +x cove-windows-latest/cove.exe chmod +x cove-macos-latest/cove chmod +x cove-macos-13/cove - zip -jr "cove-$(cat cove-ubuntu-latest/host).zip" cove-ubuntu-latest/cove + zip -jr "cove-$(cat cove-ubuntu-22.04/host).zip" cove-ubuntu-22.04/cove zip -jr "cove-$(cat cove-windows-latest/host).zip" cove-windows-latest/cove.exe zip -jr "cove-$(cat cove-macos-latest/host).zip" cove-macos-latest/cove zip -jr "cove-$(cat cove-macos-13/host).zip" cove-macos-13/cove diff --git a/CHANGELOG.md b/CHANGELOG.md index 76fa94a..3f9ce8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Procedure when bumping the version number: ### Changed - Display emoji user id hashes in the nick list +- Compile linux binary with older glibc version ## v0.9.3 - 2025-05-31 From 10214f33695ad3eb8b87802d8d683cea5c618bf4 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 27 Jun 2025 11:03:06 +0200 Subject: [PATCH 109/109] Fix clippy warning --- cove/src/ui/euph/room.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index fe1f768..7e8ff99 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -121,7 +121,7 @@ impl EuphRoom { .server_config .clone() .room(self.vault().room().name.clone()) - .name(format!("{room:?}-{}", next_instance_id)) + .name(format!("{room:?}-{next_instance_id}")) .human(true) .username(self.room_config.username.clone()) .force_username(self.room_config.force_username)