Commit Graph

8690 Commits

Author SHA1 Message Date
Benjamin Bouvier
ff40ef0176 ffi: replace some block_on asyncs by async() functions 2024-05-01 11:11:04 +02:00
Benjamin Bouvier
d02125ba21 ffi: simplify notification settings locks
This gets rid of a few calls to `RUNTIME.block_on`.
2024-05-01 11:11:04 +02:00
Ivan Enderlin
76200c1007 Merge pull request #3367 from zecakeh/upgrade-crates
chore: Upgrade dependencies
2024-05-01 09:39:28 +02:00
Kévin Commaille
b4c3ab38b8 chore: Upgrade more crates
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 20:05:34 +02:00
Kévin Commaille
f4b0ebdb95 ui: Do not enable matrix_sdk experimental-oidc feature
The feature should have been removed when the authentication
module was moved.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 19:01:00 +02:00
Kévin Commaille
6488be671e Fix check of nonce length
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 18:44:47 +02:00
Kévin Commaille
5eaf10e9f8 chore: Upgrade base64 crate
This matches the version used in ruma and vodozemac

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 17:46:59 +02:00
Benjamin Bouvier
177e31cf9a timeline: reset pagination status if a live back-pagination is aborted 2024-04-30 16:10:30 +02:00
Kévin Commaille
dc2b9ed89c ci: Upgrade most actions (#3364)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 15:04:54 +02:00
Damir Jelić
fb9982fb48 oidc: Use the correct types to compare the status codes in the oidc example (#3363) 2024-04-30 13:02:29 +00:00
Kévin Commaille
856dd01009 Upgrade http, ruma, reqwest and wiremock dependencies (#3362)
They need to be updated together
because the latters depend on the former.

matrix-authentication-service is still using http 0.2
so we need to add a conversion layer between both major versions
for OIDC requests.

We need to update vodozemac too because of a dependency resolution issue.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 14:04:56 +02:00
Kévin Commaille
ea1a01000f sdk: Use the GET /auth_issuer endpoint for OIDC
The well-known method is deprecated.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-30 12:33:31 +02:00
Benjamin Bouvier
0ebedfe286 clippy: disable the box_default lint, take 2 2024-04-30 12:04:29 +02:00
Benjamin Bouvier
e0b4e2c35d fixup! paginator: reset the paginator's state if the task is cancelled 2024-04-30 12:04:29 +02:00
Benjamin Bouvier
1f2459478f paginator: reset the paginator's state if the task is cancelled
This makes all the requests (/context and /messages) cancellation-safe
by making two changes:

- first, use sync locks instead of async locks for the prev/next batch
tokens. This ensures that we can't get cancelled after receiving a
response and managing internal state, i.e. we keep run-to-completion
semantics until the end of the function, once we got a response.
- second, introduce a RAII guard that will reset the state to a given
value when dropped. Then use this to reset the state to Initial (resp.
Idle) in /context (resp. /messages) when the async call is aborted. We
use `mem::forget` once the response has been returned, so as to not call
the `Drop` implementation of the guard later on.

A regression test has also been introduced.
2024-04-30 12:04:29 +02:00
Benjamin Bouvier
16eb449c6b clippy: disable the box_default lint
The clippy website explains that `Box::new(Default::default())` can be
shortened to `Box::default()` and that it's more readable. That's true…
when you don't have a generic parameter in the mix (which may be
required if rustc can't infer the type of the boxee), in which case it
just looks bad, e.g. `Box::<MyType>::default()` instead of
`Box::new(MyType::default())`.

I do strongly prefer the latter, and propose to get rid of the lint, as
a result.
2024-04-29 14:32:08 +02:00
Doug
4618d7ca7d ffi: Allow creation of a matrix.to link for any room alias. 2024-04-29 12:00:36 +02:00
Ivan Enderlin
5e2a2465c9 Merge pull request #3357 from zecakeh/use-axum
sdk: Replace hyper with axum for local servers
2024-04-29 09:35:33 +02:00
Kévin Commaille
0e0a406cb1 Replace hyper with axum for oidc_cli example
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-27 19:37:46 +02:00
Kévin Commaille
04e5643422 Lock axum to 0.7.4
Version 0.7.5 triggers a warning in
our version of rust nightly in CI,
but we can't update it to a recent
version because it triggers a warning
caused by displaydoc

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-27 18:34:37 +02:00
Kévin Commaille
d2bb17acd5 sdk: Replace hyper with axum for SSO login
hyper::Server was dropped in hyper 1, without a replacement.
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2024-04-27 17:12:10 +02:00
Ivan Enderlin
dddc607e07 timeline: add event focus mode for permalinks
timeline: add event focus mode for permalinks
2024-04-25 16:23:28 +02:00
Ivan Enderlin
25f893b0bb Merge branch 'main' into bnjbvr/permalink-mvp 2024-04-25 16:02:23 +02:00
Andy Balaam
415617080a Merge pull request #3337 from matrix-org/andybalaam/utd-type-info
crypto: UtdCause enum in reporting hooks and encryption event
2024-04-25 08:55:50 +01:00
Andy Balaam
2c7afc201f Merge pull request #3326 from matrix-org/andybalaam/allow-setting-encryption-settings
ffi: Expose encryption settings via FFI
2024-04-25 08:55:43 +01:00
Andy Balaam
89abb75d4d crypto: Include UTD cause in FFI EncryptedMessage 2024-04-24 12:16:17 +01:00
Andy Balaam
fd5666f55f crypto: Support unstable prefix for MSC4115 2024-04-24 08:31:31 +01:00
Benjamin Bouvier
397a26e00b ffi: add bindings for the timeline focus mode and associated functions 2024-04-23 19:02:59 +02:00
Benjamin Bouvier
a6c42404a6 tests: add integration tests for the new timeline focus mode 2024-04-23 19:02:45 +02:00
Benjamin Bouvier
7856dab56d timeline: add support for a focus mode in the timeline
This introduces the `TimelineFocus`, a new enum to declare if the
timeline is "live" aka looking at events from sync and displaying them
as they come in, or focused on an event (e.g. after clicking a
permalink).

When in the second mode, the timeline can paginate forwards and
backwards, without interacting with the event cache (as this would
require some complicated reconciliation of known events with events
received from pagination, with no guarantee that those events are event
connected in whatever way).

An event-focused timeline will also show edits/reactions/redactions in
real-time (as the events are received from the sync), but will not show
new timeline items, be they for local echoes or events received from the
sync.
2024-04-23 19:02:27 +02:00
Andy Balaam
ebcf1c434c ffi: Expose encryption_settings via FFI 2024-04-23 15:45:29 +01:00
Andy Balaam
b5e2eb6831 crypto: Add a UtdCause and code to determine it for membership 2024-04-23 15:44:39 +01:00
Andy Balaam
9d20a02a12 build: Ensure uniffi feature is properly passed on where needed 2024-04-23 15:26:51 +01:00
Benjamin Bouvier
8f5e1f3dfc timeline: include the remote event's origin in the timeline position/end
and don't assume inserting to the end means it's coming from sync — as
it won't be true for forward pagination anymore.
2024-04-23 13:45:01 +02:00
Benjamin Bouvier
d9864373f3 timeline: add the ability to set a prefix for internal IDs 2024-04-23 13:19:32 +02:00
Benjamin Bouvier
e4331ac9b8 timeline: use a string instead of a u64 to identify timeline items
This will allow to define a prefix later, to distinguish detached
timelines from live timelines.
2024-04-23 13:19:32 +02:00
Benjamin Bouvier
9547e3cee6 timeline: move populate_initial_user_receipt to TimelineInnerState
This makes the API less weird, and is more consistent with other read
receipts methods.
2024-04-23 13:19:14 +02:00
Benjamin Bouvier
ec45ce3aa6 timeline: prevent deadlock in populate_initial_user_receipt
Follow-up to 13cc7962.
2024-04-23 13:19:14 +02:00
Benjamin Bouvier
5916192fb6 ffi: don't abort RoomInfo creation if the room member invite event is missing
`Room::invite_details()` can return an error if the room member event
(the invite) is missing from the store. Usually that would be a sign
that the state is semi-broken, since there should always be such an
event for an invited room. But if it's missing, it shouldn't break the
creation of a `RoomInfo`, and just be missing from the struct.
2024-04-23 11:05:44 +02:00
Ivan Enderlin
5e347ce135 fix(ui): Timeline::send_reply correctly sets up m.mentions
fix(ui): `Timeline::send_reply` correctly sets up `m.mentions`
2024-04-23 09:43:05 +02:00
Ivan Enderlin
97ce5742e1 fix(ui): Timeline::send_reply correctly sets up m.mentions.
In https://github.com/matrix-org/matrix-rust-sdk/pull/2691, I suppose
the way `add_mentions` is computed is… wrong. `AddMentions` is used to
automatically infer the `m.mentions` of the reply event based on the
replied event. The way it was computed was based on the reply event
`mentions`, which seems wrong: if the reply contains mentions, then the
sender should be part of it? Nah. That's a bug. We want the reply event
to automatically mention the sender of the replied event if and only
if it's not the same as the current user, i.e. the sender of the reply
event.

This patch fixes the `add_mentions` calculation. This patch also updates
a test and adds another test to ensure that `m.mentions` is correctly
defined when replying to an event.
2024-04-23 09:30:21 +02:00
Benjamin Bouvier
13cc7962e7 timeline: prevent deadlock in replace_with_initial_events
The `state` lock was taken at the top level of this function, and
indirectly implicitly in the `set_fully_read_event` function. This fixes
it, and adds a regression test.
2024-04-22 20:49:12 +02:00
Benjamin Bouvier
c471ee42ab paginator: select how many events to retrieve from the /messages query 2024-04-22 16:58:37 +02:00
Benjamin Bouvier
8e2fdd9200 paginator: select how many events to retrieve from the initial /context query 2024-04-22 16:58:37 +02:00
Benjamin Bouvier
289e2ac92b test: silently skip the room summary test on CI, if the server doesn't support it 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
90c35b6b34 room preview: add support for MSC3266, room summary 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
fd96360228 dependencies: bump ruma
Honestly, I'm not sure how the retry-after that's a fixed point in time
in the future should be handled, open to suggestions here…
2024-04-22 14:55:47 +02:00
Benjamin Bouvier
bd65c77534 dependencies: use a fork of Ruma for the time being 2024-04-22 14:55:47 +02:00
Benjamin Bouvier
4398052d94 timeline: after an event cache update lag, fetch previous events back from the cache
Fixes #3311.

When the timeline is lagging behind the event cache, it should not only
clear what it contains (because it may be lagging some information
coming from the event cache), it should also retrieve the events the
cache knows about, and adds them as if they were "initial" events.

This makes sure that the event cache's events and the timeline's events
are always the same, and that, in the case of a lag, there won't be any
missing chunks (caused by the event cache back-pagination being further
away in the past, than what's displayed in the timeline).

The lag behind a bit too hard to reproduce, I've not included a test
here; but I think this should be the right move.
2024-04-22 11:18:19 +02:00
Ivan Enderlin
b03ae97580 Merge pull request #3346 from matrix-org/dependabot/cargo/rustls-0.21.11
chore(deps): bump rustls from 0.21.10 to 0.21.11
2024-04-22 10:48:02 +02:00