Commit graph

923 commits

Author SHA1 Message Date
Bruno Windels
c36e812360 move RequestWrapper to own file
and add tests, improve comments, and and don't use timeout connection
error as that's not what happens if aborted request from service worker
is reported as TypeError either.
2021-04-09 15:15:28 +02:00
Bruno Windels
2b1f4866a9 map unexpected fetch AbortError to ConnectionError, so doesn't stop sync 2021-04-09 14:25:19 +02:00
Bruno Windels
e17fb24bd8 also await sharing the key in encrypt 2021-04-09 10:37:55 +02:00
Bruno Windels
13f20cdd26 wait for running key share operation in encrypt 2021-04-09 10:37:43 +02:00
Bruno Windels
bdc8451c4a better logging 2021-04-08 18:39:52 +02:00
Bruno Windels
9e697c6cbe don't add the pending event again if removed already, fixes #289 2021-04-08 18:36:26 +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
97030f7ef3 add https to homeserver if not already a valid url 2021-04-01 17:44:55 +02:00
Bruno Windels
c06659c0be support checking if pusher is still present on server 2021-04-01 14:59:46 +02:00
Bruno Windels
76fdbbb2fe shorten this 2021-03-23 18:20:23 +01:00
Bruno Windels
d5b12fa7f9 log endpoint hostname 2021-03-23 18:20:23 +01:00
Bruno Windels
3313d0623a thinko with push checks 2021-03-23 18:20:23 +01:00
Bruno Windels
630e61a674 support enabling/disabling push notifs on a session 2021-03-23 18:20:23 +01:00
Bruno Windels
d4fc08c06b put pusher bits in separate class to enable and disable on the HS 2021-03-23 18:20:23 +01:00
Bruno Windels
5d55f6d78c log app version when opening session 2021-03-15 16:55:14 +01:00
Bruno Windels
d88720a18f don't start key backup operation if not enabled 2021-03-15 16:54:43 +01:00
Bruno Windels
2b24de838a actually log initial session backup enabling rather than using null log 2021-03-15 15:24:57 +01:00
Bruno Windels
325d237302 simpler optional log 2021-03-15 15:23:46 +01:00
Bruno Windels
8684d6b5e5 some fixes 2021-03-15 15:23:35 +01:00
Bruno Windels
fcc06b2754 WIP to add logging to decryption and fetching key backups 2021-03-15 14:39:42 +01:00
Bruno Windels
f2dc7728a5 notifyRoomKey was a better name 2021-03-15 14:36:38 +01:00
Bruno Windels
96f060c0a9 also retry decryption for backfilled entries
as their event ids won't be stored along the missing key (we only store
synced items so we don't fill up the missing event ids in the store
with undecryptable backfilled event ids)
2021-03-15 14:33:14 +01:00
Bruno Windels
4b62e0a2ce extract retry event ids for key before overwriting key on key backup 2021-03-15 13:38:27 +01:00
Bruno Windels
b4f4594ead
Merge pull request #267 from vector-im/bwindels/fix-223
consider all server errors as connection errors
2021-03-09 11:54:21 +00:00
Bruno Windels
0bd0f788e3 consider all server errors as connection errors
even if they do have an errcode

fixes #223
2021-03-09 12:51:34 +01:00
Bruno Windels
8cd6a7988a on fill server OTKs up to max/2
so we don't remove keys for yet to be received
olm messages that claimed a key
2021-03-09 12:33:31 +01:00
Bruno Windels
0b211e8e1c simplify this code now that it is only doing one thing 2021-03-09 12:27:51 +01:00
Bruno Windels
30b056af1c let devices know we can't claim their OTKs 2021-03-08 16:19:46 +01:00
Bruno Windels
30525cf391 oops, missing await to store new olm sessions! 2021-03-08 16:19:28 +01:00
Bruno Windels
a3987a655e log if a connection error is a timeout 2021-03-08 15:35:34 +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
b37a586094 add clarification why this doesn't need to also check member changes 2021-03-05 17:04:18 +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
e97ed9ae45 fix session test, just barely 2021-03-05 17:03:12 +01:00
Bruno Windels
49fc971d67 cleanup 2021-03-05 17:02:57 +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
4e0bd16a4e reuse LRU Cache for session cache 2021-03-05 17:01:38 +01:00
Bruno Windels
c1c8f11bf7 fix TypeError when syncing a new e2ee room with keys at the same time 2021-03-05 11:50:54 +01:00
Bruno Windels
5682e715e6 prevent multiple checks if a new room key is better 2021-03-05 10:07:48 +01:00
Bruno Windels
d08c41c13a probably best to close this 2021-03-04 22:09:11 +01:00
Bruno Windels
932d26ed8c detect the webkit bug, and await a bogus request when opening a txn 2021-03-04 19:49:13 +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
4445b1ee01 store key share operations before tracking the room 2021-03-03 18:56:16 +01:00
Bruno Windels
aa23672694 forgot await, this broke updating the timeline when fetching key backup 2021-03-03 17:50:38 +01:00
Bruno Windels
b012b1dc99 Show correct profile for pending messages 2021-03-03 14:53:22 +01:00
Bruno Windels
6771303086 make a method to determine only the retry entries rather 2021-03-03 14:03:50 +01:00
Bruno Windels
404dbcd065 english 2021-03-03 14:03:50 +01:00
Bruno Windels
e7598b9c76 only request key backup for events that are UTD 2021-03-03 14:03:50 +01:00
Bruno Windels
30481a5a9e add logging to key sharing and discarding in reaction to member changes 2021-03-03 14:03:50 +01:00
Bruno Windels
f3c49e51f2 add, don't replace timeline retry entries
also, filter out any that have been decrypted already
2021-03-03 14:03:50 +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
3671574547 comment about session backup 2021-03-03 14:03:50 +01:00
Bruno Windels
3bfe52b1dc filter encrypted events before deciding to decrypt or not 2021-03-03 14:03:50 +01:00
Bruno Windels
9702c4fd64 more logging in sync write 2021-03-03 14:03:50 +01:00
Bruno Windels
8d7cb2a39a remove unused imports 2021-03-03 14:03:50 +01:00
Bruno Windels
e85844f482 don't redeclare retryEntries, or they won't get passed to writeSync 2021-03-03 14:03:50 +01:00
Bruno Windels
56db210763 attempt at fixing https://github.com/vector-im/hydrogen-web/issues/245 2021-03-03 14:03:50 +01:00
Bruno Windels
e29bc6710a bring back missing import 2021-03-03 14:03:50 +01:00
Bruno Windels
c6db23bcfb WIP to store missing session event ids 2021-03-03 14:03:50 +01:00
Bruno Windels
3fa2d22015 remove isTimelineOpen flag and rather do the check to verify in Room
flags are ugly, let's avoid them where we can
2021-03-03 14:03:50 +01:00
Bruno Windels
265a9bd993 applyToEntries does not return anything 2021-03-02 19:39:04 +01:00
Bruno Windels
10003e7d3a also sync room not in the rooms section but with new room keys 2021-03-02 19:39:04 +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
8a39c16a38 fix name conflict with _sessionInfo in parent class 2021-03-02 19:39:04 +01:00
Bruno Windels
a536ea7742 comment to explain replay attack better 2021-03-02 19:39:04 +01:00
Bruno Windels
a33200d926 fix sender key lookup for room key coming from olm 2021-03-02 19:39:04 +01:00
Bruno Windels
fb446167f6 make new sync room keys available during decryption of same sync 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
636208a321 show all event type counts in device msg logging 2021-02-24 20:56:20 +01:00
Bruno Windels
1e209b8613 Prevent pending events being skipped when remote echo comes
This fixes #241
2021-02-24 14:14:04 +01:00
Bruno Windels
b63ad629a7 can remove console logging here now 2021-02-24 11:25:26 +01:00
Bruno Windels
48c361531d log clearing unread state of a room 2021-02-24 11:22:19 +01:00
Bruno Windels
376e59820c more info when logging gap fills 2021-02-24 11:22:07 +01:00
Bruno Windels
1093895133 log opening timeline
also load the timeline when opening it in the room, so logging
starts in the room (and we don't need to pass the logger to Timeline)
and also API-wise it makes more sense to
not return uninitialized objects
2021-02-24 11:21:04 +01:00
Bruno Windels
41ecf1db8e missing semicolon 2021-02-24 10:38:19 +01:00
Bruno Windels
23b8ba7e54 unused var 2021-02-24 10:14:26 +01:00
Bruno Windels
86011b42e3 await the room log operations for login/load session
so the callee can await the operation
2021-02-24 09:58:50 +01:00
Bruno Windels
0cbf6008a2 log event id when sending and when receiving remote echo on sync 2021-02-23 19:58:01 +01:00
Bruno Windels
dd38fc13d7 log sending messages 2021-02-23 19:22:59 +01:00
Bruno Windels
57bb75e864 log login & loading a session 2021-02-23 19:22:25 +01:00
Bruno Windels
ef1e867dee no need for keys in the iteration 2021-02-23 19:20:58 +01:00
Bruno Windels
67ddcaa468 fix lint errors in Sync 2021-02-23 19:20:36 +01:00
Bruno Windels
c6c96a611a fix iteration bug when disposing pending events at shutdown
discovered by logging
2021-02-23 19:04:25 +01:00
Bruno Windels
0a4d72b011 remove extra newline 2021-02-22 11:23:24 +01:00
Bruno Windels
94cc8b99b0 don't need to check this actually, sync response should be there 2021-02-22 11:21:56 +01:00
Bruno Windels
f0d9d13f4e don't assume device lists are set in sync response 2021-02-22 11:20:51 +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
08622699f6 more logging for device messages 2021-02-18 19:56:47 +01:00
Bruno Windels
c5c0a181ff move check for devicelists up in Session.writeSync, and more logging 2021-02-18 19:56:10 +01:00
Bruno Windels
ad0c813833 don't take network time into account in sync log filter 2021-02-18 19:48:19 +01:00
Bruno Windels
cd68bb7b3f log when devices get marked as outdated 2021-02-18 14:00:06 +01:00
Bruno Windels
8539b0c893 also log session in after sync completed as detail level 2021-02-18 13:07:52 +01:00
Bruno Windels
dea11845f5 log encrypted event count in session sync write 2021-02-18 13:07:32 +01:00
Bruno Windels
e590b573fb log remaining specific room entries as detailed 2021-02-18 12:44:19 +01:00
Bruno Windels
9f9de0988e don't log here yet as the logger isn't passed from createIdentity yet 2021-02-18 12:44:19 +01:00
Bruno Windels
7524a912c3 use (t)ype rather than kind 2021-02-18 12:44:19 +01:00
Bruno Windels
f321968ac3 add more sync logging 2021-02-18 12:44:19 +01:00
Bruno Windels
d201d2c9de don't use depth based log filtering, also add Detail log level
it's hard to make it work with an override where you don't want
to filter by depth if a given loglevel is present in the children.
2021-02-18 12:44:19 +01:00
Bruno Windels
d39c3812b2
Merge pull request #231 from vector-im/bwindels/logs
Structured logging
2021-02-17 10:19:46 +00:00
Bruno Windels
338f628627 remove option to anonymize 2021-02-16 18:30:06 +01:00
Bruno Windels
4defbe1322 simplify log filtering, while also adding depth based filtering 2021-02-16 15:07:17 +01:00
Bruno Windels
78805f0a65 implement dynamic log filtering
the logger does not have a base level any more, because there is
no sensible place to configure this.

instead, we allow to dynamically determine what should be logged
after an operation finished by setting the threshold and default
log level inspecting the finished log item.
2021-02-16 11:37:48 +01:00
Bruno Windels
704708bd6c add some logging to sync 2021-02-12 18:56:26 +01:00
Bruno Windels
a53c25d2ae support logging in hsApi 2021-02-12 18:35:33 +01:00
Bruno Windels
bbab1e9ecc move base64/58 encoding into platform
fixes https://github.com/vector-im/hydrogen-web/issues/99
2021-02-12 16:01:54 +01:00
Bruno Windels
91bd5f638c finish logging api 2021-02-12 13:04:05 +01:00
Bruno Windels
e515548037 add some comments while debugging a problem 2021-02-11 21:08:06 +01:00
Bruno Windels
89599e9f87 WIP 2021-02-11 21:07:18 +01:00
Bruno Windels
e49639fda2 move textencoder/decoder into platform 2021-02-11 17:29:48 +01:00
Bruno Windels
ac1bbb3937 ensure thumbnail dimensions are integer, fixes #203 2021-02-11 11:15:20 +01:00
Bruno Windels
764cddcdec can be cached 2020-11-20 11:45:38 +01:00
Bruno Windels
8b8d06cf3e show error for attachments still need upload but missing after refresh 2020-11-19 14:42:29 +01:00
Bruno Windels
0581066350 upload smallest attachments first
so you don't get a delay at the end of the upload
when starting a new request
2020-11-18 20:09:27 +01:00
Bruno Windels
a23075a326 make safe to call when no attachments present 2020-11-18 20:09:07 +01:00
Bruno Windels
fba5877b3b dispose attachment blobs when pending event is removed/closing session 2020-11-18 20:08:42 +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
83cbe78cd6 report attachment upload progress 2020-11-16 10:45:46 +01:00
Bruno Windels
1dd46b875b this is fine actually, as it will get encrypted.
just don't pass it to the upload
2020-11-13 19:22:06 +01:00
Bruno Windels
0292725076 better formatting 2020-11-13 19:10:18 +01:00
Bruno Windels
262cc8936e don't leak mimetype for encrypted attachments 2020-11-13 19:10:04 +01:00
Bruno Windels
d2a4242e5b support multiple attachments per event 2020-11-13 17:19:19 +01:00
Bruno Windels
8b16d8bc99 handle upload failures better 2020-11-11 13:06:03 +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
48cd4ac95d track upload error 2020-11-11 11:51:11 +01:00
Bruno Windels
91f15074be /upload is on /media/r0, not /client/r0 2020-11-11 11:50:40 +01:00
Bruno Windels
366f3c0bba iv and digest are sent in unpadded base64 2020-11-11 11:50:20 +01:00
Bruno Windels
e9324ad678 support jwk keys to encrypt 2020-11-11 11:47:39 +01:00
Bruno Windels
7088b2cdc8 support attachment upload and sending from room api 2020-11-11 10:47:55 +01:00
Bruno Windels
0c70a67ebb pass platform to room
as we'll need it to access crypto and creating blobs
2020-11-11 10:47:19 +01:00
Bruno Windels
c289bcd097 return blob from encryptAttachment 2020-11-11 10:46:37 +01:00
Bruno Windels
32b7b1f064 draft of AttachmentUpload class 2020-11-11 10:46:20 +01:00
Bruno Windels
2890a6aff7 implement attachment uploading in hs api rather than media repo
as we need the access token
2020-11-11 10:45:44 +01:00
Bruno Windels
9f2c7c1e32 support uploading blobs in hs api 2020-11-11 10:45:23 +01:00
Bruno Windels
2cfffa015d WIP 2020-11-10 22:36:26 +01:00
Bruno Windels
d14f485292 Merge branch 'master' into bwindels/file-downloads 2020-11-10 18:55:27 +01:00
Bruno Windels
f5480b7708 provide random value for IE11 2020-11-10 18:31:18 +01:00
Bruno Windels
ba323c65d6 fix typo in name 2020-11-10 18:30:48 +01:00
Bruno Windels
373a42c7a8 allow downloading plaintext attachments also, with or without cache 2020-11-10 17:49:48 +01:00
Bruno Windels
de143fdafc update timestamp when creating a new megolm session 2020-11-10 16:17:56 +01:00
Bruno Windels
769feac73c cleanup 2020-11-10 14:02:27 +01:00
Bruno Windels
5f6ad91ff2 offload creating an olm session to the olm worker
so IE11 doesn't lock up when you start typing
2020-11-10 11:04:09 +01:00
Bruno Windels
bd5771e449 remove obsolete comment 2020-11-09 17:22:37 +01:00
Bruno Windels
6572377832 move tracking the room to where we need the devices 2020-11-09 16:50:39 +01:00
Bruno Windels
9cfb3c8e95 only check to pre-share new megolm session every minute 2020-11-09 16:50:05 +01:00
Bruno Windels
44a2febce9 hook it up 2020-11-06 23:43:02 +01:00
Bruno Windels
c6ff4c2517 finish room encryption part 2020-11-06 18:56:32 +01:00
Bruno Windels
d0d1f68a9c WIP 2020-11-06 16:56:12 +01:00
Bruno Windels
5d12aef6db support pre-sharing room keys in room encryption 2020-11-06 10:32:37 +01:00
Bruno Windels
e0c8be3a9a try to call out when #187 happens 2020-11-05 22:41:33 +01:00
Bruno Windels
16542284f3 fix #48 2020-11-05 21:24:14 +01:00
Bruno Windels
b8370d53b6 always throw here so we never get to Ready status when stopped 2020-11-05 21:22:29 +01:00
Bruno Windels
134f018849 always have an error when stopping sync 2020-11-05 21:21:27 +01:00
Bruno Windels
a3ec01385b
Merge pull request #178 from vector-im/bwindels/lightbox
Lightbox for picture messages
2020-11-02 11:23:10 +00:00
Bruno Windels
597a57eae3 too much whitespace 2020-10-30 19:59:21 +01:00
Bruno Windels
137264edcb implement subscribing to a single event 2020-10-30 15:19:51 +01:00
Bruno Windels
7d81306a49 return BufferHandles from the media repository
BufferHandles are platform specific handles to a buffer. On web,
they have a .blob and .url property.
2020-10-30 15:18:27 +01:00
Bruno Windels
3008367307 detect AbortError properly, name is a string 2020-10-30 09:54:38 +01:00
Bruno Windels
a3aa25449b make it work with xhr 2020-10-26 17:37:32 +01:00
Bruno Windels
3ed5ea8b0b Merge branch 'master' into bwindels/decrypt-images 2020-10-26 17:08:29 +01:00
Bruno Windels
1a518cdd28 more refactor fixes 2020-10-26 16:31:30 +01:00
Bruno Windels
03351d2e1f extract platform class to put all platform specific code in 2020-10-26 15:44:11 +01:00
Bruno Windels
46fd769dda (re)move old (compile-time) platform code 2020-10-26 10:34:35 +01:00
Bruno Windels
4fd71279cf don't disable cache for media repository downloads 2020-10-26 09:58:39 +01:00
Bruno Windels
6a468a0883 decrypt attachment code 2020-10-23 17:45:15 +02:00
Bruno Windels
3a6268f0c1 basic PoC of image decryption working
needs looooaaads of cleanup still
2020-10-23 17:25:11 +02:00
Bruno Windels
f214c53fa9 add @internal and other comments to Session 2020-10-23 12:59:40 +02:00
Bruno Windels
df8eed14aa expose whether we already have a 4s key,to show the 4s setup in settings
it's a tri-state of null/false/true with null meaning we need to
go online first to know as only then we try to setup session backup
2020-10-23 12:57:47 +02:00
Bruno Windels
df72e829bf setup session backup as part of start method, so we know we're online
also don't upload OTKs in case of existing account until
catchup sync has happened
2020-10-23 12:22:52 +02:00
Bruno Windels
a7a922680d request persisted storage when logging in/restoring a session 2020-10-20 17:02:34 +02:00
Bruno Windels
6f82d81f39 better session backup ui 2020-10-19 18:29:13 +02:00
Bruno Windels
974f77a71d WIP 2020-10-16 18:06:20 +02:00
Bruno Windels
0d622164df close session db in other tabs when opening 2020-10-16 12:50:37 +02:00
Bruno Windels
8122d76e73 Merge branch 'master' into bwindels/url-routing 2020-10-14 12:45:49 +02:00
Bruno Windels
b00db1af3e only keep 20 outbound olm sessions in memory at once to prevent OOM 2020-10-14 12:44:27 +02:00
Bruno Windels
07701117cd reduce megolm sync cache size to 1 session
as this is kept around for every e2ee room, and we only have
limited olm memory
2020-10-14 12:43:35 +02:00
Bruno Windels
b29b776e9f fix olm session cache being leaked when closing session 2020-10-14 11:25:49 +02:00
Bruno Windels
c8dd7b42e7 encountered this very unlikely race while testing, so prevent it 2020-10-13 13:10:35 +02:00
Bruno Windels
927e8134d3 use url navigation in root view model
also track all view models as it is
important everything is properly disposed now
2020-10-09 17:03:38 +02:00
Bruno Windels
00bd4364f0 early draft of loading session via url scheme 2020-10-08 18:23:37 +02:00
Bruno Windels
a7db44eabf
Merge pull request #138 from vector-im/bwindels/filter-room-list
Room list filtering
2020-10-06 11:08:39 +00:00
Bruno Windels
b1cb797919 fix refactor error in xhr, breaking it 2020-10-06 13:02:35 +02:00
Bruno Windels
7def542e21 fix test 2020-10-06 12:19:47 +02:00
Bruno Windels
5ae1be9a9c ignore invalid json on error pages 2020-10-05 17:18:05 +02:00
Bruno Windels
c8e4dbc1b3 this should be a map 2020-10-05 17:06:29 +02:00
Bruno Windels
e93b091566 dont use no-cache in fetch, as it doesn't play well with CORS on Safari 2020-10-02 14:02:59 +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
bebdaad7d4 log when we can't abort 2020-10-01 16:23:15 +02:00
Bruno Windels
c1df371a14 add some documentation for our idb investigations 2020-10-01 16:14:58 +02:00
Bruno Windels
9a4d47820d change this back as well 2020-10-01 14:46:30 +02:00
Bruno Windels
cb7da2ba4a dont need this anymore 2020-10-01 14:45:09 +02:00
Bruno Windels
f402e8c6c4 typo/thinko in docs 2020-10-01 14:39:23 +02:00
Bruno Windels
300529b7c5 write sync token first
in case we get a TransactionInactiveError,
we have at least written the sync token
and won't repeat the same sync request
2020-10-01 14:38:54 +02:00
Bruno Windels
1117c77d05 note for future optimisation 2020-10-01 14:36:00 +02:00
Bruno Windels
d5a6a4d350 todo comment 2020-10-01 14:35:46 +02:00
Bruno Windels
3c7125bb88 add (optional) logging for idb requests 2020-10-01 14:35:33 +02:00
Bruno Windels
93a7f9959e Safari doesn't like the prepare txn still open when opening the sync txn
Waiting for it to close magically solves the TransactionInactiveError
we were seeing on some incremental sync request when
reading from roomMembers.

Still unsure what this is about, and if we should wait for all read txns
to close or not.
2020-10-01 14:31:38 +02:00
Bruno Windels
ddb14f48bf we actually don't need to track write requests
as errors will bubble up to the txn
2020-10-01 14:31:08 +02:00
Bruno Windels
d5a52c32d6 these don't return a promise anymore 2020-09-29 11:51:14 +02:00
Bruno Windels
37690cffe3 track storage write requests internally, as we never await their promise 2020-09-29 11:50:37 +02:00
Bruno Windels
482b5f4d22 allow passing message to IDBRequestError 2020-09-29 11:50:10 +02:00
Bruno Windels
43d430fc98 remove unused storage modification functions 2020-09-29 11:47:49 +02:00
Bruno Windels
f993048a2b Merge branch 'master' into bwindels/idb-promises-txn 2020-09-29 11:33:58 +02:00
Bruno Windels
e5b1cbbcd3 prevent endless loop when restoring messages that were already sent 2020-09-29 11:32:49 +02:00
Bruno Windels
7627a2bda2 add comment 2020-09-29 10:53:02 +02:00
Bruno Windels
163ca12854 ignore abort error 2020-09-29 10:52:52 +02:00
Bruno Windels
919357b474 more broken imports after refactor 2020-09-29 09:57:48 +02:00
Bruno Windels
c529df179b also import this 2020-09-29 09:56:46 +02:00
Bruno Windels
c1ecaffbae fix refactor typo 2020-09-29 09:54:51 +02:00
Bruno Windels
07fcf7e75b also do this in try catch 2020-09-29 09:43:25 +02:00
Bruno Windels
b1f9cfd972 cleanup storage errors a bit 2020-09-29 09:17:03 +02:00
Bruno Windels
ee4c132fb4 add todo 2020-09-28 16:06:41 +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
d759e1429f set error before changing state to stopped 2020-09-28 16:06:19 +02:00
Bruno Windels
3440823981
Merge pull request #117 from vector-im/bwindels/idb-promises
Prevent transaction from closing on IE11/Win7
2020-09-28 13:37:34 +00:00
Bruno Windels
dd30f51ffe add copyright 2020-09-28 15:28:51 +02:00
Bruno Windels
8366b44d8c dont assume global is window 2020-09-28 14:52:12 +02:00
Bruno Windels
98a6d82820 detect when sync promise hack is needed 2020-09-28 14:51:41 +02:00
Bruno Windels
706ec97296 change method name 2020-09-28 13:25:44 +02:00
Bruno Windels
64290d5ae6 flush promises manually in idb event handler 2020-09-25 16:53:19 +02:00
Bruno Windels
27a8ef4604 add comment how timeouts interact with the reconnector 2020-09-25 10:45:41 +02:00
Bruno Windels
e175e9ac8b cleanup 2020-09-25 10:45:34 +02:00
Bruno Windels
134b04c782 make flushing room key shares reentrant
as it can be called from Room.start while still running.
2020-09-25 10:45:00 +02:00
Bruno Windels
bcca23bac9 retry sync on timeout, even for incremental sync 2020-09-25 10:44:36 +02:00
Bruno Windels
7f0d36cf79 remove double negation 2020-09-25 10:44:19 +02:00
Bruno Windels
86df4993e1 prevent room summary from being updated every time it is in /sync resp 2020-09-24 16:45:28 +02:00
Bruno Windels
46abafdccc ensure cloned is always set to false for this._data
by making all assignments of this._data go through applyChanges
2020-09-24 16:40:51 +02:00
Bruno Windels
4a0173e90f only run decryptPending if needed 2020-09-24 10:53:51 +02:00
Bruno Windels
4d616ce281 add todo for future optimisation 2020-09-24 10:35:09 +02:00
Bruno Windels
ece4840653 don't mark rooms as unread after retrying decryption for now
this will not mark e2ee rooms as unread if their room key is delayed
though. We should really only do this for back-filled events but that
is hard to do right now, as we don't know the original source here.
2020-09-23 19:11:11 +02:00
Bruno Windels
eb4237f6f4 tell caller if an update was done from summery.writeAndApplyData
so room actually emits an update
2020-09-23 19:10:25 +02:00
Bruno Windels
17f84ab314 fix "this" still being used in readRawTimelineEntries ... 2020-09-23 19:09:44 +02:00
Bruno Windels
086bdafe9a no need for async 2020-09-23 18:28:21 +02:00
Bruno Windels
7cad3b2bdb some tabs in here 2020-09-23 18:22:51 +02:00
Bruno Windels
64f657e5a2 fix test 2020-09-23 18:20:29 +02:00
Bruno Windels
6e77ebb160 undo obsolete changes 2020-09-23 18:06:16 +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
a8392dc684 also decrypt messages in the sync response that enabled encryption
like initial sync
2020-09-23 14:26:14 +02:00
Bruno Windels
241176d6fb WIP 2020-09-22 18:22:37 +02:00
Bruno Windels
137f55b44d manage request scheduler in session container
so we can start it before sync does its first request,
which otherwise gets aborted because the scheduler hasn't started yet
2020-09-22 16:39:41 +02:00
Bruno Windels
150f06b9bf also move to Stopped for aborts 2020-09-22 16:39:04 +02:00
Bruno Windels
85b451ffa1 can't rename named params like this 2020-09-22 15:49:43 +02:00