Commit graph

1590 commits

Author SHA1 Message Date
strawberry
fcca352795 apply Read/Write/FlushOptions where available for future usage
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
20c089b7ed simplify/tune rocksdb options, config option for compression algo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
Timo Kösters
6f77f7ee9e dont leak users in room directory if sender is not allowed to see them
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
6df7f976db log sync sender_user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
be5c13ab0d make config PathBuf instead of String
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
0db3a43d1f add multi_get (multi_get_cf) for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
Charles Hall
3160a36634 refactor clap into a separate file
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
5454b653fe switch to hickory-dns / hickory_resolver
trust-dns rebranded to hickry-dns

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
3f01293a6f fix User-Agent
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
307d42ccc7 disable update check by default
save the few bytes of bandwidth for something else

also now that we send our User-Agent, it is
technically sending conduwuit versions now

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
4bfcbf2b57 update image(-rs)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
c26ba6437e clearly document where this code came from
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
7d825690f7 admin cmd to fetch PDU from remote server
does not append to timeline/database yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
e888a0a745 drop dead server log spam to debug
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
39d9cc9d33 fix sqlite lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
82247f7ab9 fix test
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
a49e79caff resolve windows-only lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
d52f03414e add commandline arg to specify a conduwuit config file
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
aec7097cd3 tokio signals are actually used for CTRL+C
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
26982fbe05 make these variables unix only too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
fee6cad778 s/rocksdb/rust_rocksdb, fix copy paste errors
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
d84378db18 build unix socket support on unix platforms only
yes windows technically supports unix sockets,
but its not as good or the same as actual
nix platform unix sockets

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
39aef8d1b9 dont build sha2, opentelemetry, or zstd code if unused
reduces unnecessary crates being compiled. splits them
into features.

i have yet to see anyone use conduit's opentelemetry
stuff, and realistically those people who do
performance benchmarking and measurements will be
building stuff anyways so they can just enable this
feature.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
958b738e5a drop querying _matrix SRV record to debug
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
5c94caa3bb temp: dont fetch remote profiles for remote membership updates
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 18:09:41 -05:00
strawberry
1a40171bc1 log warning for failed preview gen, better error message
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 18:09:41 -05:00
strawberry
1911f5a8fa fix cargo doc lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
c58f93105a implement legacy "v1" media request routes
if https://github.com/ruma/ruma/issues/1240 is to
be trusted, there are apparently still servers
and clients that may call these endpoints.

i'm unable to read the history of that matrix.to
link so i don't know the full context, but this
is trivial to implement so..

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
496a9c7af8 resolve some pedantic lints, reduce some allocations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
Matthias Ahouansou
5ab76a1332 update ruma appservice Registration type MR
from https://gitlab.com/famedly/conduit/-/merge_requests/583

and fixed panic from blocking async call in timeline/mod.rs

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
Timo Kösters
019a82850d improvement: do not save typing edus in db
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
7c1624931d remove various unnecessary qualifications
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
aedb5966fe resolve nightly performance assigning_clones lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
4dfd5a7c15 add AuthScheme AccessTokenOptional in ruma_wrapper
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
99fdf699ae finish query_trusted_key_servers_first option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
d2060c8647 add config option for max RocksDB LOG files
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
7bfb86a851 set default rocksdb log level to error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
e90cd48f61 remove unnecessary pubs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
139b0fdc3e add global flush function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
7cbb0139f2 implement flush() and cleanup() for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
0df17a4103 remove unused lifetimes for sqlite functions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
ce3e61a39a document cleanup_second_interval, change default to 1800 seconds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
b5ef72826e dont run perform_cleanup twice on shutdown
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
da34b7f90f fix unused_must_use lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
446cb24c0b use Default value of 0 if BE array is not valid
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
Matthias Ahouansou
4ec2d3ecb5 refactor: use async-aware RwLocks and Mutexes where possible
squashed from https://gitlab.com/famedly/conduit/-/merge_requests/595

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
f419c64aca add rustfmt.toml, format entire codebase
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
9fd521f041 partial impl of query_trusted_key_servers_first option
65% finished

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
2832d8cb93 make CONDUIT_CONFIG optional
retains compatibility for container users
who set it to empty.

if the variable is unspecified, it will
use the CONDUIT_ variables as normal.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
90d90c46da use get_physical for only physical core count
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
0352ea7dda add rocksdb parallelism threads config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
9251727d57 return proper error if fail fetching and dont have profile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
465533d32b attempt keeping track/cache remote profiles locally again
also fixes logic error where we always say
we couldnt find the profile

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
daaf4b7bea add basic loopback address container checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
023c16e4f4 specify if registration token is set in show-config
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
608aa83ed2 check if invited user is an admin before rejecting instead
i think this makes more sense tbh than what synapse does

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
34e8fd38cf extend room banning to local+remote room invites
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
ea66bff46b config option to block non-admin room invites
works just like block_non_admin_invites from synapse

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
c97483dbd3 fix rocksdb-specific lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
e2c7afe69c go through a ton of pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
33727a3423 replace database assert!s with if statements
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
624b866ed5 adjust lints for CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
04d16ac544 remove two unnecessary string heap allocs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
a9f714ae8d remove single-use lifetimes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
71654f26b9 add todo for MockedKVDatabase get_all_media_keys
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
cde6fdd741 resolve or_fun_call clippy lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
93cc98a04c fix cargo doc lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
d5bfef18a4 fix 1.77 clippy warning (multiple_bound_locations)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
cd6a6b308b remove unnecessary clone
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
27f61a2dee add missing comment slash
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
b26c593a2a adjust max rocksdb LOG files based on hard drive or SSD option
keeps 3 LOG files at most if on hard drive, else keeps 20

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
ee548bd2e7 admin command to delete all remote media within the past x time
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
sininenkissa
e71855cd0b
make conduwuit show up as the server software name on /_matrix/federation/v1/version (#186)
conduwuit > /_matrix/federation/v1/version

Co-authored-by: June <june@girlboss.ceo>
2024-03-01 19:29:21 -05:00
strawberry
82f10214b3 remove all unused lifetimes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-28 13:56:19 -05:00
strawberry
abf41f4c79 check if specified user belongs to us
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-28 13:56:19 -05:00
strawberry
ee4f0a0ae5 admin cmd to list all rooms a user is in
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-28 13:56:19 -05:00
Timo Kösters
f0ae99125a fix: avoid panic when client is confused about rooms 2024-02-28 13:56:19 -05:00
Timo Kösters
8e0f7b0d0a Avoid federation when it is not necessary 2024-02-28 13:56:19 -05:00
strawberry
3c12c2b6ca fix: add top level "redacts" key for v11 redactions
at least with Element Web: they still rely on the
"redacts" top level key. it was reported that
federated redactions were not working for v11 rooms
with conduwuit. after adding back the top level
key when appending a PDU to the timeline, they
now work again.

spec below says to continue adding the top level
key for compatibility with older clients.

https://spec.matrix.org/v1.9/rooms/v11/#moving-the-redacts-property-of-mroomredaction-events-to-a-content-property

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-28 13:56:19 -05:00
strawberry
f76937a085 fix incorrect repo link on welcome msg
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
24625e9659 resolve nightly rust warnings
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
598ac3e140 unmark v1 as experimental
it was reported that even with this, conduit
still cannot join those rooms.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
cdc644946d admin cmd to delete MXCs via event_id
this can be used as a way to deal with the thumbnail
and the media file at the same time without knowing
the thumbnail MXC URL.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
da3297fdcb add !admin as way to call conduit bot
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
9224e37472 helpful error msg upon failed db version assert
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
50fb202382 admin cmd to delete multiple MXC URLs in bulk
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
45ad7b40b3 add support for dual HTTP/HTTPS, rm caddy from complement
complement sends C-S requests over HTTP, and federation
over HTTPS.

complement without caddy *almost* works. unfortunately
i am now dealing with invalid X-Matrix signatures
due to non-percent encoded URIs and it does not
seem trivial to percent-encode URIs that a
reverse proxy would normally do for you.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
07772f2fed document conduit direct TLS support + logging
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
67b307c75b add support for listening on multiple ports
retains existing config compatibility using either:
`port = 6167`
`port = [80, 443, 8448]`

Co-authored-by: Charles Hall <charles@computer.surgery>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
342400fe2d fix tests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
ca42ec338b replace accidental unwraps with if let's
this provides not only some future compatibility with MSC4051,
but it just makes sense to not crash/error if we can't get a server_name
from the room ID and should just use the server_name from the sender
user's invite event. there is already code ahead that accounts for
an empty vector so this is safe.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
4d624846ee admin command to delete media via MXC url
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
27c29e6063 db functions to delete media via MXC
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
1ecad225be feat: custom text for user displayname suffix upon registration
replaces the lightning bolt emoji option with support for
your own text or emojis

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
03d796e95e support room aliases for room blocking, argument to disable federation
and makes parsing the room more generic (room ID or room alias)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
36bc21193c oops forgot import
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
3d26210eac more useful database logging (compaction, time taken to load)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
bdda875416 bump conduwuit version to 0.1.3
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
9a6a77974b add support for bulk banning room IDs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
e25d574208 move room moderation stuff to a subcommand
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00