342 Commits

Author SHA1 Message Date
Kegan Dougal
808d7f8d21 client: use prettier; add README 2022-02-23 19:26:38 +00:00
Kegan Dougal
3867cece40 client: tidy up error message handling 2022-02-23 18:31:49 +00:00
Kegan Dougal
7ddcfd5ae5 client: refactor devtools, sync connection and debug commands
- Move svg / bandwidth code to devtools.js
- Move HTTP API code to SlidingSyncConnection (with abort controller and tx/rx stats)
- Remove debug commands: they need to be re-done to be actually useful for developers.
2022-02-23 18:05:09 +00:00
Kegan Dougal
05a731dfbc client: Move some sliding sync code to sync.js 2022-02-23 17:39:31 +00:00
Kegan Dougal
0b7405d062 client/bugfix: ensure that when you filter the room list it bumps to the top of the list 2022-02-23 12:34:14 +00:00
Kegan Dougal
52978edffd client: add render.js to put boring non-sliding-sync code in 2022-02-23 12:16:22 +00:00
Kegan Dougal
693a75ee66 client: Add white dots for room positions with data (default off as it's expensive) 2022-02-23 11:01:40 +00:00
Kegan Dougal
d5654f3c2f client: animate SYNC/INVALIDATE/INSERT/DELETE/UPDATE operations 2022-02-23 10:51:09 +00:00
Kegan Dougal
817b9b0442 client: Add svg visualisation of the sliding window ranges 2022-02-22 19:04:19 +00:00
Kegan Dougal
2e53b357d9 client: add Tx/Rx stats 2022-02-22 18:24:35 +00:00
Kegan Dougal
356423e2cd client/bugfix: Deep-copy DEFAULT_RANGES
Otherwise the list ranges are set to the same values for different
lists which causes one list to not render correctly.
2022-02-22 17:45:19 +00:00
Kegan Dougal
10f94336ba state: rewrite SELECT ... IN to be SELECT ... ANY
Using ANY allows us to give a single parameter containing many many
entries, which bypasses the postgres parameter limit of 65535. Without
this, large rooms like Matrix HQ which have current state >65535 events
will not be stored correctly.

Add torture test to the events table to assert that we can query >65535
events.
2022-02-22 17:38:18 +00:00
Kegan Dougal
064095c899 BREAKING: Modify syncv3_to_device_messages to include columns for type/sender
We want to be able to query based on these fields.
2022-02-22 17:04:31 +00:00
Kegan Dougal
8884b2c215 Always insert a PL event in tests 2022-02-22 10:42:54 +00:00
Kegan Dougal
b71a2b7769 Use GMSL timestamps 2022-02-21 20:35:17 +00:00
Kegan Dougal
e680a3c66d Include invited rooms in the room list
With a very basic test to make sure it appears.
2022-02-21 20:31:54 +00:00
Kegan Dougal
c8f44f6c6b Delete children at the end of the list, not the beginning
Else the IDs are wrong and need to be updated. This fixes the
bug with it requesting huge offsets when filtering by room name.
2022-02-18 18:39:55 +00:00
Kegan Dougal
44bfebfab9 Invalidate ranges when the filter changes on a list
Some bugs still exist on the client where it gets confused about the
new offsets, but the server code seems to be doing the right thing.
2022-02-18 18:29:25 +00:00
Kegan Dougal
4c10175125 bugfix: security test could send invalid state if eve hit /sync before alice
This is because only the alice stream has the room state, the test omits it
for the eve state which wouldn't be the case for a real server.
2022-02-18 17:10:35 +00:00
Kegan Dougal
bb96521843 Remove debug logging 2022-02-18 17:01:16 +00:00
Kegan Dougal
b208a2e2b3 Add room name filtering; Remove session IDs entirely
Should fix #19
2022-02-18 16:49:26 +00:00
Kegan Dougal
129f6fa61c Skip flakey multiple range test for now 2022-02-04 18:31:51 +00:00
Kegan Dougal
987b510a1c Add security tests
Specifically to ensure that single proxy multiple user doesn't leak
events to other users.
2022-02-04 18:23:25 +00:00
Kegan Dougal
c1ff6bb716 Add regression test for NPE panic when using timeline_limit: 0 2022-02-04 16:09:26 +00:00
Kegan Dougal
86113387b5 Implement a proper fix for the panic earlier 2022-02-01 15:57:56 +00:00
Kegan Dougal
39d6e99f96 NPE bugfix 2022-02-01 12:16:38 +00:00
Kegan Dougal
eaa6593d36 client: bugfix which resulted in dupe rooms 2022-01-04 16:47:56 +00:00
Kegan Dougal
8f27160a88 Make pos a string and not an int 2022-01-04 15:32:50 +00:00
Kegan Dougal
6257027a29 s/rooms/ranges 2022-01-04 15:32:50 +00:00
Matthew Hodgson
7e64721f59
typo 2021-12-27 00:34:41 +00:00
Matthew Hodgson
35511b6465
point folks to MSC3575 2021-12-27 00:34:27 +00:00
kegsay
e8c7bb9f08
Update README.md 2021-12-23 16:36:12 +00:00
Kegan Dougal
63ef76f0ca add unstable prefix 2021-12-22 18:20:02 +00:00
Kegan Dougal
617165e59f Bind to /_matrix/client/org.matrix.msc3575/sync as well as /_matrix/client/v3/sync 2021-12-22 16:23:57 +00:00
Kegan Dougal
fa823d6e86 Add support for the initial flag 2021-12-22 16:04:00 +00:00
Kegan Dougal
bcdb51321d Remove proto msc 2021-12-20 10:54:27 +00:00
Kegan Dougal
371324750c Add proto-MSC and start fleshing it out 2021-12-17 18:16:01 +00:00
Kegan Dougal
d4eee49f63 Implement E2EE extension, with tests.
- Persist OTK counts and device list changes in-memory per Poller.
- Expose a new `E2EEFetcher` to allow the E2EE extension code to
  grab said E2EE data from the Poller.
- OTK counts are replaced outright.
- Device lists are updated in a user_id->changed|left map which is then
  deleted when read.
- Add tests for basic functionality and some edge cases like ensuring that
  v3 request retries still return changed|left values.
2021-12-16 18:12:09 +00:00
Kegan Dougal
6544375383 Add API shape for E2EE extension
Most of this is just live-streaming v2 updates to any active
v3 connections, dropping them otherwise.
2021-12-16 17:18:44 +00:00
Kegan Dougal
6396cc8da1 NPE fix for tests 2021-12-16 11:37:06 +00:00
Kegan Dougal
7c6c0412fa Refine HasData check to avoid tight-looping when there are no new to-device messages 2021-12-16 11:34:15 +00:00
Kegan Dougal
24be8252f7 Change the retry schedule for the v2 poller to always be 3s
Comments explain why.
2021-12-15 09:56:58 +00:00
Kegan Dougal
0dff964705 Batch together updates
Previously when live streaming you could only get 1 update per request.
We now batch them up until there are no more incoming events.
2021-12-15 09:51:25 +00:00
Kegan Dougal
502d3b5852 Flesh out test cases for to-device events 2021-12-14 14:38:39 +00:00
Kegan Dougal
0e021eb560 Pass to-device messages through to the client
- Treat to-device messages as opaque JSON blobs
- Add basic integration test to ensure the messages make it from v2 to v3.
2021-12-14 11:51:47 +00:00
Kegan Dougal
60a53870c8 Add extensions package and glue it into the sync3 handler
Extensions will be the main way to compartmentalise additional
/sync functionality beyond the baseline of a sliding window
and room subscriptions. Things like presence, to-device messages,
receipts, OTK counts and device lists, typing, etc can all live
as optional opt-in extensions to the core protocol.

The intention is that extensions can lean on the baseline
functionality to get information like "which rooms are present
in the sliding window" and "which rooms are directly subscribed to"
in order to aid their calculations. For example, a typing extension
may have a flag to only show typing notifications in directly
subscribed rooms (e.g rooms whose timelines are visible). To-device
extensions by comparison will just be a simple 'fetch more events'
API as it cannot make use of visible rooms in any meaningful way
as metadata is encrypted, but will make use of an explicit `since`
token to avoid implicit ACKs which plague sync v2. Presence extensions
may only load presence status for users who are joined to the
sliding window of rooms rather than all rooms. This functionality
can be provided without bogging down the logic with sliding window
handling.
2021-12-13 18:22:41 +00:00
Kegan Dougal
2cd90bca1c Flesh out to-device API
Naming in harmony with https://github.com/matrix-org/matrix-doc/issues/1898
2021-12-13 15:27:02 +00:00
Kegan Dougal
9540e3456b Update API notes 2021-12-10 15:18:39 +00:00
Kegan Dougal
344cd5dbc1 Don't wait for a full sync if the user has synced before
This means we can serve rooms/events from the v3 database
immediately if they exist. The downside is that we still do
need to hit v2 to pull in to-device messages, but they can
come in later.
2021-12-10 14:40:30 +00:00
Kegan Dougal
c0265d822b Ensure that when timeline limits are expanded we honour them
We cache timelines in-memory per-room. If the initial timeline
request was small, and then a larger timeline limit was used
(say in a room subscription) then we would not fetch more events.
We now invalidate the cache if we don't have enough events AND
there is no create event in the timeline (indicating there should
be more).
2021-12-10 12:55:20 +00:00