Commit Graph

13223 Commits

Author SHA1 Message Date
Kévin Commaille
525f9866a4 refactor(auth-qrcode): Rename everything OIDC to OAuth 2.0
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 19:41:04 +01:00
Kévin Commaille
d7dc1c9b5b refactor(auth-qrcode): Use oauth2 crate instead of openidconnect
The MSCs are now only based on OAuth 2.0, which is simpler than OpenID Connect.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 18:42:54 +01:00
Kévin Commaille
7da3aaaa8a chore: Add new PR links to MediaRetentionPolicy changelog entries
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 12:28:43 +01:00
Kévin Commaille
5aaa6bf187 feat(base): Add automatic media cache cleanups to MediaService
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 12:20:13 +01:00
Kévin Commaille
af9a5edd59 feat(executor): Expose JoinHandle::is_finished method on wasm32
For parity with tokio's JoinHandle.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 12:10:31 +01:00
Kévin Commaille
6e764644b3 feat(base): Require that EventCacheStoreMedia implementations implement Clone
We want to be able to send the store to a new task, so the easiest way is to be able to clone it.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 12:09:18 +01:00
Kévin Commaille
8dc2ec9dc4 feat(base): Allow to clone MediaService
We want to be able to send it to a new task, so the easiest way is to be able to clone it.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 12:03:12 +01:00
Kévin Commaille
4e1ae3d5e9 feat(base): Store last media cleanup time with EventCacheStoreMedia
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 11:52:42 +01:00
Kévin Commaille
582b3a91d6 refactor(sqlite): Add methods to get and set values in the kv table by (de)serializing them
Since it's a common occurrence, it will reduce duplication.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-02 11:47:43 +01:00
Kévin Commaille
f7467ff57a feat(base): Add setting for frequency of automatic media cache cleanups
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-02-01 17:51:47 +01:00
Damir Jelić
57919f5480 chore: Bump most of our deps 2025-01-31 17:14:37 +01:00
Damir Jelić
b8949cfe26 chore: Bump vodozemac 2025-01-31 17:14:37 +01:00
Damir Jelić
8d27b0c811 test: Simplify some tests using the assert_next_with_timeout macro 2025-01-31 14:15:18 +01:00
Damir Jelić
3707d2fb81 test: Make the timeout parameter in the assert_next_with_timeout macro optional 2025-01-31 14:15:18 +01:00
Damir Jelić
eaaa5e17a0 chore: Fix a doc example in the MatrixMockServer 2025-01-31 14:15:18 +01:00
Ivan Enderlin
e3958b754c chore(crypto-ffi): Done is a unit type, no need for { .. }. 2025-01-31 14:07:43 +01:00
Ivan Enderlin
78d9e1292f chore(sdk): Do not iterate over the entire iterator when we can reach back.
This patch uses `next_back()` instead of `last()`, which is equivalent
but `last()` requires to iterate over the entire iterator, while
`next_back()` is a single operation.
2025-01-31 14:07:43 +01:00
Ivan Enderlin
d594b4dad7 chore(sdk): Remove a useless type conversion.
This patch removes a useless type conversion. The `Room::event()` method
returns a `TimelineEvent`, so calling `Into::into` is useless: we map
`TimelineEvent` to `TimelineEvent`.
2025-01-31 14:07:43 +01:00
Ivan Enderlin
3f40ad83a5 chore(sdk): Remove a useless type conversion.
This patch removes a useless type conversion. The iterator produces
`TimelineEvent`, so mapping to `TimelineEvent::from` is useless: we map
`TimelineEvent` to `TimelineEvent`.
2025-01-31 14:07:43 +01:00
Ivan Enderlin
5049d1a3b6 chore(sqlite): Use repeat_n(…, n) instead of repeat(…).take(n).
Thanks Clippy!
2025-01-31 14:07:43 +01:00
Damir Jelić
29862fc9bd refactor: Add the assert_next_eq_with_timeout test helper
This test helper is the same as the assert_next_eq helper, but it waits
for the stream to be ready for a certain amount of time instead of
expecting it to be ready right away.
matrix-sdk-ffi/20250131
2025-01-31 09:58:55 +01:00
Damir Jelić
585224b2fa chore(ui): Replace the unit type with an empty block 2025-01-31 09:58:55 +01:00
Damir Jelić
0dc5e69ace fix: Retry the sync even in case of network errors 2025-01-31 09:58:55 +01:00
Damir Jelić
b323802ab0 fix(ui): Enable retries for network failures of the /versions check in the SyncService 2025-01-31 09:58:55 +01:00
Damir Jelić
252786d2ef refactor(ui): Make SyncService::stop infallible
The `SyncService::stop()` method could fail for the following reasons:

1. The supervisor was not properly started up, this is a programmer error.
2. The supervisor task wouldn't shut down and instead it returns a JoinError.
3. We couldn't notify the supervisor task that it should shutdown due the channel being closed.

All of those cases shouldn't ever happen and the supervisor task will be
stopped in all of them.

1. Since there is no supervisor to be stopped, we can safely just log an
   error, our tests ensure that a `SyncService::start()` does create a
   supervisor.

2. A JoinError can be returned if the task has been cancelled or if the
   supervisor task has panicked. Since we never cancel the task, nor
   have any panics in the supervisor task, we can assume that this won't
   happen.

3. The supervisor task holds on to a reference to the receiving end of
   the channel, as long as the task is alive the channel can not be
   closed.

In conclusion, it doesn't seem to be useful to forward these error cases
to the user.
2025-01-31 09:58:55 +01:00
Damir Jelić
97cbe57d3f docs: Document the offline mode for the SyncService 2025-01-31 09:58:55 +01:00
Damir Jelić
0d8ad159c3 test(ui): Write tests for the SyncService offline mode 2025-01-31 09:58:55 +01:00
Damir Jelić
9d732395ce feat(ui): Introduce a "offline" mode for the SyncService 2025-01-31 09:58:55 +01:00
Damir Jelić
6a772d1c56 test: Add a method to mock the /versions endpoint to the MatrixMockServer 2025-01-31 09:58:55 +01:00
Damir Jelić
b71499ffe6 refactor(ui): Move the start/stop implementations under the inner SyncService
This will allow us to more easily implement a restart method.
2025-01-31 09:58:55 +01:00
Damir Jelić
4dadf8581a refactor(ui): Move the creation of the child tasks in the SyncService around
This patch moves the creations of the child tasks of the SyncService
into the supervisor tasks itself. This should make it easier to let the
supervisor recreate tasks.

This will become useful once we introduce a offline mode where the
supervisor task becomes responsible to restart syncing once we notice
that the server is back online.
2025-01-31 09:58:55 +01:00
Benjamin Bouvier
4d4cd61363 chore: update copyright years for files newly introduced 2025-01-31 08:50:41 +01:00
Richard van der Hoff
6f42b0a67b crypto: withhold outgoing messages to unsigned dehydrated devices
Per https://github.com/matrix-org/matrix-rust-sdk/issues/4313, we should not
send outgoing messages to dehydrated devices that are not signed by the current
pinned/verified identity.
2025-01-29 17:37:36 +00:00
Richard van der Hoff
e3b348761e test: test helpers in share_strategy tests
Split the existing `set_up_test_machine` into two parts, so we can set up
the test OlmMachine without importing data for other users
2025-01-29 17:37:36 +00:00
Ivan Enderlin
d755a8a3aa chore(ui): Move EventMeta inside the metadata module.
This patch moves the `EventMeta` type from `state.rs` to `metadata.rs`.
2025-01-29 11:44:27 +01:00
Ivan Enderlin
66e3ddec47 chore(ui): Move TimelineMetadata into its own module.
This patch moves `TimelineMetadata`, its implementation and companion
types (like `RelativePosition`) into its own module. The idea is to
reduce the size of the `state.rs` module.
2025-01-29 11:44:27 +01:00
Ivan Enderlin
720d443452 chore(ui): Move TimelineStateTransaction into its own module.
This patch moves `TimelineStateTransaction` and its implementation into
its own module. The idea is to reduce the size of the `state.rs` module.
2025-01-29 11:44:27 +01:00
Ivan Enderlin
33d691a58e Merge pull request #4571 from zecakeh/media-retention-policy
feat: Add MediaRetentionPolicy to the EventCacheStore, take 2
2025-01-28 17:27:02 +01:00
Kévin Commaille
c2f39c1086 Merge branch 'main' into media-retention-policy 2025-01-28 16:53:52 +01:00
Kévin Commaille
df9c355aed Merge branch 'main' into media-retention-policy
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:46:55 +01:00
Kévin Commaille
0334ff3f64 chore(sdk): Add changelog entry for MediaRetentionPolicy
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:44 +01:00
Kévin Commaille
8262726369 chore(sqlite): Add changelog entry for EventCacheStore changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:44 +01:00
Kévin Commaille
a4a6bf540d chore(base): Add changelog entry for MediaRetentionPolicy and associated changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:44 +01:00
Kévin Commaille
9b38f38aea fix(base): Organize changelog the same way as other crates
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:44 +01:00
Kévin Commaille
2e05cc74bf feat(sdk): Add methods to Media to interact with MediaRetentionPolicy
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:44 +01:00
Kévin Commaille
eb9b86971a feat(base): Add methods for MediaRetentionPolicy to EventCacheStore
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-01-28 15:44:42 +01:00
Ivan Enderlin
31e7ec182c chore(ui): Remove TimelineNewItemPosition.
This patch removes the `TimelineNewItemPosition` type a sit is no longer
used.
2025-01-28 15:43:06 +01:00
Ivan Enderlin
5e8f3b2bc8 chore(ui): Remove HandleManyEventsResult.
This patch removes the `HandleManyEventsResult` type as it is no longer
used.
2025-01-28 15:43:06 +01:00
Ivan Enderlin
c0b91c4b0e chore(ui): Remove TimelineState(Transaction)::add_remote_events_at.
This patch removes `TimelineState::add_remote_events_at` and
`TimelineStateTransaction::add_remote_events_at` as they are no longer
used.
2025-01-28 15:43:06 +01:00
Ivan Enderlin
46d90afa9c refactor(ui): Use handle_remote_events_with_diffs instead of add_remote_events.
This patch replaces a call to `add_remote_events` by
`handle_remote_events_with_diffs`.

The idea is to remove all calls to `add_remote_events`.
2025-01-28 15:43:06 +01:00