From 9cdd5abe2628e6ec3fd036d7894a55b09d622d4d Mon Sep 17 00:00:00 2001 From: Kevin Boos Date: Tue, 24 Sep 2024 18:03:36 +0000 Subject: [PATCH 1/2] Update SDK, use Native sliding sync discovery, don't re-populated event cache initially on EVERY update --- Cargo.lock | 181 ++++++++++++++++---------------------------- Cargo.toml | 6 +- src/sliding_sync.rs | 39 +++++----- 3 files changed, 86 insertions(+), 140 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f2af4d5..871cef65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,12 +77,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - [[package]] name = "android-tzdata" version = "0.1.1" @@ -732,11 +726,10 @@ checksum = "0c03c416ed1a30fbb027ef484ba6ab6f80e1eada675e1a2b92fd673c045a1f1d" [[package]] name = "deadpool" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" +checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ - "async-trait", "deadpool-runtime", "num_cpus", "tokio", @@ -753,9 +746,9 @@ dependencies = [ [[package]] name = "deadpool-sqlite" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8010e36e12f3be22543a5e478b4af20aeead9a700dd69581a5e050a070fc22c" +checksum = "2f9cc6210316f8b7ced394e2a5d2833ce7097fb28afb5881299c61bc18e8e0e9" dependencies = [ "deadpool", "deadpool-sync", @@ -790,22 +783,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", - "der_derive", - "flagset", "zeroize", ] -[[package]] -name = "der_derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "deranged" version = "0.3.9" @@ -987,12 +967,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" -[[package]] -name = "flagset" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a7e408202050813e6f1d9addadcaafef3dca7530c7ddfb005d4081cce6779" - [[package]] name = "flate2" version = "1.0.28" @@ -1182,19 +1156,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", - "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.4" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ "hashbrown", ] @@ -1207,9 +1180,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hilog-sys" @@ -1237,9 +1210,9 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +checksum = "0ff6858c1f7e2a470c5403091866fa95b36fe0dbac5d771f932c15e5ff1ee501" dependencies = [ "log", "mac", @@ -1445,9 +1418,9 @@ dependencies = [ [[package]] name = "indexed_db_futures" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cc2083760572ee02385ab8b7c02c20925d2dd1f97a1a25a8737a238608f1152" +checksum = "43315957678a70eb21fb0d2384fe86dde0d6c859a01e24ce127eb65a0143d28c" dependencies = [ "accessory", "cfg-if", @@ -1488,9 +1461,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -1626,9 +1596,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" dependencies = [ "cc", "pkg-config", @@ -2003,9 +1973,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "markup5ever" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +checksum = "d581ff8be69d08a2efa23a959d81aa22b739073f749f067348bd4f4ba4b69195" dependencies = [ "log", "phf", @@ -2041,7 +2011,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "anymap2", "aquamarine", @@ -2088,7 +2058,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "as_variant", "async-trait", @@ -2112,13 +2082,12 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "async-trait", "futures-core", "futures-util", "gloo-timers", - "instant", "ruma", "serde", "serde_json", @@ -2134,7 +2103,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.2" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "aes", "as_variant", @@ -2174,7 +2143,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "anyhow", "async-trait", @@ -2202,7 +2171,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.1" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "async-trait", "deadpool-sqlite", @@ -2224,7 +2193,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "base64", "blake3", @@ -2243,13 +2212,12 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/project-robius/matrix-rust-sdk?branch=re-export-reactions-type#0788b7a5d075ad2521335b625f7fc50b8308c6db" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#5ba90611b43915926a37be83f3de1d4d53bca6bd" dependencies = [ "as_variant", "async-once-cell", "async-rx", "async-stream", - "async-trait", "async_cell", "chrono", "eyeball", @@ -2272,6 +2240,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", + "tokio-stream", "tracing", "unicode-normalization", ] @@ -2306,13 +2275,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2620,17 +2590,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs7" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79178be066405e0602bf3035946edef6b11b3f9dde46dfe5f8bfd7dea4b77e7" -dependencies = [ - "der", - "spki", - "x509-cert", -] - [[package]] name = "pkcs8" version = "0.10.2" @@ -2756,9 +2715,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4e75767fbc9d92b90e4d0c011f61358cde9513b31ef07ea3631b15ffc3b4fd" +checksum = "666f0f59e259aea2d72e6012290c09877a780935cc3c18b1ceded41f3890d59c" dependencies = [ "bitflags 2.4.1", "memchr", @@ -3080,7 +3039,7 @@ checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" [[package]] name = "ruma" version = "0.10.1" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "assign", "js_int", @@ -3096,7 +3055,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "as_variant", "assign", @@ -3119,7 +3078,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "as_variant", "base64", @@ -3151,7 +3110,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "as_variant", "indexmap", @@ -3176,9 +3135,11 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ + "http", "js_int", + "mime", "ruma-common", "ruma-events", "serde", @@ -3188,7 +3149,7 @@ dependencies = [ [[package]] name = "ruma-html" version = "0.2.0" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "as_variant", "html5ever", @@ -3200,7 +3161,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ "js_int", "thiserror", @@ -3209,8 +3170,9 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://github.com/matrix-org/ruma?rev=f25b3220d0c3ece7720020ed180af4955a855402#f25b3220d0c3ece7720020ed180af4955a855402" +source = "git+https://github.com/ruma/ruma?rev=1ae98db9c44f46a590f4c76baf5cef70ebb6970d#1ae98db9c44f46a590f4c76baf5cef70ebb6970d" dependencies = [ + "cfg-if", "once_cell", "proc-macro-crate", "proc-macro2", @@ -3223,9 +3185,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" +checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ "bitflags 2.4.1", "fallible-iterator", @@ -3741,26 +3703,25 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", @@ -4110,9 +4071,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.5.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", "wasm-bindgen", @@ -4139,8 +4100,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vodozemac" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d4af70b53b42adf2aac459a305851b8d754f210aaf11ab509e1065beff422" +source = "git+https://github.com/matrix-org/vodozemac?rev=57cbf7e939d7b54d20207e8361b7135bd65c9cc2#57cbf7e939d7b54d20207e8361b7135bd65c9cc2" dependencies = [ "aes", "arrayvec", @@ -4154,7 +4114,6 @@ dependencies = [ "hkdf", "hmac", "matrix-pickle", - "pkcs7", "prost", "rand", "serde", @@ -4194,19 +4153,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", @@ -4231,9 +4191,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4241,9 +4201,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", @@ -4254,9 +4214,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-streams" @@ -4610,17 +4570,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "x509-cert" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25eefca1d99701da3a57feb07e5079fc62abba059fc139e98c13bbb250f3ef29" -dependencies = [ - "const-oid", - "der", - "spki", -] - [[package]] name = "xmlwriter" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 02332ef4..ac3f9925 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,10 +30,8 @@ futures-util = "0.3" imbl = { version = "3.0.0", features = ["serde"] } # same as matrix-sdk-ui imghdr = "0.7.0" linkify = "0.10.0" -# matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "experimental-sliding-sync", "e2e-encryption", "automatic-room-key-forwarding", "markdown", "sqlite", "rustls-tls", "bundled-sqlite" ] } -matrix-sdk = { git = "https://github.com/project-robius/matrix-rust-sdk", branch = "re-export-reactions-type", default-features = false, features = [ "experimental-sliding-sync", "e2e-encryption", "automatic-room-key-forwarding", "markdown", "sqlite", "rustls-tls", "bundled-sqlite" ] } -# matrix-sdk-ui = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "e2e-encryption", "rustls-tls" ] } -matrix-sdk-ui = { git = "https://github.com/project-robius/matrix-rust-sdk", branch = "re-export-reactions-type", default-features = false, features = [ "e2e-encryption", "rustls-tls" ] } +matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "experimental-sliding-sync", "e2e-encryption", "automatic-room-key-forwarding", "markdown", "sqlite", "rustls-tls", "bundled-sqlite" ] } +matrix-sdk-ui = { git = "https://github.com/matrix-org/matrix-rust-sdk", default-features = false, features = [ "rustls-tls" ] } rangemap = "1.5.0" tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] } tracing-subscriber = "0.3.17" diff --git a/src/sliding_sync.rs b/src/sliding_sync.rs index b1ce5b10..fb917a73 100644 --- a/src/sliding_sync.rs +++ b/src/sliding_sync.rs @@ -7,7 +7,7 @@ use makepad_widgets::{error, log, warning, SignalToUI}; use matrix_sdk::{ config::RequestConfig, event_handler::EventHandlerDropGuard, media::MediaRequest, room::RoomMember, ruma::{ api::client::session::get_login_types::v3::LoginType, events::{room::{message::{ForwardThread, RoomMessageEventContent}, MediaSource}, FullStateEventContent, StateEventType}, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, UInt, UserId - }, sliding_sync::http::request::ListFilters, Client, Room, SlidingSyncList, SlidingSyncMode + }, sliding_sync::VersionBuilder, Client, Room, SlidingSyncList, SlidingSyncMode }; use matrix_sdk_ui::{timeline::{AnyOtherFullStateEventContent, LiveBackPaginationStatus, RepliedToInfo, TimelineDetails, TimelineItem, TimelineItemContent}, Timeline}; use tokio::{ @@ -61,10 +61,10 @@ async fn login(cli: Cli) -> Result<(Client, Option)> { .map(|h| h.as_str()) .unwrap_or("https://matrix-client.matrix.org/"); // .unwrap_or("https://matrix.org/"); + let mut builder = Client::builder() .homeserver_url(homeserver_url) - // The matrix homeserver's sliding sync proxy doesn't support Simplified MSC3575. - .simplified_sliding_sync(false); + .sliding_sync_version_builder(VersionBuilder::DiscoverNative); if let Some(proxy) = cli.proxy { builder = builder.proxy(proxy); @@ -782,8 +782,8 @@ async fn async_main_loop() -> Result<()> { // Listen for updates to the ignored user list. handle_ignore_user_list_subscriber(client.clone()); - let mut filters = ListFilters::default(); - filters.not_room_types = vec!["m.space".into()]; // Ignore spaces for now. + // let mut filters = ListFilters::default(); + // filters.not_room_types = vec!["m.space".into()]; // Ignore spaces for now. let visible_room_list_name = "VisibleRooms".to_owned(); let visible_room_list = SlidingSyncList::builder(&visible_room_list_name) @@ -791,7 +791,7 @@ async fn async_main_loop() -> Result<()> { // .sync_mode(SlidingSyncMode::new_growing(1)) // only load a few timeline events per room to start with. We'll load more later on demand when a room is first viewed. .timeline_limit(20) - .filters(Some(filters)) + // .filters(Some(filters)) .required_state(vec![ // we want to know immediately: (StateEventType::RoomEncryption, "".to_owned()), // is it encrypted (StateEventType::RoomMember, "$LAZY".to_owned()), // lazily fetch room member profiles for users that have sent events @@ -802,11 +802,9 @@ async fn async_main_loop() -> Result<()> { // (StateEventType::RoomTopic, "".to_owned()), // any topic if known (optional, can be fetched later) ]); - // Now that we're logged in, try to connect to the sliding sync proxy. - log!("Sliding sync proxy URL: {:?}", client.sliding_sync_proxy()); + // Now that we're logged in, try to start up a sliding sync instance. let sliding_sync = client .sliding_sync("main-sync")? - .sliding_sync_proxy("https://slidingsync.lab.matrix.org".try_into()?) .with_all_extensions() // .add_cached_list(visible_room_list).await? .add_list(visible_room_list) @@ -893,15 +891,16 @@ async fn async_main_loop() -> Result<()> { continue; }; - // TODO: when the event cache handles its own cache, we can remove this. - client - .event_cache() - .add_initial_events( - &room_id, - ssroom.timeline_queue().iter().cloned().collect(), - ssroom.prev_batch(), - ) - .await?; + // // TODO: when the event cache handles its own cache, we can remove this. + // TODO FIXME: we should only do this once + // client + // .event_cache() + // .add_initial_events( + // &room_id, + // ssroom.timeline_queue().iter().cloned().collect(), + // ssroom.prev_batch(), + // ) + // .await?; let timeline = Timeline::builder(&room) .track_read_marker_and_receipts() @@ -1123,7 +1122,7 @@ async fn timeline_subscriber_handler( let send_update = |timeline_items: Vector>, changed_indices: Range, clear_cache: bool, num_updates: usize| { if num_updates > 0 { - // log!("timeline_subscriber: applied {num_updates} updates for room {room_id}, timeline now has {} items. Clear cache? {clear_cache}. Changes: {changed_indices:?}.", timeline_items.len()); + log!("timeline_subscriber: applied {num_updates} updates for room {room_id}, timeline now has {} items. Clear cache? {clear_cache}. Changes: {changed_indices:?}.", timeline_items.len()); sender.send(TimelineUpdate::NewItems { items: timeline_items, changed_indices, @@ -1135,7 +1134,7 @@ async fn timeline_subscriber_handler( } }; - const LOG_DIFFS: bool = false; + const LOG_DIFFS: bool = true; while let Some(batch) = subscriber.next().await { let mut num_updates = 0; From 3f48b7bf72c4f53bd7998dd06836c7cd94b7fbcb Mon Sep 17 00:00:00 2001 From: Kevin Boos Date: Thu, 26 Sep 2024 15:18:33 -0700 Subject: [PATCH 2/2] reset LOG_DIFFS to be disabled --- src/sliding_sync.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sliding_sync.rs b/src/sliding_sync.rs index 50e954d1..1aefd2ec 100644 --- a/src/sliding_sync.rs +++ b/src/sliding_sync.rs @@ -1168,9 +1168,13 @@ async fn timeline_subscriber_handler( clear_cache: true, }).expect("Error: timeline update sender couldn't send update with initial items!"); + const LOG_DIFFS: bool = false; + let send_update = |timeline_items: Vector>, changed_indices: Range, clear_cache: bool, num_updates: usize| { if num_updates > 0 { - log!("timeline_subscriber: applied {num_updates} updates for room {room_id}, timeline now has {} items. Clear cache? {clear_cache}. Changes: {changed_indices:?}.", timeline_items.len()); + if LOG_DIFFS { + log!("timeline_subscriber: applied {num_updates} updates for room {room_id}, timeline now has {} items. Clear cache? {clear_cache}. Changes: {changed_indices:?}.", timeline_items.len()); + } sender.send(TimelineUpdate::NewItems { items: timeline_items, changed_indices, @@ -1182,8 +1186,6 @@ async fn timeline_subscriber_handler( } }; - const LOG_DIFFS: bool = true; - while let Some(batch) = subscriber.next().await { let mut num_updates = 0; let mut index_of_first_change = usize::MAX;