Commit graph

2837 commits

Author SHA1 Message Date
Charles Hall
47c210d5de reorder attic token check 2025-08-03 10:59:05 -07:00
Charles Hall
7fc39b1845 simplify attic call
The comment isn't really needed since the reasoning applies to the
other instances of readarray and here-strings too, and the IFS bit is
unnecessary.
2025-08-03 10:57:39 -07:00
Charles Hall
85b9080c77 change working directory
Did you know installables are parsed with regex? This mitigates how
horrifying that is.
2025-08-02 20:49:19 -07:00
Charles Hall
be3822d585 drop eval
Shellcheck says so.
2025-08-02 20:49:19 -07:00
Charles Hall
cf4f2fe51b use more readarray
The first part replaces a loop which is probably a performance
improvement, and the second part addresses a shellcheck complaint about
not declaring and assigning separately.
2025-08-02 20:49:19 -07:00
Charles Hall
27667911ed upgrade docker images to lix 2.93.3 2025-08-02 20:49:13 -07:00
Jonas Platte
c713e9f21f
Remove no-op #[async_trait] attribute 2025-07-31 20:44:54 +02:00
Jonas Platte
a3da77ce2c
Add a couple extra Sync bounds
Not necessary right now, but required for axum 0.8.
2025-07-31 20:44:54 +02:00
Charles Hall
40da74f28c Revert "do default-feature unification in nix"
This reverts commit 8f24ac1f27.

This is no longer necessary since the set of all features is equal to
the set of default features.
2025-07-24 15:09:12 -07:00
Charles Hall
b5294f9aa0 remove all-features devshell
It's no longer necessary since it's equivalent to the default-features
one now. The `DIRENV_DEVSHELL` thing is left in place however in case
that becomes useful again in the future.
2025-07-24 15:00:02 -07:00
Charles Hall
e6dbc293f1 remove jemalloc support
It's no longer being developed and it is very very annoying to maintain
support for.
2025-07-21 21:48:57 -07:00
Olivia Lee
55a01e7113
don't strip unknown keys when copying redacts property to/from content
Servers are required to preserve unknown properties in event content,
since they may be added by a future version of the spec. Round-tripping
through RoomRedactionEventContent results in dropping all unknown
properties.
2025-07-20 18:07:30 -07:00
Olivia Lee
9a142c7557
refactor Pdu::copy_redacts to use early returns 2025-07-20 12:46:06 -07:00
Olivia Lee
88ad596e8d
add type-safe accessors to account_data service 2025-06-02 11:07:21 -07:00
Olivia Lee
b82458a460
use event content in account_data service api instead of full events
This eliminates the possibility of passing an event that has a
mismatching type, reducing the space of possible invalid states.
2025-06-02 11:07:21 -07:00
Olivia Lee
66210bc32d
separate account_data service methods for room vs global events
Previously we were mashing everything together as RoomAccountDataEvent,
even the global events. This technically worked, because of the hidden
custom fields on the ruma event types, but it's confusing and easy to
mess up. Separate methods with appropriate types are preferable.
2025-06-02 11:07:21 -07:00
Olivia Lee
6897f0ba34
clarify behavior in service::account_data::changes_since docs 2025-06-02 11:07:21 -07:00
Olivia Lee
fe14300d91
reintroduce account_data::Service struct
In preparation for adding some additional methods at the service level.

Dropping the tracing spans for the data methods, because two duplicate
spans here seems kinda excessive.
2025-06-02 11:07:21 -07:00
LordMZTE
868bb44adf
support listening on Unix sockets 2025-06-01 22:16:48 +02:00
Olivia Lee
188eac5cfd include ban reasons when banning a user that already had a member event
The case where the user never had a member event in the room is already
handled correctly.
2025-06-01 09:38:27 +00:00
Lambda
c965c9747b Send User-Agent header in outbound requests 2025-05-29 19:53:02 +00:00
Lambda
d425ba72f8
Update ruma to 0.12.2 2025-05-04 14:03:46 -07:00
avdb13
48ecf50973 update documentation of service::users::Data::iter 2025-04-20 03:47:07 +00:00
Charles Hall
d1370f9834
refactor fetch_unknown_prev_events
Early returns (or continues, in this case) good.
2025-04-16 19:16:57 -07:00
Olivia Lee
6cb7896e17
use trust-dns for all DNS queries
Previously we were only using trust-dns for resolving SRV records in
server discovery, and then for resolving the hostname from the SRV
record target if one exists. With the previous behavior, admins need to
ensure that both their system resolver and trust-dns are working
correctly in order for outgoing traffic to work reliably. This can be
confusing to debug, because it's not obvious to the admin if or when
each resolver are being used. Now, everything goes through trust-dns and
outgoing federation DNS should fail/succeed more predictably.

I also expect some performance improvement from having an in-process DNS
cache, but haven't taken measurements yet.
2025-04-14 15:56:33 -07:00
Olivia Lee
e249aed1cb
rename Resolver -> FederationResolver and document 2025-04-14 15:50:04 -07:00
Olivia Lee
e98dd5b9a3
put global trust-dns resolver in an Arc
This allows us to reference it in reqwest clients configuration.
2025-04-14 15:50:04 -07:00
Olivia Lee
33f3592612
fix starting the server when db/media dirs do not exist yet
This used to be supported, as we explicitly call std::fs::create_dir_all
when initializing these, but it was broken in
b01b70fc20, which attempts to canonicalize
the paths to check for overlap before creating them.
2025-04-14 15:28:31 -07:00
Olivia Lee
abb1b5681e
add partial_canonicalize helper function
This is useful for checking for potential overlap between paths that
have not been fully created yet.
2025-04-14 15:28:31 -07:00
Olivia Lee
c03103a142
document that conduwuit migration is unlikely to work
<https://conduwuit.puppyirl.gay/#can-i-migrate-or-switch-from-conduit>
says that they broke db compatibility explicitly. I'm not sure when this
happened and which versions are compatible. Until we evaluate that we
should warn people not to try.
2025-04-11 13:10:23 -07:00
Olivia Lee
1529d60a6a
set default database backend in nixos module to rocksdb
The media backend already has a default value.
2025-04-06 20:06:40 -07:00
Charles Hall
1cd12460d7
make systemd patient for startup
RocksDB compaction can take quite a while if it doesn't happen
regularly, which it doesn't, currently.
2025-04-06 15:46:27 -07:00
Lambda
6bcc4e310e
Immediately trigger EDU sending after client read receipt
Previously, read receipts would only be forwarded via federation
incidentally when some PDU was later sent to the destination server.
Trigger a send without any event to collect EDUs and get read receipts
out directly.
2025-03-30 16:48:06 -07:00
Lambda
81c5f09919
service/sending: tiny refactors, NFC 2025-03-30 16:48:06 -07:00
Lambda
d9c7fbbd82
services/sending: avoid unnecessary clone 2025-03-30 16:48:06 -07:00
Lambda
ed12b0bf67
services/sending: guard against federation requests to ourselves
These would always fail and get stuck/retried forever.
2025-03-30 16:48:02 -07:00
Charles Hall
bb80f1cf2e
update rust deps that don't require code changes
I also had to pin ruma because otherwise cargo complained that features
were removed from ruma so it couldn't resolve the dependency by itself.
2025-03-27 16:31:45 -07:00
Charles Hall
a901d62575
skip checks for deps-only derivation
This is probably a crane bug that it's doing this in the first place.
2025-03-27 16:31:41 -07:00
Charles Hall
8b7cbb5f25
update rocksdb
This is done separately since it requires more involved changes than
just cargo's files.
2025-03-27 16:30:52 -07:00
Charles Hall
8da6c5d4b3
bump lockfile format version
This was actually introduced in version 1.83 of the rust toolchain.
2025-03-27 16:30:48 -07:00
K900
7ee117d36a fix: update nix inputs, fix build with latest crane
Fixes references to rustc leaking into the binary.

Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/47752427561f1c34debb16728a210d378f0ece36' (2024-11-10)
  → 'github:zhaofengli/attic/ff8a897d1f4408ebbf4d45fa9049c06b3e1e3f4e' (2025-02-02)
• Updated input 'crane':
    'github:ipetkov/crane/ef80ead953c1b28316cc3f8613904edc2eb90c28' (2024-11-08)
  → 'github:ipetkov/crane/70947c1908108c0c551ddfd73d4f750ff2ea67cd' (2025-03-19)
• Updated input 'fenix':
    'github:nix-community/fenix/e10ba121773f754a30d31b6163919a3e404a434f' (2024-11-16)
  → 'github:nix-community/fenix/7d9ba794daf5e8cc7ee728859bc688d8e26d5f06' (2025-03-20)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/1b90e979aeee8d1db7fe14603a00834052505497' (2024-11-15)
  → 'github:rust-lang/rust-analyzer/15d87419f1a123d8f888d608129c3ce3ff8f13d4' (2025-03-18)
• Updated input 'flake-compat':
    'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04)
  → 'github:edolstra/flake-compat/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec' (2024-12-04)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5e4fbfb6b3de1aa2872b76d49fafc942626e2add' (2024-11-15)
  → 'github:NixOS/nixpkgs/698214a32beb4f4c8e3942372c694f40848b360d' (2025-03-25)
2025-03-27 22:37:39 +03:00
Charles Hall
d6475eee6d
remove redundant condition 2025-03-21 16:48:56 -07:00
Charles Hall
799594cd1f
fix typo and update changelog
The MR number for the original MR was missing the leading `1`.
2025-03-21 16:28:11 -07:00
Charles Hall
218d75d573
update nixos module
Can't believe I forgot to do this...
2025-03-21 16:25:42 -07:00
Charles Hall
a04951541a
don't check canonicalized paths while sandboxed
Because the configured paths won't exist in the sandbox, so
canonicalization would fail.
2025-03-21 16:25:42 -07:00
Charles Hall
50583bc93e
reject overlapping non-canonical paths too
For example, if the database path is `/foo` and the media path is
`/foo/bar`, but `/foo/bar` is a symlink or hardlink to `/baz`, the
previous check would pass. The whole point of this check is to ensure
that the database and media data can't step on each other, so this check
is needed to deny that kind of situation as well.

It would probably be good to add a test for this behavior.
2025-03-21 16:25:31 -07:00
Charles Hall
b01b70fc20
reject overlapping media and database paths 2025-03-20 11:33:59 -07:00
Charles Hall
81a449d1d2
make database path a pathbuf
I'm guessing it wasn't like this already because of one of the admin
commands I deleted.
2025-03-20 11:33:59 -07:00
Charles Hall
5a5608e088
separate media and database paths
The primary motivation for this change is to support databases that
don't take a path, e.g. out of process databases.

This configuration structure leaves the door open for other media
storage mechanisms in the future, such as S3.

It's also structured to avoid `#[serde(flatten)]` so that we can use
`#[serde(deny_unknown_fields)]`.
2025-03-20 11:33:59 -07:00
Charles Hall
ae920fdbe8
make option name less redundant 2025-03-20 10:40:20 -07:00