Compare commits

...

2218 commits
next ... main

Author SHA1 Message Date
strawberry
e589464954
bump cargo.lock and deps
Some checks failed
CI and Artifacts / Test (push) Has been cancelled
CI and Artifacts / Build (push) Has been cancelled
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-10-05 22:33:58 -04:00
Jason Volk
0413037246 fix lints
Signed-off-by: Jason Volk <jason@zemos.net>
2024-10-05 17:07:37 -07:00
Jacob Taylor
b9a8f8e6c7 automatically scale conduwuit caches by CPU-core-count 2024-10-05 17:07:37 -07:00
strawberry
032b199129 add db query command to get all pushers for a user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-15 19:56:29 -04:00
strawberry
e9e5fe2176 implement MSC4165, removing own power levels on deactivation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-15 14:20:01 -04:00
strawberry
17fd34eb12 dedupe some account deactivation steps, remove all profile fields on deactivation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-15 12:08:07 -04:00
strawberry
895b178720 add admin command to force demote a local user from a room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-15 11:36:47 -04:00
strawberry
a65dd6dfb3 dont allow guests to publish to room directories
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-14 12:37:29 -04:00
strawberry
e146c75279 dont include appservices in room guest access enforcement check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-14 12:27:22 -04:00
strawberry
d75aebc373 implement generic K-V support for MSC4133, GET/PUT/DELETE
no PATCH still yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-14 11:16:49 -04:00
morguldir
80b72637e2
ci: enable cachix after restoring the cache
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-13 05:09:10 +02:00
morguldir
a41e63b40e Add back allow_check_for_updates
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-12 22:51:31 -04:00
strawberry
cf9b72ce3f remove a few unnecessary muts
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-09 21:41:57 -04:00
strawberry
38552b36e9 make the first user admin if created from CLI / --execute
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-09 21:13:37 -04:00
strawberry
9de780b56c remove unnecessary displayname requirement on making user admin
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-09 21:10:56 -04:00
strawberry
55f71d3912 bump conduwuit to 0.4.7
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 19:56:53 -04:00
strawberry
61347bee06 advertise support for MSC4133 and MSC4175
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 19:53:33 -04:00
strawberry
38cd88e1e8 remove unnecessary cloning on account deactivation profile updates
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 19:33:21 -04:00
strawberry
b44f7f5476 remove MSC4175 timezone on account deactivation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 19:23:54 -04:00
strawberry
e888810e67 update complement results for TestFederationThumbnail
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 16:22:02 -04:00
morguldir
02aee2f174
ci: retry attic push 3 times, and continue on errors
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-08 20:51:34 +02:00
morguldir
24c408f4c6
bump rocksdb to 9.6.1, add binutils to devshell 2024-09-08 19:21:23 +02:00
morguldir
1c1f300efe
ci: avoid propagating bash errors immidiately
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-08 17:41:02 +02:00
morguldir
8dccc04b40
nix: explicitly include liburing in the devshell
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-08 17:40:02 +02:00
strawberry
96ab59b5b0
bump cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-08 10:28:21 -04:00
strawberry
c47337f3db
docs: ignore development.md and contributing.md from lychee
and update 2 other nix references

Signed-off-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-08 10:24:38 -04:00
morguldir
3e0d404fb4
syncv3: use RoomTypeFilter struct instead of Option<RoomType>
Signed-off-by: morguldir <morguldir@protonmail.com>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-07 18:09:21 +02:00
morguldir
593d3bb321
nix: update flake.lock, skip building tests for liburing
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-09-08 05:03:30 +02:00
strawberry
f14a253664 add local_only arg to list joined members in room admin cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-07 12:46:59 -04:00
strawberry
b3974c569d log device display name on normal user registrations too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-07 10:10:46 -04:00
strawberry
f163ebf3bb implement MSC4133 only with MSC4175 for GET/PUT/DELETE
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-07 09:27:35 -04:00
strawberry
5ae9a5ff31 bump nix lockfile, and ruma
• Updated input 'attic':
    'github:zhaofengli/attic/6d9aeaef0a067d664cb11bb7704f7ec373d47fb2' (2024-08-21)
  → 'github:zhaofengli/attic/bea72d75b6165dfb529ba0c39cc6c7e9c7f0d234' (2024-09-02)
• Added input 'attic/flake-parts':
    'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d' (2024-08-01)
• Added input 'attic/flake-parts/nixpkgs-lib':
    follows 'attic/nixpkgs'
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/d4a7a4d0e066278bfb0d77bd2a7adde1c0ec9e3d' (2024-08-16)
  → 'github:NixOS/nixpkgs/b96f849e725333eb2b1c7f1cb84ff102062468ba' (2024-08-30)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/205fd4226592cc83fd4c0885a3e4c9c400efabb5' (2024-07-09)
  → 'github:NixOS/nixpkgs/797f7dc49e0bc7fab4b57c021cdf68f595e47841' (2024-08-22)
• Updated input 'complement':
    'github:matrix-org/complement/6e4426a9e63233f9821a4d2382bfed145244183f' (2024-07-30)
  → 'github:matrix-org/complement/39733c1b2f8314800776748cc7164f9a34650686' (2024-08-22)
• Updated input 'crane':
    'github:ipetkov/crane/7ce92819802bc583b7e82ebc08013a530f22209f' (2024-08-18)
  → 'github:ipetkov/crane/7e4586bad4e3f8f97a9271def747cf58c4b68f3c' (2024-09-04)
• Removed input 'crane/nixpkgs'
• Updated input 'fenix':
    'github:nix-community/fenix/e88b38a5a3834e039d413a88f8150a75ef6453ef' (2024-08-21)
  → 'github:nix-community/fenix/d9afdb4465ba2f20bb73b0ff5d2c2837cafc2e14' (2024-09-06)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/3723e5910c14f0ffbd13de474b8a8fcc74db04ce' (2024-08-20)
  → 'github:rust-lang/rust-analyzer/124c7482167ff6eea4f7663c0be87ea568ccd8c6' (2024-09-05)
• Updated input 'liburing':
    'github:axboe/liburing/2d4e799017d64cd2f8304503eef9064931bb3fbd' (2024-08-21)
  → 'github:axboe/liburing/0fe5c09195c0918f89582dd6ff098a58a0bdf62a' (2024-09-06)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/36a9aeaaa17a2d4348498275f9fe530cd4f9e519' (2024-08-21)
  → 'github:NixOS/nixpkgs/ad416d066ca1222956472ab7d0555a6946746a80' (2024-09-04)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-07 09:27:29 -04:00
strawberry
6f643a4b06 bump rust to 1.81.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-06 21:08:21 -04:00
strawberry
80698c0b17 docs: add some more conduwuit development info
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-06 20:33:02 -04:00
strawberry
909eeac5b0 drop target CPU for aarch64 to cortex-a53 instead of cortex-a73
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-06 19:02:04 -04:00
strawberry
f521f88daf docs: mildly update the NixOS page to ref https://github.com/NixOS/nixpkgs/pull/339260
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-06 19:00:38 -04:00
strawberry
8f7ade4c22 document all the fancy admin room config options and arguments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 12:44:24 -04:00
strawberry
8849a100fd dont use HTML for initial welcome message
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 12:11:56 -04:00
strawberry
5dfda2d300 fix one header in readme
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 12:08:38 -04:00
strawberry
c13e9a7c2b document allow_legacy_media config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 12:00:08 -04:00
morguldir
393eef431b
syncv3: avoid fetching timelines for invites 2024-08-31 18:58:39 +02:00
Jason Volk
4bac9b33cc propagate config error for cidr range
Signed-off-by: Jason Volk <jason@zemos.net>
2024-09-01 11:15:55 +00:00
strawberry
60605e9579 remove unnecessary loop/allocations on CIDR range init
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 00:59:43 -04:00
strawberry
27bfb67d75 add --no-details to admin rooms list command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 00:56:49 -04:00
strawberry
fc1834d629 use codeblocks instead of HTML tables for some admin commands
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 00:44:22 -04:00
strawberry
2fcedad2b1 document ways to recovering admin room access
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-09-01 00:40:17 -04:00
strawberry
b362f0e0fa fix some other markdown formatting
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-31 16:05:47 -04:00
strawberry
5530e7434a notify admin room on new room directory publishes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-31 13:18:48 -04:00
strawberry
bfb10cda26 slightly cleanup and simplify client /report endpoint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-31 12:51:24 -04:00
strawberry
5dbb868936 remove unnecessary loops/allocations in client /capabilities
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-31 12:18:21 -04:00
Jason Volk
14b9511d2e fix default capture EnvFilter in release mode
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-31 12:24:11 +00:00
morguldir
7b852352e5
deploying: make traefik config self-sufficient, include well known 2024-08-31 14:09:16 +02:00
Jason Volk
b45df5f7bd bump appservice requests to v1.7
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-31 09:55:26 +00:00
strawberry
4797183b43 remove unnecessary loop/allocations in /joined_members
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 19:52:55 -04:00
strawberry
d68b71a0aa add appservice ping client endpoint (MSC2659)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 19:38:15 -04:00
strawberry
922875477f docs: fix some borked codeblocks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 19:38:15 -04:00
strawberry
3a623dbdc3 add force_leave_room admin command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 17:17:00 -04:00
strawberry
ae98610c50 docs: document new startup --execute admin cmd flag/argument
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 16:42:37 -04:00
strawberry
bceed3c829 dont debug print startup admin command content body
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 15:01:54 -04:00
strawberry
b89d2ceccd bump syn, serde, and tokio
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 12:57:50 -04:00
renovate[bot]
eaa8997506 Update nixos/nix Docker tag to v2.24.4 2024-08-30 12:57:50 -04:00
strawberry
42a42b24a9 renovate: exclude rust deps we forked / cant easily bump or upgrade
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 12:57:50 -04:00
strawberry
8d7e5ca2bb redirect/handle r0 media paths too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 12:57:50 -04:00
strawberry
119cc2eec0 fix typo with reqwest builder for disabling zstd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-30 12:57:50 -04:00
morguldir
9fde835673
syncv3: read receipts extension (MSC3960) 2024-08-30 18:23:42 +02:00
morguldir
bf9d498621 syncv3: check timestamps of all the rooms in the timeline 2024-08-30 18:20:18 +02:00
morguldir
f8cf57c1fb
syncv3: fix bump types and only set timestamp if we find an event 2024-08-30 11:39:14 +02:00
morguldir
26a6d349dc
nix: fix toolchain splicing warning
we load the toolchain from a file so not sure how we would create a toolchain based on pkgs 🤔
2024-08-30 10:35:05 +02:00
morguldir
77c0c13a83
syncv3: support per room account data 2024-08-30 10:31:08 +02:00
morguldir
36b8de1339
syncv3: include invited rooms in the count 2024-08-30 09:30:50 +02:00
morguldir
29a6065bae
syncv3: include latest timestamps, calculated from a default set of types
List borrowed from synapse
2024-08-24 14:52:48 +02:00
morguldir
f4c8b77377
syncv3: include the invite_state in the response 2024-08-24 07:33:07 +02:00
morguldir
85400d15bc
syncv3: reset the connection after restarts 2024-08-24 06:57:31 +02:00
morguldir
13334a88ca
syncv3: handle empty conn_id by mapping it to a predefined string 2024-08-24 06:45:33 +02:00
morguldir
351062eb82
syncv3: add support for filtering invites and room types 2024-08-24 06:44:32 +02:00
morguldir
001523ec81
Avoid panicing during sliding sync if the user isn't in any rooms 2024-08-24 05:23:51 +02:00
morguldir
0a5f18ed83
reformat: make markdown files wrap at 80 chars 2024-08-24 05:13:43 +02:00
morguldir
16ce62302a
.editorconfig: use tabs for rust files 2024-08-24 05:11:38 +02:00
Jason Volk
0068624cd6 add exception for upload when allow_legacy_media=false
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
2837151dba redirect legacy url preview
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
3d8757c896 update complement for new media
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
b175892178 support MSC4180 unstable stable flag for MSC3916
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
d8a1996e24 bump ruma for deprecation warning suppression
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
a934a7f687 freeze remote media via legacy endpoints
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
1638be0339 add authenticated media client api
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
ea2343850f add remote fetch suite for authenticated media
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
fcfb323cd5 relegate legacy media handlers to separate file
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
84a8e36120 add federation endpoints for authenticated media
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-30 08:24:52 +00:00
Jason Volk
47f9c69eff split media related migrations into service dir
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
73af171830 add config option for pruning missing media
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
9654dd9218 Fix stale example config for media_compat_file_link
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
dea5fee6a3 abstract duration parsing into utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
4d42a29c51 add thumbnail dimension structure
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
7b0e830f4c add interface to get file metadata w/ admin command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
e7b2c14280 tag admin room m.server_notice on grant
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
bb5f2556c3 improve admin command error propagation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
f047675a63 rename admin/handler to admin/processor
Handler is overused. Handler ought to mean the end-function handling the
command. The command processor is the central dispatcher to the handler.

Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
f4db6292b3 add smoketest-assist execution mode
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
fcb9d04d9e add program argument for functional testing; simplify execute argument
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
ffc41cb01f split admin service startup related into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
e4bcbb8088 propagate errors from reqwest client constructions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
e4ba34a638 remove zombie globals/client file
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
strawberry
d5e7befaa9 move a few MXC parsing logs to trace
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
1157140657 mark sending ruma matrix version as 1_11
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
fb49e37067 add admin command to delete all remote media from a specific server
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
8923c9a227 add admin command to redact an individual event from a local user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
2b7e0dcb80 add admin command to delete all local media by a local user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
e790785db8 fix: force argument for delete past remote media wasn't fully functional
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
6b65a8fc86 add functions to delete media from specific local users
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
a79ae7d1a2 add missing MXC URI prefix bytes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
156199a218 add --no_details to list banned rooms command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
c16e5b50eb update complement results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
47ca835c20 initialise default TLS crypto provider with aws_lc_rs manually
we use ring for hashing state and ruma, and reqwest/rustls defaults
to aws_lc_rs, so we have to manually pick which one. there doesn't
seem to be a way to just use one for some reason, so lets just use
the new aws_lc_rs.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
morguldir
dc3d9ebbf1 Bump flake.lock to avoid https://github.com/NixOS/nixpkgs/issues/332957 for cargo-audit 2024-08-29 19:19:20 +00:00
morguldir
c1bcdeaf01 Add olm to permittedInsecurePackages for CI 2024-08-29 19:19:20 +00:00
strawberry
08efebd5af bump rocksdb to v9.5.2
• Updated input 'rocksdb':
    'github:girlbossceo/rocksdb/60fa2881f3b60b0b77ad3ded0904d432a98f392c' (2024-08-18)
  → 'github:girlbossceo/rocksdb/5a67ad7ce46328578ee5587fb0c23faa03d14e67' (2024-08-22)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
morguldir
ddacda9ecf add heroes support to sliding sync responses
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
1e4b1e516e ci: allow olm vulnerable library in nixpkgs for ci
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
fadb2de5bf docs: document list of projects conduwuit has forked
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
edd42974e5 bump cargo.lock and deps, add zstd compression to reqwest client
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
e0fd84149d bump nix flake.lock
• Updated input 'attic':
    'github:zhaofengli/attic/26b9417bde03edc6280d1f7ce709cd619cdb72d4' (2024-08-13)
  → 'github:zhaofengli/attic/acf3c351f8de47c6857f31948ab253f9c7ce2a6f' (2024-08-19)
• Updated input 'attic/crane':
    'github:ipetkov/crane/480dff0be03dac0e51a8dfc26e882b0d123a450e' (2024-05-29)
  → 'github:ipetkov/crane/4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4' (2024-08-06)
• Updated input 'attic/flake-compat':
    'github:edolstra/flake-compat/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9' (2023-01-17)
  → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04)
• Updated input 'attic/flake-utils':
    'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02)
  → 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)
• Added input 'attic/flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/07262b18b97000d16a4bdb003418bd2fb067a932' (2024-03-25)
  → 'github:NixOS/nixpkgs/d4a7a4d0e066278bfb0d77bd2a7adde1c0ec9e3d' (2024-08-16)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/44733514b72e732bd49f5511bd0203dea9b9a434' (2024-03-26)
  → 'github:NixOS/nixpkgs/205fd4226592cc83fd4c0885a3e4c9c400efabb5' (2024-07-09)
• Updated input 'cachix':
    'github:cachix/cachix/bd558fd32f55d6df1c3d496bade90335a1a6044d' (2024-08-10)
  → 'github:cachix/cachix/72bb6b9987149f53f2458bb1596306c621d8b804' (2024-08-14)
• Updated input 'crane':
    'github:ipetkov/crane/4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4' (2024-08-06)
  → 'github:ipetkov/crane/7ce92819802bc583b7e82ebc08013a530f22209f' (2024-08-18)
• Updated input 'fenix':
    'github:nix-community/fenix/296d44c440302980824c5f3b67e477cf0522e0c1' (2024-08-13)
  → 'github:nix-community/fenix/b6a1c29a8f460af63f66cad2b5acf3b78867603e' (2024-08-20)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/32a86cb1dad2b208e8f36f1bb50c2e4806b0371f' (2024-08-12)
  → 'github:rust-lang/rust-analyzer/979e3b54f70f6f231c117a5d628b98106e5c7d31' (2024-08-19)
• Updated input 'liburing':
    'github:axboe/liburing/401b3e4bde2316d35e93b548269c72bbb64adc02' (2024-08-13)
  → 'github:axboe/liburing/1ecfda19594e68b760a09b91ef442f7e76a3514e' (2024-08-19)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/a58bc8ad779655e790115244571758e8de055e3d' (2024-08-11)
  → 'github:NixOS/nixpkgs/8a3354191c0d7144db9756a74755672387b702ba' (2024-08-18)
• Updated input 'rocksdb':
    'github:girlbossceo/rocksdb/911f4243e69c2e320a7a209bf1f5f3ff5f825495' (2024-07-13)
  → 'github:girlbossceo/rocksdb/60fa2881f3b60b0b77ad3ded0904d432a98f392c' (2024-08-18)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
23690fd837 make jemalloc stats an optional feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
867050df9e use fork of rust-rocksdb and jemallocator
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
Jason Volk
50e66a2976 add partial envfilter support for admin log capture; conf item
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
4d0fc41222 add conf item for federation loopback prevention bypass
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
152ae705a0 refactor for structured Mxc type
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
54e6a41404 move remote media fetchers into services
minor error simplification

Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
c3f00f4d15 remove redundant CSP directives which effectively default to the same value
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
43300ea41e Make axum-dual-protocol a non-feature. Fix build issues.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
17a54bc4f8 refactor for ruma cow headers; update for ContentDisposition type
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
f540bed61e propagate additional errors from db options
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
2cf472a69b elide header from command output when no logs captured
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
b2d8da489c add configurable automatic admin command execution after startup
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
025afb61cb bump ruma again for borrowed identifier deserialization
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
40d53563fc integrate ruma js_int errors into enum
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
5db816277b add from serde_json error to enum
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
efa70b9e78 add serde de/ser impls for error
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
bac795de5f use transparent thiserror attribute; cleanup error variants
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
f69f4c479c propagate error from database options building
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
992f725362 allow expression to defer macro
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
0e56d1c7a2 add math::try_into util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
b4d5282123 add nullary type_name debug util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
15ad7523aa split Destination enum into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
Jason Volk
eb6e509ad8 use where clause for long lines
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-29 19:19:20 +00:00
strawberry
4432c06c86 remove local room aliases and unpublish room when banning a room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
bc5ecb0c72 attempt to recreate server default push rules more if broken/empty content/etc
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
f1b41ce6e3 remove unnecessary alias check on deleting room aliases
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
826b1d1d62 remove unnecessary "unsupported room version" error on PDU processing to allow custom room versions properly
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
c40ed0c98e add missing remove aliases on room upgrade transferring room aliases
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00: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
strawberry
66679c7522 nix: bump flake.lock
• Updated input 'attic':
    'github:zhaofengli/attic/6139576a3ce6bb992e0f6c3022528ec233e45f00' (2024-07-09)
  → 'github:zhaofengli/attic/26b9417bde03edc6280d1f7ce709cd619cdb72d4' (2024-08-13)
• Updated input 'cachix':
    'github:cachix/cachix/4e9e71f78b9500fa6210cf1eaa4d75bdbab777c3' (2024-07-02)
  → 'github:cachix/cachix/bd558fd32f55d6df1c3d496bade90335a1a6044d' (2024-08-10)
• Updated input 'cachix/devenv':
    'github:cachix/devenv/bb32aa986f2f695385e54428d0eaf7d05b31466e' (2024-06-30)
  → 'github:cachix/devenv/ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91' (2024-08-08)
• Updated input 'cachix/devenv/pre-commit-hooks':
    follows 'cachix/pre-commit-hooks'
  → follows 'cachix/git-hooks'
• Added input 'cachix/git-hooks':
    'github:cachix/git-hooks.nix/c7012d0c18567c889b948781bc74a501e92275d1' (2024-08-09)
• Added input 'cachix/git-hooks/flake-compat':
    follows 'cachix/flake-compat'
• Added input 'cachix/git-hooks/gitignore':
    'github:hercules-ci/gitignore.nix/637db329424fd7e46cf4185293b9cc8c88c95394' (2024-02-28)
• Added input 'cachix/git-hooks/gitignore/nixpkgs':
    follows 'cachix/git-hooks/nixpkgs'
• Added input 'cachix/git-hooks/nixpkgs':
    follows 'cachix/nixpkgs'
• Added input 'cachix/git-hooks/nixpkgs-stable':
    'github:NixOS/nixpkgs/194846768975b7ad2c4988bdb82572c00222c0d7' (2024-07-07)
• Updated input 'cachix/nixpkgs':
    'github:NixOS/nixpkgs/00d80d13810dbfea8ab4ed1009b09100cca86ba8' (2024-07-01)
  → 'github:NixOS/nixpkgs/cb9a96f23c491c081b38eab96d22fa958043c9fa' (2024-08-04)
• Removed input 'cachix/pre-commit-hooks'
• Removed input 'cachix/pre-commit-hooks/flake-compat'
• Removed input 'cachix/pre-commit-hooks/gitignore'
• Removed input 'cachix/pre-commit-hooks/gitignore/nixpkgs'
• Removed input 'cachix/pre-commit-hooks/nixpkgs'
• Removed input 'cachix/pre-commit-hooks/nixpkgs-stable'
• Updated input 'crane':
    'github:ipetkov/crane/2d83156f23c43598cf44e152c33a59d3892f8b29' (2024-07-09)
  → 'github:ipetkov/crane/4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4' (2024-08-06)
• Updated input 'fenix':
    'github:nix-community/fenix/5087b12a595ee73131a944d922f24d81dae05725' (2024-07-13)
  → 'github:nix-community/fenix/296d44c440302980824c5f3b67e477cf0522e0c1' (2024-08-13)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/ffbc5ad993d5cd2f3b8bcf9a511165470944ab91' (2024-07-11)
  → 'github:rust-lang/rust-analyzer/32a86cb1dad2b208e8f36f1bb50c2e4806b0371f' (2024-08-12)
• Updated input 'liburing':
    'github:axboe/liburing/1d674f83b7d0f07553ac44d99a401b05853d9dbe' (2024-07-12)
  → 'github:axboe/liburing/401b3e4bde2316d35e93b548269c72bbb64adc02' (2024-08-13)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9' (2024-07-12)
  → 'github:NixOS/nixpkgs/a58bc8ad779655e790115244571758e8de055e3d' (2024-08-11)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
a2afdbe1fa bump various cargo deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
f86ab0cd03 bump rust toolchain to hotfix 1.80.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
7b8ef3b070 dont apply new_user_displayname_suffix to appservice user registrations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
83ef4eecc7 reduce unnecessary logging on URL preview and event, use sensible error code for URL previews
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
52ccad04a6 apply forbidden_remote_server_names to outbound sending and inbound federation handling
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
8fe19a6ef0 dont send duplicate membership update events if pfp and display name are same
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
fd96f597cd respect m.room.guest_access on room joins
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
982f9eb780 implement MSC4166, returning M_NOT_FOUND if no TURN URIs are set
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 19:19:20 +00:00
strawberry
aeb6fbe70f remove matrix.org code of conduct from conduwuit's foundational rules
while their code of conduct has very great baseline points, this is not a code of
conduct the foundation upholds themselves, so it would be a disserve to mislead
folks into using this as a baseline.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-29 14:24:37 -04:00
Aurora Master
d264935625 Update ci.yml 2024-08-27 13:56:43 -04:00
Matthew Scheffel
28cd784972 paginate_relations_with_filter DRY & flip ordering #504 2024-08-16 22:19:10 -04:00
strawberry
6662aa21ef bump complement to 6e4426a9e63233f9821a4d2382bfed145244183f
• Updated input 'complement':
    'github:matrix-org/complement/0d14432e010482ea9e13a6f7c47c1533c0c9d62f' (2024-07-10)
  → 'github:matrix-org/complement/6e4426a9e63233f9821a4d2382bfed145244183f' (2024-07-30)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-08 17:18:26 -04:00
Jason Volk
9b9a91f6ef add our_modules() for log capture filter convenience
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
94b805de0b generalize log capture to all admin commands; simplify handler
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
eded585f79 rename some command types for consistency
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
a552321287 add Clap to Error
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
f98bfbbdcd add string stream convenience util; add ?Sized bounds on log fmt functors
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
e9ab548445 tweak some tracing log levels
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
15184d1a79 Add span scope names array to capture filter data; optimize values visitor vec.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
0c6bbde25f fix markdown table formatter for log capture
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
13aa353765 add arrayvec as a dependency
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
ac941a801a add interface to query rocksdb properties w/ admin cmd
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
f261d44edb add method to iterate opened database columns
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
849cfdcdfa add rocksdb stats level option with conf item
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
Jason Volk
1470331f7e add repair_mode documentation to example conf
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-08 18:09:21 +00:00
strawberry
dcaa96a79f sync: always include_redundant_members when using element_hacks feature
see:
- https://github.com/matrix-org/matrix-js-sdk/pull/4329
- 568051c0f0/synapse/handlers/pagination.py (L639)
- https://matrix.to/#/!n8DKU1BeeJilOJXDPr:seirdy.one/$gvGF7GuPrLPR8nHg4UiHvP-ZVwuiMkYS8O6VlsDCW9w?via=awawawawawawawawawawawawawawawawawawawawawawawawawawawawawawaw.gay&via=transfem.dev&via=matrix.org

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:07:01 -04:00
strawberry
101a966922 docs: mention potential DNS issues when using docker
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:06:28 -04:00
strawberry
57940f38ea set last_seen_ip on new/initial device creation
this is not automatically updating, but at least have something
useful there instead of nothing

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:06:19 -04:00
strawberry
22f8c339fc debian: remove --verbose from postinst
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:06:09 -04:00
strawberry
c896acb729 dont consider presence status changes apart of presence spam
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:06:01 -04:00
strawberry
7f1bc490d6 docs: update configuration docs for the new -O option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:05:27 -04:00
strawberry
1091c30845 docs: mention FreeBSD specific build commandline for deployment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:05:16 -04:00
strawberry
12d9e454db display success/failure count in get-remote-pdu-list
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:04:51 -04:00
strawberry
82b973a8b1 nix: use cortex-a73 / ARMv8-a, strip and remove unnecessary bloat
for some reason gcc is included in OCI images

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:04:41 -04:00
strawberry
71ee31a014 add missing newline in banned room list output
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-07 12:04:12 -04:00
skedastically
69b4ec81b6
update container registry links (#549 / #548)
* gitlab URL

* Update docker.md
2024-08-05 15:23:40 -04:00
Jason Volk
fe0969e7ca fix release-max-perf profile [ci skip]
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-01 13:37:27 +00:00
Jason Volk
2e3e14b045 refactor some additional errors
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-01 10:58:59 +00:00
Jason Volk
f51d4237c7 bump cargo
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-01 10:58:59 +00:00
strawberry
d8a87258d6 rust: bump console-subscriber to 0.4
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-01 10:58:58 +00:00
strawberry
3da2242730 bump tokio, use default-features = false for more crates
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-08-01 10:58:58 +00:00
Jason Volk
5add9a8c34 support field values in err! macro
Signed-off-by: Jason Volk <jason@zemos.net>
2024-08-01 10:58:58 +00:00
Jason Volk
5b1642f641 split server_keys from event_handler into service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 21:10:22 +00:00
Jason Volk
eb94aa7079 remove dangling sending/resolve unit
this was probably un-deleted during a rebase conflict resolution,
but remained outside of the mod tree.

Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 21:10:22 +00:00
Jason Volk
24884c3b9b move media helpers from api to services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 03:04:17 +00:00
Jason Volk
a0a002b17f disable legacy media compat by default; cleanse directory when disabled
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 03:04:17 +00:00
Jason Volk
f632b06e6d use Services instead of Server for middleware function state
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 03:04:17 +00:00
Jason Volk
1f88866612 optimize api state extractor
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-31 03:04:17 +00:00
Jason Volk
ccef1a4c8b add formal wrapping for api state
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 21:32:43 +00:00
Jason Volk
5c258f41c8 fixes for modules
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
15126ee1b2 additional weak references where applicable
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
e37ac56dba use weak references to break services dependency cycle
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
a74613be96 improve database repair/shutdown log messages
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
a95ded167f fix type complexity
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
95121b6e05 use single-line codeblock for specific features lists
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
e6884ef13a fix various nightly incidental lints
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
49033db2b8 fix trailing body passed to commands
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
ddc8c3b46c split presence data object into file; improve service encapsulations
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
Jason Volk
ea95627dce hoist rustc flag string array to global const
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-28 05:59:12 -07:00
strawberry
c3e751542d ci: default to empty string to "unset" variables
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-28 05:59:12 -07:00
strawberry
4b765aa17c ci: only use sccache conditionally
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-27 15:28:17 -04:00
Jason Volk
954cfc6bb7 bump cargo
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 09:08:51 +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
7e50db4193 de-global services from admin
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
7a3cc3941e parse generics for implement macro
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
ca82b59c6f upgrade to syn 2.x
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
3b5607ecdc add macro for out-of-line definitions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
96f6a75bc8 add refutable pattern function macro
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
68f42baf73 rename admin Command to CommandInput
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
271959ee27 add debug list-dependencies admin command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
c423a83656 add cli override for any configuration item
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
4e975887cf add command to list features
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
8bb69eb81d add simple ast dimension diagnostic
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
2100618d47 add rustc build flags reflection
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
936d2915e2 add cargo manifest reflection
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
f014231644 add conf item to disable rocksdb compaction
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
7d487d53d8 de-cycle conduit_macros from conduit_core.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
d7d874f88d start core info module; move version to info
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
ee864bcd9e normalize admin debug command handlers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
111cbea6fc add debug time command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
85f734ec74 proc macro
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
2468e0c3de unconditionally derive Debug on subcommand enums
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
f841c2356d preliminary get-signing-keys command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
c64adbec0e split signing_keys_for from verify_keys_for
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
4458efa2b2 rename signing_keys_for to verify_keys_for
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
5c0bf29122 add util for camel to snake case conversion
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
91b49a7786 add basic exchange util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
5a17fbccf5 add type_name debug tool
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
5ed95ea357 contextualize handler in object
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
ccfa939bd3 split admin command enum from handler
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
263e338088 add --console program option to automatically spawn
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
2fb43dd38d infra to synthesize program options with config options
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
59efabbbc2 de-global server_is_ours / user_is_local
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
010e4ee35a de-global services for services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
992c0a1e58 de-global services for admin
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
9b20c6918f add indirection for circular-dependencies between services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
3dc91525ce fix over-tabulation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
a88f913a17 enrich interface for inter-service referencing
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
4343218957 initialize some containers with_capacity
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:42 +00:00
Jason Volk
b116984e46 use mutex_map for url preview lock
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:41 +00:00
Jason Volk
b0ac5255c8 move sending service impl properly back to mod root
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:41 +00:00
Jason Volk
29fc5b9b52 de-global some services in services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:41 +00:00
Jason Volk
3ccd9ea326 consolidate all resolution in resolver; split units
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 08:26:41 +00:00
Jason Volk
8a2ae401df convert Client into Service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 07:54:05 +00:00
Jason Volk
f465d77ad3 convert Resolver into a Service.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 07:54:05 +00:00
Jason Volk
2fd6f6b0ff add polymorphism to Services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 07:54:05 +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
463f1a1287 only use graceful shutdown w/ axum-server fixed
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-27 07:53:09 +00:00
strawberry
04fc87ad07 ci: try to free more runner storage/space
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
dc573f4562 ci: run free disk space for documentation workflow too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
74826dcb94 resolve lint_groups_priority lint (https://github.com/rust-lang/cargo/issues/12918)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
b20c4e0539 bump MSRV and rust toolchain to 1.80.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
fb8a2846df ci/nix: use a "test" cargo profile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
04971d0430 ci: cache all crates in rust-cache
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
f098532b09 ci: retry nix-build-and-cache 3 times before failing due to attic issues
attic just sucks and every 5 CI runs guarantees at least 2 false
gateway errors that i can't do anything about.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
60927c1c72 ci: try using sccache
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
03296412ab ci: validate deb packages produced
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
934ab6a4fe nix: add dpkg to devshell packages for dpkg-deb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:10 -04:00
strawberry
1378399f9d ci: build and upload static debug/dev binaries and OCI images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-25 22:50:08 -04:00
strawberry
09680f653f nix: add outputs for debug builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 19:55:49 -04:00
strawberry
39f19c483a nix: use all-features for complement OCI images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 19:55:46 -04:00
strawberry
39c0f4ea3d delete unused bad_signature_ratelimiter rm'd in 67f9553790
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 19:12:20 -04:00
strawberry
405167fc3f add harmless check for presence PUT matching sender user
this is already done but we just don't error and always
use the sender user. match synapse behaviour where we check
and error.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
b13ea4ff45 fix non-working admin room topic accessor output
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
100fc5e0f7 bump tokio to 1.39.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
96f9d64111 add back is_historical check on admin user creations from accidental removal
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
30ad5da5f1 use ruma-identifiers-validation feature from our ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
ce0ca96df4 clarify that sentry_traces_sample_rate is a percentage
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
4851ad26e2 bump cargo.lock, lock jemallocator to 0.5.4
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:25 -04:00
strawberry
328759a60f ci: run quick smoke test of x86_64 static binary
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-24 01:41:21 -04:00
strawberry
463fa4fd53 nix: dont build unnecessary jemalloc docs or cxx integration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-22 17:57:51 -04:00
strawberry
db494e0d68 bump conduwuit to 0.4.6
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-22 17:57:51 -04:00
Myned
4788040458 fix media_startup_check typo
Signed-off-by: Myned <dev@bjork.tech>
2024-07-22 13:31:20 -04:00
Matthew Scheffel
06531993f6
Calculate Age Rather than Hardcoding to 1 (#531) 2024-07-17 21:47:59 -04:00
strawberry
c29197b3f4 ci: dont publish -rc tags as latest docker branches
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-16 00:44:47 -04:00
Jason Volk
739eab46d5 refactor thumbnail math
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:40:18 +00:00
Jason Volk
923a98eb66 partially revert dc18f89c0b for now
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:40:18 +00:00
Jason Volk
4430e4dee0 de-global some services()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
d67f19a55d cleanup some error callsites
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
b903b46d16 split thumbnailing related into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
167559bb27 rename FileMeta::file to Option<content>
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
838e4b9d8d log more details for panic in tower handler
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
038b71fc9d add state to router
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
720fbd09c2 move routes into api router top level
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
c42cb90dd3 simplify result handler / 405 error interposition
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
Jason Volk
5950355348 break from wait loop on empty taskset
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-16 02:39:49 +00:00
strawberry
f79bd2ac72 bump ruma-identifiers-validation to c51ccb2c68d2e3557eb12b1a49036531711ec0e5
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
80ec0e31b1 bump tracing fork
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
bda44b16b1 ci: run nix dynamic build test with DIRENV_DEVSHELL=dynamic
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
e2280aa1a5 ci: try removing --impure
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
bdf2de076a ci: set NIX_CONFIG with our binary caches for the earlier CI steps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
1797fec3c9 nix: disable USE_RTTI for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-15 22:13:05 -04:00
strawberry
188fa5a073 patch rustyline-async and use no default features
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
f0c63c539b nix: dont build more unnecessary tests/tools for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
649e9da1f8 nix: try to make armv8.2-a / cortex-a55 optimised builds if target is aarch64
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
df28359a19 nix: dont build rocksdb core tools (ldb / sst_dump) (-DWITH_CORE_TOOLS=1)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
9370e93a8d nix: try to make x86-64-v2 optimised builds if target is x86_64
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
bdd5845490 docs: suggest recursive chmod
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:18 -04:00
strawberry
bacffd6174 rename conduit_cache_capacity_modifier to cache_capacity_modifier
this prefix causes you to require setting the environment variable
to `CONDUWUIT_CONDUIT_CACHE_CAPACITY_MODIFIER`

alias this so we dont break any configs

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:08:15 -04:00
strawberry
a1bfd7a018 nix: dont include experimental feature on all-features builds
this is just future infra for it

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:06:52 -04:00
strawberry
7009f56a7a fix user directory publishing access controls
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:06:52 -04:00
strawberry
2c0bfac43e nix: bump flake.lock and rocksdb to v9.4.0
• Updated input 'attic':
    'github:zhaofengli/attic/717cc95983cdc357bc347d70be20ced21f935843' (2024-06-01)
  → 'github:zhaofengli/attic/6139576a3ce6bb992e0f6c3022528ec233e45f00' (2024-07-09)
• Updated input 'complement':
    'github:matrix-org/complement/bc97f1ddc1cd7485faf80c8935ee2641f3e1b57c' (2024-07-02)
  → 'github:matrix-org/complement/0d14432e010482ea9e13a6f7c47c1533c0c9d62f' (2024-07-10)
• Updated input 'crane':
    'github:ipetkov/crane/0aed560c5c0a61c9385bddff471a13036203e11c' (2024-07-06)
  → 'github:ipetkov/crane/2d83156f23c43598cf44e152c33a59d3892f8b29' (2024-07-09)
• Updated input 'fenix':
    'github:nix-community/fenix/abc0549e3560189462a7d394cc9d50af4608d103' (2024-07-08)
  → 'github:nix-community/fenix/5087b12a595ee73131a944d922f24d81dae05725' (2024-07-13)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/a5b21ea0aa644dffd7cf958b43f11f221d53404e' (2024-07-07)
  → 'github:rust-lang/rust-analyzer/ffbc5ad993d5cd2f3b8bcf9a511165470944ab91' (2024-07-11)
• Updated input 'liburing':
    'github:axboe/liburing/7b3245583069bd481190c9da18f22e9fc8c3a805' (2024-06-22)
  → 'github:axboe/liburing/1d674f83b7d0f07553ac44d99a401b05853d9dbe' (2024-07-12)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1' (2024-07-08)
  → 'github:NixOS/nixpkgs/7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9' (2024-07-12)
• Updated input 'rocksdb':
    'github:girlbossceo/rocksdb/a935c0273e1ba44eacf88ce3685a9b9831486155' (2024-07-02)
  → 'github:girlbossceo/rocksdb/911f4243e69c2e320a7a209bf1f5f3ff5f825495' (2024-07-13)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:06:52 -04:00
strawberry
fcb6c8a113 bump rust-rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:06:52 -04:00
Charles Hall
1ab77aeb91 don't strip binary for dev builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:06:52 -04:00
strawberry
3d73b53136 update complement results
we dont implement authenticated media yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-14 12:35:00 +00:00
strawberry
101fdbc9b1 bump cargo.lock
Updating bytes v1.6.0 -> v1.6.1
Updating cc v1.1.0 -> v1.1.3
Updating http-body v1.0.0 -> v1.0.1
Updating syn v2.0.70 -> v2.0.71
Updating thiserror v1.0.61 -> v1.0.62
Updating thiserror-impl v1.0.61 -> v1.0.62

Signed-off-by: strawberry <strawberry@puppygock.gay>
Co-authored-by: Jason Volk <jason@zemos.net>
2024-07-14 12:35:00 +00:00
Jason Volk
e53c2fbc5a fix tracing flame envfilter defaults; remove preprocessed cfgs
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
95006f7e46 fix unnecessary preprocessing cfgs
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
cce270d938 tokio metrics
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
5ec49b3f62 split csp into array; integrate error; cleanup type
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
e4dc4a1ba5 fix graceful shutdown on unix socket
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
d2fb6d04c9 cleanup pending transactions before sender worker completes
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
05efd9b044 elaborate error macro and apply at various callsites
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
b3f2288d07 add constant-expression string utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
084751ae38 refactor globals::updates into a Service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
aa7a310200 move media startup into service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
38c989a07e split service manager into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
5be679e17b refactor main task stack through service mgr
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
b8baa1223d reduce RoomVersionId patterns
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
b87f1649d4 split error into directory
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
4a6f089b23 move some config checks into check unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
4600c7f32d move infallible handling into error
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
4cc92dd175 refactor Error::bad_config
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
93ec4e579b error macro suite
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
c111d2e395 abstract service worker pattern; restart on panic.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
03d890cd49 move admin tests into unit; fix
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
a35b6cbfdd use separate configurable jaeger envfilter
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-14 11:31:39 +00:00
Jason Volk
5570220c89 use separate but configurable envfilter for sentry
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
899b79873e propagate errors from tracing init
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
57969f9480 fix large stack array exceeding limit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
d88ab37120 add configuration for sentry to send panics and errors
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
bc58e5002d add interface for current log filter; fix console suppression
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
160f48043e add selective log handle reload
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
0023b09f5b make tracing reload handles into a named map
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
db3c718ddc add config for sentry stacktraces
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
e73aa2aa21 log propagated errors in admin service; minor cleanup
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
61f2a3c68b catch panic from admin commands
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
0627b46f40 add panic suite to Error
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
f10f5319db elaborate error log functor stack
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
16e76d45cb improve alloc stats interface; fix admin command formatting
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
2a304c2b6c add some usage stats output on the mutex maps
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +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
2d251eb19c cleanup on drop for utils::mutex_map.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
01b2928d55 add make user admin command (#136)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
50c2d2b801 add command to force join user to room (#136)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
5dcdafe207 take local join branch when remote join would fail
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
c62d653989 tweak some log levels
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
Jason Volk
454dd43d4c fix membership route ABA's
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-13 21:20:05 +00:00
AlexPewMaster
8077e910f6 Fix CONDUWUIT_CONFIG variable in docker-compose.yml files (+ remove deprecated compose version) 2024-07-13 17:16:39 -04:00
strawberry
b5d4a1c1b0 drop harmless state event not found message to debug_info
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
aa9540af21 slightly simplify send_state_event route
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
080975ab0e adjust/update complement conduwuit config.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
f129d90900 nix: delete -DWITH_SNAPPY=1 from rocksdb cmakeFlags
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
53223a4d5f remove snappy as a default feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
05befa4ba2 nix: make enableLiburing in rocksdb conditional instead of default true
for some reason enableLiburing in nixpkgs rocksdb is default
true which breaks Darwin entirely

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
a8e690f22b nix: unset patches in rocksdb
we have the patch already and i dont want to make it nix
exclusive by reverting it in my rocksdb fork

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
192c1e08da add exclude_disabled and exclude_banned room list admin cmd arguments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
0fa6976d86 add client IP and user logging on join, remove unnecessary Option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
93e7cf461d add client IP logging to media requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
d036d8adcb bump rust-rocksdb to 0.27.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
7a4bbe2ff6 nix: drop hardened_malloc feature from all-features builds
this is non-functional and i've spent far too long trying to figure
out what the issue is

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
438911c18d nix: remove unnecessary dependencies gathering from allFeatures
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
bd71435a22 ci: build static binaries and OCI imgs with --all-features
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
53fa7c3729 nix: add all-features outputs/packages
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
d2facaee0b bump various dependencies
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
0dae9280d9 nix: bump flake.lock
• Updated input 'crane':
    'github:ipetkov/crane/087e08a41009bf083d51ab35d8e30b1b7eafa7b0' (2024-07-03)
  → 'github:ipetkov/crane/0aed560c5c0a61c9385bddff471a13036203e11c' (2024-07-06)
• Updated input 'fenix':
    'github:nix-community/fenix/f6994934e25396d3a70ddb908cefccd8d3c37ac4' (2024-07-05)
  → 'github:nix-community/fenix/27cbad7cc093c5298231b87daa04db9610053651' (2024-07-06)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/cae997e3380363a906588f14c7b4587f39cf09f5' (2024-07-03)
  → 'github:rust-lang/rust-analyzer/f2afcb874e7410121c366ae601660abe327e320b' (2024-07-05)

• Updated input 'fenix':
    'github:nix-community/fenix/27cbad7cc093c5298231b87daa04db9610053651' (2024-07-06)
  → 'github:nix-community/fenix/abc0549e3560189462a7d394cc9d50af4608d103' (2024-07-08)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/f2afcb874e7410121c366ae601660abe327e320b' (2024-07-05)
  → 'github:rust-lang/rust-analyzer/a5b21ea0aa644dffd7cf958b43f11f221d53404e' (2024-07-07)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)
  → 'github:NixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1' (2024-07-08)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
35336eb686 ci: use $COMPLEMENT_SRC from nix devshell for a pinned complement rev
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
efea13a675 add access control checks for room directory publishing/removing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
b5ee15a216 dont skip_all tracing instrument on fetch_state
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
0873e18e14 remove random duplicate function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
6abc4ad798 make local_aliases_for_room db iterator Send
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
373991a8d6 cleanup and fix backfill from server getting
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
68ad351f84 nix: partially remove some liburing overrides
the argument one is weird and causing build script invalid arguments

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
83e853e7a3 add "unstable" endpoint legacy Element Android/iOS seems to call
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
1c453b1b55 require authentication on change password and deactivation routes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
60141950f7 fix wrong deactivate-all argument comment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
391bfd986e use ruma's X-Matrix to construct the sending X-Matrix header value
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
da03de1d32 bump flake.lock fully
• Updated input 'crane':
    'github:ipetkov/crane/109987da061a1bf452f435f1653c47511587d919' (2024-05-24)
  → 'github:ipetkov/crane/087e08a41009bf083d51ab35d8e30b1b7eafa7b0' (2024-07-03)
• Updated input 'fenix':
    'github:nix-community/fenix/b6fc5035b28e36a98370d0eac44f4ef3fd323df6' (2024-05-22)
  → 'github:nix-community/fenix/f6994934e25396d3a70ddb908cefccd8d3c37ac4' (2024-07-05)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/21ec8f523812b88418b2bfc64240c62b3dd967bd' (2024-05-19)
  → 'github:rust-lang/rust-analyzer/cae997e3380363a906588f14c7b4587f39cf09f5' (2024-07-03)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5710852ba686cc1fd0d3b8e22b3117d43ba374c2' (2024-05-21)
  → 'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6' (2024-07-03)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
e54f4d4397 ci: move complement diff results test output
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
daa5c34ea3 fix empty version string for NixOS users
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
strawberry
3259ea08b5 use cond compilation for config check, fix docker check w/unix sockets, use our logging instead of tracing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-10 22:00:46 -04:00
Jason Volk
158de10fe6 log erroring errors; improve inspection functors.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-09 04:09:34 +00:00
Jason Volk
4718387dbe fix wrapper macro semicolons
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-09 03:38:07 +00:00
Jason Volk
a43c78e55f add RumaError to Error; encapsulate RumaResponse in api
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-09 03:38:07 +00:00
Jason Volk
7ba0777bd3 move RumaResponse out of core Error; cleanup Error conversions.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
59d86d3641 restrict clippy::string_slice
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
51df946911 de-branch duration limit statement
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
23a9055199 relax and de-clutter let_underscore_must_use
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
100c6f572b trim unused dependencies in member crates
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
eb5556e74e additional tracing spans / log cleanup.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
8296e0ed67 slightly optimize command completer
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:10 +00:00
Jason Volk
8e3be6feb0 slightly optimize Destination::get_prefix()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
59c4062305 set trivial/leaf spans to debug level
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
113a27c1d5 use usize for max_request_size config item
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
5af880e4f4 fix reference count on punned ColumnFamily Arc
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
56a1b0e761 restrict untripped clippies
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
5722c4ae39 fix needless collect
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
dfd13780df mitigate additional cast lints
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
dcd7422c45 fix as conversions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
7397064edd fix arithmetic side-effects
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
52a561ff9e abstract expoential backoff to math utils.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
5e72d36800 add math utils; integrate checked expression macros
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
611f09829e use shorthand constraint syntax and formatting
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
a388c2e06e allow clippy::enum_glob_use
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
24b37e03a0 add pretty time util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
Jason Volk
a309ef55c9 restore signal state after channel failures
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-08 22:02:09 +00:00
AlexPewMaster
c1c084dda1 Introduce a new way of deploying conduwuit using caddy in Docker 2024-07-08 17:59:59 -04:00
strawberry
72d9e8ed2b bump conduwuit version to 0.4.5
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-07 14:32:41 -04:00
Jason Volk
a3638dbb15 use rwlock for command handler.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-07 06:24:08 +00:00
Jason Volk
5254eb4f72 add basic tab completion to console
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-07 06:24:08 +00:00
Jason Volk
b31e81a469 add common_prefix string util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-06 15:26:07 +00:00
Jason Volk
0e580292a6 encap admin handler init/fini in crate
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-06 15:26:07 +00:00
Jason Volk
38a24e0170 remove unused deps in member crates
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-06 15:26:07 +00:00
Jason Volk
8350aced39 add ctrl-\ quit support to admin console
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-06 15:26:07 +00:00
Jason Volk
04e3de08eb add log to error functors for Result::map_or_else
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-06 15:26:07 +00:00
Christoph Dittmann
2bc53139fa Don't send empty presence EDUs
I run a homeserver whose logs show a high number of incoming empty
presence EDUs originating from the user agent "Conduwuit/0.4.4". They
arrive at a rate of about 2 queries per second per Conduwuit server.

The empty EDUs all look the same, only with `origin_server_ts`
increasing:

```
{"origin":"example.com","origin_server_ts":1720266475601,"edus":[{"edu_type":"m.presence","content":{"push":[]}}]}
```

These updates are unnecessary because they don't do anything. They
only increase network traffic and CPU usage on both sides.

After this commit, the empty presence updates are no longer inserted
into the outgoing event queue.
2024-07-06 14:13:33 +02:00
strawberry
8691141237 ci: try running nix-build-and-cache prior dynamic build test
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-05 02:48:36 -04:00
Jason Volk
17a3ed4c56 add admin query resolver commands
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 22:15:54 +00:00
Jason Volk
2dd68d3fa5 add time format string util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
dc18f89c0b don't cache server name lookups indefinitely (#436)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
eaf1cf38a5 refactor resolver tuples into structs
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
eeda96d94a inline analysis and symbol reduction; emits smaller than 64 bytes marked inline
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
1e8b8cce0f even more byte utils optimizations
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
db46d6dd6b optimize millis_since_unix_epoch()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
08274150e5 cork database during global counter increment
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
e125af620e impl crate::Service for Service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
177c9e8bfa add split_once_infallible string util
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
4f5c6de853 start rand utils suite
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
25c004f08c remove dead cache
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
f104ced55d remove unnecessary wrapper
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
Jason Volk
0cea64309a move PduEvent from services to core
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-04 21:06:35 +00:00
strawberry
229f2fde7a skip 2 more flakey complement tests still
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-04 11:17:13 -04:00
strawberry
9a0ffd55da skip complement test TestClientSpacesSummary still
too flakey still

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-04 01:55:22 -04:00
renovate[bot]
d1b3faf4bd Update Rust crate sd-notify to v0.4.2 2024-07-03 23:02:44 -04:00
strawberry
4014cb4413 document emergency_password
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 23:02:44 -04:00
strawberry
b2dbc3bc10 update complement results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 23:02:38 -04:00
strawberry
e2033fb6c1 notify users to update their build scripts if using rocksdb or sha256_media
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:47 -04:00
strawberry
6b433392a4 slight docs updates
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:47 -04:00
strawberry
0832c28a40 dedupe some state accessors in various places
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:47 -04:00
strawberry
b0eec60724 add MSC3266 room summary API support
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:47 -04:00
strawberry
82acc7c0b0 ci: add back ubuntu free disk space
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:47 -04:00
strawberry
c9384e9c78 allow all complement tests again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 22:12:45 -04:00
strawberry
3502e6ef87 bump conduwuit to 0.4.4
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 11:30:16 -04:00
strawberry
deca2c52c6 switch to ruma's X-Matrix parser
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 11:30:16 -04:00
strawberry
daa46a0dc4 auto-fix some markdown lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 11:30:16 -04:00
strawberry
74791642c1 add markdownlint and run lychee in documentation CI workflow
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 11:30:16 -04:00
strawberry
1a64e42cfe add /openid/request_token and /openid/userinfo routes
heavily changed and improved by me

Co-authored-by: mikoto <avdb@keemail.me>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-03 11:30:11 -04:00
Jason Volk
5edd391e83 support admin server restart --force
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
7658387a74 remove resolver wrapper; use std mutex
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
be2d1c722b encap dep:chrono in time utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
8cf55c702f split time utils into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
3b9fba233c split bytes utils into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
af81baae44 split string utils into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
52d470058a split hash utils into directory
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
df0328f43f split send txn handler
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
473b29d524 move remaining runtime caches into their respective service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
e1d1dac95e add missing media compat example config
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
a2d25215a3 consolidate key/value types; consistent interface arguments
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
46423cab4f fix counter increment race
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
2e2cf08bb2 optimize increment / increment batch
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
ee64fb149c optimize get w/ zero-copy ref handle
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
0522fe7d92 reimplement iterator from lowlevel
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
6dd6e4bfaf simplify cork interface related
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
a1ced0a56f fix admin query timers not covering full iteration
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jacob Taylor
0171262581 make pduid_pdu/eventid_outlierpdu scale with conduit_cache_capacity_modifier via cache_size(), and fix lint 2024-07-03 06:34:16 +00:00
Jason Volk
972037dcd9 optimize column family handles
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
Jason Volk
0613140130 optimize bytes conversion utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-03 06:34:16 +00:00
morguldir
f43c09b05d
ci: pin cache-nix-action
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-07-03 06:13:39 +02:00
morguldir
b035cd7cbe
ci: remove detsys from documentation/build workflow too
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-07-03 04:51:59 +02:00
morguldir
b7aa79884d
ci: try out cargo caching 2024-07-03 03:39:49 +02:00
morguldir
9c6cc44abb
ci: use correct config file
also had to try putting it at the end again
2024-07-03 01:56:14 +02:00
morguldir
9c0d7b1da0
ci: change to cache-nix-action 2024-07-03 01:08:30 +02:00
strawberry
ed3a464722 remove uselsss partial_cmp with cmp
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 21:21:37 -04:00
strawberry
28ac3790c2 sync upstream spaces/hierarchy federation MR
also had to fix a million clippy lints

fix(spaces): deal with hierarchy recursion
fix(spaces): properly handle max_depth
refactor(spaces): token scheme to prevent clients from modifying max_depth and suggested_only
perf(spaces): use tokens to skip to room to start populating results at
feat(spaces): request hierarchy from servers in via field of child event

Co-authored-by: Matthias Ahouansou <matthias@ahouansou.cz>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 21:20:28 -04:00
strawberry
9115901c66 update complement results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 21:20:24 -04:00
strawberry
652faafe6e bump ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 16:46:19 -04:00
strawberry
8deba94a12 update various deps, update rocksdb to v9.3.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 16:46:13 -04:00
strawberry
bb27f21ac1 simplify getting join_authorized_via_users_server for make/send_join, remove unnecessary async
Co-authored-by: Matthias Ahouansou <matthias@ahouansou.cz>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 15:32:40 -04:00
strawberry
339a1fc4e8 only sign /send_join events if restricted join via room version and join_authorised_via_users_server
Co-authored-by: Matthias Ahouansou <matthias@ahouansou.cz>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 15:01:11 -04:00
strawberry
75731671d1 use RoomMemberEventContent for send_join/send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-02 14:46:53 -04:00
Jason Volk
20aab1792b fix version format regression 3a51e18ce6
Signed-off-by: Jason Volk <jason@zemos.net>
2024-07-01 23:35:04 +00:00
Kimiblock Moe
e9f4cd58a9 Bind Mount the old matrix-conduit directory 2024-07-01 17:19:50 -04:00
renovate[bot]
6bae136720 Update Rust crate clap to v4.5.8 2024-07-01 00:18:18 -04:00
renovate[bot]
39a1e994eb chore(deps): update rust crate log to v0.4.22 2024-07-01 00:18:09 -04:00
renovate[bot]
c2c36197e9 chore(deps): update nixos/nix docker tag to v2.23.1 2024-07-01 00:17:53 -04:00
Paul Robertson
c952db72e7 remove unused CONDUWUIT_CONFIG_FILE variable 2024-07-01 00:16:32 -04:00
Paul Robertson
1ca484f90d explain how to configure conduwuit 2024-07-01 00:16:23 -04:00
Paul Robertson
b1150cded9 rename configuruation.md to configuration/examples.md 2024-07-01 00:16:23 -04:00
strawberry
2b35f83089 ci: exclude renovate[bot]
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-01 00:14:16 -04:00
strawberry
792d4aa6ce fix nightly clippy lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-01 00:14:16 -04:00
strawberry
6c461025e5 use proper redacts field
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-07-01 00:14:16 -04:00
Jason Volk
9d1db7d171 rename fsck to check
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
2387f7f955 move tester command under debug
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
5805394ca5 add tester timer stub
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
3301cde8e7 add timer around admin command processing
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
b28d216e00 improve debug get-room-state; use RoomOrAliasId
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
f127987c7a add convenience alias resolver to interface
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
fa02d7b7e3 diffuse get_alias_helper into services::rooms::alias
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
96a16190c5 mute dev_release_log_level from --all-features for now
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
d9054f5364 add backreference to layer in capture data struct
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
db288b169e add config option for tokio_console runtime enablement
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
bc50034173 idiomize various expressions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
20fe84379c rename log::Server to log::Log
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
06f01d384f simplify argon init
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
bd19fac4c5 split tracing init into unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
703c275266 split sentry init; add user-agent, trace hooks.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
c05f00661b use extern namespace in log wrapper macros
convert use tracing statements

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
0e46b750a0 default to jemalloc when both hardened_malloc and jemalloc enabled.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
3a51e18ce6 pre-format version strings
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
7638bbc49c keep column list lexically sorted
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
35049c94de simplify db ThreadMode typedef
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
7db8478dc0 hoist iterator modes; group fns
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
df7a1dee15 remove --features=rocksdb from smoketest; use separate target dir
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
dc633100da hoist read_options/write_options instances
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
0f1432f448 improve appservice::Data interface encap
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
30b5ad3870 de-feature rocksdb 2024-06-30 18:02:16 +00:00
Jason Volk
cb48e25783 refactor dyn KvTree out of services
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
57acc4f655 fix needless pass by value
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
875d9e8b07 fix complex types
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:16 +00:00
Jason Volk
de21f7442a devirtualize database
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:02:14 +00:00
Jason Volk
7ad7badd60 devirtualize service Data traits
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
a6edaad6fc error enum cleanup
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
fbcdb3860a eliminate dep:rust-rocksdb et al from admin crate
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
01f4455ceb convert rocksdb errors locally; remove from Error.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
c1712d4d8b optimize increment
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
3480074f61 sha256_media integration
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Jason Volk
efbdced535 cleanup migration function a bit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-30 18:01:20 +00:00
Paul Robertson
19d8f0b27e
dont use any for a single feature check 2024-06-30 10:40:54 -04:00
Paul Robertson
8d5305c769
lock cleanup 2024-06-30 10:40:35 -04:00
Paul Robertson
73b85372d6
drop parking_lot feature 2024-06-29 11:20:48 -04:00
Paul Robertson
5e6b9ec1cf
drop thread_local feature 2024-06-29 11:20:48 -04:00
Paul Robertson
e24b7d2f3e
drop sqlite from docs 2024-06-29 11:20:48 -04:00
Paul Robertson
c61258fa0d
drop rusqlite dependency 2024-06-29 11:20:48 -04:00
Paul Robertson
65177d237a
drop the sqlite feature from core 2024-06-29 11:20:48 -04:00
Paul Robertson
325f1c0bd2
drop the sqlite feature from database 2024-06-29 11:20:45 -04:00
Paul Robertson
68f1b4789a
drop the sqlite feature from main 2024-06-29 11:05:33 -04:00
Paul Robertson
624cd2acfa
remove sqlite code 2024-06-29 11:05:33 -04:00
morguldir
fb758f5f4b chore(deps): bump Cargo.lock (subtle crate was yanked) 2024-06-27 17:41:13 -04:00
morguldir
5d138a7e5e ci: skip development.md file when running lychee 2024-06-27 17:41:13 -04:00
morguldir
563618cc9e ci: free disk space before starting tests 2024-06-27 17:41:13 -04:00
morguldir
0a28d80cf2 ci: try another upstream cache
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-06-27 17:41:13 -04:00
Integral
6f9d7b5667 docs: fix broken link to development.md 2024-06-23 12:20:53 -04:00
Jason Volk
d875e0c1c0 fix handling of empty admin command lines
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-23 09:52:16 -04:00
renovate[bot]
7a71012589 chore(deps): update aquasecurity/trivy-action action to v0.23.0 2024-06-22 18:37:54 -04:00
strawberry
189688994b ci: properly exclude renovate from docker publishing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-22 18:35:30 -04:00
strawberry
bc093e9544 bump conduwuit version to 0.4.3
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-22 17:56:34 -04:00
Jason Volk
2dae3052e2 remove unnecessary html render
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-22 21:22:56 +00:00
Jason Volk
0f07b86159 bump Cargo.lock 2024-06-22 21:22:56 +00:00
Jason Volk
2f84bc895d Improve additional command outputs containing codeblocks.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-22 21:22:56 +00:00
Jason Volk
3b34e72456 improve output scheme for admin query commands
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-22 21:22:56 +00:00
Jason Volk
7eee88160a truncate other span names and fields
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-22 21:22:56 +00:00
strawberry
5f46623371 redaction fixes 2024-06-22 21:22:56 +00:00
Jason Volk
cbb97b4fdf bump termimad
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-18 10:56:19 +00:00
Jason Volk
14dcc8db15 truncate MatchedPath for span field
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-18 10:56:19 +00:00
Jason Volk
213a6d441f shorten several request span names.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-18 10:56:19 +00:00
Jason Volk
98d96b89a5 minor reductions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-18 10:56:19 +00:00
Jason Volk
1c0ed91f6f rename ruma_wrapper to router
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 05:04:00 +00:00
Jason Volk
64705fa27d rename router to routes
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 05:04:00 +00:00
Jason Volk
8affdc43a6 additional termimad config
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
1ccdba8921 use markdown for list-database-files command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
50ce87161b refactor admin command visibilities and use statements
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
c6f4b20e17 add server restart support w/ admin command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
2cb31275f0 fix missing command response; use non-empty command responses
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
5aee03d14a switch to crate rustyline_async
improve console signal and interrupt stack

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
Jason Volk
959fd2e6c4 split main signal handler to unit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-17 02:10:27 +00:00
strawberry
f40a3ea4a6 docs: more improvements, fixes, cleanup, etc
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 21:30:51 -04:00
strawberry
aa963c61da docs: add slight theme changes, better title
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 20:58:17 -04:00
strawberry
c98cf13010 ci: typo, store path is /conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 19:17:29 -04:00
strawberry
73dd4b1f8f ci: enable accept-flake-config, use the same args everywhere
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 18:54:03 -04:00
strawberry
c921deaee2 docs: update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 15:35:08 -04:00
strawberry
a5de4d30bb ci: add forgejo/gitea actions file
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 15:35:08 -04:00
strawberry
9e9b256b83 temp: comment out hardened_malloc code
sorry but this is just non-functional in our build system,
i haven't had time to figure out why nix doesn't like what
i'm doing with it, and i haven't heard anyone using this

(the user who i anticipated would use this has not updated
their conduwuit in many months)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 15:20:57 -04:00
strawberry
ddf327e8b6 bump termimad
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
3341a8e56e ci: allow drafts to run artifact builds again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
4942d684ea bump gitlab nix ci to 2.23.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
f8f6dba674 docs: add conduwuit-bin to arch-linux.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
e5c9bf1992 misc build changes to mdbook, add favicon/logo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
502856a4a2 use pinned revs of git cargo deps where possible
should reduce all but rocksdb from here: 0a48586e8c/pkgs/conduwuit-git/pins.json

Co-authored-by: PedroHLC <root@pedrohlc.com>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
PedroHLC
2be2a0dc91 fix: add tracing-log patch, use pinned tracing revs
original patch from 637ff3ce0c (diff-73188cdc15fe4e672c637dfc8a06ca08c30f789aa31dc8e1a5297f76779bc369)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
cd3e7394bf nix: support pushing to conduwuit.cachix.org
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
a543bec1a5 ci: add conduwuit cachix nix binary cache
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
a589a34d15 ci: unify/simplify documentation and ci nix steps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
4312ac91c1 ci: set NIX_CONFIG for documentation workflow too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
e83b426caf ci: set SOURCE_DATE_EPOCH for at least debian pkgs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
cad1d34611 ci: disable detsys telemetry, use our binary cache URL as upstream
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
ce4517269b ci: output complement diff results to summary again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
169617ab87 ci: remove erroneous DIRENV_DEVSHELL
engage already sets `DIRENV_DEVSHELL` as necessary

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
strawberry
3596fe0e18 ci: dont let renovate publish docker images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-16 13:16:51 -04:00
Jason Volk
a22524496d console command interruption
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 08:02:14 +00:00
Jason Volk
1d1b1644e9 add admin debug echo command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 08:02:14 +00:00
Jason Volk
483f0a9c86 add admin command for admin room notices
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 08:02:14 +00:00
Jason Volk
3d3d63fdf4 admin commands for shutdown/reload
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +00:00
Jason Volk
08f2b8579c abstract shutdown/reload functionality.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +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
83565007bb fix lint group priority
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +00:00
Jason Volk
3872ae80f7 fix PanicInfo deprecation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +00:00
Jason Volk
0923b6f428 fix use std::mem related lint
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 07:24:51 +00:00
Jason Volk
48d9677959 rustfmt nightly/stable compats
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 03:07:59 +00:00
Jason Volk
02bd67dc4b admin command path simplifications; fix message to room
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 03:07:59 +00:00
Jason Volk
3813628acd log full custom edu rather than just content
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-16 03:07:59 +00:00
Kimiblock Moe
7b7593a6f5 Change the env name 2024-06-15 23:06:38 -04:00
Kimiblock Moe
1323506c88 Fix naming issues, directories will be moved in the post_upgrade function 2024-06-15 23:06:38 -04:00
Kimiblock Moe
332fc74fb8 Add systemd service for Arch 2024-06-15 23:06:38 -04:00
strawberry
03c04ce0a1 dont allow "remote admins" to run public escaped cmds on behalf of others
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-14 23:46:07 -04: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
539aa27815 reduce roomid_mutex_federation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-14 22:09:55 +00:00
Jason Volk
22272bdc16 reduce roomid_mutex_insert
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-14 22:09:55 +00:00
Jason Volk
8b68d6306c add MutexMap to utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-14 22:09:55 +00:00
Jason Volk
d4775f0763 add server-side command escape w/ public echo for admins
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-14 06:40:47 +00:00
Jason Volk
571ab6ac2b admin terminal console
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-13 03:33:24 +00:00
Jason Volk
5df7443437 add log suppression tool
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-13 02:16:46 +00:00
Jason Volk
e76e604771 add MxidError to our Error
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 21:06:09 +00:00
Jason Volk
1f9225e4d1 add markdown log format for capture
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 21:06:09 +00:00
Jason Volk
c914a4fd91 capture logs for resolve-true-destination admin cmd
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:52:39 +00:00
Jason Volk
aa34021b27 tracing capture interface
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
Jason Volk
1bb4021b90 add format util to log suite
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
Jason Volk
877c04de52 add color utils to log suite
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
Jason Volk
029e1c630a split core log into directory
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
Jason Volk
39110ebc3c add fmt::Error as core Error source
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
Jason Volk
2ab3231ea6 add tracing_subscriber::filter::ParseError to amalgam
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-12 18:25:27 +00:00
strawberry
d0069cc100 log out any sessions when the server emergency password is unset
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Matthias Ahouansou
556e78214a fix: only allow the server user to set the admin alias
Should make it safer to move the alias if the admin room broke on a public server.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
strawberry
8fff7ea706 cleanup+refactor admin room alias and server account accessing to globals
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Matthias Ahouansou
f712c0cefb fix: restrict who can remove aliases
Previously, anyone could remove any local alias, meaning that someone could re-route a popular alias elsewhere
Now, only the creator of the alias, users who can set canonical aliases for the room, server admins and the server user can delete aliases

added some additional changes/fixes to adapt to our codebase

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Matthias Ahouansou
26d103d314 fix: only process admin commands if server user is in the room
Should prevent some edge cases with a misconfigured admin room

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Benjamin Lee
0688a96c37 drop redacted events from search results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Benjamin Lee
eb73d8c669 fix: de-index pdus when redacted
bit of code dedupe as well

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Benjamin Lee
20a54aacd6 factor search tokenization out into a function
This ensures that the tokenization algorithm will remain in sync between
querying, indexing, and deindexing. The existing code had slightly
different behavior for querying, because it did not discard words with
>50 bytes. This was inconsequential, because >50 byte tokens are never
present in the index.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Benjamin Lee
81cd677b4e fix dropped events in search
The previous code would drop some events entirely if any events between
`skip` and `skip + limit` were not visible to the user. This would cause
the set of events skipped by the `skip(skip)` method to extend past
`skip` in the raw result set, because `skip(skip)` was being called
*after* filtering out invisible events.

This bug will become much more severe with a full filtering
implementation, because it will be more likely for events to be filtered
out. Currently, it is only possible to trigger with rooms that have
history visibility set to "invited" or "joined".

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
Benjamin Lee
73da353e52 fix missing next_batch for search
The previous code would fail to return next_batch if any of the events
in the window were not visible to the user. It would also return an
unnecessary next_batch when no more results are available if the total
number of results is exactly `skip + limit`.

This bug will become much more severe with a full filtering
implementation, because we will be more likely to trigger it by
filtering out events in a search call. Currently, it is only possible to
trigger with rooms that have history visibility set to "invited" or
"joined".

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-12 14:04:47 -04:00
strawberry
d5677b6ae7 bump cargo.lock due to yanked httparse
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 20:18:28 -04:00
strawberry
01a77f8a71 add replaces_state and prev_sender in unsigned for membership changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 13:03:32 -04:00
strawberry
ea03a50e21 remove pfps/avatars and display names upon deactivation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 01:19:18 -04:00
strawberry
25d44cad31 slightly dedupe pfp/displayname updates, update blurhash in PDUs too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 01:19:18 -04:00
strawberry
91519959ed mark account as deactivated before leaving rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 01:19:18 -04:00
strawberry
2e31bcc213 use our fork of axum-server instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-11 01:19:18 -04:00
strawberry
305dfc3b42 adminroom: cmds to view room topic and room members
this will be extended more

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 23:38:03 -04:00
strawberry
65fbb80145 adminroom: leave all rooms by default on manual deactivations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 21:14:18 -04:00
strawberry
f1d90e5df6 log client/remote IP address on various routes tracing calls
this uses InsecureClientIp as this is purely for informational
and logging purposes

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 21:04:51 -04:00
strawberry
74b29ce067 adminroom: improved room list outputs, add counts
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
0e7c3cb338 adminroom: simplify codeblock checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
14a3471fcb adminroom: fix function typo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
c834e86e67 adminroom: user cmds to put/get/delete room account data
primarily useful for inserting `m.server_notice` user account data
onto the admin room

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
b4f0a8a8b5 adminroom: clean up and optimise user commands
`deactivate-all` was terrible and incredibly inefficient

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
9bb90213e1 adminroom: add user ID parsing utils
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
fcdf1463ef refactor get_room_topic into 1 single function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
88d038ffec refactor getting room's canonical alias into 1 function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
4b4c0952a2 refactor guest_can_join into 1 single function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
016270b33b adminroom: add server_in_room state cache accessor
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
d2063013b4 adminroom: add various state_cache db accessors
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
03ba9bde29 admin cmd to force download and use a server's room state
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
1287a86c05 client-api: export validate_and_add_event_id
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 19:45:04 -04:00
strawberry
8210e8c42e slightly adjust sliding sync code for ruma bump
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 17:20:59 -04:00
strawberry
adf0bfd894 bump ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 16:57:44 -04:00
strawberry
6b843ec4dd switch to patch/fork of axum-server to fix shutdown hangs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 16:55:40 -04:00
strawberry
ac02078395 bump cargo.lock, add tracing feature to axum-extra
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 16:55:40 -04:00
renovate[bot]
b9d38fd3ba chore(deps): update rust crate http-body-util to v0.1.2 2024-06-10 16:55:40 -04:00
renovate[bot]
1b2c8236fb chore(deps): update rust crate clap to v4.5.7 2024-06-10 16:55:40 -04:00
renovate[bot]
d7b8af627c chore(deps): update rust crate console-subscriber to 0.3 2024-06-10 16:55:40 -04:00
renovate[bot]
130aae8758 chore(deps): update rust crate url to v2.5.1 2024-06-10 16:55:40 -04:00
renovate[bot]
4741a76896 chore(deps): update rust crate regex to v1.10.5 2024-06-10 16:55:40 -04:00
strawberry
5bfb62e979 Revert "update complement results"
This reverts commit 9a3c52aa75.
2024-06-10 15:38:20 -04:00
strawberry
cb03654dc1 fix broken federated room invites/joins
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-10 14:53:26 -04:00
Jason Volk
f0557e3303 split migrations function
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:56:41 +00:00
Jason Volk
f52acd9cdf Fix idiomatic let if
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
eae41fc411 Fix use-self
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
c3c91e9d80 Fix suboptimal flops
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
a8de5d1e60 Fix futures not Send
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
7688d67870 Fix needless pass by ref mut
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
89d7d48324 Fix equatable if let
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
b525031a25 Fix derive partial eq without eq
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
67f4285504 Fix branches sharing code
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
b65f05ce19 simplify lifetime parameters
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
db2c9f28b6 split admin room moderation commands
prior stack frame allocated 170 KiB

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
fc1b8326e6 split join_room_by_id_helper into local and remote
prior stack frame allocated 180 KiB

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
Jason Volk
6e50b07bf5 Fix large future
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-09 20:06:50 +00:00
strawberry
9a3c52aa75 update complement results
they seem to be failures out of
our control (?)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-09 12:05:30 -04:00
strawberry
ccf9f95cc9 retroactively fix bad data in roomuserid_joined, remove pointless prefix scans
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-09 03:55:04 -04:00
strawberry
0524e6ed52 remove unnecessary active_local_joined_users_in_room state_cache accessor
the underlying bug has been fixed

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-08 17:32:04 -04:00
strawberry
7f5b59afbb add conduwuit-specific db migration fixing double split db entries
for a few months now we accidentally had double 0xFF splits being
inserted into `roomuserid_joined` cf when membership counts and such
are being updated.

this is a conduwuit-specific db migration and does NOT break conduit
compatibility.

`fix_bad_double_separator_in_state_cache`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-08 16:58:24 -04:00
strawberry
ab5db37851 fix bad double split insert on roomuserid_joined cf
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-08 16:57:48 -04:00
strawberry
c0c7f23a05 services(timeline): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
14ec41c211 services(state_cache): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
2230bc7339 services(state): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
0ebabba971 services(pdu_metadata): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
3ed561cb31 service(globals): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
a061644b2d service(event_handler): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
82ac6b01b2 service(auth_chain): use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
97ddb2ce87 bump conduwuit to version 0.4.2
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
a04ff7d4af fix(fed): dont reject /state_ids/ on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
10dfbf6420 fix(fed): dont reject /state/ on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
d10bc67c9d fix(fed): dont reject /event_auth/ on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
197a02bf8d fix(fed): dont reject /event/ on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
8103bd7310 fix(fed): dont reject /backfill/ on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
81487e3f07 fix(fed): dont reject /get_missing_events on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
bfbb29dded add is_world_readable state_accessor func, use self instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:10:00 -04:00
strawberry
1cc7cf54a7 add config option to allow guests to access TURN server
`turn_allow_guests`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:09:59 -04:00
strawberry
40e4019f7f add missing TURN example config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-07 15:09:59 -04:00
Lux Aliaga
176d95c2a8 admin: media: Force flag on past media removal
When enabled, if a file is deemed unremovable, it skips past it and
continues deleting all other files that fit the criteria. Additionally,
fix age comparison under the same command.

Signed-off-by: Lux Aliaga <lux@nixgoat.me>
2024-06-07 15:08:08 -04:00
renovate[bot]
8d32fb1445 chore(deps): update sentry-rust monorepo to 0.34.0 2024-06-07 00:52:25 -04:00
renovate[bot]
82a3b73774 chore(deps): update rust crate clap to v4.5.6 2024-06-07 00:52:13 -04:00
renovate[bot]
1f19356693 chore(deps): update aquasecurity/trivy-action action to v0.22.0 2024-06-07 00:52:05 -04:00
Jason Volk
3ada847570 extract client ip from connection state
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
0bade5317f add connection info to router
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
c2267d4c03 add services state to router
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
aebae11c82 reintroduce the variadic macro for ruma handler.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
f871d8fd4e move impl FromRequest for Ruma up one level; some cleanup
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
4a68e28c71 use debug_warn for presence spam
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
6e59135a7d eliminate RotationHandler
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
0e74ade7d7 isolate axum shutdown in router; minor run-cycle/signalling tweaks
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-07 02:00:28 +00:00
Jason Volk
e4aa20ebeb move services ctor/dtor detail into service
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
427aa4645c cleanup/reduce some tracing spans.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
73718a1208 elminate generic argument in ruma_wrapper::auth
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
0e3d192ad2 fix trivial-casts
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
76a4d8aa4c additional clippy configuration
these are documentary values seeking review, not final standards set for the project.

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
9bb52cb3ec add missing dev_release_log_level feature projection
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
dd49b3c3a1 fix/simplify emergency access initialization
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +00:00
Jason Volk
b2e56777af fix missing toolchain in cargo smoketest run invocation.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 18:21:40 +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
strawberry
8428f43c78 add legacy element hack for UIAA using invalid user field
see:
- e9302a9556
- https://github.com/element-hq/element-android/issues/8043
- https://github.com/element-hq/element-ios/issues/7405

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-06 10:57:00 -04:00
Jason Volk
3af153f5ae split s2s into units
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-06 04:41:27 -04:00
strawberry
38238c309f appservices: remove unnecessary services() call for self
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 18:18:08 -04:00
strawberry
0857fe7907 abstract+add more "users in room" accessors, check membership state on active_local_joined_users_in_room
`roomuserid_joined` cf seems unreliable, so in the mean time we need to check
membership state (or maybe this is a more reliable check anyways)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 18:18:08 -04:00
strawberry
c738c119f8 delete unnecessary real_users_cache, fix overwriting push_target iter, add proper function for getting local active users in room
this `real_users_cache` cache seems weird, and i have no idea what
prompted its creation upstream. perhaps they did this because
sqlite was very slow and their rocksdb setup is very poor, so
a "solution" was to stick member counts in memory.
slow iterators, scanning, etc do not apply to conduwuit where
our rocksdb is extremely tuned, and i seriously doubt something
like this would have any real world net-positive performance impact.

also for some reason, there is suspicious logic where we
overwrite the entire push target collection.

both of these things could be a potential cause for receiving
notifications in rooms we've left.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 18:18:08 -04:00
strawberry
c1227340b3 update complement results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 18:17:46 -04:00
strawberry
bf10ff65a4 media: ignore Content-Type params, use binary_search
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 17:28:51 -04:00
strawberry
b781771a9b media: drop Content-Type detection support
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 16:33:53 -04:00
strawberry
df8ba04e31 media: trust client Content-Type again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 16:33:53 -04:00
strawberry
19926ba00d sort ALLOWED_INLINE_CONTENT_TYPES
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 16:33:53 -04:00
strawberry
893cc50570 csp: set form-action 'none'
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 16:33:53 -04:00
strawberry
c9fbbdce1c csp: remove unusual directives, slight security improvement
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-05 02:50:44 -04:00
Jason Volk
732e8b82aa Abstract password hashing into util.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-05 03:00:23 +00:00
Tom Black
282c2feca8 Clarify purpose and temporary muting 2024-06-04 17:13:21 +01:00
strawberry
919735b4ce remove usages of &String and &Owned[..]
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 14:17:42 -04:00
strawberry
2e83e56a07 remove deleted config options and update address example option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 14:17:42 -04:00
strawberry
ff7dfec74c slightly cleanup update check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 14:17:42 -04:00
strawberry
84290bd668 update deps, remove unnecessary zstd crate, pin rust-rocksdb rev
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 14:17:32 -04:00
strawberry
b29a8791de admincmd: leave all rooms if deactivating all users with --force
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
83220b43a2 use saturating_add and vec with_capacity in even more places
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
4ea7af5780 ci(engage): use all-features devshell for cargo doc / rustdoc --all-features
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
79fb8091dc ci(engage): use all-features direnv devshell for clippy/all
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
f6fa2a4f65 use swap_remove instead of remove in a few places
`swap_remove` is faster if we don't care about the order (O(1))

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
b63937af0b ci(engage): add cargo test default, use all-features devshell for cargo test --all-features
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
3c4e325036 nix(bin): cache default devshell on top of all-features devshell
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
023fb41c49 load .env file before initializing flake to use DIRENV_DEVSHELL in .env
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
9a5f1dac57 drop unnecessarily verbose get_alias_helper logging
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
173ff26eb6 disable URL previews by default upon admin room creation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:28 -04:00
strawberry
45e3fdba69 admin room: add get-latest-pdu and get-first-pdu commands
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-03 00:10:24 -04:00
strawberry
9f359e0550 make resolve_state public to resolve new forced compressed room state
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
ffdf47d1ea add latest_pdu_in_room timeline function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
1af65e695d media: return application/octet-stream if no content-type was provided
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
b1886583d9 csp: fix typo, add base-uri none
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
f11103b43b media: check detected content-type against MSC2702
only return `inline` if the detected content-type is an allowed
inline content-type as defined by MSC2702

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
9b096cc67b fix: check if you've left the room before forgetting it
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
1ac72ab914 init a few state hashmaps using with_capacity
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
f0533e07ef fed: remove unnecessary mutables, use with_capacity in couple more places
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
68f42f5a2f fed: relax read receipt EDU check
so in theory: guest users, peaking over federation,
and world readable rooms should be allowed to send
read receipts even if they're not joined.

relaxing this check to only allow the read receipt if
the server has at least 1 member in the room makes
some of this still work

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
884cbab135 ci: comment out hardened_malloc clippy check for now
i need to either fix static linking, or just make it
dynamic always (but then kinda useless idk)

https://gitlab.com/conduwuit/conduwuit/-/jobs/6953419673#L3155

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
4aead5de7a reflax a couple restrictions on custom room IDs and aliases
🙃

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
strawberry
aef25ea1f7 enable tracing feature for axum
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 23:53:31 -04:00
Jason Volk
1a4736d40b support configuring multiple bind hosts; default to dual localhost.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-03 01:17:58 +00:00
strawberry
f09e0dc137 add conduwuit community code of conduct
this is a code of conduct that the moderation team made up,
specific to conduwuit's community spaces such as the matrix rooms.

the matrix foundation and contributor's covenant still apply, but
having conduwuit-specific additional guidelines help

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 21:02:38 -04:00
strawberry
de79b66cea misc docs changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-06-02 21:02:38 -04:00
strawberry
95ca9d00a2 nix: get all features from main crate 2024-06-02 23:01:12 +00:00
Jason Volk
887496d040 consolidate default cargo features
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 23:01:12 +00:00
Jason Volk
c2586737ae accept receipts prior to events
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 23:01:12 +00:00
Jason Volk
7d2f510cc3 single-source for defaulty log filter string
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 23:01:12 +00:00
Jason Volk
102bd1b4a6 use debug_warn for parse_incoming_pdu err results.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 23:01:12 +00:00
Jason Volk
89ab687f16 move signal handling out to main
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 23:01:12 +00:00
Jason Volk
1108235c63 misc simplifications and cleanup
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
90d9a997a5 split / cleanup core utils.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
5fe5ab279c split RouterExt impl related into ruma_wrapper unit.
slightly restrict client_server mod index.

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
f1d1366129 split resolve_actual_dest
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
ba48758b89 impl fmt::Display for FedDest
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
9df5265c00 split sending resolver into unit.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 20:17:45 +00:00
Jason Volk
ee52d2f751 refactor lints into categories. lints are now more strict.
rust:
* ALL lints which rustc defaults to "allow" have been set to "warn".
* NEW "warn" lints which produce a warning as of this commit have been
explicitly identified and commented with a TODO for later review.

clippy:
* ALL categories (sans restriction) now fully enabled to "warn".
* redundant lints set to "warn" from categories now at "warn" are removed.
* previous "allow" sadness moved into respective categories.
* new warnings produced as of this commit have been explicitly identified:
	- nursery lints set to "allow" marked with TODO for later review.
	- pedantic lints set to "allow"

Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
53fe2362fc Fix path-buf-push-overwrite
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
38ab1083e3 Fix ptr-cast-constness
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
050841a871 Fix inefficient-to-string
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
4521e93d04 Fix stable-sort-primitive
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
0f3d43153b Fix unused-self
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
e5eccb3a0c Fix unreadable-literal
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
68cbf19154 Fix items-after-statements
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
2ab427fe99 Fix default-trait-access 2024-06-02 12:34:05 -04:00
Jason Volk
02081b66c4 Fix some unnecessary-unwraps w/ addl cleanup/simplification.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
b3fc8516ed Fix unnested-or-patterns
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
9e51525c25 Fix uninlined-format-args
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
14039d9df4 cleanup unused extern crates.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
eed8a2a801 add and sort incomplete package metadata
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 12:34:05 -04:00
Jason Volk
c3a0d28309 add tracing span; mute connection errors.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jason Volk
6d1144bb69 move unix socket unlink from services to router
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jason Volk
2e45cb281a split router::serve units.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jason Volk
0baa57f5d9 add back unix socket listener.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jason Volk
faa2b95c84 add unwrap_infallible tool
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jason Volk
dd1d8fa760 upgrade to hyper-util 0.1.5
Signed-off-by: Jason Volk <jason@zemos.net>
2024-06-02 01:20:28 -04:00
Jayryn
f4cfc77a57 Check if database symlink already exists
test -L $object [object exists and is a symbolic link (same as -h)]

It is not recommended to use -h 
[True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this program. Do not rely on its existence; use -L instead.]
2024-05-28 04:06:53 -04:00
Jason Volk
b8b93a2e86 Bump 0.4.1
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
29d69b7688 update complement test results
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
strawberry
bd07fb61e0 add hot_reload.md to SUMMARY.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
a41a60ef07 media: dont ignore requested filename on /download for Content-Disposition
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
Jason Volk
ec7a9ab726 add toolchain and build/check shortcut to smoketest
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
25f598ce6c enable http2 feature for reqwest.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
dbcb3be0ab fix duplicate output; increase wait in smoketest.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
a537462d51 replace num_cpus dependency with available_parallelism()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
d2aef071bc add possibly referenced rocksdb symbol to export list.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
d68b11e8ff fix rustflags for release-max-perf
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
9cf5b0926e fix regressed jemalloc stats feature
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
ff0b57c89c remove unused jemalloc dep in main module.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
b94045a468 dissolve key_value/*
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
3122648767 split ruma_wrapper from_request() related.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
3f5349ad76 simplify RumaHandler for Router building.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
27dcf213f1 tweak error strings.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
a1b526b3b7 tweak log levels
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
dc614e11d6 check invite target is our server.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
c5569b4c6e dedup acl checks
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
Jason Volk
71a1285c7b hoist receipt ACL check
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-27 18:16:23 -04:00
strawberry
abdda6cf32 check invited user's server against ACLs on /invite
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
4d21f9d962 use ok_or_else instead of ok_or for function calls in server_server.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
1013fe5a42 check for membership join state at /send_join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
f31b7b9420 ignore inbound EDUs for users that dont belong to origin server
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
e5e358cc68 compare X-Matrix origin + body origin and check PDU/EDU length at /send txn
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
50bc7cc005 check state_key matches sender user at /send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
445015e9ea check user ID server against ACLs at /send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
7a38c12e5d check for member event type at /send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
2a77951152 check for membership leave state at /send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
0256c27363 check if we know about room at /make_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
826edc0a3a check state_key matches sender user at /send_join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
a5043a38e1 only allow membership event types at /send_join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
bfd471a863 check user ID server against ACLs for /send_join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
3981e77ec6 check user ID server against ACLs for /make_join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
81bf4b7150 check user ID server against ACLs for /make_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
b8ec763a7c ignore read receipts from ACL'd servers and users not joined
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
003d4edbfa debug log receiving typing EDUs for users not in room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
4f0006d18a ignore typing EDUs from ACL'd user's servers
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
b822e3a94c listen on IPv6 localhost by default
this is dual-stack by default on linux, resolves
issues with nginx using `localhost` and randomly
choosing between 127.0.0.1 and [::1], causing
intermittent upstream issues

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
68fffe8e96 check room ACLs on sender user's server for incoming PDUs
`handle_incoming_pdu`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
strawberry
7328ed7509 rename misleading sender_servername to origin
this is the X-Matrix origin/server, NOT the `"sender"``
user's server name.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-27 18:16:23 -04:00
Benjamin Lee
6ccf578437 bump rocksdb input
Nedded to pull in [1], which is rared for dynamic rocksdb builds with
liburing.

[1]: c8a1450231
2024-05-27 04:54:57 -04:00
Benjamin Lee
8a1848a814 Revert "nix: default output to scopeHostStatic instead of scopeHost"
This reverts commit a37b2b9e64.

Dynamic builds are working again, so we'd prefer having that be the
default output for consistency with nixpkgs.
2024-05-27 04:54:57 -04:00
Benjamin Lee
b4cd8e9140 fix dynamic builds with liburing
The original implementation of this was really weird, so I restructed it
a lot while debugging, and am just gonna leave the restructured version.

Root cause of the segfault seems to be that upstream nixpkgs liburing
derivation is generating both static and dynamic libraries, causing
rocksdb to statically link liburing in a dynamic build, pulling in some
allocator stuff at the same time. I created a PR[1] to fix this upstream,
but it probably won't be available on nixos-unstable for quite a while,
so we can also patch it locally.

[1]: https://github.com/NixOS/nixpkgs/pull/314945
2024-05-27 04:54:57 -04:00
Benjamin Lee
a08f90b161 add a smoke-test to CI for the nix 'default' output
I talked to somebody yesterday in #conduwuit:puppygock.gay that was using
this output in their system config. The dynamically-linked jemalloc build
is quite fragile, and is not tested by anything else in CI. We want to
make sure we don't break it again in the future.
2024-05-27 04:54:57 -04:00
Benjamin Lee
207979579c fix dynamically linked devshell
This failed to inherit the fix from bec507d7390dda9ca2e624ef846521a20e2252c7
because the crane package's buildInputs become propagatedBuildInputs in
a static stdenv, but become normal buildInputs in a dynamic stdenv. Since
we were only pulling propagatedBuildInputs into the devshell, dynamically
linked devshells did not include the rust-jemalloc-sys package. This
causes tikv-jemalloc-sys to build it's own static jemalloc package, and
we end up loading libc before jemalloc at runtime.
2024-05-27 04:54:57 -04:00
Benjamin Lee
68b96026ec unmark dynamically-linked jemalloc builds as broken
It turns out that this was actually fixed by
bec507d7390dda9ca2e624ef846521a20e2252c7 and
857ac42aacf430f14a9b7108591cea91185af8b3, but we didn't identify it at the
time. Notably, the `dynamic` devshell is still broken.
2024-05-27 04:54:57 -04:00
strawberry
30beb20230 conditionally static link rust-rocksdb-uwu by hot reload cfg
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
19e7779693 update complement test results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
6269822613 actually fix all let_underscore_must_use lints
CI caught some more

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
0877ee6191 allow let underscore use lint for rocksdb create cf for now
the workaround needs to be extended to rocksdb caches, but
i dont know that part of code

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
a37b2b9e64 nix: default output to scopeHostStatic instead of scopeHost
defaults to static builds instead of dynamically linked builds

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
29fe960efa bump hyper-util and libz-sys
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
6bf2e73830 ci: run cache dependencies in ci.yml as well
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
630760b5da bump rocksdb to v9.2.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
61e7f1e614 remove rpath = true from dev profile as the rustflags have it
needed for hot reloading but rpath being true by default
causes linker errors on lld because of the sad rpath bug

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
7ebed7aa3e clarify disable-room message after banning room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
ad3eeaf4c1 delete audit.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
5215fbe695 drop redaction calculated hash log to debug_info
this is normal redactions. no valid reason this needs to be
warn as it just causes confusion.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
dc9fe657d5 fix guest accounts being logged still
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
1c7c5bc09c feat: add /_conduwuit/local_user_count endpoint
only enabled if federation is enabled

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
32161801ed use/enable let_underscore_must_use lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
71bdcb958a fix: dont drop remote federation error on 4xx responses
for a very long time, if a remote server responded to us with
a valid but unsuccessful (HTTP 4xx) response and the caller was the
`send_federation_request` function, we may find ourselves
with a warning message only containing the destination's
server name which was very unhelpful. the true error was
buried away in trace logs. this would primarily be noticed
with server key fetch requests from us.

conduit has been throwing away the ruma request error: https://gitlab.com/famedly/conduit/-/blame/next/src/utils/error.rs#L62

before: 2024-05-23T04:45:02.930224Z  WARN router:{path=/_matrix/client/v3/publicRooms}:handle: conduit_api::client_server::directory: Failed to return our /publicRooms: matrix.org
after: 2024-05-23T05:05:02.435272Z  WARN router:{path=/_matrix/client/v3/publicRooms}:handle: conduit_api::client_server::directory: Failed to return our /publicRooms: matrix.org: [401 / M_UNAUTHORIZED] Failed to find any key to satisfy: _FetchKeyRequest(server_name='your.server.name', minimum_valid_until_ts=1716440702337, key_ids=['ed25519:RQB3XPQX'])

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
d3db0ad4e2 renovate: label PRs as dependencies and github_actions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
e098448b9d init a few vecs in event_handler using with_capacity
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
d49507bc21 media: decomplexify get_all_media_keys for deleting all MXC URIs
wow this was terrible, early strawberry code

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
cb73ae3732 add registration token validity endpoint as per matrix 1.2
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
06bec40591 fix: add missing fetch_required_signing_keys for remote send_leave
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
9a7ba94ccf explicity define unstable support for sliding sync
this matrix-react-sdk PR (and the cited sliding sync MSC)
says that they will intend on checking sliding sync support
from this unstable feature flag at /versions until the CORS
header stuff is specced

https://github.com/matrix-org/matrix-react-sdk/pull/12498

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
2990c30ac9 nix: bump rocksdb input
• Updated input 'rocksdb':
    'github:girlbossceo/rocksdb/db6df0b185774778457dabfcbd822cb81760cade' (2024-05-03)
  → 'github:girlbossceo/rocksdb/be68b3c95ccd225f3121ba33a67cfaf3c3596afc' (2024-05-23)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
d9c575d96f bump deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
c32406aa0e replace deprecated config option for complement
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
03d12cb44e update docs a tad
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
bef7dbd1cb finally error on complement diff mismatch, remove jemalloc builds from
CI

jemalloc is now a default feature

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
08577873b4 update complement test results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
a3931b0f1f nix: bump flake.lock
• Updated input 'crane':
    'github:ipetkov/crane/27025ab71bdca30e7ed0a16c88fd74c5970fc7f5' (2024-05-09)
  → 'github:ipetkov/crane/7443df1c478947bf96a2e699209f53b2db26209d' (2024-05-19)
• Updated input 'fenix':
    'github:nix-community/fenix/297c756ba6249d483c1dafe42378560458842173' (2024-05-10)
  → 'github:nix-community/fenix/063d7e5fac454edd35b7e2cedb6ca9fb1410c79b' (2024-05-21)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/5bf2f85c8054d80424899fa581db1b192230efb5' (2024-05-09)
  → 'github:rust-lang/rust-analyzer/21ec8f523812b88418b2bfc64240c62b3dd967bd' (2024-05-19)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f1010e0469db743d14519a1efd37e23f8513d714' (2024-05-09)
  → 'github:NixOS/nixpkgs/3eaeaeb6b1e08a016380c279f8846e0bd8808916' (2024-05-21)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
ba2f22b5d3 nix: remove jemalloc (now default) targets, add jq input for default
jq input change was from 17eb354590
to prevent unnecessary bindgen rebuilds

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
0914aaa1b6 skip a few known flaky/unreliable complement tests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-25 22:28:43 -04:00
strawberry
f3427afc7f nix: use new public keys for binary caches due to attic issues
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-24 18:13:02 -04:00
morguldir
9aa372d83b nix: Allow excluding features, allow disabling release_max_log_level 2024-05-24 15:12:23 -04:00
morguldir
5893901a75 Explicitly include snappy as well
Not sure what changed that we need this

Signed-off-by: morguldir <morguldir@protonmail.com>
2024-05-24 12:46:15 -04:00
morguldir
8ba9b33a95 Make sure we use the liburing of the platform we're building for
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-05-24 12:46:15 -04:00
morguldir
70047ff26d Make rocksdb include liburing, and tell gcc the path during the build
With: strings /nix/store/9skicdac6xs4yww1nd3h7m6xydv4hxlj-rocksdb-9.1.1/lib/librocksdb.so.9|rg io_uring|wc -l
112
With: strings result/bin/conduit |rg io_uring|wc -l
5

Without: strings static-x86_64-unknown-linux-musl-jemalloc |rg io_uring | wc -l
0

Signed-off-by: morguldir <morguldir@protonmail.com>
2024-05-24 12:46:15 -04:00
Benjamin Lee
1d57e14dc0 set C/LDFLAGS for complement dependencies directly
Previously we were relying on NIX_CFLAGS_COMPILE, but this is not being
set in static devshells. A cleaner solution for complement would likely
be to build the tests in their own nix derivation instead of building
them in the devshell, but this change unblocks CI for now.
2024-05-24 10:53:47 -04:00
Benjamin Lee
5d81203277 use a statically-linked binary for complement
Dynamically-linked jemalloc is broken.
2024-05-24 10:53:47 -04:00
Benjamin Lee
ad39a34c16 add a dynamically-linked devshell
This is broken on linux, but can be used by darwin users for development,
since static/jemalloc/darwin is broken.
2024-05-24 10:53:47 -04:00
Benjamin Lee
a007338b34 mark dynamic jemalloc builds as broken on linux 2024-05-24 10:53:47 -04:00
Benjamin Lee
3d1507e6dd mark static rocksdb broken on darwin 2024-05-24 10:53:47 -04:00
Benjamin Lee
4cb7c0b982 don't use prefixed jemalloc with rocksdb
This is causing build failures on Mac:

> In file included from /tmp/nix-build-rocksdb-static-aarch64-apple-darwin-9.1.1.drv-0/source/memory/memory_allocator.cc:8:
> In file included from /tmp/nix-build-rocksdb-static-aarch64-apple-darwin-9.1.1.drv-0/source/memory/jemalloc_nodump_allocator.h:11:
> /tmp/nix-build-rocksdb-static-aarch64-apple-darwin-9.1.1.drv-0/source/port/jemalloc_helper.h:63:36: warning: unknown attribute '_rjem_malloc' ignored [-Wunknown-attributes]
> mallocx(size_t, int) JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1)
>                                    ^~~~~~
> /nix/store/3bix0kzy670dyhhizri3dwb1qfj3sdpa-jemalloc-static-aarch64-apple-darwin-5.3.0/include/jemalloc/jemalloc.h:412:18: note: expanded from macro 'malloc'
> #  define malloc je_malloc
>                  ^~~~~~~~~
> /nix/store/3bix0kzy670dyhhizri3dwb1qfj3sdpa-jemalloc-static-aarch64-apple-darwin-5.3.0/include/jemalloc/jemalloc.h:75:21: note: expanded from macro 'je_malloc'
> #  define je_malloc _rjem_malloc
>                     ^~~~~~~~~~~~
> /nix/store/3bix0kzy670dyhhizri3dwb1qfj3sdpa-jemalloc-static-aarch64-apple-darwin-5.3.0/include/jemalloc/jemalloc.h:183:43: note: expanded from macro 'JEMALLOC_ATTR'
> #  define JEMALLOC_ATTR(s) __attribute__((s))

Full build log at <https://girlboss.ceo/~strawberry/pb/ygJ3>. This is
likely fixable with patches to rocksdb, but not worth it since darwin is
only a dev platform.
2024-05-24 10:53:47 -04:00
Benjamin Lee
0c34cf95ce set show-trace for nix in CI 2024-05-24 10:53:47 -04:00
Benjamin Lee
17cc02ff99 add a 'no-features' devshell for local testing 2024-05-24 10:53:47 -04:00
Benjamin Lee
c0f8253fc5 enable all-features in nix for CI builds
CI is running `cargo build --all-features`, so we should be passing all
the features to nix as well.

The only thing this currently affects is the jemalloc_prof feature, but if
we add any non-default features that affect nix in the future they should
also be handled correctly now.
2024-05-24 10:53:47 -04:00
Benjamin Lee
0fd0a5d73c switch default devshell to static linking
Dynamically-linked jemalloc doesn't work due to link-order issues, and we
want CI to be testing a static binary anyway since that's what we're
publishing in releases.
2024-05-24 10:53:47 -04:00
Benjamin Lee
4e6fc2f2df factor devshell out into a helper function
We're planning to add a second devshell with `all-features` for CI.
2024-05-24 10:53:47 -04:00
Benjamin Lee
a6742ce8a7 remove liburing from devshell
This doesn't seem to be necessary to build, and the derivation is broken
in pkgsStatic.
2024-05-24 10:53:47 -04:00
Benjamin Lee
188dea13e0 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-24 10:53:47 -04:00
Benjamin Lee
a7fe434086 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.
2024-05-24 10:53:47 -04:00
renovate[bot]
eb8dd9cb44 chore(deps): update aquasecurity/trivy-action action to v0.21.0 2024-05-23 01:30:36 -04:00
strawberry
474d50d10c bump conduwuit version to 0.4.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-21 20:22:17 -04:00
Jason Volk
2e732c711c docs: Update docs for hot-reloading.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
strawberry
981ec51ec0 docs: add initial docs for hot reload
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-21 20:22:17 -04:00
Jason Volk
2dd5cf8c68 move clap; fix version
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
Jason Volk
74832bdc47 fix smoke from builds produced by --all-features
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
Jason Volk
fdc9a9a1b8 add cargo smoketest
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
Jason Volk
1f3a9a40e5 lint clippy::collapsible_match (nightly)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
Jason Volk
362649ff87 rename src/bin to src/main
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
strawberry
4aeec78ab4 debian: remove old symlink on postrm
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-21 20:22:17 -04:00
strawberry
9bfa89a555 adjust debian metadata, set crane workspace name
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-21 20:22:17 -04:00
Jason Volk
6c1434c165 Hot-Reloading Refactor
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-21 20:22:17 -04:00
slonkazoid
ae1a4fd283 add modification time fallback if birth time is not supported on this platform 2024-05-21 16:58:30 -04:00
Benjamin Lee
9eb0784f6f don't return extra member count or e2ee device updates from sync
Previously, we were returning redundant member count updates or encrypted
device updates from the /sync endpoint in some cases. The extra member
count updates are spec-compliant, but unnecessary, while the extra
encrypted device updates violate the spec.

The refactor necessary to fix this bug is also necessary to support
filtering on state events in sync.

Details:

Joined room incremental sync needs to examine state events for four
purposes:

 1. determining whether we need to return an update to room member counts
 2. determining the set of left/joined devices for encrypted rooms
    (returned in `device_lists`)
 3. returning state events to the client (in `rooms.joined.*.state`)
 4. tracking which member events we have sent to the client, so they can
    be omitted on future requests when lazy-loading is enabled.

The state events that we need to examine for the first two cases is member
events in the delta between `since` and the end of `timeline`. For the
second two cases, we need the delta between `since` and the start of
`timeline`, plus contextual member events for any senders that occur in
`timeline`. The second list is subject to filtering, while the first is
not.

Before this change, we were using the same set of state events that we are
returning to the client (cases 3/4) to do the analysis for cases 1/2.
In a compliant implementation, this would result in us missing some
relevant member events in 1/2 in addition to seeing redundant member
events. In current conduwuit this is not the case because the set of
events that we return to the client is always a superset of the set that
is needed for cases 1/2. This is because we don't support filtering, and
we have an existing bug[1] where we are returning the delta between
`since` and the end of `timeline` rather than the start.

[1]: https://github.com/girlbossceo/conduwuit/issues/361

Fixing this is necessary to implement filtering because otherwise
we would start missing some member events for member count or encrypted
device updates if the relevant member events are rejected by the filter.
This would be much worse than our current behavior.
2024-05-20 20:55:56 -04:00
Benjamin Lee
8bffcfe82b remove sync response cache
This cache can serve invalid responses, and has an extremely low hit
rate.

It serves invalid responses because because it's only keyed off
the `since` parameter, but many of the other request parameters also
affect the response or it's side effects. This will become worse once we
implement filtering, because there will be a wider space of parameters
with different responses. This problem is fixable, but not worth it
because of the low hit rate.

The low hit rate is because normal clients will always issue the next
sync request with `since` set to the `prev_batch` value of the previous
response. The only time we expect to see multiple requests with the same
`since` is when the response is empty, but we don't cache empty
responses.

This was confirmed experimentally by logging cache hits and misses over
15 minutes with a wide variety of clients. This test was run on
matrix.computer.surgery, which has only a few active users, but a
large volume of sync traffic from many rooms. Over the test period, we
had 3 hits and 5309 misses. All hits occurred in the first minute, so I
suspect that they had something to do with client recovery from an
offline state. The clients that were connected during the test are:

 - element web
 - schildichat web
 - iamb
 - gomuks
 - nheko
 - fractal
 - fluffychat web
 - fluffychat android
 - cinny web
 - element android
 - element X android

Fixes: #336
2024-05-17 18:13:11 -04:00
strawberry
6ef4781050 downgrade zlib/libz-sys to 1.1.16 as it breaks nix
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-17 03:42:25 -04:00
strawberry
302592f219 bump conduwuit version to 0.3.4
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-17 03:17:27 -04:00
Benjamin Lee
7cd72d8447 bump lockfile 2024-05-17 03:08:56 -04:00
renovate[bot]
4389e08686 chore(deps): update cachix/install-nix-action action to v27 2024-05-15 14:39:21 -04:00
strawberry
91064fe873 fix up systemd unit file, remove chown on config file for debian
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
004354353a docker-compose: slight cleanups, correct database paths, fix branding
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
c64a507691 correct default database path to /var/lib/conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
81d2078cdb debian: dont start service immediately, add postinst instructions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
f5864afb52 remove namespace check on username login, code simplification on login route
the namespace check on username login is unnecessary, hashes aren't ever
going to match, and axum auth handles this kind of stuff already

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
9a63e7cc9b flip order of complement diff checking, update test results
we now pass all Content-Disposition checks/tests

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
296d7c58ee nix: bump complement input for conduwuit support
https://github.com/matrix-org/complement/pull/723

• Updated input 'complement':
    'github:matrix-org/complement/370a014dca0f720614e0c8f68b9a3e66ecf7f516' (2024-05-02)
  → 'github:matrix-org/complement/8587fb3cbe746754b2c883ff6c818ca4d987d0a5' (2024-05-14)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
a8446f910a debian: fix config permissions, delete debconf support
debconf support needs to be done in a way that does not duplicate
the config file like upstream does.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
a063a6d088 debian: make the docs actually coherent and understandable, and update it
the language here is very poor and i'm not sure why it was written like this.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
5069c88f77 ci: correct paths for debian package creation, use conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
53974320e5 debian: create system account verbosely
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
1c6ef66e3e fix gitlab ci
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
ffb63c9c8d ci: regex out the cargo/rustc target for cargo-deb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
de6b296eb5 ci: use verbose for mv operations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
4c11c9f048 ci: use target-specific dirs for cargo-deb, fix cargo-deb paths
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
6074298426 ci: allow build job to be ran for all events except for draft PRs
this allows build to be ran for workflow_dispatch

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
6e9f68bf81 chore: update complement test results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
edd67a102a ci(debian): add missing --target= for arm64 debs, add --verbose
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-15 14:31:35 -04:00
strawberry
434b5118cc media: return our detected MIME type for Content-Type
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 15:54:22 -04:00
strawberry
4185a33747 fix: we should be checking for xml MIME type instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 15:54:22 -04:00
strawberry
829307c83b disallow svg MIME types to be inline Content-Disposition
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 11:37:50 -04:00
strawberry
2bd7a92256 complement: add -tags="conduwuit_blacklist"
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
bfa33f8713 unpin rust-rocksdb version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
040cf29051 ci: add lix binary cache, update .gitlab-ci file
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
80bc1cd78a ci: output 100 failure summary lines instead of 50
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
78994deb1e nix: simplify isDarwin lib check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
714b3e7144 s/nix/lix in a couple places
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
1cd57f40f6 upload complement OCI image from CI, document where it can be found, use main instead of dev for tag
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
da9a0eb77b docs: fix broken systemd unit link
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
37b2c90e62 chore(nix): bump flake
• Updated input 'complement':
    'github:matrix-org/complement/891d18872c153d39a9ce63b545045efddb845738' (2024-04-30)
  → 'github:matrix-org/complement/370a014dca0f720614e0c8f68b9a3e66ecf7f516' (2024-05-02)
• Updated input 'crane':
    'github:ipetkov/crane/f6c6a2fb1b8bd9b65d65ca9342dd0eb180a63f11' (2024-04-21)
  → 'github:ipetkov/crane/27025ab71bdca30e7ed0a16c88fd74c5970fc7f5' (2024-05-09)
• Updated input 'fenix':
    'github:nix-community/fenix/73124e1356bde9411b163d636b39fe4804b7ca45' (2024-05-01)
  → 'github:nix-community/fenix/297c756ba6249d483c1dafe42378560458842173' (2024-05-10)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/55d9a533b309119c8acd13061581b43ae8840823' (2024-04-20)
  → 'github:rust-lang/rust-analyzer/5bf2f85c8054d80424899fa581db1b192230efb5' (2024-05-09)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5c24cf2f0a12ad855f444c30b2421d044120c66f' (2024-04-19)
  → 'github:NixOS/nixpkgs/f1010e0469db743d14519a1efd37e23f8513d714' (2024-05-09)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
ba150a1185 nix: stop running unnecessary cargo check on builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
ddce9496f2 nix: fix building rust on macOS (Security apple_sdk framework)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-12 03:05:34 -04:00
strawberry
fe637f481d ci: fix incorrect startsWith syntax
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-11 14:29:00 -04:00
strawberry
18e43e1d35 Reapply "bump various deps"
This reverts commit 6b918966d4.
2024-05-10 22:56:44 -04:00
strawberry
09fca89ac5 Revert "rocksdb: enable async_io if using io_uring feature"
This reverts commit 6266e0ab5e.
2024-05-10 22:56:44 -04:00
morguldir
9f19a2025d Revert "feat(membership): check if user already has the membership that is requested to be set"
This reverts commit 321a6ca0fe.

These checks were not working as intended, resulting in the unban button not working

The join check gets kept since it slightly reduces the amount of sent joins in some cases
This check will probably be replaced soon for a more universal solution to the "made no change" issue

Signed-off-by: morguldir <morguldir@protonmail.com>
2024-05-10 22:52:44 -04:00
strawberry
6b918966d4 Revert "bump various deps"
This reverts commit 653ec3799e.
2024-05-09 22:38:05 -04:00
strawberry
328502c1cd dont send avatar url or display name for ban membership events
the display name or avatar may be offensive

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 17:44:15 -04:00
strawberry
d15e461303 config option to auto-remediate bad users joining bad rooms or servers
also forgets all rooms upon leave_all_rooms

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 17:44:15 -04:00
strawberry
6946eead28 pin rust-rocksdb to before snappy update
it seems to break nix builds

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 17:42:05 -04:00
strawberry
09d3240365 bump conduwuit version to 0.3.3
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 17:42:05 -04:00
strawberry
653ec3799e bump various deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 17:42:05 -04:00
strawberry
6de9f52d5a docs: update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 12:34:50 -04:00
strawberry
484e7d1d2a docs: add my selfhosted forgejo mirror
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 12:34:50 -04:00
strawberry
dfa01541b3 docs: transfem.dev has rules
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 12:34:50 -04:00
strawberry
adbe9268ce docs: add troubleshooting, maintenance, various improvements and fixes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 12:34:50 -04:00
strawberry
3504e6e724 fix broken reports
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 12:33:46 -04:00
strawberry
154b2ab490 media: additional sanitisation on the Content-Disposition filename
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 09:53:04 -04:00
strawberry
2231ccf118 return inline Content-Disposition based on the detected file type (e.g. image/video)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 09:53:04 -04:00
strawberry
d4d9f92ade add security response HTTP headers if not present
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-09 09:53:04 -04:00
renovate[bot]
e4e1636da8 chore(deps): update aquasecurity/trivy-action action to v0.20.0 2024-05-08 15:06:45 -04:00
strawberry
e99aac9550 ci: fix gitlab container registry destination
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-08 15:04:59 -04:00
strawberry
ddb87168ed update gitlab repo link
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-08 15:04:59 -04:00
strawberry
245c34e659 ci: dont run docker publishing if none of the usernames are set
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-07 23:59:05 -04:00
strawberry
43b07be3fc ci: use PR author instead of branch name for docker image publishing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-07 02:44:55 -04:00
strawberry
99d98efeb1 ci: fix docker publishing typo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 13:05:00 -04:00
strawberry
7b25ef2e6c make next_batch token a variable in search, revert threads_until change
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
1f8a7a707c nix: cache complement outputs using nix-build-and-cache
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
86ec20e787 docs: remove last dev branch mention
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
Charles Hall
8c21388f01 fix nix-build-and-cache
Now it actually caches everything.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
d657fa32e9 ci: format string
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
321e197d8c correct arithmetic adjustments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
16a98b0683 ci: push docker images for PRs in the merge-PR_NUMBER-HEAD_REF format, fix main pushes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
9e1bbc1650 ci: run on new tag pushes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
91ff6a36a4 ci: abort workflow if latest repo tag does not match with running tag ref
protects against a maintainer creating a downgrading version tag, and
uploading artifacts with that version

this check is only ran via workflow dispatch on the tag

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
56f1d8be1f ci(docker): publish latest only if ref starts with our tag format
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
ed60f189cc docs: remove dev docker images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
cabf4362be docs: direct all PRs to main
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
2472c7c47a ci: don't run on dev anymore, run on main and non-draft PRs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
Xiretza
136cb038cf auth_chain: add useful debug logging 2024-05-06 03:45:10 -04:00
Xiretza
8f89be0fbd utils: add helper for adding unbounded slices to tracing spans 2024-05-06 03:45:10 -04:00
Xiretza
bbdced9c90 Fix appservice namespace check for room aliases
Only normal users should be prevented from creating an alias within an
exclusive namespace, not the appservice itself. This mirrors the
behaviour in api/client_server/room.rs on room creation.
2024-05-06 03:45:10 -04:00
strawberry
a6f4dc2b74 engage(lychee): check all markdown files too, enable verbose mode
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
df203fa244 add a contributing guide
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
c6e6eb0af3 ignore empty CONDUWUIT_VERSION_EXTRA for server version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
29babebc4d adminroom: add count to list-joined-rooms user command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
Matt Moriarity
2f3194840c fix extra version when using flake-compat 2024-05-06 03:45:10 -04:00
strawberry
0ebb323490 resolve almost all as_conversions lints
may need further opinion from others on these

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
f8e1255994 presence: set empty string status msg to None
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
b5c0c30a5e resolve half of the integer_arithmetic lints, couple misc changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
ac4590952b set io_uring for rocksdb a default feature
this was already enabled by default by rocksdb technically, but
it wasn't building with it properly.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
67569cb9c8 nix: switch to fork of rocksdb input
db6df0b185
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
11ec0dff4f add PATCH to list of allowed HTTP methods in CORS (MSC4138)
https://github.com/matrix-org/matrix-spec-proposals/pull/4138

we already had HEAD

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
a198f0481a nix: add liburing to devshell
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
6266e0ab5e rocksdb: enable async_io if using io_uring feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
9ee1485960 enable overflow-checks for dev/debug profile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
05314ec46c nix: set hardcoded NIX_OUTPATH_USED_AS_RANDOM_SEED for bindgen
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
b66d2d44d0 chore: bump MSRV to 1.77.0 as 1.78.0 came out
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
3b2db9027a envrc: allow loading env vars from .env if it exists
from ffd479d66f

This is primarily useful for replicating the environment from CI so that
the `nix-build-and-cache` script is easier to invoke.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
97e81885db use dep: syntax in cargo.toml features
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
706c1c993b nix: don't run cargo test for crane buildpackage
CI does this already

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-06 03:45:10 -04:00
strawberry
cb70d51e2b bump conduwuit version to 0.3.2
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-05 16:52:51 -04:00
strawberry
bfb827a418 send Cache-Control and CORS header for remote thumbnail responses
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-05 16:28:21 -04:00
strawberry
e2fb588a8c sent attachment content-disposition on thumbnails too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-05 16:28:21 -04:00
strawberry
43c4dfc5df set content-disposition to attachment instead of inline
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-05 16:28:21 -04:00
strawberry
42e3567153 disable overflow-checks for performance
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 02:18:24 -04:00
strawberry
75ad5cfbb7 bump conduwuit version to 0.3.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 02:12:34 -04:00
strawberry
be5101b07c bump console-subscriber to 0.2
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 02:12:34 -04:00
strawberry
c531101657 misc docs adjustments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
761263332b ci: push to gitlab container registry too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
5fe146aa85 docs: update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
d7399a12fb config: split at __ for struct sections of config, add couple missing settings for show-config
this makes `CONDUWUIT_WELL_KNOWN__CLIENT` a valid env variable config
option as it would normally exist under `[well_known.client]` in toml

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
7e2a15497c use function comments for lsp here
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
e226046e15 drop default appservice_timeout to 35 seconds
AS's are generally hosted on the same machine or within the same
network

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
75b9332917 dont allow creating remote users in admin room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
de26bf22dc adjust a couple error codes for room alias getting
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
a7c14a861b ci: output complement diff results to job summary, temp allow error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
05b7dec482 temp(ci): comment complement results diff for now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
38ca88da9f ci(gitlab): use --no-strip for cargo deb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
2e5ba7ab17 ci(gitlab): use gitlab fastzip feature flag
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
35683d66dd sort the complement results by test name for consistent output
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
e1052d1829 chore: update checked-in complement test results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
49078aa836 fix: get the presence of the requested user instead of ourselves
after getting the shared rooms with the target user, we actually only
get the presence of ourselves instead of the requested user

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
b6b739a7b7 set -vet=off to (hopefully) run all complement tests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
fa0bdd431b add destination to X-Matrix Authorization outbound requests
we were already validating this for inbound requests

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
a6cf5cfd8b remove future deleted nix binary cache
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
37c2877cf8 chore: update checked in list of complement test results
also remove the separated passed/failed list, it's already ordered
neatly for folks to read.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
1181a7a7a9 nix: specify explicit branches/refs for flake inputs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
cad16b9268 ci, nix: build and cache all packages and CI dependencies
from f5bd9bc45e
with changes for GitHub CI and misc

Co-authored-by: Charles Hall <charles@computer.surgery>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
3b410d0556 ci: run complement with direnv
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
28f599236a ci: compare complement results with checked-in results
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
365c85ad27 use nix-output-monitor if available
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
13f1274c35 run complement in CI (does not compare results yet)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
c4beb7d462 dont return "Allocator" header for server memory-usage if empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
0f13ada300 return more user-friendly message for debug memory-stats
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
a7f8c848aa refactor and simplify room creation route a bit
removes a couple unnecessary checks, uses our room_id ruma request field

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
25bc1f069d chore: bump deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
0223386243 remove this unnecessary log, use debug_warn
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
a496cc4705 dedupe version getting code, rename to CONDUWUIT_VERSION_EXTRA
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
8ec9372a8e lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Charles Hall
a01a7e1219 improve "Leave event has no state" log
To include the user, room, and event ID.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
db81ffb4ea nix: only set CONDUIT_VERSION_EXTRA for final build + slight cleanup
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
096c252dc2 move hierarchy via servers higher up, add some debug logging to it
this entire thing needs to be cleaned up later, but i need spaces
to work

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
1464b30433 add workaround for room creation initial_state event content as {}, slight refactor
this will simply skip over the events

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Jason Volk
3585e8a2ef rename / simplify tester stub for now
Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Jason Volk
b19d2ad5b0 daily logging improvements
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
8ecf722abb split http serving from main.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
5d76db8f19 add configuration for rocksdb direct-io enablement
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
strawberry
f4a2b39d55 split up alias.rs a bit (alias checks and room alias server name stuff)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
e00b65b0e0 use ok_or_else instead of ok_or for backup.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
beeacd4ef1 initialise capabilities with default constructor
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
e5735c81ed dedupe half of account/room data config.rs code
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
b17ccdadd2 dedupe some code in state.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
8e3918250d rm complement test logs, rm docker healthcheck.sh, rm .vscode/ dir, move test results to tests/ dir
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
6021cb0a1f partially revert this
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
35114dde7d add query_over_tcp_only config option for hickory
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
62fd6e2c7c set AD bit to false in hickory
this is purely DNSSEC related which we don't use, and DNSSEC on matrix
is unbearable for federation (no one sets it up properly, it's extremely taxing, etc)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
668a7645e9 add ip_lookup_strategy config option for hickory resolver
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
3f8407dd64 add hot_lib to default.nix src include
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
b8c4d6b157 bump ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
0b39bb813e tiny refactoring, split out report_event_route a bit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
d32ea6ec20 cargo doc lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
041a7a90f3 hot lib things again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
9c0c4c292c document hot_lib for developers a bit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
ed86a4aa9e slight misc adjustments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
b282c1eb6d add (probably messy) support for hot lib reload via admin command
`!admin test test1`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
76c5942b4f use user_is_local and server_is_ours more, remove few double filters
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
e7505a4b20 resolve ptr_as_ptr lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
a97520b0e9 bump MSRV to 1.76.0
there's really no point in trying to stay as low as possible for us,
and this makes development easier. Debian users should just use rustup,
Nix users already get the proper toolchains.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
9931e60050 use single global function for server name local and user local checking
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
8f17d965b2 use <pre> for codeblock formatting in jemalloc stats, link to ffi func
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Jason Volk
9f5d7b0761 fix mallctl suite lints
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Charles Hall
4faf690f57 run clippy on default, all, and allocator features
This way all 4 major configurations are linted.
2024-05-03 01:52:29 -04:00
Charles Hall
838550536a reflow clippy in engage file 2024-05-03 01:52:29 -04:00
Charles Hall
3b05417246 handle the case where 0 or >1 allocs are enabled
In particular this fixes `cargo build --all-features`.
2024-05-03 01:52:29 -04:00
Charles Hall
e0c0d51a05 fix lints 2024-05-03 01:52:29 -04:00
Jason Volk
e4b669360f start mallctl suite w/ jemalloc stats
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
56f652c12d cleanup admin worker loop
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
4b6938e0f6 add admin server uptime command
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Benjamin Lee
781d4b7907 document tracing_flame options in example config 2024-05-03 01:52:29 -04:00
Benjamin Lee
56f1e905de add config option tracing_flame_output_path
Hardcoding the output path to something in CWD is a pain if you're running
conduwuit through systemd or similar. Also made the error message when
it's unable to create the output file a little more friendly.
2024-05-03 01:52:29 -04:00
Benjamin Lee
646b31d2bd flush tracing-flame output file on exit
Previously we were dropping the flush guard early, possibly causing
samples to be lost on exit.
2024-05-03 01:52:29 -04:00
Benjamin Lee
7d92515b1d add tracing_flame_filter config option
The previous hardcoded filter `trace,h2=off` isn't appropriate in all
cases, it's better to have this be configurable.
2024-05-03 01:52:29 -04:00
Benjamin Lee
cc578d9a67 keep stdout logs when tracing-flame/jaeger is enabled
Previously, enabling the `tracing_flame` or `allow_jaeger` options would
prevent any logs from being written to stdout. In addition, enabling the
`allow_jaeger` option would inhibit the `tracing_flame` option.

Now that we have a way to use separate tracing filters with different
layers, we can enable all three at the same time without issues.

This commit also prevents the `debug log_level` command from modifying
the `tracing-flame` filter. This was supported previously, but I don't
think it's something that you would ever want to do intentionally. Now
that we have both the normal log filter and the `tracing-flame` filter
enabled at the same time, we want to `debug log_level` to only modify the
normal filter.
2024-05-03 01:52:29 -04:00
strawberry
bf713cd0ba lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
61f813c187 admin command to get rooms a remote user is in, remove unnecessary dedupe+sort
imagine this SQL query but in conduwuit:

select * from users_in_public_rooms where user_id like '%user_id%';

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
450f15df4f admin debug command to fetch a server's true destination
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
1cbf2bdc6b update dns_cache_entries example config setting
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Jason Volk
b4035bf0da increase default dns cache entries
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
37ecb4f2b9 decrease log verbosity for potentially cached NoRecordsFound
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
Jason Volk
daf4b56435 fix inherited sequential small options
Signed-off-by: Jason Volk <jason@zemos.net>
2024-05-03 01:52:29 -04:00
strawberry
799b2909ab ci: dont run registry pushes if creds are not set
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
614ef5b3a1 raise dns_min_ttl_nxdomain back to 3 days
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
cfa89b8b64 add remaining other rocksdb compression options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
9f245281b1 never allow only 1 tokio worker or rocksdb parallelism thread (max compare)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
d172a6883d bump some deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
strawberry
04afc83043 switch to my fork of tracing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-05-03 01:52:29 -04:00
Benjamin Lee
8a5599adf9 add optional support for tokio-console
This turned out to be quite hairy, mostly because we need to apply the
config's log level filter to the actual logs (stdout and, optionally
sentry), but do not want to filter out the tokio tracing events needed by
the console_subscriber. I hit several edge cases in tracing getting
this to work, and we now depend on a git version of tracing with a
backported patch :(
2024-05-03 01:52:29 -04:00
strawberry
341bafb91e final last minute change
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
72877622e5 forgot to update example config
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
66e3e95b78 use logical core count for rocksdb parallelism
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
b0de16bf5a misc docs updates and ci path-ignore again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
e8508d16e1 update README.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
8574d0758e add concurrency group and paths-ignore to ci.yml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
59199e8f66 document presence_timeout_remote_users
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
a41472cc3f why not
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
6fd3123660 update some documentation a bit for new users
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
5195593f55 add @resources to syscall filter in the default systemd unit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Tom Foster
536efe2cd7 CI working with job summaries
All images should be generating correctly with parallelism and Docker manifests, and should output the end of the CI testing errors in a job summary box when the test fails.

When the test succeeds you get a big  then at the end of the Docker publish it should include the `docker pull` commands for both Docker Hub and GHCR registries to make those pesky Docker users lives easier!
2024-04-26 02:03:40 -04:00
strawberry
aa299111a4 update differences.md a bit more, and README.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
33afd60026 use number of logical cores for tokio worker thread count
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
54eb634588 add rocksdb compaction thread priority/iopriority w/ conf
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
a4c243cae5 cleanup, update, and format differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
1da3048bb8 allow accepting CONDUWUIT_ prefixed config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
894902b75f bump cargo.lock due to yanked crate
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
c87ea1dea1 delete unused servername_ratelimiter semaphore now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
d55015ccda rename release_log_level dev feature to dev_release_log_level, some rebranding
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Charles Hall
76ab8ca69b allow disabling default features via override 2024-04-26 02:03:40 -04:00
Jason Volk
67f9553790 backoff to valhalla
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
255bcf5243 split sending from mod interface.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
a124122dd4 daily logging improvements
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
0b33eec1c2 remove max_concurrent_requests sender hazard
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
00ce43d739 remove redundant timers
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
b01d25277d fix remote media error propagation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
b3984f5337 deduplicate cache control into constant
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
7e5ed199c9 deduplicate media handler bodies; minor reorg
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Tom Foster
6fbf4b5679 Simplify docker manifest CI stage 2024-04-26 02:03:40 -04:00
Charles Hall
ee9650bd9f update flake.lock
Should've been done in fe606f4fad12b14de398ebf0319462f432dc336e but the
author didn't realize it.

Flake lock file updates:

• Updated input 'rocksdb':
    'github:facebook/rocksdb/bcf88d48ce8aa8b536aee4dd305533b3b83cf435' (2024-04-16)
  → 'github:facebook/rocksdb/6f7cabeac80a3a6150be2c8a8369fcecb107bf43' (2024-04-22)
2024-04-26 02:03:40 -04:00
strawberry
c1d8678eeb try moving a couple things around in CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
e2c460ec54 ci: define packages permission in publish step
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
4128d83be6 bump ruma, adjust a couple lines of docs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
a81563244f restricted room join typo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
3c45a468f1 bump rocksdb to 9.1.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
af0b81f5fb simplify conduwuit version number, bump to 0.3.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Tom Foster
d57110e2f3 Improved CI artifact filename handling 2024-04-26 02:03:40 -04:00
Jason Volk
49e453fe07 cleanup/refactor sender base loop
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
d19573c7b5 Revert "Revert "prevent empty transactions from going out""
This reverts commit bb43351658.
2024-04-26 02:03:40 -04:00
strawberry
c57601a4b8 delete all active requests for the appservice when we delete it
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
dc35d06c0a misc changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
c915f3dec5 resolve rust 1.75 error?
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
7f86a166ec make "release_max_level_info" into a crate feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
b1ddc502cc please stop "rustc-ice"
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
bd73103713 adjust appservice sending logging
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
eb5dcf08c6 remove unnecessary appservice reqwest timeout, reduce couple unwraps, return if unsuccessful HTTP response
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
46ce15f61f slightly adjust pusher logging, return if non-successful status instead of continuing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
ee07e3e975 missing semicolon
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
15a990dc25 improve various logging
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
57e6af6e21 split sending/send base functions
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
f919fa879b abbrev destination in sender
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
d91f24d841 partially revert this in main.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
e90ab8ec8e split request base result handling and tweak logging
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
aef77bd338 add release_log_level feature to simulate release logs in debug mode.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
3140f101c1 move clap into utils
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
0734b52a8a slight misc error.rs changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
renovate[bot]
f0dd3930fa chore(deps): update nixos/nix docker tag to v2.22.0 2024-04-26 02:03:40 -04:00
Tom Foster
e17f8d5b24 Multi-threaded CI to accelerate builds 2024-04-26 02:03:40 -04:00
strawberry
726bc50fe4 ignore irrelevant cargo audit RUSTSEC in engage explicitly
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
418ec87cfd try logging the full URI instead of just the path for tracing_span
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
6874ac0015 allow RUSTSEC-2020-0016 due to hot lib reload
this is an optional crate anyways

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
6394b1812c use 403 for auth check fails everywhere else
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
1b41e35f1d use HTTP 403 (forbidden) instead of HTTP 400 for membership failed auth checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
73c67d6b17 add back complement test results (dir subject to change?)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
5f0d519327 docs: fix complement script command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
eb10e7d39b fix(appservices): don't perform identity assertion when auth is optional
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
456a3f93bd replace all mentions of docker compose v1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
a730adb836 use perf_measurements attributes here
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
b7a494c40d reduce tls override cache lock exposure
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
17d0c869b0 remove some various unused functions and mark some possibly important ones *for now*
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
66bb88a03a make everything pub(crate) instead of pub
conduwuit is not a library

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
472c32f453 conduit "library" delete, resolve some warnings from that
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
5e8ae971f1 flip min_duration and max_duration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
1595037427 cleanup scoped types; improve error logging
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
938d1f6e77 add conf item for sender retry backoff limit
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
f273e8feb5 resolver defaults to error for everything except NoRecordsFound.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
906057dd8d add all admin query command for appservices
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
d90ac11603 remove mentions of "outgoing_kind" everywhere else too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
e26cd5e296 rename OutgoingKind to Destination, add QueuedRequests and ActiveRequestsFor admin query commands
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Tom Foster
77d73583f6 Separate CI job for publishing docker manifest 2024-04-26 02:03:40 -04:00
strawberry
b8a748815a dont allow admin room to be made world readable
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Charles Hall
9297c642aa update flake.lock
Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/6eabc3f02fae3683bffab483e614bebfcd476b21?narHash=sha256-wSZjK%2BrOXn%2BUQiP1NbdNn5/UW6UcBxjvlqr2wh%2B%2BMbM%3D' (2024-02-14)
  → 'github:zhaofengli/attic/4dbdbee45728d8ce5788db6461aaaa89d98081f0?narHash=sha256-0O4v6e4a1toxXZ2gf5INhg4WPE5C5T%2BSVvsBt%2B45Mcc%3D' (2024-03-29)
• Updated input 'attic/nixpkgs':
    'github:NixOS/nixpkgs/aa9d4729cbc99dabacb50e3994dcefb3ea0f7447?narHash=sha256-KnIRG5NMdLIpEkZTnN5zovNYc0hhXjAgv6pfd5Z4c7U%3D' (2023-12-14)
  → 'github:NixOS/nixpkgs/07262b18b97000d16a4bdb003418bd2fb067a932?narHash=sha256-QoQqXoj8ClGo0sqD/qWKFWezgEwUL0SUh37/vY2jNhc%3D' (2024-03-25)
• Updated input 'attic/nixpkgs-stable':
    'github:NixOS/nixpkgs/1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f?narHash=sha256-blbrBBXjjZt6OKTcYX1jpe9SRof2P9ZYWPzq22tzXAA%3D' (2023-12-17)
  → 'github:NixOS/nixpkgs/44733514b72e732bd49f5511bd0203dea9b9a434?narHash=sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq%2BP/1Z5IoYWs7E%3D' (2024-03-26)
• Updated input 'crane':
    'github:ipetkov/crane/55f4939ac59ff8f89c6a4029730a2d49ea09105f?narHash=sha256-Vz1KRVTzU3ClBfyhOj8gOehZk21q58T1YsXC30V23PU%3D' (2024-04-21)
  → 'github:ipetkov/crane/f6c6a2fb1b8bd9b65d65ca9342dd0eb180a63f11?narHash=sha256-qd/MuLm7OfKQKyd4FAMqV4H6zYyOfef5lLzRrmXwKJM%3D' (2024-04-21)
• Updated input 'fenix':
    'github:nix-community/fenix/aa45c3e901ea42d6633af083c0c555efaf948b17?narHash=sha256-nTaO7ZDL4D02dVC5ktqnXNiNuODBUHyE4qEcFjAUCQY%3D' (2024-03-28)
  → 'github:nix-community/fenix/19aaa94a73cc670a4d87e84f0909966cd8f8cd79?narHash=sha256-3pbv7UgAgetwz9YdjzIT/lZ6Rgj6wj6MR4mphBLyDjU%3D' (2024-04-21)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/ad51a17c627b4ca57f83f0dc1f3bb5f3f17e6d0b?narHash=sha256-s/YOyBM0vumhkqCFi8CnV5imFlC5JJrGia8CmEXyQkM%3D' (2024-03-27)
  → 'github:rust-lang/rust-analyzer/55d9a533b309119c8acd13061581b43ae8840823?narHash=sha256-iN5QUlUq527lswmBC%2BRopfXdu6Xx7mmTaBSH2l59FtM%3D' (2024-04-20)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2726f127c15a4cc9810843b96cad73c7eb39e443?narHash=sha256-UKcYiHWHQynzj6CN/vTcix4yd1eCu1uFdsuarupdCQQ%3D' (2024-03-27)
  → 'github:NixOS/nixpkgs/5c24cf2f0a12ad855f444c30b2421d044120c66f?narHash=sha256-XtTSSIB2DA6tOv%2Bl0FhvfDMiyCmhoRbNB%2B0SeInZkbk%3D' (2024-04-19)
2024-04-26 02:03:40 -04:00
Charles Hall
06e8b63a3c add cargo-audit to the devshell
Apparently github actions VMs ship with it and that's how it was working
before? Cursed. We should control our own supply chain and also ensure
that local development uses the same version as CI.
2024-04-26 02:03:40 -04:00
Charles Hall
63fe828120 use lib.makeScope and files to organize packages
Some of the improvements here include:

* rocksdb can actually use jemalloc now instead of just pulling in a
  second rocksdb for no reason
* "complement-runtime" factored back out into shell file
* complement image no longer uses `mkDerivation` for `copyToRoot`
  because that's what `buildEnv` is for
* complement image no longer sets `SERVER_NAME`, complement already does
  that
* all packages were factored out into `callPackage`-able files for use
  with a custom `lib.makeScope pkgs.newScope`
* new version of `mkPackage` has options that are easier to use and
  override such as `features`
2024-04-26 02:03:40 -04:00
Charles Hall
36774322e1 always go through inputs 2024-04-26 02:03:40 -04:00
Charles Hall
5476a36a0b remove dead code 2024-04-26 02:03:40 -04:00
Charles Hall
d2c3275323 get complement via flake inputs
Flake lock file updates:

• Added input 'complement':
    'github:matrix-org/complement/d73c81a091604b0fc5b6b0617dcac58c25763f57?narHash=sha256-hom/Lt0gZzLWqFhUJG0X2i88CAMIILInO5w0tPj6G3s%3D' (2024-04-18)
2024-04-26 02:03:40 -04:00
Charles Hall
b635e807ef get rocksdb via flake inputs
Flake lock file updates:

• Added input 'rocksdb':
    'github:facebook/rocksdb/bcf88d48ce8aa8b536aee4dd305533b3b83cf435?narHash=sha256-vRPyrXkXVVhP56n5FVYef8zbIsnnanQSpElmQLZ7mh8%3D' (2024-04-16)
2024-04-26 02:03:40 -04:00
Charles Hall
503c0f1076 flatten and sort all flake inputs 2024-04-26 02:03:40 -04:00
strawberry
acbe3bfbda use global valid_cidr_range everywhere else
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
22bebb9b74 various logging improvements.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
423fc6dad0 precompute cidr range denylist; move validator.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
93c3e6dec8 forgor is_err check too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
ebc59e6f15 some more room alias helper logging
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
5acb110f2b remove unnecessary continue
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
b3f03d307d try finding more servers for federation hierarchy instead of room ID server name
just the room ID server name is terrible

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
69968b94ea flip this
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
311be20055 break out the via field for hierarchy requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
8a767c4b10 on room alias joins, attempt to find the room ID through *more* servers if available
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
8ad42a85ef dont eat the ?server_name= param for join room by ID or alias
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
54cf992490 bump all deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
85b5597ea7 integrate reqwest read_timeout options.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
c396ff5cb8 show info log in release mode
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
eb9a6fe426 refactor sending send/resolver/well-known error propagation
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
68aa368450 cleanup/split/dedup sending/send callstack
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
Jason Volk
9361acadcb add debug log level macros.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
1e0b34367b add users query command, initial fsck admin command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
affd063df6 allow user admin commands to take the username only
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
8b3c4a528c add get_latest_edu_count admin query cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
cffe48d2dc add federation allowed checks on get remote pdu list
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
f87a012834 always print the details in panic catcher
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
039e79ab1b return matrix JSON response for panic catcher with details if debug build or trace used
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
afd72f23da add get-remote-pdu-list debug admin command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Charles Hall
a260308bc9 unpin crane because the bug was fixed
Flake lock file updates:

• Updated input 'crane':
    'github:ipetkov/crane/2c653e4478476a52c6aa3ac0495e4dea7449ea0e?narHash=sha256-XoXRS%2B5whotelr1rHiZle5t5hDg9kpguS5yk8c8qzOc%3D' (2024-02-11)
  → 'github:ipetkov/crane/55f4939ac59ff8f89c6a4029730a2d49ea09105f?narHash=sha256-Vz1KRVTzU3ClBfyhOj8gOehZk21q58T1YsXC30V23PU%3D' (2024-04-21)
2024-04-26 02:03:40 -04:00
strawberry
2271a56adc move sign_json and verify_json admin commands to debug
these are purely debug-related commands

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
9b7dab3a57 add sending.rs to admin db query command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
67b4f19c60 simplify room v11 top level redacts key
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Tom Foster
820cf3b9af ci: extract OCI images before loading and before login
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
aaba7342b5 fix config check running too late, add tower panic catcher(?)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
94dfe26707 ci: fix dockerhub login
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
893707d501 finish general admin room cleanup
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Tom Foster
a36b37ee3d Simplify to publish combined jemalloc image for all architectures 2024-04-26 02:03:40 -04:00
Tom Foster
8525dda468 Simplify publish to Dockerhub 2024-04-26 02:03:40 -04:00
strawberry
0cf368a327 refactor a ton of the admin room code (50% done)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
6b28bd5ae7 refactor more of admin code, add unfinished fsck command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
7cbe82668b ci: oci image registry publishing take 374237598
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
ce7355cbe0 add globals iterators/getters for admin query cmd, improve structure a bit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
2de4eea688 create better structure for admin query commands
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
b93215d7f2 use raw database functions, not helper functions, for admin query command
the helper functions may do ad-hoc data manipulation

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
e4a6a2325b initial support for querying database getters and iterators via admin cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
f954cd2387 ci(oci): add back arch prefix, try labeling our jemalloc images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
640cb2d4a8 ci: 🧌
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
96399703cc use --no-strip for cargo-deb, fix OCI image stuff
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
31f851f157 temp: get rid of hardened_malloc builds from CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
dd415182f9 bump hardened_malloc-rs, dont make num_cpus optional, use full debuginfo instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
99f920f7bc use gcc by default for hardened_malloc instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
7007df9abd bump conduwuit version to 0.2.1
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
1b8ae43ec9 fix lint for now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
e64f4df763 add release-debuginfo cargo profile with limited debug and no strip
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
ef23c604d7 bump axum-server-dual-protocol, remove 2 unnecessary attribute check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
19255c0c14 use max_request_size in axum.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
AwesomeQubic
999cc7ccf5 possibly fix macOS builds for nix
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
morguldir
6c0d527b90 Use jemalloc/hmalloc for cross builds
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-04-26 02:03:40 -04:00
morguldir
056c9d6920 Since we use crane.buildPackage we need to use cargoExtraArgs
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-04-26 02:03:40 -04:00
morguldir
3ebf1082d6 Base oci-images on their matching alloc variant
Co-authored-by: AwesomeQubic <ThatQubicWah@protonmail.com>
Signed-off-by: morguldir <morguldir@protonmail.com>
2024-04-26 02:03:40 -04:00
strawberry
aa77a31dfc stop excluding http deps from renovate !!!!
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
AwesomeQubic
30b5142ecc fix flake for macos, fix jemalloc/hmalloc builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
Jason Volk
05477150a2 Upgrade hyper/axum/tower/http stack.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-26 02:03:40 -04:00
strawberry
305f75b0e7 ci: try to fix cargo-deb arm64 stripping
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
8fc32b8e90 comment x86_64-unknown-linux-gnu for now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
2e15a0d18b split up CI again into tests, static builds, and OCI images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
73b25b9793 ci: limit max parallel jobs to 4
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
2a987ca67a try using upstream rocksdb again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
AwesomeQubic
90fc2bf53e add Complement support to the nix flake
Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: AwesomeQubic <ThatQubicWah@protonmail.com>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
de38d61126 merge ci steps back into one job for now
how do i persist or reuse the "state" of previous jobs

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
a4b28507de bump hickory, ruma, and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
3d445dd984 bump rocksdb to 9.1.0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
30e6c2385c use latest main rev for hickory (and for reqwest)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
d3dbe110d5 adjust DNS default config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
a898cf0db4 ci: remove download env
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
d070c89f84 split up CI steps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
a3c53036d5 cargo fmt
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
morguldir
32eb568909 Remove extra test flag when publishing to ghcr in the CI
test -n checks if a string is longer than non-zero, but we just need a compare

Signed-off-by: morguldir <morguldir@protonmail.com>
2024-04-26 02:03:40 -04:00
strawberry
bd25709446 Revert "dont use loole for sending channel code"
This reverts commit d0a9666a29.
2024-04-26 02:03:40 -04:00
strawberry
a64cbd0304 fix wrong warn message
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-26 02:03:40 -04:00
strawberry
d0a9666a29 dont use loole for sending channel code
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
11a2da3819 fix flake for other oci images too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
fcda7252c3 fix flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
bb43351658 Revert "prevent empty transactions from going out"
This reverts commit cc7cd51e9c.
2024-04-17 14:51:08 -04:00
strawberry
e95e4b9200 revert tag name in nix flake for OCI images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
7300103796 check if user is allowed to invite for restricted room join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
5667884a6a ci: wrap ref_name in quotes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
Matthias Ahouansou
19e4befcb8 feat(appservice): ensure users/aliases outside of namespaces are not accessed
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
morguldir
b303a774d8 Set the time of the HEAD commit as the OCI created field
Apparently it uses `date -Iseconds` to parse, so we can use @ with a timestamp

Also it doesn't parse `created` in buildImage, only buildLayeredImage

Signed-off-by: morguldir <morguldir@protonmail.com>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
5015fc7a2c add ci and flake support for using ref name to docker image tag
also runs ci on dev branch

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
641399e900 dont auto join rooms if registrations are from appservices
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
6131465d23 don't use bad_database (HTTP 500) for auth check failures
this is not database-related, and may trigger exponential backoff
against us from other servers

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
c5c8934db7 default to shared room history visibility if invalid (per spec)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
eebdd30ed7 bump cargo.toml dependencies
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
Jason Volk
541fa2d2f7 tweak various log levels and messages
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-17 14:51:08 -04:00
Jason Volk
33cc3d56c1 lazy-construct presence; avoids useless db queries in sender and syncer.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-17 14:51:08 -04:00
Jason Volk
8b003e6be2 add DNS configuration for TCP fallback.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-17 14:51:08 -04:00
Jason Volk
b6cf0e6fcf fix trust_negative_responses config option
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-17 14:51:08 -04:00
strawberry
160b9afe97 fix force room banning for room alias resolution
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
8e77d60abf bump major conduwuit version to 0.2.0 due to federation breakage
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
97c63604fd "global" ACLs config option, block room directory requests to forbidden servers
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
47c43769d7 improve some user admin cmd checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
404bdd1db5 allow ban-list-of-rooms to take room aliases
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
Matthias Ahouansou
59be0b3ddc sync upstream token/appservice auth code
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
strawberry
c76445e9c1 clear ratelimits when clearing cache too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-17 14:51:08 -04:00
renovate[bot]
6d47c20efa Update Rust crate chrono to 0.4.38 2024-04-15 07:34:45 -04:00
Jason Volk
cc7cd51e9c prevent empty transactions from going out
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-15 07:30:39 -04:00
strawberry
38b15418ca remove created date from OCI image generation
dockerhub and github container registry don't like this,
and i have no idea what to do.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-15 07:01:00 -04:00
strawberry
775191d5c1 dont include the timestamp in the docker image created date
i hate this

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-15 00:55:07 -04:00
strawberry
527a5cbd73 don't allow moderators dangerous permissions, fix pl 100 state_default
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 23:05:26 -04:00
strawberry
d1c139de26 add config option for url_preview_domain_explicit_denylist
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
Jason Volk
287887224f default empty presence string to offline.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
cdb2dff7dd federation incoming logging/tracing related
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
ad4e214d28 polylogarithmic debodge
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
e493b3a60d split prev_event loop body; fetch state; dedup room version procurement.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
424e13cec2 split signing_keys from event_handler/mod.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
dba0575e75 some optimizations to get_auth_chain()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
678d87ced1 add multi_get_or_create_shorteventids()
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
b4080de749 fix multi_get for abstraction and limit to specific column for least-surprise
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
c4ebc2f1d1 fix double-deserialization in federation transaction handler.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
97fc6c158f add edu select limit and condition for presence.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
6c9e95f7c9 add config option for allow_outgoing_read_receipts
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
Jason Volk
2b54c00f04 add config option to disable rocksdb LOG file
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-14 22:35:23 -04:00
strawberry
20efe437fb default to debug log level if using debug build
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
878dcd71bb fix invalid database code for servers_invite_via
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
59ba3e3190 only allow admins to send room state events by default (e.g. ACLs)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
27f8c5b63d don't debug log device display name for guest registrations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
71611f0ae5 nix: try lastModifiedDate for oci image created date
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
0f3f919e7b add list of passed, failed, and all complement tests
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2024-04-14 22:35:23 -04:00
strawberry
ac5dd77783 update complement Dockerfile conduwuit config sed's
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
d9ea3ffe70 raise complement test timeout to 30 minutes from 10 minutes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
ca8128b195 document commandline args for complement
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
eceef5efa2 add config option for allowing guests to auto join rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
d95c02f575 add config option for logging guest regs in admin room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
e57051acd8 run all complement tests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
f263630ac1 fix: use path_and_query() for "uri" in request_map for signatures
resolves X-Matrix signatures being invalid in some edge-cases,
and fixes Complement/Sytest federation tests

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
81f5492675 fix complement script
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
d717329448 cite banner image used by at least github repo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
068a878260 partially update differences.md, at note at the top
this is hard to maintain now, and i think conduwuit is reaching a point that
it's way too different from upstream to simply "list all the differences" out

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
168858c8de port room directory auth to new auth stuff
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
9b82551e63 bump cargo.lock due to yanked jobserver
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
Matthias Ahouansou
a0b65eda1e merge the huge authentication MR mess (reject requests with authentication when not used)
and (fix: allow invalid auth when no auth is required)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
792a8ddb2f fix rustdoc lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
Matthias Ahouansou
8eda3be9ce disable federation at the router level too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
0d21d70d4a remove two unnecessary matches
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
e5307d44ca log error for /publicRooms requests, simplify it a bit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
9b5c8c124e fix example config well_known options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
c2785038d8 add back default derive for WellKnownConfig
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
fdf523a93c bump conduwuit version to 0.1.15
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
Matthias Ahouansou
2d4877f9a5 feat(federation): implement /make_leave and /send_leave
also fixed some clippy lints, and added "event_id" field
removal check for room v1 and 2

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
bfa68e7bc5 refactor well-known stuff to use proper ruma types, config types, etc
this does deprecate the original `well_known_` prefixed config options
with a dedicated/proper config sub-block (`[config.well_known]`)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
993c0102d9 add unstable support for MSC4125
from https://gitlab.com/famedly/conduit/-/merge_requests/626 with code fixes and clippy lint fixes

MSC4125: https://github.com/matrix-org/matrix-spec-proposals/pull/4125

Co-authored-by: Matthias Ahouansou <matthias@ahouansou.cz>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
46e945d571 bump ruma, deps, and add MSC4125 ruma feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
f9e6caef87 simplify getting event content in build_and_append_pdu
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
223f05c922 mark room version 11 as stable
there's nothing unstable about this, and per upstream only unstable
room versions are used if they are complex to support (versions <=5)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
b7a2482e4d output jemalloc and hmalloc builds in CI, add back target check for cargo.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
befdc29b1e bump deps, fix repo link on cargo.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
593bad7780 remove unnecessary malloc imports, remove cargo.toml env check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
9883444486 allow unset variables in nix-build-and-cache for unset ATTIC_TOKEN
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
89c22435d5 nix: simplify malloc outputs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
354487fa10 nix: use HEAD commit's date for docker image creation and reproducible images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
a94387dcdc maybe add multiple outputs support to nix flake for jemalloc and hardened_malloc
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
10219a531b dual malloc feature check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
f6e9c106aa use hardened_malloc by default only on supported targets
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-14 22:35:23 -04:00
strawberry
ff0d4c98ee add hardened_malloc-rs feature and global_allocator
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2024-04-14 22:35:23 -04:00
Jason Volk
7d92cad55f deactivate bloom filter
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-10 12:15:34 -04:00
Jason Volk
6345742e8b tweak compaction options
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
c42209c0b3 use Arc<[u64]> rather than Arc<HashSet<u64>> for auth_chain_cache value.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
2cc72de80e fix lossy origin regression 12a8c9badd
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
458e56818c polylogarithmic debodge
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
345be5ba5e use rocksdb caches for a few of the lru_caches
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
strawberry
fc44ba6ab3 bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
839a89c968 remove some unnecessary loops
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
40596634c4 respond with actual servers for /_matrix/federation/v1/query/directory requests instead of just us
aka be spec compliant

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
973fed155e config option to allow/disallow federation profile requests
allow_profile_lookup_federation_requests

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
85814e96e3 implement unstable MSC2666 support for querying mutual rooms
https://github.com/matrix-org/matrix-spec-proposals/pull/2666

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
0dc3acea71 build zstd_compression by default for tower-http
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
9be072181c remove unneeded url preview function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
3438b340a9 remove comments, log channel errors
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
68321ec467 bump conduwuit version to 0.1.14
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
raizo
579d3ce865 replace tokio channels with loole (#256)
* rewrite admin handler to use loole channels

* apply correct formatting

* move all other services to loole channels

* fix ci
2024-04-09 15:26:45 -04:00
strawberry
c82c548cbf bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
7f14c08c34 admin command to change tracing log level dynamically
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
Jason Volk
a83da4f17b refactor rocksdb opts; split kvtree
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
bade4ed17f conf item to toggle periodic cleanup for rocksdb
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
865b5d7241 reorganize database crate.
split database Cork into unit.

split database migrations from mod.rs

Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
fe91ce0601 add conf items for rocksdb repair and read-only modes.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
Jason Volk
5f11d68616 tracing instruments for ruma state res
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-09 15:26:45 -04:00
strawberry
d92e8e170f list max cache capacity in memory-usage admin cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
72d983d2ec add admin command to fetch /.well-known/matrix/support from server
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
39946beda8 add server-side support for /.well-known/matrix/support
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
Matthias Ahouansou
c946352e7f fix(sync): send phoney leave event where room state is unknown on invite rejection
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
Matthias Ahouansou
3b5794b5bd fix(membership): check if server is in room to decide whether to do remote leaves
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
Matthias Ahouansou
6078b5ee9d fixup! feat: support /make_join and /send_join for restricted rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
Matthias Ahouansou
d8949d55c4 refactor(state_accessor): add method to check if a user can invite another user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
70ce9c299e bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-09 15:26:45 -04:00
strawberry
2516d44cb1 dont 404 and respond+update with default push rules if non-existent
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
e4a987cf80 bump ruma and declare support for unstable MSC3026 (busy presence state)
a938640491

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
db8e7e5382 TEMP: remove user_is_invited stuff
this is clearly unfinished right now

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
f0b91461a0 refactor(state_accessor): add method to check if a user can invite another user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
renovate[bot]
a8452f3ae1 chore(deps): update nixos/nix docker tag to v2.21.2 2024-04-05 22:15:16 -04:00
Matthias Ahouansou
321a6ca0fe feat(membership): check if user already has the membership that is requested to be set
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
0307cdf2b2 bump ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
1ccc777532 bump conduwuit version to 0.1.13
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Jason Volk
ebb71b7d7c add contains_url filter to /messages; also split out visibility filter.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
Jason Volk
cde06125b8 immutable cache-control for media
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
strawberry
bfd91c93e0 enable presence by default, remove presence warning
it is now very very good

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
1b84f5a855 resolve wildcard_imports and checked_conversations lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
f0a0704a93 slight adjustments, remove some explicit annotations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Jason Volk
9cc4f3e929 split main
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
Jason Volk
7f6c19f066 fix using same federation reqwest pool after sender deduplication.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
Jason Volk
ca1c77d76b refactor presence to not involve rooms.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
Jason Volk
885224ab76 add tools for user-to-server and user-to-user visibility
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
strawberry
3c2e8a5250 fix spaces test lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Jason Volk
568136296f add granular conf items for all memory caches
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
5c30d2b2b0 fix(membership): perform stricter checks when choosing an authorized user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
68e64392f0 fix(membership): remove join_authorized_via_users_server field on state update
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
172d71e365 check if user is joined in the room in user_can_invite
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
c803891634 better event_type checks for send_state_event_for_key_helper
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
0214caeaea always allow count to be filled in search response
i fail to see any reason why we would always want
this to be None

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
a2ee6b410e add another element_hacks feature check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
ab0182ace4 check if user is allowed to invite for join_authorized_via_users_server in join_room_by_id_helper
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
b9e442b694 use map_or in user_can_invite
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
ddcf43f1b8 replace ErrorKind::Forbidden with forbidden() non-exhaustive constructor
917584e0ca

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
13cd9c4c38 bump cargo.lock due to RUSTSEC-2024-0332, and bump ruma
https://rustsec.org/advisories/RUSTSEC-2024-0332

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
49eb418786 feat: support /make_join and /send_join for restricted rooms
from https://gitlab.com/famedly/conduit/-/merge_requests/618

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
Matthias Ahouansou
ed960f41ac feat: recurse relationships (and fix some lints)
from https://gitlab.com/famedly/conduit/-/merge_requests/613

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
661dba688a add trivially_copy_pass_by_ref lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
3efb3a93ca sync hierarchy over federation MR
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-05 22:15:16 -04:00
strawberry
bd69d9b565 move invalid 200 response log to info
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
strawberry
6800f91949 remove some services() usage on startup for accessing config
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
strawberry
bd117bdf0d use config.allow_local_presence instead of services()
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
strawberry
d6651ab422 remove unused import
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
K900
8134dd9151 Reduce number of separate sources of truth for presence disabled-ness
Instead of checking if we should update every time we want to update,
call the updater every time and decide internally.
2024-04-03 12:52:46 -04:00
strawberry
34fe7b7369 drop /hierarchy requests to debug
this is not helpful informational logging

```
2024-04-02T04:40:52.590444Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking thomcat.rocks for /hierarchy
2024-04-02T04:40:52.628248Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking hackingfor.eu for /hierarchy
2024-04-02T04:40:52.808526Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:52.920936Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:52.959362Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: Some("#cybersec-whonix:matrix.org"), name: Some("Whonix"), num_joined_members: 329, room_id: "!OJFkLJksWastbfdRuf:matrix.org", topic: Some("| Part of the Cybersec matrix.org community (#cyber-space:matrix.org) | RULES: https://cybersec-rules.thomcat.rocks | Whonix-focused room | Off-topic chat is fine. Keep it brief and/or move it to #cybersec-offtopic:matrix.org"), world_readable: true, guest_can_join: false, avatar_url: Some("mxc://matrix.org/DMJtrQdhQHKxeODrSibtrczX"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
2024-04-02T04:40:52.959762Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:53.109611Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: Some("#lockpicking:matrix.org"), name: Some("Lockpicking"), num_joined_members: 284, room_id: "!uEYjSxQOZnHEkiurTP:matrix.org", topic: Some("| Part of the Cybersec matrix.org community (#cyber-space:matrix.org) | RULES: https://cybersec-rules.thomcat.rocks | Off-topic chat is fine. Keep it brief and/or move it to #cybersec-offtopic:matrix.org"), world_readable: false, guest_can_join: false, avatar_url: Some("mxc://thomcat.rocks/cSeFfMLUdjymKdkUmXtIQTjf"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
2024-04-02T04:40:53.109880Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:53.261581Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: Some("#cybersec-rss:matrix.org"), name: Some("Cybersecurity-RSS"), num_joined_members: 347, room_id: "!IVHnAZkhJOhdZxlHRA:matrix.org", topic: Some("|   Part of the Cybersec matrix.org community (#cyber-space:matrix.org)   |   Suggestions to our RSS feed list welcome at #cybersecurity:matrix.org"), world_readable: true, guest_can_join: false, avatar_url: Some("mxc://thomcat.rocks/ugdubBloOkVCYxqFzdVoPwcV"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
2024-04-02T04:40:53.305166Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: Some("#cybersec-whonix:matrix.org"), name: Some("Whonix"), num_joined_members: 329, room_id: "!OJFkLJksWastbfdRuf:matrix.org", topic: Some("| Part of the Cybersec matrix.org community (#cyber-space:matrix.org) | RULES: https://cybersec-rules.thomcat.rocks | Whonix-focused room | Off-topic chat is fine. Keep it brief and/or move it to #cybersec-offtopic:matrix.org"), world_readable: true, guest_can_join: false, avatar_url: Some("mxc://matrix.org/DMJtrQdhQHKxeODrSibtrczX"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
2024-04-02T04:40:53.323257Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking thomcat.rocks for /hierarchy
2024-04-02T04:40:53.323672Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:53.369721Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Asking matrix.org for /hierarchy
2024-04-02T04:40:53.529250Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: None, name: None, num_joined_members: 1463, room_id: "!aBXqGDWIxVYeYxVbRu:matrix.org", topic: Some("| Part of the Cybersec matrix.org community (#cyber-space:matrix.org) | The room needs urgent attention? @ all the mods! | RULES: https://cybersec-rules.thomcat.rocks | \"you seem to be completely in lack of basic knowledge of how a computer or any programming language operates, to the point that any attempt of discussing any security measures is a complete waste of time\""), world_readable: false, guest_can_join: false, avatar_url: Some("mxc://thomcat.rocks/DjRWzuYjLkScQYPySYNedlFr"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
2024-04-02T04:40:53.546581Z  INFO http_request{path=/_matrix/client/v1/rooms/:room_id/hierarchy}: conduit::service::rooms::spaces: Got response from matrix.org for /hierarchy
Response { children: [], inaccessible_children: [], room: SpaceHierarchyParentSummary { canonical_alias: None, name: None, num_joined_members: 1463, room_id: "!aBXqGDWIxVYeYxVbRu:matrix.org", topic: Some("| Part of the Cybersec matrix.org community (#cyber-space:matrix.org) | The room needs urgent attention? @ all the mods! | RULES: https://cybersec-rules.thomcat.rocks | \"you seem to be completely in lack of basic knowledge of how a computer or any programming language operates, to the point that any attempt of discussing any security measures is a complete waste of time\""), world_readable: false, guest_can_join: false, avatar_url: Some("mxc://thomcat.rocks/DjRWzuYjLkScQYPySYNedlFr"), join_rule: "public", room_type: None, children_state: [], allowed_room_ids: [] } }
```

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
strawberry
667db8e8a3 output error if sending to trusted key server failed
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-03 12:52:46 -04:00
strawberry
935202eaa3 move panic = "abort" to release-high-perf build profile
i don't really want to do this but broken dependencies
are making this unavoidable

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
a20b071a8a add manual_let_else lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
Matthias Ahouansou
c31fb7134a fix: do not expect that all http requests are valid reqwest requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
Jason Volk
93a43a0eda add conf item for exact amount of startup netburst.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
0ba8d1318d move presence up two levels out of rooms.edus and rooms.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
9790477b0e move typing feature up one level out of rooms.edus.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
89a919ce75 move read_receipt feature up one level out of rooms.edus.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
22b123de7b improve tracing attributes in sending stack.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
a87e7d8e17 split out, dedup, cleanup sending service methods
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
Jason Volk
3c09313f79 move and reorganize sending codepaths; no functional changes
Signed-off-by: Jason Volk <jason@zemos.net>
2024-04-02 00:32:41 -04:00
strawberry
a72ea54d11 update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
e75fb17899 ci: dont run docker stuff if not a PR *and* both env variables are not empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
ed5be58f9f ci: only run dockerhub steps if username and token are not empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
95ca7bc3e4 move complement dir to tests dir
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
Matthias Ahouansou
2a48e562e6 fix: return error when trying to unregister unknown appservice id
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
51afde9e98 admin cmd to send a request/ping to /_matrix/federation/v1/version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
738878f6ff bump conduwuit version to 0.1.12
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
fec4b3c953 delete conduit_bin feature
i dont know what's the point of this

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
a0ad911688 stop sending make_join requests after 50 failures
this is a very generous number

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
af6c72fa84 stop sending make_join if 15 servers responded with unsupported/invalid room version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
ce414023a4 default to None room topic if invalid/redacted for spaces too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
Matthias Ahouansou
c61aee4f1c fix: reject /register requests when there is no token and the type is appservice
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
7a1a271518 dont allow m.call.invite timeline events in public rooms
also simplifies the encrypted event check (we dont
need to convert anything here)

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
renovate[bot]
71cea1c567 fix(deps): update rust crate image to 0.25.1 2024-04-02 00:32:41 -04:00
strawberry
ff3bc3fb09 on new room creations: only allow moderators to call public rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
72b60c4770 add lockdown_public_room_directory config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-04-02 00:32:41 -04:00
strawberry
00ddc1c88e generalise and cleanup docs a bit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
Jason Volk
114324e26c remove write_lock around rocksdb
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
strawberry
141a6bc73e dont panic when failing to create admin room response/PDU
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
712cdef6c7 drop url_preview_max_spider_size to 384KB
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
9cd25db955 list resolver caches in memory-usage admin cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
89e3d17e65 update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
Jason Volk
18c34434bc add outgoing federation typing and conf items
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
Jason Volk
4a57592378 add clamp util.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
Jason Volk
4becbed2a7 refactor sending interface stack
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
Jason Volk
f956e8c3b5 move and deduplicate read receipt flusher.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
strawberry
6fa2e0814c dont ignore all tracing logs for sentry
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
350d25a368 bump cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
2b3ee3bf0b set allow_incoming_presence to true by default
this is harmless and is a better UX anyways

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
f818c368c0 config options for HTTP compression on tower+reqwest
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
44435f76fe bump conduwuit version to 0.1.11
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
b437e47d8c partial tower/tower-http sentry and gzip/brotli compression
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
renovate[bot]
3103ad2205 chore(deps): update actions/configure-pages action to v5 2024-03-30 22:06:18 -04:00
strawberry
b36c397702 mark msc2285 (private read receipts) as supported
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
60623cd14b dont return bad_config for private room directory requests
this would log as an error and as HTTP 500

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
b39aa00a9b add trusted keyservers to backfill from if in room
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
babf29d217 fix sentry features, add sentry_traces_sample_rate
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
835c2112c8 dont depend on openssl, add sentry_tracing
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
47889410eb use CONDUIT_VERSION_EXTRA in endpoints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
87a7c8d9e8 add opt-in sentry logging, improve main function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
93b03fe338 use true_fn for startup_netburst option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
07135cc849 add two pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
Jason Volk
125ff21c88 add conf item to toggle startup netburst (for developers).
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
Jason Volk
3cf67f3993 disambiguate logging macros by locking log crate
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-30 22:06:18 -04:00
strawberry
cf8727a5f8 only test long_file_names_works if using sha256_media feature
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
77475dacf5 bump rocksdb, switch to fork of rocksdb, bump flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
renovate[bot]
80f624c0fb fix(deps): update rust crate serde_html_form to 0.2.6 2024-03-30 22:06:18 -04:00
strawberry
98e480ddcd revert checking appserice destination against ip_range_denylist
this is the url field in the appservice registration file,
this is almost always localhost and the admin should
be vetting the appservice registration yaml file before
registering it anyways.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
renovate[bot]
e4d1d4e86d fix(deps): update rust crate tokio to 1.37.0 2024-03-30 22:06:18 -04:00
renovate[bot]
73bdf3c5cc chore(deps): update aquasecurity/trivy-action action to v0.19.0 2024-03-30 22:06:18 -04:00
strawberry
ee3160dd1b allow manual_unwrap_or_default lint here
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
8915b6469d forbid admin room from being made public
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
38c2e5567e remove unwrap from admin room build_and_append_pdu
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
1893b45de3 propagate errors if we fail processing admin room subcommands
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
48d1a3af3c resolve the last few relevant pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
fa71dd4b4c use body.dir for relations now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
92dbe82675 remove unnecessary clone from into_iter
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
6aaf169c45 fix wrong order of logic, prefer room alias server first if available
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
e9793868ec add recursion_depth None for now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
0d50dfd7cf bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
567b24e410 add /_conduwuit/server_version route
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
4f1f6fa56f drop -alpha from version string
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-30 22:06:18 -04:00
strawberry
051668b62b use rusqlite commit before c-strings were added
this is a 1.77.0 rust feature, this would require
bumping MSRV

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
4b4b63eda4 bump cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
renovate[bot]
50c870cc1d chore(deps): update docker docker tag to v26 2024-03-26 22:24:24 -04:00
renovate[bot]
b252572db4 fix(deps): update rust crate clap to 4.5.4 2024-03-26 22:24:24 -04:00
renovate[bot]
cf474d96f0 fix(deps): update rust crate serde_json to 1.0.115 2024-03-26 22:24:24 -04:00
renovate[bot]
aa2af6bf93 chore(deps): update nixos/nix docker tag to v2.21.1 2024-03-26 22:24:24 -04:00
strawberry
53c0cfd70e docs: fix a few headlines
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
3d0f0cc1ce add query_all_nameservers config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
Jason Volk
cb12f285e9 improve incoming http request and other logging
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
Jason Volk
0df1f84cc8 set trust_negative_responses in nameserver config.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
strawberry
e6c34b982f fix git blame ignore revs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
08a21b8ee2 better maximize_fd_limit test
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
Jason Volk
edb4468771 clear destinations cache in clear_caches fn.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
strawberry
c31de51efc ignore rev 16294831 from blame
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
868976a149 use chain_width 60
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
9d6b070f35 Revert "update rustfmt"
This reverts commit e517f2bad8c8a4181f70126067ea49d8b3ad1635.
2024-03-26 22:24:24 -04:00
Jason Volk
07596d866f update rustfmt 2024-03-26 22:24:24 -04:00
Jason Volk
525379f8ac enable caching in hickory_dns w/ configurables.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
Jason Volk
21874f8ab7 eliminate gai resolver.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
Jason Volk
f5da75e476 split structs from service/globals/mod.rs into separate units
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
Jason Volk
f3bc87c4e6 elaborate on RocksDB recovery modes in example-config.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
strawberry
24faf4dd26 revert 0297cfe307
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
6f7113950b raise too-many-lines-threshold to 700 (for now?)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
3f9825788e check URL preview requests against ip_range_denylist
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
bef0459fb8 bump conduwuit version to 0.1.10
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
4be37fbe8d only remove event_id field in room v1 and v2
no this doesnt make those rooms work,
just a why not thing

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
0863bec098 allow non-joined users to get aliases of world_readable rooms
`user_can_see_state_events` checks if user is joined,
or if room visibility is world_readable

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
380b61184d reduce high presence timeouts
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
32ab88e68a check the URL and response remote address for ip_range_denylist
the previous only checked the server_name

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
fbefbd57be implement include_state search criteria
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
c2e89b939c add element web search count hack (?)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
f4146de17d add feature for smElement client hacks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
55813e90bf add EditorConfig vs code extension to recommendations
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
Jason Volk
d3c9f5595a split admin commands into modules.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
Jason Volk
6b1933914d add file listing to database abstraction.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-26 22:24:24 -04:00
strawberry
bdf3997de5 pin ruma rev
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
7bd56765ef fix some more pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
a7e6fe8b60 fix infinite loop lint
this is actually better to do CPU-wise anyways

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
8dad4461b4 log if our trusted key server is broken for batch requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-26 22:24:24 -04:00
strawberry
101cb34f9a make rocksdb_recovery_mode a u8, document it
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
331c0b37cd add conf item for alternate rocksdb recovery modes. 2024-03-23 01:49:27 -04:00
strawberry
a57f4db207 bump default_sender_timeout from 75 seconds to 180
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
27d6ce3cc5 log path parameters when try http request fails
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
6e0d6c78fb use BTreeMap again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
27d83a51f2 remove unnecessary match arm for space invite join_rule
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
renovate[bot]
8fab2cd94a fix(deps): update rust crate regex to 1.10.4 2024-03-23 01:49:27 -04:00
strawberry
7fbbdf83ab forgot to fix these ones too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
3bc2af7d26 resolve and add even more pedantic clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
0bb5115bd1 resolve clippy match_bool
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
9d0b647911 resolve couple pedantic clippy lints, remove unnecessary qualifications
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
6d7ef80aba format cargo.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
931e1cad06 ci: make docker username and GHCR variables
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
9832f11074 add zed to .gitignore
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
d8c6c2930e update differences.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
23ee479062 only allow up to info level logging on release builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
c5afc6bf98 bump ruma and bytes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
0384b48b4a add main.rs test for unix maximize_fd_limit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Charles Hall
74c34e885e allow including extra info in --version output
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
9f7431c08f remove rocksdb prefix extractor
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Timo Kösters
710a6b5c6f refactor: remove previous typing implementation and add sync wakeup for new one
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Matthias Ahouansou
60f2471f59 refactor appservice type stuff
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
7c9c5b1d78 log room for backfill_if_required requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
d7fc6874d1 Revert RocksDB 9.0.0 update
there seems to be a regression, likely from https://github.com/facebook/rocksdb/issues/12361 / https://github.com/facebook/rocksdb/pull/12309

```
[1/0/2 built] building rocksdb-9.0.0 (configurePhase): -- Detecting CXX compile features - donedirenv: ([/Users/strawberry/.nix-profile/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
error: builder for '/nix/store/9slwgpnardhn2vqzqhn361ic668n38wq-rocksdb-9.0.0.drv' failed with exit code 1;
       last 10 log lines:
       > -- Found lz4: /nix/store/cafwv4439qbm2ij04mpc7xz5m3f7mfix-lz4-1.9.4/lib/liblz4.dylib
       > CMake Error at /nix/store/bin32lqag7lx38994xpf9jvhk1xbd64c-cmake-3.28.2/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
       >   Could NOT find zstd (missing: ZSTD_INCLUDE_DIRS)
       > Call Stack (most recent call first):
       >   /nix/store/bin32lqag7lx38994xpf9jvhk1xbd64c-cmake-3.28.2/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
       >   cmake/modules/Findzstd.cmake:17 (find_package_handle_standard_args)
       >   CMakeLists.txt:167 (find_package)
       >
       >
       > -- Configuring incomplete, errors occurred!
       For full logs, run 'nix log /nix/store/9slwgpnardhn2vqzqhn361ic668n38wq-rocksdb-9.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/ir8jf2wic98iymjlk7d2i1kjjsgv15v2-nix-shell-env.drv' failed to build
```

happens in both rust-rocksdb and our fork of rust-rocksdb

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
ab5552ec6c Revert "bump rocksdb in nix flake"
This reverts commit 4475c1ba259368145a9d420791d250d875b001d5.
2024-03-23 01:49:27 -04:00
strawberry
fdb0ccc9dc bump rocksdb in nix flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
10e1801974 remove/update incorrect example config comment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
f27a2bace8 bump conduwuit version to 0.1.9
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
37c040dc77 fix incorrect v1 URL path for URL previews
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
90b8ac0c64 follow 3 redirects for federation requests instead of 2
just in case

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
33dfa64963 follow 3 redirects for URL previews instead of 6
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
713b1b23c9 document new timeout config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
9ed3e64a60 oops forgot to commit these new files
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
9334f938ae refactor reqwest client suite w/ conf items.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
Jason Volk
61b1d6d869 add corks to coalesce writes for several heavy calltrees.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
Jason Volk
3f60365cc6 add write buffer corking using rocksdb manual_wal_flush.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
Charles Hall
3969b667ba make chapter name reflect file name
Personally I think this makes more sense anyway.
2024-03-23 01:49:27 -04:00
Charles Hall
52fb4d9752 reduce scope of nixos documentation
There are so many ways to do this we realistically shouldn't bother
describing any of them, especially because people should be learning all
the options and choosing the one that suits them best anyway.

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
3059801ed8 rename Docker header
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Charles Hall
ed96bd2053 rename "simple" deployment to "generic"
The main thing this section is really useful for is explaining how to
configure various reverse proxies, which applies to basically anything.

Also, remove all the language about this being "recommended", because
nothing in this documentation is actually tested in CI.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Charles Hall
58f113451f remove section about cross compilation
It is very stale. Please just use Nix. Trying to do it outside of Nix
will be an exercise in frustration, I guarantee it.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
2e713753d5 bump ruma, rust-rocksdb, and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Charles Hall
831c452af9 avoid duplicating links in documentation
Because one might forget to update them. I did, initially, which is why
I'm making this change.
2024-03-23 01:49:27 -04:00
Charles Hall
2de47fc9c0 add mdbook to the devshell 2024-03-23 01:49:27 -04:00
renovate[bot]
99c38d2a5e fix(deps): update rust crate jsonwebtoken to 9.3.0 2024-03-23 01:49:27 -04:00
strawberry
66a36a5576 significantly drop URL preview timeouts
theres no reason for us to spend so long trying to get
a preview

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
2470fa91d8 raise connection pooling idle timeout to 50 seconds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
1e07f417ba raise get_keys_helper timeout even more
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
4dfefda03b update book.toml for conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
55708949cc slight request logging improvements
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
5ed55da0dd auto join rooms from admin room created users too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
f06f30ca2a fix wrong error message about presence
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
9715b07b38 skip rooms we have not joined before for auto-join
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
dda3b0e7e2 default to None if "name" in m.room.name is empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
3e902836cc simplify heroes get_avatar
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
7066b7b428 feat: automatically join rooms on registration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
2ca357e44c use unwrap_or_default if timestamp conversion fails
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
694986db29 check+clarify online backups are RocksDB only
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
7af78cf708 return helpful message instead of empty message if no backups
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
f9a60bf48b make database_backup_path a PathBuf
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
strawberry
5a434e7f3d make database_path a PathBuf
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
renovate[bot]
ab420e8a90 chore(deps): update docker docker tag to v25.0.5 2024-03-23 01:49:27 -04:00
strawberry
f7e8054a00 fix lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
fa942aedd7 add database backup with admin commands
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
strawberry
ece817c562 db_cache_capacity_mb defaults to 256.0 now
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
e9d67ecb53 reconfigure and optimize rocksdb options.
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
544c38341b add sync() to db abstraction for fsync(2). 2024-03-23 01:49:27 -04:00
Jason Volk
d4cfee4e71 add rocksdb env to options. keep options in engine state.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
Jason Volk
af605a03b7 add abstract fallbacks for kv batch methods.
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
strawberry
10e2eb5e08 bump rocksdb, deps, switch to hickory dns/resolver
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
renovate[bot]
5eb4010e03 fix(deps): update rust crate serde_yaml to 0.9.33 2024-03-23 01:49:27 -04:00
strawberry
a405f10f82 fix docs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-23 01:49:27 -04:00
Jason Volk
7b15f85c62 fix zealous client connection close (regression 809c9b4481)
Signed-off-by: Jason Volk <jason@zemos.net>
2024-03-23 01:49:27 -04:00
strawberry
7809f0a6ae bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
85cb559002 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
61f49ecf0e rename forbidden_room_names to forbidden_alias_names
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
5e880ac44a declare various missing server capabilities
this should fix FluffyChat password resets, and
other possible client issues that expose features
based on server capabilities.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
7f7bd91e8a add comment for future org.matrix.msc2285.stable
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
96e1938616 remove unnecessary assert for test
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
694b926366 move docs/gh pages into separate workflow
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
c8c3a9ed43 docs: s/conduit-example/conduwuit-example
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
896c372cfe disable broken assertions_on_result_states lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
2be43d3712 fix failing to register new appservice accounts
this is such a terribly named enum field.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
0301c7c083 fix Appservice AccessTokenOptional authentication type endpoints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
a2a7b81076 fix test
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
ea6425712a dont setup github pages if pull request
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
19f313b91d deploy book to github pages
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
e2827a1a79 build documentation/book in github actions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
b1b88601ab docs: dont point everyone to element
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Samuel Meenzen
e9ce642795 docs: build docs using mdBook, build in CI, deploy to gitlab pages
squashed from https://gitlab.com/famedly/conduit/-/merge_requests/604

added differences.md

Co-authored-by: Charles Hall <charles@computer.surgery>
Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
a7966b8f05 config option to allow incoming remote read receipts
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
b78d79a45a ignore deactivated users and remote user profiles wih forbidden_usernames
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
8c3f946e97 bump conduwuit version to 0.1.8
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Jason Volk
abceae26de add flush suite to sending service; trigger on read receipts.
Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Jason Volk
95ea665649 complete federation destination caching preempting getaddrinfo(3).
fixed some clippy lints and spacing adjusted

Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Jason Volk
6fe0ea05b8 add remove_batch with transaction to database abstraction.
adjusted to make building sqlite happy again

Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Jason Volk
ba03d55879 clear dns and tls-override caches from !admin command.
Signed-off-by: Jason Volk <jason@zemos.net>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
9b5c4697bf bump async-trait and ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
16572a868a slight inclusive wording changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
b079b94715 track media uploads by user
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
19135eaa58 document forbidden room aliases and usernames
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Matthias Ahouansou
e7c6b8c91b feat(spaces): hierarchy over federation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
1ecbf55d68 check allow_federation in send_federation_request
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Matthias Ahouansou
4c841cd909 refactor: check if federation is disabled inside the authcheck where possible
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
Matthias Ahouansou
c48535ef32 fix: avoid panics when admin room is not available
Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
5473631e1d admin command to see a room's full state from our database
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
de8f773620 slight wording updates
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
strawberry
b4fa306a20 remove rocksdb optimize_level_style_compaction
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-19 00:17:41 -04:00
renovate[bot]
930bf3891c fix(deps): update rust crate figment to 0.10.15 2024-03-16 11:18:07 -04:00
strawberry
8d8467a4ea add legacy v1 routes for the remaining media endpoints
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
c6cf3589f4 check if rocksdb_max_log_files is 0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
Samuel Meenzen
623478fa2d chore: add EditorConfig
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
a9059afe21 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
1c67a1da45 update README.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
99efa6d622 bump rust-rocksdb, and transitive deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
8cc23671e0 treat non-appservice registrations as None auth
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
da9fdd2a60 add unimplemented default impl to fix sqlite building
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
1bfc5336f7 remove some conditional compilation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
8e3b9a3d17 Revert "switch to hickory-dns / hickory_resolver"
This reverts commit 2ea524bfabeb20e3f2f523ca276fbb9782b6d9e9.
2024-03-16 00:09:48 -04:00
strawberry
dd1bdf0698 bump conduwuit version to 0.1.7
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
935f83af98 dont allow GetRemotePdu server to be ourselves
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
b0bee8f6ae drop sync requests to debug
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
5ea1f18776 rocksdb_max_log_files must not be 0
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
0bed5ca506 remove unnecessary variable qualifications
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
01b722beb0 add room alias server names for backfill, self check server name
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
9b2ccff7dd add room ID server_name as backfill server, make servers a vector
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
690928ec81 (hopefully?) implement AuthScheme::AppserviceToken
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
ad8d1dc68a silence unused_qualification clippys warning due to async traits
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
416c6b1778 bump ruma (cargo update)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
0ac2092888 check if federation is enabled in GetRemotePdu
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
f1507a4522 handle GetRemotePdu response as backfilled PDU
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
6c9f47a968 some more rocksdb conditional compilation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
a3c24bcc31 add rocksdb_bottommost_compression_level config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
9a9f7b9c54 add RocksDB rocksdb_compression_level and rocksdb_bottommost_compression
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
9dc4290438 split GetPdu and GetRemotePdu, handle response as incoming PDU
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
Jason Volk
10336f9af6 use WriteBatchWithTransaction for batched insertions.
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
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
Samuel Meenzen
238c371ef4 fix(ci): avoid duplicate pipelines
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
e174686eeb bump misc deps
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
ad54311c2e attempt to use example config for debian package
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
renovate[bot]
4781e232db fix(deps): update rust crate serde_html_form to 0.2.5 2024-03-16 00:09:48 -04:00
strawberry
c2317d5e83 use CFG when building on Windows
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
ccd149245f adjust dev build args to speed up builds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-16 00:09:48 -04:00
strawberry
33f0d111bc use main branch for rusqlite
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
742c869cc2 dont build default features for jemalloc
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
e435d48b6f ci: run cargo deb version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
efe6a90159 ci: run cargo audit version, run audit earlier
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
9ed7d36e8e ci: run cargo doc for all features
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
781853603c test all features in engage (CI)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
4a6d17b835 fix rocksdb hash
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
2f45ba8eac link to CI page for artifacts
i need to figure out how to do programmatic releases soon

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
bed6953601 add CI status badge to README
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
0fb87cdbf8 document we officially support various OS's
i build/develop on a mac, i have a windows machine,
my servers run linux and i do prod builds on linux,
and BSD support is generally inherent with linux
and mac.

i don't think it hurts or would be difficult for me
to say i support all of these.

upstream conduit only officially supports Linux

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
3f06725261 reformat and improve cargo.toml significantly
makes it a LOT more readable, and found some ways
to reduce unnecessary crates being built.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
04e5d2c20a document github ci in rust-toolchain.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
cd2f00e012 format flake, use rust-rocksdb fork
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-10 13:03:28 -04:00
strawberry
4d4c2cf5f8 bump conduwuit version to 0.1.6
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 18:09:41 -05: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
renovate[bot]
e4789cfc23 fix(deps): update rust crate reqwest to 0.11.25 2024-03-08 18:09:41 -05:00
strawberry
e4370b2f6f bump ruma to fix Element Android URL previews
https://github.com/ruma/ruma/pull/1743

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
strawberry
507baf20fa bump conduwuit version to 0.1.5
lots of new stuff

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
c44d317907 update DIFFERENCES.md
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
a47923820c bump rusqlite, ruma, and http
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
5a15dab7a9 bump ruma and cargo.lock
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
dd22a14147 bump CI deps (CVE-2024-27297 / GHSA-2ffj-w4mj-pg37)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
Samuel Meenzen
d593d1825b feat: run ci on demand to prevent unnecessary job executions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
f991dd381f update DIFFERENCES.md
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
3b90932cff bump deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
21f35d46c8 update DIFFERENCES.md
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
f3df9437c2 allow broken lint (?)
the braces are required. removing them like
the suggestion says breaks everything.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
5c225ccbe7 mention RocksDB Direct IO in example config
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
9c789bd82f (hopefully correct) check if ATTIC_ENDPOINT is set in gh repo vars
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
strawberry
6c7bc8d7dd add back more verbose nix build logging (-L)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
strawberry
c8289f0886 partially make other docker compose files consistent
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-08 12:51:21 -05:00
Tom Foster
37b6c1e7f7 Add extra example options 2024-03-08 12:51:21 -05:00
Charles Hall
a4ec0daafa make CI more efficient (github and gitlab)
squashed from https://gitlab.com/famedly/conduit/-/merge_requests/596

ported the relevant parts to GitHub Actions

Co-authored-by: strawberry <strawberry@puppygock.gay>
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
46b543eebe add .git-blame-ignore-revs
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
3cfa34d8b8 update config comment for rocksdb threads
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
b527ec4666 Revert "bump nix flake"
This reverts commit 68f2c637da56cc3e5c1021c5d08a979fe88dc403.
2024-03-03 22:20:37 -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
9202f18521 bump nix flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
ffcdbe2cc7 bump conduwuit version to 0.1.4, adjust example config
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
d1b919ed07 update DIFFERENCES.md
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
56f36fe7a7 add a lot more rustc and clippy workspace lints
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
6022d20797 remove useless rustfmt.toml
if it ends up being useful, add it back

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
103df55a43 dont use default features for argon2, dev build speedup
this seems to reduce a few crates when building

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
c7d950a52c update DIFFERENCES.md
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
86de649742 cargo.lock maintenance
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
strawberry
5c94c9c0d4 bump ruma and base64
base64 0.22.0 has decoding perf improvements

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
3f4f0b0d3b adjust nix build script for github actions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
dd57ce7d0c bump trivy
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
5b6d05f2db add missing CI error check, add package permission
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-03-03 22:20:37 -05:00
strawberry
9bcbccc391 bump gitlab CI nix version
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
5a8abaa54d update DIFFERENCES.md
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
strawberry
fb53849b9d adjust the nix README a bit
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
olly1240
3d4ed3e4fc Fixed nginx proxy_pass directive 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
EPS-DEV
4e2ce16bb8 docs: Fix 2 Links To Config Example 2024-02-28 11:02:08 -05:00
June
ca281b21db
document conduwuit homeserver, slight README adjustments 2024-02-26 00:49:14 -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
63fe9ef567 document nix binary cache in nix/README.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
6fc859e718 update DIFFERENCES.md and document multiple listening ports
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
0a91a3e6cc remove non-working key
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
12d2680862 disable incremental builds in CI (just to be safe)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
a9d232f064 remove a few unused deps (cargo machete)
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
443bb244fc bump ruma fork
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
5344cdbbca correct rocksdb flake version override
this was causing rocksdb to be built with
a version of 8.3.2, but pulling 8.10.0
source code.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-26 00:40:15 -05:00
strawberry
ec2092cb43 add complement CA to conduit.toml dockerfile
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
99f7dad939 bump nix (rust crate) and add either
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
43c2ac6c1c update DIFFERENCES.md
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
81b8f7c380 bump ruma and image-rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
47671606dd bump nix version in gitlab CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
99b8a568d6 add .DS_Store to gitignore (lol)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
c038da21b4 adjust complement stuff a tad
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
cc762c49e2 bump thread_local in cargo.toml
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
0972079319 raise default systemd unit start/stop timeout
default of 90 seconds can be too low if hardware is not very fast
and rocksdb compaction or shutdown takes too long

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
strawberry
5a4403fa25 bump cargo.lock due to yanked crate
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-24 13:04:13 -05:00
K900
9602fefa7e fix: update ruma commit hash 2024-02-24 11:07:26 -05:00
strawberry
0593dce8a6 add missing feature to DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -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
renovate[bot]
8fe42cb9e8 fix(deps): update rust crate serde to 1.0.197 2024-02-20 07:06:57 -05:00
renovate[bot]
ac3a3a84e2 fix(deps): update rust crate serde_json to 1.0.114 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
renovate[bot]
54728ac440 chore(deps): update nixos/nix docker tag to v2.20.2 2024-02-20 07:06:57 -05:00
renovate[bot]
a8574fdfd7 fix(deps): update rust crate serde_yaml to 0.9.32 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
ce1aae7abc update transitive png dependency
thanks to cargo audit, 0.17.12 was yanked due
to build breakage.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
620206be91 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
renovate[bot]
856ea200ac fix(deps): update rust crate ring to 0.17.8 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
strawberry
c9364dc077 dont evict admins from room, allow admins to join banned rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
ed0c8e86f7 initial implementation of banning room IDs
takes a full room ID, evicts all our users from that room,
adds room ID to banned room IDs metadata db table, and
forbids any new local users from attempting to join it.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
a92f291bbf feat: query param to return full state event or event content
query parameter `?format=event|content`

defaults to normal behaviour which is the event's content.

ruma impl: 788ea6b00f

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
b80be6c709 remove unused database function
i have no idea what this is for

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
a2f7f6fda4 prefix every admin room help cmd with -
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
strawberry
a0205cd41d implement deprecated user field for login requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-20 07:06:57 -05:00
renovate[bot]
5f007d8117 chore(deps): lock file maintenance 2024-02-16 19:30:28 -05:00
renovate[bot]
f2d4e626c0 fix(deps): update rust crate clap to 4.5.1 2024-02-16 17:40:29 -05:00
renovate[bot]
45698e310a chore(deps): lock file maintenance 2024-02-15 01:27:13 -05:00
strawberry
b1d1f3a643 add my attic binary caches
conduit and conduwuit are the same

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-15 01:18:30 -05:00
strawberry
bef1061a51 that was not a valid option
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-15 01:18:30 -05:00
strawberry
adb2059ea2 make ATTIC_TOKEN available in environment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-15 01:18:30 -05:00
strawberry
bb3d5b5d9f add cargo audit as engage task
just in case trivy is useless

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-15 01:18:30 -05:00
strawberry
359a137d2e add trivy for code and vulnerability scanning
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 20:14:21 -05:00
renovate[bot]
cf9d77d04e chore(deps): update nixos/nix docker tag to v2.20.1 2024-02-14 19:36:13 -05:00
renovate[bot]
3c675dd08e chore(deps): update docker docker tag to v25.0.3 2024-02-14 19:35:58 -05:00
renovate[bot]
aa8e534293 fix(deps): update rust crate tikv-jemallocator to 0.5.4 2024-02-14 19:35:29 -05:00
renovate[bot]
9f5b823b3a fix(deps): update rust crate tikv-jemalloc-ctl to 0.5.4 2024-02-14 19:34:02 -05:00
strawberry
62603f2348 install nix-env engage for gitlab ci
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:31:30 -05:00
strawberry
3a72193c84 move nix config to NIX_CONFIG env variable
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
33e7dafc1a fix incorrect comment about db_cache_capacity_mb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
5515d12edd make gitlab CI work for conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
63bb00d902 error if using known placeholder server_name, log if using debug build
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
d1f55b59cf fix wrong docker image in compose files
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
e09b2598ee update attic URL, upload to conduwuit too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
5d7b8cd309 think this is the correct way
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
0e7ec9f2dd update rocksdb to 8.10.0 in nix flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
strawberry
4bcedf7f4b bump rocksdb (finally)
queue the CI errors

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 19:07:08 -05:00
renovate[bot]
c66fa14002 fix(deps): update rust crate serde_yaml to 0.9.31 2024-02-14 17:34:16 -05:00
renovate[bot]
8c074d1cf9 fix(deps): update rust crate serde_json to 1.0.113 2024-02-14 17:27:48 -05:00
renovate[bot]
7a08f0754b fix(deps): update rust crate serde_html_form to 0.2.4 2024-02-14 17:23:53 -05:00
renovate[bot]
5ef46c63e6 fix(deps): update rust crate serde to 1.0.196 2024-02-14 17:22:57 -05:00
strawberry
5b31cdf1b5 ignore basically all the http dependencies we cant upgrade to
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-14 09:51:11 -05:00
Samuel Meenzen
8e03a79d35 feat: renovate all the way
Because dependabot is lazy on weekends.
2024-02-14 09:42:00 -05:00
dependabot[bot]
c98c71eb7c Bump thiserror from 1.0.56 to 1.0.57
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.56...1.0.57)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 07:23:22 -05:00
strawberry
16d384271b CI expects default features of rocksdb?
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
9724fe7d70 go back to outdated rocksdb (the fork breaks CI in a weird way now)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
4ef6c8a01a does this commit work???
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
0052d7b669 use rust-rocksdb 8f65a73f0962edc4cc028f4012692043dc657a76
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
dac8b3db49 move these config checks to main.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
0ea8657070 default to Undefined if room avatar URL was not found despite checking if its Some
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
bb1edc3f1a use zaidoon1's fork of rust-rocksdb
https://github.com/zaidoon1/rust-rocksdb

https://github.com/rust-rocksdb/rust-rocksdb/issues/855#issuecomment-1937412844

shame that this has resulted in yet another fork of software, but oh well...

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
244c1f7190 config option to check root domain with URL previews
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
54ade97f96 add expect message when failing to send oneshot channel shutdown transaction
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
6ee6217f95 update DIFFERENCES.md and debian postinst config
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
48e4b71dd1 remove hardcoded 300kb limit on spider size with config option of 1MB default
modern websites are sadly massive, 300kb is pretty low. 1MB should be enough.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
2ea895199a dont drop true error with url str parse, fix url contains logic order, clarify config comment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
7786553cda doc+check if user does not have local presence enabled if using outgoing presence
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
d069379d77 (please) dont drop true error in presence timer creation failures
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
8e6d52e7dd dont follow more than 2 redirects for URL previews for security reasons
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
fb2eba722d fix media tests for URL previews
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
Reiner Herrmann
c0dd5b1cc2 feat: URL preview support
from upstream MR https://gitlab.com/famedly/conduit/-/merge_requests/347
with the following changes (so far):
- remove hardcoded list of allowed hosts (strongly disagree with this,
even if it is desired, it should not be harcoded)
- add more allow config options for granularity via URL contains,
host contains, and domain is (explicit match) for security
- warn if a user is allowing all URLs to be previewed for security reasons
- replace an expect with proper error handling
- bump webpage to 2.0
- improved code style a tad

Co-authored-by: rooot <hey@rooot.gay>
Signed-off-by: rooot <hey@rooot.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
6f26be1c6e eat less /ban endpoint fields, fix ban reason not consistently applied
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
9be73d341c update debian systemd unit to use notify and harden/update it more
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
3ff5bc5298 ask systemd for more time when shutting down if needed, raise axum shutdown timeout to 3 mins
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
0b171a2b9c bump default max_concurrent_requests to 500, update config comment
also raise 1024 bytes to 4096 bytes in minimum max_request_size check

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
da4b509940 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
b8ab4754a5 slight wording addition
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
7ddf08e8b7 filter out "config" as it's an expected config option
this seems to exist when using `CONDUIT_CONFIG`
environment variable, this is expected.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
6996d63a02 warn if a catchall config option (unknown config option) exists
a longer way of saying: warn if a config key is unknown

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
d4d8c6eb21 check if custom room ID is apart of forbidden room alias
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
Matthias Ahouansou
fc93b29abe feat: forbid certain usernames & room aliases
squashed from https://gitlab.com/famedly/conduit/-/merge_requests/582

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
Matthias Ahouansou
784d307425 revamp appservice registration to ruma's Registration type
squashed from https://gitlab.com/famedly/conduit/-/merge_requests/583

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
Raito Bezarius
0e9eb22ee7 feat: support non-flake users
This uses flakes-compat to read the `flake.nix` and expose it
to non-flake users.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
strawberry
1f7ac6d112 update valid_until_ts comment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-02-11 21:56:55 -05:00
dependabot[bot]
e0cdcf66d3 Bump tokio from 1.35.1 to 1.36.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.35.1 to 1.36.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.35.1...tokio-1.36.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 21:08:17 -05:00
dependabot[bot]
3ac42129ac Bump reqwest from 0.11.23 to 0.11.24
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.23 to 0.11.24.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.23...v0.11.24)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-01 19:39:24 -05:00
strawberry
1157994b49 update docker README with our links
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 21:12:09 -05:00
strawberry
71d5361703 bit of repo cleanup
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 21:12:09 -05:00
strawberry
ee90f66450 remove test branch, only publish if not PR
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
03080c5677 bump ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
1b780fdbfa i think its docker.io
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
c239ff5e42 make image_name variable work, OCI uses/expects conduit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
2dd8d372de username is not secret, use conduwuit and main branch
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
4be2948afc fix syntax error, add test branch
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
29d7257a41 attempt to push OCI images to docker hub and ghcr
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 19:39:26 -05:00
strawberry
98b54caca5 remove test branch from CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:27:13 -05:00
strawberry
ab22dc4bc8 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
83f7ea54df update gh actions OCI image paths to match gitlab
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Samuel Meenzen
d8e7ea78ed Publish oci image to the gitlab registry
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Charles Hall
c33fd35c1c (upstream) update DEPLOY.md with new build links
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
25d9cc28d6 remove removing rustup and default cargo, remove building aarch64 deb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
4cebb282ab (prob doesnt work) build aarch64 deb
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
fedbe0dc66 build deb, update deb metadata and files
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
1581a3ca84 force copy
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
d11b03feab dont compress OCI images, copy result to tar.gz
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Charles Hall
621c85fd3b run cargo update
`IndexMap::remove` was deprecated in favor of explicitly named methods.
I assume that we actually needed to be using `shift_remove`, otherwise
we probably wouldn't be bothering with `indexmap` here in the first
place. I wonder if this fixes any bugs lol

from: https://gitlab.com/famedly/conduit/-/merge_requests/580

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
950d69eb66 build OCI images for x86_64 and aarch64 in CI
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
468009fce5 fix wrong artifact path in gitlab ci
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
1f3b91accd remove redundant copy and just use path
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Charles Hall
d68268da2e pass pkgsCrossStatic to mkOciImage, not pkgsHost
This fixes a bug where the aarch64 OCI image had metadata saying it was
an x86_64 OCI image. On top of that, I think the metadata was actually
right (aside from Conduit's binary): since all other packages were being
pulled from `pkgsHost`, an OCI image cross compiled for aarch64 from a
different architecture would result in unexecutable binaries (e.g. tini)
since they were compiled for the completely wrong architecture.

from: https://gitlab.com/famedly/conduit/-/merge_requests/579

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
fb1fa4364d downgrade rust-rocksdb back to latest stable
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Charles Hall
8954243457 switch crane input back to upstream
Thanks to the crane maintainer to fixing my issue in a way that doesn't
suck, unlike my attempt in the fork we were briefly using.

from: https://gitlab.com/famedly/conduit/-/merge_requests/576

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
Charles Hall
79750b9685 make complement (mostly) work again
Well, kinda. It crashed on me after 10 minutes because the tests timed
out like in <https://github.com/matrix-org/complement/issues/394>.
Sounds like this means it's a them problem though.

I want to use Nix to build this image instead in the future but this
will at least make it work for now and give me a reference for while I'm
porting it. I also want to make Conduit natively understand Complement's
requirements instead of `sed`ing a bunch of stuff and needing a reverse
proxy in the container. Should be more reliable that way.

I'm not making this run in CI until the above stuff is addressed and
until I can decide on a way to pin the revision of Complement being
tested against.

from: https://gitlab.com/famedly/conduit/-/merge_requests/575

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
bc421ec96b add -L to nix build command
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
33847b8b4b fix syntax error (both uses and run)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
77e8a6e5ae port some of artifacts building to gh actions (attempt 1)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-31 16:20:26 -05:00
strawberry
aa3fd6a47e switch cargo.toml pkg name back to conduit
we already make it clear this is a fork with
our version and such

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-27 16:47:33 -05:00
strawberry
24605e151d make allow_federation default to true
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-27 16:47:33 -05:00
Charles Hall
c329eb197d add ca certificates to the OCI image
Without this, checking the authority of TLS certificates fails, making
Conduit (rightly) refuse to connect to anything.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-27 16:47:33 -05:00
strawberry
81a4f9e539 use main instead of latest for docker tag
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-27 16:47:33 -05:00
strawberry
fd19d132eb make nix-build-and-cache executable
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 20:39:01 -05:00
strawberry
8793abf41f does this work
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 19:47:54 -05:00
strawberry
331b63ca40 upstream nix changes, make rocksdb git work
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 19:47:54 -05:00
strawberry
35ebc459fa add explicit_outlives_requirements rustc lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 19:47:54 -05:00
strawberry
5a8a3c742d s/15000/10000
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 19:47:54 -05:00
Charles Hall
620bfacc30 ci: cross compile static binaries for x86_64 and aarch64
from https://gitlab.com/famedly/conduit/-/merge_requests/569

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-26 19:47:54 -05:00
kubo6472
7588790c3b bump nix cache
Fix nodejs v16 incompatible/deprecation
2024-01-25 20:20:27 -05:00
strawberry
4ac568769b improvement: registration token now only works when registration is enabled
Co-authored-by: Timo Kösters <timo@koesters.xyz>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
ab0b52ef1e update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
8b6bd8e89e add cargo clippy
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
2c51cdc23b update nix flake for gitlab CI building docker images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
0e8267656f fix room ID messages, remove comments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
08a183e8c7 assume well-known is None if text length exceeds 10000 chars
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
Charles Hall
ec7aeb1096 move resolver logic into the resolver
Honestly not sure why it wasn't done like this before. This code is much
less awkward to follow and more compartmentalized.

These changes were mainly motivated by a clippy lint triggering on the
original code, which then made me wonder if I could get rid of some of
the `Box`ing. Turns out I could, and this is the result of that.

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
1536f08d81 use both is_ip_literal and IPAddress is_valid checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
9858b33b37 just remove double quotes if found instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
e0419d9c5d custom room ID checks, dont use format! macro due to quotes being added
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
7eff572e77 check if room ID already exists instead of erroring on auth check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
8754f0e2a5 additional character check on room alias
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
e272f0f34f update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
89d9cdeb3a IP range denylist logging, and fix logic error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
382347353e add custom room ID support using room_id field
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
2980af6490 move room creation config check higher up
dont bother wasting resources if we know we
arent even allowed to make the room to begin with

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
ead9a58dce dont crash failing to deserialise room creation content
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
3453dcc344 add error checking to room aliases
length, colon, and spaces. also dont crash.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
b51d148899 remove random space
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
6c1358d0c8 send home_server on login response again
a 6+ year old deprecated field that isnt even spelled
right, and no clients use it must still be sent
according to spec

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
9d1ca3e84a update deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
114369bcf6 delete Dockerfile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
fa0c083555 don't send requests to specified list of IP CIDRs
this can most definitely be improved but this is a decent attempt.
the only annoying this is i couldn't just use a Vec<IPAddress> which
would have significantly simplified all of this, but serde can't
deserialise it on the config side i guess.

i may find a better way to do this in the future, but this should cover
most areas anyways.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
71d247232d oops forgot that endpoint too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
6c75087863 eat less of client parameters for media requests
still cantt respect allow_redirect yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
ab6cb4ad2d switch back to expect for sender_user
as far as i can tell, it will return a normal
error in the auth token handling code so this is fine.
we also shouldnt assume all errors from this are
access_token related.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
02bc818633 match explicit URI to see if we should authenticate the user
first attempt at forcing an endpoint to be authenticated

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
1de7980143 update DIFFERENCES.md so far
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
dc9c86d3db bump ruma, rusqlite, and rocksdb
latest rocksdb now has WriteBufferManager support

i hope no one is using sqlite with conduwuit, but if they are let's
bump it to latest git too for the latest sqlite version available.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
9d0c85ab17 use ruma JsOption, bump figment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
4e8823dedb add warning about outgoing presence PDU/EDU relationship
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
1460a82f54 use engage for gitlab CI
from https://gitlab.com/famedly/conduit/-/merge_requests/564

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
11bc725268 return joined member count of room for pushrules instead of hardcoded 10
im not sure what the TODO is trying to say here,
but since it's many years old and conduwuit is
fast, i dont see an issue with this.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
b50c47e1c2 silence loud tower_http errors (move to info)
these are benign errors that are from things like
conduwuit fetching remote media from dead servers

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
34bac4d1d9 support sending well_known client response in /login using well_known_client
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
cf62cb0d0a send avatar_url on invite member events like synapse
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
f275a0dfbe fix obvious copy-paste error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
982eec178b add conduwuit-example.toml (new example config)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
fb1ade551a revamp example config, document lots of config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
a7aa91739f make warning and slight changes to DEPLOY.md for conduwuit
this is not finished yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
fae00e5136 remove rocksdb_max_open_files option
default for RocksDB is -1 and conduwuit already raises the
soft and hard nofile limits at startup.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-25 19:28:33 -05:00
strawberry
6ffc54e241 support blocking servers from fetching remote media from
akin to synapse's `prevent_media_downloads_from`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
1a06c8c9d3 more error checking for deserialising events and canonical JSON
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
c83acabfb0 return proper error if we fail to convert to canonical JSON
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
3d6b499b88 log error and PDU for failed auth checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
3ffca25f6f update few endpoint docs versions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
2bbc75d68e why did i have to run cargo fmt twice
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
de303d9480 update rust toolchain in flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
40f5345586 fix formatting and links of user reports more
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
6063a671c3 bump MSRV to 1.75.0 for latest ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
632276ae99 bump ruma to aa3acd88d21dfbb7595f54e619f52761bcb0259e
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
e944ed5eb4 fix /report endpoint a lot
in short, the `/report` endpoint now checks if:
- the reporting room in the URI matches the PDU/event reported
- sender user is in the room reported
- raises report reasoning to 750 characters (spec doesn't say to limit
these, but thorough and informative reports for server admins are not
a bad thing)
- (hopefully) fixes some broken formatting
- add a random short delay before sending a successful response to the
client to make it more annoying to enumerate for events on our server
(security by obscurity but spec suggests it)

basically, secure reports better lol

see https://spec.matrix.org/v1.9/client-server-api/#post_matrixclientv3roomsroomidreporteventid

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
7eb57a9fd5 explicitly fallback to None for invalid/empty room topics
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
1f117582ca update all transitive dependencies (cargo update)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
9a3866afff return M_INVALID_PARAM instead of M_BAD_JSON for bad room aliases
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
92641d0628 first of many small code documentation
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
ad1d272e2a fix blocks_in_conditions clippy lint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
8d42351e34 add presence options to show-config admin cmd
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
0252e9c2c7 split max build optimisations into release-high-perf build profile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
a85ebdeaa0 require sender_user being in the reporting room for /report events
Matrix 1.8 change:
https://spec.matrix.org/v1.9/client-server-api/#post_matrixclientv3roomsroomidreporteventid

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
efa6308172 actually we can remove loole (for now) and crossbeam
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
bfc738d80e default to None for room topic event in spaces or /publicRooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
ef10a2df36 add more lints, bump image and crossbeam
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
59c7f93656 fix more clippy lints (part 1)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
renovate[bot]
44440f745f chore(deps): update actions/cache action to v4 2024-01-17 12:04:47 -05:00
strawberry
2074e36aa4 add missing ban reason to ban events
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
2f16726bac raise generated passwords to 25 chars
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
2b031e40a2 partially revert keeping track of remote user profiles
this seems to require some more work to properly ignore
dead server errors without breaking the entire room join

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
149d22eef7 make set avatar, displayname, and blurhash async and forgot another let _
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
9ec1532580 ignore potential errors when updating user profiles
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
4d410d7304 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
0297cfe307 remove cached destination for a destination if request fails
this can help if users change their well-known or such and we don't want
to keep on hitting the old destination.

from 11357d1f1a

Co-authored-by: Jacob Taylor <jacob@explodie.org>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
ad792f4565 oops dedup only works on consecutive elements
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
52884abff6 don't validate or add signature if room is not v8 or above or not using restricted joins
should resolve https://github.com/matrix-org/matrix-spec/issues/1708 on
for conduwuit until spec clarifies.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
5c4b8ad7a3 replace panics on unknown room versions with errors
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
c70ce49ec0 don't allow non-local users to have their creds modified in Deactivate admin cmds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
edd74efbf2 dedup servers in get_alias_helper
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
da539efb98 only follow up to 6 redirects in default reqwest ClientBuilder
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
ae11e378d2 debug log well-known response body and text
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
14a0d12002 declare support for Matrix 1.5 in our federation requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
acc0bdad1a update rocksdb to 8.10.0
https://github.com/rust-rocksdb/rust-rocksdb/pull/852

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
424f02466c DIFFERENCES.md: suggest servers to join via at room directory
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
0b0b52c33b add all possible workspace clippy lints (with commenting out most for now)
this will be a major pain to work through. for now, let's
just add them and overtime work through these.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
49b6f338fd feat: suggest servers to join at /_matrix/client/v3/directory/room/{roomAlias}
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
da3ac7a2f1 deps updates again
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
15ffc4951e oops forgot to bump 1.70.0 in flake and gitlab dockerfile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
8e569b8d29 we also support webp images
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
6ea07da24d nix: update flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
468e5a48f3 add more stuff to DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
ee2f1c3084 the great persy, sled, and heed purge (and bump MSRV to 1.74.1)
these database backends are either unmaintained, broken in conduit, or
incredibly niche for something like conduwuit.

also i want to bump the MSRV.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
b28a2fad97 feat: keep track of remote profiles for user directory and local requests
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
ef8dcdfe3c declare explicit support for room filtering (MSC3827)
conduit has supported this for a while now and is a Matrix 1.4 feature

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
c75674faf5 bump default_presence_offline_timeout to 30 minutes (too low imo)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
966cca25f1 bump conduwuit version as we've made a lot of changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
85b2c6681b allow HEAD HTTP requests in CORS
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
20aa2cfca6 update device lists for user upon logout
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-14 20:55:56 -05:00
strawberry
830cd0e6d7 document we shutdown cleaner and safer
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-09 12:24:42 -05:00
strawberry
7021c52c9b send a User-Agent on all requests
amazing that this wasn't done in the first place. a lack of a UA is
suspicious and some providers may block our requests just for the sake
of no UA.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
strawberry
aa40e07d2d add some new things/fixes to DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
strawberry
8586b15e1a add support for serving client+server well-known and /client/server.json endpoints from conduwuit
the last endpoint is a non-standard health check endpoint used by at
least Element Web as a weird way to determine if syncv3 is available

there can also be some valid use-cases for serving well-knowns from the
application itself

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
strawberry
bb2f213ac3 more helpful panic msg on failing to increase soft/hard FD limits
this can be caused by security policies, hardening, etc

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
strawberry
1308574db0 bump ruma to latest commit (syncv3 JsOption and push optional power levels)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
strawberry
5422d0cedd declare support for various missing matrix versions
this is another one of those things that upstream has neglected

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-07 22:26:27 -05:00
dependabot[bot]
bead35d460 Bump clap from 4.4.12 to 4.4.13
Bumps [clap](https://github.com/clap-rs/clap) from 4.4.12 to 4.4.13.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.12...v4.4.13)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-06 16:17:14 -05:00
dependabot[bot]
8b57ebe9a2 Bump opentelemetry_sdk from 0.21.1 to 0.21.2
Bumps [opentelemetry_sdk](https://github.com/open-telemetry/opentelemetry-rust) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/open-telemetry/opentelemetry-rust/releases)
- [Commits](https://github.com/open-telemetry/opentelemetry-rust/compare/v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: opentelemetry_sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-06 16:17:07 -05:00
dependabot[bot]
16a0cd4ed4 Bump loole from 0.1.13 to 0.3.0
Bumps [loole](https://github.com/mahdi-shojaee/loole) from 0.1.13 to 0.3.0.
- [Commits](https://github.com/mahdi-shojaee/loole/commits)

---
updated-dependencies:
- dependency-name: loole
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-06 16:17:00 -05:00
dependabot[bot]
673febe9a4 Bump serde from 1.0.193 to 1.0.194
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.193 to 1.0.194.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.193...v1.0.194)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-06 16:16:53 -05:00
strawberry
2161630b54 raise reqwest client timeout to 300 seconds
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 16:16:44 -05:00
strawberry
3ba129e80c remove unnecessary else logic in sha256_media db migration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 16:16:44 -05:00
strawberry
3723d37b14 raise report reason limit to 500 (though spec doesnt say to limit these)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 16:16:44 -05:00
strawberry
d56e76c23e raise various timeouts, make exp backoff consistent
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 16:16:44 -05:00
strawberry
8c04dffbbd add DIFFERENCES.md (changes conduwuit makes from upstream)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 14:51:08 -05:00
strawberry
c534027fa4 revamp README.md to conduwuit
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-06 14:51:08 -05:00
dependabot[bot]
7a8aa969fa Bump thiserror from 1.0.52 to 1.0.56
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.52 to 1.0.56.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.52...1.0.56)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 19:36:40 -05:00
dependabot[bot]
c82f662e0e Bump async-trait from 0.1.75 to 0.1.77
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.75 to 0.1.77.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/commits)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 19:27:21 -05:00
dependabot[bot]
4ed6de2919 Bump figment from 0.10.12 to 0.10.13
Bumps [figment](https://github.com/SergioBenitez/Figment) from 0.10.12 to 0.10.13.
- [Commits](https://github.com/SergioBenitez/Figment/commits)

---
updated-dependencies:
- dependency-name: figment
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 19:21:23 -05:00
dependabot[bot]
796dea43cb Bump serde_json from 1.0.108 to 1.0.109
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.108 to 1.0.109.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.108...v1.0.109)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-02 19:21:15 -05:00
dependabot[bot]
712da2b354 Bump clap from 4.4.11 to 4.4.12
Bumps [clap](https://github.com/clap-rs/clap) from 4.4.11 to 4.4.12.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.11...v4.4.12)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-29 19:18:17 -05:00
dependabot[bot]
e38c595a6d Bump tokio from 1.34.0 to 1.35.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.34.0 to 1.35.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.34.0...tokio-1.35.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-27 13:20:33 -05:00
dependabot[bot]
14a880257e Bump thiserror from 1.0.51 to 1.0.52
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.51 to 1.0.52.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.51...1.0.52)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-26 18:11:29 -05:00
dependabot[bot]
56282414fe Bump serde_yaml from 0.9.27 to 0.9.29
Bumps [serde_yaml](https://github.com/dtolnay/serde-yaml) from 0.9.27 to 0.9.29.
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](https://github.com/dtolnay/serde-yaml/compare/0.9.27...0.9.29)

---
updated-dependencies:
- dependency-name: serde_yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-26 17:53:56 -05:00
dependabot[bot]
06685874b7 Bump reqwest from 0.11.22 to 0.11.23
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.22 to 0.11.23.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.22...v0.11.23)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-26 17:53:49 -05:00
strawberry
06e0360142 change welcome message
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
91c7c15bb3 log where we are listening at/on
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
7e447765fe remove warning in error message, drop 2nd error down to warn
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
09d0c13d6f remove unused config global function
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
d4c360c135 replace run_server() unwrap just to be safe
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
757ba60ff9 add comment about the blocking await above this config check
comment saying this would have been nice. moved the config checks above
that blocking call.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
071f9959a6 remove false_fn as just default alone always evaluates to false
ideally we could just do true/false but it is almost 2024 and this is
not possible in serde.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
d214371423 add option for explicit opt-in allow open registration and make it clear
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
strawberry
5e641e2886 move default rocksdb logging from info to warn
info is still logging useless database statistics and metrics that will
accumulate, less I/O activity.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 17:07:24 -05:00
dependabot[bot]
b7cfca5e7b Bump futures-util from 0.3.29 to 0.3.30
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.29 to 0.3.30.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 16:02:19 -05:00
dependabot[bot]
f1d978f139 Bump tracing from 0.1.37 to 0.1.40
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.37 to 0.1.40.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.40)

---
updated-dependencies:
- dependency-name: tracing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 16:02:12 -05:00
dependabot[bot]
49a92f08d6 Bump crossbeam from 0.8.2 to 0.8.3
Bumps [crossbeam](https://github.com/crossbeam-rs/crossbeam) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-0.8.2...crossbeam-0.8.3)

---
updated-dependencies:
- dependency-name: crossbeam
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 15:46:09 -05:00
dependabot[bot]
cb23dba67d Bump persy from 1.4.4 to 1.4.7
Bumps [persy](https://gitlab.com/tglman/persy) from 1.4.4 to 1.4.7.
- [Changelog](https://gitlab.com/tglman/persy/blob/master/release-checklist.md)
- [Commits](https://gitlab.com/tglman/persy/compare/1.4.4...1.4.7)

---
updated-dependencies:
- dependency-name: persy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 15:45:59 -05:00
strawberry
14fc20e31e cargo fmt
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-25 11:09:19 -05:00
Val Lorentz
89c3679e9a Add missing pub key in send_join handling 2023-12-25 11:09:19 -05:00
Val Lorentz
33cae7eaab Explicitly match RoomVersionId::V11 2023-12-25 11:09:19 -05:00
Val Lorentz
f3045be622 Reuse existing get_room_version 2023-12-25 11:09:19 -05:00
Nineko
fdc3e07be6
feat: replaced flaky argon2 with better argon2 crate (#37)
* feat: replaced flaky argon2 with better argon2 crate

* fix: applied cargo fmt nightly

* docs: added comment specifying what the settings for Argon2 mean

* fix: made hashing error a bit more descriptive

* fix: fixed incorrect value for Kib
2023-12-25 10:28:56 -05:00
Charles Hall
6a9f8dfa6f add shebang to .envrc
All this really does is make syntax highlighting and shellcheck work by
default in more editors.
2023-12-24 01:56:56 -05:00
Charles Hall
629efaa910 use constructor to avoid deprecation warnings 2023-12-24 01:05:13 -05:00
Charles Hall
827af38cc9 comment out heed backend; code doesn't compile 2023-12-24 01:05:13 -05:00
strawberry
5bb6128149 remove wrong else logic
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
dd8a6ede09 dont allow guest registration if registration disabled with token configured
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
6664259e64 forbid guest users from registering if no real admin user exists
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
01a8f6323d log next steps if a guest account registered and attempted to get admin
this might be an unreachable state with the next commit, but let's be
extra sure here just in case a guest still managed to register before
a real admin was created.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
c026ef77fb document allow_guest_registration in conduit-example.toml
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
dc73df763a don't grant guest users admin, slight user + guest logging improvements
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
strawberry
b0fdc1351b add config option for guest registration, make guest registration respect allow_registration
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-23 11:49:14 -05:00
dependabot[bot]
f20beae8dc Bump nix from 0.26.4 to 0.27.1
Bumps [nix](https://github.com/nix-rust/nix) from 0.26.4 to 0.27.1.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.26.4...v0.27.1)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 18:56:36 -05:00
dependabot[bot]
09f68f9f78 Bump serde_html_form from 0.2.2 to 0.2.3
Bumps [serde_html_form](https://github.com/jplatte/serde_html_form) from 0.2.2 to 0.2.3.
- [Changelog](https://github.com/jplatte/serde_html_form/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jplatte/serde_html_form/compare/v0.2.2...v0.2.3)

---
updated-dependencies:
- dependency-name: serde_html_form
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 18:39:35 -05:00
dependabot[bot]
ba40582412 Bump ring from 0.17.5 to 0.17.7
Bumps [ring](https://github.com/briansmith/ring) from 0.17.5 to 0.17.7.
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 18:32:38 -05:00
dependabot[bot]
d502357a0f Bump tracing-subscriber from 0.3.17 to 0.3.18
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.3.17 to 0.3.18.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.17...tracing-subscriber-0.3.18)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-22 18:32:28 -05:00
Charles Hall
d76ea86909 update opentelemetry things
Upstream's changelogs are unhelpful :/
2023-12-22 18:24:03 -05:00
strawberry
a3336902a0 bump rust-rockdb to latest git for 8.9.1
Co-authored-by: Charles Hall <charles@computer.surgery>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-21 22:47:28 -05:00
dependabot[bot]
b977d94261 Bump thiserror from 1.0.48 to 1.0.51
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.48 to 1.0.51.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.48...1.0.51)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 19:17:27 -05:00
dependabot[bot]
65c9b1721f Bump jsonwebtoken from 9.1.0 to 9.2.0
Bumps [jsonwebtoken](https://github.com/Keats/jsonwebtoken) from 9.1.0 to 9.2.0.
- [Changelog](https://github.com/Keats/jsonwebtoken/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Keats/jsonwebtoken/compare/v9.1.0...v9.2.0)

---
updated-dependencies:
- dependency-name: jsonwebtoken
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 19:17:06 -05:00
strawberry
b239de551d remove deprecated recommended vscode extension
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-20 23:03:18 -05:00
dependabot[bot]
b49e43d8bb Bump clap from 4.4.8 to 4.4.11
Bumps [clap](https://github.com/clap-rs/clap) from 4.4.8 to 4.4.11.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.8...v4.4.11)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 22:37:04 -05:00
dependabot[bot]
f5d2df5483 Bump async-trait from 0.1.74 to 0.1.75
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.74 to 0.1.75.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.74...0.1.75)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 22:32:46 -05:00
renovate[bot]
4db66496a8
chore: Configure Renovate (#15)
* Add renovate.json

* remove default preset, add nix, allow non-office hours

Signed-off-by: strawberry <strawberry@puppygock.gay>

* enable lockfile maintenance

Signed-off-by: strawberry <strawberry@puppygock.gay>

* will this make nix work

Signed-off-by: strawberry <strawberry@puppygock.gay>

---------

Signed-off-by: strawberry <strawberry@puppygock.gay>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: strawberry <strawberry@puppygock.gay>
2023-12-20 22:26:36 -05:00
Jakub Kubík
cc4e6e213f fix(sync): correctly update presence properties 2023-12-20 21:50:18 -05:00
Jakub Kubík
69025d30f7 style(presence): use flat_map instead of matching Results in filter 2023-12-20 21:50:13 -05:00
strawberry
e93b4aa08e fix typo
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-20 21:46:54 -05:00
dependabot[bot]
a4afe2111b Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-20 21:46:54 -05:00
strawberry
0927754d37 add dependabot
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-20 21:46:54 -05:00
strawberry
b3252dd1d4 remove old gitlab stuff and issue templates
not really important enough for us to have these right now

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-20 21:46:54 -05:00
Charles Hall
216d83ea1d run engage in github actions 2023-12-20 21:46:54 -05:00
Charles Hall
6910a68699 use engage for ci 2023-12-20 21:46:54 -05:00
Charles Hall
311c7d83ca fix rustdoc warnings
Also removed all instances of `#[command(verbatim_doc_comment)]` because
I'm pretty sure it's not necessary anymore. The `[commandbody]` things
were making rustdoc upset about broken link syntax. I also normalized
"code-block" to "code block" in that file since the latter appears more
often.
2023-12-20 21:46:54 -05:00
Charles Hall
f54dd1c0fb improve the nix flake
It's pretty much the same as it was before but now it's more better.
2023-12-20 21:46:54 -05:00
nat
118a061ac9
nix: bump inputs and update rocksdb
otherwise bindings are too new and it doesn't build
2023-12-06 22:30:08 +01:00
strawberry
8454773275 log rejected sendjoin, remove unnecessary clone
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-03 20:20:25 -05:00
strawberry
0ed891b3a1 bump version
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-03 01:16:08 -05:00
strawberry
d9d1ce3cb5 fix refering uninit static, use upstream rocksdb again, don't compile debug info
even rust-analyzer themselves don't compile with debug info because it
makes cargo checks and builds in general a lot longer. helps speed
things up and we mainly care about panics/stacktraces and compiler
errors.

https://github.com/rust-lang/rust-analyzer/blob/master/Cargo.toml#L12-L15

upstream rust-rocksdb is active again finally

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-03 01:00:23 -05:00
strawberry
4d52dd2f44 use puppy check for updates endpoint
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-02 21:45:09 -05:00
strawberry
f62f641545 add rocksdb configurable options and tweaks, logging improvements, exp. room v11 support
split out the spinning disk focused options into a configurable option, current
conduwuit users are NVMe/SSDs anyways so those options are just hindering performance.

rocksdb logging builds up overtime with no cleanup or anything, adds support for
configuring the amount of logging, size of files, log rotate, etc.
fixes https://gitlab.com/girlbossceo/conduwuit/-/issues/1

misc conduit logging improvements for help debugging issues and maybe a future feature

experimental Room V11 support from https://gitlab.com/famedly/conduit/-/merge_requests/562

Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-12-02 21:30:06 -05:00
strawberry
56e4166ee8 never let clippy fail, use CARGO_PKG_NAME, allow issues on gh, simplify regex a tad
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-11-29 23:19:53 -05:00
strawberry
1a3051eb4a remove nightly only feature, small housekeeping stuff
Signed-off-by: strawberry <strawberry@puppygock.gay>
2023-11-29 21:59:18 -05:00
strawberry
150364b07d rename to conduwuit and use proper version number
Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-29 21:37:12 -05:00
strawberry
87d6a17f0a fix all the warnings!!!! (0 clippy and rustc warnings now)
too many changes to list, codebase significantly better than it was a few weeks ago though

Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-29 21:36:02 -05:00
strawberry
20b686cac5 add some ruma features, fix futures warning
Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-27 21:34:45 -05:00
strawberry
b06ed1b92f remove # from internal room ID list
internal room IDs do not have #, they start with !

Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-27 01:35:30 -05:00
strawberry
e2ec2a98ba make rooms alias list command more nicer
room IDs in conduit have a server name attached to them already
outputting the server name again just makes it look incorrect

also add codeblock to the internal room ID portion

Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-27 01:25:20 -05:00
strawberry
54a3f47851 fix every clippy warning possible, remove io_uring as default feature
this project's codebase is so horrendous, im shocked that no one has ran
clippy at all. it had ~200 total lint warnings, some with performance
issues and unsoundness, and the rest just very ugly codebase. i have sat
down and fixed as many of these as possible and i am exhausted.
i haven't fixed some extremely complex ones, but i brought it down from
~200 to ~30.

i have also removed io_uring as a default feature due to it falling
under the same category as linux eBPF: major kernel attack surface for
minimal performance gains. this also makes it impossible to cross-compile
from macOS to Linux because io_uring does not exist in Darwin land.
there are far better ways to achieve better performance than io_uring on
the codebase level.

Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-27 00:50:55 -05:00
tezlm
19d1b484e0 split out room info into its own function 2023-11-26 22:16:38 -05:00
tezlm
c2b103514b Make commands plural 2023-11-26 22:16:38 -05:00
tezlm
5fc5076517 Room directory admin commands 2023-11-26 22:16:32 -05:00
tezlm
b30884c7ac reply to messages 2023-11-26 22:14:59 -05:00
tezlm
ebb94341c8 Admin room alias commands
- room alias set
- room alias remove
- room alias which
- room alias list
2023-11-26 22:14:59 -05:00
tezlm
6fdeec1108 Add appservice show command to show config 2023-11-26 22:14:59 -05:00
tezlm
562eaa1dea Allow using languages in code blocks.
```yaml
This works now
```
2023-11-26 22:14:59 -05:00
tezlm
3e9c564209 Rework admin commands to use subcommands.
This commit doesn't add, remove, or change any
commands, it only organizes them
2023-11-26 22:14:59 -05:00
strawberry
5106203d67 drop iouring, add 2 info logs, silence clippy warning
iouring falls into the same category as eBPF and is a major source of kernel vulnerabilities. the benefits gained here are too minimal to bother keeping this enabled, and makes cross-compiling from macOS impossible

Signed-off-by: strawberry <june@girlboss.ceo>
2023-11-26 22:14:59 -05:00
strawberry
dd544fad29 use cache_capacity_modifier for spaces/hierarchy cache
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-26 22:14:59 -05:00
strawberry
2dc1c1fdcb fix clippy performance and sus warnings, remove 1 unwrap, forgot to increment db version
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-26 22:14:43 -05:00
strawberry
b4e2f7ca37 log error for invalid room member events in db
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 20:42:38 -05:00
AndSDev
d13e3827ce feat: send push notification on invite to invited user and etc 2023-11-25 20:28:25 -05:00
strawberry
6958c720d0 make pdu stuff async, remove unnecessary db version check
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 18:29:38 -05:00
strawberry
4d7b5eb759 add version argument, move import to test body
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 15:53:33 -05:00
strawberry
8fffb6ea04 fix compilation with no zstd, use correct key, bump 2 deps
Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 15:46:03 -05:00
strawberry
0c4604b482 bump ruma, add wrong room keys error code, tiny logging change
can't update ruma to very latest commit because of the weird JsOption thing for syncv4 that i can't wrap my head around how to use, not important anyways

Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 12:42:05 -05:00
strawberry
e9cd8caaed add feature flagged support for migrating from base64 file name keys to sha256 ones
core implementation and tests from https://gitlab.com/famedly/conduit/-/merge_requests/467
feature flag, base64 encode update, and tweaks were me

Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 11:38:28 -05:00
Val Lorentz
d092820699 Fetch server keys concurrently
This speeds up handling of /_matrix/federation/v1/send/:transaction_id
when more than one event contains unknown keys.

In particular, when receiving multiple PDUs with dead servers in their
auth chain, timeouts of each server accumulate and can make handling of
incoming requests take several minutes, to the point the client closes
the connection (eg. matrix.org has a 2 minute timeout), causing new
events to be dropped eventually.
2023-11-25 11:38:28 -05:00
strawberry
87d1040386 bump various deps (except for the HTTP libs currently), use my
rust-rocksdb fork, add optional opt-in zstd response body compression
config, add webp support for images

cant upgrade things like axum, http, tower, hyper, etc due to the 1.0
release of http which are breaking all of these libs

Signed-off-by: strawberry <strawberry@pupbrain.dev>
2023-11-25 11:36:55 -05:00
girlbossceo
3533645959 bump rust-argon2
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-11-10 20:50:36 -05:00
girlbossceo
65b682c841 bump rocksdb
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-11-10 20:47:09 -05:00
girlbossceo
af1f7404f1 add notification_push_path global
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 23:43:41 -04:00
girlbossceo
16c3a38761 remove another unnecessary unwrap/expect
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 23:43:08 -04:00
girlbossceo
6931f4b778 reduce more unnecessary logging and improve a tad
dead servers in rooms are not relevant to log, keep it as info/debug

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 23:40:44 -04:00
girlbossceo
64084fb2d0 use a proper function for this instead of checking 200
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:36:47 -04:00
girlbossceo
9bb1dca5f1 mark unused variables as unusued
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:34:50 -04:00
girlbossceo
03af588efb don't unwrap reqwest requests for appservice and pushers too
this is another denial of service vector, but less severe than the federation one.

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:34:09 -04:00
girlbossceo
8b95399387 add support for modifying the default notification pusher path
this is not officially in spec yet, but who cares? matrix team certainly doesn't care.

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:31:11 -04:00
girlbossceo
b8acacfb3e use light owasp defs instead of argon2 defs
the ones now used by default in rust-argon2 are extremely aggressive and
resource intensive. owasp's 2nd default is very reasonable with the same
security.

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:15:36 -04:00
tezlm
23ec725923 remove unnecessary config overwrite
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 22:14:21 -04:00
girlbossceo
95187419f9 do not expect/unwrap requests
causes tokio runtime worker to panic as we attempt to convert an HTTP
Request from ruma (try_into_http_request) into a reqwest Request so the
reqwest http client on the server can execute said request. error
message is not ideal ("invalid port number") but core issue is fixed.

Co-authored-by: infamous <ehuff007@gmail.com>
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-28 09:05:23 -04:00
girlbossceo
8b28225af9 add lz4 to rocksdb features
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-23 22:22:42 -04:00
Rohan Kumar
d08beada62
Stop using default features for rocksdb
We only need zstd and snappy
2023-10-21 21:18:45 -07:00
Jakub Kubík
58a83f06b1 feat(presence): add granular allow configuration 2023-10-21 22:31:16 -04:00
Jakub Kubík
ba03edfae9 feat(presence): implement presence functionality 2023-10-21 22:31:06 -04:00
girlbossceo
22eff2d29c clean up few unnecessary warnings
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-21 16:15:42 -04:00
girlbossceo
05c08c8529 fix device name federation control
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-21 12:19:21 -04:00
girlbossceo
6e46f56929 error log thing
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-21 12:18:59 -04:00
girlbossceo
a3d219e401 tweak rocksdb, use direct io
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-21 12:18:41 -04:00
girlbossceo
c223f8284c bump deps, update rocksdb
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-10-21 12:18:07 -04:00
girlbossceo
e486c35faa don't skip tracing for event_handler
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-24 13:01:54 -04:00
girlbossceo
f72fd67a71 remove dbg's, update rocksdb, use iouring
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-24 10:17:26 -04:00
girlbossceo
0390d19b56 log state res error
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-24 10:17:06 -04:00
girlbossceo
28b63e913f unix sockets
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:49:53 -04:00
girlbossceo
fda30f5602 fix: add destination field authorization handler (not my commit)
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:47:37 -04:00
girlbossceo
ebd2ec45b1 fix: Do not allow fetching cached remote users' profiles over federation (nyaaori)
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:47:37 -04:00
girlbossceo
1b75d384d7 option to control federating device display names
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:47:35 -04:00
girlbossceo
81e8df3102 options to control public room directory visibility
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:46:43 -04:00
girlbossceo
76c00283de woof woof
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 21:46:41 -04:00
June
84338cc827 aggressive optimisations
Signed-off-by: June <june@girlboss.ceo>
2023-09-13 21:46:06 -04:00
June
100cae49b6 add my Cross config
Signed-off-by: June <june@girlboss.ceo>
2023-09-13 21:46:06 -04:00
Tobias Bucher
9c3b3daafc Use upstream reqwest instead of vendored one
This uses the `ClientBuilder::dns_resolver` function that was added in
reqwest 0.11.13, instead of the homebrew `ClientBuilder::resolve_fn`.
2023-09-13 21:46:06 -04:00
girlbossceo
42efc9deaf Implement UNIX sockets
Initial implementation done in https://gitlab.com/famedly/conduit/-/merge_requests/507,
*substantially* reworked, corrected, improved by infamous <ehuff007@gmail.com>,
and few parts done by me.

Co-authored-by: infamous <ehuff007@gmail.com>
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:49:02 -04:00
girlbossceo
81e68434d8 update few deps
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:39:03 -04:00
girlbossceo
618036dc31 support querying _matrix-fed and _matrix
_matrix-fed is the new IANA registered SRV record service name
per MSC4040. _matrix is now considered deprecated in Matrix 1.8.
see 3.3 and 3.4 of https://spec.matrix.org/v1.8/server-server-api/#resolving-server-names

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:36:03 -04:00
girlbossceo
6695b8d8b6 mark room versions 1 and 2 as unstable
even though these rooms would be quite broken as they typically would be
super super old rooms, people seem to still complain about conduit not
"supporting" room versions 1 and 2. to make them happy, just make them
as unstable so they can at least join it.

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:36:03 -04:00
girlbossceo
87c527ad79 remove unused trace
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:36:03 -04:00
girlbossceo
6e672a3592 mark room version 11 as unstable
Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:36:03 -04:00
girlbossceo
40908b24e7 set default room version to 10
this has been the new default since Matrix 1.6, and V10 has been flagged
as stable for a while in Conduit

Signed-off-by: girlbossceo <june@girlboss.ceo>
2023-09-13 20:36:03 -04:00
503 changed files with 61886 additions and 35188 deletions

View file

@ -4,7 +4,6 @@ tests
# Docker files
Dockerfile*
docker-compose*
# IDE files
.vscode

23
.editorconfig Normal file
View file

@ -0,0 +1,23 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
tab_width = 4
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
[*.{md,txt}]
indent_style = space
indent_size = 4
max_line_length = 80
[*.nix]
indent_size = 2
[*.rs]
indent_style = tab

8
.envrc
View file

@ -1 +1,7 @@
use flake
#!/usr/bin/env bash
dotenv_if_exists
use flake ".#${DIRENV_DEVSHELL:-default}"
PATH_add bin

7
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,7 @@
# .git-blame-ignore-revs
# adds a proper rustfmt.toml and formats the entire codebase
1d1ac065141181438e744e7d8abd0e45f75a2f91
f419c64aca300a338096b4e0db4c73ace54f23d0
# use chain_width 60
162948313c212193965dece50b816ef0903172ba
5998a0d883d31b866f7c8c46433a8857eae51a89

View file

@ -1 +1,8 @@
- [ ] I agree to release my code and all other changes of this PR under the Apache-2.0 license
<!-- Please describe your changes here -->
-----------------------------------------------------------------------------
- [ ] I ran `cargo fmt`, `cargo clippy`, and `cargo test`
- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license

264
.gitea/workflows/ci.yml Normal file
View file

@ -0,0 +1,264 @@
name: CI and Artifacts
on:
pull_request:
push:
# documentation workflow deals with this or is not relevant for this workflow
paths-ignore:
- '*.md'
- 'conduwuit-example.toml'
- 'book.toml'
- '.gitlab-ci.yml'
- '.gitignore'
- 'renovate.json'
- 'docs/**'
- 'debian/**'
- 'docker/**'
branches:
- main
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
#workflow_dispatch:
#concurrency:
# group: ${{ gitea.head_ref || gitea.ref_name }}
# cancel-in-progress: true
env:
# Required to make some things output color
TERM: ansi
# Publishing to my nix binary cache
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
# conduwuit.cachix.org
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
# Just in case incremental is still being set to true, speeds up CI
CARGO_INCREMENTAL: 0
# Custom nix binary cache if fork is being used
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
# Get error output from nix that we can actually use
NIX_CONFIG: show-trace = true
#permissions:
# packages: write
# contents: read
jobs:
tests:
name: Test
runs-on: ubuntu-latest
steps:
- name: Sync repository
uses: https://github.com/actions/checkout@v4
- name: Tag comparison check
if: startsWith(gitea.ref, 'refs/tags/v')
run: |
# Tag mismatch with latest repo tag check to prevent potential downgrades
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
if [ $LATEST_TAG != ${{ gitea.ref_name }} ]; then
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.'
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.' >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Install Nix
uses: https://github.com/DeterminateSystems/nix-installer-action@main
with:
diagnostic-endpoint: ""
extra-conf: |
experimental-features = nix-command flakes
accept-flake-config = true
- name: Enable Cachix binary cache
run: |
nix profile install nixpkgs#cachix
cachix use crane
cachix use nix-community
- name: Configure Magic Nix Cache
uses: https://github.com/DeterminateSystems/magic-nix-cache-action@main
with:
diagnostic-endpoint: ""
upstream-cache: "https://attic.kennel.juneis.dog/conduwuit"
- name: Apply Nix binary cache configuration
run: |
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
EOF
- name: Use alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
EOF
- name: Prepare build environment
run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
direnv allow
nix develop .#all-features --command true
- name: Cache CI dependencies
run: |
bin/nix-build-and-cache ci
- name: Run CI tests
run: |
direnv exec . engage > >(tee -a test_output.log)
- name: Sync Complement repository
uses: https://github.com/actions/checkout@v4
with:
repository: 'matrix-org/complement'
path: complement_src
- name: Run Complement tests
run: |
direnv exec . bin/complement 'complement_src' 'complement_test_logs.jsonl' 'complement_test_results.jsonl'
cp -v -f result complement_oci_image.tar.gz
- name: Upload Complement OCI image
uses: https://github.com/actions/upload-artifact@v4
with:
name: complement_oci_image.tar.gz
path: complement_oci_image.tar.gz
if-no-files-found: error
- name: Upload Complement logs
uses: https://github.com/actions/upload-artifact@v4
with:
name: complement_test_logs.jsonl
path: complement_test_logs.jsonl
if-no-files-found: error
- name: Upload Complement results
uses: https://github.com/actions/upload-artifact@v4
with:
name: complement_test_results.jsonl
path: complement_test_results.jsonl
if-no-files-found: error
- name: Diff Complement results with checked-in repo results
run: |
diff -u --color=always tests/test_results/complement/test_results.jsonl complement_test_results.jsonl > >(tee -a complement_test_output.log)
echo '# Complement diff results' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
tail -n 100 complement_test_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Update Job Summary
if: success() || failure()
run: |
if [ ${{ job.status }} == 'success' ]; then
echo '# ✅ completed suwuccessfully' >> $GITHUB_STEP_SUMMARY
else
echo '```' >> $GITHUB_STEP_SUMMARY
tail -n 40 test_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
build:
name: Build
runs-on: ubuntu-latest
needs: tests
strategy:
matrix:
include:
- target: aarch64-unknown-linux-musl
- target: x86_64-unknown-linux-musl
steps:
- name: Sync repository
uses: https://github.com/actions/checkout@v4
- name: Install Nix
uses: https://github.com/DeterminateSystems/nix-installer-action@main
with:
diagnostic-endpoint: ""
extra-conf: |
experimental-features = nix-command flakes
accept-flake-config = true
- name: Install and enable Cachix binary cache
run: |
nix profile install nixpkgs#cachix
cachix use crane
cachix use nix-community
- name: Configure Magic Nix Cache
uses: https://github.com/DeterminateSystems/magic-nix-cache-action@main
with:
diagnostic-endpoint: ""
upstream-cache: "https://attic.kennel.juneis.dog/conduwuit"
- name: Apply Nix binary cache configuration
run: |
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
EOF
- name: Use alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
EOF
- name: Prepare build environment
run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
direnv allow
nix develop .#all-features --command true
- name: Build static ${{ matrix.target }}
run: |
CARGO_DEB_TARGET_TUPLE=$(echo ${{ matrix.target }} | grep -o -E '^([^-]*-){3}[^-]*')
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
bin/nix-build-and-cache just .#static-${{ matrix.target }}
mkdir -v -p target/release/
mkdir -v -p target/$CARGO_DEB_TARGET_TUPLE/release/
cp -v -f result/bin/conduit target/release/conduwuit
cp -v -f result/bin/conduit target/$CARGO_DEB_TARGET_TUPLE/release/conduwuit
# -p conduit is the main crate name
direnv exec . cargo deb --verbose --no-build --no-strip -p conduit --target=$CARGO_DEB_TARGET_TUPLE --output target/release/${{ matrix.target }}.deb
mv -v target/release/conduwuit static-${{ matrix.target }}
mv -v target/release/${{ matrix.target }}.deb ${{ matrix.target }}.deb
- name: Upload static-${{ matrix.target }}
uses: https://github.com/actions/upload-artifact@v4
with:
name: static-${{ matrix.target }}
path: static-${{ matrix.target }}
if-no-files-found: error
- name: Upload deb ${{ matrix.target }}
uses: https://github.com/actions/upload-artifact@v4
with:
name: deb-${{ matrix.target }}
path: ${{ matrix.target }}.deb
if-no-files-found: error
compression-level: 0
- name: Build OCI image ${{ matrix.target }}
run: |
bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}
cp -v -f result oci-image-${{ matrix.target }}.tar.gz
- name: Upload OCI image ${{ matrix.target }}
uses: https://github.com/actions/upload-artifact@v4
with:
name: oci-image-${{ matrix.target }}
path: oci-image-${{ matrix.target }}.tar.gz
if-no-files-found: error
compression-level: 0

View file

@ -1,11 +0,0 @@
---
name: "Issue with / Feature Request for Conduit"
about: "Please file issues on GitLab: https://gitlab.com/famedly/conduit/-/issues/new"
title: "CLOSE ME"
---
**⚠️ Conduit development does not happen on GitHub. Issues opened here will not be addressed**
Please open issues on GitLab: https://gitlab.com/famedly/conduit/-/issues/new

551
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,551 @@
name: CI and Artifacts
on:
pull_request:
push:
# documentation workflow deals with this or is not relevant for this workflow
paths-ignore:
- '*.md'
- 'conduwuit-example.toml'
- 'book.toml'
- '.gitlab-ci.yml'
- '.gitignore'
- 'renovate.json'
- 'docs/**'
- 'debian/**'
- 'docker/**'
branches:
- main
- change-ci-cache
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
# sccache only on main repo
SCCACHE_GHA_ENABLED: "${{ (github.event.pull_request.draft != true) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && (vars.SCCACHE_ENDPOINT != '') && (github.event.pull_request.user.login != 'renovate[bot]') && 'true' || 'false' }}"
RUSTC_WRAPPER: "${{ (github.event.pull_request.draft != true) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && (vars.SCCACHE_ENDPOINT != '') && (github.event.pull_request.user.login != 'renovate[bot]') && 'sccache' || '' }}"
SCCACHE_BUCKET: "${{ (github.event.pull_request.draft != true) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && (vars.SCCACHE_ENDPOINT != '') && (github.event.pull_request.user.login != 'renovate[bot]') && 'sccache' || '' }}"
SCCACHE_S3_USE_SSL: ${{ vars.SCCACHE_S3_USE_SSL }}
SCCACHE_REGION: ${{ vars.SCCACHE_REGION }}
SCCACHE_ENDPOINT: ${{ vars.SCCACHE_ENDPOINT }}
SCCACHE_CACHE_MULTIARCH: ${{ vars.SCCACHE_CACHE_MULTIARCH }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Required to make some things output color
TERM: ansi
# Publishing to my nix binary cache
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
# conduwuit.cachix.org
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
# Just in case incremental is still being set to true, speeds up CI
CARGO_INCREMENTAL: 0
# Custom nix binary cache if fork is being used
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
# Get error output from nix that we can actually use, and use our binary caches for the earlier CI steps
NIX_CONFIG: |
show-trace = true
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
# complement uses libolm
NIXPKGS_ALLOW_INSECURE: 1
permissions:
packages: write
contents: read
jobs:
tests:
name: Test
runs-on: ubuntu-latest
env:
CARGO_PROFILE: "test"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: Sync repository
uses: actions/checkout@v4
- name: Tag comparison check
if: ${{ startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-rc') }}
run: |
# Tag mismatch with latest repo tag check to prevent potential downgrades
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
if [ $LATEST_TAG != ${{ github.ref_name }} ]; then
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.'
echo '# WARNING: Attempting to run this workflow for a tag that is not the latest repo tag. Aborting.' >> $GITHUB_STEP_SUMMARY
exit 1
fi
- uses: nixbuild/nix-quick-install-action@v28
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5.1.0
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 2073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
purge-last-accessed: 86400
# except the version with the `primary-key`, if it exists
purge-primary-key: never
# always save the cache
save-always: true
- name: Enable Cachix binary cache
run: |
nix profile install nixpkgs#cachix
cachix use crane
cachix use nix-community
- name: Apply Nix binary cache configuration
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
EOF
- name: Use alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
EOF
- name: Prepare build environment
run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
direnv allow
nix develop .#all-features --command true --impure
- name: Cache CI dependencies
run: |
bin/nix-build-and-cache ci
# use sccache for Rust
- name: Run sccache-cache
if: (github.event.pull_request.draft != true) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && (vars.SCCACHE_ENDPOINT != '') && (github.event.pull_request.user.login != 'renovate[bot]')
uses: mozilla-actions/sccache-action@main
# use rust-cache
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
- name: Run CI tests
run: |
direnv exec . engage > >(tee -a test_output.log)
- name: Run Complement tests
run: |
# the nix devshell sets $COMPLEMENT_SRC, so "/dev/null" is no-op
direnv exec . bin/complement "/dev/null" complement_test_logs.jsonl complement_test_results.jsonl > >(tee -a test_output.log)
cp -v -f result complement_oci_image.tar.gz
- name: Upload Complement OCI image
uses: actions/upload-artifact@v4
with:
name: complement_oci_image.tar.gz
path: complement_oci_image.tar.gz
if-no-files-found: error
- name: Upload Complement logs
uses: actions/upload-artifact@v4
with:
name: complement_test_logs.jsonl
path: complement_test_logs.jsonl
if-no-files-found: error
- name: Upload Complement results
uses: actions/upload-artifact@v4
with:
name: complement_test_results.jsonl
path: complement_test_results.jsonl
if-no-files-found: error
- name: Diff Complement results with checked-in repo results
run: |
diff -u --color=always tests/test_results/complement/test_results.jsonl complement_test_results.jsonl > >(tee -a complement_diff_output.log)
- name: Update Job Summary
if: success() || failure()
run: |
if [ ${{ job.status }} == 'success' ]; then
echo '# ✅ completed suwuccessfully' >> $GITHUB_STEP_SUMMARY
else
echo '# CI failure' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
tail -n 40 test_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '# Complement diff results' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
tail -n 100 complement_diff_output.log | sed 's/\x1b\[[0-9;]*m//g' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: Run cargo clean test artifacts
run: |
cargo clean --profile test
build:
name: Build
runs-on: ubuntu-latest
needs: tests
strategy:
matrix:
include:
- target: aarch64-unknown-linux-musl
- target: x86_64-unknown-linux-musl
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: Sync repository
uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v28
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5.1.0
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/*.nix', '**/.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 2073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
purge-last-accessed: 86400
# except the version with the `primary-key`, if it exists
purge-primary-key: never
# always save the cache
save-always: true
- name: Enable Cachix binary cache
run: |
nix profile install nixpkgs#cachix
cachix use crane
cachix use nix-community
- name: Apply Nix binary cache configuration
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
EOF
- name: Use alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
EOF
- name: Prepare build environment
run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
nix profile install --impure --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
direnv allow
nix develop .#all-features --command true --impure
# use sccache for Rust
- name: Run sccache-cache
if: (github.event.pull_request.draft != true) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && (vars.SCCACHE_ENDPOINT != '') && (github.event.pull_request.user.login != 'renovate[bot]')
uses: mozilla-actions/sccache-action@main
# use rust-cache
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
- name: Build static ${{ matrix.target }}
run: |
CARGO_DEB_TARGET_TUPLE=$(echo ${{ matrix.target }} | grep -o -E '^([^-]*-){3}[^-]*')
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features
mkdir -v -p target/release/
mkdir -v -p target/$CARGO_DEB_TARGET_TUPLE/release/
cp -v -f result/bin/conduit target/release/conduwuit
cp -v -f result/bin/conduit target/$CARGO_DEB_TARGET_TUPLE/release/conduwuit
# -p conduit is the main crate name
direnv exec . cargo deb --verbose --no-build --no-strip -p conduit --target=$CARGO_DEB_TARGET_TUPLE --output target/release/${{ matrix.target }}.deb
mv -v target/release/conduwuit static-${{ matrix.target }}
mv -v target/release/${{ matrix.target }}.deb ${{ matrix.target }}.deb
# quick smoke test of the x86_64 static release binary
- name: Run x86_64 static release binary
run: |
# GH actions default runners are x86_64 only
if file result/bin/conduit | grep x86-64; then
result/bin/conduit --version
fi
- name: Build static debug ${{ matrix.target }}
run: |
CARGO_DEB_TARGET_TUPLE=$(echo ${{ matrix.target }} | grep -o -E '^([^-]*-){3}[^-]*')
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
bin/nix-build-and-cache just .#static-${{ matrix.target }}-all-features-debug
# > warning: dev profile is not supported and will be a hard error in the future. cargo-deb is for making releases, and it doesn't make sense to use it with dev profiles.
# so we need to coerce cargo-deb into thinking this is a release binary
mkdir -v -p target/release/
mkdir -v -p target/$CARGO_DEB_TARGET_TUPLE/release/
cp -v -f result/bin/conduit target/release/conduwuit
cp -v -f result/bin/conduit target/$CARGO_DEB_TARGET_TUPLE/release/conduwuit
# -p conduit is the main crate name
direnv exec . cargo deb --verbose --no-build --no-strip -p conduit --target=$CARGO_DEB_TARGET_TUPLE --output target/release/${{ matrix.target }}-debug.deb
mv -v target/release/conduwuit static-${{ matrix.target }}-debug
mv -v target/release/${{ matrix.target }}-debug.deb ${{ matrix.target }}-debug.deb
# quick smoke test of the x86_64 static debug binary
- name: Run x86_64 static debug binary
run: |
# GH actions default runners are x86_64 only
if file result/bin/conduit | grep x86-64; then
result/bin/conduit --version
fi
# check validity of produced deb package, invalid debs will error on these commands
- name: Validate produced deb package
run: |
# List contents
dpkg-deb --contents ${{ matrix.target }}.deb
dpkg-deb --contents ${{ matrix.target }}-debug.deb
# List info
dpkg-deb --info ${{ matrix.target }}.deb
dpkg-deb --info ${{ matrix.target }}-debug.deb
- name: Upload static-${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: static-${{ matrix.target }}
path: static-${{ matrix.target }}
if-no-files-found: error
- name: Upload deb ${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: deb-${{ matrix.target }}
path: ${{ matrix.target }}.deb
if-no-files-found: error
compression-level: 0
- name: Upload static-${{ matrix.target }}-debug
uses: actions/upload-artifact@v4
with:
name: static-${{ matrix.target }}-debug
path: static-${{ matrix.target }}-debug
if-no-files-found: error
- name: Upload deb ${{ matrix.target }}-debug
uses: actions/upload-artifact@v4
with:
name: deb-${{ matrix.target }}-debug
path: ${{ matrix.target }}-debug.deb
if-no-files-found: error
compression-level: 0
- name: Build OCI image ${{ matrix.target }}
run: |
bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features
cp -v -f result oci-image-${{ matrix.target }}.tar.gz
- name: Build debug OCI image ${{ matrix.target }}
run: |
bin/nix-build-and-cache just .#oci-image-${{ matrix.target }}-all-features-debug
cp -v -f result oci-image-${{ matrix.target }}-debug.tar.gz
- name: Upload OCI image ${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: oci-image-${{ matrix.target }}
path: oci-image-${{ matrix.target }}.tar.gz
if-no-files-found: error
compression-level: 0
- name: Upload OCI image ${{ matrix.target }}-debug
uses: actions/upload-artifact@v4
with:
name: oci-image-${{ matrix.target }}-debug
path: oci-image-${{ matrix.target }}-debug.tar.gz
if-no-files-found: error
compression-level: 0
docker:
name: Docker publish
runs-on: ubuntu-latest
needs: build
if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || (github.event.pull_request.draft != true)) && (vars.DOCKER_USERNAME != '') && (vars.GITLAB_USERNAME != '') && github.event.pull_request.user.login != 'renovate[bot]'
env:
DOCKER_ARM64: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
DOCKER_AMD64: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
DOCKER_TAG: docker.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
DOCKER_BRANCH: docker.io/${{ github.repository }}:${{ (startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-rc') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
GHCR_ARM64: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
GHCR_AMD64: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
GHCR_TAG: ghcr.io/${{ github.repository }}:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
GHCR_BRANCH: ghcr.io/${{ github.repository }}:${{ (startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-rc') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
GLCR_ARM64: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-arm64v8
GLCR_AMD64: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}-amd64
GLCR_TAG: registry.gitlab.com/conduwuit/conduwuit:${{ (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}-${{ github.sha }}
GLCR_BRANCH: registry.gitlab.com/conduwuit/conduwuit:${{ (startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-rc') && 'latest') || (github.head_ref != '' && format('merge-{0}-{1}', github.event.number, github.event.pull_request.user.login)) || github.ref_name }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitLab Container Registry
if: ${{ (vars.GITLAB_USERNAME != '') && (env.GITLAB_TOKEN != '') }}
uses: docker/login-action@v3
with:
registry: registry.gitlab.com
username: ${{ vars.GITLAB_USERNAME }}
password: ${{ secrets.GITLAB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Move OCI images into position
run: |
mv -v oci-image-x86_64-unknown-linux-musl/*.tar.gz oci-image-amd64.tar.gz
mv -v oci-image-aarch64-unknown-linux-musl/*.tar.gz oci-image-arm64v8.tar.gz
mv -v oci-image-x86_64-unknown-linux-musl-debug/*.tar.gz oci-image-amd64-debug.tar.gz
mv -v oci-image-aarch64-unknown-linux-musl-debug/*.tar.gz oci-image-arm64v8-debug.tar.gz
- name: Load and push amd64 image
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
docker load -i oci-image-amd64.tar.gz
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_AMD64 }}
docker tag $(docker images -q conduit:main) ${{ env.GHCR_AMD64 }}
docker tag $(docker images -q conduit:main) ${{ env.GLCR_AMD64 }}
docker push ${{ env.DOCKER_AMD64 }}
docker push ${{ env.GHCR_AMD64 }}
docker push ${{ env.GLCR_AMD64 }}
- name: Load and push arm64 image
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
docker load -i oci-image-arm64v8.tar.gz
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_ARM64 }}
docker tag $(docker images -q conduit:main) ${{ env.GHCR_ARM64 }}
docker tag $(docker images -q conduit:main) ${{ env.GLCR_ARM64 }}
docker push ${{ env.DOCKER_ARM64 }}
docker push ${{ env.GHCR_ARM64 }}
docker push ${{ env.GLCR_ARM64 }}
- name: Load and push amd64 debug image
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
docker load -i oci-image-amd64-debug.tar.gz
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_AMD64 }}-debug
docker tag $(docker images -q conduit:main) ${{ env.GHCR_AMD64 }}-debug
docker tag $(docker images -q conduit:main) ${{ env.GLCR_AMD64 }}-debug
docker push ${{ env.DOCKER_AMD64 }}-debug
docker push ${{ env.GHCR_AMD64 }}-debug
docker push ${{ env.GLCR_AMD64 }}-debug
- name: Load and push arm64 debug image
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
docker load -i oci-image-arm64v8-debug.tar.gz
docker tag $(docker images -q conduit:main) ${{ env.DOCKER_ARM64 }}-debug
docker tag $(docker images -q conduit:main) ${{ env.GHCR_ARM64 }}-debug
docker tag $(docker images -q conduit:main) ${{ env.GLCR_ARM64 }}-debug
docker push ${{ env.DOCKER_ARM64 }}-debug
docker push ${{ env.GHCR_ARM64 }}-debug
docker push ${{ env.GLCR_ARM64 }}-debug
- name: Create Docker combined manifests
run: |
# Dockerhub Container Registry
docker manifest create ${{ env.DOCKER_TAG }} --amend ${{ env.DOCKER_ARM64 }} --amend ${{ env.DOCKER_AMD64 }}
docker manifest create ${{ env.DOCKER_BRANCH }} --amend ${{ env.DOCKER_ARM64 }} --amend ${{ env.DOCKER_AMD64 }}
# GitHub Container Registry
docker manifest create ${{ env.GHCR_TAG }} --amend ${{ env.GHCR_ARM64 }} --amend ${{ env.GHCR_AMD64 }}
docker manifest create ${{ env.GHCR_BRANCH }} --amend ${{ env.GHCR_ARM64 }} --amend ${{ env.GHCR_AMD64 }}
# GitLab Container Registry
docker manifest create ${{ env.GLCR_TAG }} --amend ${{ env.GLCR_ARM64 }} --amend ${{ env.GLCR_AMD64 }}
docker manifest create ${{ env.GLCR_BRANCH }} --amend ${{ env.GLCR_ARM64 }} --amend ${{ env.GLCR_AMD64 }}
- name: Create Docker combined debug manifests
run: |
# Dockerhub Container Registry
docker manifest create ${{ env.DOCKER_TAG }}-debug --amend ${{ env.DOCKER_ARM64 }}-debug --amend ${{ env.DOCKER_AMD64 }}-debug
docker manifest create ${{ env.DOCKER_BRANCH }}-debug --amend ${{ env.DOCKER_ARM64 }}-debug --amend ${{ env.DOCKER_AMD64 }}-debug
# GitHub Container Registry
docker manifest create ${{ env.GHCR_TAG }}-debug --amend ${{ env.GHCR_ARM64 }}-debug --amend ${{ env.GHCR_AMD64 }}-debug
docker manifest create ${{ env.GHCR_BRANCH }}-debug --amend ${{ env.GHCR_ARM64 }}-debug --amend ${{ env.GHCR_AMD64 }}-debug
# GitLab Container Registry
docker manifest create ${{ env.GLCR_TAG }}-debug --amend ${{ env.GLCR_ARM64 }}-debug --amend ${{ env.GLCR_AMD64 }}-debug
docker manifest create ${{ env.GLCR_BRANCH }}-debug --amend ${{ env.GLCR_ARM64 }}-debug --amend ${{ env.GLCR_AMD64 }}-debug
- name: Push manifests to Docker registries
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
docker manifest push ${{ env.DOCKER_TAG }}
docker manifest push ${{ env.DOCKER_BRANCH }}
docker manifest push ${{ env.GHCR_TAG }}
docker manifest push ${{ env.GHCR_BRANCH }}
docker manifest push ${{ env.GLCR_TAG }}
docker manifest push ${{ env.GLCR_BRANCH }}
docker manifest push ${{ env.DOCKER_TAG }}-debug
docker manifest push ${{ env.DOCKER_BRANCH }}-debug
docker manifest push ${{ env.GHCR_TAG }}-debug
docker manifest push ${{ env.GHCR_BRANCH }}-debug
docker manifest push ${{ env.GLCR_TAG }}-debug
docker manifest push ${{ env.GLCR_BRANCH }}-debug
- name: Add Image Links to Job Summary
if: ${{ (vars.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '') }}
run: |
echo "- \`docker pull ${{ env.DOCKER_TAG }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`docker pull ${{ env.GHCR_TAG }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`docker pull ${{ env.GLCR_TAG }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`docker pull ${{ env.DOCKER_TAG }}-debug\`" >> $GITHUB_STEP_SUMMARY
echo "- \`docker pull ${{ env.GHCR_TAG }}-debug\`" >> $GITHUB_STEP_SUMMARY
echo "- \`docker pull ${{ env.GLCR_TAG }}-debug\`" >> $GITHUB_STEP_SUMMARY

144
.github/workflows/documentation.yml vendored Normal file
View file

@ -0,0 +1,144 @@
name: Documentation and GitHub Pages
on:
pull_request:
push:
branches:
- main
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Required to make some things output color
TERM: ansi
# Publishing to my nix binary cache
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
# conduwuit.cachix.org
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
# Custom nix binary cache if fork is being used
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
# Get error output from nix that we can actually use, and use our binary caches for the earlier CI steps
NIX_CONFIG: |
show-trace = true
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
docs:
name: Documentation and GitHub Pages
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
- name: Sync repository
uses: actions/checkout@v4
- name: Setup GitHub Pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v5
- uses: nixbuild/nix-quick-install-action@v28
- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5.1.0
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 2073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
purge-last-accessed: 86400
# except the version with the `primary-key`, if it exists
purge-primary-key: never
# always save the cache
save-always: true
- name: Enable Cachix binary cache
run: |
nix profile install nixpkgs#cachix
cachix use crane
cachix use nix-community
- name: Apply Nix binary cache configuration
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = https://attic.kennel.juneis.dog/conduit https://attic.kennel.juneis.dog/conduwuit https://cache.lix.systems https://conduwuit.cachix.org
extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk= conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE= cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o= conduwuit.cachix.org-1:MFRm6jcnfTf0jSAbmvLfhO3KBMt4px+1xaereWXp8Xg=
EOF
- name: Use alternative Nix binary caches if specified
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
run: |
sudo tee -a "${XDG_CONFIG_HOME:-$HOME/.config}/nix/nix.conf" > /dev/null <<EOF
extra-substituters = ${{ env.ATTIC_ENDPOINT }}
extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}
EOF
- name: Prepare build environment
run: |
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
nix profile install --inputs-from . nixpkgs#direnv nixpkgs#nix-direnv
direnv allow
nix develop --command true
- name: Cache CI dependencies
run: |
bin/nix-build-and-cache ci
- name: Run lychee and markdownlint
run: |
direnv exec . engage just lints lychee
direnv exec . engage just lints markdownlint
- name: Build documentation (book)
run: |
bin/nix-build-and-cache just .#book
cp -r --dereference result public
- name: Upload generated documentation (book) as normal artifact
uses: actions/upload-artifact@v4
with:
name: public
path: public
if-no-files-found: error
# don't compress again
compression-level: 0
- name: Upload generated documentation (book) as GitHub Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: public
- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request'
id: deployment
uses: actions/deploy-pages@v4

42
.github/workflows/trivy.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Trivy code and vulnerability scanning
on:
pull_request:
push:
branches:
- main
tags:
- '*'
schedule:
- cron: '00 12 * * *'
permissions:
contents: read
jobs:
trivy-scan:
name: Trivy Scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy code and vulnerability scanner on repo
uses: aquasecurity/trivy-action@0.24.0
with:
scan-type: repo
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH,MEDIUM,LOW
- name: Run Trivy code and vulnerability scanner on filesystem
uses: aquasecurity/trivy-action@0.24.0
with:
scan-type: fs
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH,MEDIUM,LOW

27
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Local environment overrides
/.env
# CMake
cmake-build-*/
@ -68,3 +71,27 @@ cached_target
# Direnv cache
/.direnv
test-conduit/
test-conduit.toml
# Gitlab CI cache
/.gitlab-ci.d
# mdbook output
public/
# macOS
.DS_Store
# VS Code
.vscode/
# Zed
.zed/
# idk where you're coming from, but i'm tired of you
rustc-ice-*
# complement test logs are huge
tests/test_results/complement/test_logs.jsonl

View file

@ -1,244 +1,144 @@
stages:
- build
- build docker image
- test
- upload artifacts
- ci
- artifacts
- publish
variables:
# Make GitLab CI go fast:
GIT_SUBMODULE_STRATEGY: recursive
FF_USE_FASTZIP: 1
CACHE_COMPRESSION_LEVEL: fastest
# --------------------------------------------------------------------- #
# Create and publish docker image #
# --------------------------------------------------------------------- #
.docker-shared-settings:
stage: "build docker image"
needs: []
tags: [ "docker" ]
variables:
# Docker in Docker:
DOCKER_BUILDKIT: 1
image:
name: docker.io/docker
services:
- name: docker.io/docker:dind
alias: docker
script:
- apk add openssh-client
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- printf "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config
- sh .gitlab/setup-buildx-remote-builders.sh
# Authorize against this project's own image registry:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Build multiplatform image and push to temporary tag:
- >
docker buildx build
--platform "linux/arm/v7,linux/arm64,linux/amd64"
--pull
--tag "$CI_REGISTRY_IMAGE/temporary-ci-images:$CI_JOB_ID"
--push
--provenance=false
--file "Dockerfile" .
# Build multiplatform image to deb stage and extract their .deb files:
- >
docker buildx build
--platform "linux/arm/v7,linux/arm64,linux/amd64"
--target "packager-result"
--output="type=local,dest=/tmp/build-output"
--provenance=false
--file "Dockerfile" .
# Build multiplatform image to binary stage and extract their binaries:
- >
docker buildx build
--platform "linux/arm/v7,linux/arm64,linux/amd64"
--target "builder-result"
--output="type=local,dest=/tmp/build-output"
--provenance=false
--file "Dockerfile" .
# Copy to GitLab container registry:
- >
docker buildx imagetools create
--tag "$CI_REGISTRY_IMAGE/$TAG"
--tag "$CI_REGISTRY_IMAGE/$TAG-bullseye"
--tag "$CI_REGISTRY_IMAGE/$TAG-commit-$CI_COMMIT_SHORT_SHA"
"$CI_REGISTRY_IMAGE/temporary-ci-images:$CI_JOB_ID"
# if DockerHub credentials exist, also copy to dockerhub:
- if [ -n "${DOCKER_HUB}" ]; then docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD" "$DOCKER_HUB"; fi
- >
if [ -n "${DOCKER_HUB}" ]; then
docker buildx imagetools create
--tag "$DOCKER_HUB_IMAGE/$TAG"
--tag "$DOCKER_HUB_IMAGE/$TAG-bullseye"
--tag "$DOCKER_HUB_IMAGE/$TAG-commit-$CI_COMMIT_SHORT_SHA"
"$CI_REGISTRY_IMAGE/temporary-ci-images:$CI_JOB_ID"
; fi
- mv /tmp/build-output ./
artifacts:
paths:
- "./build-output/"
docker:next:
extends: .docker-shared-settings
rules:
- if: '$BUILD_SERVER_SSH_PRIVATE_KEY && $CI_COMMIT_BRANCH == "next"'
variables:
TAG: "matrix-conduit:next"
docker:master:
extends: .docker-shared-settings
rules:
- if: '$BUILD_SERVER_SSH_PRIVATE_KEY && $CI_COMMIT_BRANCH == "master"'
variables:
TAG: "matrix-conduit:latest"
docker:tags:
extends: .docker-shared-settings
rules:
- if: "$BUILD_SERVER_SSH_PRIVATE_KEY && $CI_COMMIT_TAG"
variables:
TAG: "matrix-conduit:$CI_COMMIT_TAG"
docker build debugging:
extends: .docker-shared-settings
rules:
- if: "$CI_MERGE_REQUEST_TITLE =~ /.*[Dd]ocker.*/"
variables:
TAG: "matrix-conduit-docker-tests:latest"
# --------------------------------------------------------------------- #
# Run tests #
# --------------------------------------------------------------------- #
cargo check:
stage: test
image: docker.io/rust:1.70.0-bullseye
needs: []
interruptible: true
before_script:
- "rustup show && rustc --version && cargo --version" # Print version info for debugging
- apt-get update && apt-get -y --no-install-recommends install libclang-dev # dependency for rocksdb
script:
- cargo check
.test-shared-settings:
stage: "test"
needs: []
image: "registry.gitlab.com/jfowl/conduit-containers/rust-with-tools:latest"
tags: ["docker"]
variables:
CARGO_INCREMENTAL: "false" # https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
interruptible: true
test:cargo:
extends: .test-shared-settings
before_script:
- apt-get update && apt-get -y --no-install-recommends install libclang-dev # dependency for rocksdb
script:
- rustc --version && cargo --version # Print version info for debugging
- "cargo test --color always --workspace --verbose --locked --no-fail-fast"
test:clippy:
extends: .test-shared-settings
allow_failure: true
before_script:
- rustup component add clippy
- apt-get update && apt-get -y --no-install-recommends install libclang-dev # dependency for rocksdb
script:
- rustc --version && cargo --version # Print version info for debugging
- "cargo clippy --color always --verbose --message-format=json | gitlab-report -p clippy > $CI_PROJECT_DIR/gl-code-quality-report.json"
artifacts:
when: always
reports:
codequality: gl-code-quality-report.json
test:format:
extends: .test-shared-settings
before_script:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check
test:audit:
extends: .test-shared-settings
allow_failure: true
script:
- cargo audit --color always || true
- cargo audit --stale --json | gitlab-report -p audit > gl-sast-report.json
artifacts:
when: always
reports:
sast: gl-sast-report.json
test:dockerlint:
stage: "test"
needs: []
image: "ghcr.io/hadolint/hadolint@sha256:6c4b7c23f96339489dd35f21a711996d7ce63047467a9a562287748a03ad5242" # 2.8.0-alpine
interruptible: true
script:
- hadolint --version
# First pass: Print for CI log:
- >
hadolint
--no-fail --verbose
./Dockerfile
# Then output the results into a json for GitLab to pretty-print this in the MR:
- >
hadolint
--format gitlab_codeclimate
--failure-threshold error
./Dockerfile > dockerlint.json
artifacts:
when: always
reports:
codequality: dockerlint.json
paths:
- dockerlint.json
rules:
- if: '$CI_COMMIT_REF_NAME != "master"'
changes:
- docker/*Dockerfile
- Dockerfile
- .gitlab-ci.yml
- if: '$CI_COMMIT_REF_NAME == "master"'
- if: '$CI_COMMIT_REF_NAME == "next"'
# --------------------------------------------------------------------- #
# Store binaries as package so they have download urls #
# --------------------------------------------------------------------- #
# DISABLED FOR NOW, NEEDS TO BE FIXED AT A LATER TIME:
#publish:package:
# stage: "upload artifacts"
# needs:
# - "docker:tags"
# rules:
# - if: "$CI_COMMIT_TAG"
# image: curlimages/curl:latest
# tags: ["docker"]
# variables:
# GIT_STRATEGY: "none" # Don't need a clean copy of the code, we just operate on artifacts
# script:
# - 'BASE_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conduit-${CI_COMMIT_REF_SLUG}/build-${CI_PIPELINE_ID}"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_amd64/conduit "${BASE_URL}/conduit-x86_64-unknown-linux-gnu"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_arm_v7/conduit "${BASE_URL}/conduit-armv7-unknown-linux-gnu"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_arm64/conduit "${BASE_URL}/conduit-aarch64-unknown-linux-gnu"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_amd64/conduit.deb "${BASE_URL}/conduit-x86_64-unknown-linux-gnu.deb"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_arm_v7/conduit.deb "${BASE_URL}/conduit-armv7-unknown-linux-gnu.deb"'
# - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build-output/linux_arm64/conduit.deb "${BASE_URL}/conduit-aarch64-unknown-linux-gnu.deb"'
# Makes some things print in color
TERM: ansi
# Faster cache and artifact compression / decompression
FF_USE_FASTZIP: true
# Print progress reports for cache and artifact transfers
TRANSFER_METER_FREQUENCY: 5s
# Avoid duplicate pipelines
# See: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: "$CI_COMMIT_BRANCH"
- if: "$CI_COMMIT_TAG"
- if: $CI
before_script:
# Enable nix-command and flakes
- if command -v nix > /dev/null; then echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf; fi
# Add conduwuit binary cache
- if command -v nix > /dev/null; then echo "extra-substituters = https://attic.kennel.juneis.dog/conduwuit" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE=" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-substituters = https://attic.kennel.juneis.dog/conduit" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk=" >> /etc/nix/nix.conf; fi
# Add alternate binary cache
- if command -v nix > /dev/null && [ -n "$ATTIC_ENDPOINT" ]; then echo "extra-substituters = $ATTIC_ENDPOINT" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null && [ -n "$ATTIC_PUBLIC_KEY" ]; then echo "extra-trusted-public-keys = $ATTIC_PUBLIC_KEY" >> /etc/nix/nix.conf; fi
# Add Lix binary cache
- if command -v nix > /dev/null; then echo "extra-substituters = https://cache.lix.systems" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" >> /etc/nix/nix.conf; fi
# Add crane binary cache
- if command -v nix > /dev/null; then echo "extra-substituters = https://crane.cachix.org" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=" >> /etc/nix/nix.conf; fi
# Add nix-community binary cache
- if command -v nix > /dev/null; then echo "extra-substituters = https://nix-community.cachix.org" >> /etc/nix/nix.conf; fi
- if command -v nix > /dev/null; then echo "extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" >> /etc/nix/nix.conf; fi
# Install direnv and nix-direnv
- if command -v nix > /dev/null; then nix-env -iA nixpkgs.direnv nixpkgs.nix-direnv; fi
# Allow .envrc
- if command -v nix > /dev/null; then direnv allow; fi
# Set CARGO_HOME to a cacheable path
- export CARGO_HOME="$(git rev-parse --show-toplevel)/.gitlab-ci.d/cargo"
ci:
stage: ci
image: nixos/nix:2.24.9
script:
# Cache CI dependencies
- ./bin/nix-build-and-cache ci
- direnv exec . engage
cache:
key: nix
paths:
- target
- .gitlab-ci.d
rules:
# CI on upstream runners (only available for maintainers)
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $IS_UPSTREAM_CI == "true"
# Manual CI on unprotected branches that are not MRs
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_REF_PROTECTED == "false"
when: manual
# Manual CI on forks
- if: $IS_UPSTREAM_CI != "true"
when: manual
- if: $CI
interruptible: true
artifacts:
stage: artifacts
image: nixos/nix:2.24.9
script:
- ./bin/nix-build-and-cache just .#static-x86_64-unknown-linux-musl
- cp result/bin/conduit x86_64-unknown-linux-musl
- mkdir -p target/release
- cp result/bin/conduit target/release
- direnv exec . cargo deb --no-build --no-strip
- mv target/debian/*.deb x86_64-unknown-linux-musl.deb
# Since the OCI image package is based on the binary package, this has the
# fun side effect of uploading the normal binary too. Conduit users who are
# deploying with Nix can leverage this fact by adding our binary cache to
# their systems.
#
# Note that although we have an `oci-image-x86_64-unknown-linux-musl`
# output, we don't build it because it would be largely redundant to this
# one since it's all containerized anyway.
- ./bin/nix-build-and-cache just .#oci-image
- cp result oci-image-amd64.tar.gz
- ./bin/nix-build-and-cache just .#static-aarch64-unknown-linux-musl
- cp result/bin/conduit aarch64-unknown-linux-musl
- ./bin/nix-build-and-cache just .#oci-image-aarch64-unknown-linux-musl
- cp result oci-image-arm64v8.tar.gz
- ./bin/nix-build-and-cache just .#book
# We can't just copy the symlink, we need to dereference it https://gitlab.com/gitlab-org/gitlab/-/issues/19746
- cp -r --dereference result public
artifacts:
paths:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl.deb
- oci-image-amd64.tar.gz
- oci-image-arm64v8.tar.gz
- public
rules:
# CI required for all MRs
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Optional CI on forks
- if: $IS_UPSTREAM_CI != "true"
when: manual
allow_failure: true
- if: $CI
interruptible: true
pages:
stage: publish
dependencies:
- artifacts
only:
- next
script:
- "true"
artifacts:
paths:
- public

View file

@ -1,5 +0,0 @@
# Nix things
.envrc @CobaltCause
flake.lock @CobaltCause
flake.nix @CobaltCause
nix/ @CobaltCause

View file

@ -1,19 +0,0 @@
<!--
If you're requesting a new feature, that isn't part of this project yet,
then please consider filling out a "Feature Request" instead!
If you need a hand setting up your conduit server, feel free to ask for help in the
Conduit Matrix Chat: https://matrix.to/#/#conduit:fachschaften.org.
-->
### Description
<!-- What did you do and what happened? Why is that bad? -->
### System Configuration
<!-- Other data that might help us debug this issue, like os, conduit version, database backend -->
Conduit Version:
Database backend (default is sqlite): sqlite
/label ~conduit

View file

@ -1,17 +0,0 @@
<!--
If you want to report a bug or an error,
then please consider filling out a "Bug Report" instead!
-->
### Is your feature request related to a problem? Please describe.
<!-- Eg. I'm always frustrated when [...] -->
### Describe the solution you'd like
/label ~conduit

View file

@ -3,6 +3,6 @@
-----------------------------------------------------------------------------
- [ ] I ran `cargo fmt` and `cargo test`
- [ ] I ran `cargo fmt`, `cargo clippy`, and `cargo test`
- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license

3
.gitlab/route-map.yml Normal file
View file

@ -0,0 +1,3 @@
# Docs: Map markdown to html files
- source: /docs/(.+)\.md/
public: '\1.html'

View file

@ -1,37 +0,0 @@
#!/bin/sh
set -eux
# --------------------------------------------------------------------- #
# #
# Configures docker buildx to use a remote server for arm building. #
# Expects $SSH_PRIVATE_KEY to be a valid ssh ed25519 private key with #
# access to the server $ARM_SERVER_USER@$ARM_SERVER_IP #
# #
# This is expected to only be used in the official CI/CD pipeline! #
# #
# Requirements: openssh-client, docker buildx #
# Inspired by: https://depot.dev/blog/building-arm-containers #
# #
# --------------------------------------------------------------------- #
cat "$BUILD_SERVER_SSH_PRIVATE_KEY" | ssh-add -
# Test server connections:
ssh "$ARM_SERVER_USER@$ARM_SERVER_IP" "uname -a"
ssh "$AMD_SERVER_USER@$AMD_SERVER_IP" "uname -a"
# Connect remote arm64 server for all arm builds:
docker buildx create \
--name "multi" \
--driver "docker-container" \
--platform "linux/arm64,linux/arm/v7" \
"ssh://$ARM_SERVER_USER@$ARM_SERVER_IP"
# Connect remote amd64 server for adm64 builds:
docker buildx create --append \
--name "multi" \
--driver "docker-container" \
--platform "linux/amd64" \
"ssh://$AMD_SERVER_USER@$AMD_SERVER_IP"
docker buildx use multi

1
.markdownlintignore Symbolic link
View file

@ -0,0 +1 @@
.gitignore

View file

@ -1,11 +0,0 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"bungcip.better-toml",
"ms-azuretools.vscode-docker",
"eamodio.gitlens",
"serayuzgur.crates",
"vadimcn.vscode-lldb",
"timonwong.shellcheck"
]
}

35
.vscode/launch.json vendored
View file

@ -1,35 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug conduit",
"sourceLanguages": ["rust"],
"cargo": {
"args": [
"build",
"--bin=conduit",
"--package=conduit"
],
"filter": {
"name": "conduit",
"kind": "bin"
}
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"CONDUIT_CONFIG": "",
"CONDUIT_SERVER_NAME": "localhost",
"CONDUIT_DATABASE_PATH": "/tmp",
"CONDUIT_ADDRESS": "0.0.0.0",
"CONDUIT_PORT": "6167"
},
"cwd": "${workspaceFolder}"
}
]
}

View file

@ -1,61 +0,0 @@
# Setting up Appservices
## Getting help
If you run into any problems while setting up an Appservice, write an email to `timo@koesters.xyz`, ask us in [#conduit:fachschaften.org](https://matrix.to/#/#conduit:fachschaften.org) or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new).
## Set up the appservice - general instructions
Follow whatever instructions are given by the appservice. This usually includes
downloading, changing its config (setting domain, homeserver url, port etc.)
and later starting it.
At some point the appservice guide should ask you to add a registration yaml
file to the homeserver. In Synapse you would do this by adding the path to the
homeserver.yaml, but in Conduit you can do this from within Matrix:
First, go into the #admins room of your homeserver. The first person that
registered on the homeserver automatically joins it. Then send a message into
the room like this:
@conduit:your.server.name: register-appservice
```
paste
the
contents
of
the
yaml
registration
here
```
You can confirm it worked by sending a message like this:
`@conduit:your.server.name: list-appservices`
The @conduit bot should answer with `Appservices (1): your-bridge`
Then you are done. Conduit will send messages to the appservices and the
appservice can send requests to the homeserver. You don't need to restart
Conduit, but if it doesn't work, restarting while the appservice is running
could help.
## Appservice-specific instructions
### Remove an appservice
To remove an appservice go to your admin room and execute
`@conduit:your.server.name: unregister-appservice <name>`
where `<name>` one of the output of `list-appservices`.
### Tested appservices
These appservices have been tested and work with Conduit without any extra steps:
- [matrix-appservice-discord](https://github.com/Half-Shot/matrix-appservice-discord)
- [mautrix-hangouts](https://github.com/mautrix/hangouts/)
- [mautrix-telegram](https://github.com/mautrix/telegram/)
- [mautrix-signal](https://github.com/mautrix/signal/) from version `0.2.2` forward.
- [heisenbridge](https://github.com/hifi/heisenbridge/)

View file

@ -61,7 +61,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement over email at
coc@koesters.xyz or over Matrix at @timo:conduit.rs.
<strawberry@puppygock.gay> or over Matrix at @strawberry:puppygock.gay.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
@ -131,4 +131,3 @@ For answers to common questions about this code of conduct, see the FAQ at
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

148
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,148 @@
# Contributing guide
This page is for about contributing to conduwuit. The
[development](./development.md) page may be of interest for you as well.
If you would like to work on an [issue][issues] that is not assigned, preferably
ask in the Matrix room first at [#conduwuit:puppygock.gay][conduwuit-matrix],
and comment on it.
### Linting and Formatting
It is mandatory all your changes satisfy the lints (clippy, rustc, rustdoc, etc)
and your code is formatted via the **nightly** `cargo fmt`. A lot of the
`rustfmt.toml` features depend on nightly toolchain. It would be ideal if they
weren't nightly-exclusive features, but they currently still are. CI's rustfmt
uses nightly.
If you need to allow a lint, please make sure it's either obvious as to why
(e.g. clippy saying redundant clone but it's actually required) or it has a
comment saying why. Do not write inefficient code for the sake of satisfying
lints. If a lint is wrong and provides a more inefficient solution or
suggestion, allow the lint and mention that in a comment.
### Running CI tests locally
conduwuit's CI for tests, linting, formatting, audit, etc use
[`engage`][engage]. engage can be installed from nixpkgs or `cargo install
engage`. conduwuit's Nix flake devshell has the nixpkgs engage with `direnv`.
Use `engage --help` for more usage details.
To test, format, lint, etc that CI would do, install engage, allow the `.envrc`
file using `direnv allow`, and run `engage`.
All of the tasks are defined at the [engage.toml][engage.toml] file. You can
view all of them neatly by running `engage list`
If you would like to run only a specific engage task group, use `just`:
- `engage just <group>`
- Example: `engage just lints`
If you would like to run a specific engage task in a specific group, use `just
<GROUP> [TASK]`: `engage just lints cargo-fmt`
The following binaries are used in [`engage.toml`][engage.toml]:
- [`engage`][engage]
- `nix`
- [`direnv`][direnv]
- `rustc`
- `cargo`
- `cargo-fmt`
- `rustdoc`
- `cargo-clippy`
- [`cargo-audit`][cargo-audit]
- [`cargo-deb`][cargo-deb]
- [`lychee`][lychee]
- [`markdownlint-cli`][markdownlint-cli]
- `dpkg`
### Matrix tests
CI runs [Complement][complement], but currently does not fail if results from
the checked-in results differ with the new results. If your changes are done to
fix Matrix tests, note that in your pull request. If more Complement tests start
failing from your changes, please review the logs (they are uploaded as
artifacts) and determine if they're intended or not.
If you'd like to run Complement locally using Nix, see the
[testing](development/testing.md) page.
[Sytest][sytest] support will come soon.
### Writing documentation
conduwuit's website uses [`mdbook`][mdbook] and deployed via CI using GitHub
Pages in the [`documentation.yml`][documentation.yml] workflow file with Nix's
mdbook in the devshell. All documentation is in the `docs/` directory at the top
level. The compiled mdbook website is also uploaded as an artifact.
To build the documentation using Nix, run: `bin/nix-build-and-cache just .#book`
The output of the mdbook generation is in `result/`. mdbooks can be opened in
your browser from the individual HTML files without any web server needed.
### Inclusivity and Diversity
All **MUST** code and write with inclusivity and diversity in mind. See the
[following page by Google on writing inclusive code and
documentation](https://developers.google.com/style/inclusive-documentation).
This **EXPLICITLY** forbids usage of terms like "blacklist"/"whitelist" and
"master"/"slave", [forbids gender-specific words and
phrases](https://developers.google.com/style/pronouns#gender-neutral-pronouns),
forbids ableist language like "sanity-check", "cripple", or "insane", and
forbids culture-specific language (e.g. US-only holidays or cultures).
No exceptions are allowed. Dependencies that may use these terms are allowed but
[do not replicate the name in your functions or
variables](https://developers.google.com/style/inclusive-documentation#write-around).
In addition to language, write and code with the user experience in mind. This
is software that intends to be used by everyone, so make it easy and comfortable
for everyone to use. 🏳️‍⚧️
### Variable, comment, function, etc standards
Rust's default style and standards with regards to [function names, variable
names, comments](https://rust-lang.github.io/api-guidelines/naming.html), etc
applies here.
### Creating pull requests
Please try to keep contributions to the GitHub. While the mirrors of conduwuit
allow for pull/merge requests, there is no guarantee I will see them in a timely
manner. Additionally, please mark WIP or unfinished or incomplete PRs as drafts.
This prevents me from having to ping once in a while to double check the status
of it, especially when the CI completed successfully and everything so it
*looks* done.
If you open a pull request on one of the mirrors, it is your responsibility to
inform me about its existence. In the future I may try to solve this with more
repo bots in the conduwuit Matrix room. There is no mailing list or email-patch
support on the sr.ht mirror, but if you'd like to email me a git patch you can
do so at `strawberry@puppygock.gay`.
Direct all PRs/MRs to the `main` branch.
By sending a pull request or patch, you are agreeing that your changes are
allowed to be licenced under the Apache-2.0 licence and all of your conduct is
in line with the Contributor's Covenant, and conduwuit's Code of Conduct.
Contribution by users who violate either of these code of conducts will not have
their contributions accepted.
[issues]: https://github.com/girlbossceo/conduwuit/issues
[conduwuit-matrix]: https://matrix.to/#/#conduwuit:puppygock.gay
[complement]: https://github.com/matrix-org/complement/
[engage.toml]: https://github.com/girlbossceo/conduwuit/blob/main/engage.toml
[engage]: https://charles.page.computer.surgery/engage/
[sytest]: https://github.com/matrix-org/sytest/
[cargo-deb]: https://github.com/kornelski/cargo-deb
[lychee]: https://github.com/lycheeverse/lychee
[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
[cargo-audit]: https://github.com/RustSec/rustsec/tree/main/cargo-audit
[direnv]: https://direnv.net/
[mdbook]: https://rust-lang.github.io/mdBook/
[documentation.yml]: https://github.com/girlbossceo/conduwuit/blob/main/.github/workflows/documentation.yml

3695
Cargo.lock generated

File diff suppressed because it is too large Load diff

1022
Cargo.toml

File diff suppressed because it is too large Load diff

351
DEPLOY.md
View file

@ -1,351 +0,0 @@
# Deploying Conduit
> ## Getting help
>
> If you run into any problems while setting up Conduit, write an email to `conduit@koesters.xyz`, ask us
> in `#conduit:fachschaften.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new).
## Installing Conduit
Although you might be able to compile Conduit for Windows, we do recommend running it on a Linux server. We therefore
only offer Linux binaries.
You may simply download the binary that fits your machine. Run `uname -m` to see what you need. Now copy the appropriate url:
| CPU Architecture | Download stable version | Download development version |
| ------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------- |
| x84_64 / amd64 (Most servers and computers) | [Binary][x84_64-glibc-master] / [.deb][x84_64-glibc-master-deb] | [Binary][x84_64-glibc-next] / [.deb][x84_64-glibc-next-deb] |
| armv7 (e.g. Raspberry Pi by default) | [Binary][armv7-glibc-master] / [.deb][armv7-glibc-master-deb] | [Binary][armv7-glibc-next] / [.deb][armv7-glibc-next-deb] |
| armv8 / aarch64 | [Binary][armv8-glibc-master] / [.deb][armv8-glibc-master-deb] | [Binary][armv8-glibc-next] / [.deb][armv8-glibc-next-deb] |
These builds were created on and linked against the glibc version shipped with Debian bullseye.
If you use a system with an older glibc version (e.g. RHEL8), you might need to compile Conduit yourself.
[x84_64-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_amd64/conduit?job=docker:master
[armv7-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm_v7/conduit?job=docker:master
[armv8-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm64/conduit?job=docker:master
[x84_64-glibc-next]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_amd64/conduit?job=docker:next
[armv7-glibc-next]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_arm_v7/conduit?job=docker:next
[armv8-glibc-next]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_arm64/conduit?job=docker:next
[x84_64-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_amd64/conduit.deb?job=docker:master
[armv7-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm_v7/conduit.deb?job=docker:master
[armv8-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm64/conduit.deb?job=docker:master
[x84_64-glibc-next-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_amd64/conduit.deb?job=docker:next
[armv7-glibc-next-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_arm_v7/conduit.deb?job=docker:next
[armv8-glibc-next-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/next/raw/build-output/linux_arm64/conduit.deb?job=docker:next
```bash
$ sudo wget -O /usr/local/bin/matrix-conduit <url>
$ sudo chmod +x /usr/local/bin/matrix-conduit
```
Alternatively, you may compile the binary yourself. First, install any dependencies:
```bash
# Debian
$ sudo apt install libclang-dev build-essential
# RHEL
$ sudo dnf install clang
```
Then, `cd` into the source tree of conduit-next and run:
```bash
$ cargo build --release
```
If you want to cross compile Conduit to another architecture, read the guide below.
<details>
<summary>Cross compilation</summary>
As easiest way to compile conduit for another platform [cross-rs](https://github.com/cross-rs/cross) is recommended, so install it first.
In order to use RockDB as storage backend append `-latomic` to linker flags.
For example, to build a binary for Raspberry Pi Zero W (ARMv6) you need `arm-unknown-linux-gnueabihf` as compilation
target.
```bash
git clone https://gitlab.com/famedly/conduit.git
cd conduit
export RUSTFLAGS='-C link-arg=-lgcc -Clink-arg=-latomic -Clink-arg=-static-libgcc'
cross build --release --no-default-features --features conduit_bin,backend_rocksdb,jemalloc --target=arm-unknown-linux-gnueabihf
```
</details>
## Adding a Conduit user
While Conduit can run as any user it is usually better to use dedicated users for different services. This also allows
you to make sure that the file permissions are correctly set up.
In Debian or RHEL, you can use this command to create a Conduit user:
```bash
sudo adduser --system conduit --group --disabled-login --no-create-home
```
## Forwarding ports in the firewall or the router
Conduit uses the ports 443 and 8448 both of which need to be open in the firewall.
If Conduit runs behind a router or in a container and has a different public IP address than the host system these public ports need to be forwarded directly or indirectly to the port mentioned in the config.
## Optional: Avoid port 8448
If Conduit runs behind Cloudflare reverse proxy, which doesn't support port 8448 on free plans, [delegation](https://matrix-org.github.io/synapse/latest/delegate.html) can be set up to have federation traffic routed to port 443:
```apache
# .well-known delegation on Apache
<Files "/.well-known/matrix/server">
ErrorDocument 200 '{"m.server": "your.server.name:443"}'
Header always set Content-Type application/json
Header always set Access-Control-Allow-Origin *
</Files>
```
[SRV DNS record](https://spec.matrix.org/latest/server-server-api/#resolving-server-names) delegation is also [possible](https://www.cloudflare.com/en-gb/learning/dns/dns-records/dns-srv-record/).
## Setting up a systemd service
Now we'll set up a systemd service for Conduit, so it's easy to start/stop Conduit and set it to autostart when your
server reboots. Simply paste the default systemd service you can find below into
`/etc/systemd/system/conduit.service`.
```systemd
[Unit]
Description=Conduit Matrix Server
After=network.target
[Service]
Environment="CONDUIT_CONFIG=/etc/matrix-conduit/conduit.toml"
User=conduit
Group=conduit
Restart=always
ExecStart=/usr/local/bin/matrix-conduit
[Install]
WantedBy=multi-user.target
```
Finally, run
```bash
$ sudo systemctl daemon-reload
```
## Creating the Conduit configuration file
Now we need to create the Conduit's config file in `/etc/matrix-conduit/conduit.toml`. Paste this in **and take a moment
to read it. You need to change at least the server name.**
You can also choose to use a different database backend, but right now only `rocksdb` and `sqlite` are recommended.
```toml
[global]
# The server_name is the pretty name of this server. It is used as a suffix for user
# and room ids. Examples: matrix.org, conduit.rs
# The Conduit server needs all /_matrix/ requests to be reachable at
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).
# If that's not possible for you, you can create /.well-known files to redirect
# requests. See
# https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client
# and
# https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server
# for more information
# YOU NEED TO EDIT THIS
#server_name = "your.server.name"
# This is the only directory where Conduit will save its data
database_path = "/var/lib/matrix-conduit/"
database_backend = "rocksdb"
# The port Conduit will be running on. You need to set up a reverse proxy in
# your web server (e.g. apache or nginx), so all requests to /_matrix on port
# 443 and 8448 will be forwarded to the Conduit instance running on this port
# Docker users: Don't change this, you'll need to map an external port to this.
port = 6167
# Max size for uploads
max_request_size = 20_000_000 # in bytes
# Enables registration. If set to false, no users can register on this server.
allow_registration = true
allow_federation = true
allow_check_for_updates = true
# Server to get public keys from. You probably shouldn't change this
trusted_servers = ["matrix.org"]
#max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time
#log = "warn,state_res=warn,rocket=off,_=off,sled=off"
address = "127.0.0.1" # This makes sure Conduit can only be reached using the reverse proxy
#address = "0.0.0.0" # If Conduit is running in a container, make sure the reverse proxy (ie. Traefik) can reach it.
```
## Setting the correct file permissions
As we are using a Conduit specific user we need to allow it to read the config. To do that you can run this command on
Debian or RHEL:
```bash
sudo chown -R root:root /etc/matrix-conduit
sudo chmod 755 /etc/matrix-conduit
```
If you use the default database path you also need to run this:
```bash
sudo mkdir -p /var/lib/matrix-conduit/
sudo chown -R conduit:conduit /var/lib/matrix-conduit/
sudo chmod 700 /var/lib/matrix-conduit/
```
## Setting up the Reverse Proxy
This depends on whether you use Apache, Caddy, Nginx or another web server.
### Apache
Create `/etc/apache2/sites-enabled/050-conduit.conf` and copy-and-paste this:
```apache
# Requires mod_proxy and mod_proxy_http
#
# On Apache instance compiled from source,
# paste into httpd-ssl.conf or httpd.conf
Listen 8448
<VirtualHost *:443 *:8448>
ServerName your.server.name # EDIT THIS
AllowEncodedSlashes NoDecode
ProxyPass /_matrix/ http://127.0.0.1:6167/_matrix/ timeout=300 nocanon
ProxyPassReverse /_matrix/ http://127.0.0.1:6167/_matrix/
</VirtualHost>
```
**You need to make some edits again.** When you are done, run
```bash
# Debian
$ sudo systemctl reload apache2
# Installed from source
$ sudo apachectl -k graceful
```
### Caddy
Create `/etc/caddy/conf.d/conduit_caddyfile` and enter this (substitute for your server name).
```caddy
your.server.name, your.server.name:8448 {
reverse_proxy /_matrix/* 127.0.0.1:6167
}
```
That's it! Just start or enable the service and you're set.
```bash
$ sudo systemctl enable caddy
```
### Nginx
If you use Nginx and not Apache, add the following server section inside the http section of `/etc/nginx/nginx.conf`
```nginx
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen 8448 ssl http2;
listen [::]:8448 ssl http2;
server_name your.server.name; # EDIT THIS
merge_slashes off;
# Nginx defaults to only allow 1MB uploads
# Increase this to allow posting large files such as videos
client_max_body_size 20M;
location /_matrix/ {
proxy_pass http://127.0.0.1:6167$request_uri;
proxy_set_header Host $http_host;
proxy_buffering off;
proxy_read_timeout 5m;
}
ssl_certificate /etc/letsencrypt/live/your.server.name/fullchain.pem; # EDIT THIS
ssl_certificate_key /etc/letsencrypt/live/your.server.name/privkey.pem; # EDIT THIS
ssl_trusted_certificate /etc/letsencrypt/live/your.server.name/chain.pem; # EDIT THIS
include /etc/letsencrypt/options-ssl-nginx.conf;
}
```
**You need to make some edits again.** When you are done, run
```bash
$ sudo systemctl reload nginx
```
## SSL Certificate
If you chose Caddy as your web proxy SSL certificates are handled automatically and you can skip this step.
The easiest way to get an SSL certificate, if you don't have one already, is to [install](https://certbot.eff.org/instructions) `certbot` and run this:
```bash
# To use ECC for the private key,
# paste into /etc/letsencrypt/cli.ini:
# key-type = ecdsa
# elliptic-curve = secp384r1
$ sudo certbot -d your.server.name
```
[Automated renewal](https://eff-certbot.readthedocs.io/en/stable/using.html#automated-renewals) is usually preconfigured.
If using Cloudflare, configure instead the edge and origin certificates in dashboard. In case youre already running a website on the same Apache server, you can just copy-and-paste the SSL configuration from your main virtual host on port 443 into the above-mentioned vhost.
## You're done!
Now you can start Conduit with:
```bash
$ sudo systemctl start conduit
```
Set it to start automatically when your system boots with:
```bash
$ sudo systemctl enable conduit
```
## How do I know it works?
You can open <https://app.element.io>, enter your homeserver and try to register.
You can also use these commands as a quick health check.
```bash
$ curl https://your.server.name/_matrix/client/versions
# If using port 8448
$ curl https://your.server.name:8448/_matrix/client/versions
```
- To check if your server can talk with other homeservers, you can use the [Matrix Federation Tester](https://federationtester.matrix.org/).
If you can register but cannot join federated rooms check your config again and also check if the port 8448 is open and forwarded correctly.
# What's next?
## Audio/Video calls
For Audio/Video call functionality see the [TURN Guide](TURN.md).
## Appservices
If you want to set up an appservice, take a look at the [Appservice Guide](APPSERVICES.md).

View file

@ -1,132 +0,0 @@
# syntax=docker/dockerfile:1
FROM docker.io/rust:1.70-bullseye AS base
FROM base AS builder
WORKDIR /usr/src/conduit
# Install required packages to build Conduit and it's dependencies
RUN apt-get update && \
apt-get -y --no-install-recommends install libclang-dev=1:11.0-51+nmu5
# == Build dependencies without our own code separately for caching ==
#
# Need a fake main.rs since Cargo refuses to build anything otherwise.
#
# See https://github.com/rust-lang/cargo/issues/2644 for a Cargo feature
# request that would allow just dependencies to be compiled, presumably
# regardless of whether source files are available.
RUN mkdir src && touch src/lib.rs && echo 'fn main() {}' > src/main.rs
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release && rm -r src
# Copy over actual Conduit sources
COPY src src
# main.rs and lib.rs need their timestamp updated for this to work correctly since
# otherwise the build with the fake main.rs from above is newer than the
# source files (COPY preserves timestamps).
#
# Builds conduit and places the binary at /usr/src/conduit/target/release/conduit
RUN touch src/main.rs && touch src/lib.rs && cargo build --release
# ONLY USEFUL FOR CI: target stage to extract build artifacts
FROM scratch AS builder-result
COPY --from=builder /usr/src/conduit/target/release/conduit /conduit
# ---------------------------------------------------------------------------------------------------------------
# Build cargo-deb, a tool to package up rust binaries into .deb packages for Debian/Ubuntu based systems:
# ---------------------------------------------------------------------------------------------------------------
FROM base AS build-cargo-deb
RUN apt-get update && \
apt-get install -y --no-install-recommends \
dpkg \
dpkg-dev \
liblzma-dev
RUN cargo install cargo-deb
# => binary is in /usr/local/cargo/bin/cargo-deb
# ---------------------------------------------------------------------------------------------------------------
# Package conduit build-result into a .deb package:
# ---------------------------------------------------------------------------------------------------------------
FROM builder AS packager
WORKDIR /usr/src/conduit
COPY ./LICENSE ./LICENSE
COPY ./README.md ./README.md
COPY debian ./debian
COPY --from=build-cargo-deb /usr/local/cargo/bin/cargo-deb /usr/local/cargo/bin/cargo-deb
# --no-build makes cargo-deb reuse already compiled project
RUN cargo deb --no-build
# => Package is in /usr/src/conduit/target/debian/<project_name>_<version>_<arch>.deb
# ONLY USEFUL FOR CI: target stage to extract build artifacts
FROM scratch AS packager-result
COPY --from=packager /usr/src/conduit/target/debian/*.deb /conduit.deb
# ---------------------------------------------------------------------------------------------------------------
# Stuff below this line actually ends up in the resulting docker image
# ---------------------------------------------------------------------------------------------------------------
FROM docker.io/debian:bullseye-slim AS runner
# Standard port on which Conduit launches.
# You still need to map the port when using the docker command or docker-compose.
EXPOSE 6167
ARG DEFAULT_DB_PATH=/var/lib/matrix-conduit
ENV CONDUIT_PORT=6167 \
CONDUIT_ADDRESS="0.0.0.0" \
CONDUIT_DATABASE_PATH=${DEFAULT_DB_PATH} \
CONDUIT_CONFIG=''
# └─> Set no config file to do all configuration with env vars
# Conduit needs:
# dpkg: to install conduit.deb
# ca-certificates: for https
# iproute2 & wget: for the healthcheck script
RUN apt-get update && apt-get -y --no-install-recommends install \
dpkg \
ca-certificates \
iproute2 \
wget \
&& rm -rf /var/lib/apt/lists/*
# Test if Conduit is still alive, uses the same endpoint as Element
COPY ./docker/healthcheck.sh /srv/conduit/healthcheck.sh
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
# Install conduit.deb:
COPY --from=packager /usr/src/conduit/target/debian/*.deb /srv/conduit/
RUN dpkg -i /srv/conduit/*.deb
# Improve security: Don't run stuff as root, that does not need to run as root
# Most distros also use 1000:1000 for the first real user, so this should resolve volume mounting problems.
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN set -x ; \
groupadd -r -g ${GROUP_ID} conduit ; \
useradd -l -r -M -d /srv/conduit -o -u ${USER_ID} -g conduit conduit && exit 0 ; exit 1
# Create database directory, change ownership of Conduit files to conduit user and group and make the healthcheck executable:
RUN chown -cR conduit:conduit /srv/conduit && \
chmod +x /srv/conduit/healthcheck.sh && \
mkdir -p ${DEFAULT_DB_PATH} && \
chown -cR conduit:conduit ${DEFAULT_DB_PATH}
# Change user to conduit, no root permissions afterwards:
USER conduit
# Set container home directory
WORKDIR /srv/conduit
# Run Conduit and print backtraces on panics
ENV RUST_BACKTRACE=1
ENTRYPOINT [ "/usr/sbin/matrix-conduit" ]

26
LICENSE
View file

@ -1,3 +1,4 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@ -174,3 +175,28 @@
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 June
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

110
README.md
View file

@ -1,79 +1,85 @@
# Conduit
### A Matrix homeserver written in Rust
# conduwuit
`main`: [![CI and
Artifacts](https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml)
<!-- ANCHOR: catchphrase -->
### a very cool, featureful fork of [Conduit](https://conduit.rs/)
<!-- ANCHOR_END: catchphrase -->
Visit the [Conduwuit documentation](https://conduwuit.puppyirl.gay/) for more
information.
<!-- ANCHOR: body -->
#### What is Matrix?
[Matrix](https://matrix.org) is an open network for secure and decentralized
communication. Users from every Matrix homeserver can chat with users from all
other Matrix servers. You can even use bridges (also called Matrix appservices)
other Matrix servers. You can even use bridges (also called Matrix Appservices)
to communicate with users outside of Matrix, like a community on Discord.
#### What is the goal?
An efficient Matrix homeserver that's easy to set up and just works. You can install
it on a mini-computer like the Raspberry Pi to host Matrix for your family,
friends or company.
An efficient Matrix homeserver that's easy to set up and just works. You can
install it on a mini-computer like the Raspberry Pi to host Matrix for your
family, friends or company.
#### Can I try it out?
Yes! You can test our Conduit instance by opening a Matrix client (<https://app.element.io> or Element Android for
example) and registering on the `conduit.rs` homeserver. The registration token is "for_testing_only". Don't share personal information.
An official conduwuit server ran by me is available at transfem.dev
([element.transfem.dev](https://element.transfem.dev) /
[cinny.transfem.dev](https://cinny.transfem.dev))
Server hosting for conduit.rs is donated by the Matrix.org Foundation.
transfem.dev is a public homeserver that can be used, it is not a "test only
homeserver". This means there are rules, so please read the rules:
[https://transfem.dev/homeserver_rules.txt](https://transfem.dev/homeserver_rules.txt)
transfem.dev is also listed at
[servers.joinmatrix.org](https://servers.joinmatrix.org/)
#### What is the current status?
Conduit is Beta, meaning you can join and participate in most
Matrix rooms, but not all features are supported and you might run into bugs
from time to time.
conduwuit is a hard fork of Conduit which is in beta, meaning you can join and
participate in most Matrix rooms, but not all features are supported and you
might run into bugs from time to time.
There are still a few important features missing:
<!-- ANCHOR_END: body -->
- E2EE emoji comparison over federation (E2EE chat works)
- Outgoing read receipts, typing, presence over federation (incoming works)
Check out the [Conduit 1.0 Release Milestone](https://gitlab.com/famedly/conduit/-/milestones/3).
#### How can I deploy my own?
- Simple install (this was tested the most): [DEPLOY.md](DEPLOY.md)
- Debian package: [debian/README.md](debian/README.md)
- Nix/NixOS: [nix/README.md](nix/README.md)
- Docker: [docker/README.md](docker/README.md)
If you want to connect an Appservice to Conduit, take a look at [APPSERVICES.md](APPSERVICES.md).
#### How can I contribute?
1. Look for an issue you would like to work on and make sure it's not assigned
to other users
2. Ask someone to assign the issue to you (comment on the issue or chat in
[#conduit:fachschaften.org](https://matrix.to/#/#conduit:fachschaften.org))
3. Fork the repo and work on the issue.[#conduit:fachschaften.org](https://matrix.to/#/#conduit:fachschaften.org) is happy to help :)
4. Submit a MR
#### Thanks to
Thanks to FUTO, Famedly, Prototype Fund (DLR and German BMBF) and all individuals for financially supporting this project.
Thanks to the contributors to Conduit and all libraries we use, for example:
- Ruma: A clean library for the Matrix Spec in Rust
- axum: A modular web framework
<!-- ANCHOR: footer -->
#### Contact
If you run into any question, feel free to
- Ask us in `#conduit:fachschaften.org` on Matrix
- Write an E-Mail to `conduit@koesters.xyz`
- Send an direct message to `timokoesters@fachschaften.org` on Matrix
- [Open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new)
- Ask us in `#conduwuit:puppygock.gay` on Matrix
- [Open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new)
#### Donate
Liberapay: <https://liberapay.com/timokoesters/>\
Bitcoin: `bc1qnnykf986tw49ur7wx9rpw2tevpsztvar5x8w4n`
- Liberapay: <https://liberapay.com/girlbossceo>
- Ko-fi: <https://ko-fi.com/puppygock>
- GitHub Sponsors: <https://github.com/sponsors/girlbossceo>
#### Logo
Lightning Bolt Logo: https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/nature/u26A1-bolt.svg \
Logo License: https://github.com/mozilla/fxemoji/blob/gh-pages/LICENSE.md
Original repo and Matrix room picture was from bran (<3). Current banner image
and logo is directly from [this cohost
post](https://cohost.org/RatBaby/post/1028290-finally-a-flag-for).
#### Is it conduwuit or Conduwuit?
Both, but I prefer conduwuit.
#### Mirrors of conduwuit
- GitHub: <https://github.com/girlbossceo/conduwuit>
- GitLab: <https://gitlab.com/conduwuit/conduwuit>
- git.girlcock.ceo: <https://git.girlcock.ceo/strawberry/conduwuit>
- git.gay: <https://git.gay/june/conduwuit>
- Codeberg: <https://codeberg.org/girlbossceo/conduwuit>
- sourcehut: <https://git.sr.ht/~girlbossceo/conduwuit>
<!-- ANCHOR_END: footer -->

25
TURN.md
View file

@ -1,25 +0,0 @@
# Setting up TURN/STURN
## General instructions
* It is assumed you have a [Coturn server](https://github.com/coturn/coturn) up and running. See [Synapse reference implementation](https://github.com/matrix-org/synapse/blob/develop/docs/turn-howto.md).
## Edit/Add a few settings to your existing conduit.toml
```
# Refer to your Coturn settings.
# `your.turn.url` has to match the REALM setting of your Coturn as well as `transport`.
turn_uris = ["turn:your.turn.url?transport=udp", "turn:your.turn.url?transport=tcp"]
# static-auth-secret of your turnserver
turn_secret = "ADD SECRET HERE"
# If you have your TURN server configured to use a username and password
# you can provide these information too. In this case comment out `turn_secret above`!
#turn_username = ""
#turn_password = ""
```
## Apply settings
Restart Conduit.

62
arch/conduwuit.service Normal file
View file

@ -0,0 +1,62 @@
[Unit]
Description=conduwuit Matrix homeserver
After=network.target
Documentation=https://conduwuit.puppyirl.gay/
RequiresMountsFor=/var/lib/private/conduwuit
[Service]
DynamicUser=yes
Type=notify
AmbientCapabilities=
CapabilityBoundingSet=
DevicePolicy=closed
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
ProcSubset=pid
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectProc=invisible
ProtectSystem=strict
PrivateDevices=yes
PrivateMounts=yes
PrivateTmp=yes
PrivateUsers=yes
PrivateIPC=yes
RemoveIPC=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service @resources
SystemCallFilter=~@clock @debug @module @mount @reboot @swap @cpu-emulation @obsolete @timer @chown @setuid @privileged @keyring @ipc
SystemCallErrorNumber=EPERM
StateDirectory=conduwuit
RuntimeDirectory=conduwuit
RuntimeDirectoryMode=0750
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml"
BindPaths=/var/lib/private/conduwuit:/var/lib/matrix-conduit
BindPaths=/var/lib/private/conduwuit:/var/lib/private/matrix-conduit
ExecStart=/usr/bin/conduwuit
Restart=on-failure
RestartSec=5
TimeoutStopSec=4m
TimeoutStartSec=4m
StartLimitInterval=1m
StartLimitBurst=5
[Install]
WantedBy=multi-user.target

56
bin/complement Executable file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -euo pipefail
# Path to Complement's source code
#
# The `COMPLEMENT_SRC` environment variable is set in the Nix dev shell, which
# points to a store path containing the Complement source code. It's likely you
# want to just pass that as the first argument to use it here.
COMPLEMENT_SRC="${COMPLEMENT_SRC:-$1}"
# A `.jsonl` file to write test logs to
LOG_FILE="$2"
# A `.jsonl` file to write test results to
RESULTS_FILE="$3"
OCI_IMAGE="complement-conduit:main"
# Complement tests that are skipped due to flakiness/reliability issues
SKIPPED_COMPLEMENT_TESTS='-skip=TestClientSpacesSummary.*|TestJoinFederatedRoomFromApplicationServiceBridgeUser.*|TestJumpToDateEndpoint.*'
# $COMPLEMENT_SRC needs to be a directory to Complement source code
if [ -f "$COMPLEMENT_SRC" ]; then
echo "\$COMPLEMENT_SRC must be a directory/path to Complement source code"
exit 1
fi
# quick test to make sure we can actually write to $LOG_FILE and $RESULTS_FILE
touch $LOG_FILE && rm -v $LOG_FILE
touch $RESULTS_FILE && rm -v $RESULTS_FILE
toplevel="$(git rev-parse --show-toplevel)"
pushd "$toplevel" > /dev/null
bin/nix-build-and-cache just .#static-complement
docker load < result
popd > /dev/null
# It's okay (likely, even) that `go test` exits nonzero
set +o pipefail
env \
-C "$COMPLEMENT_SRC" \
COMPLEMENT_BASE_IMAGE="$OCI_IMAGE" \
go test -tags="conduwuit_blacklist" "$SKIPPED_COMPLEMENT_TESTS" -v -timeout 1h -json ./tests | tee "$LOG_FILE"
set -o pipefail
# Post-process the results into an easy-to-compare format, sorted by Test name for reproducible results
cat "$LOG_FILE" | jq -s -c 'sort_by(.Test)[]' | jq -c '
select(
(.Action == "pass" or .Action == "fail" or .Action == "skip")
and .Test != null
) | {Action: .Action, Test: .Test}
' > "$RESULTS_FILE"

105
bin/nix-build-and-cache Executable file
View file

@ -0,0 +1,105 @@
#!/usr/bin/env bash
set -eo pipefail
toplevel="$(git rev-parse --show-toplevel)"
# Build just the single installable and forward any other arguments too
just() {
# uses nix-output-monitor (nom) if available
if command -v nom &> /dev/null; then
nom build "$@"
else
nix build -L "$@"
fi
if [ -z "$ATTIC_TOKEN" ]; then
echo "\$ATTIC_TOKEN is unset, skipping uploading to the binary cache"
return
fi
# historical "conduit" store for compatibility purposes, same as conduwuit
nix run --inputs-from "$toplevel" attic -- \
login \
conduit \
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduit}" \
"$ATTIC_TOKEN"
# Find all output paths of the installables and their build dependencies
readarray -t derivations < <(nix path-info --derivation "$@")
cache=()
for derivation in "${derivations[@]}"; do
cache+=(
"$(nix-store --query --requisites --include-outputs "$derivation")"
)
done
withattic() {
nix shell --inputs-from "$toplevel" attic --command xargs attic push "$@" <<< "${cache[*]}"
}
# Upload them to Attic (conduit store)
#
# Use `xargs` and a here-string because something would probably explode if
# several thousand arguments got passed to a command at once. Hopefully no
# store paths include a newline in them.
(
IFS=$'\n'
withattic conduit || withattic conduit || withattic conduit || true
)
# main "conduwuit" store
nix run --inputs-from "$toplevel" attic -- \
login \
conduwuit \
"${ATTIC_ENDPOINT:-https://attic.kennel.juneis.dog/conduwuit}" \
"$ATTIC_TOKEN"
# Upload them to Attic (conduwuit store) and Cachix
#
# Use `xargs` and a here-string because something would probably explode if
# several thousand arguments got passed to a command at once. Hopefully no
# store paths include a newline in them.
(
IFS=$'\n'
withattic conduwuit || withattic conduwuit || withattic conduwuit || true
# push to cachix if available
if [ "$CACHIX_AUTH_TOKEN" ]; then
nix shell --inputs-from "$toplevel" cachix -c xargs \
cachix push conduwuit <<< "${cache[*]}"
fi
)
}
# Build and cache things needed for CI
ci() {
cache=(
--inputs-from "$toplevel"
# Keep sorted
"$toplevel#devShells.x86_64-linux.default"
"$toplevel#devShells.x86_64-linux.all-features"
attic#default
cachix#default
nixpkgs#direnv
nixpkgs#jq
nixpkgs#nix-direnv
)
just "${cache[@]}"
}
# Build and cache *all* the package outputs from the flake.nix
packages() {
declare -a cache="($(
nix flake show --json 2> /dev/null |
nix run --inputs-from "$toplevel" nixpkgs#jq -- \
-r \
'.packages."x86_64-linux" | keys | map("'"$toplevel"'#" + .) | @sh'
))"
just "${cache[@]}"
}
eval "$@"

24
book.toml Normal file
View file

@ -0,0 +1,24 @@
[book]
title = "conduwuit 🏳️‍⚧️ 💜 🦴"
description = "conduwuit, which is a well-maintained fork of Conduit, is a simple, fast and reliable chat server for the Matrix protocol"
language = "en"
authors = ["strawberry (June)"]
text-direction = "ltr"
multilingual = false
src = "docs"
[build]
build-dir = "public"
create-missing = true
extra-watch-dirs = ["debian", "docs"]
[rust]
edition = "2021"
[output.html]
git-repository-url = "https://github.com/girlbossceo/conduwuit"
edit-url-template = "https://github.com/girlbossceo/conduwuit/edit/main/{path}"
git-repository-icon = "fa-github-square"
[output.html.search]
limit-results = 15

7
clippy.toml Normal file
View file

@ -0,0 +1,7 @@
array-size-threshold = 4096
cognitive-complexity-threshold = 94 # TODO reduce me ALARA
excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5
future-size-threshold = 7745 # TODO reduce me ALARA
stack-size-threshold = 144000 # reduce me ALARA
too-many-lines-threshold = 700 # TODO reduce me to <= 100
type-complexity-threshold = 250 # reduce me to ~200

View file

@ -1,48 +0,0 @@
# For use in our CI only. This requires a build artifact created by a previous run pipline stage to be placed in cached_target/release/conduit
FROM registry.gitlab.com/jfowl/conduit-containers/rust-with-tools:commit-16a08e9b as builder
#FROM rust:latest as builder
WORKDIR /workdir
ARG RUSTC_WRAPPER
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG SCCACHE_BUCKET
ARG SCCACHE_ENDPOINT
ARG SCCACHE_S3_USE_SSL
COPY . .
RUN mkdir -p target/release
RUN test -e cached_target/release/conduit && cp cached_target/release/conduit target/release/conduit || cargo build --release
## Actual image
FROM debian:bullseye
WORKDIR /workdir
# Install caddy
RUN apt-get update && apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-testing-archive-keyring.gpg && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-testing.list && apt-get update && apt-get install -y caddy
COPY conduit-example.toml conduit.toml
COPY complement/caddy.json caddy.json
ENV SERVER_NAME=localhost
ENV CONDUIT_CONFIG=/workdir/conduit.toml
RUN sed -i "s/port = 6167/port = 8008/g" conduit.toml
RUN echo "allow_federation = true" >> conduit.toml
RUN echo "allow_check_for_updates = true" >> conduit.toml
RUN echo "allow_encryption = true" >> conduit.toml
RUN echo "allow_registration = true" >> conduit.toml
RUN echo "log = \"warn,_=off,sled=off\"" >> conduit.toml
RUN sed -i "s/address = \"127.0.0.1\"/address = \"0.0.0.0\"/g" conduit.toml
COPY --from=builder /workdir/target/release/conduit /workdir/conduit
RUN chmod +x /workdir/conduit
EXPOSE 8008 8448
CMD uname -a && \
sed -i "s/#server_name = \"your.server.name\"/server_name = \"${SERVER_NAME}\"/g" conduit.toml && \
sed -i "s/your.server.name/${SERVER_NAME}/g" caddy.json && \
caddy start --config caddy.json > /dev/null && \
/workdir/conduit

View file

@ -1,13 +0,0 @@
# Running Conduit on Complement
This assumes that you're familiar with complement, if not, please readme
[their readme](https://github.com/matrix-org/complement#running).
Complement works with "base images", this directory (and Dockerfile) helps build the conduit complement-ready docker
image.
To build, `cd` to the base directory of the workspace, and run this:
`docker build -t complement-conduit:dev -f complement/Dockerfile .`
Then use `complement-conduit:dev` as a base image for running complement tests.

View file

@ -1,72 +0,0 @@
{
"logging": {
"logs": {
"default": {
"level": "WARN"
}
}
},
"apps": {
"http": {
"https_port": 8448,
"servers": {
"srv0": {
"listen": [":8448"],
"routes": [{
"match": [{
"host": ["your.server.name"]
}],
"handle": [{
"handler": "subroute",
"routes": [{
"handle": [{
"handler": "reverse_proxy",
"upstreams": [{
"dial": "127.0.0.1:8008"
}]
}]
}]
}],
"terminal": true
}],
"tls_connection_policies": [{
"match": {
"sni": ["your.server.name"]
}
}]
}
}
},
"pki": {
"certificate_authorities": {
"local": {
"name": "Complement CA",
"root": {
"certificate": "/complement/ca/ca.crt",
"private_key": "/complement/ca/ca.key"
},
"intermediate": {
"certificate": "/complement/ca/ca.crt",
"private_key": "/complement/ca/ca.key"
}
}
}
},
"tls": {
"automation": {
"policies": [{
"subjects": ["your.server.name"],
"issuers": [{
"module": "internal"
}],
"on_demand": true
}, {
"issuers": [{
"module": "internal",
"ca": "local"
}]
}]
}
}
}
}

View file

@ -1,57 +0,0 @@
# =============================================================================
# This is the official example config for Conduit.
# If you use it for your server, you will need to adjust it to your own needs.
# At the very least, change the server_name field!
# =============================================================================
[global]
# The server_name is the pretty name of this server. It is used as a suffix for user
# and room ids. Examples: matrix.org, conduit.rs
# The Conduit server needs all /_matrix/ requests to be reachable at
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).
# If that's not possible for you, you can create /.well-known files to redirect
# requests. See
# https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client
# and
# https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server
# for more information
# YOU NEED TO EDIT THIS
#server_name = "your.server.name"
# This is the only directory where Conduit will save its data
database_path = "/var/lib/matrix-conduit/"
database_backend = "rocksdb"
# The port Conduit will be running on. You need to set up a reverse proxy in
# your web server (e.g. apache or nginx), so all requests to /_matrix on port
# 443 and 8448 will be forwarded to the Conduit instance running on this port
# Docker users: Don't change this, you'll need to map an external port to this.
port = 6167
# Max size for uploads
max_request_size = 20_000_000 # in bytes
# Enables registration. If set to false, no users can register on this server.
allow_registration = true
allow_federation = true
allow_check_for_updates = true
# Enable the display name lightning bolt on registration.
enable_lightning_bolt = true
# Servers listed here will be used to gather public keys of other servers.
# Generally, copying this exactly should be enough. (Currently, Conduit doesn't
# support batched key requests, so this list should only contain Synapse
# servers.)
trusted_servers = ["matrix.org"]
#max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time
#log = "warn,state_res=warn,rocket=off,_=off,sled=off"
address = "127.0.0.1" # This makes sure Conduit can only be reached using the reverse proxy
#address = "0.0.0.0" # If Conduit is running in a container, make sure the reverse proxy (ie. Traefik) can reach it.

911
conduwuit-example.toml Normal file
View file

@ -0,0 +1,911 @@
# =============================================================================
# This is the official example config for conduwuit.
# If you use it for your server, you will need to adjust it to your own needs.
# At the very least, change the server_name field!
#
# This documentation can also be found at https://conduwuit.puppyirl.gay/configuration.html
# =============================================================================
[global]
# The server_name is the pretty name of this server. It is used as a suffix for user
# and room ids. Examples: matrix.org, conduit.rs
# The Conduit server needs all /_matrix/ requests to be reachable at
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).
# If that's not possible for you, you can create /.well-known files to redirect
# requests (delegation). See
# https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixclient
# and
# https://spec.matrix.org/v1.9/server-server-api/#getwell-knownmatrixserver
# for more information
# YOU NEED TO EDIT THIS
#server_name = "your.server.name"
# Servers listed here will be used to gather public keys of other servers (notary trusted key servers).
#
# The default behaviour for conduwuit is to attempt to query trusted key servers before querying the individual servers.
# This is done for performance reasons, but if you would like to query individual servers before the notary servers
# configured below, set to
#
# (Currently, conduwuit doesn't support batched key requests, so this list should only contain Synapse servers)
# Defaults to `matrix.org`
# trusted_servers = ["matrix.org"]
# Sentry.io crash/panic reporting, performance monitoring/metrics, etc. This is NOT enabled by default.
# conduwuit's default Sentry reporting endpoint is o4506996327251968.ingest.us.sentry.io
#
# Defaults to *false*
#sentry = false
# Sentry reporting URL if a custom one is desired
#
# Defaults to conduwuit's default Sentry endpoint: "https://fe2eb4536aa04949e28eff3128d64757@o4506996327251968.ingest.us.sentry.io/4506996334657536"
#sentry_endpoint = ""
# Report your Conduwuit server_name in Sentry.io crash reports and metrics
#
# Defaults to false
#sentry_send_server_name = false
# Performance monitoring/tracing sample rate for Sentry.io
#
# Note that too high values may impact performance, and can be disabled by setting it to 0.0 (0%)
# This value is read as a percentage to Sentry, represented as a decimal
#
# Defaults to 15% of traces (0.15)
#sentry_traces_sample_rate = 0.15
# Whether to attach a stacktrace to Sentry reports.
#sentry_attach_stacktrace = false
# Send panics to sentry. This is true by default, but sentry has to be enabled.
#sentry_send_panic = true
# Send errors to sentry. This is true by default, but sentry has to be enabled. This option is
# only effective in release-mode; forced to false in debug-mode.
#sentry_send_error = true
# Controls the tracing log level for Sentry to send things like breadcrumbs and transactions
# Defaults to "info"
#sentry_filter = "info"
### Database configuration
# This is the only directory where conduwuit will save its data, including media.
# Note: this was previously "/var/lib/matrix-conduit"
database_path = "/var/lib/conduwuit"
# Database backend: Only rocksdb is supported.
database_backend = "rocksdb"
### Network
# The port(s) conduwuit will be running on. You need to set up a reverse proxy such as
# Caddy or Nginx so all requests to /_matrix on port 443 and 8448 will be
# forwarded to the conduwuit instance running on this port
# Docker users: Don't change this, you'll need to map an external port to this.
# To listen on multiple ports, specify a vector e.g. [8080, 8448]
#
# default if unspecified is 8008
port = 6167
# default address (IPv4 or IPv6) conduwuit will listen on. Generally you want this to be
# localhost (127.0.0.1 / ::1). If you are using Docker or a container NAT networking setup, you
# likely need this to be 0.0.0.0.
# To listen multiple addresses, specify a vector e.g. ["127.0.0.1", "::1"]
#
# default if unspecified is both IPv4 and IPv6 localhost: ["127.0.0.1", "::1"]
address = "127.0.0.1"
# Max request size for file uploads
max_request_size = 20_000_000 # in bytes
# Uncomment unix_socket_path to listen on a UNIX socket at the specified path.
# If listening on a UNIX socket, you must remove/comment the 'address' key if defined and add your
# reverse proxy to the 'conduwuit' group, unless world RW permissions are specified with unix_socket_perms (666 minimum).
#unix_socket_path = "/run/conduwuit/conduwuit.sock"
#unix_socket_perms = 660
# Set this to true for conduwuit to compress HTTP response bodies using zstd.
# This option does nothing if conduwuit was not built with `zstd_compression` feature.
# Please be aware that enabling HTTP compression may weaken TLS.
# Most users should not need to enable this.
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
zstd_compression = false
# Set this to true for conduwuit to compress HTTP response bodies using gzip.
# This option does nothing if conduwuit was not built with `gzip_compression` feature.
# Please be aware that enabling HTTP compression may weaken TLS.
# Most users should not need to enable this.
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
gzip_compression = false
# Set this to true for conduwuit to compress HTTP response bodies using brotli.
# This option does nothing if conduwuit was not built with `brotli_compression` feature.
# Please be aware that enabling HTTP compression may weaken TLS.
# Most users should not need to enable this.
# See https://breachattack.com/ and https://wikipedia.org/wiki/BREACH before deciding to enable this.
brotli_compression = false
# Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you do not want conduwuit to send outbound requests to.
# Defaults to RFC1918, unroutable, loopback, multicast, and testnet addresses for security.
#
# To disable, set this to be an empty vector (`[]`).
# Please be aware that this is *not* a guarantee. You should be using a firewall with zones as doing this on the application layer may have bypasses.
#
# Currently this does not account for proxies in use like Synapse does.
ip_range_denylist = [
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"100.64.0.0/10",
"192.0.0.0/24",
"169.254.0.0/16",
"192.88.99.0/24",
"198.18.0.0/15",
"192.0.2.0/24",
"198.51.100.0/24",
"203.0.113.0/24",
"224.0.0.0/4",
"::1/128",
"fe80::/10",
"fc00::/7",
"2001:db8::/32",
"ff00::/8",
"fec0::/10",
]
### Moderation / Privacy / Security
# Config option to control whether the legacy unauthenticated Matrix media repository endpoints will be enabled.
# These endpoints consist of:
# - /_matrix/media/*/config
# - /_matrix/media/*/upload
# - /_matrix/media/*/preview_url
# - /_matrix/media/*/download/*
# - /_matrix/media/*/thumbnail/*
#
# The authenticated equivalent endpoints are always enabled.
#
# Defaults to true for now, but this is highly subject to change, likely in the next release.
#allow_legacy_media = true
# Set to true to allow user type "guest" registrations. Element attempts to register guest users automatically.
# Defaults to false
allow_guest_registration = false
# Set to true to log guest registrations in the admin room.
# Defaults to false as it may be noisy or unnecessary.
log_guest_registrations = false
# Set to true to allow guest registrations/users to auto join any rooms specified in `auto_join_rooms`
# Defaults to false
allow_guests_auto_join_rooms = false
# Vector list of servers that conduwuit will refuse to download remote media from.
# No default.
# prevent_media_downloads_from = ["example.com", "example.local"]
# Enables registration. If set to false, no users can register on this
# server.
# If set to true without a token configured, users can register with no form of 2nd-
# step only if you set
# `yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse` to
# true in your config. If you would like
# registration only via token reg, please configure the `registration_token` key.
allow_registration = false
# Please note that an open registration homeserver with no second-step verification
# is highly prone to abuse and potential defederation by homeservers, including
# matrix.org.
# A static registration token that new users will have to provide when creating
# an account. If unset and `allow_registration` is true, registration is open
# without any condition. YOU NEED TO EDIT THIS.
registration_token = "change this token for something specific to your server"
# controls whether federation is allowed or not
# defaults to true
# allow_federation = true
# controls whether users are allowed to create rooms.
# appservices and admins are always allowed to create rooms
# defaults to true
# allow_room_creation = true
# controls whether non-admin local users are forbidden from sending room invites (local and remote),
# and if non-admin users can receive remote room invites. admins are always allowed to send and receive all room invites.
# defaults to false
# block_non_admin_invites = false
# List of forbidden username patterns/strings. Values in this list are matched as *contains*.
# This is checked upon username availability check, registration, and startup as warnings if any local users in your database
# have a forbidden username.
# No default.
# forbidden_usernames = []
# List of forbidden room aliases and room IDs as patterns/strings. Values in this list are matched as *contains*.
# This is checked upon room alias creation, custom room ID creation if used, and startup as warnings if any room aliases
# in your database have a forbidden room alias/ID.
# No default.
# forbidden_alias_names = []
# List of forbidden server names that we will block incoming AND outgoing federation with, and block client room joins / remote user invites.
#
# This check is applied on the room ID, room alias, sender server name, sender user's server name, inbound federation X-Matrix origin, and outbound federation handler.
#
# Basically "global" ACLs. No default.
# forbidden_remote_server_names = []
# List of forbidden server names that we will block all outgoing federated room directory requests for. Useful for preventing our users from wandering into bad servers or spaces.
# No default.
# forbidden_remote_room_directory_server_names = []
# Set this to true to allow your server's public room directory to be federated.
# Set this to false to protect against /publicRooms spiders, but will forbid external users
# from viewing your server's public room directory. If federation is disabled entirely
# (`allow_federation`), this is inherently false.
allow_public_room_directory_over_federation = false
# Set this to true to allow your server's public room directory to be queried without client
# authentication (access token) through the Client APIs. Set this to false to protect against /publicRooms spiders.
allow_public_room_directory_without_auth = false
# Set this to true to lock down your server's public room directory and only allow admins to publish rooms to the room directory.
# Unpublishing is still allowed by all users with this enabled.
#
# Defaults to false
lockdown_public_room_directory = false
# Set this to true to allow federating device display names / allow external users to see your device display name.
# If federation is disabled entirely (`allow_federation`), this is inherently false. For privacy, this is best disabled.
allow_device_name_federation = false
# Vector list of domains allowed to send requests to for URL previews. Defaults to none.
# Note: this is a *contains* match, not an explicit match. Putting "google.com" will match "https://google.com" and "http://mymaliciousdomainexamplegoogle.com"
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
url_preview_domain_contains_allowlist = []
# Vector list of explicit domains allowed to send requests to for URL previews. Defaults to none.
# Note: This is an *explicit* match, not a contains match. Putting "google.com" will match "https://google.com", "http://google.com", but not "https://mymaliciousdomainexamplegoogle.com"
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
url_preview_domain_explicit_allowlist = []
# Vector list of URLs allowed to send requests to for URL previews. Defaults to none.
# Note that this is a *contains* match, not an explicit match. Putting "google.com" will match "https://google.com/", "https://google.com/url?q=https://mymaliciousdomainexample.com", and "https://mymaliciousdomainexample.com/hi/google.com"
# Setting this to "*" will allow all URL previews. Please note that this opens up significant attack surface to your server, you are expected to be aware of the risks by doing so.
url_preview_url_contains_allowlist = []
# Vector list of explicit domains not allowed to send requests to for URL previews. Defaults to none.
# Note: This is an *explicit* match, not a contains match. Putting "google.com" will match "https://google.com", "http://google.com", but not "https://mymaliciousdomainexamplegoogle.com"
# The denylist is checked first before allowlist. Setting this to "*" will not do anything.
url_preview_domain_explicit_denylist = []
# Maximum amount of bytes allowed in a URL preview body size when spidering. Defaults to 384KB (384_000 bytes)
url_preview_max_spider_size = 384_000
# Option to decide whether you would like to run the domain allowlist checks (contains and explicit) on the root domain or not. Does not apply to URL contains allowlist. Defaults to false.
# Example: If this is enabled and you have "wikipedia.org" allowed in the explicit and/or contains domain allowlist, it will allow all subdomains under "wikipedia.org" such as "en.m.wikipedia.org" as the root domain is checked and matched.
# Useful if the domain contains allowlist is still too broad for you but you still want to allow all the subdomains under a root domain.
url_preview_check_root_domain = false
# Config option to allow or disallow incoming federation requests that obtain the profiles
# of our local users from `/_matrix/federation/v1/query/profile`
#
# This is inherently false if `allow_federation` is disabled
#
# Defaults to true
allow_profile_lookup_federation_requests = true
# Config option to automatically deactivate the account of any user who attempts to join a:
# - banned room
# - forbidden room alias
# - room alias or ID with a forbidden server name
#
# This may be useful if all your banned lists consist of toxic rooms or servers that no good faith user would ever attempt to join, and
# to automatically remediate the problem without any admin user intervention.
#
# This will also make the user leave all rooms. Federation (e.g. remote room invites) are ignored here.
#
# Defaults to false as rooms can be banned for non-moderation-related reasons
#auto_deactivate_banned_room_attempts = false
### Admin Room and Console
# Controls whether the conduwuit admin room console / CLI will immediately activate on startup.
# This option can also be enabled with `--console` conduwuit argument
#
# Defaults to false
#admin_console_automatic = false
# Controls what admin commands will be executed on startup. This is a vector list of strings of admin commands to run.
#
# An example of this can be: `admin_execute = ["debug ping puppygock.gay", "debug echo hi"]`
#
# This option can also be configured with the `--execute` conduwuit argument and can take standard shell commands and environment variables
#
# Such example could be: `./conduwuit --execute "server admin-notice conduwuit has started up at $(date)"`
#
# Defaults to nothing.
#admin_execute = [""]
# Controls whether conduwuit should error and fail to start if an admin execute command (`--execute` / `admin_execute`) fails
#
# Defaults to false
#admin_execute_errors_ignore = false
# Controls the max log level for admin command log captures (logs generated from running admin commands)
#
# Defaults to "info" on release builds, else "debug" on debug builds
#admin_log_capture = info
# Allows admins to enter commands in rooms other than #admins by prefixing with \!admin. The reply
# will be publicly visible to the room, originating from the sender.
# defaults to true
#admin_escape_commands = true
### Misc
# max log level for conduwuit. allows debug, info, warn, or error
# see also: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
# **Caveat**:
# For release builds, the tracing crate is configured to only implement levels higher than error to avoid unnecessary overhead in the compiled binary from trace macros.
# For debug builds, this restriction is not applied.
#
# Defaults to "info"
#log = "info"
# controls whether encrypted rooms and events are allowed (default true)
#allow_encryption = false
# if enabled, conduwuit will send a simple GET request periodically to `https://pupbrain.dev/check-for-updates/stable`
# for any new announcements made. Despite the name, this is not an update check
# endpoint, it is simply an announcement check endpoint.
# Defaults to false.
#allow_check_for_updates = false
# Set to false to disable users from joining or creating room versions that aren't 100% officially supported by conduwuit.
# conduwuit officially supports room versions 6 - 10. conduwuit has experimental/unstable support for 3 - 5, and 11.
# Defaults to true.
#allow_unstable_room_versions = true
# Option to control adding arbitrary text to the end of the user's displayname upon registration with a space before the text.
# This was the lightning bolt emoji option, just replaced with support for adding your own custom text or emojis.
# To disable, set this to "" (an empty string)
# Defaults to "🏳️‍⚧️" (trans pride flag)
#new_user_displayname_suffix = "🏳️‍⚧️"
# Option to control whether conduwuit will query your list of trusted notary key servers (`trusted_servers`) for
# remote homeserver signing keys it doesn't know *first*, or query the individual servers first before falling back to the trusted
# key servers.
#
# The former/default behaviour makes federated/remote rooms joins generally faster because we're querying a single (or list of) server
# that we know works, is reasonably fast, and is reliable for just about all the homeserver signing keys in the room. Querying individual
# servers may take longer depending on the general infrastructure of everyone in there, how many dead servers there are, etc.
#
# However, this does create an increased reliance on one single or multiple large entities as `trusted_servers` should generally
# contain long-term and large servers who know a very large number of homeservers.
#
# If you don't know what any of this means, leave this and `trusted_servers` alone to their defaults.
#
# Defaults to true as this is the fastest option for federation.
#query_trusted_key_servers_first = true
# List/vector of room **IDs** that conduwuit will make newly registered users join.
# The room IDs specified must be rooms that you have joined at least once on the server, and must be public.
#
# No default.
#auto_join_rooms = []
# Retry failed and incomplete messages to remote servers immediately upon startup. This is called bursting.
# If this is disabled, said messages may not be delivered until more messages are queued for that server.
# Do not change this option unless server resources are extremely limited or the scale of the server's
# deployment is huge. Do not disable this unless you know what you are doing.
#startup_netburst = true
# Limit the startup netburst to the most recent (default: 50) messages queued for each remote server. All older
# messages are dropped and not reattempted. The `startup_netburst` option must be enabled for this value to have
# any effect. Do not change this value unless you know what you are doing. Set this value to -1 to reattempt
# every message without trimming the queues; this may consume significant disk. Set this value to 0 to drop all
# messages without any attempt at redelivery.
#startup_netburst_keep = 50
# If the 'perf_measurements' feature is enabled, enables collecting folded stack trace profile of tracing spans using
# tracing_flame. The resulting profile can be visualized with inferno[1], speedscope[2], or a number of other tools.
# [1]: https://github.com/jonhoo/inferno
# [2]: www.speedscope.app
# tracing_flame = false
# If 'tracing_flame' is enabled, sets a filter for which events will be included in the profile.
# Supported syntax is documented at https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
# tracing_flame_filter = "trace,h2=off"
# If 'tracing_flame' is enabled, set the path to write the generated profile.
# tracing_flame_output_path = "./tracing.folded"
# Enable the tokio-console. This option is only relevant to developers.
# See: docs/development.md#debugging-with-tokio-console for more information.
#tokio_console = false
# Enable backward-compatibility with Conduit's media directory by creating symlinks of media. This
# option is only necessary if you plan on using Conduit again. Otherwise setting this to false
# reduces filesystem clutter and overhead for managing these symlinks in the directory. This is now
# disabled by default. You may still return to upstream Conduit but you have to run Conduwuit at
# least once with this set to true and allow the media_startup_check to take place before shutting
# down to return to Conduit.
#
# Disabled by default.
#media_compat_file_link = false
# Prunes missing media from the database as part of the media startup checks. This means if you
# delete files from the media directory the corresponding entries will be removed from the
# database. This is disabled by default because if the media directory is accidentally moved or
# inaccessible the metadata entries in the database will be lost with sadness.
#
# Disabled by default.
#prune_missing_media = false
# Checks consistency of the media directory at startup:
# 1. When `media_compat_file_link` is enbled, this check will upgrade media when switching back
# and forth between Conduit and Conduwuit. Both options must be enabled to handle this.
# 2. When media is deleted from the directory, this check will also delete its database entry.
#
# If none of these checks apply to your use cases, and your media directory is significantly large
# setting this to false may reduce startup time.
#
# Enabled by default.
#media_startup_check = true
# OpenID token expiration/TTL in seconds
#
# These are the OpenID tokens that are primarily used for Matrix account integrations, *not* OIDC/OpenID Connect/etc
#
# Defaults to 3600 (1 hour)
#openid_token_ttl = 3600
# Emergency password feature. This password set here will let you login to the server service account (e.g. `@conduit`)
# and let you run admin commands, invite yourself to the admin room, etc.
#
# no default.
#emergency_password = ""
### Generic database options
# Set this to any float value to multiply conduwuit's in-memory LRU caches with.
# By default, the caches scale automatically with cpu-core-count.
# May be useful if you have significant memory to spare to increase performance.
#
# This was previously called `conduit_cache_capacity_modifier`
#
# Defaults to 1.0.
#cache_capacity_modifier = 1.0
# Set this to any float value in megabytes for conduwuit to tell the database engine that this much memory is available for database-related caches.
# May be useful if you have significant memory to spare to increase performance.
# Defaults to 128.0 + (64.0 * CPU core count).
#db_cache_capacity_mb = 256.0
### RocksDB options
# Set this to true to use RocksDB config options that are tailored to HDDs (slower device storage)
#
# It is worth noting that by default, conduwuit will use RocksDB with Direct IO enabled. *Generally* speaking this improves performance as it bypasses buffered I/O (system page cache).
# However there is a potential chance that Direct IO may cause issues with database operations if your setup is uncommon. This has been observed with FUSE filesystems, and possibly ZFS filesystem.
# RocksDB generally deals/corrects these issues but it cannot account for all setups.
# If you experience any weird RocksDB issues, try enabling this option as it turns off Direct IO and feel free to report in the conduwuit Matrix room if this option fixes your DB issues.
# See https://github.com/facebook/rocksdb/wiki/Direct-IO for more information.
#
# Defaults to false
#rocksdb_optimize_for_spinning_disks = false
# Enables direct-io to increase database performance. This is enabled by default. Set this option to false if the
# database resides on a filesystem which does not support direct-io.
#rocksdb_direct_io = true
# RocksDB log level. This is not the same as conduwuit's log level. This is the log level for the RocksDB engine/library
# which show up in your database folder/path as `LOG` files. Defaults to error. conduwuit will typically log RocksDB errors as normal.
#rocksdb_log_level = "error"
# Max RocksDB `LOG` file size before rotating in bytes. Defaults to 4MB.
#rocksdb_max_log_file_size = 4194304
# Time in seconds before RocksDB will forcibly rotate logs. Defaults to 0.
#rocksdb_log_time_to_roll = 0
# Amount of threads that RocksDB will use for parallelism on database operatons such as cleanup, sync, flush, compaction, etc. Set to 0 to use all your logical threads.
#
# Defaults to your CPU logical thread count.
#rocksdb_parallelism_threads = 0
# Enables idle IO priority for compaction thread. This prevents any unexpected lag in the server's operation and
# is usually a good idea. Enabled by default.
#rocksdb_compaction_ioprio_idle = true
# Enables idle CPU priority for compaction thread. This is not enabled by default to prevent compaction from
# falling too far behind on busy systems.
#rocksdb_compaction_prio_idle = false
# Maximum number of LOG files RocksDB will keep. This must *not* be set to 0. It must be at least 1.
# Defaults to 3 as these are not very useful.
#rocksdb_max_log_files = 3
# Type of RocksDB database compression to use.
# Available options are "zstd", "zlib", "bz2", "lz4", or "none"
# It is best to use ZSTD as an overall good balance between speed/performance, storage, IO amplification, and CPU usage.
# For more performance but less compression (more storage used) and less CPU usage, use LZ4.
# See https://github.com/facebook/rocksdb/wiki/Compression for more details.
#
# "none" will disable compression.
#
# Defaults to "zstd"
#rocksdb_compression_algo = "zstd"
# Level of compression the specified compression algorithm for RocksDB to use.
# Default is 32767, which is internally read by RocksDB as the default magic number and
# translated to the library's default compression level as they all differ.
# See their `kDefaultCompressionLevel`.
#
#rocksdb_compression_level = 32767
# Level of compression the specified compression algorithm for the bottommost level/data for RocksDB to use.
# Default is 32767, which is internally read by RocksDB as the default magic number and
# translated to the library's default compression level as they all differ.
# See their `kDefaultCompressionLevel`.
#
# Since this is the bottommost level (generally old and least used data), it may be desirable to have a very
# high compression level here as it's lesss likely for this data to be used. Research your chosen compression algorithm.
#
#rocksdb_bottommost_compression_level = 32767
# Whether to enable RocksDB "bottommost_compression".
# At the expense of more CPU usage, this will further compress the database to reduce more storage.
# It is recommended to use ZSTD compression with this for best compression results.
# See https://github.com/facebook/rocksdb/wiki/Compression for more details.
#
# Defaults to false as this uses more CPU when compressing.
#rocksdb_bottommost_compression = false
# Level of statistics collection. Some admin commands to display database statistics may require
# this option to be set. Database performance may be impacted by higher settings.
#
# Option is a number ranging from 0 to 6:
# 0 = No statistics.
# 1 = No statistics in release mode (default).
# 2 to 3 = Statistics with no performance impact.
# 3 to 5 = Statistics with possible performance impact.
# 6 = All statistics.
#
# Defaults to 1 (No statistics, except in debug-mode)
#rocksdb_stats_level = 1
# Database repair mode (for RocksDB SST corruption)
#
# Use this option when the server reports corruption while running or panics. If the server refuses
# to start use the recovery mode options first. Corruption errors containing the acronym 'SST' which
# occur after startup will likely require this option.
#
# - Backing up your database directory is recommended prior to running the repair.
# - Disabling repair mode and restarting the server is recommended after running the repair.
#
# Defaults to false
#rocksdb_repair = false
# Database recovery mode (for RocksDB WAL corruption)
#
# Use this option when the server reports corruption and refuses to start. Set mode 2 (PointInTime)
# to cleanly recover from this corruption. The server will continue from the last good state,
# several seconds or minutes prior to the crash. Clients may have to run "clear-cache & reload" to
# account for the rollback. Upon success, you may reset the mode back to default and restart again.
# Please note in some cases the corruption error may not be cleared for at least 30 minutes of
# operation in PointInTime mode.
#
# As a very last ditch effort, if PointInTime does not fix or resolve anything, you can try mode
# 3 (SkipAnyCorruptedRecord) but this will leave the server in a potentially inconsistent state.
#
# The default mode 1 (TolerateCorruptedTailRecords) will automatically drop the last entry in the
# database if corrupted during shutdown, but nothing more. It is extraordinarily unlikely this will
# desynchronize clients. To disable any form of silent rollback set mode 0 (AbsoluteConsistency).
#
# The options are:
# 0 = AbsoluteConsistency
# 1 = TolerateCorruptedTailRecords (default)
# 2 = PointInTime (use me if trying to recover)
# 3 = SkipAnyCorruptedRecord (you now voided your Conduwuit warranty)
#
# See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes for more information
#
# Defaults to 1 (TolerateCorruptedTailRecords)
#rocksdb_recovery_mode = 1
### Domain Name Resolution and Caching
# Maximum entries stored in DNS memory-cache. The size of an entry may vary so please take care if
# raising this value excessively. Only decrease this when using an external DNS cache. Please note
# that systemd does *not* count as an external cache, even when configured to do so.
#dns_cache_entries = 32768
# Minimum time-to-live in seconds for entries in the DNS cache. The default may appear high to most
# administrators; this is by design. Only decrease this if you are using an external DNS cache.
#dns_min_ttl = 10800
# Minimum time-to-live in seconds for NXDOMAIN entries in the DNS cache. This value is critical for
# the server to federate efficiently. NXDOMAIN's are assumed to not be returning to the federation
# and aggressively cached rather than constantly rechecked.
#
# Defaults to 3 days as these are *very rarely* false negatives.
#dns_min_ttl_nxdomain = 259200
# The number of seconds to wait for a reply to a DNS query. Please note that recursive queries can
# take up to several seconds for some domains, so this value should not be too low.
#dns_timeout = 10
# Number of retries after a timeout.
#dns_attempts = 10
# Fallback to TCP on DNS errors. Set this to false if unsupported by nameserver.
#dns_tcp_fallback = true
# Enable to query all nameservers until the domain is found. Referred to as "trust_negative_responses" in hickory_resolver.
# This can avoid useless DNS queries if the first nameserver responds with NXDOMAIN or an empty NOERROR response.
#
# The default is to query one nameserver and stop (false).
#query_all_nameservers = true
# Enables using *only* TCP for querying your specified nameservers instead of UDP.
#
# You very likely do *not* want this. hickory-resolver already falls back to TCP on UDP errors.
# Defaults to false
#query_over_tcp_only = false
# DNS A/AAAA record lookup strategy
#
# Takes a number of one of the following options:
# 1 - Ipv4Only (Only query for A records, no AAAA/IPv6)
# 2 - Ipv6Only (Only query for AAAA records, no A/IPv4)
# 3 - Ipv4AndIpv6 (Query for A and AAAA records in parallel, uses whatever returns a successful response first)
# 4 - Ipv6thenIpv4 (Query for AAAA record, if that fails then query the A record)
# 5 - Ipv4thenIpv6 (Query for A record, if that fails then query the AAAA record)
#
# If you don't have IPv6 networking, then for better performance it may be suitable to set this to Ipv4Only (1) as
# you will never ever use the AAAA record contents even if the AAAA record is successful instead of the A record.
#
# Defaults to 5 - Ipv4ThenIpv6 as this is the most compatible and IPv4 networking is currently the most prevalent.
#ip_lookup_strategy = 5
### Request Timeouts, Connection Timeouts, and Connection Pooling
## Request Timeouts are HTTP response timeouts
## Connection Timeouts are TCP connection timeouts
##
## Connection Pooling Timeouts are timeouts for keeping an open idle connection alive.
## Connection pooling and keepalive is very useful for federation or other places where for performance reasons,
## we want to keep connections open that we will re-use frequently due to TCP and TLS 1.3 overhead/expensiveness.
##
## Generally these defaults are the best, but if you find a reason to need to change these they are here.
# Default/base connection timeout.
# This is used only by URL previews and update/news endpoint checks
#
# Defaults to 10 seconds
#request_conn_timeout = 10
# Default/base request timeout. The time waiting to receive more data from another server.
# This is used only by URL previews, update/news, and misc endpoint checks
#
# Defaults to 35 seconds
#request_timeout = 35
# Default/base request total timeout. The time limit for a whole request. This is set very high to not
# cancel healthy requests while serving as a backstop.
# This is used only by URL previews and update/news endpoint checks
#
# Defaults to 320 seconds
#request_total_timeout = 320
# Default/base idle connection pool timeout
# This is used only by URL previews and update/news endpoint checks
#
# Defaults to 5 seconds
#request_idle_timeout = 5
# Default/base max idle connections per host
# This is used only by URL previews and update/news endpoint checks
#
# Defaults to 1 as generally the same open connection can be re-used
#request_idle_per_host = 1
# Federation well-known resolution connection timeout
#
# Defaults to 6 seconds
#well_known_conn_timeout = 6
# Federation HTTP well-known resolution request timeout
#
# Defaults to 10 seconds
#well_known_timeout = 10
# Federation client request timeout
# You most definitely want this to be high to account for extremely large room joins, slow homeservers, your own resources etc.
#
# Defaults to 300 seconds
#federation_timeout = 300
# Federation client idle connection pool timeout
#
# Defaults to 25 seconds
#federation_idle_timeout = 25
# Federation client max idle connections per host
#
# Defaults to 1 as generally the same open connection can be re-used
#federation_idle_per_host = 1
# Federation sender request timeout
# The time it takes for the remote server to process sent transactions can take a while.
#
# Defaults to 180 seconds
#sender_timeout = 180
# Federation sender idle connection pool timeout
#
# Defaults to 180 seconds
#sender_idle_timeout = 180
# Federation sender transaction retry backoff limit
#
# Defaults to 86400 seconds
#sender_retry_backoff_limit = 86400
# Appservice URL request connection timeout
#
# Defaults to 35 seconds as generally appservices are hosted within the same network
#appservice_timeout = 35
# Appservice URL idle connection pool timeout
#
# Defaults to 300 seconds
#appservice_idle_timeout = 300
# Notification gateway pusher idle connection pool timeout
#
# Defaults to 15 seconds
#pusher_idle_timeout = 15
### Presence / Typing Indicators / Read Receipts
# Config option to control local (your server only) presence updates/requests. Defaults to true.
# Note that presence on conduwuit is very fast unlike Synapse's.
# If using outgoing presence, this MUST be enabled.
#
#allow_local_presence = true
# Config option to control incoming federated presence updates/requests. Defaults to true.
# This option receives presence updates from other servers, but does not send any unless `allow_outgoing_presence` is true.
# Note that presence on conduwuit is very fast unlike Synapse's.
#
#allow_incoming_presence = true
# Config option to control outgoing presence updates/requests. Defaults to true.
# This option sends presence updates to other servers, but does not receive any unless `allow_incoming_presence` is true.
# Note that presence on conduwuit is very fast unlike Synapse's.
# If using outgoing presence, you MUST enable `allow_local_presence` as well.
#
#allow_outgoing_presence = true
# Config option to enable the presence idle timer for remote users. Disabling is offered as an optimization for
# servers participating in many large rooms or when resources are limited. Disabling it may cause incorrect
# presence states (i.e. stuck online) to be seen for some remote users. Defaults to true.
#presence_timeout_remote_users = true
# Config option to control how many seconds before presence updates that you are idle. Defaults to 5 minutes.
#presence_idle_timeout_s = 300
# Config option to control how many seconds before presence updates that you are offline. Defaults to 30 minutes.
#presence_offline_timeout_s = 1800
# Config option to control whether we should receive remote incoming read receipts.
# Defaults to true.
#allow_incoming_read_receipts = true
# Config option to control whether we should send read receipts to remote servers.
# Defaults to true.
#allow_outgoing_read_receipts = true
# Config option to control outgoing typing updates to federation. Defaults to true.
#allow_outgoing_typing = true
# Config option to control incoming typing updates from federation. Defaults to true.
#allow_incoming_typing = true
# Config option to control maximum time federation user can indicate typing.
#typing_federation_timeout_s = 30
# Config option to control minimum time local client can indicate typing. This does not override
# a client's request to stop typing. It only enforces a minimum value in case of no stop request.
#typing_client_timeout_min_s = 15
# Config option to control maximum time local client can indicate typing.
#typing_client_timeout_max_s = 45
### TURN / VoIP
# vector list of TURN URIs/servers to use
#
# No default
#turn_uris = ["turn:example.turn.uri?transport=udp", "turn:example.turn.uri?transport=tcp"]
# TURN secret to use for generating the HMAC-SHA1 hash apart of username and password generation
#
# this is more secure, but if needed you can use traditional username/password below.
#
# no default
#turn_secret = ""
# TURN username to provide the client
#
# no default
#turn_username = ""
# TURN password to provide the client
#
# no default
#turn_password = ""
# TURN TTL
#
# Default is 86400 seconds
#turn_ttl = 86400
# allow guests/unauthenticated users to access TURN credentials
#
# this is the equivalent of Synapse's `turn_allow_guests` config option. this allows
# any unauthenticated user to call `/_matrix/client/v3/voip/turnServer`.
#
# defaults to false
#turn_allow_guests = false
# Other options not in [global]:
#
#
# Enables running conduwuit with direct TLS support
# It is strongly recommended you use a reverse proxy instead. This is primarily relevant for test suites like complement that require a private CA setup.
# [global.tls]
# certs = "/path/to/my/certificate.crt"
# key = "/path/to/my/private_key.key"
#
# Whether to listen and allow for HTTP and HTTPS connections (insecure!)
# This config option is only available if conduwuit was built with `axum_dual_protocol` feature (not default feature)
# Defaults to false
#dual_protocol = false
# If you are using delegation via well-known files and you cannot serve them from your reverse proxy, you can
# uncomment these to serve them directly from conduwuit. This requires proxying all requests to conduwuit, not just `/_matrix` to work.
#
#[global.well_known]
#server = "matrix.example.com:443"
#client = "https://matrix.example.com"
#
# A single contact and/or support page for /.well-known/matrix/support
# All options here are strings. Currently only supports 1 single contact.
# No default.
#
#support_page = ""
#support_role = ""
#support_email = ""
#support_mxid = ""

41
debian/README.md vendored
View file

@ -1,37 +1,22 @@
Conduit for Debian
==================
# conduwuit for Debian
Installation
------------
Information about downloading and deploying the Debian package. This may also be referenced for other `apt`-based distros such as Ubuntu.
Information about downloading, building and deploying the Debian package, see
the "Installing Conduit" section in [DEPLOY.md](../DEPLOY.md).
All following sections until "Setting up the Reverse Proxy" be ignored because
this is handled automatically by the packaging.
### Installation
Configuration
-------------
It is recommended to see the [generic deployment guide](../deploying/generic.md) for further information if needed as usage of the Debian package is generally related.
When installed, Debconf generates the configuration of the homeserver
(host)name, the address and port it listens on. This configuration ends up in
`/etc/matrix-conduit/conduit.toml`.
### Configuration
You can tweak more detailed settings by uncommenting and setting the variables
in `/etc/matrix-conduit/conduit.toml`. This involves settings such as the maximum
file size for download/upload, enabling federation, etc.
When installed, the example config is placed at `/etc/conduwuit/conduwuit.toml` as the default config. At the minimum, you will need to change your `server_name` here.
Running
-------
You can tweak more detailed settings by uncommenting and setting the config options
in `/etc/conduwuit/conduwuit.toml`.
The package uses the `matrix-conduit.service` systemd unit file to start and
stop Conduit. It loads the configuration file mentioned above to set up the
environment before running the server.
### Running
This package assumes by default that Conduit will be placed behind a reverse
proxy such as Apache or nginx. This default deployment entails just listening
on `127.0.0.1` and the free port `6167` and is reachable via a client using the URL
<http://localhost:6167>.
The package uses the [`conduwuit.service`](../configuration/examples.md#example-systemd-unit-file) systemd unit file to start and stop conduwuit. The binary is installed at `/usr/sbin/conduwuit`.
At a later stage this packaging may support also setting up TLS and running
stand-alone. In this case, however, you need to set up some certificates and
renewal, for it to work properly.
This package assumes by default that conduwuit will be placed behind a reverse proxy. The default config options apply (listening on `localhost` and TCP port `6167`). Matrix federation requires a valid domain name and TLS, so you will need to set up TLS certificates and renewal for it to work properly if you intend to federate.
Consult various online documentation and guides on setting up a reverse proxy and TLS. Caddy is documented at the [generic deployment guide](../deploying/generic.md#setting-up-the-reverse-proxy) as it's the easiest and most user friendly.

64
debian/conduwuit.service vendored Normal file
View file

@ -0,0 +1,64 @@
[Unit]
Description=conduwuit Matrix homeserver
Documentation=https://conduwuit.puppyirl.gay/
After=network-online.target
[Service]
DynamicUser=yes
User=conduwuit
Group=conduwuit
Type=notify
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml"
ExecStart=/usr/sbin/conduwuit
ReadWritePaths=/var/lib/conduwuit /etc/conduwuit
AmbientCapabilities=
CapabilityBoundingSet=
DevicePolicy=closed
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
ProcSubset=pid
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectProc=invisible
ProtectSystem=strict
PrivateDevices=yes
PrivateMounts=yes
PrivateTmp=yes
PrivateUsers=yes
PrivateIPC=yes
RemoveIPC=yes
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service @resources
SystemCallFilter=~@clock @debug @module @mount @reboot @swap @cpu-emulation @obsolete @timer @chown @setuid @privileged @keyring @ipc
SystemCallErrorNumber=EPERM
#StateDirectory=conduwuit
RuntimeDirectory=conduwuit
RuntimeDirectoryMode=0750
Restart=on-failure
RestartSec=5
TimeoutStopSec=2m
TimeoutStartSec=2m
StartLimitInterval=1m
StartLimitBurst=5
[Install]
WantedBy=multi-user.target

23
debian/config vendored
View file

@ -1,17 +1,18 @@
#!/bin/sh
set -e
# TODO: implement debconf support that is maintainable without duplicating the config
# Source debconf library.
. /usr/share/debconf/confmodule
# Ask for the Matrix homeserver name, address and port.
db_input high matrix-conduit/hostname || true
db_go
db_input low matrix-conduit/address || true
db_go
db_input medium matrix-conduit/port || true
db_go
#. /usr/share/debconf/confmodule
#
## Ask for the Matrix homeserver name, address and port.
#db_input high conduwuit/hostname || true
#db_go
#
#db_input low conduwuit/address || true
#db_go
#
#db_input medium conduwuit/port || true
#db_go
exit 0

View file

@ -1,47 +0,0 @@
[Unit]
Description=Conduit Matrix homeserver
After=network.target
[Service]
DynamicUser=yes
User=_matrix-conduit
Group=_matrix-conduit
Type=simple
AmbientCapabilities=
CapabilityBoundingSet=
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=strict
PrivateDevices=yes
PrivateMounts=yes
PrivateTmp=yes
PrivateUsers=yes
RemoveIPC=yes
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
StateDirectory=matrix-conduit
Environment="CONDUIT_CONFIG=/etc/matrix-conduit/conduit.toml"
ExecStart=/usr/sbin/matrix-conduit
Restart=on-failure
RestartSec=10
StartLimitInterval=1m
StartLimitBurst=5
[Install]
WantedBy=multi-user.target

95
debian/postinst vendored
View file

@ -1,86 +1,43 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
# TODO: implement debconf support that is maintainable without duplicating the config
#. /usr/share/debconf/confmodule
CONDUIT_CONFIG_PATH=/etc/matrix-conduit
CONDUIT_CONFIG_FILE="${CONDUIT_CONFIG_PATH}/conduit.toml"
CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit/
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
case "$1" in
configure)
# Create the `_matrix-conduit` user if it does not exist yet.
if ! getent passwd _matrix-conduit > /dev/null ; then
echo 'Adding system user for the Conduit Matrix homeserver' 1>&2
# Create the `conduwuit` user if it does not exist yet.
if ! getent passwd conduwuit > /dev/null ; then
echo 'Adding system user for the conduwuit Matrix homeserver' 1>&2
adduser --system --group --quiet \
--home "$CONDUIT_DATABASE_PATH" \
--home "$CONDUWUIT_DATABASE_PATH" \
--disabled-login \
--force-badname \
_matrix-conduit
--shell "/usr/sbin/nologin" \
conduwuit
fi
# Create the database path if it does not exist yet and fix up ownership
# and permissions.
mkdir -p "$CONDUIT_DATABASE_PATH"
chown _matrix-conduit "$CONDUIT_DATABASE_PATH"
chmod 700 "$CONDUIT_DATABASE_PATH"
# and permissions for the config.
mkdir -v -p "$CONDUWUIT_DATABASE_PATH"
if [ ! -e "$CONDUIT_CONFIG_FILE" ]; then
# Write the debconf values in the config.
db_get matrix-conduit/hostname
CONDUIT_SERVER_NAME="$RET"
db_get matrix-conduit/address
CONDUIT_ADDRESS="$RET"
db_get matrix-conduit/port
CONDUIT_PORT="$RET"
mkdir -p "$CONDUIT_CONFIG_PATH"
cat > "$CONDUIT_CONFIG_FILE" << EOF
[global]
# The server_name is the pretty name of this server. It is used as a suffix for
# user and room ids. Examples: matrix.org, conduit.rs
# The Conduit server needs all /_matrix/ requests to be reachable at
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).
# If that's not possible for you, you can create /.well-known files to redirect
# requests. See
# https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client
# and
# https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server
# for more information
server_name = "${CONDUIT_SERVER_NAME}"
# This is the only directory where Conduit will save its data.
database_path = "${CONDUIT_DATABASE_PATH}"
database_backend = "rocksdb"
# The address Conduit will be listening on.
# By default the server listens on address 0.0.0.0. Change this to 127.0.0.1 to
# only listen on the localhost when using a reverse proxy.
address = "${CONDUIT_ADDRESS}"
# The port Conduit will be running on. You need to set up a reverse proxy in
# your web server (e.g. apache or nginx), so all requests to /_matrix on port
# 443 and 8448 will be forwarded to the Conduit instance running on this port
# Docker users: Don't change this, you'll need to map an external port to this.
port = ${CONDUIT_PORT}
# Max size for uploads
max_request_size = 20_000_000 # in bytes
# Enables registration. If set to false, no users can register on this server.
allow_registration = true
allow_federation = true
allow_check_for_updates = true
trusted_servers = ["matrix.org"]
#max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time
#log = "warn,state_res=warn,rocket=off,_=off,sled=off"
EOF
# symlink the previous location for compatibility if it does not exist yet.
if ! test -L "/var/lib/matrix-conduit" ; then
ln -s -v "$CONDUWUIT_DATABASE_PATH" "/var/lib/matrix-conduit"
fi
chown -v conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH"
chown -v conduwuit:conduwuit -R "$CONDUWUIT_CONFIG_PATH"
chmod -v 740 "$CONDUWUIT_DATABASE_PATH"
echo ''
echo 'Make sure you edit the example config at /etc/conduwuit/conduwuit.toml before starting!'
echo 'To start the server, run: systemctl start conduwuit.service'
echo ''
;;
esac

19
debian/postrm vendored
View file

@ -1,10 +1,11 @@
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
#. /usr/share/debconf/confmodule
CONDUIT_CONFIG_PATH=/etc/matrix-conduit
CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
CONDUWUIT_DATABASE_PATH_SYMLINK=/var/lib/matrix-conduit
case $1 in
purge)
@ -14,12 +15,16 @@ case $1 in
# Per https://www.debian.org/doc/debian-policy/ch-files.html#behavior
# "configuration files must be preserved when the package is removed, and
# only deleted when the package is purged."
if [ -d "$CONDUIT_CONFIG_PATH" ]; then
rm -r "$CONDUIT_CONFIG_PATH"
if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then
rm -v -r "$CONDUWUIT_CONFIG_PATH"
fi
if [ -d "$CONDUIT_DATABASE_PATH" ]; then
rm -r "$CONDUIT_DATABASE_PATH"
if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then
rm -v -r "$CONDUWUIT_DATABASE_PATH"
fi
if [ -d "$CONDUWUIT_DATABASE_PATH_SYMLINK" ]; then
rm -v -r "$CONDUWUIT_DATABASE_PATH_SYMLINK"
fi
;;
esac

21
debian/templates vendored
View file

@ -1,21 +0,0 @@
Template: matrix-conduit/hostname
Type: string
Default: localhost
Description: The server (host)name of the Matrix homeserver
This is the hostname the homeserver will be reachable at via a client.
.
If set to "localhost", you can connect with a client locally and clients
from other hosts and also other homeservers will not be able to reach you!
Template: matrix-conduit/address
Type: string
Default: 127.0.0.1
Description: The listen address of the Matrix homeserver
This is the address the homeserver will listen on. Leave it set to 127.0.0.1
when using a reverse proxy.
Template: matrix-conduit/port
Type: string
Default: 6167
Description: The port of the Matrix homeserver
This port is most often just accessed by a reverse proxy.

10
default.nix Normal file
View file

@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix

42
deps/rust-rocksdb/Cargo.toml vendored Normal file
View file

@ -0,0 +1,42 @@
[package]
name = "rust-rocksdb-uwu"
categories.workspace = true
description = "dylib wrapper for rust-rocksdb"
edition = "2021"
keywords.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
version = "0.0.1"
[features]
default = ["lz4", "zstd", "zlib", "bzip2"]
jemalloc = ["rust-rocksdb/jemalloc"]
io-uring = ["rust-rocksdb/io-uring"]
valgrind = ["rust-rocksdb/valgrind"]
snappy = ["rust-rocksdb/snappy"]
lz4 = ["rust-rocksdb/lz4"]
zstd = ["rust-rocksdb/zstd"]
zlib = ["rust-rocksdb/zlib"]
bzip2 = ["rust-rocksdb/bzip2"]
rtti = ["rust-rocksdb/rtti"]
mt_static = ["rust-rocksdb/mt_static"]
multi-threaded-cf = ["rust-rocksdb/multi-threaded-cf"]
serde1 = ["rust-rocksdb/serde1"]
malloc-usable-size = ["rust-rocksdb/malloc-usable-size"]
[dependencies.rust-rocksdb]
git = "https://github.com/girlbossceo/rust-rocksdb-zaidoon1"
rev = "22f942609921ecf837399e1c2fe6fcb8dbb1095e"
#branch = "master"
default-features = false
[lib]
path = "lib.rs"
crate-type = [
"rlib",
# "dylib"
]
[lints]
workspace = true

61
deps/rust-rocksdb/lib.rs vendored Normal file
View file

@ -0,0 +1,61 @@
pub use rust_rocksdb::*;
#[cfg_attr(not(conduit_mods), link(name = "rocksdb"))]
#[cfg_attr(conduit_mods, link(name = "rocksdb", kind = "static"))]
extern "C" {
pub fn rocksdb_list_column_families();
pub fn rocksdb_logger_create_stderr_logger();
pub fn rocksdb_options_set_info_log();
pub fn rocksdb_get_options_from_string();
pub fn rocksdb_writebatch_create();
pub fn rocksdb_writebatch_destroy();
pub fn rocksdb_writebatch_put_cf();
pub fn rocksdb_writebatch_delete_cf();
pub fn rocksdb_iter_value();
pub fn rocksdb_iter_seek_to_last();
pub fn rocksdb_iter_seek_for_prev();
pub fn rocksdb_iter_seek_to_first();
pub fn rocksdb_iter_next();
pub fn rocksdb_iter_prev();
pub fn rocksdb_iter_seek();
pub fn rocksdb_iter_valid();
pub fn rocksdb_iter_get_error();
pub fn rocksdb_iter_key();
pub fn rocksdb_iter_destroy();
pub fn rocksdb_livefiles();
pub fn rocksdb_livefiles_count();
pub fn rocksdb_livefiles_destroy();
pub fn rocksdb_livefiles_column_family_name();
pub fn rocksdb_livefiles_name();
pub fn rocksdb_livefiles_size();
pub fn rocksdb_livefiles_level();
pub fn rocksdb_livefiles_smallestkey();
pub fn rocksdb_livefiles_largestkey();
pub fn rocksdb_livefiles_entries();
pub fn rocksdb_livefiles_deletions();
pub fn rocksdb_put_cf();
pub fn rocksdb_delete_cf();
pub fn rocksdb_get_pinned_cf();
pub fn rocksdb_create_column_family();
pub fn rocksdb_get_latest_sequence_number();
pub fn rocksdb_batched_multi_get_cf();
pub fn rocksdb_cancel_all_background_work();
pub fn rocksdb_repair_db();
pub fn rocksdb_list_column_families_destroy();
pub fn rocksdb_flush();
pub fn rocksdb_flush_wal();
pub fn rocksdb_open_column_families();
pub fn rocksdb_open_for_read_only_column_families();
pub fn rocksdb_open_as_secondary_column_families();
pub fn rocksdb_open_column_families_with_ttl();
pub fn rocksdb_open();
pub fn rocksdb_open_for_read_only();
pub fn rocksdb_open_with_ttl();
pub fn rocksdb_open_as_secondary();
pub fn rocksdb_write();
pub fn rocksdb_create_iterator_cf();
pub fn rocksdb_backup_engine_create_new_backup_flush();
pub fn rocksdb_backup_engine_options_create();
pub fn rocksdb_write_buffer_manager_destroy();
pub fn rocksdb_options_set_ttl();
}

1
development.md Symbolic link
View file

@ -0,0 +1 @@
docs/development.md

View file

@ -1,218 +0,0 @@
# Deploy using Docker
> **Note:** To run and use Conduit you should probably use it with a Domain or Subdomain behind a reverse proxy (like Nginx, Traefik, Apache, ...) with a Lets Encrypt certificate.
## Docker
To run Conduit with Docker you can either build the image yourself or pull it from a registry.
### Use a registry
OCI images for Conduit are available in the registries listed below. We recommend using the image tagged as `latest` from GitLab's own registry.
| Registry | Image | Size | Notes |
| --------------- | --------------------------------------------------------------- | ----------------------------- | ---------------------- |
| GitLab Registry | [registry.gitlab.com/famedly/conduit/matrix-conduit:latest][gl] | ![Image Size][shield-latest] | Stable image. |
| Docker Hub | [docker.io/matrixconduit/matrix-conduit:latest][dh] | ![Image Size][shield-latest] | Stable image. |
| GitLab Registry | [registry.gitlab.com/famedly/conduit/matrix-conduit:next][gl] | ![Image Size][shield-next] | Development version. |
| Docker Hub | [docker.io/matrixconduit/matrix-conduit:next][dh] | ![Image Size][shield-next] | Development version. |
[dh]: https://hub.docker.com/r/matrixconduit/matrix-conduit
[gl]: https://gitlab.com/famedly/conduit/container_registry/2497937
[shield-latest]: https://img.shields.io/docker/image-size/matrixconduit/matrix-conduit/latest
[shield-next]: https://img.shields.io/docker/image-size/matrixconduit/matrix-conduit/next
Use
```bash
docker image pull <link>
```
to pull it to your machine.
### Build using a dockerfile
The Dockerfile provided by Conduit has two stages, each of which creates an image.
1. **Builder:** Builds the binary from local context or by cloning a git revision from the official repository.
2. **Runner:** Copies the built binary from **Builder** and sets up the runtime environment, like creating a volume to persist the database and applying the correct permissions.
To build the image you can use the following command
```bash
docker build --tag matrixconduit/matrix-conduit:latest .
```
which also will tag the resulting image as `matrixconduit/matrix-conduit:latest`.
### Run
When you have the image you can simply run it with
```bash
docker run -d -p 8448:6167 \
-v db:/var/lib/matrix-conduit/ \
-e CONDUIT_SERVER_NAME="your.server.name" \
-e CONDUIT_DATABASE_BACKEND="rocksdb" \
-e CONDUIT_ALLOW_REGISTRATION=true \
-e CONDUIT_ALLOW_FEDERATION=true \
-e CONDUIT_MAX_REQUEST_SIZE="20_000_000" \
-e CONDUIT_TRUSTED_SERVERS="[\"matrix.org\"]" \
-e CONDUIT_MAX_CONCURRENT_REQUESTS="100" \
-e CONDUIT_LOG="warn,rocket=off,_=off,sled=off" \
--name conduit <link>
```
or you can use [docker-compose](#docker-compose).
The `-d` flag lets the container run in detached mode. You now need to supply a `conduit.toml` config file, an example can be found [here](../conduit-example.toml).
You can pass in different env vars to change config values on the fly. You can even configure Conduit completely by using env vars, but for that you need
to pass `-e CONDUIT_CONFIG=""` into your container. For an overview of possible values, please take a look at the `docker-compose.yml` file.
If you just want to test Conduit for a short time, you can use the `--rm` flag, which will clean up everything related to your container after you stop it.
### Docker-compose
If the `docker run` command is not for you or your setup, you can also use one of the provided `docker-compose` files.
Depending on your proxy setup, you can use one of the following files;
- If you already have a `traefik` instance set up, use [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml)
- If you don't have a `traefik` instance set up (or any other reverse proxy), use [`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)
- For any other reverse proxy, use [`docker-compose.yml`](docker-compose.yml)
When picking the traefik-related compose file, rename it so it matches `docker-compose.yml`, and
rename the override file to `docker-compose.override.yml`. Edit the latter with the values you want
for your server.
Additional info about deploying Conduit can be found [here](../DEPLOY.md).
### Build
To build the Conduit image with docker-compose, you first need to open and modify the `docker-compose.yml` file. There you need to comment the `image:` option and uncomment the `build:` option. Then call docker-compose with:
```bash
docker-compose up
```
This will also start the container right afterwards, so if want it to run in detached mode, you also should use the `-d` flag.
### Run
If you already have built the image or want to use one from the registries, you can just start the container and everything else in the compose file in detached mode with:
```bash
docker-compose up -d
```
> **Note:** Don't forget to modify and adjust the compose file to your needs.
### Use Traefik as Proxy
As a container user, you probably know about Traefik. It is a easy to use reverse proxy for making
containerized app and services available through the web. With the two provided files,
[`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and
[`docker-compose.override.yml`](docker-compose.override.yml), it is equally easy to deploy
and use Conduit, with a little caveat. If you already took a look at the files, then you should have
seen the `well-known` service, and that is the little caveat. Traefik is simply a proxy and
loadbalancer and is not able to serve any kind of content, but for Conduit to federate, we need to
either expose ports `443` and `8448` or serve two endpoints `.well-known/matrix/client` and
`.well-known/matrix/server`.
With the service `well-known` we use a single `nginx` container that will serve those two files.
So...step by step:
1. Copy [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and [`docker-compose.override.yml`](docker-compose.override.yml) from the repository and remove `.for-traefik` (or `.with-traefik`) from the filename.
2. Open both files and modify/adjust them to your needs. Meaning, change the `CONDUIT_SERVER_NAME` and the volume host mappings according to your needs.
3. Create the `conduit.toml` config file, an example can be found [here](../conduit-example.toml), or set `CONDUIT_CONFIG=""` and configure Conduit per env vars.
4. Uncomment the `element-web` service if you want to host your own Element Web Client and create a `element_config.json`.
5. Create the files needed by the `well-known` service.
- `./nginx/matrix.conf` (relative to the compose file, you can change this, but then also need to change the volume mapping)
```nginx
server {
server_name <SUBDOMAIN>.<DOMAIN>;
listen 80 default_server;
location /.well-known/matrix/server {
return 200 '{"m.server": "<SUBDOMAIN>.<DOMAIN>:443"}';
types { } default_type "application/json; charset=utf-8";
}
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://<SUBDOMAIN>.<DOMAIN>"}}';
types { } default_type "application/json; charset=utf-8";
add_header "Access-Control-Allow-Origin" *;
}
location / {
return 404;
}
}
```
6. Run `docker-compose up -d`
7. Connect to your homeserver with your preferred client and create a user. You should do this immediately after starting Conduit, because the first created user is the admin.
## Voice communication
In order to make or receive calls, a TURN server is required. Conduit suggests using [Coturn](https://github.com/coturn/coturn) for this purpose, which is also available as a Docker image. Before proceeding with the software installation, it is essential to have the necessary configurations in place.
### Configuration
Create a configuration file called `coturn.conf` containing:
```conf
use-auth-secret
static-auth-secret=<a secret key>
realm=<your server domain>
```
A common way to generate a suitable alphanumeric secret key is by using `pwgen -s 64 1`.
These same values need to be set in conduit. You can either modify conduit.toml to include these lines:
```
turn_uris = ["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]
turn_secret = "<secret key from coturn configuration>"
```
or append the following to the docker environment variables dependig on which configuration method you used earlier:
```yml
CONDUIT_TURN_URIS: '["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]'
CONDUIT_TURN_SECRET: "<secret key from coturn configuration>"
```
Restart Conduit to apply these changes.
### Run
Run the [Coturn](https://hub.docker.com/r/coturn/coturn) image using
```bash
docker run -d --network=host -v $(pwd)/coturn.conf:/etc/coturn/turnserver.conf coturn/coturn
```
or docker-compose. For the latter, paste the following section into a file called `docker-compose.yml`
and run `docker-compose up -d` in the same directory.
```yml
version: 3
services:
turn:
container_name: coturn-server
image: docker.io/coturn/coturn
restart: unless-stopped
network_mode: "host"
volumes:
- ./coturn.conf:/etc/coturn/turnserver.conf
```
To understand why the host networking mode is used and explore alternative configuration options, please visit the following link: https://github.com/coturn/coturn/blob/master/docker/coturn/README.md.
For security recommendations see Synapse's [Coturn documentation](https://github.com/matrix-org/synapse/blob/develop/docs/setup/turn/coturn.md#configuration).

View file

@ -1,84 +0,0 @@
# syntax=docker/dockerfile:1
# ---------------------------------------------------------------------------------------------------------
# This Dockerfile is intended to be built as part of Conduit's CI pipeline.
# It does not build Conduit in Docker, but just copies the matching build artifact from the build jobs.
#
# It is mostly based on the normal Conduit Dockerfile, but adjusted in a few places to maximise caching.
# Credit's for the original Dockerfile: Weasy666.
# ---------------------------------------------------------------------------------------------------------
FROM docker.io/alpine:3.16.0@sha256:4ff3ca91275773af45cb4b0834e12b7eb47d1c18f770a0b151381cd227f4c253 AS runner
# Standard port on which Conduit launches.
# You still need to map the port when using the docker command or docker-compose.
EXPOSE 6167
# Users are expected to mount a volume to this directory:
ARG DEFAULT_DB_PATH=/var/lib/matrix-conduit
ENV CONDUIT_PORT=6167 \
CONDUIT_ADDRESS="0.0.0.0" \
CONDUIT_DATABASE_PATH=${DEFAULT_DB_PATH} \
CONDUIT_CONFIG=''
# └─> Set no config file to do all configuration with env vars
# Conduit needs:
# ca-certificates: for https
# iproute2: for `ss` for the healthcheck script
RUN apk add --no-cache \
ca-certificates \
iproute2
ARG CREATED
ARG VERSION
ARG GIT_REF
# Labels according to https://github.com/opencontainers/image-spec/blob/master/annotations.md
# including a custom label specifying the build command
LABEL org.opencontainers.image.created=${CREATED} \
org.opencontainers.image.authors="Conduit Contributors" \
org.opencontainers.image.title="Conduit" \
org.opencontainers.image.version=${VERSION} \
org.opencontainers.image.vendor="Conduit Contributors" \
org.opencontainers.image.description="A Matrix homeserver written in Rust" \
org.opencontainers.image.url="https://conduit.rs/" \
org.opencontainers.image.revision=${GIT_REF} \
org.opencontainers.image.source="https://gitlab.com/famedly/conduit.git" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.documentation="https://gitlab.com/famedly/conduit" \
org.opencontainers.image.ref.name=""
# Test if Conduit is still alive, uses the same endpoint as Element
COPY ./docker/healthcheck.sh /srv/conduit/healthcheck.sh
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
# Improve security: Don't run stuff as root, that does not need to run as root:
# Most distros also use 1000:1000 for the first real user, so this should resolve volume mounting problems.
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN set -x ; \
deluser --remove-home www-data ; \
addgroup -S -g ${GROUP_ID} conduit 2>/dev/null ; \
adduser -S -u ${USER_ID} -D -H -h /srv/conduit -G conduit -g conduit conduit 2>/dev/null ; \
addgroup conduit conduit 2>/dev/null && exit 0 ; exit 1
# Change ownership of Conduit files to conduit user and group
RUN chown -cR conduit:conduit /srv/conduit && \
chmod +x /srv/conduit/healthcheck.sh && \
mkdir -p ${DEFAULT_DB_PATH} && \
chown -cR conduit:conduit ${DEFAULT_DB_PATH}
# Change user to conduit
USER conduit
# Set container home directory
WORKDIR /srv/conduit
# Run Conduit and print backtraces on panics
ENV RUST_BACKTRACE=1
ENTRYPOINT [ "/srv/conduit/conduit" ]
# Depending on the target platform (e.g. "linux/arm/v7", "linux/arm64/v8", or "linux/amd64")
# copy the matching binary into this docker image
ARG TARGETPLATFORM
COPY --chown=conduit:conduit ./$TARGETPLATFORM /srv/conduit/conduit

View file

@ -1,69 +0,0 @@
# Conduit - Behind Traefik Reverse Proxy
version: '3'
services:
homeserver:
### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image,
### then you are ready to go.
image: matrixconduit/matrix-conduit:latest
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this:
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d
# build:
# context: .
# args:
# CREATED: '2021-03-16T08:18:27Z'
# VERSION: '0.1.0'
# LOCAL: 'false'
# GIT_REF: origin/master
restart: unless-stopped
volumes:
- db:/var/lib/matrix-conduit/
networks:
- proxy
environment:
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit/
CONDUIT_DATABASE_BACKEND: rocksdb
CONDUIT_PORT: 6167
CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUIT_ALLOW_REGISTRATION: 'true'
CONDUIT_ALLOW_FEDERATION: 'true'
CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUIT_MAX_CONCURRENT_REQUESTS: 100
#CONDUIT_LOG: warn,rocket=off,_=off,sled=off
CONDUIT_ADDRESS: 0.0.0.0
CONDUIT_CONFIG: '' # Ignore this
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
# and in the docker-compose override file.
well-known:
image: nginx:latest
restart: unless-stopped
volumes:
- ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
- ./nginx/www:/var/www/ # location of the client and server .well-known-files
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and Conduit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# volumes:
# - ./element_config.json:/app/config.json
# networks:
# - proxy
# depends_on:
# - homeserver
volumes:
db:
networks:
# This is the network Traefik listens to, if your network has a different
# name, don't forget to change it here and in the docker-compose.override.yml
proxy:
external: true

View file

@ -1,45 +0,0 @@
# Conduit - Traefik Reverse Proxy Labels
version: '3'
services:
homeserver:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
- "traefik.http.routers.to-conduit.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which Conduit is hosted
- "traefik.http.routers.to-conduit.tls=true"
- "traefik.http.routers.to-conduit.tls.certresolver=letsencrypt"
- "traefik.http.routers.to-conduit.middlewares=cors-headers@docker"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
# and in the docker-compose file.
well-known:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.to-matrix-wellknown.rule=Host(`<SUBDOMAIN>.<DOMAIN>`) && PathPrefix(`/.well-known/matrix`)"
- "traefik.http.routers.to-matrix-wellknown.tls=true"
- "traefik.http.routers.to-matrix-wellknown.tls.certresolver=letsencrypt"
- "traefik.http.routers.to-matrix-wellknown.middlewares=cors-headers@docker"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
### Uncomment this if you uncommented Element-Web App in the docker-compose.yml
# element-web:
# labels:
# - "traefik.enable=true"
# - "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
# - "traefik.http.routers.to-element-web.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which Element-Web is hosted
# - "traefik.http.routers.to-element-web.tls=true"
# - "traefik.http.routers.to-element-web.tls.certresolver=letsencrypt"

View file

@ -1,98 +0,0 @@
# Conduit - Behind Traefik Reverse Proxy
version: '3'
services:
homeserver:
### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image,
### then you are ready to go.
image: matrixconduit/matrix-conduit:latest
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this:
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d
# build:
# context: .
# args:
# CREATED: '2021-03-16T08:18:27Z'
# VERSION: '0.1.0'
# LOCAL: 'false'
# GIT_REF: origin/master
restart: unless-stopped
volumes:
- db:/srv/conduit/.local/share/conduit
### Uncomment if you want to use conduit.toml to configure Conduit
### Note: Set env vars will override conduit.toml values
# - ./conduit.toml:/srv/conduit/conduit.toml
networks:
- proxy
environment:
CONDUIT_SERVER_NAME: localhost:6167 # replace with your own name
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
CONDUIT_ALLOW_REGISTRATION : 'true'
### Uncomment and change values as desired
# CONDUIT_ADDRESS: 0.0.0.0
# CONDUIT_PORT: 6167
# CONDUIT_CONFIG: '/srv/conduit/conduit.toml' # if you want to configure purely by env vars, set this to an empty string ''
# Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging
# CONDUIT_LOG: info # default is: "warn,_=off,sled=off"
# CONDUIT_ALLOW_JAEGER: 'false'
# CONDUIT_ALLOW_ENCRYPTION: 'true'
# CONDUIT_ALLOW_FEDERATION: 'true'
# CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
# CONDUIT_DATABASE_PATH: /srv/conduit/.local/share/conduit
# CONDUIT_WORKERS: 10
# CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
# We need some way to server the client and server .well-known json. The simplest way is to use a nginx container
# to serve those two as static files. If you want to use a different way, delete or comment the below service, here
# and in the docker-compose override file.
well-known:
image: nginx:latest
restart: unless-stopped
volumes:
- ./nginx/matrix.conf:/etc/nginx/conf.d/matrix.conf # the config to serve the .well-known/matrix files
- ./nginx/www:/var/www/ # location of the client and server .well-known-files
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and Conduit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# volumes:
# - ./element_config.json:/app/config.json
# networks:
# - proxy
# depends_on:
# - homeserver
traefik:
image: "traefik:latest"
container_name: "traefik"
restart: "unless-stopped"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
# - "./traefik_config:/etc/traefik"
- "acme:/etc/traefik/acme"
labels:
- "traefik.enable=true"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# global redirect to https
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=http"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
networks:
- proxy
volumes:
db:
acme:
networks:
proxy:

View file

@ -1,54 +0,0 @@
# Conduit
version: '3'
services:
homeserver:
### If you already built the Conduit image with 'docker build' or want to use a registry image,
### then you are ready to go.
image: matrixconduit/matrix-conduit:latest
### If you want to build a fresh image from the sources, then comment the image line and uncomment the
### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this:
### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d
# build:
# context: .
# args:
# CREATED: '2021-03-16T08:18:27Z'
# VERSION: '0.1.0'
# LOCAL: 'false'
# GIT_REF: origin/master
restart: unless-stopped
ports:
- 8448:6167
volumes:
- db:/var/lib/matrix-conduit/
environment:
CONDUIT_SERVER_NAME: your.server.name # EDIT THIS
CONDUIT_DATABASE_PATH: /var/lib/matrix-conduit/
CONDUIT_DATABASE_BACKEND: rocksdb
CONDUIT_PORT: 6167
CONDUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUIT_ALLOW_REGISTRATION: 'true'
CONDUIT_ALLOW_FEDERATION: 'true'
CONDUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
CONDUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUIT_MAX_CONCURRENT_REQUESTS: 100
#CONDUIT_LOG: warn,rocket=off,_=off,sled=off
CONDUIT_ADDRESS: 0.0.0.0
CONDUIT_CONFIG: '' # Ignore this
#
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and Conduit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# ports:
# - 8009:80
# volumes:
# - ./element_config.json:/app/config.json
# depends_on:
# - homeserver
volumes:
db:

View file

@ -1,19 +0,0 @@
#!/bin/sh
# If the config file does not contain a default port and the CONDUIT_PORT env is not set, create
# try to get port from process list
if [ -z "${CONDUIT_PORT}" ]; then
CONDUIT_PORT=$(ss -tlpn | grep conduit | grep -m1 -o ':[0-9]*' | grep -m1 -o '[0-9]*')
fi
# If CONDUIT_ADDRESS is not set try to get the address from the process list
if [ -z "${CONDUIT_ADDRESS}" ]; then
CONDUIT_ADDRESS=$(ss -tlpn | awk -F ' +|:' '/conduit/ { print $4 }')
fi
# The actual health check.
# We try to first get a response on HTTP and when that fails on HTTPS and when that fails, we exit with code 1.
# TODO: Change this to a single wget call. Do we have a config value that we can check for that?
wget --no-verbose --tries=1 --spider "http://${CONDUIT_ADDRESS}:${CONDUIT_PORT}/_matrix/client/versions" || \
wget --no-verbose --tries=1 --spider "https://${CONDUIT_ADDRESS}:${CONDUIT_PORT}/_matrix/client/versions" || \
exit 1

22
docs/SUMMARY.md Normal file
View file

@ -0,0 +1,22 @@
# Summary
- [Introduction](introduction.md)
- [Differences from upstream Conduit](differences.md)
- [Configuration](configuration.md)
- [Examples](configuration/examples.md)
- [Deploying](deploying.md)
- [Generic](deploying/generic.md)
- [NixOS](deploying/nixos.md)
- [Docker](deploying/docker.md)
- [Arch Linux](deploying/arch-linux.md)
- [Debian](deploying/debian.md)
- [FreeBSD](deploying/freebsd.md)
- [TURN](turn.md)
- [Appservices](appservices.md)
- [Maintenance](maintenance.md)
- [Troubleshooting](troubleshooting.md)
- [Development](development.md)
- [Contributing](contributing.md)
- [Testing](development/testing.md)
- [Hot Reloading ("Live" Development)](development/hot_reload.md)
- [conduwuit Community Code of Conduct](conduwuit_coc.md)

53
docs/appservices.md Normal file
View file

@ -0,0 +1,53 @@
# Setting up Appservices
## Getting help
If you run into any problems while setting up an Appservice: ask us in
[#conduwuit:puppygock.gay](https://matrix.to/#/#conduwuit:puppygock.gay) or
[open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new).
## Set up the appservice - general instructions
Follow whatever instructions are given by the appservice. This usually includes
downloading, changing its config (setting domain, homeserver url, port etc.) and
later starting it.
At some point the appservice guide should ask you to add a registration yaml
file to the homeserver. In Synapse you would do this by adding the path to the
homeserver.yaml, but in conduwuit you can do this from within Matrix:
First, go into the `#admins` room of your homeserver. The first person that
registered on the homeserver automatically joins it. Then send a message into
the room like this:
!admin appservices register
```
paste
the
contents
of
the
yaml
registration
here
```
You can confirm it worked by sending a message like this:
`!admin appservices list`
The server bot should answer with `Appservices (1): your-bridge`
Then you are done. conduwuit will send messages to the appservices and the
appservice can send requests to the homeserver. You don't need to restart
conduwuit, but if it doesn't work, restarting while the appservice is running
could help.
## Appservice-specific instructions
### Remove an appservice
To remove an appservice go to your admin room and execute
`!admin appservices unregister <name>`
where `<name>` one of the output of `appservices list`.

93
docs/conduwuit_coc.md Normal file
View file

@ -0,0 +1,93 @@
# conduwuit Community Code of Conduct
Welcome to the conduwuit community! Were excited to have you here. conduwuit is
a hard-fork of the Conduit homeserver, aimed at making Matrix more accessible
and inclusive for everyone.
This space is dedicated to fostering a positive, supportive, and inclusive
environment for everyone. This Code of Conduct applies to all conduwuit spaces,
including any further community rooms that reference this CoC. Here are our
guidelines to help maintain the welcoming atmosphere that sets conduwuit apart.
For the general foundational rules, please refer to the [Contributor's
Covenant](https://github.com/girlbossceo/conduwuit/blob/main/CODE_OF_CONDUCT.md).
Below are additional guidelines specific to the conduwuit community.
## Our Values and Guidelines
1. **Respect and Inclusivity**: We are committed to maintaining a community
where everyone feels safe and respected. Discrimination, harassment, or hate
speech of any kind will not be tolerated. Recognise that each community member
experiences the world differently based on their past experiences, background,
and identity. Share your own experiences and be open to learning about others'
diverse perspectives.
2. **Positivity and Constructiveness**: Engage in constructive discussions and
support each other. If you feel angry, negative, or aggressive, take a break
until you can participate in a positive and constructive manner. Process intense
feelings with a friend or in a private setting before engaging in community
conversations to help maintain a supportive and focused environment.
3. **Clarity and Understanding**: Our community includes neurodivergent
individuals and those who may not appreciate sarcasm or subtlety. Communicate
clearly and kindly, avoiding sarcasm and ensuring your messages are easily
understood by all. Additionally, avoid putting the burden of education on
marginalized groups by doing your own research before asking for explanations.
4. **Be Open to Inclusivity**: Actively engage in conversations about making our
community more inclusive. Report discriminatory behavior to the moderators
and be open to constructive feedback that aims to improve our community.
Understand that discussing discrimination and negative experiences can be
emotionally taxing, so focus on the message rather than critiquing the tone
used.
5. **Commit to Inclusivity**: Building an inclusive community requires time,
energy, and resources. Recognise that addressing discrimination and bias is
an ongoing process that necessitates commitment and action from all community
members.
## Matrix Community
This Code of Conduct applies to the entire [conduwuit Matrix
Space](https://matrix.to/#/#conduwuit-space:puppygock.gay) and its rooms,
including:
### [#conduwuit:puppygock.gay](https://matrix.to/#/#conduwuit:puppygock.gay)
This room is for support and discussions about conduwuit. Ask questions, share
insights, and help each other out.
### [#conduwuit-offtopic:girlboss.ceo](https://matrix.to/#/#conduwuit-offtopic:girlboss.ceo)
For off-topic community conversations about any subject. While this room allows
for a wide range of topics, the same CoC applies. Keep discussions respectful
and inclusive, and avoid divisive subjects like country/world politics. General
topics, such as world events, are welcome as long as they follow the CoC.
### [#conduwuit-dev:puppygock.gay](https://matrix.to/#/#conduwuit-dev:puppygock.gay)
This room is dedicated to discussing active development of conduwuit. Posting
requires an elevated power level, which can be requested in one of the other
rooms. Use this space to collaborate and innovate.
## Enforcement
We have a zero-tolerance policy for violations of this Code of Conduct. If
someones behavior makes you uncomfortable, please report it to the moderators.
Actions we may take include:
1. **Warning**: A warning given directly in the room or via a private message
from the moderators, identifying the violation and requesting corrective
action.
2. **Temporary Mute**: Temporary restriction from participating in discussions
for a specified period to allow for reflection and cooling off.
3. **Kick or Ban**: Egregious behavior may result in an immediate kick or ban to
protect other community members. Bans are considered permanent and will only
be reversed in exceptional circumstances after proven good behavior.
Please highlight issues directly in rooms when possible, but if you don't feel
comfortable doing that, then please send a DM to one of the moderators directly.
Together, lets build a community where everyone feels valued and respected.
— The conduwuit Moderation Team

64
docs/configuration.md Normal file
View file

@ -0,0 +1,64 @@
# Configuration
This chapter describes various ways to configure conduwuit.
## Basics
conduwuit uses a config file for the majority of the settings, but also supports
setting individual config options via commandline.
Please refer to the [example config
file](./configuration/examples.md#example-configuration) for all of those
settings.
The config file to use can be specified on the commandline when running
conduwuit by specifying the `-c`, `--config` flag. Alternatively, you can use
the environment variable `CONDUWUIT_CONFIG` to specify the config file to used.
Conduit's environment variables are supported for backwards compatibility.
## Option commandline flag
conduwuit supports setting individual config options in TOML format from the
`-O` / `--option` flag. For example, you can set your server name via `-O
server_name=\"example.com\"`.
Note that the config is parsed as TOML, and shells like bash will remove quotes.
So unfortunately it is required to escape quotes if the config option takes a
string. This does not apply to options that take booleans or numbers:
- `--option allow_registration=true` works ✅
- `-O max_request_size=99999999` works ✅
- `-O server_name=example.com` does not work ❌
- `--option log=\"debug\"` works ✅
- `--option server_name='"example.com'"` works ✅
## Execute commandline flag
conduwuit supports running admin commands on startup using the commandline
argument `--execute`. The most notable use for this is to create an admin user
on first startup.
The syntax of this is a standard admin command without the prefix such as
`./conduwuit --execute "users create_user june"`
An example output of a success is:
```
INFO conduit_service::admin::startup: Startup command #0 completed:
Created user with user_id: @june:girlboss.ceo and password: `<redacted>`
```
This commandline argument can be paired with the `--option` flag.
## Environment variables
All of the settings that are found in the config file can be specified by using
environment variables. The environment variable names should be all caps and
prefixed with `CONDUWUIT_`.
For example, if the setting you are changing is `max_request_size`, then the
environment variable to set is `CONDUWUIT_MAX_REQUEST_SIZE`.
To modify config options not in the `[global]` context such as
`[global.well_known]`, use the `__` suffix split: `CONDUWUIT_WELL_KNOWN__SERVER`
Conduit's environment variables are supported for backwards compatibility (e.g.
`CONDUIT_SERVER_NAME`).

View file

@ -0,0 +1,32 @@
## Example configuration
<details>
<summary>Example configuration</summary>
```toml
{{#include ../../conduwuit-example.toml}}
```
</details>
## Debian systemd unit file
<details>
<summary>Debian systemd unit file</summary>
```
{{#include ../../debian/conduwuit.service}}
```
</details>
## Arch Linux systemd unit file
<details>
<summary>Arch Linux systemd unit file</summary>
```
{{#include ../../arch/conduwuit.service}}
```
</details>

1
docs/contributing.md Symbolic link
View file

@ -0,0 +1 @@
../CONTRIBUTING.md

3
docs/deploying.md Normal file
View file

@ -0,0 +1,3 @@
# Deploying
This chapter describes various ways to deploy conduwuit.

View file

@ -0,0 +1,15 @@
# conduwuit for Arch Linux
Currently conduwuit is only on the Arch User Repository (AUR).
The conduwuit AUR packages are community maintained and are not maintained by
conduwuit development team, but the AUR package maintainers are in the Matrix
room. Please attempt to verify your AUR package's PKGBUILD file looks fine
before asking for support.
- [conduwuit](https://aur.archlinux.org/packages/conduwuit) - latest tagged
conduwuit
- [conduwuit-git](https://aur.archlinux.org/packages/conduwuit-git) - latest git
conduwuit from `main` branch
- [conduwuit-bin](https://aur.archlinux.org/packages/conduwuit-bin) - latest
tagged conduwuit static binary

1
docs/deploying/debian.md Normal file
View file

@ -0,0 +1 @@
{{#include ../../debian/README.md}}

View file

@ -0,0 +1,65 @@
# conduwuit - Behind Traefik Reverse Proxy
services:
homeserver:
### If you already built the conduduwit image with 'docker build' or want to use the Docker Hub image,
### then you are ready to go.
image: girlbossceo/conduwuit:latest
restart: unless-stopped
volumes:
- db:/var/lib/conduwuit
#- ./conduwuit.toml:/etc/conduwuit.toml
networks:
- proxy
environment:
CONDUWUIT_SERVER_NAME: your.server.name.example # EDIT THIS
CONDUWUIT_DATABASE_PATH: /var/lib/conduwuit
CONDUWUIT_DATABASE_BACKEND: rocksdb
CONDUWUIT_PORT: 6167 # should match the loadbalancer traefik label
CONDUWUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUWUIT_ALLOW_REGISTRATION: 'true'
CONDUWUIT_ALLOW_FEDERATION: 'true'
CONDUWUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
CONDUWUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUWUIT_LOG: warn,state_res=warn
CONDUWUIT_ADDRESS: 0.0.0.0
#CONDUWUIT_CONFIG: '/etc/conduwuit.toml' # Uncomment if you mapped config toml above
# We need some way to serve the client and server .well-known json. The simplest way is via the CONDUWUIT_WELL_KNOWN
# variable / config option, there are multiple ways to do this, e.g. in the conduwuit.toml file, and in a seperate
# see the override file for more information about delegation
CONDUWUIT_WELL_KNOWN: |
{
client=https://your.server.name.example,
server=your.server.name.example:443
}
#cpuset: "0-4" # Uncomment to limit to specific CPU cores
ulimits: # conduwuit uses quite a few file descriptors, and on some systems it defaults to 1024, so you can tell docker to increase it
nofile:
soft: 1048567
hard: 1048567
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and conduwuit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# volumes:
# - ./element_config.json:/app/config.json
# networks:
# - proxy
# depends_on:
# - homeserver
volumes:
db:
networks:
# This is the network Traefik listens to, if your network has a different
# name, don't forget to change it here and in the docker-compose.override.yml
proxy:
external: true
# vim: ts=2:sw=2:expandtab

View file

@ -0,0 +1,37 @@
# conduwuit - Traefik Reverse Proxy Labels
services:
homeserver:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
- "traefik.http.routers.to-conduwuit.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which conduwuit is hosted
- "traefik.http.routers.to-conduwuit.tls=true"
- "traefik.http.routers.to-conduwuit.tls.certresolver=letsencrypt"
- "traefik.http.routers.to-conduwuit.middlewares=cors-headers@docker"
- "traefik.http.services.to_conduwuit.loadbalancer.server.port=6167"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowOriginList=*"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowHeaders=Origin, X-Requested-With, Content-Type, Accept, Authorization"
- "traefik.http.middlewares.cors-headers.headers.accessControlAllowMethods=GET, POST, PUT, DELETE, OPTIONS"
# If you want to have your account on <DOMAIN>, but host conduwuit on a subdomain,
# you can let it only handle the well known file on that domain instead
#- "traefik.http.routers.to-matrix-wellknown.rule=Host(`<DOMAIN>`) && PathPrefix(`/.well-known/matrix`)"
#- "traefik.http.routers.to-matrix-wellknown.tls=true"
#- "traefik.http.routers.to-matrix-wellknown.tls.certresolver=letsencrypt"
#- "traefik.http.routers.to-matrix-wellknown.middlewares=cors-headers@docker"
### Uncomment this if you uncommented Element-Web App in the docker-compose.yml
# element-web:
# labels:
# - "traefik.enable=true"
# - "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
# - "traefik.http.routers.to-element-web.rule=Host(`<SUBDOMAIN>.<DOMAIN>`)" # Change to the address on which Element-Web is hosted
# - "traefik.http.routers.to-element-web.tls=true"
# - "traefik.http.routers.to-element-web.tls.certresolver=letsencrypt"
# vim: ts=2:sw=2:expandtab

View file

@ -0,0 +1,54 @@
services:
caddy:
# This compose file uses caddy-docker-proxy as the reverse proxy for conduwuit!
# For more info, visit https://github.com/lucaslorentz/caddy-docker-proxy
image: lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
networks:
- caddy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
labels:
caddy: example.com
caddy.0_respond: /.well-known/matrix/server {"m.server":"matrix.example.com:443"}
caddy.1_respond: /.well-known/matrix/client {"m.server":{"base_url":"https://matrix.example.com"},"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc3575.proxy":{"url":"https://matrix.example.com"}}
homeserver:
### If you already built the conduwuit image with 'docker build' or want to use a registry image,
### then you are ready to go.
image: girlbossceo/conduwuit:latest
restart: unless-stopped
volumes:
- db:/var/lib/conduwuit
#- ./conduwuit.toml:/etc/conduwuit.toml
environment:
CONDUWUIT_SERVER_NAME: example.com # EDIT THIS
CONDUWUIT_DATABASE_PATH: /var/lib/conduwuit
CONDUWUIT_DATABASE_BACKEND: rocksdb
CONDUWUIT_PORT: 6167
CONDUWUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUWUIT_ALLOW_REGISTRATION: 'true'
CONDUWUIT_ALLOW_FEDERATION: 'true'
CONDUWUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
CONDUWUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUWUIT_LOG: warn,state_res=warn
CONDUWUIT_ADDRESS: 0.0.0.0
#CONDUWUIT_CONFIG: '/etc/conduwuit.toml' # Uncomment if you mapped config toml above
networks:
- caddy
labels:
caddy: matrix.example.com
caddy.reverse_proxy: "{{upstreams 6167}}"
volumes:
db:
networks:
caddy:
external: true

View file

@ -0,0 +1,146 @@
# conduwuit - Behind Traefik Reverse Proxy
services:
homeserver:
### If you already built the conduwuit image with 'docker build' or want to use the Docker Hub image,
### then you are ready to go.
image: girlbossceo/conduwuit:latest
restart: unless-stopped
volumes:
- db:/var/lib/conduwuit
#- ./conduwuit.toml:/etc/conduwuit.toml
networks:
- proxy
environment:
CONDUWUIT_SERVER_NAME: your.server.name.example # EDIT THIS
CONDUWUIT_TRUSTED_SERVERS: '["matrix.org"]'
CONDUWUIT_ALLOW_REGISTRATION: 'false' # After setting a secure registration token, you can enable this
CONDUWUIT_REGISTRATION_TOKEN: # This is a token you can use to register on the server
CONDUWUIT_ADDRESS: 0.0.0.0
CONDUWUIT_PORT: 6167 # you need to match this with the traefik load balancer label if you're want to change it
CONDUWUIT_DATABASE_PATH: /var/lib/conduwuit
#CONDUWUIT_CONFIG: '/etc/conduit.toml' # Uncomment if you mapped config toml above
### Uncomment and change values as desired, note that conduwuit has plenty of config options, so you should check out the example example config too
# Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging
# CONDUWUIT_LOG: info # default is: "warn,state_res=warn"
# CONDUWUIT_ALLOW_JAEGER: 'false'
# CONDUWUIT_ALLOW_ENCRYPTION: 'true'
# CONDUWUIT_ALLOW_FEDERATION: 'true'
# CONDUWUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
# CONDUWUIT_ALLOW_INCOMING_PRESENCE: true
# CONDUWUIT_ALLOW_OUTGOING_PRESENCE: true
# CONDUWUIT_ALLOW_LOCAL_PRESENCE: true
# CONDUWUIT_WORKERS: 10
# CONDUWUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
# CONDUWUIT_NEW_USER_DISPLAYNAME_SUFFIX = "🏳<200d>⚧"
# We need some way to serve the client and server .well-known json. The simplest way is via the CONDUWUIT_WELL_KNOWN
# variable / config option, there are multiple ways to do this, e.g. in the conduwuit.toml file, and in a seperate
# reverse proxy, but since you do not have a reverse proxy and following this guide, this example is included
CONDUWUIT_WELL_KNOWN: |
{
client=https://your.server.name.example,
server=your.server.name.example:443
}
#cpuset: "0-4" # Uncomment to limit to specific CPU cores
ulimits: # conduwuit uses quite a few file descriptors, and on some systems it defaults to 1024, so you can tell docker to increase it
nofile:
soft: 1048567
hard: 1048567
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and conduwuit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# volumes:
# - ./element_config.json:/app/config.json
# networks:
# - proxy
# depends_on:
# - homeserver
traefik:
image: "traefik:latest"
container_name: "traefik"
restart: "unless-stopped"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:z"
- "acme:/etc/traefik/acme"
#- "./traefik_config:/etc/traefik:z"
labels:
- "traefik.enable=true"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# global redirect to https
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=web"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
configs:
- source: dynamic.yml
target: /etc/traefik/dynamic.yml
environment:
TRAEFIK_LOG_LEVEL: DEBUG
TRAEFIK_ENTRYPOINTS_WEB: true
TRAEFIK_ENTRYPOINTS_WEB_ADDRESS: ":80"
TRAEFIK_ENTRYPOINTS_WEB_HTTP_REDIRECTIONS_ENTRYPOINT_TO: websecure
TRAEFIK_ENTRYPOINTS_WEBSECURE: true
TRAEFIK_ENTRYPOINTS_WEBSECURE_ADDRESS: ":443"
TRAEFIK_ENTRYPOINTS_WEBSECURE_HTTP_TLS_CERTRESOLVER: letsencrypt
#TRAEFIK_ENTRYPOINTS_WEBSECURE_HTTP_MIDDLEWARES: secureHeaders@file # if you want to enabled STS
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT: true
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL: # Set this to the email you want to receive certificate expiration emails for
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_KEYTYPE: EC384
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_HTTPCHALLENGE: true
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_HTTPCHALLENGE_ENTRYPOINT: web
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_STORAGE: "/etc/traefik/acme/acme.json"
TRAEFIK_PROVIDERS_DOCKER: true
TRAEFIK_PROVIDERS_DOCKER_ENDPOINT: "unix:///var/run/docker.sock"
TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT: false
TRAEFIK_PROVIDERS_FILE: true
TRAEFIK_PROVIDERS_FILE_FILENAME: "/etc/traefik/dynamic.yml"
configs:
dynamic.yml:
content: |
# Optionally set STS headers, like in https://hstspreload.org
# http:
# middlewares:
# secureHeaders:
# headers:
# forceSTSHeader: true
# stsIncludeSubdomains: true
# stsPreload: true
# stsSeconds: 31536000
tls:
options:
default:
cipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
minVersion: VersionTLS12
volumes:
db:
acme:
networks:
proxy:
# vim: ts=2:sw=2:expandtab

View file

@ -0,0 +1,43 @@
# conduwuit
services:
homeserver:
### If you already built the conduwuit image with 'docker build' or want to use a registry image,
### then you are ready to go.
image: girlbossceo/conduwuit:latest
restart: unless-stopped
ports:
- 8448:6167
volumes:
- db:/var/lib/conduwuit
#- ./conduwuit.toml:/etc/conduwuit.toml
environment:
CONDUWUIT_SERVER_NAME: your.server.name # EDIT THIS
CONDUWUIT_DATABASE_PATH: /var/lib/conduwuit
CONDUWUIT_DATABASE_BACKEND: rocksdb
CONDUWUIT_PORT: 6167
CONDUWUIT_MAX_REQUEST_SIZE: 20_000_000 # in bytes, ~20 MB
CONDUWUIT_ALLOW_REGISTRATION: 'true'
CONDUWUIT_ALLOW_FEDERATION: 'true'
CONDUWUIT_ALLOW_CHECK_FOR_UPDATES: 'true'
CONDUWUIT_TRUSTED_SERVERS: '["matrix.org"]'
#CONDUWUIT_LOG: warn,state_res=warn
CONDUWUIT_ADDRESS: 0.0.0.0
#CONDUWUIT_CONFIG: '/etc/conduwuit.toml' # Uncomment if you mapped config toml above
#
### Uncomment if you want to use your own Element-Web App.
### Note: You need to provide a config.json for Element and you also need a second
### Domain or Subdomain for the communication between Element and conduwuit
### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md
# element-web:
# image: vectorim/element-web:latest
# restart: unless-stopped
# ports:
# - 8009:80
# volumes:
# - ./element_config.json:/app/config.json
# depends_on:
# - homeserver
volumes:
db:

139
docs/deploying/docker.md Normal file
View file

@ -0,0 +1,139 @@
# conduwuit for Docker
## Docker
To run conduwuit with Docker you can either build the image yourself or pull it
from a registry.
### Use a registry
OCI images for conduwuit are available in the registries listed below.
| Registry | Image | Size | Notes |
| --------------- | --------------------------------------------------------------- | ----------------------------- | ---------------------- |
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:latest][gh] | ![Image Size][shield-latest] | Stable tagged image. |
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:latest][gl] | ![Image Size][shield-latest] | Stable tagged image. |
| Docker Hub | [docker.io/girlbossceo/conduwuit:latest][dh] | ![Image Size][shield-latest] | Stable tagged image. |
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:main][gh] | ![Image Size][shield-main] | Stable main branch. |
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:main][gl] | ![Image Size][shield-main] | Stable main branch. |
| Docker Hub | [docker.io/girlbossceo/conduwuit:main][dh] | ![Image Size][shield-main] | Stable main branch. |
[dh]: https://hub.docker.com/r/girlbossceo/conduwuit
[gh]: https://github.com/girlbossceo/conduwuit/pkgs/container/conduwuit
[gl]: https://gitlab.com/conduwuit/conduwuit/container_registry/6369729
[shield-latest]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/latest
[shield-main]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/main
Use
```bash
docker image pull $LINK
```
to pull it to your machine.
### Run
When you have the image you can simply run it with
```bash
docker run -d -p 8448:6167 \
-v db:/var/lib/conduwuit/ \
-e CONDUWUIT_SERVER_NAME="your.server.name" \
-e CONDUWUIT_DATABASE_BACKEND="rocksdb" \
-e CONDUWUIT_ALLOW_REGISTRATION=false \
--name conduit $LINK
```
or you can use [docker compose](#docker-compose).
The `-d` flag lets the container run in detached mode. You may supply an
optional `conduwuit.toml` config file, the example config can be found
[here](../configuration/examples.md). You can pass in different env vars to
change config values on the fly. You can even configure conduwuit completely by
using env vars. For an overview of possible values, please take a look at the
[`docker-compose.yml`](docker-compose.yml) file.
If you just want to test conduwuit for a short time, you can use the `--rm`
flag, which will clean up everything related to your container after you stop
it.
### Docker-compose
If the `docker run` command is not for you or your setup, you can also use one
of the provided `docker-compose` files.
Depending on your proxy setup, you can use one of the following files;
- If you already have a `traefik` instance set up, use
[`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml)
- If you don't have a `traefik` instance set up and would like to use it, use
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)
- If you want a setup that works out of the box with `caddy-docker-proxy`, use
[`docker-compose.with-caddy.yml`](docker-compose.with-caddy.yml) and replace all
`example.com` placeholders with your own domain
- For any other reverse proxy, use [`docker-compose.yml`](docker-compose.yml)
When picking the traefik-related compose file, rename it so it matches
`docker-compose.yml`, and rename the override file to
`docker-compose.override.yml`. Edit the latter with the values you want for your
server.
When picking the `caddy-docker-proxy` compose file, it's important to first
create the `caddy` network before spinning up the containers:
```bash
docker network create caddy
```
After that, you can rename it so it matches `docker-compose.yml` and spin up the
containers!
Additional info about deploying conduwuit can be found [here](generic.md).
### Build
To build the conduwuit image with docker-compose, you first need to open and
modify the `docker-compose.yml` file. There you need to comment the `image:`
option and uncomment the `build:` option. Then call docker compose with:
```bash
docker compose up
```
This will also start the container right afterwards, so if want it to run in
detached mode, you also should use the `-d` flag.
### Run
If you already have built the image or want to use one from the registries, you
can just start the container and everything else in the compose file in detached
mode with:
```bash
docker compose up -d
```
> **Note:** Don't forget to modify and adjust the compose file to your needs.
### Use Traefik as Proxy
As a container user, you probably know about Traefik. It is a easy to use
reverse proxy for making containerized app and services available through the
web. With the two provided files,
[`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and
[`docker-compose.override.yml`](docker-compose.override.yml), it is equally easy
to deploy and use conduwuit, with a little caveat. If you already took a look at
the files, then you should have seen the `well-known` service, and that is the
little caveat. Traefik is simply a proxy and loadbalancer and is not able to
serve any kind of content, but for conduwuit to federate, we need to either
expose ports `443` and `8448` or serve two endpoints `.well-known/matrix/client`
and `.well-known/matrix/server`.
With the service `well-known` we use a single `nginx` container that will serve
those two files.
## Voice communication
See the [TURN](../turn.md) page.

11
docs/deploying/freebsd.md Normal file
View file

@ -0,0 +1,11 @@
# conduwuit for FreeBSD
conduwuit at the moment does not provide FreeBSD builds. Building conduwuit on
FreeBSD requires a specific environment variable to use the system prebuilt
RocksDB library instead of rust-rocksdb / rust-librocksdb-sys which does *not*
work and will cause a build error or coredump.
Use the following environment variable: `ROCKSDB_LIB_DIR=/usr/local/lib`
Such example commandline with it can be: `ROCKSDB_LIB_DIR=/usr/local/lib cargo
build --release`

161
docs/deploying/generic.md Normal file
View file

@ -0,0 +1,161 @@
# Generic deployment documentation
> ## Getting help
>
> If you run into any problems while setting up conduwuit, ask us in
> `#conduwuit:puppygock.gay` or [open an issue on
> GitHub](https://github.com/girlbossceo/conduwuit/issues/new).
## Installing conduwuit
You may simply download the binary that fits your machine. Run `uname -m` to see
what you need.
Prebuilt fully static musl binaries can be downloaded from the latest tagged
release [here](https://github.com/girlbossceo/conduwuit/releases/latest) or
`main` CI branch workflow artifact output. These also include Debian packages.
These binaries have jemalloc and io_uring statically linked and included with
them.
Alternatively, you may compile the binary yourself. We recommend using
Nix (or [Lix](https://lix.systems) to build conduwuit as this has the most guaranteed
reproducibiltiy and easiest to get a build environment and output going.
Otherwise, follow standard Rust project build guides (installing git and cloning
the repo, getting the Rust toolchain via rustup, installing LLVM toolchain +
libclang for RocksDB, installing liburing for io_uring and RocksDB, etc).
## Adding a conduwuit user
While conduwuit can run as any user it is better to use dedicated users for
different services. This also allows you to make sure that the file permissions
are correctly set up.
In Debian or Fedora/RHEL, you can use this command to create a conduwuit user:
```bash
sudo adduser --system conduwuit --group --disabled-login --no-create-home
```
For distros without `adduser`:
```bash
sudo useradd -r --shell /usr/bin/nologin --no-create-home conduwuit
```
## Forwarding ports in the firewall or the router
conduwuit uses the ports 443 and 8448 both of which need to be open in the
firewall.
If conduwuit runs behind a router or in a container and has a different public
IP address than the host system these public ports need to be forwarded directly
or indirectly to the port mentioned in the config.
## Setting up a systemd service
The systemd unit for conduwuit can be found
[here](../configuration/examples.md#example-systemd-unit-file). You may need to
change the `ExecStart=` path to where you placed the conduwuit binary.
## Creating the conduwuit configuration file
Now we need to create the conduwuit's config file in
`/etc/conduwuit/conduwuit.toml`. The example config can be found at
[conduwuit-example.toml](../configuration/examples.md).
**Please take a moment to read the config. You need to change at least the server name.**
RocksDB is the only supported database backend.
## Setting the correct file permissions
If you are using a dedicated user for conduwuit, you will need to allow it to
read the config. To do that you can run this:
```bash
sudo chown -R root:root /etc/conduwuit sudo chmod -R 755 /etc/conduwuit
```
If you use the default database path you also need to run this:
```bash
sudo mkdir -p /var/lib/conduwuit/ sudo chown -R conduwuit:conduwuit /var/lib/conduwuit/
sudo chmod 700 /var/lib/conduwuit/
```
## Setting up the Reverse Proxy
Refer to the documentation or various guides online of your chosen reverse proxy
software. A [Caddy](https://caddyserver.com/) example will be provided as this
is the recommended reverse proxy for new users and is very trivial to use
(handles TLS, reverse proxy headers, etc transparently with proper defaults).
Lighttpd is not supported as it seems to mess with the `X-Matrix` Authorization
header, making federation non-functional. If using Apache, you need to use
`nocanon` to prevent this.
### Caddy
Create `/etc/caddy/conf.d/conduwuit_caddyfile` and enter this (substitute for
your server name).
```caddyfile
your.server.name, your.server.name:8448 {
# TCP reverse_proxy
127.0.0.1:6167
# UNIX socket
#reverse_proxy unix//run/conduwuit/conduwuit.sock
}
```
That's it! Just start and enable the service and you're set.
```bash
sudo systemctl enable --now caddy
```
## You're done
Now you can start conduwuit with:
```bash
sudo systemctl start conduwuit
```
Set it to start automatically when your system boots with:
```bash
sudo systemctl enable conduwuit
```
## How do I know it works?
You can open [a Matrix client](https://matrix.org/ecosystem/clients), enter your
homeserver and try to register.
You can also use these commands as a quick health check (replace
`your.server.name`).
```bash
curl https://your.server.name/_conduwuit/server_version
# If using port 8448
curl https://your.server.name:8448/_conduwuit/server_version
```
- To check if your server can talk with other homeservers, you can use the
[Matrix Federation Tester](https://federationtester.matrix.org/). If you can
register but cannot join federated rooms check your config again and also check
if the port 8448 is open and forwarded correctly.
# What's next?
## Audio/Video calls
For Audio/Video call functionality see the [TURN Guide](../turn.md).
## Appservices
If you want to set up an appservice, take a look at the [Appservice
Guide](../appservices.md).

45
docs/deploying/nixos.md Normal file
View file

@ -0,0 +1,45 @@
# conduwuit for NixOS
conduwuit can be acquired by Nix (or [Lix][lix]) from various places:
* The `flake.nix` at the root of the repo
* The `default.nix` at the root of the repo
* From conduwuit's binary cache
A community maintained NixOS package is available at [`conduwuit`](https://search.nixos.org/packages?channel=unstable&show=conduwuit&from=0&size=50&sort=relevance&type=packages&query=conduwuit)
A binary cache for conduwuit that the CI/CD publishes to is available at the
following places (both are the same just different names):
```
https://attic.kennel.juneis.dog/conduit
conduit:eEKoUwlQGDdYmAI/Q/0slVlegqh/QmAvQd7HBSm21Wk=
https://attic.kennel.juneis.dog/conduwuit
conduwuit:BbycGUgTISsltcmH0qNjFR9dbrQNYgdIAcmViSGoVTE=
```
The binary caches were recreated some months ago due to attic issues. The old public
keys were:
```
conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
```
If specifying a Git remote URL in your flake, you can use any remotes that
are specified on the README (the mirrors), such as the GitHub: `github:girlbossceo/conduwuit`
The `flake.nix` and `default.nix` do not currently provide a NixOS module (contributions
welcome!), so [`services.matrix-conduit`][module] from Nixpkgs can be used to configure
conduwuit.
If you want to run the latest code, you should get conduwuit from the `flake.nix`
or `default.nix` and set [`services.matrix-conduit.package`][package]
appropriately to use conduwuit instead of Conduit.
[lix]: https://lix.systems/
[module]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit
[package]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit.package

127
docs/development.md Normal file
View file

@ -0,0 +1,127 @@
# Development
Information about developing the project. If you are only interested in using
it, you can safely ignore this page. If you plan on contributing, see the
[contributor's guide](./contributing.md).
## conduwuit project layout
conduwuit uses a collection of sub-crates, packages, or workspace members
that indicate what each general area of code is for. All of the workspace
members are under `src/`. The workspace definition is at the top level / root
`Cargo.toml`.
The crate names are generally self-explanatory:
- `admin` is the admin room
- `api` is the HTTP API, Matrix C-S and S-S endpoints, etc
- `core` is core conduwuit functionality like config loading, error definitions,
global utilities, logging infrastructure, etc
- `database` is RocksDB methods, helpers, RocksDB config, and general database definitions,
utilities, or functions
- `macros` are conduwuit Rust [macros][macros] like general helper macros, logging
and error handling macros, and [syn][syn] and [procedural macros][proc-macro]
used for admin room commands and others
- `main` is the "primary" sub-crate. This is where the `main()` function lives,
tokio worker and async initialisation, Sentry initialisation, [clap][clap] init,
and signal handling. If you are adding new [Rust features][features], they *must*
go here.
- `router` is the webserver and request handling bits, using axum, tower, tower-http,
hyper, etc, and the [global server state][state] to access `services`.
- `service` is the high-level database definitions and functions for data,
outbound/sending code, and other business logic such as media fetching.
It is highly unlikely you will ever need to add a new workspace member, but
if you truly find yourself needing to, we recommend reaching out to us in
the Matrix room for discussions about it beforehand.
The primary inspiration for this design was apart of hot reloadable development,
to support "conduwuit as a library" where specific parts can simply be swapped out.
There is evidence Conduit wanted to go this route too as `axum` is technically an
optional feature in Conduit, and can be compiled without the binary or axum library
for handling inbound web requests; but it was never completed or worked.
See the Rust documentation on [Workspaces][workspaces] for general questions
and information on Cargo workspaces.
## Adding compile-time [features][features]
If you'd like to add a compile-time feature, you must first define it in
the `main` workspace crate located in `src/main/Cargo.toml`. The feature must
enable a feature in the other workspace crate(s) you intend to use it in. Then
the said workspace crate(s) must define the feature there in its `Cargo.toml`.
So, if this is adding a feature to the API such as `woof`, you define the feature
in the `api` crate's `Cargo.toml` as `woof = []`. The feature definition in `main`'s
`Cargo.toml` will be `woof = ["conduit-api/woof"]`.
The rationale for this is due to Rust / Cargo not supporting
["workspace level features"][9], we must make a choice of; either scattering
features all over the workspace crates, making it difficult for anyone to add
or remove default features; or define all the features in one central workspace
crate that propagate down/up to the other workspace crates. It is a Cargo pitfall,
and we'd like to see better developer UX in Rust's Workspaces.
Additionally, the definition of one single place makes "feature collection" in our
Nix flake a million times easier instead of collecting and deduping them all from
searching in all the workspace crates' `Cargo.toml`s. Though we wouldn't need to
do this if Rust supported workspace-level features to begin with.
## List of forked dependencies
During conduwuit development, we have had to fork
some dependencies to support our use-cases in some areas. This ranges from
things said upstream project won't accept for any reason, faster-paced
development (unresponsive or slow upstream), conduwuit-specific usecases, or
lack of time to upstream some things.
- [ruma/ruma][1]: <https://github.com/girlbossceo/ruwuma> - various performance
improvements, more features, faster-paced development, client/server interop
hacks upstream won't accept, etc
- [facebook/rocksdb][2]: <https://github.com/girlbossceo/rocksdb> - liburing
build fixes, GCC build fix, and logging callback C API for Rust tracing
integration
- [tikv/jemallocator][3]: <https://github.com/girlbossceo/jemallocator> - musl
builds seem to be broken on upstream
- [zyansheep/rustyline-async][4]:
<https://github.com/girlbossceo/rustyline-async> - tab completion callback and
`CTRL+\` signal quit event for CLI
- [rust-rocksdb/rust-rocksdb][5]:
<https://github.com/girlbossceo/rust-rocksdb-zaidoon1> - [`@zaidoon1`'s][8] fork
has quicker updates, more up to date dependencies. Our changes fix musl build
issues, Rust part of the logging callback C API, removes unnecessary `gtest`
include, and uses our RocksDB and jemallocator
- [tokio-rs/tracing][6]: <https://github.com/girlbossceo/tracing> - Implements
`Clone` for `EnvFilter` to support dynamically changing tracing envfilter's
alongside other logging/metrics things
## Debugging with `tokio-console`
[`tokio-console`][7] can be a useful tool for debugging and profiling. To make a
`tokio-console`-enabled build of conduwuit, enable the `tokio_console` feature,
disable the default `release_max_log_level` feature, and set the `--cfg
tokio_unstable` flag to enable experimental tokio APIs. A build might look like
this:
```bash
RUSTFLAGS="--cfg tokio_unstable" cargo build \
--release \
--no-default-features \
--features=systemd,element_hacks,gzip_compression,brotli_compression,zstd_compression,tokio_console
```
[1]: https://github.com/ruma/ruma/
[2]: https://github.com/facebook/rocksdb/
[3]: https://github.com/tikv/jemallocator/
[4]: https://github.com/zyansheep/rustyline-async/
[5]: https://github.com/rust-rocksdb/rust-rocksdb/
[6]: https://github.com/tokio-rs/tracing/
[7]: https://docs.rs/tokio-console/latest/tokio_console/
[8]: https://github.com/zaidoon1/
[9]: https://github.com/rust-lang/cargo/issues/12162
[workspaces]: https://doc.rust-lang.org/cargo/reference/workspaces.html
[macros]: https://doc.rust-lang.org/book/ch19-06-macros.html
[syn]: https://docs.rs/syn/latest/syn/
[proc-macro]: https://doc.rust-lang.org/reference/procedural-macros.html
[clap]: https://docs.rs/clap/latest/clap/
[features]: https://doc.rust-lang.org/cargo/reference/features.html
[state]: https://docs.rs/axum/latest/axum/extract/struct.State.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View file

@ -0,0 +1,197 @@
# Hot Reloading ("Live" Development)
### Summary
When developing in debug-builds with the nightly toolchain, conduwuit is modular
using dynamic libraries and various parts of the application are hot-reloadable
while the server is running: http api handlers, admin commands, services,
database, etc. These are all split up into individual workspace crates as seen
in the `src/` directory. Changes to sourcecode in a crate rebuild that crate and
subsequent crates depending on it. Reloading then occurs for the changed crates.
Release builds still produce static binaries which are unaffected. Rust's
soundness guarantees are in full force. Thus you cannot hot-reload release
binaries.
### Requirements
Currently, this development setup only works on x86_64 and aarch64 Linux glibc.
[musl explicitly does not support hot reloadable libraries, and does not
implement `dlclose`][2]. macOS does not fully support our usage of `RTLD_GLOBAL`
possibly due to some thread-local issues. [This Rust issue][3] may be of
relevance, specifically [this comment][4]. It may be possible to get it working
on only very modern macOS versions such as at least Sonoma, as currently loading
dylibs is supported, but not unloading them in our setup, and the cited comment
mentions an Apple WWDC confirming there have been TLS changes to somewhat make
this possible.
As mentioned above this requires the nightly toolchain. This is due to reliance
on various Cargo.toml features that are only available on nightly, most
specifically `RUSTFLAGS` in Cargo.toml. Some of the implementation could also be
simpler based on other various nightly features. We hope lots of nightly
features start making it out of nightly sooner as there have been dozens of very
helpful features that have been stuck in nightly ("unstable") for at least 5+
years that would make this simpler. We encourage greater community consensus to
move these features into stability.
This currently only works on x86_64/aarch64 Linux with a glibc C library. musl C
library, macOS, and likely other host architectures are not supported (if other
architectures work, feel free to let us know and/or make a PR updating this).
This should work on GNU ld and lld (rust-lld) and gcc/clang, however if you
happen to have linker issues it's recommended to try using `mold` or `gold`
linkers, and please let us know in the [conduwuit Matrix room][7] the linker
error and what linker solved this issue so we can figure out a solution. Ideally
there should be minimal friction to using this, and in the future a build script
(`build.rs`) may be suitable to making this easier to use if the capabilities
allow us.
### Usage
As of 19 May 2024, the instructions for using this are:
0. Have patience. Don't hesitate to join the [conduwuit Matrix room][7] to
receive help using this. As indicated by the various rustflags used and some
of the interesting issues linked at the bottom, this is definitely not something
the Rust ecosystem or toolchain is used to doing.
1. Install the nightly toolchain using rustup. You may need to use `rustup
override set nightly` in your local conduwuit directory, or use `cargo
+nightly` for all actions.
2. Uncomment `cargo-features` at the top level / root Cargo.toml
3. Scroll down to the `# Developer profile` section and uncomment ALL the
rustflags for each dev profile and their respective packages.
4. In each workspace crate's Cargo.toml (everything under `src/*` AND
`deps/rust-rocksdb/Cargo.toml`), uncomment the `dylib` crate type under
`[lib]`.
5. Due to [this rpath issue][5], you must export the `LD_LIBRARY_PATH`
environment variable to your nightly Rust toolchain library directory. If
using rustup (hopefully), use this: `export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/`
6. Start the server. You can use `cargo +nightly run` for this along with the
standard.
7. Make some changes where you need to.
8. In a separate terminal window in the same directory (or using a terminal
multiplexer like tmux), run the *build* Cargo command `cargo +nightly build`.
Cargo should only rebuild what was changed / what's necessary, so it should
not be rebuilding all the crates.
9. In your conduwuit server terminal, hit/send `CTRL+C` signal. This will tell
conduwuit to find which libraries need to be reloaded, and reloads them as
necessary.
10. If there were no errors, it will tell you it successfully reloaded `#`
modules, and your changes should now be visible. Repeat 7 - 9 as needed.
To shutdown conduwuit in this setup, hit/send `CTRL+\`. Normal builds still
shutdown with `CTRL+C` as usual.
Steps 1 - 5 are the initial first-time steps for using this. To remove the hot
reload setup, revert/comment all the Cargo.toml changes.
As mentioned in the requirements section, if you happen to have some linker
issues, try using the `-fuse-ld=` rustflag and specify mold or gold in all the
`rustflags` definitions in the top level Cargo.toml, and please let us know in
the [conduwuit Matrix room][7] the problem. mold can be installed typically
through your distro, and gold is provided by the binutils package.
It's possible a helper script can be made to do all of this, or most preferably
a specially made build script (build.rs). `cargo watch` support will be
implemented soon which will eliminate the need to manually run `cargo build` all
together.
### Addendum
Conduit was inherited as a single crate without modularity or reloading in its
design. Reasonable partitioning and abstraction allowed a split into several
crates, though many circular dependencies had to be corrected. The resulting
crates now form a directed graph as depicted in figures below. The interfacing
between these crates is still extremely broad which is not mitigable.
Initially [hot_lib_reload][6] was investigated but found appropriate for a
project designed with modularity through limited interfaces, not a large and
complex existing codebase. Instead a bespoke solution built directly on
[libloading][8] satisfied our constraints. This required relatively minimal
modifications and zero maintenance burden compared to what would be required
otherwise. The technical difference lies with relocation processing: we leverage
global bindings (`RTLD_GLOBAL`) in a very intentional way. Most libraries and
off-the-shelf module systems (such as [hot_lib_reload][6]) restrict themselves
to local bindings (`RTLD_LOCAL`). This allows them to release software to
multiple platforms with much greater consistency, but at the cost of burdening
applications to explicitly manage these bindings. In our case with an optional
feature for developers, we shrug any such requirement to enjoy the cost/benefit
on platforms where global relocations are properly cooperative.
To make use of `RTLD_GLOBAL` the application has to be oriented as a directed
acyclic graph. The primary rule is simple and illustrated in the figure below:
**no crate is allowed to call a function or use a variable from a crate below
it.**
![conduwuit's dynamic library setup diagram - created by Jason
Volk](assets/libraries.png)
When a symbol is referenced between crates they become bound: **crates cannot be
unloaded until their calling crates are first unloaded.** Thus we start the
reloading process from the crate which has no callers. There is a small problem
though: the first crate is called by the base executable itself! This is solved
by using an `RTLD_LOCAL` binding for just one link between the main executable
and the first crate, freeing the executable from all modules as no global
binding ever occurs between them.
![conduwuit's reload and load order diagram - created by Jason
Volk](assets/reload_order.png)
Proper resource management is essential for reliable reloading to occur. This is
a very basic ask in RAII-idiomatic Rust and the exposure to reloading hazards is
remarkably low, generally stemming from poor patterns and practices.
Unfortunately static analysis doesn't enforce reload-safety programmatically
(though it could one day), for now hazards can be avoided by knowing a few basic
do's and dont's:
1. Understand that code is memory. Just like one is forbidden from referencing
free'd memory, one must not transfer control to free'd code. Exposure to this
is primarily from two things:
- Callbacks, which this project makes very little use of.
- Async tasks, which are addressed below.
2. Tie all resources to a scope or object lifetime with greatest possible
symmetry (locality). For our purposes this applies to code resources, which
means async blocks and tokio tasks.
- **Never spawn a task without receiving and storing its JoinHandle**.
- **Always wait on join handles** before leaving a scope or in another cleanup
function called by an owning scope.
3. Know any minor specific quirks documented in code or here:
- Don't use `tokio::spawn`, instead use our `Handle` in `core/server.rs`, which
is reachable in most of the codebase via `services()` or other state. This is
due to some bugs or assumptions made in tokio, as it happens in `unsafe {}`
blocks, which are mitigated by circumventing some thread-local variables. Using
runtime handles is good practice in any case.
The initial implementation PR is available [here][1].
### Interesting related issues/bugs
- [DT_RUNPATH produced in binary with rpath = true is wrong (cargo)][5]
- [Disabling MIR Optimization in Rust Compilation
(cargo)](https://internals.rust-lang.org/t/disabling-mir-optimization-in-rust-compilation/19066/5)
- [Workspace-level metadata
(cargo-deb)](https://github.com/kornelski/cargo-deb/issues/68)
[1]: https://github.com/girlbossceo/conduwuit/pull/387
[2]: https://wiki.musl-libc.org/functional-differences-from-glibc.html#Unloading-libraries
[3]: https://github.com/rust-lang/rust/issues/28794
[4]: https://github.com/rust-lang/rust/issues/28794#issuecomment-368693049
[5]: https://github.com/rust-lang/cargo/issues/12746
[6]: https://crates.io/crates/hot-lib-reloader/
[7]: https://matrix.to/#/#conduwuit:puppygock.gay
[8]: https://crates.io/crates/libloading

View file

@ -0,0 +1,22 @@
# Testing
## Complement
Have a look at [Complement's repository][complement] for an explanation of what
it is.
To test against Complement, with Nix (or [Lix](https://lix.systems) and direnv installed
and set up, you can:
* Run `./bin/complement "$COMPLEMENT_SRC" ./path/to/logs.jsonl
./path/to/results.jsonl` to build a Complement image, run the tests, and output
the logs and results to the specified paths. This will also output the OCI image
at `result`
* Run `nix build .#complement` from the root of the repository to just build a
Complement OCI image outputted to `result` (it's a `.tar.gz` file)
* Or download the latest Complement OCI image from the CI workflow artifacts
output from the commit/revision you want to test (e.g. from main)
[here][ci-workflows]
[ci-workflows]: https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml?query=event%3Apush+is%3Asuccess+actor%3Agirlbossceo
[complement]: https://github.com/matrix-org/complement

380
docs/differences.md Normal file
View file

@ -0,0 +1,380 @@
#### **Note: This list may not up to date. There are rapidly more and more
improvements, fixes, changes, etc being made that it is becoming more difficult
to maintain this list. I recommend that you give conduwuit a try and see the
differences for yourself. If you have any concerns, feel free to join the
conduwuit Matrix room and ask any pre-usage questions.**
### list of features, bug fixes, etc that conduwuit does that Conduit does not
Outgoing typing indicators, outgoing read receipts, **and** outgoing presence!
## Performance
- Concurrency support for individual homeserver key fetching for faster remote
room joins and room joins that will error less frequently
- Send `Cache-Control` response header with `immutable` and 1 year cache length
for all media requests (download and thumbnail) to instruct clients to cache
media, and reduce server load from media requests that could be otherwise cached
- Add feature flags and config options to enable/build with zstd, brotli, and/or
gzip HTTP body compression (response and request)
- Eliminate all usage of the thread-blocking `getaddrinfo(3)` call upon DNS
queries, significantly improving federation latency/ping and cache DNS results
(NXDOMAINs, successful queries, etc) using hickory-dns / hickory-resolver
- Enable HTTP/2 support on all requests
- Vastly improve RocksDB default settings to use new features that help with
performance significantly, uses settings tailored to SSDs, various ways to tweak
RocksDB, and a conduwuit setting to tell RocksDB to use settings that are
tailored to HDDs or slow spinning rust storage or buggy filesystems.
- Implement database flush and cleanup conduwuit operations when using RocksDB
- Implement RocksDB write buffer corking and coalescing in database write-heavy
areas
- Perform connection pooling and keepalives where necessary to significantly
improve federation performance and latency
- Various config options to tweak connection pooling, request timeouts,
connection timeouts, DNS timeouts and settings, etc with good defaults which
also help huge with performance via reusing connections and retrying where
needed
- Properly get and use the amount of parallelism / tokio workers
- Implement building conduwuit with jemalloc (which extends to the RocksDB
jemalloc feature for maximum gains) or hardened_malloc light variant, and
io_uring support, and produce CI builds with jemalloc and io_uring by default
for performance (Nix doesn't seem to build
[hardened_malloc-rs](https://github.com/girlbossceo/hardened_malloc-rs)
properly)
- Add support for caching DNS results with hickory-dns / hickory-resolver in
conduwuit (not a replacement for a proper resolver cache, but still far better
than nothing), also properly falls back on TCP for UDP errors or if a SRV
response is too large
- Add config option for using DNS over TCP, and config option for controlling
A/AAAA record lookup strategy (e.g. don't query AAAA records if you don't have
IPv6 connectivity)
- Overall significant database, Client-Server, and federation performance and
latency improvements (check out the ping room leaderboards if you don't believe
me :>)
- Add config options for RocksDB compression and bottommost compression,
including choosing the algorithm and compression level
- Use [loole](https://github.com/mahdi-shojaee/loole) MPSC channels instead of
tokio MPSC channels for huge performance boosts in sending channels (mainly
relevant for federation) and presence channels
- Use `tracing`/`log`'s `release_max_level_info` feature to improve performance,
build speeds, binary size, and CPU usage in release builds by avoid compiling
debug/trace log level macros that users will generally never use (can be
disabled with a build-time feature flag)
- Remove some unnecessary checks on EDU handling for incoming transactions,
effectively speeding them up
- Simplify, dedupe, etc huge chunks of the codebase, including some that were
unnecessary overhead, binary bloats, or preventing compiler/linker optimisations
- Implement zero-copy RocksDB database accessors, substantially improving
performance caused by unnecessary memory allocations
## General Fixes/Features
- Add legacy Element client hack fixing password changes and deactivations on
legacy Element Android/iOS due to usage of an unspecced `user` field for UIAA
- Raise and improve all the various request timeouts making some things like
room joins and client bugs error less or none at all than they should, and make
them all user configurable
- Add missing `reason` field to user ban events (`/ban`)
- Safer and cleaner shutdowns across incoming/outgoing requests (graceful
shutdown) and the database
- Stop sending `make_join` requests on room joins if 15 servers respond with
`M_UNSUPPORTED_ROOM_VERSION` or `M_INVALID_ROOM_VERSION`
- Stop sending `make_join` requests if 50 servers cannot provide `make_join` for
us
- Respect *most* client parameters for `/media/` requests (`allow_redirect`
still needs work)
- Return joined member count of rooms for push rules/conditions instead of a
hardcoded value of 10
- Make `CONDUIT_CONFIG` optional, relevant for container users that configure
only by environment variables and no longer need to set `CONDUIT_CONFIG` to an
empty string.
- Allow HEAD and PATCH (MSC4138) HTTP requests in CORS for clients (despite not
being explicity mentioned in Matrix spec, HTTP spec says all HEAD requests need
to behave the same as GET requests, Synapse supports HEAD requests)
- Fix using conduwuit with flake-compat on NixOS
- Resolve and remove some "features" from upstream that result in concurrency
hazards, exponential backoff issues, or arbitrary performance limiters
- Find more servers for outbound federation `/hierarchy` requests instead of
just the room ID server name
- Support for suggesting servers to join through at
`/_matrix/client/v3/directory/room/{roomAlias}`
- Support for suggesting servers to join through us at
`/_matrix/federation/v1/query/directory`
- Misc edge-case search fixes (e.g. potentially missing some events)
- Misc `/sync` fixes (e.g. returning unnecessary data or incorrect/invalid
responses)
- Add `replaces_state` and `prev_sender` in `unsigned` for state event changes
which primarily makes Element's "See history" button on a state event functional
- Fix Conduit not allowing incoming federation requests for various world
readable rooms
- Fix Conduit not respecting the client-requested file name on media requests
- Prevent sending junk / non-membership events to `/send_join` and `/send_leave`
endpoints
- Only allow the requested membership type on `/send_join` and `/send_leave`
endpoints (e.g. don't allow leave memberships on join endpoints)
- Prevent state key impersonation on `/send_join` and `/send_leave` endpoints
- Validate `X-Matrix` origin and request body `"origin"` field on incoming
transactions
- Add `GET /_matrix/client/v1/register/m.login.registration_token/validity`
endpoint
- Explicitly define support for sliding sync at `/_matrix/client/versions`
(`org.matrix.msc3575`)
- Fix seeing empty status messages on user presences
## Moderation
- (Also see [Admin Room](#admin-room) for all the admin commands pertaining to
moderation, there's a lot!)
- Add support for room banning/blocking by ID using admin command
- Add support for serving `support` well-known from `[global.well_known]`
(MSC1929) (`/.well-known/matrix/support`)
- Config option to forbid publishing rooms to the room directory
(`lockdown_public_room_directory`) except for admins
- Admin commands to delete room aliases and unpublish rooms from our room
directory
- For all
[`/report`](https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3roomsroomidreporteventid)
requests: check if the reported event ID belongs to the reported room ID, raise
report reasoning character limit to 750, fix broken formatting, make a small
delayed random response per spec suggestion on privacy, and check if the sender
user is in the reported room.
- Support blocking servers from downloading remote media from, returning a 404
- Don't allow `m.call.invite` events to be sent in public rooms (prevents
calling the entire room)
- On new public room creations, only allow moderators to send `m.call.invite`,
`org.matrix.msc3401.call`, and `org.matrix.msc3401.call.member` events to
prevent unprivileged users from calling the entire room
- Add support for a "global ACLs" feature (`forbidden_remote_server_names`) that
blocks inbound remote room invites, room joins by room ID on server name, room
joins by room alias on server name, incoming federated joins, and incoming
federated room directory requests. This is very helpful for blocking servers
that are purely toxic/bad and serve no value in allowing our users to suffer
from things like room invite spam or such. Please note that this is not a
substitute for room ACLs.
- Add support for a config option to forbid our local users from sending
federated room directory requests for
(`forbidden_remote_room_directory_server_names`). Similar to above, useful for
blocking servers that help prevent our users from wandering into bad areas of
Matrix via room directories of those malicious servers.
- Add config option for auto remediating/deactivating local non-admin users who
attempt to join bad/forbidden rooms (`auto_deactivate_banned_room_attempts`)
- Deactivating users will remove their profile picture, blurhash, display name,
and leave all rooms by default just like Synapse and for additional privacy
- Reject some EDUs from ACL'd users such as read receipts and typing indicators
## Privacy/Security
- Add config option for device name federation with a privacy-friendly default
(disabled)
- Add config option for requiring authentication to the `/publicRooms` endpoint
(room directory) with a default enabled for privacy
- Add config option for federating `/publicRooms` endpoint (room directory) to
other servers with a default disabled for privacy
- Uses proper `argon2` crate by RustCrypto instead of questionable `rust-argon2`
crate
- Generate passwords with 25 characters instead of 15
- Config option `ip_range_denylist` to support refusing to send requests
(typically federation) to specific IP ranges, typically RFC 1918, non-routable,
testnet, etc addresses like Synapse for security (note: this is not a guaranteed
protection, and you should be using a firewall with zones if you want guaranteed
protection as doing this on the application level is prone to bypasses).
- Config option to block non-admin users from sending room invites or receiving
remote room invites. Admin users are still allowed.
- Config option to disable incoming and/or outgoing remote read receipts
- Config option to disable incoming and/or outgoing remote typing indicators
- Config option to disable incoming, outgoing, and/or local presence and for
timing out remote users
- Sanitise file names for the `Content-Disposition` header for all media
requests (thumbnails, downloads, uploads)
- Media repository on handling `Content-Disposition` and `Content-Type` is fully
spec compliant and secured
- Send secure default HTTP headers such as a strong restrictive CSP (see
MSC4149), deny iframes, disable `X-XSS-Protection`, disable interest cohort in
`Permission-Policy`, etc to mitigate any potential attack surface such as from
untrusted media
## Administration/Logging
- Commandline argument to specify the path to a config file instead of relying
on `CONDUIT_CONFIG`
- Revamped admin room infrastructure and commands
- Substantially clean up, improve, and fix logging (less noisy dead server
logging, registration attempts, more useful troubleshooting logging, proper
error propagation, etc)
- Configurable RocksDB logging (`LOG` files) with proper defaults (rotate, max
size, verbosity, etc) to stop LOG files from accumulating so much
- Explicit startup error if your configuration allows open registration without
a token or such like Synapse with a way to bypass it if needed
- Replace the lightning bolt emoji option with support for setting any arbitrary
text (e.g. another emoji) to suffix to all new user registrations, with a
conduwuit default of "🏳️‍⚧️"
- Implement config option to auto join rooms upon registration
- Warn on unknown config options specified
- Add `/_conduwuit/server_version` route to return the version of conduwuit
without relying on the federation API `/_matrix/federation/v1/version`
- Add `/_conduwuit/local_user_count` route to return the amount of registered
active local users on your homeserver *if federation is enabled*
- Add configurable RocksDB recovery modes to aid in recovering corrupted RocksDB
databases
- Support config options via `CONDUWUIT_` prefix and accessing non-global struct
config options with the `__` split (e.g. `CONDUWUIT_WELL_KNOWN__SERVER`)
- Add support for listening on multiple TCP ports and multiple addresses
- **Opt-in** Sentry.io telemetry and metrics, mainly used for crash reporting
- Log the client IP on various requests such as registrations, banned room join
attempts, logins, deactivations, federation transactions, etc
- Fix Conduit dropping some remote server federation response errors
## Maintenance/Stability
- GitLab CI ported to GitHub Actions
- Add support for the Matrix spec compliance test suite
[Complement](https://github.com/matrix-org/complement/) via the Nix flake and
various other fixes for it
- Implement running and diff'ing Complement results in CI and error if any
mismatch occurs to prevent large cases of conduwuit regressions
- Repo is (officially) mirrored to GitHub, GitLab, git.gay, git.girlcock.ceo,
sourcehut, and Codeberg (see README.md for their links)
- Docker container images published to GitLab Container Registry, GitHub
Container Registry, and Dockerhub
- Extensively revamp the example config to be extremely helpful and useful to
both new users and power users
- Fixed every single clippy (default lints) and rustc warnings, including some
that were performance related or potential safety issues / unsoundness
- Add a **lot** of other clippy and rustc lints and a rustfmt.toml file
- Repo uses [Renovate](https://docs.renovatebot.com/),
[Trivy](https://github.com/aquasecurity/trivy-action), and keeps ALL
dependencies as up to date as possible
- Purge unmaintained/irrelevant/broken database backends (heed, sled, persy) and
other unnecessary code or overhead
- webp support for images
- Add cargo audit support to CI
- Add documentation lints via lychee and markdownlint-cli to CI
- CI tests for all sorts of feature matrixes (jemalloc, non-defaullt, all
features, etc)
- Add static and dynamic linking smoke tests in CI to prevent any potential
linking regressions for Complement, static binaries, Nix devshells, etc
- Add timestamp by commit date when building OCI images for keeping image build
reproducibility and still have a meaningful "last modified date" for OCI image
- Add timestamp by commit date via `SOURCE_DATE_EPOCH` for Debian packages
- Startup check if conduwuit running in a container and is listening on
127.0.0.1 (generally containers are using NAT networking and 0.0.0.0 is the
intended listening address)
- Add a panic catcher layer to return panic messages in HTTP responses if a
panic occurs
- Add full compatibility support for SHA256 media file names instead of base64
file names to overcome filesystem file name length limitations (OS error file
name too long) while still retaining upstream database compatibility
- Remove SQLite support due to being very poor performance, difficult to
maintain against RocksDB, and is a blocker to significantly improved database
code
## Admin Room
- Add support for a console CLI interface that can issue admin commands and
output them in your terminal
- Add support for an admin-user-only commandline admin room interface that can
be issued in any room with the `\\!admin` or `\!admin` prefix and returns the
response as yourself in the same room
- Add admin commands for uptime, server startup, server shutdown, and server
restart
- Fix admin room handler to not panic/crash if the admin room command response
fails (e.g. too large message)
- Add command to dynamically change conduwuit's tracing log level filter on the
fly
- Add admin command to fetch a server's `/.well-known/matrix/support` file
- Add debug admin command to force update user device lists (could potentially
resolve some E2EE flukes)
- Implement **RocksDB online backups**, listing RocksDB backups, and listing
database file counts all via admin commands
- Add various database visibility commands such as being able to query the
getters and iterators used in conduwuit, a very helpful online debugging utility
- Forbid the admin room from being made public or world readable history
- Add `!admin` as a way to call the admin bot
- Extend clear cache admin command to support clearing more caches such as DNS
and TLS name overrides
- Admin debug command to send a federation request/ping to a server's
`/_matrix/federation/v1/version` endpoint and measures the latency it took
- Add admin command to bulk delete media via a codeblock list of MXC URLs.
- Add admin command to delete both the thumbnail and media MXC URLs from an
event ID (e.g. from an abuse report)
- Add admin command to list all the rooms a local user is joined in
- Add admin command to list joined members in a room
- Add admin command to view the room topic of a room
- Add admin command to delete all remote media in the past X minutes as a form
of deleting media that you don't want on your server that a remote user posted
in a room, a `--force` flag to ignore errors, and support for reading `last
modified time` instead of `creation time` for filesystems that don't support
file created metadata
- Add admin command to return a room's full/complete state
- Admin debug command to fetch a PDU from a remote server and inserts it into
our database/timeline as backfill
- Add admin command to delete media via a specific MXC. This deletes the MXC
from our database, and the file locally.
- Add admin commands for banning (blocking) room IDs from our local users
joining (admins are always allowed) and evicts all our local users from that
room, in addition to bulk room banning support, and blocks room invites (remote
and local) to the banned room, as a moderation feature
- Add admin commands to output jemalloc memory stats and memory usage
- Add admin command to get rooms a *remote* user shares with us
- Add debug admin commands to get the earliest and latest PDU in a room
- Add debug admin command to echo a message
- Add admin command to insert rooms tags for a user, most useful for inserting
the `m.server_notice` tag on your admin room to make it "persistent" in the
"System Alerts" section of Element
- Add experimental admin debug command for Dendrite's `AdminDownloadState`
(`/admin/downloadState/{serverName}/{roomID}`) admin API endpoint to download
and use a remote server's room state in the room
- Disable URL previews by default in the admin room due to various command
outputs having "URLs" in them that clients may needlessly render/request
- Extend memory usage admin server command to support showing memory allocator
stats such as jemalloc's
- Add admin debug command to see memory allocator's full extended debug
statistics such as jemalloc's
## Misc
- Add guest support for accessing TURN servers via `turn_allow_guests` like
Synapse
- Support for creating rooms with custom room IDs like Maunium Synapse
(`room_id` request body field to `/createRoom`)
- Query parameter `?format=event|content` for returning either the room state
event's content (default) for the full room state event on
`/_matrix/client/v3/rooms/{roomId}/state/{eventType}[/{stateKey}]` requests (see
<https://github.com/matrix-org/matrix-spec/issues/1047>)
- Send a User-Agent on all of our requests
- Send `avatar_url` on invite room membership events/changes
- Support sending [`well_known` response to client login
responses](https://spec.matrix.org/v1.10/client-server-api/#post_matrixclientv3login)
if using config option `[well_known.client]`
- Implement `include_state` search criteria support for `/search` requests
(response now can include room states)
- Declare various missing Matrix versions and features at
`/_matrix/client/versions`
- Implement legacy Matrix `/v1/` media endpoints that some clients and servers
may still call
- Config option to change Conduit's behaviour of homeserver key fetching
(`query_trusted_key_servers_first`). This option sets whether conduwuit will
query trusted notary key servers first before the individual homeserver(s), or
vice versa which may help in joining certain rooms.
- Implement unstable MSC2666 support for querying mutual rooms with a user
- Implement unstable MSC3266 room summary API support
- Implement unstable MSC4125 support for specifying servers to join via on
federated invites
- Make conduwuit build and be functional under Nix + macOS
- Log out all sessions after unsetting the emergency password
- Assume well-knowns are broken if they exceed past 12288 characters.
- Add support for listening on both HTTP and HTTPS if using direct TLS with
conduwuit for usecases such as Complement
- Add config option for disabling RocksDB Direct IO if needed
- Add various documentation on maintaining conduwuit, using RocksDB online
backups, some troubleshooting, using admin commands, moderation documentation,
etc
- (Developers): Add support for [hot reloadable/"live" modular
development](development/hot_reload.md)
- (Developers): Add support for tokio-console
- (Developers): Add support for tracing flame graphs
- No cryptocurrency donations allowed, conduwuit is fully maintained by
independent queer maintainers, and with a strong priority on inclusitivity and
comfort for protected groups 🏳️‍⚧️
- [Add a community Code of Conduct for all conduwuit community spaces, primarily
the Matrix space](https://conduwuit.puppyirl.gay/conduwuit_coc.html)

22
docs/introduction.md Normal file
View file

@ -0,0 +1,22 @@
# conduwuit
{{#include ../README.md:catchphrase}}
{{#include ../README.md:body}}
#### What's different about your fork than upstream Conduit?
See the [differences](differences.md) page
#### How can I deploy my own?
- [Deployment options](deploying.md)
If you want to connect an appservice to conduwuit, take a look at the
[appservices documentation](appservices.md).
#### How can I contribute?
See the [contributor's guide](contributing.md)
{{#include ../README.md:footer}}

97
docs/maintenance.md Normal file
View file

@ -0,0 +1,97 @@
# Maintaining your conduwuit setup
## Moderation
conduwuit has moderation through admin room commands. "binary commands" (medium
priority) and an admin API (low priority) is planned. Some moderation-related
config options are available in the example config such as "global ACLs" and
blocking media requests to certain servers. See the example config for the
moderation config options under the "Moderation / Privacy / Security" section.
conduwuit has moderation admin commands for:
- managing room aliases (`!admin rooms alias`)
- managing room directory (`!admin rooms directory`)
- managing room banning/blocking and user removal (`!admin rooms moderation`)
- managing user accounts (`!admin users`)
- fetching `/.well-known/matrix/support` from servers (`!admin federation`)
- blocking incoming federation for certain rooms (not the same as room banning)
(`!admin federation`)
- deleting media (see [the media section](#media))
Any commands with `-list` in them will require a codeblock in the message with
each object being newline delimited. An example of doing this is:
```` !admin rooms moderation ban-list-of-rooms ``` !roomid1:server.name
!roomid2:server.name !roomid3:server.name ``` ````
## Database
If using RocksDB, there's very little you need to do. Compaction is ran
automatically based on various defined thresholds tuned for conduwuit to be high
performance with the least I/O amplifcation or overhead. Manually running
compaction is not recommended, or compaction via a timer. RocksDB is built with
io_uring support via liburing for async read I/O.
Some RocksDB settings can be adjusted such as the compression method chosen. See
the RocksDB section in the [example config](configuration/examples.md). btrfs
users may benefit from disabling compression on RocksDB if CoW is in use.
RocksDB troubleshooting can be found [in the RocksDB section of
troubleshooting](troubleshooting.md).
## Backups
Currently only RocksDB supports online backups. If you'd like to backup your
database online without any downtime, see the `!admin server` command for the
backup commands and the `database_backup_path` config options in the example
config. Please note that the format of the database backup is not the exact
same. This is unfortunately a bad design choice by Facebook as we are using the
database backup engine API from RocksDB, however the data is still there and can
still be joined together.
To restore a backup from an online RocksDB backup:
- shutdown conduwuit
- create a new directory for merging together the data
- in the online backup created, copy all `.sst` files in
`$DATABASE_BACKUP_PATH/shared_checksum` to your new directory
- trim all the strings so instead of `######_sxxxxxxxxx.sst`, it reads
`######.sst`. A way of doing this with sed and bash is `for file in *.sst; do mv
"$file" "$(echo "$file" | sed 's/_s.*/.sst/')"; done`
- copy all the files in `$DATABASE_BACKUP_PATH/1` (or the latest backup number
if you have multiple) to your new directory
- set your `database_path` config option to your new directory, or replace your
old one with the new one you crafted
- start up conduwuit again and it should open as normal
If you'd like to do an offline backup, shutdown conduwuit and copy your
`database_path` directory elsewhere. This can be restored with no modifications
needed.
Backing up media is also just copying the `media/` directory from your database
directory.
## Media
Media still needs various work, however conduwuit implements media deletion via:
- MXC URI or Event ID (unencrypted and attempts to find the MXC URI in the
event)
- Delete list of MXC URIs
- Delete remote media in the past `N` seconds/minutes via filesystem metadata on
the file created time (`btime`) or file modified time (`mtime`)
See the `!admin media` command for further information. All media in conduwuit
is stored at `$DATABASE_DIR/media`. This will be configurable soon.
If you are finding yourself needing extensive granular control over media, we
recommend looking into [Matrix Media
Repo](https://github.com/t2bot/matrix-media-repo). conduwuit intends to
implement various utilities for media, but MMR is dedicated to extensive media
management.
Built-in S3 support is also planned, but for now using a "S3 filesystem" on
`media/` works. conduwuit also sends a `Cache-Control` header of 1 year and
immutable for all media requests (download and thumbnail) to reduce unnecessary
media requests from browsers, reduce bandwidth usage, and reduce load.

128
docs/troubleshooting.md Normal file
View file

@ -0,0 +1,128 @@
# Troubleshooting conduwuit
> ## Docker users ⚠️
>
> Docker is extremely UX unfriendly. Because of this, a ton of issues or support
> is actually Docker support, not conduwuit support. We also cannot document the
> ever-growing list of Docker issues here.
>
> If you intend on asking for support and you are using Docker, **PLEASE**
> triple validate your issues are **NOT** because you have a misconfiguration in
> your Docker setup.
>
> If there are things like Compose file issues or Dockerhub image issues, those
> can still be mentioned as long as they're something we can fix.
## conduwuit and Matrix issues
#### Lost access to admin room
You can reinvite yourself to the admin room through the following methods:
- Use the `--execute "users make_user_admin <username>"` conduwuit binary
argument once to invite yourslf to the admin room on startup
- Use the conduwuit console/CLI to run the `users make_user_admin` command
- Or specify the `emergency_password` config option to allow you to temporarily
log into the server account (`@conduit`) from a web client
## General potential issues
#### Potential DNS issues when using Docker
Docker has issues with its default DNS setup that may cause DNS to not be
properly functional when running conduwuit, resulting in federation issues. The
symptoms of this have shown in excessively long room joins (30+ minutes) from
very long DNS timeouts, log entries of "mismatching responding nameservers",
and/or partial or non-functional inbound/outbound federation.
This is **not** a conduwuit issue, and is purely a Docker issue. It is not
sustainable for heavy DNS activity which is normal for Matrix federation. The
workarounds for this are:
- Use DNS over TCP via the config option `query_over_tcp_only = true`
- Don't use Docker's default DNS setup and instead allow the container to use
and communicate with your host's DNS servers (host's `/etc/resolv.conf`)
## RocksDB / database issues
#### Direct IO
Some filesystems may not like RocksDB using [Direct
IO](https://github.com/facebook/rocksdb/wiki/Direct-IO). Direct IO is for
non-buffered I/O which improves conduwuit performance, but at least FUSE is a
filesystem potentially known to not like this. See the [example
config](configuration/examples.md) for disabling it if needed. Issues from
Direct IO on unsupported filesystems are usually shown as startup errors.
#### Database corruption
If your database is corrupted *and* is failing to start (e.g. checksum
mismatch), it may be recoverable but careful steps must be taken, and there is
no guarantee it may be recoverable.
The first thing that can be done is launching conduwuit with the
`rocksdb_repair` config option set to true. This will tell RocksDB to attempt to
repair itself at launch. If this does not work, disable the option and continue
reading.
RocksDB has the following recovery modes:
- `TolerateCorruptedTailRecords`
- `AbsoluteConsistency`
- `PointInTime`
- `SkipAnyCorruptedRecord`
By default, conduwuit uses `TolerateCorruptedTailRecords` as generally these may
be due to bad federation and we can re-fetch the correct data over federation.
The RocksDB default is `PointInTime` which will attempt to restore a "snapshot"
of the data when it was last known to be good. This data can be either a few
seconds old, or multiple minutes prior. `PointInTime` may not be suitable for
default usage due to clients and servers possibly not being able to handle
sudden "backwards time travels", and `AbsoluteConsistency` may be too strict.
`AbsoluteConsistency` will fail to start the database if any sign of corruption
is detected. `SkipAnyCorruptedRecord` will skip all forms of corruption unless
it forbids the database from opening (e.g. too severe). Usage of
`SkipAnyCorruptedRecord` voids any support as this may cause more damage and/or
leave your database in a permanently inconsistent state, but it may do something
if `PointInTime` does not work as a last ditch effort.
With this in mind:
- First start conduwuit with the `PointInTime` recovery method. See the [example
config](configuration/examples.md) for how to do this using
`rocksdb_recovery_mode`
- If your database successfully opens, clients are recommended to clear their
client cache to account for the rollback
- Leave your conduwuit running in `PointInTime` for at least 30-60 minutes so as
much possible corruption is restored
- If all goes will, you should be able to restore back to using
`TolerateCorruptedTailRecords` and you have successfully recovered your database
## Debugging
Note that users should not really be debugging things. If you find yourself
debugging and find the issue, please let us know and/or how we can fix it.
Various debug commands can be found in `!admin debug`.
#### Debug/Trace log level
conduwuit builds without debug or trace log levels by default for at least
performance reasons. This may change in the future and/or binaries providing
such configurations may be provided. If you need to access debug/trace log
levels, you will need to build without the `release_max_log_level` feature.
#### Changing log level dynamically
conduwuit supports changing the tracing log environment filter on-the-fly using
the admin command `!admin debug change-log-level`. This accepts a string
**without quotes** the same format as the `log` config option.
#### Pinging servers
conduwuit can ping other servers using `!admin debug ping`. This takes a server
name and goes through the server discovery process and queries
`/_matrix/federation/v1/version`. Errors are outputted.
#### Allocator memory stats
When using jemalloc with jemallocator's `stats` feature, you can see conduwuit's
jemalloc memory stats by using `!admin debug memory-stats`

54
docs/turn.md Normal file
View file

@ -0,0 +1,54 @@
# Setting up TURN/STURN
In order to make or receive calls, a TURN server is required. conduwuit suggests
using [Coturn](https://github.com/coturn/coturn) for this purpose, which is also
available as a Docker image.
### Configuration
Create a configuration file called `coturn.conf` containing:
```conf
use-auth-secret
static-auth-secret=<a secret key>
realm=<your server domain>
```
A common way to generate a suitable alphanumeric secret key is by using `pwgen
-s 64 1`.
These same values need to be set in conduwuit. See the [example
config](configuration/examples.md) in the TURN section for configuring these and
restart conduwuit after.
### Run
Run the [Coturn](https://hub.docker.com/r/coturn/coturn) image using
```bash
docker run -d --network=host -v
$(pwd)/coturn.conf:/etc/coturn/turnserver.conf coturn/coturn
```
or docker-compose. For the latter, paste the following section into a file
called `docker-compose.yml` and run `docker compose up -d` in the same
directory.
```yml
version: 3
services:
turn:
container_name: coturn-server
image: docker.io/coturn/coturn
restart: unless-stopped
network_mode: "host"
volumes:
- ./coturn.conf:/etc/coturn/turnserver.conf
```
To understand why the host networking mode is used and explore alternative
configuration options, please visit [Coturn's Docker
documentation](https://github.com/coturn/coturn/blob/master/docker/coturn/README.md).
For security recommendations see Synapse's [Coturn
documentation](https://element-hq.github.io/synapse/latest/turn-howto.html).

208
engage.toml Normal file
View file

@ -0,0 +1,208 @@
interpreter = ["bash", "-euo", "pipefail", "-c"]
[[task]]
name = "engage"
group = "versions"
script = "engage --version"
[[task]]
name = "nix"
group = "versions"
script = "nix --version"
[[task]]
name = "direnv"
group = "versions"
script = "direnv --version"
[[task]]
name = "rustc"
group = "versions"
script = "rustc --version"
[[task]]
name = "cargo"
group = "versions"
script = "cargo --version"
[[task]]
name = "cargo-fmt"
group = "versions"
script = "cargo fmt --version"
[[task]]
name = "rustdoc"
group = "versions"
script = "rustdoc --version"
[[task]]
name = "cargo-clippy"
group = "versions"
script = "cargo clippy -- --version"
[[task]]
name = "cargo-audit"
group = "versions"
script = "cargo audit --version"
[[task]]
name = "cargo-deb"
group = "versions"
script = "cargo deb --version"
[[task]]
name = "lychee"
group = "versions"
script = "lychee --version"
[[task]]
name = "markdownlint"
group = "versions"
script = "markdownlint --version"
[[task]]
name = "dpkg"
group = "versions"
script = "dpkg --version"
[[task]]
name = "cargo-audit"
group = "security"
script = "cargo audit -D warnings -D unmaintained -D unsound -D yanked"
[[task]]
name = "cargo-fmt"
group = "lints"
script = """
cargo fmt --check -- --color=always
"""
[[task]]
name = "cargo-doc"
group = "lints"
script = """
env DIRENV_DEVSHELL=all-features \
RUSTDOCFLAGS="-D warnings" \
direnv exec . \
cargo doc \
--workspace \
--profile test \
--all-features \
--no-deps \
--document-private-items \
--color always
"""
[[task]]
name = "clippy/default"
group = "lints"
script = """
cargo clippy \
--workspace \
--profile test \
--all-targets \
--color=always \
-- \
-D warnings
"""
[[task]]
name = "clippy/all"
group = "lints"
script = """
env DIRENV_DEVSHELL=all-features \
direnv exec . \
cargo clippy \
--workspace \
--profile test \
--all-targets \
--all-features \
--color=always \
-- \
-D warnings
"""
[[task]]
name = "clippy/jemalloc"
group = "lints"
script = """
cargo clippy \
--workspace \
--profile test \
--features jemalloc \
--all-targets \
--color=always \
-- \
-D warnings
"""
#[[task]]
#name = "clippy/hardened_malloc"
#group = "lints"
#script = """
#cargo clippy \
# --workspace \
# --features hardened_malloc \
# --all-targets \
# --color=always \
# -- \
# -D warnings
#"""
[[task]]
name = "lychee"
group = "lints"
script = "lychee --verbose --offline docs *.md --exclude development.md --exclude contributing.md --exclude testing.md"
[[task]]
name = "markdownlint"
group = "lints"
script = "markdownlint docs *.md || true" # TODO: fix the ton of markdown lints so we can drop `|| true`
[[task]]
name = "cargo/all"
group = "tests"
script = """
env DIRENV_DEVSHELL=all-features \
direnv exec . \
cargo test \
--workspace \
--profile test \
--all-targets \
--all-features \
--color=always \
-- \
--color=always
"""
[[task]]
name = "cargo/default"
group = "tests"
script = """
cargo test \
--workspace \
--profile test \
--all-targets \
--color=always \
-- \
--color=always
"""
# Ensure that the flake's default output can build and run without crashing
#
# This is a dynamically-linked jemalloc build, which is a case not covered by
# our other tests. We've had linking problems in the past with dynamic
# jemalloc builds that usually show up as an immediate segfault or "invalid free"
[[task]]
name = "nix-default"
group = "tests"
script = """
env DIRENV_DEVSHELL=dynamic \
CARGO_PROFILE="test" \
direnv exec . \
bin/nix-build-and-cache just .#default-test
env DIRENV_DEVSHELL=dynamic \
CARGO_PROFILE="test" \
direnv exec . \
nix run -L .#default-test -- --help && nix run -L .#default-test -- --version
"""

694
flake.lock generated
View file

@ -1,22 +1,114 @@
{
"nodes": {
"crane": {
"attic": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1688772518,
"narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=",
"lastModified": 1725300620,
"narHash": "sha256-IdM+pZ6BnmD3o1fTJZ2BD43k7dwi1BbVfLDLpM1nE5s=",
"owner": "zhaofengli",
"repo": "attic",
"rev": "bea72d75b6165dfb529ba0c39cc6c7e9c7f0d234",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"ref": "main",
"repo": "attic",
"type": "github"
}
},
"cachix": {
"inputs": {
"devenv": "devenv",
"flake-compat": "flake-compat_3",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1724232775,
"narHash": "sha256-6u2DycIEgrgNYlLxyGqdFVmBNiKIitnQKJ1pbRP5oko=",
"owner": "cachix",
"repo": "cachix",
"rev": "03b6cb3f953097bff378fb8b9ea094bd091a4ec7",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "master",
"repo": "cachix",
"type": "github"
}
},
"cachix_2": {
"inputs": {
"devenv": "devenv_2",
"flake-compat": [
"cachix",
"devenv",
"flake-compat"
],
"nixpkgs": [
"cachix",
"devenv",
"nixpkgs"
],
"pre-commit-hooks": [
"cachix",
"devenv",
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1712055811,
"narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=",
"owner": "cachix",
"repo": "cachix",
"rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "cachix",
"type": "github"
}
},
"complement": {
"flake": false,
"locked": {
"lastModified": 1724347376,
"narHash": "sha256-y0e/ULDJ92IhNQZsS/06g0s+AYZ82aJfrIO9qEse94c=",
"owner": "matrix-org",
"repo": "complement",
"rev": "39733c1b2f8314800776748cc7164f9a34650686",
"type": "github"
},
"original": {
"owner": "matrix-org",
"ref": "main",
"repo": "complement",
"type": "github"
}
},
"crane": {
"inputs": {
"nixpkgs": [
"attic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722960479,
"narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=",
"owner": "ipetkov",
"repo": "crane",
"rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e",
"rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4",
"type": "github"
},
"original": {
@ -25,6 +117,86 @@
"type": "github"
}
},
"crane_2": {
"locked": {
"lastModified": 1725409566,
"narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=",
"owner": "ipetkov",
"repo": "crane",
"rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c",
"type": "github"
},
"original": {
"owner": "ipetkov",
"ref": "master",
"repo": "crane",
"type": "github"
}
},
"devenv": {
"inputs": {
"cachix": "cachix_2",
"flake-compat": [
"cachix",
"flake-compat"
],
"nix": "nix_2",
"nixpkgs": [
"cachix",
"nixpkgs"
],
"pre-commit-hooks": [
"cachix",
"git-hooks"
]
},
"locked": {
"lastModified": 1723156315,
"narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=",
"owner": "cachix",
"repo": "devenv",
"rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"devenv_2": {
"inputs": {
"flake-compat": [
"cachix",
"devenv",
"cachix",
"flake-compat"
],
"nix": "nix",
"nixpkgs": "nixpkgs_2",
"poetry2nix": "poetry2nix",
"pre-commit-hooks": [
"cachix",
"devenv",
"cachix",
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1708704632,
"narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=",
"owner": "cachix",
"repo": "devenv",
"rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "python-rewrite",
"repo": "devenv",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
@ -33,20 +205,37 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1689488573,
"narHash": "sha256-diVASflKCCryTYv0djvMnP2444mFsIG0ge5pa7ahauQ=",
"lastModified": 1725690497,
"narHash": "sha256-5fT+96rV7Hx29HG+4/oBbr3V+yExKuLN2vcBcPbVBlU=",
"owner": "nix-community",
"repo": "fenix",
"rev": "39096fe3f379036ff4a5fa198950b8e79defe939",
"rev": "4b8d964df93d1f918ee6c4f003b3548c432cc866",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "main",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1673956053,
@ -62,10 +251,82 @@
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"ref": "master",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"attic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
@ -80,13 +341,291 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
"cachix",
"flake-compat"
],
"gitignore": "gitignore",
"nixpkgs": [
"cachix",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1723202784,
"narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "c7012d0c18567c889b948781bc74a501e92275d1",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"cachix",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"liburing": {
"flake": false,
"locked": {
"lastModified": 1725659644,
"narHash": "sha256-WjnpmopfvFoUbubIu9bki+Y6P4YXDfvnW4+72hniq3g=",
"owner": "axboe",
"repo": "liburing",
"rev": "0fe5c09195c0918f89582dd6ff098a58a0bdf62a",
"type": "github"
},
"original": {
"owner": "axboe",
"ref": "master",
"repo": "liburing",
"type": "github"
}
},
"nix": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": [
"cachix",
"devenv",
"cachix",
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression"
},
"locked": {
"lastModified": 1712911606,
"narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=",
"owner": "domenkozar",
"repo": "nix",
"rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1710156097,
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "nix-filter",
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"cachix",
"devenv",
"cachix",
"devenv",
"poetry2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688870561,
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nix_2": {
"inputs": {
"flake-compat": [
"cachix",
"devenv",
"flake-compat"
],
"nixpkgs": [
"cachix",
"devenv",
"nixpkgs"
],
"nixpkgs-regression": "nixpkgs-regression_2"
},
"locked": {
"lastModified": 1712911606,
"narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=",
"owner": "domenkozar",
"repo": "nix",
"rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12",
"type": "github"
},
"original": {
"owner": "domenkozar",
"ref": "devenv-2.21",
"repo": "nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1689444953,
"narHash": "sha256-0o56bfb2LC38wrinPdCGLDScd77LVcr7CrH1zK7qvDg=",
"lastModified": 1724999960,
"narHash": "sha256-LB3jqSGW5u1ZcUcX6vO/qBOq5oXHlmOCxsTXGMEitp4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8acef304efe70152463a6399f73e636bcc363813",
"rev": "b96f849e725333eb2b1c7f1cb84ff102062468ba",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-regression_2": {
"locked": {
"lastModified": 1643052045,
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1724316499,
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1692808169,
"narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9201b5ff357e781bf014d0330d18555695df7ba8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1722813957,
"narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa",
"type": "github"
},
"original": {
@ -96,22 +635,88 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1725534445,
"narHash": "sha256-Yd0FK9SkWy+ZPuNqUgmVPXokxDgMJoGuNpMEtkfcf84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9bb1e7571aadf31ddb4af77fc64b2d59580f9a39",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"cachix",
"devenv",
"cachix",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1692876271,
"narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"rocksdb": {
"flake": false,
"locked": {
"lastModified": 1725811807,
"narHash": "sha256-k6aubvLSJwW7CtIxBRSlM6Z8UiJDCdFUgDWPYLV47Qk=",
"owner": "girlbossceo",
"repo": "rocksdb",
"rev": "347d50e212b24d98b5ad9841404ff80c1bb873f0",
"type": "github"
},
"original": {
"owner": "girlbossceo",
"ref": "v9.6.1",
"repo": "rocksdb",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"attic": "attic",
"cachix": "cachix",
"complement": "complement",
"crane": "crane_2",
"fenix": "fenix",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_3",
"liburing": "liburing",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs_4",
"rocksdb": "rocksdb"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1689441253,
"narHash": "sha256-4MSDZaFI4DOfsLIZYPMBl0snzWhX1/OqR/QHir382CY=",
"lastModified": 1725630423,
"narHash": "sha256-gNCLk3Zg7JlAwmWbVHTH6f3+iqdeQ4fheOotCZy8x5M=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8",
"rev": "08c7bbc2dbe4dcc8968484f1a0e1e6fe7a1d4f6d",
"type": "github"
},
"original": {
@ -121,32 +726,37 @@
"type": "github"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"crane",
"flake-utils"
],
"nixpkgs": [
"crane",
"nixpkgs"
]
},
"systems": {
"locked": {
"lastModified": 1688351637,
"narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "f9b92316727af9e6c7fee4a761242f7f46880329",
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems": {
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",

455
flake.nix
View file

@ -1,93 +1,404 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
attic.url = "github:zhaofengli/attic?ref=main";
cachix.url = "github:cachix/cachix?ref=master";
complement = { url = "github:matrix-org/complement?ref=main"; flake = false; };
crane = { url = "github:ipetkov/crane?ref=master"; };
fenix = { url = "github:nix-community/fenix?ref=main"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-compat = { url = "github:edolstra/flake-compat?ref=master"; flake = false; };
flake-utils.url = "github:numtide/flake-utils?ref=main";
nix-filter.url = "github:numtide/nix-filter?ref=main";
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
rocksdb = { url = "github:girlbossceo/rocksdb?ref=v9.6.1"; flake = false; };
liburing = { url = "github:axboe/liburing?ref=master"; flake = false; };
};
outputs =
{ self
, nixpkgs
, flake-utils
, fenix
, crane
}: flake-utils.lib.eachDefaultSystem (system:
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# Use mold on Linux
stdenv = if pkgs.stdenv.isLinux then
pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv
else
pkgs.stdenv;
# Nix-accessible `Cargo.toml`
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pkgsHost = import inputs.nixpkgs{
inherit system;
config.permittedInsecurePackages = [ "olm-3.2.16" ];
};
pkgsHostStatic = pkgsHost.pkgsStatic;
# The Rust toolchain to use
toolchain = fenix.packages.${system}.toolchainOf {
# Use the Rust version defined in `Cargo.toml`
channel = cargoToml.package.rust-version;
toolchain = inputs.fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
# THE rust-version HASH
sha256 = "sha256-gdYqng0y9iHYzYPAdkC/ka3DRny3La/S5G8ASj0Ayyc=";
# See also `rust-toolchain.toml`
sha256 = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo=";
};
# The system's RocksDB
ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb}/include";
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
mkScope = pkgs: pkgs.lib.makeScope pkgs.newScope (self: {
inherit pkgs;
book = self.callPackage ./nix/pkgs/book {};
complement = self.callPackage ./nix/pkgs/complement {};
craneLib = ((inputs.crane.mkLib pkgs).overrideToolchain (_: toolchain));
inherit inputs;
main = self.callPackage ./nix/pkgs/main {};
oci-image = self.callPackage ./nix/pkgs/oci-image {};
liburing = pkgs.liburing.overrideAttrs {
# Tests weren't building
outputs = [ "out" "dev" "man" ];
buildFlags = [ "library"];
src = inputs.liburing;
};
rocksdb = (pkgs.rocksdb.override {
liburing = self.liburing;
}).overrideAttrs (old: {
src = inputs.rocksdb;
version = pkgs.lib.removePrefix
"v"
(builtins.fromJSON (builtins.readFile ./flake.lock))
.nodes.rocksdb.original.ref;
# we have this already at https://github.com/girlbossceo/rocksdb/commit/a935c0273e1ba44eacf88ce3685a9b9831486155
# unsetting this so i don't have to revert it and make this nix exclusive
patches = [];
cmakeFlags = pkgs.lib.subtractLists
[
# no real reason to have snappy, no one uses this
"-DWITH_SNAPPY=1"
# we dont need to use ldb or sst_dump (core_tools)
"-DWITH_CORE_TOOLS=1"
# we dont need to build rocksdb tests
"-DWITH_TESTS=1"
# we use rust-rocksdb via C interface and dont need C++ RTTI
"-DUSE_RTTI=1"
]
old.cmakeFlags
++ [
# we dont need to use ldb or sst_dump (core_tools)
"-DWITH_CORE_TOOLS=0"
# we dont need trace tools
"-DWITH_TRACE_TOOLS=0"
# we dont need to build rocksdb tests
"-DWITH_TESTS=0"
# we use rust-rocksdb via C interface and dont need C++ RTTI
"-DUSE_RTTI=0"
];
# Shared between the package and the devShell
nativeBuildInputs = (with pkgs.rustPlatform; [
bindgenHook
]);
# outputs has "tools" which we dont need or use
outputs = [ "out" ];
builder =
((crane.mkLib pkgs).overrideToolchain toolchain.toolchain).buildPackage;
in
{
packages.default = builder {
src = ./.;
# preInstall hooks has stuff for messing with ldb/sst_dump which we dont need or use
preInstall = "";
});
});
inherit
stdenv
nativeBuildInputs
ROCKSDB_INCLUDE_DIR
ROCKSDB_LIB_DIR;
};
scopeHost = mkScope pkgsHost;
scopeHostStatic = mkScope pkgsHostStatic;
devShells.default = (pkgs.mkShell.override { inherit stdenv; }) {
# Rust Analyzer needs to be able to find the path to default crate
# sources, and it can read this environment variable to do so
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
mkDevShell = scope: scope.pkgs.mkShell {
env = scope.main.env // {
# Rust Analyzer needs to be able to find the path to default crate
# sources, and it can read this environment variable to do so. The
# `rust-src` component is required in order for this to work.
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
inherit
ROCKSDB_INCLUDE_DIR
ROCKSDB_LIB_DIR;
# Convenient way to access a pinned version of Complement's source
# code.
COMPLEMENT_SRC = inputs.complement.outPath;
# Needed for Complement
CGO_CFLAGS = "-I${scope.pkgs.olm}/include";
CGO_LDFLAGS = "-L${scope.pkgs.olm}/lib";
};
# Development tools
nativeBuildInputs = nativeBuildInputs ++ (with toolchain; [
cargo
clippy
rust-src
rustc
rustfmt
]);
};
packages = [
# Always use nightly rustfmt because most of its options are unstable
#
# This needs to come before `toolchain` in this list, otherwise
# `$PATH` will have stable rustfmt instead.
inputs.fenix.packages.${system}.latest.rustfmt
checks = {
packagesDefault = self.packages.${system}.default;
devShellsDefault = self.devShells.${system}.default;
toolchain
]
++ (with pkgsHost.pkgs; [
engage
cargo-audit
liburing
# Required by hardened-malloc.rs dep
binutils
# Needed for producing Debian packages
cargo-deb
# Needed for CI to check validity of produced Debian packages (dpkg-deb)
dpkg
# Needed for Complement
go
# Needed for our script for Complement
jq
# Needed for finding broken markdown links
lychee
# Needed for linting markdown files
markdownlint-cli
# Useful for editing the book locally
mdbook
# used for rust caching in CI to speed it up
sccache
# needed so we can get rid of gcc and other unused deps that bloat OCI images
removeReferencesTo
])
++ scope.main.buildInputs
++ scope.main.propagatedBuildInputs
++ scope.main.nativeBuildInputs;
meta.broken = scope.main.meta.broken;
};
in
{
packages = {
default = scopeHost.main;
default-debug = scopeHost.main.override {
profile = "dev";
# debug build users expect full logs
disable_release_max_log_level = true;
};
default-test = scopeHost.main.override {
profile = "test";
disable_release_max_log_level = true;
};
all-features = scopeHost.main.override {
all_features = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
all-features-debug = scopeHost.main.override {
profile = "dev";
all_features = true;
# debug build users expect full logs
disable_release_max_log_level = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
hmalloc = scopeHost.main.override { features = ["hardened_malloc"]; };
oci-image = scopeHost.oci-image;
oci-image-all-features = scopeHost.oci-image.override {
main = scopeHost.main.override {
all_features = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
};
oci-image-all-features-debug = scopeHost.oci-image.override {
main = scopeHost.main.override {
profile = "dev";
all_features = true;
# debug build users expect full logs
disable_release_max_log_level = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
};
oci-image-hmalloc = scopeHost.oci-image.override {
main = scopeHost.main.override {
features = ["hardened_malloc"];
};
};
book = scopeHost.book;
complement = scopeHost.complement;
static-complement = scopeHostStatic.complement;
}
//
builtins.listToAttrs
(builtins.concatLists
(builtins.map
(crossSystem:
let
binaryName = "static-${crossSystem}";
pkgsCrossStatic =
(import inputs.nixpkgs {
inherit system;
crossSystem = {
config = crossSystem;
};
}).pkgsStatic;
scopeCrossStatic = mkScope pkgsCrossStatic;
in
[
# An output for a statically-linked binary
{
name = binaryName;
value = scopeCrossStatic.main;
}
# An output for a statically-linked unstripped debug ("dev") binary
{
name = "${binaryName}-debug";
value = scopeCrossStatic.main.override {
profile = "dev";
# debug build users expect full logs
disable_release_max_log_level = true;
};
}
# An output for a statically-linked unstripped debug binary with the
# "test" profile (for CI usage only)
{
name = "${binaryName}-test";
value = scopeCrossStatic.main.override {
profile = "test";
disable_release_max_log_level = true;
};
}
# An output for a statically-linked binary with `--all-features`
{
name = "${binaryName}-all-features";
value = scopeCrossStatic.main.override {
all_features = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
}
# An output for a statically-linked unstripped debug ("dev") binary with `--all-features`
{
name = "${binaryName}-all-features-debug";
value = scopeCrossStatic.main.override {
profile = "dev";
all_features = true;
# debug build users expect full logs
disable_release_max_log_level = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
}
# An output for a statically-linked binary with hardened_malloc
{
name = "${binaryName}-hmalloc";
value = scopeCrossStatic.main.override {
features = ["hardened_malloc"];
};
}
# An output for an OCI image based on that binary
{
name = "oci-image-${crossSystem}";
value = scopeCrossStatic.oci-image;
}
# An output for an OCI image based on that unstripped debug ("dev") binary
{
name = "oci-image-${crossSystem}-debug";
value = scopeCrossStatic.oci-image.override {
main = scopeCrossStatic.main.override {
profile = "dev";
# debug build users expect full logs
disable_release_max_log_level = true;
};
};
}
# An output for an OCI image based on that binary with `--all-features`
{
name = "oci-image-${crossSystem}-all-features";
value = scopeCrossStatic.oci-image.override {
main = scopeCrossStatic.main.override {
all_features = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
};
}
# An output for an OCI image based on that unstripped debug ("dev") binary with `--all-features`
{
name = "oci-image-${crossSystem}-all-features-debug";
value = scopeCrossStatic.oci-image.override {
main = scopeCrossStatic.main.override {
profile = "dev";
all_features = true;
# debug build users expect full logs
disable_release_max_log_level = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
};
}
# An output for an OCI image based on that binary with hardened_malloc
{
name = "oci-image-${crossSystem}-hmalloc";
value = scopeCrossStatic.oci-image.override {
main = scopeCrossStatic.main.override {
features = ["hardened_malloc"];
};
};
}
]
)
[
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-musl"
]
)
);
devShells.default = mkDevShell scopeHostStatic;
devShells.all-features = mkDevShell
(scopeHostStatic.overrideScope (final: prev: {
main = prev.main.override {
all_features = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
}));
devShells.no-features = mkDevShell
(scopeHostStatic.overrideScope (final: prev: {
main = prev.main.override { default_features = false; };
}));
devShells.dynamic = mkDevShell scopeHost;
});
}

View file

@ -1,198 +0,0 @@
# Conduit for Nix/NixOS
This guide assumes you have a recent version of Nix (^2.4) installed.
Since Conduit ships as a Nix flake, you'll first need to [enable
flakes][enable_flakes].
You can now use the usual Nix commands to interact with Conduit's flake. For
example, `nix run gitlab:famedly/conduit` will run Conduit (though you'll need
to provide configuration and such manually as usual).
If your NixOS configuration is defined as a flake, you can depend on this flake
to provide a more up-to-date version than provided by `nixpkgs`. In your flake,
add the following to your `inputs`:
```nix
conduit = {
url = "gitlab:famedly/conduit";
# Assuming you have an input for nixpkgs called `nixpkgs`. If you experience
# build failures while using this, try commenting/deleting this line. This
# will probably also require you to always build from source.
inputs.nixpkgs.follows = "nixpkgs";
};
```
Next, make sure you're passing your flake inputs to the `specialArgs` argument
of `nixpkgs.lib.nixosSystem` [as explained here][specialargs]. This guide will
assume you've named the group `flake-inputs`.
Now you can configure Conduit and a reverse proxy for it. Add the following to
a new Nix file and include it in your configuration:
```nix
{ config
, pkgs
, flake-inputs
, ...
}:
let
# You'll need to edit these values
# The hostname that will appear in your user and room IDs
server_name = "example.com";
# The hostname that Conduit actually runs on
#
# This can be the same as `server_name` if you want. This is only necessary
# when Conduit is running on a different machine than the one hosting your
# root domain. This configuration also assumes this is all running on a single
# machine, some tweaks will need to be made if this is not the case.
matrix_hostname = "matrix.${server_name}";
# An admin email for TLS certificate notifications
admin_email = "admin@${server_name}";
# These ones you can leave alone
# Build a dervation that stores the content of `${server_name}/.well-known/matrix/server`
well_known_server = pkgs.writeText "well-known-matrix-server" ''
{
"m.server": "${matrix_hostname}"
}
'';
# Build a dervation that stores the content of `${server_name}/.well-known/matrix/client`
well_known_client = pkgs.writeText "well-known-matrix-client" ''
{
"m.homeserver": {
"base_url": "https://${matrix_hostname}"
}
}
'';
in
{
# Configure Conduit itself
services.matrix-conduit = {
enable = true;
# This causes NixOS to use the flake defined in this repository instead of
# the build of Conduit built into nixpkgs.
package = flake-inputs.conduit.packages.${pkgs.system}.default;
settings.global = {
inherit server_name;
};
};
# Configure automated TLS acquisition/renewal
security.acme = {
acceptTerms = true;
defaults = {
email = admin_email;
};
};
# ACME data must be readable by the NGINX user
users.users.nginx.extraGroups = [
"acme"
];
# Configure NGINX as a reverse proxy
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"${matrix_hostname}" = {
forceSSL = true;
enableACME = true;
listen = [
{
addr = "0.0.0.0";
port = 443;
ssl = true;
}
{
addr = "[::]";
port = 443;
ssl = true;
} {
addr = "0.0.0.0";
port = 8448;
ssl = true;
}
{
addr = "[::]";
port = 8448;
ssl = true;
}
];
locations."/_matrix/" = {
proxyPass = "http://backend_conduit$request_uri";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header Host $host;
proxy_buffering off;
'';
};
extraConfig = ''
merge_slashes off;
'';
};
"${server_name}" = {
forceSSL = true;
enableACME = true;
locations."=/.well-known/matrix/server" = {
# Use the contents of the derivation built previously
alias = "${well_known_server}";
extraConfig = ''
# Set the header since by default NGINX thinks it's just bytes
default_type application/json;
'';
};
locations."=/.well-known/matrix/client" = {
# Use the contents of the derivation built previously
alias = "${well_known_client}";
extraConfig = ''
# Set the header since by default NGINX thinks it's just bytes
default_type application/json;
# https://matrix.org/docs/spec/client_server/r0.4.0#web-browser-clients
add_header Access-Control-Allow-Origin "*";
'';
};
};
};
upstreams = {
"backend_conduit" = {
servers = {
"[::1]:${toString config.services.matrix-conduit.settings.global.port}" = { };
};
};
};
};
# Open firewall ports for HTTP, HTTPS, and Matrix federation
networking.firewall.allowedTCPPorts = [ 80 443 8448 ];
networking.firewall.allowedUDPPorts = [ 80 443 8448 ];
}
```
Now you can rebuild your system configuration and you should be good to go!
[enable_flakes]: https://nixos.wiki/wiki/Flakes#Enable_flakes
[specialargs]: https://nixos.wiki/wiki/Flakes#Using_nix_flakes_with_NixOS

36
nix/pkgs/book/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ inputs
# Dependencies
, main
, mdbook
, stdenv
}:
stdenv.mkDerivation {
inherit (main) pname version;
src = inputs.nix-filter {
root = inputs.self;
include = [
"book.toml"
"conduwuit-example.toml"
"CODE_OF_CONDUCT.md"
"CONTRIBUTING.md"
"README.md"
"development.md"
"debian/conduwuit.service"
"debian/README.md"
"arch/conduwuit.service"
"docs"
"theme"
];
};
nativeBuildInputs = [
mdbook
];
buildPhase = ''
mdbook build -d $out
'';
}

View file

@ -0,0 +1,23 @@
[global]
address = "0.0.0.0"
allow_device_name_federation = true
allow_guest_registration = true
allow_public_room_directory_over_federation = true
allow_public_room_directory_without_auth = true
allow_registration = true
database_path = "/database"
log = "trace,h2=warn,hyper=warn"
port = [8008, 8448]
trusted_servers = []
query_trusted_key_servers_first = false
yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse = true
ip_range_denylist = []
url_preview_domain_contains_allowlist = ["*"]
media_compat_file_link = false
media_startup_check = false
rocksdb_direct_io = false
[global.tls]
certs = "/certificate.crt"
dual_protocol = true
key = "/private_key.key"

View file

@ -0,0 +1,97 @@
# Dependencies
{ bashInteractive
, buildEnv
, coreutils
, dockerTools
, gawk
, lib
, main
, openssl
, stdenv
, tini
, writeShellScriptBin
}:
let
main' = main.override {
profile = "test";
all_features = true;
disable_release_max_log_level = true;
disable_features = [
# this is non-functional on nix for some reason
"hardened_malloc"
# dont include experimental features
"experimental"
];
};
start = writeShellScriptBin "start" ''
set -euxo pipefail
${lib.getExe openssl} genrsa -out private_key.key 2048
${lib.getExe openssl} req \
-new \
-sha256 \
-key private_key.key \
-subj "/C=US/ST=CA/O=MyOrg, Inc./CN=$SERVER_NAME" \
-out signing_request.csr
cp ${./v3.ext} v3.ext
echo "DNS.1 = $SERVER_NAME" >> v3.ext
echo "IP.1 = $(${lib.getExe gawk} 'END{print $1}' /etc/hosts)" \
>> v3.ext
${lib.getExe openssl} x509 \
-req \
-extfile v3.ext \
-in signing_request.csr \
-CA /complement/ca/ca.crt \
-CAkey /complement/ca/ca.key \
-CAcreateserial \
-out certificate.crt \
-days 1 \
-sha256
${lib.getExe' coreutils "env"} \
CONDUWUIT_SERVER_NAME="$SERVER_NAME" \
${lib.getExe main'}
'';
in
dockerTools.buildImage {
name = "complement-${main.pname}";
tag = "main";
copyToRoot = buildEnv {
name = "root";
pathsToLink = [
"/bin"
];
paths = [
bashInteractive
coreutils
main'
start
];
};
config = {
Cmd = [
"${lib.getExe start}"
];
Entrypoint = if !stdenv.isDarwin
# Use the `tini` init system so that signals (e.g. ctrl+c/SIGINT)
# are handled as expected
then [ "${lib.getExe' tini "tini"}" "--" ]
else [];
Env = [
"SSL_CERT_FILE=/complement/ca/ca.crt"
"CONDUWUIT_CONFIG=${./config.toml}"
];
ExposedPorts = {
"8008/tcp" = {};
"8448/tcp" = {};
};
};
}

View file

@ -0,0 +1,6 @@
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]

View file

@ -0,0 +1,106 @@
{ lib
, pkgsBuildHost
, rust
, stdenv
}:
lib.optionalAttrs stdenv.hostPlatform.isStatic {
ROCKSDB_STATIC = "";
}
//
{
CARGO_BUILD_RUSTFLAGS =
lib.concatStringsSep
" "
([]
++ lib.optionals
stdenv.targetPlatform.isx86_64
[ "-C" "target-cpu=x86-64-v2" ]
++ lib.optionals
stdenv.targetPlatform.isAarch64
[ "-C" "target-cpu=cortex-a53" ] # cortex-a53 == ARMv8-A
# This disables PIE for static builds, which isn't great in terms
# of security. Unfortunately, my hand is forced because nixpkgs'
# `libstdc++.a` is built without `-fPIE`, which precludes us from
# leaving PIE enabled.
++ lib.optionals
stdenv.hostPlatform.isStatic
[ "-C" "relocation-model=static" ]
++ lib.optionals
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
[ "-l" "c" ]
++ lib.optionals
# This check has to match the one [here][0]. We only need to set
# these flags when using a different linker. Don't ask me why,
# though, because I don't know. All I know is it breaks otherwise.
#
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L37-L40
(
# Nixpkgs doesn't check for x86_64 here but we do, because I
# observed a failure building statically for x86_64 without
# including it here. Linkers are weird.
(stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64)
&& stdenv.hostPlatform.isStatic
&& !stdenv.isDarwin
&& !stdenv.cc.bintools.isLLVM
)
[
"-l"
"stdc++"
"-L"
"${stdenv.cc.cc.lib}/${stdenv.hostPlatform.config}/lib"
]
);
}
# What follows is stolen from [here][0]. Its purpose is to properly
# configure compilers and linkers for various stages of the build, and
# even covers the case of build scripts that need native code compiled and
# run on the build platform (I think).
#
# [0]: https://github.com/NixOS/nixpkgs/blob/5cdb38bb16c6d0a38779db14fcc766bc1b2394d6/pkgs/build-support/rust/lib/default.nix#L57-L80
//
(
let
inherit (rust.lib) envVars;
in
lib.optionalAttrs
(stdenv.targetPlatform.rust.rustcTarget
!= stdenv.hostPlatform.rust.rustcTarget)
(
let
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
in
{
"CC_${cargoEnvVarTarget}" = envVars.ccForTarget;
"CXX_${cargoEnvVarTarget}" = envVars.cxxForTarget;
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" =
envVars.linkerForTarget;
}
)
//
(
let
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
in
{
"CC_${cargoEnvVarTarget}" = envVars.ccForHost;
"CXX_${cargoEnvVarTarget}" = envVars.cxxForHost;
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForHost;
CARGO_BUILD_TARGET = rustcTarget;
}
)
//
(
let
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
in
{
"CC_${cargoEnvVarTarget}" = envVars.ccForBuild;
"CXX_${cargoEnvVarTarget}" = envVars.cxxForBuild;
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.linkerForBuild;
HOST_CC = "${pkgsBuildHost.stdenv.cc}/bin/cc";
HOST_CXX = "${pkgsBuildHost.stdenv.cc}/bin/c++";
}
)
)

219
nix/pkgs/main/default.nix Normal file
View file

@ -0,0 +1,219 @@
# Dependencies (keep sorted)
{ craneLib
, inputs
, jq
, lib
, libiconv
, liburing
, pkgsBuildHost
, rocksdb
, removeReferencesTo
, rust
, rust-jemalloc-sys
, stdenv
# Options (keep sorted)
, default_features ? true
, disable_release_max_log_level ? false
, all_features ? false
, disable_features ? []
, features ? []
, profile ? "release"
}:
let
# We perform default-feature unification in nix, because some of the dependencies
# on the nix side depend on feature values.
crateFeatures = path:
let manifest = lib.importTOML "${path}/Cargo.toml"; in
lib.remove "default" (lib.attrNames manifest.features);
crateDefaultFeatures = path:
(lib.importTOML "${path}/Cargo.toml").features.default;
allDefaultFeatures = crateDefaultFeatures "${inputs.self}/src/main";
allFeatures = crateFeatures "${inputs.self}/src/main";
features' = lib.unique
(features ++
lib.optionals default_features allDefaultFeatures ++
lib.optionals all_features allFeatures);
disable_features' = disable_features ++ lib.optionals disable_release_max_log_level ["release_max_log_level"];
features'' = lib.subtractLists disable_features' features';
featureEnabled = feature : builtins.elem feature features'';
enableLiburing = featureEnabled "io_uring" && !stdenv.isDarwin;
# This derivation will set the JEMALLOC_OVERRIDE variable, causing the
# tikv-jemalloc-sys crate to use the nixpkgs jemalloc instead of building it's
# own. In order for this to work, we need to set flags on the build that match
# whatever flags tikv-jemalloc-sys was going to use. These are dependent on
# which features we enable in tikv-jemalloc-sys.
rust-jemalloc-sys' = (rust-jemalloc-sys.override {
# tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
unprefixed = true;
}).overrideAttrs (old: {
configureFlags = old.configureFlags ++
# we dont need docs
[ "--disable-doc" ] ++
# we dont need cxx/C++ integration
[ "--disable-cxx" ] ++
# tikv-jemalloc-sys/profiling feature
lib.optional (featureEnabled "jemalloc_prof") "--enable-prof" ++
# tikv-jemalloc-sys/stats feature
(if (featureEnabled "jemalloc_stats") then [ "--enable-stats" ] else [ "--disable-stats" ]);
});
buildDepsOnlyEnv =
let
rocksdb' = (rocksdb.override {
jemalloc = rust-jemalloc-sys';
# rocksdb fails to build with prefixed jemalloc, which is required on
# darwin due to [1]. In this case, fall back to building rocksdb with
# libc malloc. This should not cause conflicts, because all of the
# jemalloc symbols are prefixed.
#
# [1]: https://github.com/tikv/jemallocator/blob/ab0676d77e81268cd09b059260c75b38dbef2d51/jemalloc-sys/src/env.rs#L17
enableJemalloc = featureEnabled "jemalloc" && !stdenv.isDarwin;
# for some reason enableLiburing in nixpkgs rocksdb is default true
# which breaks Darwin entirely
enableLiburing = enableLiburing;
}).overrideAttrs (old: {
# TODO: static rocksdb fails to build on darwin, also see <https://github.com/NixOS/nixpkgs/issues/320448>
# build log at <https://girlboss.ceo/~strawberry/pb/JjGH>
meta.broken = stdenv.hostPlatform.isStatic && stdenv.isDarwin;
enableLiburing = enableLiburing;
sse42Support = stdenv.targetPlatform.isx86_64;
cmakeFlags = if stdenv.targetPlatform.isx86_64
then lib.subtractLists [ "-DPORTABLE=1" ] old.cmakeFlags
++ lib.optionals stdenv.targetPlatform.isx86_64 [
"-DPORTABLE=x86-64-v2"
"-DUSE_SSE=1"
"-DHAVE_SSE=1"
"-DHAVE_SSE42=1"
]
else if stdenv.targetPlatform.isAarch64
then lib.subtractLists [ "-DPORTABLE=1" ] old.cmakeFlags
++ lib.optionals stdenv.targetPlatform.isAarch64 [
# cortex-a53 == ARMv8-A
"-DPORTABLE=armv8-a"
]
else old.cmakeFlags;
});
in
{
# https://crane.dev/faq/rebuilds-bindgen.html
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
CARGO_PROFILE = profile;
ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include";
ROCKSDB_LIB_DIR = "${rocksdb'}/lib";
}
//
(import ./cross-compilation-env.nix {
# Keep sorted
inherit
lib
pkgsBuildHost
rust
stdenv;
});
buildPackageEnv = {
CONDUWUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev or "";
} // buildDepsOnlyEnv // {
# Only needed in static stdenv because these are transitive dependencies of rocksdb
CARGO_BUILD_RUSTFLAGS = buildDepsOnlyEnv.CARGO_BUILD_RUSTFLAGS
+ lib.optionalString (enableLiburing && stdenv.hostPlatform.isStatic)
" -L${lib.getLib liburing}/lib -luring"
+ lib.optionalString stdenv.targetPlatform.isx86_64
" -Ctarget-cpu=x86-64-v2"
+ lib.optionalString stdenv.targetPlatform.isAarch64
" -Ctarget-cpu=cortex-a53"; # cortex-a53 == ARMv8-A
};
commonAttrs = {
inherit
(craneLib.crateNameFromCargoToml {
cargoToml = "${inputs.self}/Cargo.toml";
})
pname
version;
src = let filter = inputs.nix-filter.lib; in filter {
root = inputs.self;
# Keep sorted
include = [
"Cargo.lock"
"Cargo.toml"
"deps"
"src"
];
};
dontStrip = profile == "dev" || profile == "test";
dontPatchELF = profile == "dev" || profile == "test";
buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
nativeBuildInputs = [
# bindgen needs the build platform's libclang. Apparently due to "splicing
# weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the
# right thing here.
pkgsBuildHost.rustPlatform.bindgenHook
# We don't actually depend on `jq`, but crane's `buildPackage` does, but
# its `buildDepsOnly` doesn't. This causes those two derivations to have
# differing values for `NIX_CFLAGS_COMPILE`, which contributes to spurious
# rebuilds of bindgen and its depedents.
jq
# needed so we can get rid of gcc and other unused deps that bloat OCI images
removeReferencesTo
]
++ lib.optionals stdenv.isDarwin [
# https://github.com/NixOS/nixpkgs/issues/206242
libiconv
# https://stackoverflow.com/questions/69869574/properly-adding-darwin-apple-sdk-to-a-nix-shell
# https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
pkgsBuildHost.darwin.apple_sdk.frameworks.Security
];
# for some reason gcc and other weird deps are added to OCI images and bloats it up
#
# <https://github.com/input-output-hk/haskell.nix/issues/829>
postInstall = with pkgsBuildHost; ''
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} -t ${gcc} -t ${libgcc} -t ${linuxHeaders} -t ${libidn2} -t ${libunistring} '{}' +
'';
};
in
craneLib.buildPackage ( commonAttrs // {
cargoArtifacts = craneLib.buildDepsOnly (commonAttrs // {
env = buildDepsOnlyEnv;
});
cargoExtraArgs = "--no-default-features "
+ lib.optionalString
(features'' != [])
"--features " + (builtins.concatStringsSep "," features'');
# This is redundant with CI
cargoTestCommand = "";
cargoCheckCommand = "";
doCheck = false;
env = buildPackageEnv;
passthru = {
env = buildPackageEnv;
};
meta.mainProgram = commonAttrs.pname;
})

View file

@ -0,0 +1,28 @@
{ inputs
# Dependencies
, dockerTools
, lib
, main
, stdenv
, tini
}:
dockerTools.buildLayeredImage {
name = main.pname;
tag = "main";
created = "@${toString inputs.self.lastModified}";
contents = [
dockerTools.caCertificates
];
config = {
Entrypoint = if !stdenv.isDarwin
# Use the `tini` init system so that signals (e.g. ctrl+c/SIGINT)
# are handled as expected
then [ "${lib.getExe' tini "tini"}" "--" ]
else [];
Cmd = [
"${lib.getExe main}"
];
};
}

26
renovate.json Normal file
View file

@ -0,0 +1,26 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"lockFileMaintenance": {
"enabled": true,
"schedule": [
"at any time"
]
},
"nix": {
"enabled": true
},
"labels": [
"dependencies",
"github_actions"
],
"ignoreDeps": [
"tikv-jemllocator",
"tikv-jemalloc-sys",
"tikv-jemalloc-ctl",
"opentelemetry-rust",
"tracing-opentelemetry"
]
}

23
rust-toolchain.toml Normal file
View file

@ -0,0 +1,23 @@
# This is the authoritiative configuration of this project's Rust toolchain.
#
# Other files that need upkeep when this changes:
#
# * `.gitlab-ci.yml`
# * `.github/workflows/ci.yml`
# * `Cargo.toml`
# * `flake.nix`
#
# Search in those files for `rust-toolchain.toml` to find the relevant places.
# If you're having trouble making the relevant changes, bug a maintainer.
[toolchain]
channel = "1.81.0"
components = [
# For rust-analyzer
"rust-src",
]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-musl",
]

Some files were not shown because too many files have changed in this diff Show more