Commit Graph

11431 Commits

Author SHA1 Message Date
Benjamin Bouvier
f5b6767253 feat(timeline): add a timeline start virtual item 2025-03-26 11:33:20 +01:00
Benjamin Bouvier
5ce045ee02 refactor(timeline): avoid unnecessary shadowing variables 2025-03-26 11:33:20 +01:00
Benjamin Bouvier
b83889dcba fix(ffi): propagate initial values before the future is picked by a runtime 2025-03-26 11:18:23 +01:00
Ivan Enderlin
cfc839f71b doc(sqlite) Add entry to the changelog. 2025-03-26 11:01:52 +01:00
Ivan Enderlin
660d4e7ccb feat(sqlite): Add StoreOpenConfig and open_with_config for all stores.
This patch adds a new `StoreOpenConfing` type to configure the store
when opening it and when creating the pool of connections to SQLite via
`deadpool_sqlite`.

This patch also adds a new `open_with_config` constructor on all
stores, namely `SqliteCryptoStore`, `SqliteEventCacheStore` and
`SqliteStateStore`.
2025-03-26 11:01:52 +01:00
Benjamin Bouvier
404dd3949f test: remove unused helpers 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
693c8df8d0 test(timeline): more of the same, with a new EventFactory method to add a receipt with a given timestamp 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
d587d5f145 test(timeline): make more use of MatrixMockServer / EventFactory 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
be6daa5930 test: add EventFactory::typing for typing notifications and get rid of more old cruft 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
acee5415c5 test: get rid of a few global statics for read receipts event contents 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
6399a99452 test(timeline): use the EventFactory a bit more 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
b5aa2113db test: add a way to create ephemeral read receipts events in the EventFactory 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
1585b0c32e test(timeline): use more MatrixMockServer 2025-03-26 11:01:14 +01:00
Benjamin Bouvier
3c01f88ab8 benchmark(linked chunk): add a benchmark for reading events out of the store 2025-03-26 10:29:01 +01:00
Benjamin Bouvier
785312856e fix(linked chunk): don't leak upon drop
The previous code in `LinkedChunk::drop()` would call `clear()`, which
would reset the chunk to an empty events chunk; preinitializing a vector
of 128 items. But this item chunk would never be dropped, so this would
cause a leak.

The solution is to split the semantics of *resetting* a linked chunk
(what was called `clear` before), from *clearing* it: clearing will put
it in an dangling state, and it's the caller's responsibility to do
something about it; as such, it's marked unsafe. `LinkedChunk::drop()`
may now call `clear()` (which is fine; last use of the linked chunk);
and `LinkedChunk::reset()` will call `clear()` and reset the first
chunk, which is fine too.
2025-03-26 10:29:01 +01:00
Benjamin Bouvier
fc8a6dc9b1 refactor(ffi): always try to load InReplyToDetails from the event cache or network 2025-03-25 11:06:31 +01:00
Benjamin Bouvier
7b8694e465 refactor(timeline): better encapsulate RepliedToEvent's fields 2025-03-25 11:06:31 +01:00
Benjamin Bouvier
655f62c331 refactor(timeline): don't ever look into the timeline's items to fetch the replied-to event content
This is a nice simplification, because this means that:

1. we use a single way to get the event (event-cache-or-network)
2. we don't have to reconstruct a `RoomMessageEventContent` from a
timeline's message, which seems a bit error prone
3. there's a single way to get the replied-to info for an event,
4. and that's actually independent of the timeline, so we can improve
the code for #4835
2025-03-25 11:06:31 +01:00
Benjamin Bouvier
53732e0ff2 refactor(timeline): use load_or_fetch_event when fetching a reply's content 2025-03-25 11:06:31 +01:00
Benjamin Bouvier
4cae122854 refactor(room): use load_or_fetch_event when creating an edit event 2025-03-25 11:06:31 +01:00
Benjamin Bouvier
2a11494c33 feat(room): introduce a new method to load from cache or network 2025-03-25 11:06:31 +01:00
Benjamin Bouvier
1dddd97d96 refactor(timeline): simplify ReplyContent::Message 2025-03-25 11:06:31 +01:00
Johannes Marbach
f8236a8b96 feat(timeline): add functions for sending messages in threads
`send_reply` is geared towards clients that don't render threads themselves. It sends a reply and optionally forwards it onto any existing thread.

This PR adds `send_thread_reply` for clients that do render threads themselves. This sends a message onto a thread, regardless of whether a thread existed before, and includes the fallback for non-threaded clients only if the message is not itself a reply on the thread.

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2025-03-24 14:31:20 +01:00
Kévin Commaille
aa07108c98 fix(oauth): Put cross-process module behind e2e-encryption feature
Since it requires the crypto store.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
9aed0cc933 chore: Add changelog about experimental-oidc feature removal
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
f6c5addf55 refactor(sdk): Remove experimental-oidc feature
Now that is compiles under WASM and that the API was cleaned up, it
should be okay.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
9434a112d9 fix(oauth): Don't run OAuth tests under WASM
They almost all require a mock server.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
c4ec32cb78 fix(sdk): Gate QR login imports and methods for WASM
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
c5b8c812b3 fix(oauth): Use WASM-compatible types from matrix-sdk-common
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
fdc2ca0c9e fix(oauth): Do not expose OAuthRegistrationStore under wasm32
It usually won't be possible to write data to a file.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 14:04:04 +02:00
Kévin Commaille
dcd0e078f6 docs(qr-login): Update docs
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
matrix-sdk-ffi/20250325
2025-03-24 09:32:05 +00:00
Kévin Commaille
78b79a758f feat(oauth-cli): Use OAuthRegistrationStore
It's probably the recommended way to do registration when the client can create files.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 09:32:05 +00:00
Kévin Commaille
29f6606d99 refactor(examples): Rename oidc_cli to oauth_cli
And update the docs.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-24 09:32:05 +00:00
Kévin Commaille
94f0beec51 chore: Add changelog for login with registration methods
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
590d1d7890 test(oauth): Add test for OAuth::use_registration_method
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
400c92fc89 refactor(oauth): Reuse the AuthorizationServerMetadata when possible
Avoids repeated calls to the same endpoint in the same flow.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
b3e82a05db refactor(oauth): Merge OAuth::login_with_oidc_callback() and OAuth::finish_login()
Accept a URL or a query string for simplicity.

That way we don't need to expose AuthorizationResponse.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
a8aa364757 refactor(oauth): Allow to use any registration method with OAuth::login
Gets rid of OAuth::url_for_oidc since it can be replaced by a call to
OAuth::login now.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
7457ecb1a8 feat(oauth): Allow to use any registration method with login_with_qr_code
Introduces the ClientRegistrationMethod type

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
01caf56edc refactor(oauth): Rename OAuth::configure to restore_or_register_client
The name is more explicit about what the function does.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
6f07d008c9 refactor(oauth): Inline store_client_registration and load_client_registration
They are one- or two-liners and are only used once.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
b408087320 refactor(oauth): OAuth::login doesn't return a Result
There is actually no way to get an error.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 19:17:13 +01:00
Kévin Commaille
22cbce82ce refactor(oauth): Use tokio::fs APIs instead of spawn_blocking
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
ecdc68aa1c chore: Add changelog for OidcRegistrations changes
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
4a0bf80ab0 test(oauth): Add checks that client ID is written to OAuthRegistrationStore
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
095425f664 refactor(oauth): Do not take static registrations in default OAuthRegistrationStore constructor
It complicates the constructor and most clients will probably not need to use it.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
ca4e212e98 refactor(oauth): Make OAuthRegistrationStore methods async
Since they perform blocking I/O we probably don't want to block a thread on that.

We use spawn_blocking, the alternative would be to use tokio::fs functions, which do the same thing and would require to load the whole file content in memory before (de)serialization.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
0b0f84b784 refactor(oauth): Don't ignore errors when reading the file of the OAuthRegistrationStore
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
fbd4a7dc38 refactor(oauth): Get rid of OAuthError::UnknownError
Instead add a variant for OAuthRegistrationStoreError to
OAuthClientRegistrationError.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00
Kévin Commaille
cb90d7fee6 refactor(oauth): Avoid impossible error
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-03-21 10:49:46 +01:00