Commit graph

207 commits

Author SHA1 Message Date
Bruno Windels
63b371b6ef support findAndUpdate with same predicate semantics in SortedArray too 2021-05-31 10:47:32 +02:00
Bruno Windels
fa37e8fedb findAndUpdate uses predicate, just add callback to update method 2021-05-31 10:46:16 +02:00
Bruno Windels
2da7ef4280 can only look in remote entries here as PEEs never return an event id 2021-05-27 10:28:02 +02:00
Bruno Windels
5e9ce365bf also apply local relations when loading at top 2021-05-27 10:27:44 +02:00
Bruno Windels
a93b1af047 ensure these don't fail on a gap entry 2021-05-27 09:16:25 +02:00
Bruno Windels
2b5dcff836 consistent naming 2021-05-27 09:11:13 +02:00
Bruno Windels
da02b5fe2d transfer local echo state when replacing event entry
e.g. after decryption or remote echo of other relation comes in
2021-05-26 13:10:19 +02:00
Bruno Windels
ce7147e463 put redactions in their own view, and allow aborting while still queued 2021-05-26 13:07:56 +02:00
Bruno Windels
af45810582 add support for redactions (and relations) local echo 2021-05-21 16:59:29 +02:00
Bruno Windels
b55efb7f11 ensure updateEntries is always set in the result of GapWriter 2021-05-21 16:58:04 +02:00
Bruno Windels
f271517446 log redaction during sync 2021-05-20 15:02:14 +02:00
Bruno Windels
df9e886f32 fix lint 2021-05-20 13:22:54 +02:00
Bruno Windels
b655c34bbb also show reason for redaction 2021-05-20 13:20:12 +02:00
Bruno Windels
780ad44032 render redacted messages 2021-05-20 13:15:35 +02:00
Bruno Windels
94b0bc82ef writing relations is async 2021-05-20 12:50:16 +02:00
Bruno Windels
9b923d337d write redactions during sync 2021-05-20 12:50:16 +02:00
Bruno Windels
8ff1f91d2c bring down lint error count, delete some old, inactive unit tests 2021-05-17 12:59:04 +02:00
Bruno Windels
1216378783 Extract BaseRoom from Room with summary and timeline, not sync or send
Which we can then reuse to create a dedicated ArchivedRoom class
which will:
 - have only relevant methods and properties (e.g. no sendEvent)
 - turns out that you can still receive a leave room in the sync
   (e.g. when banned after kick) so we'll make the sync for
   an archived room separate from room to not overcomplicate the sync
   there, much like we did for Invite already.
2021-05-07 16:13:49 +02:00
Bruno Windels
7defd4a02b ensure the sync is limited when rejoining without overlap
otherwise gap would be lost. The server should do this already,
but we're just ensuring it is, to be more robust.
2021-05-06 14:15:47 +02:00
Bruno Windels
08ba4577f6 rejoin logic was throwing away the prev_batch token 2021-05-06 14:15:47 +02:00
Bruno Windels
ec0de15da6 handle overlap with existing timeline when rejoining room 2021-04-22 17:21:29 +02:00
Bruno Windels
f976eeaf13 rename SortedArray.replace to update 2021-04-08 18:36:09 +02:00
Bruno Windels
863f659774 fall back to bare userid for local echo profile 2021-04-08 16:30:46 +02:00
Bruno Windels
813be758d7 we should prefer to not pick the event itself if it's a member event
but still fall back to that if it's a new join
2021-04-08 15:33:21 +02:00
Bruno Windels
f67ccc18f4 take most recent member rather than first in timeline for inline lookup
noticed this while inspecting the code, looks related to #269
2021-04-08 12:57:10 +02:00
Bruno Windels
6f37c232f7 Don't cache members that haven't been written yet - fixes #271 2021-04-08 12:56:24 +02:00
Bruno Windels
fcc06b2754 WIP to add logging to decryption and fetching key backups 2021-03-15 14:39:42 +01:00
Bruno Windels
cfb521ef10 fix ll events being duplicated in the timeline preventing name changes 2021-03-05 20:10:57 +01:00
Bruno Windels
f4a7782298 add MemberWriter, and only return MemberChange's if something changed 2021-03-05 17:03:45 +01:00
Bruno Windels
f98f690b49 no need to "serialize" here every time, it just adds noise 2021-03-05 17:02:26 +01:00
Bruno Windels
e0d14207ac make opening a txn async again
as we'll need to await a bogus request first thing after opening the txn

funny enough, we originally made it sync to accommodate the same bug
in safari, but that didn't prevent any microtask being awaited
before scheduling a request in the calling code closing the txn.

We'll await a bogus request within the transaction class now so it
doesn't depend on the calling code
2021-03-04 19:47:02 +01:00
Bruno Windels
b012b1dc99 Show correct profile for pending messages 2021-03-03 14:53:22 +01:00
Bruno Windels
43547e0901 don't add retried entries to the timeline if they are not already there 2021-03-03 14:03:50 +01:00
Bruno Windels
7f1cdf6841 also decrypt all matching timeline entries when new key 2021-03-03 14:03:50 +01:00
Bruno Windels
8d7cb2a39a remove unused imports 2021-03-03 14:03:50 +01:00
Bruno Windels
8d080163b3 reattempt decryption for timeline items 2021-03-02 19:39:04 +01:00
Bruno Windels
061e7abd50 don't break on empty room sync response 2021-03-02 19:39:04 +01:00
Bruno Windels
8208464653 only log and clear when actually needed 2021-03-02 19:37:11 +01:00
Bruno Windels
e1821b1753 prevent linking fragment to itself when filling a gap
this seems to happen when at the beginning of the timeline and
make the timeline reader go into an infinite loop
2021-03-02 19:31:00 +01:00
Bruno Windels
6f6346d5c3 detect when hitting beginning of timeline when loading timeline 2021-03-02 19:29:55 +01:00
Bruno Windels
57bb75e864 log login & loading a session 2021-02-23 19:22:25 +01:00
Bruno Windels
f4a3b64da0 log in sync writer (at detail level) and log room ids at info level 2021-02-19 11:57:17 +01:00
Bruno Windels
fd81111bfb merge state machine from AttachmentUpload into PendingEvent
to have less state machines, and we are mostly interested in the
aggregate status of all attachments of an event

this will also drive updates through the pending events collection
that already exists rather than an extra observablevalue, so less
housekeeping to update the UI.
2020-11-18 13:04:23 +01:00
Bruno Windels
d2a4242e5b support multiple attachments per event 2020-11-13 17:19:19 +01:00
Bruno Windels
af4f3f902f wait for attachment to be uploaded in send queue
also expose attachment from PendingEvent(Entry)
2020-11-11 11:51:39 +01:00
Bruno Windels
137264edcb implement subscribing to a single event 2020-10-30 15:19:51 +01:00
Bruno Windels
46fd769dda (re)move old (compile-time) platform code 2020-10-26 10:34:35 +01:00
Bruno Windels
c8dd7b42e7 encountered this very unlikely race while testing, so prevent it 2020-10-13 13:10:35 +02:00
Bruno Windels
07eee8fac1 only create fragments when we will really write events to the timeline store 2020-10-01 17:01:33 +02:00
Bruno Windels
1117c77d05 note for future optimisation 2020-10-01 14:36:00 +02:00
Bruno Windels
76381fbca1 open storage transactions synchronously
this (almost) makes it work in some browsers that otherwise
have throw a TransactionInactiveError on the first operation
you try to do on a store.
2020-09-28 16:06:41 +02:00
Bruno Windels
17f84ab314 fix "this" still being used in readRawTimelineEntries ... 2020-09-23 19:09:44 +02:00
Bruno Windels
d53b5eefb3 fill in the blanks 2020-09-23 17:59:42 +02:00
Bruno Windels
9d41e122a0 draft of falling back to reading entries since last decrypted event key
this change notifyRoomKey(s) to only take one room key at a time
to simplify things
2020-09-23 17:34:25 +02:00
Bruno Windels
241176d6fb WIP 2020-09-22 18:22:37 +02:00
Bruno Windels
8c4d68def9 show decryption errors in timeline 2020-09-14 15:47:00 +02:00
Bruno Windels
9f6822f362 remove needsRoomKey flag on member 2020-09-11 14:38:36 +02:00
Bruno Windels
0dece5b04f make continuation logic work well with pending events
- don't use display name to compare but user id
   (pending doesn't have display name yet)
 - use current time as timestamp
2020-09-11 11:43:40 +02:00
Bruno Windels
de1cc0d739 abort decrypt requests when changing room 2020-09-10 17:43:01 +02:00
Bruno Windels
0bf1723d99 Worker WIP 2020-09-10 15:40:30 +01:00
Bruno Windels
fdbc5f3c1d WIP worker work 2020-09-10 13:00:11 +02:00
Bruno Windels
17412bbb2f more validation 2020-09-10 12:12:39 +02:00
Bruno Windels
1c77c3b876 expose multi-step decryption from RoomEncryption, adjust room timeline
sync code hasn't been adjusted yet
2020-09-10 12:11:25 +02:00
Bruno Windels
650df6fea8 forgot await 2020-09-08 15:00:29 +02:00
Bruno Windels
5a8aac57ac there might not be a member yet 2020-09-08 15:00:20 +02:00
Bruno Windels
bbaf3a5605 write needsRoomKey flag when new members joins to tracked e2ee room 2020-09-08 14:22:11 +02:00
Bruno Windels
c32ac2c764 use decryption result to show message verification status in timeline 2020-09-08 10:50:39 +02:00
Bruno Windels
9137d5dcbb make decryption algorithms return DecryptionResult
which contains curve25519 key and claimed ed25519 key as well as payload
2020-09-08 10:48:11 +02:00
Bruno Windels
a817a9aaf9 return decrypted type and content 2020-09-04 16:41:03 +02:00
Bruno Windels
8e5d5db32b add event prop on entry 2020-09-04 16:40:15 +02:00
Bruno Windels
dc0576f2db cleanup 2020-09-04 15:31:45 +02:00
Bruno Windels
5a731903da implement decrypting when loading timeline 2020-09-04 15:30:06 +02:00
Bruno Windels
62bcb27784 implement decryption retrying and decrypting of gap/load entries
turns out we do have to always check for replay attacks because
failing to decrypt doesn't prevent an item from being stored,
so if you reload and then load you might be decrypting it
for the first time
2020-09-04 15:29:58 +02:00
Bruno Windels
502ba5deea first draft of decryption in Room and RoomEncryption 2020-09-04 12:09:19 +02:00
Bruno Windels
2e67b2b6b8 handle prev_content location ambiguity 2020-08-31 14:21:18 +02:00
Bruno Windels
8482bc95ec pass memberchanges around instead of members
so we can easily tell how their membership changes, (e.g. join -> left)
which we'll need for device tracking.

Not adding this to RoomMember because RoomMember also needs to be
able to represent a member loaded from storage which doesn't contain
this error. A MemberChange exists only within a sync.
2020-08-31 09:50:57 +02:00
Bruno Windels
1fe496eeea fix crash when state is not set (erroneously?) on gap response
this seems to happen when the only event in the room is
a m.room.create
2020-08-27 09:52:30 +02:00
Bruno Windels
5d21ae3fb7 fix error on conduit with state field that is missing when empty 2020-08-21 19:10:28 +02:00
Bruno Windels
2bfbb41ee7 send receipt to server when clearing unread state so notif count clears 2020-08-21 15:16:57 +02:00
Bruno Windels
f5acee02be add comment why we do things in this order 2020-08-20 16:20:35 +02:00
Bruno Windels
fafdf669db use prev_content from later events before state 2020-08-20 15:23:56 +02:00
Bruno Windels
830c300102 fix typo that broke the txn 2020-08-20 15:23:29 +02:00
Bruno Windels
514d1d9579 first draft of adding profile info while filling gap 2020-08-20 14:39:03 +02:00
Bruno Windels
229502ca43 remove logging 2020-08-20 10:48:59 +02:00
Bruno Windels
4b275529f7 fixup: writing member info during sync 2020-08-20 10:47:14 +02:00
Bruno Windels
d31a1b5fff render display name in timeline 2020-08-20 10:26:28 +02:00
Bruno Windels
41c00ce44a write display name and avatar on event during sync 2020-08-20 10:26:08 +02:00
Bruno Windels
ba3a4ab8b2 process state events in the timeline together with other timeline events
so member info gets overwritten after all the previous events
have already been written
2020-08-20 09:39:19 +02:00
Bruno Windels
d08297d1e0 move RoomMembers to own dir 2020-08-19 16:28:09 +02:00
Bruno Windels
bfc5eb3ee5 return changed members from sync writer
we will use it to handle race between /sync and /members
and to update the member list if it loaded
2020-08-19 16:12:49 +02:00
Bruno Windels
2ad9b17ad7 no need to update members, as all the info is in the member event
as we won't store deviceTrackingStatus in the member
2020-08-19 16:10:07 +02:00
Bruno Windels
9ff4f3839c Merge branch 'master' into bwindels/memberlist 2020-08-19 12:13:38 +02:00
Bruno Windels
2526198251 replace usage of readPath with ?. 2020-08-19 11:36:43 +02:00
Bruno Windels
37597e2acb mark fragment in storage when start of timeline is reached
so we don't keep looping to fetch more messages
when scrolled all the way up
2020-08-17 17:41:10 +02:00
Bruno Windels
56efd7eee0 don't load timeline past gaps 2020-08-17 15:22:25 +02:00
Bruno Windels
00a85697ab add license header in all source files 2020-08-05 18:38:55 +02:00
Bruno Windels
f5d3092031 WIP 2020-06-26 23:26:24 +02:00
Bruno Windels
f56b96b0ff add some ideas for relations 2020-05-07 19:14:53 +02:00
Bruno Windels
28bed56b5a prevent closing more than once 2020-05-04 22:21:56 +02:00
Bruno Windels
c379caf4c0 remove obsolete ifdef comments 2020-04-20 21:31:27 +02:00