diff --git a/Cargo.lock b/Cargo.lock index c4e09a1..07328a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "aead" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99" +dependencies = [ + "crypto-common 0.2.2", + "inout 0.2.2", +] + [[package]] name = "aegis" version = "0.9.15" @@ -35,7 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures 0.2.17", ] @@ -45,9 +55,9 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead", + "aead 0.5.2", "aes", - "cipher", + "cipher 0.4.4", "ctr", "ghash", "subtle", @@ -291,6 +301,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "base16ct" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6" + [[package]] name = "base64" version = "0.22.1" @@ -493,9 +509,9 @@ dependencies = [ "encoding_rs", "fast-float2", "log", - "quick-xml", + "quick-xml 0.41.0", "serde", - "zip", + "zip 8.6.0", ] [[package]] @@ -543,17 +559,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18758054972164c3264f7c8386f5fc6da6114cb46b619fd365d4e3b2dc3ae487" -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures 0.2.17", -] - [[package]] name = "chacha20" version = "0.10.2" @@ -561,21 +566,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", + "cipher 0.5.2", "cpufeatures 0.3.1", "rand_core 0.10.1", ] [[package]] name = "chacha20poly1305" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +checksum = "9b89e1c441e926b9c82a8d023f6e1b7ae0adcfaa7d621814e4d60789bac751cb" dependencies = [ - "aead", - "chacha20 0.9.1", - "cipher", + "aead 0.6.1", + "chacha20", + "cipher 0.5.2", "poly1305", - "zeroize", ] [[package]] @@ -598,8 +603,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common 0.1.7", - "inout", - "zeroize", + "inout 0.1.4", +] + +[[package]] +name = "cipher" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" +dependencies = [ + "block-buffer 0.12.1", + "crypto-common 0.2.2", + "inout 0.2.2", ] [[package]] @@ -649,6 +664,12 @@ dependencies = [ "cc", ] +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + [[package]] name = "codemap" version = "0.1.3" @@ -707,12 +728,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - [[package]] name = "const-oid" version = "0.10.2" @@ -759,6 +774,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" +[[package]] +name = "cpubits" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -835,6 +856,20 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271" +dependencies = [ + "cpubits", + "ctutils", + "num-traits", + "rand_core 0.10.1", + "serdect", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -852,7 +887,19 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ + "getrandom 0.4.3", "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "crypto-primes" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f" +dependencies = [ + "crypto-bigint", + "rand_core 0.10.1", ] [[package]] @@ -861,7 +908,16 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", +] + +[[package]] +name = "ctutils" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +dependencies = [ + "cmov", ] [[package]] @@ -918,11 +974,11 @@ checksum = "7eed2c4702fa172d1ce21078faa7c5203e69f5394d48cc436d25928394a867a2" [[package]] name = "der" -version = "0.7.10" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a" dependencies = [ - "const-oid 0.9.6", + "const-oid", "pem-rfc7468", "zeroize", ] @@ -943,7 +999,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid 0.9.6", "crypto-common 0.1.7", "subtle", ] @@ -955,7 +1010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer 0.12.1", - "const-oid 0.10.2", + "const-oid", "crypto-common 0.2.2", ] @@ -1783,16 +1838,15 @@ dependencies = [ [[package]] name = "im-client" version = "0.1.0" -source = "git+https://github.com/DizeyLab/im?rev=509d0e7#509d0e7b19104ad3ae2e1dc82c65e1f38dfe7d9b" +source = "git+https://github.com/DizeyLab/im?rev=25140f3#25140f308a711d4090fa75bb29558a3f5335587c" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "chacha20poly1305", "rand 0.10.2", "reqwest", "rsa", "serde", "serde_json", - "sha2 0.10.9", "sha2 0.11.0", "subtle", "thiserror", @@ -1820,6 +1874,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "inout" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7" +dependencies = [ + "hybrid-array", +] + [[package]] name = "intrusive-collections" version = "0.9.7" @@ -1889,16 +1952,15 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" name = "iz-client" version = "0.1.0" dependencies = [ - "base64 0.22.1", + "base64 0.23.1", "chacha20poly1305", "http", "rand 0.10.2", - "rand_core 0.6.4", + "rand_core 0.10.1", "reqwest", "rsa", "serde", "serde_json", - "sha2 0.10.9", "sha2 0.11.0", "subtle", "thiserror", @@ -1912,7 +1974,7 @@ name = "iz-core" version = "0.1.0" dependencies = [ "async-trait", - "base64 0.22.1", + "base64 0.23.1", "chacha20poly1305", "rand 0.10.2", "serde", @@ -1924,7 +1986,7 @@ dependencies = [ "toml", "turso", "ulid", - "zip", + "zip 9.0.0-pre3", ] [[package]] @@ -1942,17 +2004,17 @@ dependencies = [ "iz-core", "lettre", "parking_lot", - "quick-xml", + "quick-xml 0.42.0", "reqwest", "serde", "serde_json", - "sha2 0.10.9", + "sha2 0.11.0", "thiserror", "time", "tokio", "topcoat", "ulid", - "zip", + "zip 9.0.0-pre3", ] [[package]] @@ -2039,9 +2101,6 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -dependencies = [ - "spin", -] [[package]] name = "lazycell" @@ -2411,22 +2470,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-bigint-dig" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" -dependencies = [ - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.8.8", - "smallvec", - "zeroize", -] - [[package]] name = "num-conv" version = "0.2.2" @@ -2442,16 +2485,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -2459,7 +2492,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -2556,9 +2588,9 @@ checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" [[package]] name = "pem-rfc7468" -version = "0.7.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" dependencies = [ "base64ct", ] @@ -2619,20 +2651,19 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkcs1" -version = "0.7.5" +version = "0.8.0-rc.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +checksum = "986d2e952779af96ea048f160fd9194e1751b4faea78bcf3ceb456efe008088e" dependencies = [ "der", - "pkcs8", "spki", ] [[package]] name = "pkcs8" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" dependencies = [ "der", "spki", @@ -2660,13 +2691,12 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +checksum = "6e2d0073b297041425c7c3df6eb4792d598a15323fe63346852b092eca02904c" dependencies = [ - "cpufeatures 0.2.17", - "opaque-debug", - "universal-hash", + "cpufeatures 0.3.1", + "universal-hash 0.6.1", ] [[package]] @@ -2678,7 +2708,7 @@ dependencies = [ "cfg-if", "cpufeatures 0.2.17", "opaque-debug", - "universal-hash", + "universal-hash 0.5.1", ] [[package]] @@ -2778,6 +2808,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + [[package]] name = "quinn" version = "0.11.11" @@ -2895,7 +2934,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ - "chacha20 0.10.2", + "chacha20", "getrandom 0.4.3", "rand_core 0.10.1", ] @@ -3115,21 +3154,19 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.10" +version = "0.10.0-rc.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +checksum = "30b2aa4ba0d89f73d1e332df05be0eeab8840351c36ca5654341dfdb57bb3caf" dependencies = [ - "const-oid 0.9.6", - "digest 0.10.7", - "num-bigint-dig", - "num-integer", - "num-traits", + "const-oid", + "crypto-bigint", + "crypto-primes", + "digest 0.11.3", "pkcs1", "pkcs8", - "rand_core 0.6.4", + "rand_core 0.10.1", "signature", "spki", - "subtle", "zeroize", ] @@ -3423,6 +3460,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serdect" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e" +dependencies = [ + "base16ct", + "serde", +] + [[package]] name = "sha1" version = "0.10.7" @@ -3515,12 +3562,12 @@ dependencies = [ [[package]] name = "signature" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", + "digest 0.11.3", + "rand_core 0.10.1", ] [[package]] @@ -3605,9 +3652,9 @@ checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" [[package]] name = "spki" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f" dependencies = [ "base64ct", "der", @@ -4070,14 +4117,13 @@ checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" [[package]] name = "topcoat" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "050c11e7b0e146a2b1eb15855abd5fa03e2754eb880922f8b6cab5ec71cac5aa" +checksum = "f3c199295b1c52e0a9c88a2b0518f6bc7522503cd0bb06d9f4742c515ac4df0a" dependencies = [ "futures-util", "inventory", "serde", - "serde_urlencoded", "tokio", "tokio-tungstenite", "topcoat-asset", @@ -4098,9 +4144,9 @@ dependencies = [ [[package]] name = "topcoat-asset" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a72e4ba8cb6a9d29613a25c2151e72d887b4a79b3f179b497734eed0e65ea702" +checksum = "fba199ae779d0409672929e7c32711ac35e87c9e39e0823d0b33b6293e3e0011" dependencies = [ "http", "memchr", @@ -4116,9 +4162,9 @@ dependencies = [ [[package]] name = "topcoat-cookie" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68c83654c4bf075f667d39463cd38ef0be9fee057054454b06612efe16e7a37" +checksum = "3cb0bf2f95c1931d32d579389695e8cf221d114f9629a57fc005d7a0bb459c0d" dependencies = [ "cookie", "getrandom 0.2.17", @@ -4131,9 +4177,9 @@ dependencies = [ [[package]] name = "topcoat-core" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f94adaa301d7a4b949d650fa803323c00cc8ffa8bf1984511c1ec5d390b6c6" +checksum = "d88c5ed693dd383ba8a4112f5b665bdb7e979ada413a7b5f9ede6935fe18e8e6" dependencies = [ "anyhow", "anymap3", @@ -4147,9 +4193,9 @@ dependencies = [ [[package]] name = "topcoat-core-grammar" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0756aa9285794c155624494bc563d56859e35205313db883a89d7dabfa6d0393" +checksum = "ce257f5c2248b4d7bf1bbd76a0e71709221f06d690462a49aad5929732c42001" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4159,9 +4205,9 @@ dependencies = [ [[package]] name = "topcoat-core-macro" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4908dba6268c8592be73e9059cdefa053066e1b1bc879c1c9a5d8d3b6e97aad" +checksum = "5d239098a8c674f16120e7bfcba6f670865c807eec2a0e2648cb319d300fab39" dependencies = [ "quote", "syn 2.0.119", @@ -4170,9 +4216,9 @@ dependencies = [ [[package]] name = "topcoat-font" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7b8308aff65f46bbe2f58371fc9823db596236bd0ea3c9d87de6534fd977e60" +checksum = "8ccc2da492bfdcf2d23d761b60338eb20ad178fd754ef19570abe6030663137d" dependencies = [ "heck", "inventory", @@ -4187,9 +4233,9 @@ dependencies = [ [[package]] name = "topcoat-font-grammar" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d68e226827fb7531d0dba69cb74fa7b82515f8428fd1a75f556f5a2bf87c1" +checksum = "6125e270bb16bf826a54e4b40b41484682b2b660af4803688887f64a9918745a" dependencies = [ "proc-macro2", "quote", @@ -4200,9 +4246,9 @@ dependencies = [ [[package]] name = "topcoat-font-macro" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e655c430bcb380f879603ea750c6222ade2ff3ade33869d9eaa32e3fc49f5469" +checksum = "5f46d0a9c08e7bf774683c05add490824af80a844f410e6ffc9fdaf00c88d7be" dependencies = [ "quote", "syn 2.0.119", @@ -4211,9 +4257,9 @@ dependencies = [ [[package]] name = "topcoat-mail" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959c9c32172ad3840f94c589a29bd143c072661c9abf2215a68fd76440ed2300" +checksum = "1b8fa0e1ad5a4f4419c50b783ac565426df5c30dfa3dc9ca9602c8cd1c3535a3" dependencies = [ "lettre", "thiserror", @@ -4225,9 +4271,9 @@ dependencies = [ [[package]] name = "topcoat-router" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e062bd348df5647f6904f4f4045b3c92c08c4a8826196e8e91a51aade00b5764" +checksum = "9f452945373fac2b61a4050639681829e99afeea872faebc93ef0b03c4211335" dependencies = [ "bytes", "form_urlencoded", @@ -4243,6 +4289,7 @@ dependencies = [ "matchit", "multer", "percent-encoding", + "pin-project-lite", "ref-cast", "serde", "serde_json", @@ -4257,9 +4304,9 @@ dependencies = [ [[package]] name = "topcoat-router-grammar" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c052423d2aa4039036f1ac5567d1e2dac48897602d34561b3024a87830e5bdce" +checksum = "188df45ec401d790e3dd84564580c5c436a456331a187bdbfb7441f8e48fa1ca" dependencies = [ "heck", "proc-macro2", @@ -4270,9 +4317,9 @@ dependencies = [ [[package]] name = "topcoat-router-macro" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea98692b786bab3adda35a60d71981f60b2a98c6e7105ac92e582b7c9ce9cab" +checksum = "ac6f9a61d3ecfe1252b861795070c4317aca6b816382919d9c941eccad2fe42d" dependencies = [ "quote", "syn 2.0.119", @@ -4281,9 +4328,9 @@ dependencies = [ [[package]] name = "topcoat-runtime" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dea200c86ca554bab7410f09cae8790a8adcbfd8f306eb78db7092ca71f8aae" +checksum = "b75367a6fb32878f28bb1e42fe97385c9b14f1d3455b0bb69afb399260a8995a" dependencies = [ "inventory", "ref-cast", @@ -4293,14 +4340,13 @@ dependencies = [ "topcoat-core", "topcoat-router", "topcoat-view", - "uuid", ] [[package]] name = "topcoat-runtime-grammar" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b73f7e4e10f49e006a71dd43e8ee629c76c08451acbc51faa7ec5b6952c53c" +checksum = "c19d5cf0ad59525a9fdd0a6ada36448833b39b85602736df16d32712f6c3a3c8" dependencies = [ "proc-macro2", "quote", @@ -4314,9 +4360,9 @@ dependencies = [ [[package]] name = "topcoat-runtime-macro" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc3e4e245abcaea6af780437cae072e8f2157c9852ec5b3058a658c61b9e0bf" +checksum = "3504cd2966788c4cb6f417a9f73faf3ae2631c5aa415bc0d37d142ba597d5c42" dependencies = [ "quote", "syn 2.0.119", @@ -4325,9 +4371,9 @@ dependencies = [ [[package]] name = "topcoat-session" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e079e8c5a63987d7f929ab05a75922feab1fe390a9cfa2c101eb35829e67eac2" +checksum = "d432a276f3d7e4e0af0f9789ee0c919fbfbf8d2025d0dac7f8072a918521cf6d" dependencies = [ "base64 0.22.1", "getrandom 0.4.3", @@ -4342,25 +4388,26 @@ dependencies = [ [[package]] name = "topcoat-view" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5904449bd6f633759d187fa621ded68178b551428c297959fd53d8fb91f3e6f6" +checksum = "4acc959c83729cb4b967c2e7de8ee78a2fc3216cceb1be650ee9524fabd26baa" dependencies = [ + "base64 0.22.1", "futures-core", "futures-util", "http", - "itoa", "memchr", "pin-project-lite", + "siphasher", "smallvec", "topcoat-core", ] [[package]] name = "topcoat-view-grammar" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf4293156d7c5fa7960edc573b686eb27426dcd888bfbe9e532304178cdda24" +checksum = "fa71393a00dba3ce203d3236e24311851134721f5bfae6a17bfacd709a983660" dependencies = [ "heck", "proc-macro2", @@ -4372,9 +4419,9 @@ dependencies = [ [[package]] name = "topcoat-view-macro" -version = "0.6.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ab2b200eda4516abdb543f307006d83fedd3681b871d2042c17106c688f716" +checksum = "2a625be243364f6674204ba412700d9eed2a1c9168f7add3b1020be4825f0e49" dependencies = [ "quote", "syn 2.0.119", @@ -4792,11 +4839,11 @@ dependencies = [ [[package]] name = "ulid" -version = "1.2.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe" +checksum = "947dde63b6d514cc5e044edad4e0ca7261afd1099d16c83d942cb2b2f348689c" dependencies = [ - "rand 0.9.5", + "rand 0.10.2", "web-time", ] @@ -4837,6 +4884,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "universal-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96" +dependencies = [ + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -5379,6 +5436,20 @@ dependencies = [ "zopfli", ] +[[package]] +name = "zip" +version = "9.0.0-pre3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e8082c6efe6dbccc7e8ea3ebf6afe46a04847f2e0bcf772c8aebc933dd2ccf" +dependencies = [ + "crc32fast", + "flate2", + "indexmap", + "memchr", + "typed-path", + "zopfli", +] + [[package]] name = "zlib-rs" version = "0.6.7" diff --git a/Cargo.toml b/Cargo.toml index 17f0cc6..cb6d45f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,21 +11,21 @@ repository = "https://github.com/DizeyLab/iz" [workspace.dependencies] iz-core = { path = "crates/iz-core", default-features = false } iz-client = { path = "crates/iz-client" } -im-client = { git = "https://github.com/DizeyLab/im", rev = "509d0e7", default-features = false } +im-client = { git = "https://github.com/DizeyLab/im", rev = "25140f3", default-features = false } serde = { version = "1.0.229", features = ["derive"] } serde_json = "1.0.151" thiserror = "2.0.20" -ulid = "1" +ulid = "3" time = { version = "0.3.55", features = ["serde", "formatting", "parsing", "macros"] } tokio = { version = "1.53.1", features = ["full"] } turso = "=0.8.0-pre.10" rand = "0.10.2" sha2 = "0.11.0" subtle = "2.6.1" -chacha20poly1305 = "0.10.1" -base64 = "0.22.1" +chacha20poly1305 = "0.11.0" +base64 = "0.23.1" toml = "1" -zip = { version = "8.6.0", default-features = false, features = ["deflate"] } +zip = { version = "9.0.0-pre3", default-features = false, features = ["deflate"] } [profile.release] codegen-units = 1 diff --git a/crates/iz-client/Cargo.toml b/crates/iz-client/Cargo.toml index e294826..f2d8b50 100644 --- a/crates/iz-client/Cargo.toml +++ b/crates/iz-client/Cargo.toml @@ -7,7 +7,7 @@ repository.workspace = true description = "Drop-in OIDC client for topcoat apps authenticating against im (vendored from im-client via in-client)" [dependencies] -topcoat = { version = "0.6.2", default-features = false, features = [ +topcoat = { version = "0.8.0", default-features = false, features = [ "router", "cookie", ] } @@ -21,10 +21,9 @@ rand.workspace = true sha2.workspace = true subtle.workspace = true chacha20poly1305.workspace = true -# rsa 0.9 verifies through the digest 0.10 traits, so its hasher comes from -# the sha2 0.10 line; the workspace sha2 0.11 stays for PKCE. -sha2-for-rsa = { package = "sha2", version = "0.10", features = ["oid"] } -rsa = "0.9.10" +# rsa 0.10 verifies through the digest 0.11 traits, so its hasher is the +# workspace sha2 0.11 that PKCE already uses. +rsa = "0.10.0-rc.18" reqwest = { version = "0.13.5", default-features = false, features = [ "rustls", "json", @@ -36,7 +35,7 @@ reqwest = { version = "0.13.5", default-features = false, features = [ test-seam = [] [dev-dependencies] -topcoat = { version = "0.6.2", default-features = false, features = [ +topcoat = { version = "0.8.0", default-features = false, features = [ "router", "cookie", "view", @@ -44,9 +43,9 @@ topcoat = { version = "0.6.2", default-features = false, features = [ "discover", ] } http = "1.5" -# Tests generate their own RSA keys, and rsa 0.9's RNG is the rand_core 0.6 -# line. -rand_core06 = { package = "rand_core", version = "0.6.4", features = ["getrandom"] } +# Tests generate their own RSA keys, and rsa 0.10's RNG is the rand_core 0.10 +# line that the workspace rand 0.10 provides. +rand_core010 = { package = "rand_core", version = "0.10.1" } [[example]] name = "mint" diff --git a/crates/iz-client/src/lib.rs b/crates/iz-client/src/lib.rs index ba8453b..1fc9b2b 100644 --- a/crates/iz-client/src/lib.rs +++ b/crates/iz-client/src/lib.rs @@ -350,7 +350,7 @@ fn seal(key: &[u8; 32], plaintext: &[u8]) -> String { let mut nonce_bytes = [0u8; 24]; rand::rng().fill_bytes(&mut nonce_bytes); let ciphertext = cipher - .encrypt(XNonce::from_slice(&nonce_bytes), plaintext) + .encrypt(&XNonce::from(nonce_bytes), plaintext) .expect("XChaCha20-Poly1305 cannot fail on a payload this small"); let mut payload = nonce_bytes.to_vec(); payload.extend_from_slice(&ciphertext); @@ -364,9 +364,8 @@ fn open(key: &[u8; 32], sealed: &str) -> Option> { } let (nonce_bytes, ciphertext) = payload.split_at(24); let cipher = XChaCha20Poly1305::new(key.into()); - cipher - .decrypt(XNonce::from_slice(nonce_bytes), ciphertext) - .ok() + let nonce: &XNonce = nonce_bytes.try_into().ok()?; + cipher.decrypt(nonce, ciphertext).ok() } fn seal_json(key: &[u8; 32], value: &T) -> String { @@ -737,7 +736,7 @@ fn verify_claims( .map_err(|e| Error::Token(e.to_string()))?; let signature = rsa::pkcs1v15::Signature::try_from(signature_bytes.as_slice()) .map_err(|e| Error::Token(e.to_string()))?; - let verifying = rsa::pkcs1v15::VerifyingKey::::new(key.clone()); + let verifying = rsa::pkcs1v15::VerifyingKey::::new(key.clone()); verifying .verify(format!("{}.{}", parts[0], parts[1]).as_bytes(), &signature) .map_err(|_| Error::Token("bad signature".into()))?; @@ -798,8 +797,8 @@ async fn refetch_jwks(state: &IzClient) -> Result<()> { continue; }; let key = rsa::RsaPublicKey::new( - rsa::BigUint::from_bytes_be(&n), - rsa::BigUint::from_bytes_be(&e), + rsa::BoxedUint::from_be_slice_vartime(&n), + rsa::BoxedUint::from_be_slice_vartime(&e), ) .map_err(|err| Error::Token(format!("bad jwk {kid}: {err}")))?; keys.push((kid.to_string(), key)); @@ -821,8 +820,8 @@ mod tests { fn keypair() -> (rsa::RsaPrivateKey, rsa::RsaPublicKey) { // 2048-bit generation is slow for a unit test; 1024 is the smallest - // rsa 0.9 accepts and the signature math under test is identical. - let private = rsa::RsaPrivateKey::new(&mut rand_core06::OsRng, 1024).unwrap(); + // rsa accepts and the signature math under test is identical. + let private = rsa::RsaPrivateKey::new(&mut rand::rng(), 1024).unwrap(); let public = private.to_public_key(); (private, public) } @@ -832,7 +831,7 @@ mod tests { let mut out = b64url.encode(header.to_string()); out.push('.'); out.push_str(&b64url.encode(claims.to_string())); - let signing = rsa::pkcs1v15::SigningKey::::new(key.clone()); + let signing = rsa::pkcs1v15::SigningKey::::new(key.clone()); let signature = signing.sign(out.as_bytes()); format!("{}.{}", out, b64url.encode(signature.to_bytes())) } @@ -1206,8 +1205,8 @@ mod tests { serde_json::json!({ "kty": "RSA", "kid": kid, - "n": b64url.encode(public.n().to_bytes_be()), - "e": b64url.encode(public.e().to_bytes_be()), + "n": b64url.encode(public.n().to_be_bytes_trimmed_vartime()), + "e": b64url.encode(public.e().to_be_bytes_trimmed_vartime()), }) } diff --git a/crates/iz-core/src/board.rs b/crates/iz-core/src/board.rs index 4ac10c9..6ee3a53 100644 --- a/crates/iz-core/src/board.rs +++ b/crates/iz-core/src/board.rs @@ -315,7 +315,7 @@ impl BoardView { for column in &mut self.columns { column.cards.retain(|card| match assignee { "none" => card.assignees.is_empty(), - id => card.assignees.iter().any(|person| &person.id == id), + id => card.assignees.iter().any(|person| person.id == id), }); } } diff --git a/crates/iz-core/src/config.rs b/crates/iz-core/src/config.rs index 1bc02c4..6ef3a3f 100644 --- a/crates/iz-core/src/config.rs +++ b/crates/iz-core/src/config.rs @@ -679,7 +679,7 @@ mod tests { std::fs::create_dir_all(dir.join("config")).unwrap(); std::fs::write( dir.join(FILE_NAME), - &format!("# mine\ndatabase = \"state/iz.db\"\n{OIDC}"), + format!("# mine\ndatabase = \"state/iz.db\"\n{OIDC}"), ) .unwrap(); @@ -1059,7 +1059,7 @@ mod tests { std::fs::create_dir_all(dir.join("config")).unwrap(); std::fs::write( dir.join(FILE_NAME), - &format!("database = \"iz.db\"\n{OIDC}"), + format!("database = \"iz.db\"\n{OIDC}"), ) .unwrap(); Config::load_from(&dir).unwrap(); diff --git a/crates/iz-core/src/store/mod.rs b/crates/iz-core/src/store/mod.rs index ca64424..4018a71 100644 --- a/crates/iz-core/src/store/mod.rs +++ b/crates/iz-core/src/store/mod.rs @@ -1046,6 +1046,7 @@ pub trait Store: BoardReads + DetailReads + 'static { /// saved, and records one activity line per field that actually changed. /// Returns the ids of the activity rows it wrote, in write order — empty /// when nothing changed — so the caller can hand each to the mail engine. + #[allow(clippy::too_many_arguments)] async fn save_task( &self, task_id: &str, diff --git a/crates/iz-core/src/store/reconcile.rs b/crates/iz-core/src/store/reconcile.rs index 22bd751..2b7fe3d 100644 --- a/crates/iz-core/src/store/reconcile.rs +++ b/crates/iz-core/src/store/reconcile.rs @@ -129,8 +129,8 @@ pub async fn reconcile( // Best-effort undo so the live file is not gone. If this also fails, // the caller has both the backup and the rebuilt file to recover from. let _ = std::fs::rename(&backup_path, path); - let _ = rename_sibling(&backup_path, path, "-wal"); - let _ = rename_sibling(&backup_path, path, "-shm"); + rename_sibling(&backup_path, path, "-wal"); + rename_sibling(&backup_path, path, "-shm"); return Err(StoreError::Backend(format!( "failed to move rebuilt database into place {}: {}", rebuilt_path, e @@ -242,7 +242,7 @@ async fn seed_general_tags(new_conn: &Connection) -> Result<()> { boards.push((board_id, created_at)); } for (board_id, created_at) in boards { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); new_conn .execute( "INSERT INTO main.tag (id, board_id, name, position, is_default, created_at) \ @@ -650,7 +650,7 @@ async fn extract_column( /// renamed onto the final name, so a reader of the final name never sees a /// partial file. fn write_blob(dir: &std::path::Path, id: &str, bytes: &[u8]) -> std::io::Result<()> { - let temp = dir.join(format!(".{}.tmp-{}", id, Ulid::new())); + let temp = dir.join(format!(".{}.tmp-{}", id, Ulid::generate())); std::fs::write(&temp, bytes)?; match std::fs::rename(&temp, dir.join(id)) { Ok(()) => Ok(()), @@ -1074,7 +1074,7 @@ mod tests { #[tokio::test] async fn validate_maps_refuses_a_declared_table_without_a_map() { - let dir = std::env::temp_dir().join(format!("iz-validate-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-validate-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); let db = Builder::new_local(&path).build().await.unwrap(); @@ -1235,7 +1235,7 @@ mod tests { /// column any more. #[tokio::test] async fn an_old_shaped_database_extracts_its_blobs_to_the_storage_dir() { - let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); let (attachment_bytes, photo_bytes) = old_shape_database(&path).await; @@ -1322,7 +1322,7 @@ mod tests { /// leaves the original file in place with nothing staged beside it. #[tokio::test] async fn a_rebuild_without_storage_refuses_to_drop_blobs() { - let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); old_shape_database(&path).await; diff --git a/crates/iz-core/src/store/schema.rs b/crates/iz-core/src/store/schema.rs index 9c5eb16..7a70280 100644 --- a/crates/iz-core/src/store/schema.rs +++ b/crates/iz-core/src/store/schema.rs @@ -52,11 +52,14 @@ pub async fn fingerprint(conn: &Connection) -> Result { .map_err(|e| StoreError::Backend(e.to_string()))?; let mut out = String::new(); - while let Some(row) = rows.next().await.map_err(|e| StoreError::Backend(e.to_string()))? { + while let Some(row) = rows + .next() + .await + .map_err(|e| StoreError::Backend(e.to_string()))? + { let t: String = row.get(0).map_err(|e| StoreError::Backend(e.to_string()))?; let name: String = row.get(1).map_err(|e| StoreError::Backend(e.to_string()))?; - let sql: Option = - row.get(2).map_err(|e| StoreError::Backend(e.to_string()))?; + let sql: Option = row.get(2).map_err(|e| StoreError::Backend(e.to_string()))?; out.push_str(&t); out.push('|'); out.push_str(&name); @@ -75,7 +78,9 @@ pub async fn declared_fingerprint() -> Result { .build() .await .map_err(|e| StoreError::Backend(e.to_string()))?; - let conn = db.connect().map_err(|e| StoreError::Backend(e.to_string()))?; + let conn = db + .connect() + .map_err(|e| StoreError::Backend(e.to_string()))?; conn.execute_batch(&schema_sql()) .await .map_err(|e| StoreError::Backend(e.to_string()))?; @@ -115,14 +120,20 @@ pub(crate) fn diff_report(old: &str, new: &str) -> String { let mut changed = Vec::new(); for old_obj in &old_objs { - match new_objs.iter().find(|n| n.kind == old_obj.kind && n.name == old_obj.name) { + match new_objs + .iter() + .find(|n| n.kind == old_obj.kind && n.name == old_obj.name) + { Some(new_obj) if new_obj.sql != old_obj.sql => changed.push((old_obj, new_obj)), Some(_) => {} None => missing.push(old_obj), } } for new_obj in &new_objs { - if !old_objs.iter().any(|o| o.kind == new_obj.kind && o.name == new_obj.name) { + if !old_objs + .iter() + .any(|o| o.kind == new_obj.kind && o.name == new_obj.name) + { extra.push(new_obj); } } @@ -204,10 +215,10 @@ fn extract_column_names(sql: &str) -> Vec { _ => current.push(ch), } } - if !current.is_empty() { - if let Some(col) = first_identifier(¤t) { - cols.push(col); - } + if !current.is_empty() + && let Some(col) = first_identifier(¤t) + { + cols.push(col); } cols } @@ -263,7 +274,7 @@ fn normalize_schema(sql: &str) -> String { if ch == '-' && chars.peek() == Some(&'-') { chars.next(); - while let Some(c) = chars.next() { + for c in chars.by_ref() { if c == '\n' { break; } @@ -364,7 +375,8 @@ mod tests { fn if_not_exists_does_not_corrupt_identifiers() { // The stripper looks for whole tokens; words that merely appear // inside identifiers or string literals must stay put. - let a = "CREATE TABLE IF NOT EXISTS notification (if_not_exists TEXT DEFAULT 'IF NOT EXISTS');"; + let a = + "CREATE TABLE IF NOT EXISTS notification (if_not_exists TEXT DEFAULT 'IF NOT EXISTS');"; let b = "CREATE TABLE notification (if_not_exists TEXT DEFAULT 'IF NOT EXISTS');"; assert_eq!(normalize_schema(a), normalize_schema(b)); } diff --git a/crates/iz-core/src/store/secret.rs b/crates/iz-core/src/store/secret.rs index 0a76293..7831e04 100644 --- a/crates/iz-core/src/store/secret.rs +++ b/crates/iz-core/src/store/secret.rs @@ -26,8 +26,8 @@ use std::io; use std::path::Path; -use base64::Engine; use base64::engine::general_purpose::STANDARD as base64; +use base64::Engine; use chacha20poly1305::aead::Aead; use chacha20poly1305::{KeyInit, XChaCha20Poly1305, XNonce}; use rand::Rng; @@ -57,9 +57,9 @@ pub fn seal(key: &Key, plaintext: &str) -> String { let cipher = XChaCha20Poly1305::new(key.into()); let mut nonce_bytes = [0u8; NONCE_BYTES]; rand::rng().fill_bytes(&mut nonce_bytes); - let nonce = XNonce::from_slice(&nonce_bytes); + let nonce = XNonce::from(nonce_bytes); let ciphertext = cipher - .encrypt(nonce, plaintext.as_bytes()) + .encrypt(&nonce, plaintext.as_bytes()) .expect("XChaCha20-Poly1305 cannot fail to encrypt a plaintext this small"); let mut payload = Vec::with_capacity(NONCE_BYTES + ciphertext.len()); payload.extend_from_slice(&nonce_bytes); @@ -80,7 +80,7 @@ pub fn open(key: &Key, sealed: &str) -> Option { } let (nonce_bytes, ciphertext) = payload.split_at(NONCE_BYTES); let cipher = XChaCha20Poly1305::new(key.into()); - let nonce = XNonce::from_slice(nonce_bytes); + let nonce: &XNonce = nonce_bytes.try_into().ok()?; let plaintext = cipher.decrypt(nonce, ciphertext).ok()?; String::from_utf8(plaintext).ok() } diff --git a/crates/iz-core/src/store/turso_store.rs b/crates/iz-core/src/store/turso_store.rs index dbf6e1a..05cf83c 100644 --- a/crates/iz-core/src/store/turso_store.rs +++ b/crates/iz-core/src/store/turso_store.rs @@ -818,7 +818,7 @@ impl TursoStore { subject, body) \ VALUES (?1, ?2, ?3, 'pending', 0, ?4, ?5, 'reminder', ?6, ?7)", params![ - Ulid::new().to_string(), + Ulid::generate().to_string(), task_id, email, stamp(now)?, @@ -1067,7 +1067,7 @@ fn ensure_storage_dirs(storage: &std::path::Path) -> Result<()> { /// is exactly what the boot sweep deletes. fn write_file_atomic(path: &std::path::Path, bytes: &[u8]) -> std::io::Result<()> { use std::io::Write as _; - let tmp = path.with_extension(format!("{}.tmp", Ulid::new())); + let tmp = path.with_extension(format!("{}.tmp", Ulid::generate())); let mut file = std::fs::File::create(&tmp)?; file.write_all(bytes)?; file.sync_all()?; @@ -1500,8 +1500,8 @@ impl Store for TursoStore { // The first sign-in is the whole setup: the workspace // and the board it is never without, the way the old // claim screen built them with the first account. - let workspace_id = Ulid::new().to_string(); - let board_id = Ulid::new().to_string(); + let workspace_id = Ulid::generate().to_string(); + let board_id = Ulid::generate().to_string(); tx.execute( "INSERT INTO workspace (id, name, created_at) VALUES (?1, 'iz', ?2)", params![workspace_id.clone(), now.clone()], @@ -1525,7 +1525,7 @@ impl Store for TursoStore { "INSERT INTO board_column (id, board_id, name, position, is_done) \ VALUES (?1, ?2, ?3, ?4, ?5)", params![ - Ulid::new().to_string(), + Ulid::generate().to_string(), board_id.clone(), *name, position as i64, @@ -1538,14 +1538,14 @@ impl Store for TursoStore { tx.execute( "INSERT INTO tag (id, board_id, name, position, is_default, created_at) \ VALUES (?1, ?2, 'General', 0, 1, ?3)", - params![Ulid::new().to_string(), board_id.clone(), now.clone()], + params![Ulid::generate().to_string(), board_id.clone(), now.clone()], ) .await .map_err(backend)?; workspace_id } }; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); tx.execute( "INSERT INTO user (id, workspace_id, oidc_sub, email, display_name, role, \ disabled, created_at, last_signed_in_at) \ @@ -1700,7 +1700,7 @@ impl Store for TursoStore { // Born linked: the directory vouches the subject, so // the row never waits unclaimed — assignment, mail // and the avatar proxy work before the first visit. - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let role = if im_admin { Role::Admin } else { Role::Member }; tx.execute( "INSERT INTO user (id, workspace_id, oidc_sub, email, display_name, \ @@ -1790,7 +1790,7 @@ impl Store for TursoStore { if seen.is_some() { return Err(StoreError::Conflict("member")); } - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let now = now_text()?; let conn = self.conn.lock().await; // Unclaimed: no sub, never signed in. The guards read such a row @@ -2196,7 +2196,7 @@ impl Store for TursoStore { is_done: bool, ) -> Result { let conn = self.conn.lock().await; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); conn.execute( "INSERT INTO board_column (id, board_id, name, position, is_done) \ VALUES (?1, ?2, ?3, ?4, ?5)", @@ -2215,9 +2215,9 @@ impl Store for TursoStore { } async fn create_task(&self, new: NewTask<'_>) -> Result { - let id = Ulid::new().to_string(); - let activity_id = Ulid::new().to_string(); - let transition_id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); + let activity_id = Ulid::generate().to_string(); + let transition_id = Ulid::generate().to_string(); let at = OffsetDateTime::now_utc(); let now = stamp(at)?; let deadline = new.deadline.map(day_text).transpose()?; @@ -2772,8 +2772,8 @@ impl Store for TursoStore { body: &str, at: OffsetDateTime, ) -> Result { - let comment_id = Ulid::new().to_string(); - let activity_id = Ulid::new().to_string(); + let comment_id = Ulid::generate().to_string(); + let activity_id = Ulid::generate().to_string(); let when = stamp(at)?; let mut conn = self.tx_conn().await?; @@ -2824,7 +2824,7 @@ impl Store for TursoStore { // deletes, never a row pointing at nothing. If the row write fails, // the file is unlinked best-effort — the row was never born, so the // bytes must not outlive it under a name nothing points at. - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let size = new.bytes.len() as i64; let path = attachment_file(&self.storage, &id); write_file_atomic(&path, &new.bytes).map_err(|e| StoreError::Backend(e.to_string()))?; @@ -3136,7 +3136,7 @@ impl Store for TursoStore { } let mut ids = Vec::with_capacity(lines.len()); for (kind, detail) in lines { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); tx.execute( "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, ?2, ?3, NULL, ?4, ?5, ?6)", @@ -3194,7 +3194,7 @@ impl Store for TursoStore { at: OffsetDateTime, ) -> Result { let stamp = stamp(at)?; - let transition_id = Ulid::new().to_string(); + let transition_id = Ulid::generate().to_string(); // Dropping a card back where it came from is not a move. Answer before // opening a transaction: there is nothing to serialise. @@ -3335,7 +3335,7 @@ impl Store for TursoStore { "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, ?2, ?3, NULL, ?4, ?5, ?6)", params![ - Ulid::new().to_string(), + Ulid::generate().to_string(), task_id, actor_id, ActivityKind::Moved.as_str(), @@ -3469,7 +3469,7 @@ impl Store for TursoStore { params![task_id, stamp.clone()], ) .await?; - let deleted_activity_id = Ulid::new().to_string(); + let deleted_activity_id = Ulid::generate().to_string(); tx.execute( "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, ?2, ?3, NULL, ?4, '', ?5)", @@ -3507,7 +3507,7 @@ impl Store for TursoStore { "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, ?2, NULL, NULL, ?3, ?4, ?5)", params![ - Ulid::new().to_string(), + Ulid::generate().to_string(), blocked.clone(), ActivityKind::Unblocked.as_str(), format!("{task_key} was deleted"), @@ -3526,7 +3526,7 @@ impl Store for TursoStore { None } else { let event = Freeing { - id: Ulid::new().to_string(), + id: Ulid::generate().to_string(), board_id, cause_key: task_key.clone(), cause_title: title, @@ -3676,7 +3676,7 @@ impl Store for TursoStore { at: OffsetDateTime, ) -> Result { let conn = self.conn.lock().await; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); conn.execute( "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)", @@ -3706,7 +3706,7 @@ impl Store for TursoStore { at: OffsetDateTime, ) -> Result { let conn = self.conn.lock().await; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); conn.execute( "INSERT INTO activity (id, task_id, actor_id, subject_id, kind, detail, created_at) \ VALUES (?1, NULL, ?2, NULL, ?3, ?4, ?5)", @@ -3731,7 +3731,7 @@ impl Store for TursoStore { at: OffsetDateTime, include_task_details: bool, ) -> Result { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let (kind, column) = trigger_parts(trigger); self.conn .lock() @@ -3844,7 +3844,7 @@ impl Store for TursoStore { at: parse_stamp(&text(&row, 5)?)?, }))); } - match self + if let Some(row) = self .one_row( "SELECT id, board_id, cause_key, cause_title, actor_id, created_at \ FROM freeing WHERE id = ?1", @@ -3852,17 +3852,14 @@ impl Store for TursoStore { ) .await? { - Some(row) => { - return Ok(Some(Event::Freed(Freeing { - id: text(&row, 0)?, - board_id: text(&row, 1)?, - cause_key: text(&row, 2)?, - cause_title: text(&row, 3)?, - actor_id: text(&row, 4)?, - at: parse_stamp(&text(&row, 5)?)?, - }))); - } - None => {} + return Ok(Some(Event::Freed(Freeing { + id: text(&row, 0)?, + board_id: text(&row, 1)?, + cause_key: text(&row, 2)?, + cause_title: text(&row, 3)?, + actor_id: text(&row, 4)?, + at: parse_stamp(&text(&row, 5)?)?, + }))); } match self .one_row( @@ -3952,7 +3949,7 @@ impl Store for TursoStore { at: OffsetDateTime, until: OffsetDateTime, ) -> Result> { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); // The index is the decision. `DO NOTHING` turns the second engine run // into zero rows affected rather than an error to interpret, and the // caller that gets `None` sends nothing. @@ -3997,7 +3994,7 @@ impl Store for TursoStore { body: &str, at: OffsetDateTime, ) -> Result { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); self.conn .lock() .await @@ -4027,7 +4024,7 @@ impl Store for TursoStore { body: &str, at: OffsetDateTime, ) -> Result { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); self.conn .lock() .await @@ -4280,7 +4277,7 @@ impl Store for TursoStore { at: OffsetDateTime, ) -> Result<()> { let conn = self.conn.lock().await; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); conn.execute( "INSERT INTO mail_decision (id, rule_id, event_id, task_id, outcome, detail, \ created_at) \ @@ -4798,7 +4795,7 @@ impl Store for TursoStore { } async fn create_tag(&self, board_id: &str, name: &str, at: OffsetDateTime) -> Result { - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let now = stamp(at)?; let mut conn = self.tx_conn().await?; let tx = conn @@ -5479,7 +5476,7 @@ mod probe { #[tokio::test] async fn durability_defaults_are_recorded() { - let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("probe.db"); let db = Builder::new_local(path.to_str().unwrap()) @@ -5497,7 +5494,7 @@ mod probe { #[tokio::test] async fn concurrent_writers_on_one_database() { - let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("probe.db"); let db = Builder::new_local(path.to_str().unwrap()) @@ -5540,7 +5537,7 @@ mod probe { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn two_database_handles_on_one_file() { // Two handles on the same file is the shape a second process takes. - let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-probe-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("probe.db"); let p = path.to_str().unwrap().to_string(); @@ -5613,7 +5610,7 @@ mod probe { /// is asserted against the real query rather than against a comment. #[tokio::test] async fn the_workspace_read_path_cannot_carry_the_password() { - let dir = std::env::temp_dir().join(format!("iz-sender-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-sender-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let store = TursoStore::open(dir.join("iz.db").to_str().unwrap(), &dir.join("storage")) .await diff --git a/crates/iz-core/tests/store.rs b/crates/iz-core/tests/store.rs index 94f38c9..b8dde0e 100644 --- a/crates/iz-core/tests/store.rs +++ b/crates/iz-core/tests/store.rs @@ -24,7 +24,7 @@ struct Scratch { impl Scratch { async fn open() -> Self { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let storage = dir.join("storage"); let store = TursoStore::open(dir.join("iz.db").to_str().unwrap(), &storage) @@ -102,7 +102,7 @@ async fn member_user( #[tokio::test] async fn the_schema_is_created_once_and_survives_reopen() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); @@ -971,7 +971,7 @@ async fn members_list_and_count_for_the_admin_screen() { #[tokio::test] async fn display_preferences_default_and_persist_across_reopen() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); @@ -1004,7 +1004,7 @@ async fn display_preferences_default_and_persist_across_reopen() { #[tokio::test] async fn updates_to_a_missing_user_are_not_found() { let scratch = Scratch::open().await; - let missing = Ulid::new().to_string(); + let missing = Ulid::generate().to_string(); assert!(matches!( scratch.store.set_role(&missing, Role::Member).await, Err(StoreError::NotFound) @@ -2566,7 +2566,7 @@ async fn an_orphan_row_is_refused() { .len(); assert_eq!(existing, 1, "only the admin"); - let dir = std::env::temp_dir().join(format!("iz-fk-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-fk-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_owned(); { @@ -2644,7 +2644,7 @@ async fn a_rule_naming_a_column_it_cannot_act_on_is_refused_by_the_schema() { // past it, straight at the table. The check constraint is the guard: a // column on a trigger that never reads one is a rule whose author meant // something the engine will not do. - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); let store = TursoStore::open(&path, &dir.join("storage")).await.unwrap(); @@ -2775,7 +2775,7 @@ async fn a_decision_is_written_once_per_rule_and_event() { #[tokio::test] async fn an_actor_only_decision_is_reworded_at_boot() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); @@ -3179,7 +3179,7 @@ async fn shared() -> (PathBuf, Arc, String, String) { /// The same, with a quiet window of `minutes` on the workspace. async fn waiting(minutes: u32) -> (PathBuf, Arc, String, String) { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let store = Arc::new( TursoStore::open(dir.join("iz.db").to_str().unwrap(), &dir.join("storage")) @@ -5533,7 +5533,7 @@ async fn a_write_that_failed_announces_nothing() { let store = &scratch.store; let mut rx = store.subscribe(); - let missing = Ulid::new().to_string(); + let missing = Ulid::generate().to_string(); assert!(matches!( store .record_send_accepted(&missing, OffsetDateTime::now_utc()) @@ -5589,8 +5589,7 @@ fn every_writing_method_announces_or_is_named_here() { let impl_block = &source[start..end]; let mut silent = Vec::new(); - let mut methods = impl_block.split("\n async fn ").skip(1).peekable(); - while let Some(chunk) = methods.next() { + for chunk in impl_block.split("\n async fn ").skip(1) { let name = chunk .split(['(', '<', ' ']) .next() @@ -5726,7 +5725,7 @@ async fn a_sender_check_is_recorded_apart_from_a_test_and_cleared_on_edit() { /// deployed with, kept verbatim in `tests/fixtures/` — and fills it with the /// kinds of row a live workspace holds, blobs included. async fn live_shaped_database() -> (PathBuf, String) { - let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-reconcile-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); @@ -7358,7 +7357,7 @@ async fn each_reminder_tells_the_meeting_in_its_own_recipients_clock() { #[tokio::test] async fn reminder_rows_survive_a_reopen() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); let store = TursoStore::open(&path, &dir.join("storage")).await.unwrap(); @@ -7369,7 +7368,6 @@ async fn reminder_rows_survive_a_reopen() { store.assign_task(&task, &mate).await.unwrap(); let before = reminders(&store, &task).await; assert_eq!(before.len(), 1); - let before = before; drop(store); let reopened = TursoStore::open(&path, &dir.join("storage")).await.unwrap(); @@ -7473,7 +7471,7 @@ async fn a_whole_second_stamp_is_written_with_nine_zero_digits() { /// one. #[tokio::test] async fn a_boot_canonicalizes_the_legacy_whole_second_stamps() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); let store = TursoStore::open(&path, &dir.join("storage")).await.unwrap(); @@ -8050,7 +8048,7 @@ struct Planted { impl Planted { async fn plant(rows: &[(&str, &str, Vec)]) -> Self { - let dir = std::env::temp_dir().join(format!("iz-resniff-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-resniff-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); drop(TursoStore::open(&path, &dir.join("storage")).await.unwrap()); @@ -8490,7 +8488,7 @@ async fn demoting_a_member_to_viewer_takes_their_assignments_with_them() { /// reads agree from the first render after the deploy. #[tokio::test] async fn a_boot_leaves_no_viewer_still_assigned() { - let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-test-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_string_lossy().into_owned(); let store = TursoStore::open(&path, &dir.join("storage")).await.unwrap(); @@ -8590,7 +8588,7 @@ async fn set_user_disabled_round_trips() { assert!(matches!( scratch .store - .set_user_disabled(&Ulid::new().to_string(), true) + .set_user_disabled(&Ulid::generate().to_string(), true) .await, Err(StoreError::NotFound) )); @@ -8665,7 +8663,7 @@ async fn a_sync_claims_an_unclaimed_row_without_touching_its_sign_in_fact() { async fn a_sync_follows_provider_drift_but_not_the_sign_in_fact() { let (scratch, _workspace, admin_id) = workspace_with_admin().await; let before = scratch.store.user(&admin_id).await.unwrap().unwrap(); - let seen = before.last_signed_in_at.clone(); + let seen = before.last_signed_in_at; let sync = scratch .store .sync_member("sub-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00") @@ -8865,8 +8863,16 @@ async fn app_settings_round_trip_through_one_row_per_key() { #[tokio::test] async fn a_remote_attachment_is_born_stored_without_a_local_file() { let (scratch, workspace, admin) = workspace_with_admin().await; - let task = add_task(&scratch.store, &workspace, "Backlog", "Ship it", None, &admin).await; - let id = Ulid::new().to_string(); + let task = add_task( + &scratch.store, + &workspace, + "Backlog", + "Ship it", + None, + &admin, + ) + .await; + let id = Ulid::generate().to_string(); let stored = scratch .store .add_remote_attachment(NewRemoteAttachment { @@ -8888,11 +8894,7 @@ async fn a_remote_attachment_is_born_stored_without_a_local_file() { assert_eq!(row.file_name, "remote.png"); assert_eq!(row.size_bytes, 7); assert!( - !scratch - .storage - .join("attachments") - .join(&id) - .exists(), + !scratch.storage.join("attachments").join(&id).exists(), "a stored row names no file on this machine" ); assert_eq!( @@ -8964,7 +8966,15 @@ async fn setting_the_storage_backend_announces_settings() { #[tokio::test] async fn local_attachments_are_the_oldest_local_rows_up_to_the_limit() { let (scratch, workspace, admin) = workspace_with_admin().await; - let task = add_task(&scratch.store, &workspace, "Backlog", "Ship it", None, &admin).await; + let task = add_task( + &scratch.store, + &workspace, + "Backlog", + "Ship it", + None, + &admin, + ) + .await; let now = OffsetDateTime::now_utc(); let mut ids = Vec::new(); for (n, name) in ["a.png", "b.png", "c.png"].iter().enumerate() { @@ -8985,12 +8995,7 @@ async fn local_attachments_are_the_oldest_local_rows_up_to_the_limit() { ); } // The middle one already moved; it must not appear in the drain's pick. - scratch - .store - .mark_attachment_stored(&ids[1]) - .await - .unwrap() - ; + scratch.store.mark_attachment_stored(&ids[1]).await.unwrap(); let picked = scratch.store.local_attachments(10).await.unwrap(); assert_eq!( @@ -9019,7 +9024,15 @@ async fn local_attachments_are_the_oldest_local_rows_up_to_the_limit() { #[tokio::test] async fn marking_stored_moves_the_row_and_unlinks_the_file() { let (scratch, workspace, admin) = workspace_with_admin().await; - let task = add_task(&scratch.store, &workspace, "Backlog", "Ship it", None, &admin).await; + let task = add_task( + &scratch.store, + &workspace, + "Backlog", + "Ship it", + None, + &admin, + ) + .await; let id = scratch .store .add_attachment(NewAttachment { @@ -9038,19 +9051,13 @@ async fn marking_stored_moves_the_row_and_unlinks_the_file() { assert!(scratch.store.mark_attachment_stored(&id).await.unwrap()); assert_eq!( - scratch - .store - .attachment(&id) - .await - .unwrap() - .unwrap() - .remote, + scratch.store.attachment(&id).await.unwrap().unwrap().remote, iz_core::store::AttachmentWhere::Stored ); assert!(!file.exists(), "the local bytes left with the row's state"); assert_eq!(scratch.store.local_attachment_count().await.unwrap(), 0); - let missing = Ulid::new().to_string(); + let missing = Ulid::generate().to_string(); assert!( !scratch .store @@ -9068,7 +9075,7 @@ async fn marking_stored_moves_the_row_and_unlinks_the_file() { /// planted stored keeps its generic mime across the boot. #[tokio::test] async fn the_boot_resniff_leaves_stored_rows_alone() { - let dir = std::env::temp_dir().join(format!("iz-resniff-{}", Ulid::new())); + let dir = std::env::temp_dir().join(format!("iz-resniff-{}", Ulid::generate())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("iz.db").to_str().unwrap().to_string(); drop(TursoStore::open(&path, &dir.join("storage")).await.unwrap()); diff --git a/crates/iz-web/Cargo.toml b/crates/iz-web/Cargo.toml index dc694cf..1b18760 100644 --- a/crates/iz-web/Cargo.toml +++ b/crates/iz-web/Cargo.toml @@ -7,7 +7,7 @@ repository.workspace = true description = "iz web app: topcoat UI, routes and the server" [dependencies] -topcoat = { version = "0.6.2", default-features = false, features = [ +topcoat = { version = "0.8.0", default-features = false, features = [ "router", "view", "runtime", @@ -58,16 +58,16 @@ calamine = { version = "0.36.1", default-features = false } # Opens a pptx directly: the slide order and text live in plain entries of # the same zip calamine opens for a workbook, read with the XML parser # already in the tree — both crates ride the lockfile as it stands. -quick-xml = { version = "0.41.0", default-features = false } +quick-xml = { version = "0.42.0", default-features = false } zip.workspace = true # Hashes the compiled stylesheet against the bundle's bytes at boot, so a # bundle from another generation refuses the boot instead of serving under # this binary (see `server.rs`'s `stylesheet_guard`). -sha2 = "0.10" +sha2 = "0.11" [build-dependencies] grass = "0.13" -sha2 = "0.10" +sha2 = "0.11" [dev-dependencies] http = "1.5" diff --git a/crates/iz-web/src/board.rs b/crates/iz-web/src/board.rs index e61ba44..738ba12 100644 --- a/crates/iz-web/src/board.rs +++ b/crates/iz-web/src/board.rs @@ -14,10 +14,10 @@ use topcoat::context::Cx; use topcoat::router::content::Form; use topcoat::router::request::headers; use topcoat::router::{HeaderName, StatusCode, header, query_params, route}; -use topcoat::view::{class, view}; +use topcoat::view::{View, ViewExt, class, view}; use crate::i18n::{Key, Lang, t}; -use crate::server::{Refusal, store, mail, require_user, require_writer}; +use crate::server::{Refusal, mail, require_user, require_writer, store}; /// The board a task belongs to, checked against this person's workspace /// before anything trusts an id the browser sent. @@ -84,7 +84,6 @@ async fn create_task_shared( clock_hour: Option<&str>, clock_minute: Option<&str>, ) -> Result> { - let user = match require_writer(cx).await { Ok(user) => user, Err(refusal) => return Ok(Some(refusal)), @@ -261,39 +260,41 @@ fn searched(query: Option<&str>) -> Option { fn sort_column_cards(cards: &mut [TaskCard], sort: &str) { match sort { "created" => cards.sort_by(|a, b| b.id.cmp(&a.id)), - "title" => cards.sort_by(|a, b| a.title.to_lowercase().cmp(&b.title.to_lowercase())), + "title" => cards.sort_by_key(|a| a.title.to_lowercase()), _ => {} } } /// The whole column list. -async fn board_columns( - cx: &Cx, +async fn board_columns<'a>( + cx: &'a Cx, sort: String, tag_filter: Option, assigned: Option, search: Option, - default_tag_id: Option<&str>, -) -> Result { + default_tag_id: Option, +) -> Result { let user = match require_user(cx).await { Ok(user) => user, Err(refusal) => { // No session to read a language off of — English, same as an // auth screen with no user yet. - return view! { + return Ok(view! { cx =>

(refusal.message())

- }; + } + .boxed()); } }; let lang = Lang::from_code(&user.language); let store = store(cx).clone(); let Some(mut view_data) = iz_core::board::load(store.as_ref(), &user.workspace_id).await? else { - return view! { + return Ok(view! { cx =>

(t(lang, Key::SomethingWentWrong))

- }; + } + .boxed()); }; if let Some(needle) = &search { view_data.searching(needle); @@ -315,25 +316,39 @@ async fn board_columns( .collect(); let mut columns = Vec::new(); for column in view_data.columns { - columns.push(render_column(cx, column, today, zone, may_write, &all_columns, default_tag_id, lang).await?); + columns.push(topcoat::view::Child::new( + render_column( + cx, + column, + today, + zone, + may_write, + &all_columns, + default_tag_id.clone(), + lang, + ) + .await?, + )); } - view! { + Ok(view! { cx => - for column in columns { (column) } + for column in columns { (topcoat::view::Child::new(column)) } } + .boxed()) } -async fn render_column( - cx: &Cx, +#[allow(clippy::too_many_arguments)] +async fn render_column<'a>( + cx: &'a Cx, column: iz_core::board::ColumnView, today: Date, zone: time::UtcOffset, may_write: bool, all_columns: &[(String, String)], - default_tag_id: Option<&str>, + default_tag_id: Option, lang: Lang, -) -> Result { +) -> Result { let column_id = column.column.id; let name = column.column.name; let is_done_column = column.column.is_done; @@ -351,14 +366,14 @@ async fn render_column( &column_id, may_write, all_columns, - default_tag_id, + default_tag_id.clone(), lang, ) .await?, ); } - view! { + Ok(view! { cx =>
@@ -367,17 +382,19 @@ async fn render_column(
if is_empty {
(t(lang, Key::NoTasks))
} - for card in cards { (card) } + for card in cards { (topcoat::view::Child::new(card)) }
} + .boxed()) } // Drag and the context menu are delegated document listeners in // `card_menu_script`, reading the card's `data-task-id`/`data-from-column` // — per-element handlers would die when a soft submit swaps the board in. -async fn render_card( - cx: &Cx, +#[allow(clippy::too_many_arguments)] +async fn render_card<'a>( + cx: &'a Cx, card: TaskCard, today: Date, done_column: bool, @@ -385,9 +402,9 @@ async fn render_card( column_id: &str, may_write: bool, all_columns: &[(String, String)], - default_tag_id: Option<&str>, + default_tag_id: Option, lang: Lang, -) -> Result { +) -> Result { let blocks = card.blocks.join(", "); let blocked_by = card.blocked_by.join(", "); let overdue = card.is_overdue(today); @@ -420,10 +437,6 @@ async fn render_card( let comments = card.comment_count; let subtasks = card.subtask_label(); let subtasks_open = card.holds_on_subtasks(); - let mut assignees = Vec::new(); - for person in card.assignees.iter() { - assignees.push(crate::layout::avatar(cx, &person.id, &person.display_name, person.photo_version, "").await?); - } let has_assignees = !card.assignees.is_empty(); let task_id = card.id.clone(); let from_column = column_id.to_string(); @@ -434,7 +447,7 @@ async fn render_card( .filter(|(id, _)| id != column_id) .cloned() .collect(); - view! { + Ok(view! { cx => if let Some(tag) = &card.tag { - if Some(tag.id.as_str()) != default_tag_id { + if Some(tag.id.as_str()) != default_tag_id.as_deref() { (tag.name.clone()) } } @@ -467,7 +480,9 @@ async fn render_card( if comments > 0 { (format!("{comments} \u{270e}")) }
- for person in assignees { (person) } + for person in &card.assignees { + (topcoat::view::Child::new(crate::layout::avatar(cx, &person.id, &person.display_name, person.photo_version, "").await?)) + } if !has_assignees { } @@ -499,7 +514,7 @@ async fn render_card( }
- } + }.boxed()) } /// Opens a card's context menu at the cursor — clamped inside the viewport @@ -521,7 +536,7 @@ async fn render_card( /// edit popovers and the modal itself stay `detail::escape_closes`'s at /// priority 90; the whole order lives in the table on `layout.rs`'s /// `escape_manager_script`. -async fn card_menu_script(cx: &Cx) -> Result { +async fn card_menu_script<'a>(cx: &'a Cx) -> Result { use topcoat::view::Unescaped; const JS: &str = "\ (function () { \ @@ -596,7 +611,7 @@ async fn card_menu_script(cx: &Cx) -> Result { } \ }); \ })();"; - view! { cx => } + Ok(view! { cx => }.boxed()) } /// Live search: the filter bar's `q` input fetches the board as the user @@ -605,7 +620,7 @@ async fn card_menu_script(cx: &Cx) -> Result { /// orphan it, and the value is deduped against the last one fetched, so an /// unchanged box never refetches. Enter still submits through the shared /// soft-nav handler. -async fn search_script(cx: &Cx) -> Result { +async fn search_script<'a>(cx: &'a Cx) -> Result { use topcoat::view::Unescaped; const JS: &str = "\ (function () { \ @@ -627,7 +642,7 @@ async fn search_script(cx: &Cx) -> Result { timer = setTimeout(function () { timer = null; fire(); }, 200); \ }); \ })();"; - view! { cx => } + Ok(view! { cx => }.boxed()) } /// Which task, if any, `/` renders the detail modal open on, and the refusal @@ -664,17 +679,18 @@ fn sort_label(sort: &str, lang: Lang) -> &'static str { /// The signed-in board: the topbar, the filter chips and the shard that owns /// every column and card. #[allow(unused_variables)] -pub async fn board_page(cx: &Cx, user: &User) -> Result { +pub async fn board_page<'a>(cx: &'a Cx, user: &'a User) -> Result { let view_data = { let store = store(cx).clone(); iz_core::board::load(store.as_ref(), &user.workspace_id).await? }; let lang = Lang::from_code(&user.language); let Some(mut view_data) = view_data else { - return view! { + return Ok(view! { cx =>

(t(lang, Key::SomethingWentWrong))

- }; + } + .boxed()); }; // Column names are stored data; the viewer reads them in their own // language, and every name this page derives — headers, the card move @@ -733,19 +749,23 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result { // an open task wins and `new` is ignored. let open_new = may_write && query.new.is_some() && open_task.is_none(); let sort = valid_sort(query.sort.as_deref()).to_string(); - let default_tag_id = tags.iter().find(|tag| tag.is_default).map(|tag| tag.id.as_str()); + let default_tag_id = tags + .iter() + .find(|tag| tag.is_default) + .map(|tag| tag.id.clone()); let refusal = match (query.on.as_deref(), query.refusal.as_deref()) { (Some("create_task") | Some("move_card"), Some(code)) => Refusal::from_code(code), _ => None, }; - view! { + let me = crate::detail::Me::from(user); + Ok(view! { cx =>
- (crate::layout::family_mark(cx).await?) - (crate::layout::topbar_nav(cx, crate::layout::NavPage::Board, user.role, lang).await?) + (topcoat::view::Child::new(crate::layout::family_mark(cx).await?)) + (topcoat::view::Child::new(crate::layout::topbar_nav(cx, crate::layout::NavPage::Board, user.role, lang).await?))
- (crate::layout::user_menu(cx, &crate::detail::Me::from(user), lang).await?) + (topcoat::view::Child::new(crate::layout::user_menu(cx, &me, lang).await?))
@@ -822,24 +842,24 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {

(t(lang, Key::NoMatches))

} else {
- (board_columns(cx, sort.clone(), tag_filter.clone(), assigned_filter.clone(), search.clone(), default_tag_id).await?) + (topcoat::view::Child::new(board_columns(cx, sort.clone(), tag_filter.clone(), assigned_filter.clone(), search.clone(), default_tag_id).await?))
} if let Some(task_id) = &open_task { - (crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete"), open_tab).await?) + (topcoat::view::Child::new(crate::detail::task_modal(cx, task_id, query.confirm.as_deref() == Some("delete"), open_tab).await?)) if let Some(file_id) = &query.file { - (crate::detail::file_viewer_modal(cx, task_id, file_id, open_tab, open_sheet, open_rows, open_cols).await?) + (topcoat::view::Child::new(crate::detail::file_viewer_modal(cx, task_id, file_id, open_tab, open_sheet, open_rows, open_cols).await?)) } } if open_new { - (crate::detail::new_task_modal(cx, &all_columns, lang).await?) + (topcoat::view::Child::new(crate::detail::new_task_modal(cx, &all_columns, lang).await?)) } - (crate::dropdown::dropdown_script(cx).await?) - (crate::layout::escape_script(cx).await?) - (card_menu_script(cx).await?) - (search_script(cx).await?) - } + (topcoat::view::Child::new(crate::dropdown::dropdown_script(cx).await?)) + (topcoat::view::Child::new(crate::layout::escape_script(cx).await?)) + (topcoat::view::Child::new(card_menu_script(cx).await?)) + (topcoat::view::Child::new(search_script(cx).await?)) + }.boxed()) } #[cfg(test)] diff --git a/crates/iz-web/src/detail.rs b/crates/iz-web/src/detail.rs index 6f88270..0c55973 100644 --- a/crates/iz-web/src/detail.rs +++ b/crates/iz-web/src/detail.rs @@ -28,7 +28,7 @@ use topcoat::Result; use topcoat::context::Cx; use topcoat::router::content::{Form, Json}; use topcoat::router::{HeaderName, StatusCode, header, route}; -use topcoat::view::{class, view}; +use topcoat::view::{View, ViewExt, class, view}; use crate::i18n::{Key, Lang, t}; use crate::server::{Refusal, back_to, mail, refusal_of, require_user, require_writer, store}; @@ -219,21 +219,6 @@ struct TaskIdForm { task_id: String, } -#[derive(Deserialize)] -struct SaveTaskForm { - task_id: String, - #[serde(default)] - title: Option, - #[serde(default)] - description: Option, - #[serde(default)] - deadline: Option, - #[serde(default)] - clock_hour: Option, - #[serde(default)] - clock_minute: Option, -} - #[derive(Deserialize)] struct PersonForm { task_id: String, @@ -560,15 +545,26 @@ pub(crate) fn combine_clock( /// with its optional time. Status is not here: the column a task sits in is /// changed by moving it, a call `board.rs` owns. #[route(POST "/api/save_task")] -async fn save_task(cx: &Cx, Form(input): Form) -> Redirect { +async fn save_task(cx: &Cx, Form(pairs): Form>) -> Redirect { use time::OffsetDateTime; - let (user, facts) = match writer_and_task(cx, &input.task_id).await { + // The pairs keep a blank word blank, the way the popover's Clear posts + // it: absent keeps, blank clears, a value sets. (`Option` fields would + // collapse blank and absent into one None.) + let field = |name: &str| { + pairs + .iter() + .find(|(key, _)| key == name) + .map(|(_, value)| value.as_str()) + }; + let task_id = field("task_id").unwrap_or_default(); + + let (user, facts) = match writer_and_task(cx, task_id).await { Ok(pair) => pair, Err(refusal) => return redirect(cx, Some(refusal)), }; - let title = match input.title { + let title = match field("title") { Some(given) => { let trimmed = given.trim().to_string(); if trimmed.is_empty() { @@ -578,17 +574,17 @@ async fn save_task(cx: &Cx, Form(input): Form) -> Redirect { } None => facts.row.title.clone(), }; - let description = match &input.description { + let description = match field("description") { Some(given) => given.trim().to_string(), None => facts.description.clone(), }; let zone = parse_zone(&user.timezone); - let time = match combine_clock(input.clock_hour.as_deref(), input.clock_minute.as_deref()) { + let time = match combine_clock(field("clock_hour"), field("clock_minute")) { Ok(time) => time, Err(refusal) => return redirect(cx, Some(refusal)), }; let (deadline, clock_at) = match moment_field( - input.deadline.as_deref(), + field("deadline"), (facts.row.deadline, facts.row.clock_at), time.as_deref(), zone, @@ -600,7 +596,7 @@ async fn save_task(cx: &Cx, Form(input): Form) -> Redirect { let store = store(cx).clone(); let activity_ids = store .save_task( - &input.task_id, + task_id, &title, &description, deadline, @@ -999,7 +995,10 @@ async fn delete_file(cx: &Cx, Form(input): Form) -> Redirect { let Some((_, url)) = crate::storage::in_of(store.as_ref()).await else { return redirect(cx, Some(Refusal::StorageUnavailable)); }; - if let Err(problem) = crate::storage::client(cx).delete(&url, &attachment.id).await { + if let Err(problem) = crate::storage::client(cx) + .delete(&url, &attachment.id) + .await + { eprintln!("storage delete: {problem:?}"); return redirect(cx, Some(Refusal::StorageUnavailable)); } @@ -1049,10 +1048,10 @@ async fn delete_file(cx: &Cx, Form(input): Form) -> Redirect { pub(crate) mod glyph { use topcoat::Result; use topcoat::context::Cx; - use topcoat::view::view; + use topcoat::view::{View, ViewExt, view}; - pub async fn chevron(cx: &Cx) -> Result { - view! { + pub async fn chevron<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn calendar(cx: &Cx) -> Result { - view! { + pub async fn calendar<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn plus(cx: &Cx) -> Result { - view! { + pub async fn plus<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn play(cx: &Cx) -> Result { - view! { + pub async fn play<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn pause(cx: &Cx) -> Result { - view! { + pub async fn pause<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn cross(cx: &Cx) -> Result { - view! { + pub async fn cross<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } /// An open part. Deliberately not the padlock: a dependency row's lock /// means "something is in front of this", and a subtask that is simply /// unfinished is not blocked by anything. - pub async fn ring(cx: &Cx) -> Result { - view! { + pub async fn ring<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn tick(cx: &Cx) -> Result { - view! { + pub async fn tick<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn lock(cx: &Cx) -> Result { - view! { + pub async fn lock<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => } + .boxed()) } - pub async fn bin(cx: &Cx) -> Result { - view! { + pub async fn bin<'a>(cx: &'a Cx) -> Result { + Ok(view! { cx => - } + }.boxed()) } } @@ -1177,7 +1185,7 @@ pub(crate) mod glyph { /// rendered. Focused native media controls swallow `Escape` before the page /// ever sees the key, so focus landing on the viewer's audio/video is moved /// straight back to the panel. -pub(crate) async fn escape_closes(cx: &Cx) -> Result { +pub(crate) async fn escape_closes<'a>(cx: &'a Cx) -> Result { use topcoat::view::Unescaped; const JS: &str = "\ (function () { \ @@ -1226,23 +1234,30 @@ pub(crate) async fn escape_closes(cx: &Cx) -> Result { }); \ }, true); \ })();"; - view! { cx => } + Ok(view! { cx => }.boxed()) } -async fn refused(cx: &Cx, call: &str, lang: Lang) -> Result { +async fn refused<'a>(cx: &'a Cx, call: &'a str, lang: Lang) -> Result { match refusal_of(cx, call) { - Some(refusal) => view! { cx => }, - None => view! { cx => }, + Some(refusal) => { + Ok(view! { cx => }.boxed()) + } + None => Ok(view! { cx => }.boxed()), } } -async fn title_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang: Lang) -> Result { +async fn title_control<'a>( + cx: &'a Cx, + task: &'a TaskDetail, + may_write: bool, + lang: Lang, +) -> Result { if !may_write { - return view! { cx =>

(task.title.clone())

}; + return Ok(view! { cx =>

(task.title.clone())

}.boxed()); } let toggle = format!("rename-{}", task.id); let rename_aria = t(lang, Key::RenameThisTask); - view! { + Ok(view! { cx =>
@@ -1255,12 +1270,17 @@ async fn title_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang: Lang) - (refused(cx, "save_task", lang).await?) + (topcoat::view::Child::new(refused(cx, "save_task", lang).await?))
- } + }.boxed()) } -async fn description_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang: Lang) -> Result { +async fn description_control<'a>( + cx: &'a Cx, + task: &'a TaskDetail, + may_write: bool, + lang: Lang, +) -> Result { let empty = task.description.trim().is_empty(); let no_description = t(lang, Key::NoDescription).to_string(); let prose = if empty { @@ -1270,11 +1290,11 @@ async fn description_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang: }; if !may_write { - return view! { cx =>

(prose)

}; + return Ok(view! { cx =>

(prose)

}.boxed()); } let toggle = format!("describe-{}", task.id); let edit_aria = t(lang, Key::EditTheDescription); - view! { + Ok(view! { cx =>
@@ -1289,9 +1309,9 @@ async fn description_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang:
- (refused(cx, "save_task", lang).await?) + (topcoat::view::Child::new(refused(cx, "save_task", lang).await?))
- } + }.boxed()) } /// The moment field: the deadline's calendar popover, with one optional @@ -1312,14 +1332,14 @@ async fn description_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang: /// The box speaks the moment when there is one, the day when there is only /// a day — the clock's day is always the deadline's, and the label reads in /// the viewer's own zone. -async fn deadline_control( - cx: &Cx, - task: &TaskDetail, +async fn deadline_control<'a>( + cx: &'a Cx, + task: &'a TaskDetail, today: Date, zone: UtcOffset, may_write: bool, lang: Lang, -) -> Result { +) -> Result { let overdue = task.is_overdue(today); let local = task.clock_at.map(|at| at.to_offset(zone)); let label = match (&local, task.deadline_parts(today)) { @@ -1346,32 +1366,33 @@ async fn deadline_control( (None, None) => t(lang, Key::NoDeadline).to_string(), }; if !may_write { - return view! { + return Ok(view! { cx => - (glyph::calendar(cx).await?) + (topcoat::view::Child::new(glyph::calendar(cx).await?)) (label) - }; + } + .boxed()); } let toggle = format!("deadline-{}", task.id); let input_value = task.deadline_input(); let hm = local.map(|at| (at.hour(), at.minute())); let change_aria = t(lang, Key::ChangeTheDeadline); let no_deadline = t(lang, Key::NoDeadline); - view! { + Ok(view! { cx =>
- (datepicker_grid(cx, "deadline", &input_value, true, lang).await?) + (topcoat::view::Child::new(datepicker_grid(cx, "deadline", &input_value, true, lang).await?))
- (refused(cx, "save_task", lang).await?) + (topcoat::view::Child::new(refused(cx, "save_task", lang).await?))
- } + }.boxed()) } /// The calendar grid's static shell inside a `.datepick-panel`: a hidden @@ -1399,20 +1420,20 @@ async fn deadline_control( /// grid — the grid cells and month title are blank until `datepicker_script` /// fills them in on open (see that function's doc comment for why the fill /// happens in JS rather than here). -pub(crate) async fn datepicker_grid( - cx: &Cx, - name: &str, - value: &str, +pub(crate) async fn datepicker_grid<'a>( + cx: &'a Cx, + name: &'a str, + value: &'a str, autosubmit: bool, lang: Lang, -) -> Result { - view! { +) -> Result { + Ok(view! { cx =>
- + - +
@@ -1420,7 +1441,7 @@ pub(crate) async fn datepicker_grid( - } + }.boxed()) } /// The house calendar's month grid, wholly in JS: this is a plain document @@ -1447,7 +1468,7 @@ pub(crate) async fn datepicker_grid( /// the grid of one standing open. The pass runs on every wire — a repair, /// not an install; closed popovers with no unsaved pick are left to the /// server's own voice. -pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result { +pub(crate) async fn datepicker_script<'a>(cx: &'a Cx, lang: Lang) -> Result { use crate::i18n::datepicker_js_literals; use topcoat::view::Unescaped; let (months, weekdays) = datepicker_js_literals(lang); @@ -1557,46 +1578,51 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result { }}, true);\ }})();" ); - view! { cx => } + Ok(view! { cx => }.boxed()) } -async fn assignee_chip( - cx: &Cx, - task_id: &str, - person: &Person, +async fn assignee_chip<'a>( + cx: &'a Cx, + task_id: &'a str, + person: &'a Person, may_write: bool, lang: Lang, -) -> Result { +) -> Result { let remove_title = crate::i18n::take_off_this_task(lang, &person.display_name); - view! { + Ok(view! { cx =>
- (crate::layout::avatar(cx, &person.id, &person.display_name, person.photo_version, "avatar-sm").await?) + (topcoat::view::Child::new(crate::layout::avatar(cx, &person.id, &person.display_name, person.photo_version, "avatar-sm").await?)) (person.display_name.clone()) if may_write {
- +
} - } + }.boxed()) } -async fn assignee_picker(cx: &Cx, task_id: &str, people: &[Person], lang: Lang) -> Result { +async fn assignee_picker<'a>( + cx: &'a Cx, + task_id: &'a str, + people: &'a [Person], + lang: Lang, +) -> Result { if people.is_empty() { - return view! { cx => }; + return Ok(view! { cx => }.boxed()); } let toggle = format!("assign-{task_id}"); let put_aria = t(lang, Key::PutSomeoneOnThisTask); - view! { + Ok(view! { cx =>
- +
for person in people { @@ -1604,30 +1630,35 @@ async fn assignee_picker(cx: &Cx, task_id: &str, people: &[Person], lang: Lang) }
- (refused(cx, "assign", lang).await?) + (topcoat::view::Child::new(refused(cx, "assign", lang).await?))
- } + }.boxed()) } -async fn link_picker(cx: &Cx, task_id: &str, linkable: &[LinkTarget], lang: Lang) -> Result { +async fn link_picker<'a>( + cx: &'a Cx, + task_id: &'a str, + linkable: &'a [LinkTarget], + lang: Lang, +) -> Result { if linkable.is_empty() { - return view! { cx => }; + return Ok(view! { cx => }.boxed()); } let toggle = format!("link-{task_id}"); let link_aria = t(lang, Key::LinkAnotherTask); - view! { + Ok(view! { cx => - } + }.boxed()) } /// One part on its parent's page: its key, its title, who holds it, and the /// button that lets it out. The status is the column's name, read off the /// board's columns the page already has. -async fn subtask_row( - cx: &Cx, - part: &iz_core::detail::SubtaskLine, - columns: &[iz_core::Column], +async fn subtask_row<'a>( + cx: &'a Cx, + part: &'a iz_core::detail::SubtaskLine, + columns: &'a [iz_core::Column], may_write: bool, lang: Lang, -) -> Result { +) -> Result { let done = part.is_done(); let status = columns .iter() @@ -1695,14 +1726,14 @@ async fn subtask_row( .await?, ); } - view! { + Ok(view! { cx => - } + }.boxed()) } /// Takes an existing task in as a part. The same shape as `link_picker`, and /// absent for the same reason: with nothing to offer it shows nothing. -async fn adopt_picker(cx: &Cx, task_id: &str, adoptable: &[LinkTarget], lang: Lang) -> Result { +async fn adopt_picker<'a>( + cx: &'a Cx, + task_id: &'a str, + adoptable: &'a [LinkTarget], + lang: Lang, +) -> Result { if adoptable.is_empty() { - return view! { cx => }; + return Ok(view! { cx => }.boxed()); } let toggle = format!("adopt-{task_id}"); let aria = t(lang, Key::MakeAPart); - view! { + Ok(view! { cx => - } + }.boxed()) } -async fn dep_row( - cx: &Cx, - task_id: &str, - edge: &DependencyEdge, +async fn dep_row<'a>( + cx: &'a Cx, + task_id: &'a str, + edge: &'a DependencyEdge, direction: Direction, may_write: bool, lang: Lang, -) -> Result { +) -> Result { let cleared = edge.is_cleared(); let note = match direction { Direction::BlockedBy => edge.blocked_by_label(), @@ -1785,7 +1821,7 @@ async fn dep_row( }; let remove_title = t(lang, Key::RemoveThisLink); let href = format!("/?task={}", edge.task_id); - view! { + Ok(view! { cx => - } + }.boxed()) } /// The version stamp a `/files/{id}` URL carries: the row's `uploaded_at`. @@ -1819,14 +1855,14 @@ fn attachment_stamp(attachment: &iz_core::store::Attachment) -> String { (attachment.uploaded_at.unix_timestamp_nanos() / 1_000).to_string() } -async fn file_chip( - cx: &Cx, - task_id: &str, - file: &iz_core::detail::FileLine, - me: &Me, +async fn file_chip<'a>( + cx: &'a Cx, + task_id: &'a str, + file: &'a iz_core::detail::FileLine, + me: &'a Me, may_write: bool, lang: Lang, -) -> Result { +) -> Result { let _ = may_write; let may_drop = me.id == file.uploaded_by || me.role.can_administer(); let on_comment = file.comment_id.is_some(); @@ -1846,7 +1882,7 @@ async fn file_chip( _ => format!("/files/{}", file.id), } }; - view! { + Ok(view! { cx => (file.name.clone()) @@ -1857,19 +1893,23 @@ async fn file_chip( if may_drop {
- +
} - } + }.boxed()) } -async fn comment_row(cx: &Cx, comment: &Comment, zone: UtcOffset) -> Result { - view! { +async fn comment_row<'a>( + cx: &'a Cx, + comment: &'a Comment, + zone: UtcOffset, +) -> Result { + Ok(view! { cx =>
- (crate::layout::avatar(cx, &comment.author.id, &comment.author.display_name, comment.author.photo_version, "avatar-lg").await?) + (topcoat::view::Child::new(crate::layout::avatar(cx, &comment.author.id, &comment.author.display_name, comment.author.photo_version, "avatar-lg").await?))
@@ -1879,7 +1919,7 @@ async fn comment_row(cx: &Cx, comment: &Comment, zone: UtcOffset) -> Result {
(comment.body.clone())
- } + }.boxed()) } /// The task modal's markup: title, description, assignees, deadline, @@ -1934,7 +1974,12 @@ fn tab_class(current: Tab, target: Tab) -> &'static str { /// artboard draws them. Wiring `?task=` on the board page is a later /// integration slice — this only renders the fragment. -pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) -> Result { +pub async fn task_modal<'a>( + cx: &'a Cx, + task_id: &'a str, + confirm_delete: bool, + tab: Tab, +) -> Result { let snapshot = match load_snapshot(cx, task_id).await? { Ok(snapshot) => snapshot, Err(refusal) => { @@ -1946,13 +1991,13 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) .await .map(|user| Lang::from_code(&user.language)) .unwrap_or(Lang::En); - return view! { + return Ok(view! { cx => - (escape_closes(cx).await?) - }; + (topcoat::view::Child::new(escape_closes(cx).await?)) + }.boxed()); } }; let DetailSnapshot { @@ -1997,7 +2042,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) None }; - view! { + Ok(view! { cx => if may_write { @@ -2032,7 +2077,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) } - (glyph::chevron(cx).await?) + (topcoat::view::Child::new(glyph::chevron(cx).await?)) } else { @@ -2043,7 +2088,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
(t(lang, Key::Esc)) - (glyph::cross(cx).await?) + (topcoat::view::Child::new(glyph::cross(cx).await?)) (format!("<- {}", t(lang, Key::NavBoard))) @@ -2087,7 +2132,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) } - (glyph::chevron(cx).await?) + (topcoat::view::Child::new(glyph::chevron(cx).await?)) } else { @@ -2106,7 +2151,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) } - (glyph::chevron(cx).await?) + (topcoat::view::Child::new(glyph::chevron(cx).await?)) } else { @@ -2118,38 +2163,38 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
(t(lang, Key::Deadline)) - (deadline_control(cx, &detail, today, zone, may_write, lang).await?) + (topcoat::view::Child::new(deadline_control(cx, &detail, today, zone, may_write, lang).await?))
(format!("{} — {}", t(lang, Key::Assignees), detail.assignees.len()))
for person in &detail.assignees { - (assignee_chip(cx, &detail.id, person, may_write, lang).await?) + (topcoat::view::Child::new(assignee_chip(cx, &detail.id, person, may_write, lang).await?)) }
if may_write { - (assignee_picker(cx, &detail.id, &unassigned, lang).await?) + (topcoat::view::Child::new(assignee_picker(cx, &detail.id, &unassigned, lang).await?)) }
- (refused(cx, "move_card", lang).await?) + (topcoat::view::Child::new(refused(cx, "move_card", lang).await?))
(t(lang, Key::Dependencies))
if may_write { - (link_picker(cx, &detail.id, &linkable, lang).await?) + (topcoat::view::Child::new(link_picker(cx, &detail.id, &linkable, lang).await?)) }
if has_deps {
for edge in &detail.blocked_by { - (dep_row(cx, &detail.id, edge, Direction::BlockedBy, may_write, lang).await?) + (topcoat::view::Child::new(dep_row(cx, &detail.id, edge, Direction::BlockedBy, may_write, lang).await?)) } for edge in &detail.blocks { - (dep_row(cx, &detail.id, edge, Direction::Blocks, may_write, lang).await?) + (topcoat::view::Child::new(dep_row(cx, &detail.id, edge, Direction::Blocks, may_write, lang).await?)) }
} else { @@ -2170,7 +2215,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
(t(lang, Key::Description)) - (description_control(cx, &detail, may_write, lang).await?) + (topcoat::view::Child::new(description_control(cx, &detail, may_write, lang).await?))
} @@ -2183,7 +2228,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) }
if may_write { - (adopt_picker(cx, &detail.id, &adoptable, lang).await?) + (topcoat::view::Child::new(adopt_picker(cx, &detail.id, &adoptable, lang).await?)) } if may_write { @@ -2194,14 +2239,14 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) } - (refused(cx, "create_subtask", lang).await?) - (refused(cx, "set_parent", lang).await?) + (topcoat::view::Child::new(refused(cx, "create_subtask", lang).await?)) + (topcoat::view::Child::new(refused(cx, "set_parent", lang).await?)) if detail.subtasks.is_empty() {

(t(lang, Key::NoSubtasks))

} else {
for part in &detail.subtasks { - (subtask_row(cx, part, &detail.columns, may_write, lang).await?) + (topcoat::view::Child::new(subtask_row(cx, part, &detail.columns, may_write, lang).await?)) }
} @@ -2218,18 +2263,18 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
- (refused(cx, "upload_file", lang).await?) + (topcoat::view::Child::new(refused(cx, "upload_file", lang).await?)) } - (refused(cx, "delete_file", lang).await?) + (topcoat::view::Child::new(refused(cx, "delete_file", lang).await?)) if !detail.files.is_empty() {
for file in &detail.files { - (file_chip(cx, &detail.id, file, &me, may_write, lang).await?) + (topcoat::view::Child::new(file_chip(cx, &detail.id, file, &me, may_write, lang).await?)) }
} @@ -2244,7 +2289,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
for entry in &detail.comments { - (comment_row(cx, entry, zone).await?) + (topcoat::view::Child::new(comment_row(cx, entry, zone).await?)) }
@@ -2313,7 +2358,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab) if tab == Tab::Task { - (refused(cx, "delete_task", lang).await?) + (topcoat::view::Child::new(refused(cx, "delete_task", lang).await?))