1
0
Fork 0
forked from mirror/grapevine
Commit graph

2442 commits

Author SHA1 Message Date
Benjamin Lee
697c5ac534
allow searching in left rooms
The spec states that

> The search API allows clients to perform full text search across
> events in all rooms that the user has been in, including those that they
> have left. Only events that the user is allowed to see will be
> searched, e.g. it won’t include events in rooms that happened after
> you left.

<https://spec.matrix.org/v1.10/client-server-api/#server-side-search>
2024-06-03 19:54:50 -07:00
Benjamin Lee
857131e959
allow seeing state from visibility=shared left rooms 2024-06-03 19:54:03 -07:00
Benjamin Lee
52af998f7b
allow seeing events from visibility=shared left rooms 2024-06-03 19:52:40 -07:00
Benjamin Lee
c64a474954
workaround to fix search in element
We inherited a similar workaround from conduit, but removed it in
71c48f66c4. At the time, it was not clear
that this had broken search.

Fixes: !26
2024-06-03 18:02:41 -07:00
Lambda
5c39c7c5ff Use destination field in X-Matrix Authorization header
Both validating and sending it is a MUST since Matrix v1.3.
2024-06-03 20:50:49 +00:00
Lambda
62dd097f49 Use Ruma XMatrix type instead of rolling our own
Both the hand-rolled parser and serialization were wrong in countless
ways. The current Ruma parser is much better, and the Ruma serialization
will be fixed by https://github.com/ruma/ruma/pull/1830.
2024-06-03 20:50:49 +00:00
Charles Hall
aec314ce85
get tracing-opentelemetry from crates.io
They made a release with the changes we needed; we can stop pulling it
from git now.
2024-06-02 17:27:54 -07:00
Lambda
bf1d54defc axum: factor out non-generic parts of request conversion
This saves ~10% in binary size!
2024-05-31 10:42:47 +00:00
Benjamin Lee
624ff57414
test all-features in CI
This should catch if jemalloc linking is broken, which wouldn't be
caught by the `lints::cargo-clippy/all` task.
2024-05-30 21:19:09 -07:00
Benjamin Lee
3a71b8e5d1
optionally use nom to build devshell dependencies
This is nice when messing around with the nix configuration, since
you'll often end up building rocksdb *many* times.

We shouldn't need to do anything to get the logs in CI because we're
calling `nix-build-and-cache ci` at the beginning
2024-05-30 21:19:09 -07:00
Benjamin Lee
823515b475
load .env file before initializing flake
This allows specifying DIRENV_DEVSHELL in .env
2024-05-30 21:19:09 -07:00
Benjamin Lee
467417c32a
use all-features devshell for clippy/all in CI
Without this, we're building a static rocksdb inside the rust-rocksdb
build script every time. As far as I know this doesn't change clippy's
behavior, but it does take a *long* time.
2024-05-30 21:19:08 -07:00
Benjamin Lee
fa48c48d52
add all-features devshell
Because the nix rocksdb build depends on the jemalloc feature, you need
to use a different devshell when passing --all-features to cargo than
the default.
2024-05-30 21:19:08 -07:00
Benjamin Lee
8f24ac1f27
do default-feature unification in nix
Some of the features affect nix dependencies, so we need to have a
full feature list available when constructing the nix derivation. This
incidentally fixes the bug where we weren't enabling jemalloc on rocksdb
in CI/devshells, because jemalloc is now a default feature. It does not
fix the more general class of that issue, where CI is performing an
`--all-features` build in a nix devshell built for default-features.

I am now passing `--no-default-features` to cargo, and having it use our
unified feature list rather than duplicating the unification inside cargo.
2024-05-30 21:19:08 -07:00
Benjamin Lee
ee43c2ff4c
only link to one jemalloc build
Without setting JEMALLOC_OVERRIDE, we end up linking to two different
jemalloc builds. Once dynamically, as a transitive dependency through
rocksdb, and a second time to the static jemalloc that tikv-jemalloc-sys
builds.

This fixes dynamically-linked jemalloc builds, for the reasons described
in <https://github.com/girlbossceo/conduwuit/pull/400#issue-2316700200>.
2024-05-30 21:19:08 -07:00
Lambda
b6fc9b0feb
service/media: add some tracing 2024-05-30 15:40:28 -07:00
Lambda
0a92c72566
Put thumbnail creation inside spawn_blocking()
This can take milliseconds or even several seconds for huge inputs,
while the rule of thumb is <100us between await points.
2024-05-30 15:40:28 -07:00
Lambda
c973485c73
service/media: refactor to reduce indentation 2024-05-30 15:40:24 -07:00
Benjamin Lee
ec1b086a35
very minor cleanup in the sync endpoint
I meant to do this in 146465693e, but
looks like I forgot.
2024-05-30 10:19:24 -07:00
Benjamin Lee
72962c6402
enable allow_federation config by default
We inherited the disabled-by-default setting from conduit. Conduwuit
change it to enabled-by-default in [1]. This can make things confusing
for users migrating from conduwuit to grapevine, especially since we
currently do not log a warning when federation is disabled.

[1]: 24605e151d
2024-05-30 09:30:13 -07:00
Lambda
12e7f525aa Clean up and deduplicate parse_servercurrentevent() 2024-05-29 20:42:59 +00:00
Lambda
25353da8b8 sending.rs: record handler errors using Display 2024-05-29 20:42:46 +00:00
Lambda
fb52ded222 sending.rs: try to preserve requester spans
Add a `follows_from` relationship to the dispatched worker's span
pointing to the caller of `send_*()`, if known.
2024-05-29 20:42:46 +00:00
Lambda
18992b4d1d sending.rs: rename OutgoingKind to Destination
That's what it is. It describes the destination of the event.
2024-05-29 20:42:45 +00:00
Lambda
9071e11e06 sending.rs: move handler functions out of service
These don't take `self`, no reason for them to be associated functions.
2024-05-29 20:42:14 +00:00
Lambda
13f79dfee1 sending.rs: factor out event handlers into separate functions
This allows for much nicer control flow, since they don't need to return
Result<OutgoingKind, (OutgoingKind, Error)>.
2024-05-29 20:42:14 +00:00
Lambda
5caafdec06 sending.rs: formatting 2024-05-29 20:42:14 +00:00
Lambda
aa69b7d15c sending.rs: rename handle_futures->handle_response
The future is already done when this is called.
2024-05-29 20:42:14 +00:00
Lambda
9961f1465f sending.rs: add RequestData to replace big tuple 2024-05-29 20:42:14 +00:00
Lambda
e294543ddb sending.rs: add RequestKey
Much easier to reason about than with a bunch of Vec<u8> everywhere.
2024-05-29 20:42:13 +00:00
Charles Hall
507de063f5
don't hardcode EnvFilter for tracing-flame 2024-05-27 10:06:26 -07:00
Lambda
7a154f7416
observability: allow combining multiple tracing layers
Previously, jaeger, tracing_flame and stderr output were mutually
exclusive. There's no good reason for this.
2024-05-27 10:03:44 -07:00
Lambda
263edcc8a1
observability: don't drop tracing_flame drop guard until exit 2024-05-27 10:02:42 -07:00
Charles Hall
c17ab5328d
factor observability things into its own module
And also create a new error for the observability initialization.
2024-05-27 10:01:00 -07:00
Charles Hall
a275543494
enable axum's tracing feature
This pretty much only makes it log a single error event, but it's one
that's useful to know about.
2024-05-26 19:47:00 -07:00
Charles Hall
8f0fdfb2f2
upgrade all cargo dependencies
Unfortunately we need to pull tracing-opentelemetry from git because
there hasn't been a release including the dependency bump on the other
opentelemetry crates.
2024-05-26 19:47:00 -07:00
Charles Hall
d5da913c79
pin nixos/nix to 2.18.2
Not sure if Lix has Docker images we can use yet, but we can at least do
this for now.
2024-05-26 19:47:00 -07:00
Charles Hall
13de9ecd41
enable unnecessary_to_owned lint
*facepalm*
2024-05-26 19:47:00 -07:00
Charles Hall
7e7911abcf
enable thread_local_initializer_can_be_made_const
There's barely enough room in the commit title for this lint's name...
2024-05-26 19:47:00 -07:00
Charles Hall
3daf2229d6
enable option_as_ref_cloned lint 2024-05-26 19:47:00 -07:00
Charles Hall
eaeb7620d9
enable multiple_bound_locations lint 2024-05-26 19:47:00 -07:00
Charles Hall
92d9f81a78
enable mixed_attributes_style lint 2024-05-26 19:47:00 -07:00
Charles Hall
41a5e6fb50
enable manual_is_variant_and lint 2024-05-26 19:47:00 -07:00
Charles Hall
5048af3a8f
enable doc_markdown lint 2024-05-26 19:47:00 -07:00
Charles Hall
c9859a9b2d
enable assigning_clones lint 2024-05-26 19:47:00 -07:00
Charles Hall
793d809ac6
enable unused_qualifications lint 2024-05-26 19:47:00 -07:00
Charles Hall
d7e945f4c5
enable dead_code lint 2024-05-26 19:46:48 -07:00
Charles Hall
518d0c9cf3
update the rust toolchain, ignore new lints
I will fix them in follow-up commits. Also apparently rustc doesn't warn
you when you pass it lints that don't exist (yet) so that's annoying.
2024-05-24 20:09:41 -07:00
Charles Hall
82c37f2983
remove stale reference
This should've been done in d5a9c6ac32,
my bad.
2024-05-24 20:09:41 -07:00
Charles Hall
b5321d81c0
update flake.lock
Nixpkgs and `rust-rocksdb` line up so we can drop our RocksDB input for
the time being.

Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/6eabc3f02fae3683bffab483e614bebfcd476b21' (2024-02-14)
  → 'github:zhaofengli/attic/4dbdbee45728d8ce5788db6461aaaa89d98081f0' (2024-03-29)
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/aa9d4729cbc99dabacb50e3994dcefb3ea0f7447' (2023-12-14)
  → 'github:NixOS/nixpkgs/07262b18b97000d16a4bdb003418bd2fb067a932' (2024-03-25)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f' (2023-12-17)
  → 'github:NixOS/nixpkgs/44733514b72e732bd49f5511bd0203dea9b9a434' (2024-03-26)
• Updated input 'crane':
    'github:ipetkov/crane/55f4939ac59ff8f89c6a4029730a2d49ea09105f' (2024-04-21)
  → 'github:ipetkov/crane/109987da061a1bf452f435f1653c47511587d919' (2024-05-24)
• Updated input 'fenix':
    'github:nix-community/fenix/c8943ea9e98d41325ff57d4ec14736d330b321b2' (2024-03-05)
  → 'github:nix-community/fenix/b6fc5035b28e36a98370d0eac44f4ef3fd323df6' (2024-05-22)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/9f14343f9ee24f53f17492c5f9b653427e2ad15e' (2024-03-04)
  → 'github:rust-lang/rust-analyzer/21ec8f523812b88418b2bfc64240c62b3dd967bd' (2024-05-19)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/d465f4819400de7c8d874d50b982301f28a84605' (2024-02-28)
  → 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)
• Updated input 'nix-filter':
    'github:numtide/nix-filter/3449dc925982ad46246cfc36469baf66e1b64f17' (2024-01-15)
  → 'github:numtide/nix-filter/3342559a24e85fc164b295c3444e8a139924675b' (2024-03-11)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/b8697e57f10292a6165a20f03d2f42920dfaf973' (2024-03-03)
  → 'github:NixOS/nixpkgs/5710852ba686cc1fd0d3b8e22b3117d43ba374c2' (2024-05-21)
• Removed input 'rocksdb'
2024-05-24 20:08:54 -07:00