Commit graph

37 commits

Author SHA1 Message Date
Jade Ellis
dcbacb5b78
feat: Allow controlling client message filtering 2025-04-26 21:59:25 +01:00
Jade Ellis
0eb9e4f3d2
refactor: Centralize server forbidden checks into moderation module
This moves all checks related to `forbidden_remote_server_names`,
`forbidden_remote_room_directory_server_names` and
`prevent_media_downloads_from` to a new `moderation` module.
This is useful for implementing more complicated logic globally.
Mostly the changes from #673, but is also relevant for #750
2025-04-19 23:37:54 +01:00
Jade Ellis
3a95585f0e
fix: Disambiguate appservices in lazy loading context
In the previous commit, app services would all appear to be the same
device when accessing the same user. This sets the device ID to be the
appservice ID when available to avoid possible clobbering.
2025-04-18 14:00:31 +01:00
nexy7574
68d68a0645
fix: Do not panic when sender_device is None in /messages route
The device ID is not always present when the appservice is the client.
This was causing 500 errors for some users, as appservices can lazy
load from `/messages`.

Fixes #738

Co-authored-by: Jade Ellis <jade@ellis.link>
2025-04-18 14:00:30 +01:00
June Clementine Strawberry
d5ad973464
change forbidden_server_names and etc to allow regex patterns for wildcards
Signed-off-by: June Clementine Strawberry <june@3.dog>
2025-04-06 15:25:19 -04:00
Jason Volk
532dfd004d move core::pdu and core::state_res into core::matrix::
Signed-off-by: Jason Volk <jason@zemos.net>
2025-04-05 02:44:46 +00:00
Jason Volk
bee4c6255a reorg PduEvent strip tools and callsites
Signed-off-by: Jason Volk <jason@zemos.net>
2025-03-30 23:00:37 +00:00
June Clementine Strawberry
ecea0cff69 fix TestFetchMessagesFromNonExistentRoom complement test
Signed-off-by: June Clementine Strawberry <june@3.dog>
2025-03-06 13:44:44 -05:00
June Clementine Strawberry
a1e1f40ded
run cargo fix for rust 2024 changes and rustfmt
Signed-off-by: June Clementine Strawberry <strawberry@puppygock.gay>
2025-02-23 01:17:45 -05:00
Jason Volk
31ab84e928 simplify client event endpoint
Signed-off-by: Jason Volk <jason@zemos.net>
2025-02-16 17:40:21 -05:00
Jason Volk
af399fd517 flatten state accessor iterations
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-29 01:18:08 +00:00
Jason Volk
68856645ee refactor lazy-loading
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-26 17:48:53 +00:00
Jason Volk
925061b92d flatten timeline pdus iterations; increase concurrency
Signed-off-by: Jason Volk <jason@zemos.net>
2025-01-09 18:14:23 +00:00
strawberry
6c96acc482
use fast binary_search for some const slices
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-12-15 01:41:50 -05:00
strawberry
52693db477
hide messages from users servers on the forbidden_remote_server_names list
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-12-15 01:02:52 -05:00
strawberry
77e0b76408
apply new rustfmt.toml changes, fix some clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-12-15 01:00:41 -05:00
strawberry
0317cc8cc5
rename conduit to conduwuit finally
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-12-14 22:24:45 -05:00
Jason Volk
320b0680bd pipeline various loops
Signed-off-by: Jason Volk <jason@zemos.net>
2024-12-03 13:25:33 +00:00
strawberry
8611cc0ee9 fix ignored_filter check, exclude dummy events over sync
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-11-24 23:14:19 -05:00
Jason Volk
97ad9afc86 default to main event for batch tokens
fix prev_batch token for legacy sync timeline

Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-24 21:47:25 +00:00
Jason Volk
3962333043 partially revert e507c31306
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-11 21:35:30 +00:00
Jason Volk
61174dd0d3 check if lazyset already contains user prior to querying
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-11 21:30:48 +00:00
Jason Volk
1f2e939fd5 optional arguments for timeline pdus iterations
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-08 08:22:54 +00:00
Jason Volk
e507c31306 make pdu batch tokens zeroith-indexed
Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-08 06:06:18 +00:00
Jason Volk
9da523c004 refactor for stronger RawPduId type
implement standard traits for PduCount

enable serde for arrayvec

typedef various shortid's

pducount simplifications

split parts of pdu_metadata service to core/pdu and api/relations

remove some yields; improve var names/syntax

tweak types for limit timeline limit arguments

Signed-off-by: Jason Volk <jason@zemos.net>
2024-11-06 21:46:20 +00:00
Jason Volk
7a09ac81e0 split send from messages; refactor client/messages; add filters to client/context
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-28 20:52:52 -04:00
Jason Volk
5e6dbaa27f apply room event filter to messages endpoint (#596)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-27 02:11:07 +00:00
Jason Volk
e482c0646f Add constructions and Default for PduBuilder
simplify various RoomMemberEventContent constructions

Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-26 18:50:28 -04:00
strawberry
6a81bf23de dont send events from ignored users over /messages
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-25 00:38:18 -04:00
Jason Volk
946ca364e0 Database Refactor
combine service/users data w/ mod unit

split sliding sync related out of service/users

instrument database entry points

remove increment crap from database interface

de-wrap all database get() calls

de-wrap all database insert() calls

de-wrap all database remove() calls

refactor database interface for async streaming

add query key serializer for database

implement Debug for result handle

add query deserializer for database

add deserialization trait for option handle

start a stream utils suite

de-wrap/asyncify/type-query count_one_time_keys()

de-wrap/asyncify users count

add admin query users command suite

de-wrap/asyncify users exists

de-wrap/partially asyncify user filter related

asyncify/de-wrap users device/keys related

asyncify/de-wrap user auth/misc related

asyncify/de-wrap users blurhash

asyncify/de-wrap account_data get; merge Data into Service

partial asyncify/de-wrap uiaa; merge Data into Service

partially asyncify/de-wrap transaction_ids get; merge Data into Service

partially asyncify/de-wrap key_backups; merge Data into Service

asyncify/de-wrap pusher service getters; merge Data into Service

asyncify/de-wrap rooms alias getters/some iterators

asyncify/de-wrap rooms directory getters/iterator

partially asyncify/de-wrap rooms lazy-loading

partially asyncify/de-wrap rooms metadata

asyncify/dewrap rooms outlier

asyncify/dewrap rooms pdu_metadata

dewrap/partially asyncify rooms read receipt

de-wrap rooms search service

de-wrap/partially asyncify rooms user service

partial de-wrap rooms state_compressor

de-wrap rooms state_cache

de-wrap room state et al

de-wrap rooms timeline service

additional users device/keys related

de-wrap/asyncify sender

asyncify services

refactor database to TryFuture/TryStream

refactor services for TryFuture/TryStream

asyncify api handlers

additional asyncification for admin module

abstract stream related; support reverse streams

additional stream conversions

asyncify state-res related

Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-25 00:32:30 -04:00
Matthias Ahouansou
2d9aab2e79 support timestamped appservice messaging
Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
Jason Volk
2f85a5c1ac de-global services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 09:08:51 +00:00
Jason Volk
8b6018d77d de-global services() from api
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 07:54:03 +00:00
Jason Volk
271f720286 move mutex maps out of globals into respective service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
30e7298dd7 fix doc-lazy-continuation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +00:00
Jason Volk
08bf074cbb reduce roomid_mutex_state
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-14 22:09:55 +00:00
Jason Volk
f32380772f rename api::client_server to api::client
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Renamed from src/api/client_server/message.rs (Browse further)