Commit Graph

551 Commits (7054f74783effdb96733c38b65e2f4f315ec2fd6)

Author SHA1 Message Date
Timo Kösters 45086b54b3
improvement: upgrade dependencies, fix timeline reload bug 2020-12-05 21:04:34 +01:00
Devin Ragotzy 164b1633d8
Update ruma to latest, renamed server keys and removed PduStub 2020-12-05 17:44:54 +01:00
Devin Ragotzy b869aab5d0
Cleanup removing debug printing and logging, append non state events 2020-12-05 17:37:13 +01:00
Devin Ragotzy c173ce43a5
convert_to_outgoing_federation_event takes CanonicalJsonObj 2020-12-05 17:37:12 +01:00
Devin Ragotzy 27e686f9ff
Convert uses of serde_json::Value to CanonicalJsonObject 2020-12-05 17:37:12 +01:00
Devin Ragotzy b6d721374f
Have Media db return optional content_type, conversion fixes 2020-12-05 17:37:11 +01:00
Devin Ragotzy bb24f6ad90
Address some review issues fmt, errors, comments 2020-12-05 17:37:11 +01:00
Devin Ragotzy 86bb93f8cf
Remove outdated TODOs, use StateEvent::from_id_value consistently 2020-12-05 17:37:10 +01:00
Devin Ragotzy 234b226468
Fix review issues, Remove EventHash's in prev/auth_events in StateEvent
The latest state-res crate uses ruma's PduRoomV3 PDU's which don't have
tuples of (EventId, EventHashs) like previous versions did (this was
left from rebasing onto master). The Media DB
now takes an optional content_type like the updated ruma structs.
2020-12-05 17:37:10 +01:00
Devin Ragotzy acd144e934
Fix get_closest_parent and cleanup federation/send/:txn 2020-12-05 17:37:10 +01:00
Devin Ragotzy b13049a6fa
Fix federated join miss hashing the join event created 2020-12-05 17:37:09 +01:00
Devin Ragotzy eca0bbb35a
Fix federated join miss hashing the join event created 2020-12-05 17:37:09 +01:00
Devin Ragotzy dcd1163806
All outgoing pdus in Sending must be PduStubs 2020-12-05 17:37:08 +01:00
Devin Ragotzy c9a6ce54cb
Add basic handling of EDUs for /send/txn 2020-12-05 17:37:08 +01:00
Devin Ragotzy 0d69ebdc6c
Reformat imports and fix clippy warnings 2020-12-05 17:37:07 +01:00
Devin Ragotzy db8a0c5d69
Add closest_parent method to Rooms Db insert in order /send pdus 2020-12-05 17:37:07 +01:00
Devin Ragotzy 96dd3b2880
Update ruma to latest, fix unstable origin feature in ruma 2020-12-05 17:37:07 +01:00
Timo Kösters 6e36081573
improvement: more logging 2020-12-05 17:35:00 +01:00
Timo Kösters 9439f2c183
feat: send logs into admin room
Log entries will automatically be deduplicated, so a message won't be
sent if the same line has already been sent in the last 30 mins
2020-12-05 17:34:58 +01:00
Timo Kösters e691e880e0
fix: logging thread crash when admin room does not exist 2020-12-02 16:08:59 +01:00
Timo Kösters 9f8cffcd22
Admin room improvements 2020-11-09 12:21:57 +01:00
Timo Kösters 16b22bb432
fix: don't allow more than 50 PDUs in a transaction 2020-11-03 21:53:57 +01:00
Timo Kösters 0762196963
fix: don't send new events from left rooms 2020-10-27 20:26:28 +01:00
Timo Kösters 2f5df4aac9
improvement: more reliable federation sending 2020-10-27 20:26:27 +01:00
Timo Kösters df82314440
improvement: welcome message 2020-10-23 14:38:12 +02:00
Timo Kösters 6b3934e31d
feat: configurable cache capacity 2020-10-23 14:38:12 +02:00
Timo Kösters 6dbe195695
improvement: flush after every request that manipulates the db 2020-10-23 14:38:07 +02:00
Timo Kösters 6bb8284fc0
improvement: correct thumbnailing algorithm 2020-10-19 17:21:28 +02:00
Timo Kösters f0a21b6165
fix: use device_id when registering
TIL body.device_id != (*body).device_id, which is pretty bad, so I
renamed body.device_id to body.sender_device
2020-10-18 21:51:28 +02:00
Timo Kösters 243126d393
Allow reading state if history_visibility is world readable
See https://matrix.org/docs/spec/client_server/r0.6.1#id87
2020-10-18 16:44:18 +02:00
Timo Kösters 12b0efac8b
fix: random timeline reloads 2020-10-18 09:03:40 +02:00
Timo Kösters 9109cb492f
fix: double join over federation 2020-10-17 11:24:57 +02:00
Timo Kösters dfcfab5b7e Merge branch 'master' into deps 2020-10-16 14:06:14 +02:00
Timo Kösters 9d1387954f
Update dependencies, remove dbgs 2020-10-16 14:04:29 +02:00
Timo Kösters b6ed018d16 Merge branch 'master' into reduce-mxc-length 2020-10-14 11:48:25 +02:00
Timo Kösters 304c53c4f5
style: make clippy happier 2020-10-07 12:29:19 +02:00
Timo Kösters 6afc4c9b3e
feat: federation disabled by default
It can be enable in the Rocket.toml config or using ROCKET_FEDERATION_ENABLED=true
2020-10-07 11:51:56 +02:00
Timo Kösters c15ae3c126
fix: invalid typing bytes because of 0xff in numbers 2020-10-07 11:51:56 +02:00
Timo Kösters bcd1fe1856
feat: admin room 2020-10-07 11:51:49 +02:00
Timo Kösters 0d6159c2da
improvement: get_missing_events route and cleanup 2020-10-01 20:49:15 +02:00
Timo Kösters ab332363ce
fix: don't send new requests to servers if we are already waiting 2020-10-01 20:49:14 +02:00
miruka 26e200e290 Reduce media ID length from 256 to 32
Most common filesystems limit paths to 255 bytes.
This change brings down the media ID length to be similar to
Synapse servers (25), and makes it possible for clients to
download media with the ID included in the filename.
2020-09-25 14:18:36 -04:00
Timo Kösters e08dfd982b
improvement: look at SRV record when sending requests 2020-09-23 12:04:02 +02:00
Timo Kösters 267c721616
fix: encryption and sync spam 2020-09-18 10:29:44 +02:00
Timo Kösters 8bcfff2766
fix: no notification counts for fast /syncs 2020-09-18 10:29:43 +02:00
Timo Kösters ea3aaa6b5c
improvement: more efficient /sync with gaps 2020-09-18 10:29:43 +02:00
Timo Kösters 506c2a3146
fix: can't find count from event in db 2020-09-17 10:24:18 +02:00
Timo Kösters 4db6d7e430
fix: remove avatar url checks
They are not in the spec and maubot relies on that
2020-09-16 18:10:55 +02:00
Timo Kösters a567cd81d5
improvement: better logs on deserialization errors 2020-09-16 15:08:51 +02:00
Timo Kösters f4078a29eb
fix: synapse complains about missing origin 2020-09-16 11:42:33 +02:00
Timo Kösters dd749b8aee
fix: server keys and destination resolution when server name contains port 2020-09-16 11:01:04 +02:00
Timo Kösters 005e00e9b1
fix: remove well-known 2020-09-15 17:16:55 +02:00
Timo Kösters 1bf614b0f5
fix: remove transaction_id from pdus over federation 2020-09-15 17:02:20 +02:00
Timo Kösters b7ab57897b
fix: sending slowness 2020-09-15 16:14:59 +02:00
Timo Kösters 0b263208e3
fix: don't panic on bad server names 2020-09-15 08:55:02 +02:00
Timo Kösters 71500b14b9
fix: send to all servers and fix media store 2020-09-15 08:17:15 +02:00
Timo Kösters f7816b11de
feat: send messages over federation 2020-09-15 08:17:06 +02:00
Timo Kösters 9f05ef926a
fix: filter public room dir 2020-09-14 16:23:15 +02:00
Timo d1099e9224
Update dependencies 2020-09-14 14:36:49 +02:00
Timo Kösters aa5e9e607e
feat: download media and thumbnails over federation 2020-09-14 14:20:38 +02:00
Timo Kösters 4e44fedbcd
fix: room list over federation 2020-09-14 11:43:42 +02:00
Timo Kösters c5313b3e8f
improvement: try out multiple servers when joining remote rooms 2020-09-14 11:00:31 +02:00
Timo Kösters 1f292c09f2
improvement: better federation joins 2020-09-14 09:29:46 +02:00
Timo Kösters af53485d70
fix: avoid pdus without event ids 2020-09-12 23:38:52 +02:00
Timo Kösters 1f28434988
feat: hacky transactions 2020-09-12 22:42:05 +02:00
Timo Kösters e6b1f54857
Merge remote-tracking branch 'origin/master' into federation 2020-09-12 22:23:54 +02:00
Timo Kösters 12a8c9badd
fix: join rooms over federation 2020-09-12 21:30:07 +02:00
Timo Kösters 1e8fbd8d50
Update ruma version 2020-09-08 17:32:03 +02:00
Timo Kösters 698e44a732
Fix /upgrade account data problems 2020-09-01 13:08:49 +02:00
Timo Kösters 515465f900
fix: make element not show "unknown user" warning
The 404 error for /profile in the spec says "There is no profile
information for this user or this user does not exist.", but Element
assumes every 404 is a user that does not exist.
2020-08-31 13:23:39 +02:00
Faelar df55e8ed0b
Add room upgrade. 2020-08-31 12:01:41 +02:00
Devin Ragotzy 2a63d0955a Sort and authenticate the events from /send_join response 2020-08-30 16:08:47 -04:00
Devin Ragotzy 3b40f3d60e Update state-res crate 2020-08-27 20:11:53 -04:00
Devin Ragotzy f46c2d1eec Fix review issues, move state-res to spec-comp branch 2020-08-27 20:11:53 -04:00
Timo Kösters 3f4cb753ee
improvement: add remaining key backup endpoints 2020-08-27 14:52:20 +02:00
Timo 4954df3cc3
feat: handle txn ids 2020-08-25 21:33:44 +02:00
Devin Ragotzy d9a29e3e5c Fix state for empty key route
Replace None with Some("") for state_key
2020-08-25 15:30:25 -04:00
Timo 33215d6099
fix: send notification count updates when private read receipts change 2020-08-24 10:46:20 +02:00
Devin Ragotzy 27ffe77823 Use helper instead of route for get_public_rooms_filtered 2020-08-23 16:45:01 -04:00
Devin Ragotzy 1848f08292 Use full sorting algorithm on incoming PDU's in membership 2020-08-23 16:43:48 -04:00
Timo 3c26166fb5 improvement: device list works better
The only situation that isn't working yet is sending `left` events for
users when the sender leaves the room
2020-08-23 16:43:48 -04:00
Timo 972babbc79 fix: set limited to true when skipping messages in /sync 2020-08-23 16:43:21 -04:00
Devin Ragotzy 672bf4f473 Cargo lock update and a few doc additions 2020-08-23 16:43:21 -04:00
Devin Ragotzy fe795d38ea Replace route calling routes with helpers
This fixes the panic from ruma "index out of bounds"
2020-08-23 16:43:21 -04:00
Devin Ragotzy 5ccdd3694b Add helper function for get_alias route 2020-08-23 16:43:21 -04:00
Devin Ragotzy ea20032404 Helper for join_room_by_id route so routes aren't calling routes 2020-08-23 16:43:21 -04:00
Devin Ragotzy 64fb0374b6 Use Vec<u8> instead of string for digest bytes and add roomid_statehash 2020-08-23 16:43:21 -04:00
Devin Ragotzy d73c6aa8ad Add roomid_statehash tree, clean up review issues 2020-08-23 16:43:21 -04:00
Devin Ragotzy 846a0098c1 Split append_pdu -> append_pdu and build_and_append
Move all state event appending to append_state_pdu.
2020-08-23 16:43:21 -04:00
Devin Ragotzy cb68bf9e0c Use ring crate to generate StatHashes when saving stateid/statehash 2020-08-23 16:43:21 -04:00
Devin Ragotzy c4f5a0a631 Keep track of State at event for state resolution
feat: first steps towards joining rooms over federation
Add state-res as a dependency of conduit
Add reverse_topological_power_sort before append_pdu
Implement statehashstatid_pduid tree for keeping track of state
Clean up implementation of state_hash as key for tracking state
2020-08-23 16:43:21 -04:00
Timo 38663228f5
fix: put reason of redaction in the redacted event 2020-08-23 16:47:27 +02:00
Timo 7ba9263cc6
improvement: show most recent PDUs first when searching 2020-08-23 16:14:11 +02:00
Timo 366554630a
fix: account registration 2020-08-23 16:14:11 +02:00
Timo 804d097a18
fix: wake up /sync for typing events 2020-08-23 16:14:10 +02:00
Timo c092f06068
docs: /sync 2020-08-23 16:14:10 +02:00
Timo df936e8e7e
improvement: guests are more spec-conform 2020-08-23 16:14:10 +02:00
Timo 64789537f5
fix: device list when leaving rooms 2020-08-23 16:14:09 +02:00
Timo 4323cf5fec
improvement: device list works better
The only situation that isn't working yet is sending `left` events for
users when the sender leaves the room
2020-08-23 16:14:09 +02:00
Timo f23fb32e95
fix: set limited to true when skipping messages in /sync 2020-08-23 16:14:09 +02:00
timokoesters e457e19088
feat: search pdus 2020-08-23 16:14:08 +02:00
Timo 27d35f5ab4
docs: fix /register method 2020-08-23 16:14:08 +02:00
Timo 3ff17f69ad
fmt 2020-08-23 16:14:07 +02:00
Timo 4be68eba76
feat: allow querying conduit's room list over federation 2020-08-23 16:14:07 +02:00
Timo 940f533d61
refactor: avoid some allocations when redacting 2020-08-23 16:14:06 +02:00
Timo 04eee089e0
feat: first steps towards joining rooms over federation 2020-08-23 16:14:06 +02:00
timokoesters f40f1d9f75
docs: endpoint documentation 2020-08-23 16:14:06 +02:00
Jonas Platte 75ea0b3163
Update ruma 2020-08-12 23:42:17 +02:00
Devin Ragotzy da1c53aaef Make State struct constructable by lib user 2020-08-03 20:56:14 -04:00
Guillem Nieto b575593647 Do not ignore db errors 2020-08-02 09:38:20 +02:00
Guillem Nieto 47abe6686e Send invites only if invited during the sync request
Fixes: https://git.koesters.xyz/timo/conduit/issues/175
2020-08-02 09:24:47 +02:00
timokoesters 98f37302a6
feat: handle /publicRooms pagination 2020-07-30 22:51:02 +02:00
timokoesters 0616acbde6
feat: handle inhibit_login in /register 2020-07-30 20:52:37 +02:00
timokoesters c1c62b7eb4
refactor: put endpoints into modules 2020-07-30 18:34:03 +02:00
Devin Ragotzy 7a70d8488f Rebase with master and update append_pdu call 2020-07-30 09:22:51 -04:00
Devin Ragotzy c8d7d80eb2 Fix start/end token swap left from dropped commits 2020-07-30 09:22:51 -04:00
Devin Ragotzy 99220565d4 Fix invite leave auth error by moving update_membership 2020-07-30 09:22:51 -04:00
Devin Ragotzy 25c0e75f29 Cargo fmt 2020-07-30 09:22:51 -04:00
Devin Ragotzy 8aac332b3a Move ignore invite logic into update_member 2020-07-30 09:22:51 -04:00
Devin Ragotzy f2fab27d81 Implement filtering invites if sender is ignored by receiver 2020-07-30 09:22:51 -04:00
timokoesters 52b1df6fd2
improvement: handle limit and set limited in /user_directory/search 2020-07-30 15:17:34 +02:00
timokoesters ce460ea159
fix: send device list updates when user is in no rooms 2020-07-30 14:09:05 +02:00
timokoesters b67372b11b
refactor: make all mods in database pub
Now they can easily export their own structs
2020-07-29 21:48:31 +02:00
Devin Ragotzy d948f896c0
Turn append_pdu args into struct PduBuilder 2020-07-29 21:47:09 +02:00
Devin Ragotzy 1c6f211933
Create media::FileMeta to represent a file and meta data 2020-07-29 21:33:48 +02:00
Devin Ragotzy 2da48b941d
Convert all map_err -> expect when deserializing to Raw 2020-07-29 21:33:47 +02:00
Devin Ragotzy 62df9ca580
Fix all clippy warnings, shorten line len in client_server 2020-07-29 21:32:35 +02:00
timokoesters e0d0fb4703
fix: only send device_one_time_keys_count when there are updates 2020-07-29 20:44:06 +02:00
timokoesters 66bc25fcd3
feat: implement /keys/changes 2020-07-29 18:05:16 +02:00
timokoesters 0693387769
improvement: more efficient /sync and only send device updates when sharing a room 2020-07-29 17:03:04 +02:00
timokoesters d891bbb5dc
improve: presence 2020-07-29 13:05:38 +02:00
timokoesters 05f9d927b8
fix: account data 2020-07-29 13:05:37 +02:00
timokoesters 21eb8d4fe3
fix: problems with pdu serialization 2020-07-29 12:59:40 +02:00
timokoesters dd3dab39ae
feat: whoami route 2020-07-29 12:59:40 +02:00
timokoesters 489cbc0a93
refactor: use <_> instead of <_parameter_name> 2020-07-29 12:59:36 +02:00
gnieto cc411c530b Fix custom account data serialization (#165)
Stylistic change

Fix custom data serialization

Build a custom event before storing global account data

Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/165
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-29 07:48:34 +02:00
Devin Ragotzy e6a1b0b66f
Add cfg_attr gate to server_server endpoints 2020-07-27 18:54:43 +02:00
Devin Ragotzy 42e0102a2a
Conditionally emit rocket::http_verb attr macros if lib/bin 2020-07-27 18:54:43 +02:00
CapsizeGlimmer 4d4969862a
Implement /rooms/<room_id>/joined_members 2020-07-27 18:21:06 +02:00
CapsizeGlimmer 8fcf8e20b8
fix MR 153 requests; cargo fmt 2020-07-27 17:50:21 +02:00
CapsizeGlimmer fa2da9e048
Implement max_request_size config option 2020-07-27 17:49:11 +02:00
timokoesters 808a7deae3
cargo fmt 2020-07-26 22:45:10 +02:00
timokoesters dc5fb7e33a
feat: encryption_disabled config option
Can be used with ROCKET_ENCRYPTION_DISABLED=true
2020-07-26 22:41:29 +02:00
gnieto 5a8705bd25 Add room tags (#140)
Merge branch 'master' into task/add-tags

Add room tagging support

Co-authored-by: Timo Kösters <timo@koesters.xyz>
Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/140
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-26 22:33:20 +02:00
timokoesters b7df8fe83c
fix: stop /messages at `to`
Fixes #150
2020-07-26 22:21:05 +02:00
Jonas Platte 09561ccea3
Upgrade ruma 2020-07-26 16:52:43 +02:00
timokoesters 16576d19cd
improvement: only remove to-device events when sure the client received them
To make this work, I had to remove the recommended limit of 100
to-device events per /sync
(https://matrix.org/docs/spec/client_server/latest#id72)
2020-07-26 13:59:19 +02:00
Devin Ragotzy 87fd432527 Refactor account_data to be more similar to other endpoints 2020-07-25 15:48:12 -04:00
Devin Ragotzy 60381ddcf4 Update to latest ruma/master rev 2020-07-25 14:25:24 -04:00
Devin Ragotzy 61458536ab Merge branch 'master' of https://git.koesters.xyz/timo/conduit into ruma-mono 2020-07-25 13:46:28 -04:00
aura 630196f0a3 Implement get_joined_rooms (#155)
whitelist /joined_rooms in sytest

Signed-off-by: Aurabindo Pillai <mail@aurabindo.in>

style: fmt

feat: implement /joined_rooms (#78)

Signed-off-by: Aurabindo Pillai <mail@aurabindo.in>

Co-authored-by: Aurabindo Pillai <mail@aurabindo.in>
Co-authored-by: timokoesters <timo@koesters.xyz>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/155
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-25 18:35:22 +02:00
timokoesters d8e1248df6
improvement: switch to stable rust 2020-07-22 22:42:01 +02:00
Devin R 84d47da392 Simplify deserialization and deconstruction for Responses 2020-07-21 16:26:01 -04:00
Devin R 33bc666859 Use sync ephemeral events in sync Resposne (remove room_id)
Bump ruma to latest master which also fixes some server name as String
to now being of type Box<ServerName>.
2020-07-21 14:04:39 -04:00
Devin R 9a993fa7c1 Convert Pdu to a validated ruma type when calling to_*_event 2020-07-18 08:22:30 -04:00
Devin R 75959cdc10 Resolve stying review issues 2020-07-18 08:21:25 -04:00
Devin R 029c60be78 Replace to_string into_boxed_str with into 2020-07-17 19:52:04 -04:00
Devin R d02685a4fd Update to latest ruma/ruma commit
This will most likely be the API that is released to crates.io so it
should be fairly stable...
2020-07-17 16:04:05 -04:00
Devin R 63e23154f3 Rebase with key backups and cross signing
Moved back to a fork of ruma with timo's key-backup and cross-signing
branch. Ephemeral events in sync responses are EphemeralRoomEventStub
(they also have no room_id like all of sync responses events)
2020-07-17 16:04:05 -04:00
Devin R 84dcb885a7 Return correct Errors and replace panic, fix misc review issues
Remove EventJson todo comments, clean up Cargo.toml commented ruma deps.
2020-07-17 16:03:36 -04:00
Devin R 24b6702047 Add to_*_event_stub methods to pdu, filter for correct event kind
When creating some responses (sync) an AnyRoomEventStub is needed for this
PduEvent will deserialize the JSON as a Stub event and a non stub event
when needed. Ephemeral and account events are checked to be the correct
type and filtered out if not. This requires an extra `deserialize` call
which could/should be removed.

TODO: Possibly get rid of EventJson in some places.
2020-07-17 16:03:33 -04:00
Devin R 7c38e53839 Move to depend on ruma monorepo and ruma-events0.22 2020-07-17 16:03:02 -04:00
Timo Kösters b9de21949d Update to rocket master (#147)
Merge branch 'master' into rocket

Update to rocket master

Co-authored-by: timokoesters <timo@koesters.xyz>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/147
2020-07-14 18:23:26 +02:00
the0 469071e105 feat: implement /event (#144)
Merge branch 'master' into event-route

Event: Implement /event

Co-authored-by: the0 <theo@localhost>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/144
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-11 14:08:37 +02:00
CapsizeGlimmer 76aa44ead3 Add logout/all route to main 2020-07-05 15:35:03 -04:00
CapsizeGlimmer 7c2144c6d7 Implement /logout/all 2020-07-05 15:35:03 -04:00
the0 b81939841b feat: account deactivation (#137)
Deactivation: swap unwrap_or(false) to .ok()?

feat: implement deactivate account route

Implement error code on login to deactivated account

Deactivation: Changes requested

Add missing .clone()

Deactivation: Requested changes

Remove unneeded .filter()

Deactivation: badly named signature leads to confusion

Co-authored-by: the0 <theo@localhost>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/137
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-05 07:48:19 +02:00
the0 67a1f21f5d feat: implement password changing (#138)
Password: Fixes

Password: Implement logging out all devices except current

Password: Implement password changing

Co-authored-by: the0 <theo@localhost>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/138
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-07-02 20:38:25 +02:00
timokoesters 54ad1fbed9
fix: CI 2020-06-26 16:26:29 +02:00
timokoesters 24c544f650
fix: DMs show up as rooms 2020-06-26 15:16:15 +02:00
Guillem Nieto 8f06d0258a
Remove `is_direct` flag from Join event
When I was investigating the DM issue, I found that join event contained
the `is_direct` flag. According to the spec, this flag should only be
set on "invite" events, but not on join.

Other homeservers do not have this flag on join.
2020-06-26 15:16:15 +02:00
timokoesters a49a572d76
feat: cross-signing 2020-06-26 15:16:15 +02:00
timokoesters 7031240af3
improvement: /members route 2020-06-16 23:25:15 +02:00
timokoesters 02fe030b2a
improvement: better default push rules 2020-06-16 23:25:14 +02:00
timokoesters db685e0cf7
fix: update rocket version 2020-06-16 13:53:15 +02:00
timokoesters 13d474f6ee
fix: update ruma version 2020-06-16 12:19:58 +02:00
PublicByte fa7612f069 refactor: remove unused imports 2020-06-11 21:06:43 +02:00
timokoesters 56d4742201
improvement: log bad database errors automatically 2020-06-11 14:58:44 +02:00
timokoesters 2368a90584
refactor: better error handling 2020-06-11 13:14:35 +02:00
timokoesters f2a5d46628
fix 2020-06-08 15:17:58 +02:00
timokoesters 176bd114a0
fix: use correct device in GET /devices 2020-06-08 14:23:42 +02:00
timokoesters bfe5b89ba4
style: cargo fmt 2020-06-08 11:45:22 +02:00
timokoesters 588049678b
refactor: replace DeviceId with str or String 2020-06-08 11:40:19 +02:00
timokoesters b4d65ab67d
improvement: optimize /sync response 2020-06-08 11:39:32 +02:00
timokoesters 0067f49d52
feat: close registration with ROCKET_REGISTRATION_DISABLED=true 2020-06-08 11:39:32 +02:00
timokoesters c85d363d71
feat: user interactive authentication 2020-06-08 11:39:30 +02:00
Timo Kösters 88d091fca1 Merge pull request 'Allow client to load history on newly joined rooms' (#111) from gnieto/conduit:fix/issue-39-history-load into master
Reviewed-by: Timo Kösters <timo@koesters.xyz>
2020-06-07 11:21:53 +02:00
Guillem Nieto cc383ac932 Cargo fmt 2020-06-06 19:48:01 +02:00
Guillem Nieto 9269f009db Allow client to load history on newly joined rooms
On /sync, check if a room is a new join between `since` parameter and
now. If it's a newly joined room, set the limited flag to true, which will force
the client to load room messages via the `/messages` endpoint.

On `master`, I could not reproduce the messages not showing to others
when joining after being invited.

Fixes #39
2020-06-06 19:29:03 +02:00
timokoesters 8eedc12567
fix: edus will not be removed after timeout 2020-06-06 15:23:37 +02:00
Jonas Platte 7526fd8602
Switch to the ruma meta-crate 2020-06-05 18:42:45 +02:00
timokoesters d404f902bf
fix: send presence too often 2020-06-04 22:36:48 +02:00
timokoesters 32da76b9a2
feat: heroes, don't send notifications every time 2020-06-04 19:05:11 +02:00
timokoesters b7f7a39973
feat: kick,ban,unban user route 2020-06-04 16:51:36 +02:00
timokoesters a8df1acdfd
feat: load replies, forward pagination 2020-06-04 13:58:55 +02:00
timokoesters 168f2281fd
improvement: bundle typing events and only send on changes
Fixes #67 and #49
2020-06-04 11:17:36 +02:00
timokoesters 8328eeb5ac
Make sytest not fail 2020-06-04 09:53:26 +02:00
timokoesters 1c85b0fd05
remove tests in favor of sytests 2020-06-04 09:48:33 +02:00
timokoesters b192fddf2f
fix: show device display names 2020-06-04 09:48:32 +02:00
timokoesters 325e373684
refactor: small changes 2020-06-03 22:30:51 +02:00
timokoesters 19c9e4b916
fix: room version 6 2020-06-03 22:30:50 +02:00
gnieto 0883c44659
Implement devices API (#20)
small improvements

Cargo fmt

Simplify insert and update methods

Review feedback

Remove has_device method calls

Load all devices with a single db call

Remove device as in logout

Put all metadata on the same tree

Create userdevice key fucntion

Implement devices API

Implement all the devices endpoints. There's a couple of pending tasks:

- Integrate the "logout" logic once it lands to master (this should
  remove the given device from the database).
- Track and store last seen timestamp and IP.

Co-authored-by: timokoesters <timo@koesters.xyz>
Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
2020-06-03 14:09:50 +02:00
gnieto ed9b544ace Implement devices API (#20)
small improvements

Cargo fmt

Simplify insert and update methods

Review feedback

Remove has_device method calls

Load all devices with a single db call

Remove device as in logout

Put all metadata on the same tree

Create userdevice key fucntion

Implement devices API

Implement all the devices endpoints. There's a couple of pending tasks:

- Integrate the "logout" logic once it lands to master (this should
  remove the given device from the database).
- Track and store last seen timestamp and IP.

Co-authored-by: timokoesters <timo@koesters.xyz>
Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
2020-06-03 13:41:30 +02:00
Jean-Baptiste Petit 1222289c75 get_state_events_for_key_route return the content of the requested event instead of the all event. 2020-06-03 09:30:34 +02:00
timokoesters 5a47c75427
fix: make redactions permanent 2020-06-01 20:58:49 +02:00
timokoesters b519bc6962
fix: only show notifications for messages 2020-06-01 20:16:18 +02:00
timokoesters 4e507ef706
feat: room visibility and aliases 2020-05-31 09:46:11 +02:00
timokoesters 9c26e22ad7
improvement: load aliases from database 2020-05-31 08:01:11 +02:00
timokoesters 18bf67748c
feat: redaction 2020-05-31 08:01:10 +02:00
timokoesters ca77c79222
fix: /register lowercases user ids
fixes #24
2020-05-27 07:09:23 +02:00
Guillem Nieto 4b3b562347 Get device_id from body instead of auth data
Device_id was retrieved from the auth data instead of login's body and
this was causing that a new device was created on every login.

This is (I guess) provoking that some sytests are failing (for example,
"POST /login returns the same device_id as that in the request").
2020-05-26 21:06:54 +02:00
timokoesters 58683585cc
improvement: show more info in public rooms list 2020-05-25 20:16:36 +02:00
timokoesters b6c0e9bfb2
feat: access control 2020-05-25 16:40:00 +02:00
timokoesters c8ba9dce01
feat: proper room creation 2020-05-25 16:39:58 +02:00
josias b106d1393b Add logout route and database methods (#21)
Condense keys

Move remove methods to remove_device

Code cleanup

Add method for removing todevice events

Remove unnecessary existence checks

Add logout route and database methods

Co-authored-by: Josias <justjosias@tutanota.com>
2020-05-24 22:10:09 +02:00
timokoesters 1014388a9c
fix: one time keys are never removed 2020-05-23 19:17:55 +02:00
timokoesters d95e8b4880
fix: problem with to-device for all devices 2020-05-21 13:52:54 +02:00
timokoesters 43478a5870
fix: send correct membership events when joining / creating rooms 2020-05-20 09:24:44 +02:00
timokoesters 8df2a1a072
improvement: add room topic to public room dir 2020-05-20 00:12:07 +02:00
timokoesters e0fccffde0
fix: changing avatar url now sends room events 2020-05-19 23:52:02 +02:00
timokoesters ada260bf42
fix: use png for thumbnails 2020-05-19 23:51:37 +02:00
timokoesters eb4af85765
fix: riot sometimes freaks out when refreshing 2020-05-19 22:56:28 +02:00
timokoesters d544d28b6e
feat: image thumbnails 2020-05-19 19:59:52 +02:00
timokoesters 61f4f2c716
improvement: implement GET publicRooms 2020-05-19 16:28:03 +02:00
timokoesters 821c608c6a
feat: media 2020-05-18 22:50:42 +02:00
timokoesters 42ae433b25
fix: send devicekeyupdate users in /sync 2020-05-18 12:46:06 +02:00
timokoesters f0aed35ecf
improvement: user dir search also searches in displaynames 2020-05-18 10:29:45 +02:00
timokoesters 56dd6cb16f
improvement: get state 2020-05-18 09:22:58 +02:00
timokoesters 6215218c3c
fix: account data json 2020-05-17 22:05:43 +02:00
timokoesters 7fc71b3968
feat: end to end encryption 2020-05-17 19:56:40 +02:00
timokoesters 4fb79ebb4c
chore: update dependencies 2020-05-14 13:56:29 +02:00
timokoesters d08f91d1c3
fix: only allow valid usernames in /register 2020-05-13 12:25:15 +02:00
Rudi Floren 00a9424719
feat: sytests 2020-05-11 14:44:23 +02:00
timokoesters 8e041f90dd
refactor: make cargo clippy happier 2020-05-11 12:34:48 +02:00
timokoesters 1dbde0e1c1
improvement: add option to get device id from token 2020-05-10 18:30:12 +02:00
timokoesters ee0d6940bd
feat: presence updates 2020-05-09 21:47:09 +02:00
timokoesters 551308e9a8
Update dependencies and send displayname updates again 2020-05-08 21:13:52 +02:00
timokoesters 8f67c01efd
refactor: split database into multiple files, more error handling, cleaner code 2020-05-03 21:44:48 +02:00
timokoesters 4b191a9311
improvement: set default push rules on register 2020-05-02 09:24:09 +02:00
timo 3cd0f89729 Add /_matrix/client/r0/register/available endpoint 2020-05-01 23:25:32 +02:00
Marcel 4bc7712ee4 [ClientServer] Add /_matrix/client/r0/register/available endpoint
Took 1 hour 25 minutes
2020-05-01 23:17:25 +02:00
timokoesters 4ca1ada73e
update ruma 2020-05-01 21:45:55 +02:00
timokoesters b02c568941
feat: notifications, simple permission systems 2020-05-01 20:28:13 +02:00
timokoesters 169dbe6c37
fix: send full state after joining a room 2020-04-29 12:19:09 +02:00
timokoesters c769283953
Update readme 2020-04-29 10:27:41 +02:00
timokoesters fd1aea7e36
Update dependencies 2020-04-29 10:27:41 +02:00
timokoesters 1cdf30f38c
Add hostname to Rocket.toml config 2020-04-29 10:27:40 +02:00
timokoesters 23cb550d00
forget rooms, load history 2020-04-29 10:27:40 +02:00
timokoesters 4cc0a07092
feat: user renaming 2020-04-29 10:27:40 +02:00
timokoesters 720cc0cffc
feat: federated room directory 2020-04-29 10:27:39 +02:00
timokoesters 120b6f4b95
Bump dependencies and fixes 2020-04-29 10:27:39 +02:00
timokoesters 873d191569
fix: http body as content when signing 2020-04-29 10:27:39 +02:00
timokoesters 1af6dd984a
More work on federation 2020-04-29 10:27:38 +02:00
timokoesters b0d9ccdb2d
Signing, basis for federation 2020-04-29 10:27:38 +02:00
timokoesters 9b79798e56
start work on signing 2020-04-29 10:27:37 +02:00
timokoesters 80ddf80f17
work 2020-04-29 10:27:31 +02:00
TheCycoONE 6d858c39ca Fix typo in password message 2020-04-15 21:17:33 +02:00
gnieto fa9e127a1e Store hashed passwords (#7)
Use if let instead of unwrap

Default to invalid password if could not calculate

Move hash password methdo and return Result

Rename get_password method

Default to empty password when no pwd is received

Store hashed passwords

Store passwords hashed with Argon2 and verify password with that stored
hash.

Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
2020-04-14 22:25:44 +02:00
timokoesters abcce95dd8
feat: invites, better public room dir, user search 2020-04-14 13:59:25 +02:00
timokoesters 3debb6203c
feat: handle typing events 2020-04-12 21:12:50 +02:00
timokoesters 3b9cadeec2
feat: read receipts 2020-04-11 23:57:56 +02:00
timokoesters ab8c2f1e5e
Rename pduid_pdus to pduid_pdu 2020-04-11 09:35:06 +02:00
timokoesters fd829bfa0d
move client_server code into own file 2020-04-11 09:30:11 +02:00
timokoesters 040296c711
Add test support and impl dummy /read_markers 2020-04-10 13:36:57 +02:00
timo 3f2bf208a9
Merge pull request 'Add displayname and avatar_url endpoints' (#5) from MTRNord/matrixserver:accountdata into master 2020-04-09 21:26:57 +02:00
Marcel 57264f72e9 Fix avatar_url error message if not starting with mxc://
Took 8 minutes
2020-04-09 21:19:27 +02:00
Marcel 8bcbc983c3 Change and add Comments to the profile endpoints
Add missing docs

Took 9 minutes
2020-04-09 21:11:21 +02:00
Marcel 49fe5e3271 Rename userid_avatar_url to userid_avatarurl and fix debug print
Run cargo fmt

Took 5 minutes
2020-04-09 21:01:39 +02:00
Marcel b1284fd509 Replace profile_* with userid_*
Add a missing dot in the errormessage
Require mxc:// to be present at the start of an avatar_url
Update mxc check TODO
Show displayname or avatar_url if either is available when getting the profile Endpoint
Return the correct data in case of a empty displayname or an empty avatar_url

Took 50 minutes

Took 34 seconds
2020-04-09 20:53:27 +02:00
timokoesters cd55220a75
fix: room directory duplicates 2020-04-09 19:39:06 +02:00
Marcel 062c5521f0 Add displayname and avatar_url endpoints
Add PUT and GET /_matrix/client/r0/profile/{userId}/displayname Endpoint
Add PUT and GET /_matrix/client/r0/profile/{userId}/avatar_url Endpoint
Add GET /_matrix/client/r0/profile/{userId} Endpoint

Took 2 hours 16 minutes
2020-04-09 18:49:27 +02:00
timokoesters 11e75e7081
make room directory work 2020-04-09 14:39:50 +02:00
timokoesters 5ac45eac59
public rooms dir 2020-04-09 12:22:39 +02:00
timokoesters 9214a62dde
better room creation 2020-04-09 11:00:58 +02:00
Jonas Platte 38ab7c843e
Update error type of /register route 2020-04-08 23:25:19 +02:00
Jonas Platte c60402bf0d
Update ruma-client-api 2020-04-08 23:13:30 +02:00
timokoesters 8557278b90
better riot.im support 2020-04-08 22:07:31 +02:00
timokoesters fdeee7fdb5
More dummy endpoints 2020-04-08 22:04:30 +02:00
timokoesters 215a31c513
Add a few dummy endpoints to make riot progress further 2020-04-08 22:04:29 +02:00
timokoesters ddcd423e6f
feat: random tokens, sessions, guest usernames and device ids 2020-04-08 22:04:29 +02:00
timokoesters 64223b8812
register login flow 2020-04-08 22:04:29 +02:00
timokoesters e55a63629c
feat: state event support 2020-04-06 14:33:02 +02:00
timokoesters 10bb96fcf7
feat: room joining, room based /sync responses 2020-04-06 13:52:46 +02:00
timokoesters 4d4cff7120
Allow all kinds of messages in /send 2020-04-05 23:06:43 +02:00
timokoesters 884dc2867d
Move to rocket's async branch 2020-04-05 19:54:08 +02:00
timokoesters 8b8381bcc0
New PduEvent struct 2020-04-04 11:53:37 +02:00
timokoesters f9cfede2a8
fix: deserialize sync event body 2020-04-03 21:17:27 +02:00
timokoesters fa3226898c
feat: save pdus
PDUs are saved in a pduid -> pdus map. roomid -> pduleaves keeps track
of the leaves of the event graph and eventid -> pduid maps event ids to
pdus.
2020-04-03 17:58:38 +02:00
timokoesters 22cca206ba
Todo: ruma signatures
This commit will get force pushed away later
2020-03-30 15:38:25 +02:00
timokoesters dba6c46667
Use sled::Tree::prefix_search for deviceids 2020-03-30 13:46:18 +02:00
timokoesters b508b4d1e7
Start work on message events 2020-03-30 00:10:44 +02:00
timokoesters 533260edd8
Add auth 2020-03-29 21:05:20 +02:00
Jonas Platte 1183105f15
Make Endpoint bound work for ruma_wrapper::Ruma 2020-03-29 14:29:12 +02:00
timokoesters 73e04e71d7
Start work on event creation 2020-03-29 13:49:13 +02:00
timokoesters 744e0adfcf
Try to impl auth in ruma_wrapper 2020-03-28 23:08:59 +01:00
timokoesters 34a53ce20a
Better database structure 2020-03-28 18:50:02 +01:00
timokoesters 6d27f15516
More logging 2020-03-28 15:16:18 +01:00
timokoesters 1679da7784 RUST_LOG=info by default 2020-03-27 21:00:40 +01:00
timokoesters c2c18b4651 feat: database 2020-02-20 10:12:13 +01:00
timokoesters cd777af41c feat: simple endpoint handlers 2020-02-18 22:07:57 +01:00