Commit Graph

13758 Commits

Author SHA1 Message Date
Damir Jelić
f61ba4f47c fix(ui): Don't do a authenticated /versions call when building the roomlist service 2025-11-11 14:37:10 +01:00
Damir Jelić
9a3857d3a7 feat(client): Add a method to only get the server versions from the cache 2025-11-11 14:37:10 +01:00
Ivan Enderlin
e79f832160 fix(ui): Undo an optimisation to start at SettingUp.
This patch undo an optimisation that was initialising the
`RoomListService` at the `SettingUp` state if a `pos` value was
recovered successfully (see bbf9bf2c0b).
The problem is that it starts with a range of 0..99 instead of 0..19,
which can slow things done in particular cases. Whilst a good idea on
paper, it's not in practise. So let's continue to recover the `pos`, but
let's keep starting at the `Init` state.
2025-11-11 13:12:02 +01:00
Ivan Enderlin
46d05d877b fix(base): Remove a panic in a log.
We must not panic if the event has no event ID.
2025-11-11 11:15:59 +01:00
Ivan Enderlin
610f82aeb2 chore(sqlite): Remove connection::Config.
This patch removes the `connection::Config` type. It was “inspired”
from `deadpool_sqlite`, but we can clearly remove it by using our own
`SqliteStoreConfig` type. It simplifies the way we open a database.
2025-11-11 11:09:18 +01:00
Ivan Enderlin
60490f4eff doc(sqlite): Add documentation to connection.
This patch explains why we create our own implementation of `deadpool`
for `rusqlite`.
2025-11-11 11:09:18 +01:00
Ivan Enderlin
6a828e31dd feat(sqlite): Replace deadpool-sqlite by our own implementation.
This patch replaces `deadpool-sqlite` by our own implementation in
`crate::connection`. It still uses `deadpool` but the object manager has
a different implementation.
2025-11-11 11:09:18 +01:00
dependabot[bot]
fff270d997 chore(deps): bump CodSpeedHQ/action from 4.3.1 to 4.3.3
Bumps [CodSpeedHQ/action](https://github.com/codspeedhq/action) from 4.3.1 to 4.3.3.
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](4348f634fa...bb005fe1c1)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 4.3.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-11 09:19:04 +01:00
Johannes Marbach
a50ecb5b18 refactor(oauth): remove superfluous join in QR login tests
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-11 09:18:16 +01:00
Ivan Enderlin
18654444b6 doc(sdk): Remove a dead reference in the doc.
This patch removes the reference to `Update`, that is no longer required.
2025-11-11 09:17:34 +01:00
dependabot[bot]
10ff5d0cc6 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from e7d460faa33cbba452e69e8b1700e6a75e8a72b8 to 04b9adbd8c1c00963289b5628510dd907b27dc60.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](e7d460faa3...04b9adbd8c)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: 04b9adbd8c1c00963289b5628510dd907b27dc60
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 18:26:12 +01:00
Johannes Marbach
f9584f5b2a feat(ffi): add sender and room information to sync notifications
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-08 09:30:11 +01:00
Damir Jelić
66619e9d1d test(oauth): Pass the rendezvous server to the bob task as well
This avoids the scenario where the mock server gets deallocated before
the rendezvous server and thus the rendezvous specific mock guards.

Dropping those in the wrong order will result in a panic.
2025-11-08 09:29:30 +01:00
Damir Jelić
2ea1c42a1a test(oauth): No need to use join in the qrcode login granting tests 2025-11-08 09:29:30 +01:00
Damir Jelić
f6ef5fbfd1 chore: Remove a stale TODO item 2025-11-08 09:29:30 +01:00
JoFrost
a6062a6cfd feat(ffi): expose m.federate and history visibility in their events (#5830)
Hello, I'm writing on behalf of the Citadel product developed by ERCOM.
This PR expose `m.federate` and `history_visibility` in timeline diffs.
These fields are available in the Matrix SDK but were previously omitted
from the FFI variant.

Signed-off-by: JoFrost <20685007+JoFrost@users.noreply.github.com>
2025-11-07 16:16:17 +01:00
Ivan Enderlin
3f3f6c2fc6 refactor(common): Revisit CrossProcessLock::try_lock_once and spin_lock's outputs.
This patch changes the signature of `CrossProcessLock::try_lock_once`.
It was returning a:

```rust
Result<CrossProcessLockResult, CrossProcessLockError>
```

Now it returns a:

```rust
Result<Result<CrossProcessLockKind, CrossProcessLockUnobtained>, L::LockError>
```

We will explain these new types in a moment.

This patch also changes the signature of `CrossProcessLock::spin_lock`.
It was returning a:

```rust
Result<CrossProcessLockGuard, CrossProcessLockError>
```

Now it returns a:

```rust
Result<Result<CrossProcessLockKind, CrossProcessLockUnobtained>, L::LockError>
```

First off, we notice that the returned types are now unified. The
`CrossProcessLockResult` type has been renamed `CrossProcessLockKind`
and lives in a `Result::Ok`. The `CrossProcessLockResult::Unobtained`
variant has been removed, but `CrossProcessLockUnobtainedReason`
has been renamed to `CrossProcessLockUnobtained` and lives in a
`Result::Err`.

Second, the `CrossProcessLockError` now is a union type between
`CrossProcessLockUnobtained` and `TryLock::LockError`. It's not used
by `try_lock_once` or `spin_lock`, but only by the code using the
cross-process lock to provide a unified error type.

The ideas behind these changes are:

- it's easy to forward an error from the `TryLock`,
- it's difficult to ignore the `Clean` vs. `Dirty` state of the lock
  guard,
- unified API with clearly separated responsibility (the first `Result`
  vs. the second `Result`).

Note: the `CrossProcessLockKind::into_guard` method aims at being
removed. It's useful now to maintain compatibility but it's “dangerous”
as it makes trivial to skip `Clean` vs. `Dirty` states. We ultimately
don't want that.
2025-11-07 16:13:03 +01:00
Ivan Enderlin
3b1418463b doc(common): Fix a link in the CHANGELOG.md. 2025-11-07 11:26:09 +01:00
Ivan Enderlin
9f248affa9 doc(common): Update CHANGELOG.md. 2025-11-07 11:26:09 +01:00
Ivan Enderlin
edf7604d30 feat(common): Detect when the cross-process lock has been dirtied.
This patch detects when the cross-process lock has been dirtied.

A new `CrossProcessLockResult` enum is introduced to simplify the
returned value of `try_lock_once` and `spin_lock`. It flattens the
previous `Result<Option<_>>` by providing 3 variants: `Clean`, `Dirty`
and `Unobtained`.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
f7a767ce97 feat(indexeddb): Add Lease::generation in crypto, media, and event cache stores.
This patch adds `Lease::generation` support in the crypto, media and
event cache stores.

For the crypto store, we add the new `lease_locks` object store/table.
Previously, `Lease` was stored in `core`, but without any prefix, it's
easy to overwrite another records, it's dangerous. The sad thing is
that it's hard to delete the existing leases in `core` because the keys
aren't known. See the comment in the code explaining the tradeoff.

For media and event cache stores, the already existing `leases` object
store/table is cleared so that we can change the format of `Lease`
easily.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
6c922e69d0 feat(common): Add a cross-process lock generation.
This patch adds `CrossProcessLockGeneration`. A lock generation is an
integer incremented each time the lock is taken by another holder. If
the generation changes, it means the lock is _dirtied_. This _dirtying_
aspect is going to be expanded in the next patches. This patch focuses
on the introduction of this _generation_.

The `CrossProcessLock::try_lock_once` method, and
the `TryLock::try_lock` method, both returns a
`Option<CrossProcessLockGeneration>` instead of a `bool`: `true` is
replaced by `Some(_)`, `false` by `None`.
2025-11-07 11:26:09 +01:00
Ivan Enderlin
01d75e939c chore(indexeddb): Run rustfmt. 2025-11-07 11:26:09 +01:00
Jorge Martín
8b805b1ea5 refactor: Try to avoid filtering all event items before finding one with the wanted id 2025-11-07 10:42:53 +01:00
Jorge Martín
a1768ea518 refactor: Add profile cache for handle_remote_event 2025-11-07 10:42:53 +01:00
Johannes Marbach
0b66019632 feat(ffi): add bindings for granting login with a QR code
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-06 15:15:59 +01:00
Richard van der Hoff
c064ca8b18 Merge pull request #5834 from matrix-org/rav/history_sharing/fix_withheld_utd_cause
crypto: correct UtdCause for unshared historical messages
2025-11-06 11:45:06 +00:00
Jorge Martín
fa6d18b55f refactor(sdk): Make the deserialization of the ignored users happen in parallel too 2025-11-06 11:13:23 +01:00
Jorge Martín
17de97e98e refactor(sdk): Fetch member data concurrently
Creating a `RoomMember` takes a lot of store queries, and previously all of them were done sequentially. I've tried to make this process run as much in parallel as I can.
2025-11-06 11:13:23 +01:00
Richard van der Hoff
c60f92a917 crypto: correct UtdCause for unshared historical messages
Per https://github.com/element-hq/element-meta/issues/2876, we want messages
where the history was not shared to appear the same as regular "historical"
messages.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
0865e96f08 refactor(crypto): simplify UtdCause logic
I find a single match statement easier to reason about than one nested in another.

Also, import `UnableToDecryptReason::*`, to shorten the match lines.
2025-11-05 15:08:10 +00:00
Richard van der Hoff
8f726e4fb9 test: use a Timeline for shared_history integ tests
I want to be able to test that the correct `UtdCause` is presented for withheld
historical messages. That means we need to use `/sync` rather than `/event` to
obtain the message (since the MSC4115 `membership` field is missing on `/event`
(https://github.com/element-hq/synapse/issues/17486)). So then the most
realistic way to get hold of the actual UtdCause is to use a Timeline.

Of course, the thing I actually want to test doesn't actually work correctly,
so it's left as a FIXME in this commit.
2025-11-05 15:08:10 +00:00
Johannes Marbach
b4ebc8bc25 feat(oauth): add flow for granting login by scanning a QR code
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
da1369b9c2 refactor(oauth): rename request_login to request_login_with_scanned_qr_code to avoid future name clashes for the opposite flow
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
d122f10147 fix(oauth): fix doc comment for GrantLoginWithGeneratedQrCode::subscribe_to_progress
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
bcf81c89e9 refactor(oauth): make device creation timeout configurable and use a lower value for tests to speed them up
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
d3dd9d28c8 refactor(oauth): extend doc comment of GrantLoginWithQrCodeBuilder::generate for better usability and to match the login flow
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
dcd08e8d3b refactor(oauth): move QrProgress to module file for later reuse
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 13:27:28 +01:00
Johannes Marbach
82c583b5bc feat(ffi): expose Client::register_notification_handler
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-11-05 10:09:31 +01:00
Ivan Enderlin
81ff96d569 fix(sqlite): Fix the database version.
The database has been updated but the version hasn't been bumped.
2025-11-04 14:59:15 +01:00
Damir Jelić
49db60d951 feat: Allow events to be fetched by event type 2025-11-04 13:58:49 +01:00
Damir Jelić
8f4267332a test: Allow to create encrypted events in the event factory 2025-11-04 13:58:49 +01:00
Damir Jelić
950c42742d refactor(sqlite): Save the event type of an event in the SQLite event cache 2025-11-04 13:58:49 +01:00
Damir Jelić
f91ffb4c31 feat: Add a method to get the event type of a TimelineEventKind 2025-11-04 13:58:49 +01:00
Richard van der Hoff
301ca5e2b8 Fix up changelogs incorrectly updated since 0.14.0 (#5828)
All of these entries have been incorrectly added to the changelogs
*since* 0.14.0 was released :(
2025-11-04 12:50:49 +00:00
Doug
1a384f0049 xtask: Workaround UniFFI's noHandle generation for Swift.
https://github.com/mozilla/uniffi-rs/issues/2717
matrix-sdk-ffi/20251104
2025-11-04 14:11:14 +02:00
Damir Jelić
781df5526d Revert "fix: Allow /versions requests to refresh the token"
This reverts commit 05b40af2c1.
2025-11-04 09:50:37 +01:00
dependabot[bot]
ea07d0199a chore(deps): bump crate-ci/typos from 1.38.1 to 1.39.0
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.38.1 to 1.39.0.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.38.1...v1.39.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 15:46:41 +01:00
dependabot[bot]
ddfd2fb570 chore(deps): bump bnjbvr/cargo-machete
Bumps [bnjbvr/cargo-machete](https://github.com/bnjbvr/cargo-machete) from 53dce01c203a6a857c9544ebec630a370d596d65 to e7d460faa33cbba452e69e8b1700e6a75e8a72b8.
- [Release notes](https://github.com/bnjbvr/cargo-machete/releases)
- [Changelog](https://github.com/bnjbvr/cargo-machete/blob/main/CHANGELOG.md)
- [Commits](53dce01c20...e7d460faa3)

---
updated-dependencies:
- dependency-name: bnjbvr/cargo-machete
  dependency-version: e7d460faa33cbba452e69e8b1700e6a75e8a72b8
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 15:41:54 +01:00
Richard van der Hoff
3b5f1eee27 Merge pull request #5820 from matrix-org/rav/history_sharing/transitive_withheld_code
crypto: pass on "history_not_shared" withheld notifications
2025-11-03 12:58:04 +00:00