diff --git a/Cargo.lock b/Cargo.lock index 5d76a59..0761aab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,7 +36,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror 1.0.65", + "thiserror 1.0.69", "tokio", "tower 0.4.13", "tracing", @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "android-tzdata" @@ -117,16 +117,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9747eb01aed7603aba23f7c869d5d7e5d37aab9c3501aced42d8fdb786f1f6e3" dependencies = [ "futures", - "thiserror 1.0.65", + "thiserror 1.0.69", "tokio", "wasm-bindgen-futures", ] [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "argparse" @@ -424,9 +424,9 @@ checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" [[package]] name = "cc" -version = "1.1.31" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "shlex", ] @@ -482,7 +482,7 @@ checksum = "5d3ad3122b0001c7f140cf4d605ef9a9e2c24d96ab0b4fb4347b76de2425f445" dependencies = [ "serde", "serde_json", - "thiserror 1.0.65", + "thiserror 1.0.69", ] [[package]] @@ -619,12 +619,13 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" +checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" dependencies = [ "cookie", - "idna 0.5.0", + "document-features", + "idna 1.0.3", "log", "publicsuffix", "serde", @@ -652,9 +653,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" dependencies = [ "libc", ] @@ -1062,6 +1063,15 @@ dependencies = [ "const-random", ] +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + [[package]] name = "doku" version = "0.21.1" @@ -1258,15 +1268,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -1445,7 +1455,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror 1.0.65", + "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1513,9 +1523,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" [[package]] name = "hashlink" @@ -1615,7 +1625,7 @@ dependencies = [ "reqwest", "reqwest-middleware", "sha2", - "thiserror 1.0.65", + "thiserror 1.0.69", "tokio", ] @@ -1768,6 +1778,7 @@ dependencies = [ "enum_delegate", "env_logger", "futures", + "getrandom", "hex", "jsonwebtoken", "katex", @@ -1788,6 +1799,7 @@ dependencies = [ "rand", "reqwest", "retry_future", + "send_wrapper", "serde", "serde_json", "sha2", @@ -1800,6 +1812,125 @@ dependencies = [ "tracing", "url", "uuid", + "wasm-bindgen", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] @@ -1820,12 +1951,23 @@ dependencies = [ [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1835,7 +1977,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", ] [[package]] @@ -1935,7 +2077,7 @@ dependencies = [ "ducc", "itertools 0.10.5", "js-sys", - "thiserror 1.0.65", + "thiserror 1.0.69", "wasm-bindgen", ] @@ -1977,7 +2119,7 @@ dependencies = [ "server_fn", "slotmap", "tachys", - "thiserror 1.0.65", + "thiserror 1.0.69", "throw_error", "typed-builder", "typed-builder-macro", @@ -2044,7 +2186,7 @@ dependencies = [ "config", "regex", "serde", - "thiserror 1.0.65", + "thiserror 1.0.69", "typed-builder", ] @@ -2153,7 +2295,7 @@ dependencies = [ "reactive_graph", "send_wrapper", "tachys", - "thiserror 1.0.65", + "thiserror 1.0.69", "url", "wasm-bindgen", "web-sys", @@ -2192,9 +2334,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.161" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libm" @@ -2229,6 +2371,18 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + [[package]] name = "lock_api" version = "0.4.12" @@ -2444,7 +2598,7 @@ dependencies = [ "rustc_version", "smallvec", "tagptr", - "thiserror 1.0.65", + "thiserror 1.0.69", "triomphe", "uuid", ] @@ -2587,7 +2741,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64b94982fe39a861561cf67ff17a7849f2cedadbbad960a797634032b7abb998" dependencies = [ "serde", - "thiserror 1.0.65", + "thiserror 1.0.69", ] [[package]] @@ -2729,7 +2883,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror 1.0.65", + "thiserror 1.0.69", "ucd-trie", ] @@ -2980,20 +3134,20 @@ checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" [[package]] name = "psm" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" +checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" dependencies = [ "cc", ] [[package]] name = "publicsuffix" -version = "2.2.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a8c1bda5ae1af7f99a2962e49df150414a43d62404644d98dd5c3a93d07457" +checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" dependencies = [ - "idna 0.3.0", + "idna 1.0.3", "psl-types", ] @@ -3023,9 +3177,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "pin-project-lite", @@ -3034,33 +3188,36 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 1.0.65", + "thiserror 2.0.3", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom", "rand", "ring", "rustc-hash", "rustls", + "rustls-pki-types", "slab", - "thiserror 1.0.65", + "thiserror 2.0.3", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ "cfg_aliases", "libc", @@ -3168,7 +3325,7 @@ dependencies = [ "send_wrapper", "serde", "slotmap", - "thiserror 1.0.65", + "thiserror 1.0.69", "web-sys", ] @@ -3234,9 +3391,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -3312,7 +3469,7 @@ dependencies = [ "http", "reqwest", "serde", - "thiserror 1.0.65", + "thiserror 1.0.69", "tower-service", ] @@ -3387,7 +3544,7 @@ dependencies = [ "quote", "syn 2.0.87", "syn_derive", - "thiserror 1.0.65", + "thiserror 1.0.69", ] [[package]] @@ -3423,9 +3580,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ "bitflags 2.6.0", "errno", @@ -3462,6 +3619,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -3534,9 +3694,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -3559,18 +3719,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -3608,7 +3768,7 @@ checksum = "cd34f36fe4c5ba9654417139a9b3a20d2e1de6012ee678ad14d240c22c78d8d6" dependencies = [ "percent-encoding", "serde", - "thiserror 1.0.65", + "thiserror 1.0.69", ] [[package]] @@ -3656,7 +3816,7 @@ dependencies = [ "serde_json", "serde_qs", "server_fn_macro_default", - "thiserror 1.0.65", + "thiserror 1.0.69", "throw_error", "tower 0.4.13", "tower-layer", @@ -3736,7 +3896,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint", "num-traits", - "thiserror 1.0.65", + "thiserror 1.0.69", "time", ] @@ -3801,6 +3961,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stacker" version = "0.1.17" @@ -3881,6 +4047,17 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "syntect" version = "5.2.0" @@ -3898,7 +4075,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "thiserror 1.0.65", + "thiserror 1.0.69", "walkdir", "yaml-rust", ] @@ -3964,9 +4141,9 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -3977,11 +4154,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.65", + "thiserror-impl 1.0.69", ] [[package]] @@ -3995,9 +4172,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", @@ -4071,6 +4248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", + "zerovec", ] [[package]] @@ -4090,9 +4268,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -4425,22 +4603,34 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna 1.0.3", "percent-encoding", "serde", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf8-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.11.0" @@ -4516,9 +4706,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -4557,9 +4747,9 @@ checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-streams" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" dependencies = [ "futures-util", "js-sys", @@ -4578,6 +4768,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.26.6" @@ -4748,6 +4948,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "xxhash-rust" version = "0.8.12" @@ -4780,6 +4992,30 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -4801,8 +5037,51 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/Cargo.toml b/Cargo.toml index 29cf167..ed63e8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ env_logger = { version = "0.11.5", default-features = false } futures = "0.3.30" hex = "0.4.3" rand = "0.8.5" +getrandom = { version = "0.2", features = ["js"] } serde_json = "1.0.128" sha2 = "0.10.8" uuid = { version = "1.10.0", features = ["serde"] } @@ -88,6 +89,7 @@ markdown-it-sub = "1.0.0" markdown-it-sup = "1.0.0" leptos-use = "0.14.0-rc2" codee = "0.2.0" +wasm-bindgen = "0.2.95" # backend-only features axum = { version = "0.7.7", optional = true } @@ -118,6 +120,7 @@ config = { version = "0.14.0", features = ["toml"], optional = true } tower = { version = "0.5.1", optional = true } tower-layer = { version = "0.3.3", optional = true } console_log = "1.0.0" +send_wrapper = "0.6.0" [dev-dependencies] pretty_assertions = "1.4.1" diff --git a/src/backend/mod.rs b/src/backend/mod.rs index e2933dd..b66dc57 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -131,7 +131,6 @@ async fn leptos_routes_handler( req: Request, ) -> Response { let handler = leptos_axum::render_app_async_with_context( - option.clone(), move || { let cookie = jar.get(AUTH_COOKIE).map(|c| c.value().to_string()); provide_context(Auth(cookie)); diff --git a/src/common/mod.rs b/src/common/mod.rs index be4666a..a7b9ae8 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -3,7 +3,6 @@ pub mod utils; pub mod validation; use chrono::{DateTime, Utc}; -use codee::{Decoder, Encoder}; use newtypes::{ArticleId, ConflictId, EditId, InstanceId, PersonId}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; @@ -352,25 +351,6 @@ pub struct SiteView { pub config: Options, } -// TODO: using () doesnt make much sense -impl Encoder<()> for SiteView { - type Error = serde_json::Error; - type Encoded = String; - - fn encode(val: &()) -> Result { - serde_json::to_string(val) - } -} - -impl Decoder<()> for SiteView { - type Error = serde_json::Error; - type Encoded = str; - - fn decode(stored_value: &Self::Encoded) -> Result<(), Self::Error> { - serde_json::from_str(stored_value) - } -} - #[test] fn test_edit_versions() { let default = EditVersion::default(); diff --git a/src/frontend/api.rs b/src/frontend/api.rs index b4cba97..034c455 100644 --- a/src/frontend/api.rs +++ b/src/frontend/api.rs @@ -31,8 +31,12 @@ use crate::{ }; use anyhow::anyhow; use reqwest::{Client, RequestBuilder, StatusCode}; +use send_wrapper::SendWrapper; use serde::{Deserialize, Serialize}; -use std::sync::LazyLock; +use std::{ + future::Future, + sync::{LazyLock}, +}; use url::Url; pub static CLIENT: LazyLock = LazyLock::new(|| ApiClient::new(Client::new(), None)); @@ -84,189 +88,277 @@ impl ApiClient { handle_json_res::(req).await } - pub async fn get_article(&self, data: GetArticleForm) -> MyResult { - self.get_query("/api/v1/article", Some(data)).await - } - - pub async fn list_articles(&self, data: ListArticlesForm) -> MyResult> { - self.get_query("/api/v1/article/list", Some(data)).await - } - - pub async fn register(&self, register_form: RegisterUserForm) -> MyResult { - let req = self - .client - .post(self.request_endpoint("/api/v1/account/register")) - .form(®ister_form); - handle_json_res::(req).await - } - - pub async fn login(&self, login_form: LoginUserForm) -> MyResult { - let req = self - .client - .post(self.request_endpoint("/api/v1/account/login")) - .form(&login_form); - handle_json_res::(req).await - } - - pub async fn create_article(&self, data: &CreateArticleForm) -> MyResult { - let req = self - .client - .post(self.request_endpoint("/api/v1/article")) - .form(data); - handle_json_res(req).await - } - - pub async fn edit_article_with_conflict( + pub fn get_article( &self, - edit_form: &EditArticleForm, - ) -> MyResult> { - let req = self - .client - .patch(self.request_endpoint("/api/v1/article")) - .form(edit_form); - handle_json_res(req).await + data: GetArticleForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/article", Some(data)).await }) } - pub async fn edit_article(&self, edit_form: &EditArticleForm) -> MyResult { - let edit_res = self.edit_article_with_conflict(edit_form).await?; - assert!(edit_res.is_none()); + pub fn list_articles( + &self, + data: ListArticlesForm, + ) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/article/list", Some(data)).await }) + } - self.get_article(GetArticleForm { - title: None, - domain: None, - id: Some(edit_form.article_id), + pub fn register( + &self, + register_form: RegisterUserForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .post(self.request_endpoint("/api/v1/account/register")) + .form(®ister_form); + handle_json_res::(req).await }) - .await } - pub async fn notifications_list(&self) -> MyResult> { - let req = self - .client - .get(self.request_endpoint("/api/v1/user/notifications/list")); - handle_json_res(req).await - } - - pub async fn notifications_count(&self) -> MyResult { - let req = self - .client - .get(self.request_endpoint("/api/v1/user/notifications/count")); - handle_json_res(req).await - } - - pub async fn approve_article(&self, article_id: ArticleId, approve: bool) -> MyResult<()> { - let form = ApproveArticleForm { - article_id, - approve, - }; - let req = self - .client - .post(self.request_endpoint("/api/v1/article/approve")) - .form(&form); - handle_json_res(req).await - } - - pub async fn delete_conflict(&self, conflict_id: ConflictId) -> MyResult<()> { - let form = DeleteConflictForm { conflict_id }; - let req = self - .client - .delete(self.request_endpoint("/api/v1/conflict")) - .form(&form); - handle_json_res(req).await - } - - pub async fn search(&self, search_form: &SearchArticleForm) -> MyResult> { - self.get_query("/api/v1/search", Some(search_form)).await - } - - pub async fn get_local_instance(&self) -> MyResult { - self.get_query("/api/v1/instance", None::).await - } - - pub async fn get_instance(&self, get_form: &GetInstance) -> MyResult { - self.get_query("/api/v1/instance", Some(get_form)).await - } - - pub async fn list_instances(&self) -> MyResult> { - self.get_query("/api/v1/instance/list", None::).await - } - - pub async fn follow_instance_with_resolve( + pub fn login( &self, - follow_instance: &str, - ) -> MyResult { - // fetch beta instance on alpha - let resolve_form = ResolveObject { - id: Url::parse(&format!("{}://{}", http_protocol_str(), follow_instance))?, - }; - let instance_resolved: DbInstance = self - .get_query("/api/v1/instance/resolve", Some(resolve_form)) - .await?; - - // send follow - let follow_form = FollowInstance { - id: instance_resolved.id, - }; - self.follow_instance(follow_form).await?; - Ok(instance_resolved) + login_form: LoginUserForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .post(self.request_endpoint("/api/v1/account/login")) + .form(&login_form); + handle_json_res::(req).await + }) } - pub async fn follow_instance(&self, follow_form: FollowInstance) -> MyResult<()> { - // cant use post helper because follow doesnt return json - let res = self - .client - .post(self.request_endpoint("/api/v1/instance/follow")) - .form(&follow_form) - .send() - .await?; - if res.status() == StatusCode::OK { + pub fn create_article( + &self, + data: CreateArticleForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .post(self.request_endpoint("/api/v1/article")) + .form(&data); + handle_json_res(req).await + }) + } + + pub fn edit_article_with_conflict( + &self, + edit_form: EditArticleForm, + ) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .patch(self.request_endpoint("/api/v1/article")) + .form(&edit_form); + handle_json_res(req).await + }) + } + + pub fn edit_article( + &self, + edit_form: EditArticleForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let article_id = edit_form.article_id; + let edit_res = self.edit_article_with_conflict(edit_form).await?; + assert!(edit_res.is_none()); + + self.get_article(GetArticleForm { + title: None, + domain: None, + id: Some(article_id), + }) + .await + }) + } + + pub fn notifications_list( + &self, + ) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .get(self.request_endpoint("/api/v1/user/notifications/list")); + handle_json_res(req).await + }) + } + + pub fn notifications_count(&self) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .get(self.request_endpoint("/api/v1/user/notifications/count")); + handle_json_res(req).await + }) + } + + pub fn approve_article( + &self, + article_id: ArticleId, + approve: bool, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let form = ApproveArticleForm { + article_id, + approve, + }; + let req = self + .client + .post(self.request_endpoint("/api/v1/article/approve")) + .form(&form); + handle_json_res(req).await + }) + } + + pub fn delete_conflict( + &self, + conflict_id: ConflictId, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let form = DeleteConflictForm { conflict_id }; + let req = self + .client + .delete(self.request_endpoint("/api/v1/conflict")) + .form(&form); + handle_json_res(req).await + }) + } + + pub fn search( + &self, + search_form: SearchArticleForm, + ) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/search", Some(search_form)).await }) + } + + pub fn get_local_instance( + &self, + ) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/instance", None::).await }) + } + + pub fn get_instance( + &self, + get_form: GetInstance, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/instance", Some(get_form)).await }) + } + + pub fn list_instances(&self) -> impl Future>> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/instance/list", None::).await }) + } + + pub fn follow_instance_with_resolve( + &self, + follow_instance: String, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + // fetch beta instance on alpha + let resolve_form = ResolveObject { + id: Url::parse(&format!("{}://{}", http_protocol_str(), follow_instance))?, + }; + let instance_resolved: DbInstance = self + .get_query("/api/v1/instance/resolve", Some(resolve_form)) + .await?; + + // send follow + let follow_form = FollowInstance { + id: instance_resolved.id, + }; + self.follow_instance(follow_form).await?; + Ok(instance_resolved) + }) + } + + pub fn follow_instance( + &self, + follow_form: FollowInstance, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + // cant use post helper because follow doesnt return json + let res = self + .client + .post(self.request_endpoint("/api/v1/instance/follow")) + .form(&follow_form) + .send() + .await?; + if res.status() == StatusCode::OK { + Ok(()) + } else { + Err(anyhow!("API error: {}", res.text().await?).into()) + } + }) + } + + pub fn site(&self) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self.client.get(self.request_endpoint("/api/v1/site")); + handle_json_res(req).await + }) + } + + pub fn logout(&self) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + self.client + .get(self.request_endpoint("/api/v1/account/logout")) + .send() + .await?; Ok(()) - } else { - Err(anyhow!("API error: {}", res.text().await?).into()) - } + }) } - pub async fn site(&self) -> MyResult { - let req = self.client.get(self.request_endpoint("/api/v1/site")); - handle_json_res(req).await + pub fn fork_article( + &self, + form: ForkArticleForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .post(self.request_endpoint("/api/v1/article/fork")) + .form(&form); + Ok(handle_json_res(req).await.unwrap()) + }) } - pub async fn logout(&self) -> MyResult<()> { - self.client - .get(self.request_endpoint("/api/v1/account/logout")) - .send() - .await?; - Ok(()) + pub fn protect_article( + &self, + params: ProtectArticleForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let req = self + .client + .post(self.request_endpoint("/api/v1/article/protect")) + .form(¶ms); + handle_json_res(req).await + }) } - pub async fn fork_article(&self, form: &ForkArticleForm) -> MyResult { - let req = self - .client - .post(self.request_endpoint("/api/v1/article/fork")) - .form(form); - Ok(handle_json_res(req).await.unwrap()) + pub fn resolve_article( + &self, + id: Url, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let resolve_object = ResolveObject { id }; + self.get_query("/api/v1/article/resolve", Some(resolve_object)) + .await + }) } - pub async fn protect_article(&self, params: &ProtectArticleForm) -> MyResult { - let req = self - .client - .post(self.request_endpoint("/api/v1/article/protect")) - .form(params); - handle_json_res(req).await + pub fn resolve_instance( + &self, + id: Url, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { + let resolve_object = ResolveObject { id }; + self.get_query("/api/v1/instance/resolve", Some(resolve_object)) + .await + }) } - - pub async fn resolve_article(&self, id: Url) -> MyResult { - let resolve_object = ResolveObject { id }; - self.get_query("/api/v1/article/resolve", Some(resolve_object)) - .await - } - - pub async fn resolve_instance(&self, id: Url) -> MyResult { - let resolve_object = ResolveObject { id }; - self.get_query("/api/v1/instance/resolve", Some(resolve_object)) - .await - } - pub async fn get_user(&self, data: GetUserForm) -> MyResult { - self.get_query("/api/v1/user", Some(data)).await + pub fn get_user( + &self, + data: GetUserForm, + ) -> impl Future> + Send + '_ { + SendWrapper::new(async move { self.get_query("/api/v1/user", Some(data)).await }) } fn request_endpoint(&self, path: &str) -> String { @@ -275,7 +367,7 @@ impl ApiClient { } } -async fn handle_json_res(#[allow(unused_mut)] mut req: RequestBuilder) -> MyResult +async fn handle_json_res(mut req: RequestBuilder) -> MyResult where T: for<'de> Deserialize<'de>, { diff --git a/src/frontend/app.rs b/src/frontend/app.rs index bc69252..f08da2d 100644 --- a/src/frontend/app.rs +++ b/src/frontend/app.rs @@ -30,8 +30,8 @@ use leptos_router::{ path, }; -pub fn site() -> Resource<(), SiteView> { - use_context::>().unwrap() +pub fn site() -> Resource { + use_context::>().unwrap() } pub fn is_logged_in() -> bool { @@ -51,7 +51,7 @@ pub trait DefaultResource { fn with_default(&self, f: impl FnOnce(&T) -> O) -> O; } -impl DefaultResource for Resource<(), T> { +impl DefaultResource for Resource { fn with_default(&self, f: impl FnOnce(&T) -> O) -> O { self.with(|x| match x { Some(x) => f(x), diff --git a/src/frontend/components/article_nav.rs b/src/frontend/components/article_nav.rs index d682a40..7aa04bc 100644 --- a/src/frontend/components/article_nav.rs +++ b/src/frontend/components/article_nav.rs @@ -35,7 +35,7 @@ pub fn ArticleNav(article: Resource, active_tab: ActiveTab) -> impl let form = GetInstance { id: Some(instance_id), }; - CLIENT.get_instance(&form).await.unwrap() + CLIENT.get_instance(form).await.unwrap() }, ); let article_link = article_link(&article_.article); diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index 5e81e1c..abd9abd 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -16,7 +16,7 @@ pub fn hydrate() { use crate::frontend::app::App; console_log::init_with_level(log::Level::Debug).expect("error initializing logger"); console_error_panic_hook::set_once(); - leptos::mount_to_body(App); + mount_to_body(App); } fn article_link(article: &DbArticle) -> String { diff --git a/src/frontend/pages/article/actions.rs b/src/frontend/pages/article/actions.rs index e40d8d1..1f0ef22 100644 --- a/src/frontend/pages/article/actions.rs +++ b/src/frontend/pages/article/actions.rs @@ -25,7 +25,7 @@ pub fn ArticleActions() -> impl IntoView { }; async move { set_error.update(|e| *e = None); - let result = CLIENT.fork_article(¶ms).await; + let result = CLIENT.fork_article(params).await; match result { Ok(res) => set_fork_response.set(Some(res.article)), Err(err) => { @@ -41,7 +41,7 @@ pub fn ArticleActions() -> impl IntoView { }; async move { set_error.update(|e| *e = None); - let result = CLIENT.protect_article(¶ms).await; + let result = CLIENT.protect_article(params).await; match result { Ok(_res) => article.refetch(), Err(err) => { diff --git a/src/frontend/pages/article/create.rs b/src/frontend/pages/article/create.rs index 896e849..1c92f4b 100644 --- a/src/frontend/pages/article/create.rs +++ b/src/frontend/pages/article/create.rs @@ -32,7 +32,7 @@ pub fn CreateArticle() -> impl IntoView { summary, }; set_wait_for_response.update(|w| *w = true); - let res = CLIENT.create_article(&form).await; + let res = CLIENT.create_article(form).await; set_wait_for_response.update(|w| *w = false); match res { Ok(_res) => { diff --git a/src/frontend/pages/article/edit.rs b/src/frontend/pages/article/edit.rs index 165f025..b81b5f6 100644 --- a/src/frontend/pages/article/edit.rs +++ b/src/frontend/pages/article/edit.rs @@ -89,7 +89,7 @@ pub fn EditArticle() -> impl IntoView { resolve_conflict_id, }; set_wait_for_response.update(|w| *w = true); - let res = CLIENT.edit_article_with_conflict(&form).await; + let res = CLIENT.edit_article_with_conflict(form).await; set_wait_for_response.update(|w| *w = false); match res { Ok(Some(conflict)) => { diff --git a/src/frontend/pages/article/list.rs b/src/frontend/pages/article/list.rs index dfa67e0..5415550 100644 --- a/src/frontend/pages/article/list.rs +++ b/src/frontend/pages/article/list.rs @@ -7,8 +7,8 @@ use leptos::{html::Input, prelude::*}; #[component] pub fn ListArticles() -> impl IntoView { let (only_local, set_only_local) = signal(false); - let button_only_local = create_node_ref::(); - let button_all = create_node_ref::(); + let button_only_local = NodeRef::::new(); + let button_all = NodeRef::::new(); let articles = Resource::new( move || only_local.get(), |only_local| async move { @@ -32,8 +32,9 @@ pub fn ListArticles() -> impl IntoView { class="btn rounded-r-none" node_ref=button_only_local on:click=move |_| { - button_all.get().map(|c| c.class("btn-primary", false)); - button_only_local.get().map(|c| c.class("btn-primary", true)); + // TODO + //button_all.get().map(|c| c.class("btn-primary", false)); + //button_only_local.get().map(|c| c.class("btn-primary", true)); set_only_local.set(true); } /> @@ -43,8 +44,8 @@ pub fn ListArticles() -> impl IntoView { class="btn btn-primary rounded-l-none" node_ref=button_all on:click=move |_| { - button_all.get().map(|c| c.class("btn-primary", true)); - button_only_local.get().map(|c| c.class("btn-primary", false)); + //button_all.get().map(|c| c.class("btn-primary", true)); + //button_only_local.get().map(|c| c.class("btn-primary", false)); set_only_local.set(false); } /> diff --git a/src/frontend/pages/search.rs b/src/frontend/pages/search.rs index dbc6d95..a0a3c6b 100644 --- a/src/frontend/pages/search.rs +++ b/src/frontend/pages/search.rs @@ -29,7 +29,7 @@ pub fn Search() -> impl IntoView { let mut search_results = SearchResults::default(); let url = Url::parse(&query); let search_data = SearchArticleForm { query }; - let search = CLIENT.search(&search_data); + let search = CLIENT.search(search_data); match search.await { Ok(mut a) => search_results.articles.append(&mut a),