Compare commits

...
175 Commits
Author SHA1 Message Date
Jade Ellis ab3c05dac6 chore: Release 2026-08-22 22:44:28 +01:00
Jade Ellis 403a90c64f fix: Correct relative script location 2026-08-22 22:43:41 +01:00
timedout 8a7324216e fix: Invert inverted power level comparisons 2026-08-22 22:08:10 +01:00
Jade Ellis fa0a11ba4f chore: Update release process 2026-08-22 22:06:32 +01:00
timedout 6bc41ca627 chore: Drop 26.8.0-alpha.1 changelog 2026-08-22 21:10:02 +01:00
timedout 7ebe89402e chore: Release v26.8.0 2026-08-22 21:08:29 +01:00
timedout 4d487afe26 fix: SEC30
Reviewed-By: Ginger <ginger@gingershaped.computer>
Reviewed-By: Jade <jade@ellis.link>
Reviewed-By: Jacob Taylor <jacob@explodie.org>
2026-08-22 20:48:37 +01:00
timedout 103dafd529 fix: Address review comments 2026-08-22 20:14:43 +01:00
timedout a61cc2ac50 fix: Return correct new extremities set 2026-08-22 20:14:43 +01:00
timedout 2ee33f091f fix: Don't only include referenced extremities 2026-08-22 20:14:43 +01:00
timedout 1cc6fb1130 chore: Add newsfrag and re-run cargo fmt 2026-08-22 20:14:43 +01:00
timedout 681daed5e8 fix: Mark prev events as referenced as we come across them 2026-08-22 20:14:43 +01:00
timedout 8d95163da4 perf: Remove unnecessary retain
The remove() at the start of the function already does this
2026-08-22 20:14:42 +01:00
timedout 0608f674a3 fix: Properly track orphaned extremities 2026-08-22 20:14:42 +01:00
Erwan Leboucher df95abf5ab fix(federation): Queue PDUs during remote joins 2026-08-22 18:29:54 +00:00
Renovate Bot 0907323588 chore(deps): update rust-zerover-patch-updates 2026-08-22 09:56:05 +00:00
Erwan Leboucher 5ceed2c2bb chore(deps): Remove unstable msc3061 feature 2026-08-20 15:30:01 +00:00
Jacob Taylor 43f117de46 fix: Update sender_retry_backoff_limit to match docs and actually be 1 week 2026-08-20 07:41:06 -07:00
Renovate Bot e60ce99e46 chore(deps): update rust-non-major 2026-08-20 14:30:57 +00:00
Renovate Bot 8265b6fecf chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44 2026-08-20 05:03:11 +00:00
Erwan Leboucher 82149397b0 fix(admin): Complete MSC4323 suspend and lock endpoints 2026-08-20 00:58:30 +00:00
timedout 6b55972cfa chore: Re-generate example config 2026-08-20 00:57:11 +00:00
timedout 862fded4e4 chore: Add newsfrag 2026-08-20 00:57:11 +00:00
timedout f1a77e0404 fix: Address review comments 2026-08-20 00:57:11 +00:00
timedout 9af60bcf62 feat: Lower default backoff base for a gentler backoff curve 2026-08-20 00:57:11 +00:00
timedout b73b3532f2 fix: Don't set retrying status when retrying is illegal 2026-08-20 00:57:11 +00:00
timedout 7352edc6e4 fix: Treat any non-ok response as a server error in sender
Otherwise we never back off sending failed requests
2026-08-20 00:57:11 +00:00
timedout a916fdf09a fix: Mark even more error codes as stale based on observed data 2026-08-20 00:57:11 +00:00
timedout 768933b025 fix: Don't stop tracking servers when there's nothing more to send despite being inflight 2026-08-20 00:57:11 +00:00
timedout 46f0483395 fix: Correctly insert running status only if the sender should attempt to send 2026-08-20 00:57:11 +00:00
timedout dde1f12814 style: Reformat 2026-08-20 00:57:11 +00:00
timedout 22f9b9b91d fix(sender): retry_after duration can be negative 2026-08-20 00:57:11 +00:00
timedout f7773760a6 fix(sender): Don't attempt to send concurrent transactions to a remote 2026-08-20 00:57:11 +00:00
timedout 6104c68768 style: Centralise decision for stale marker 2026-08-20 00:57:11 +00:00
timedout 9ed8c230fa feat: Update servers-in-backoff command to annotate stale info 2026-08-20 00:57:11 +00:00
timedout ef5bf7c977 feat: Clear destinations cache when a remote is potentially stale 2026-08-20 00:57:11 +00:00
timedout 53db584741 feat: Add debug command to extract backoff info 2026-08-20 00:57:11 +00:00
timedout 2d713c1631 feat: Use an explicit backoff base value 2026-08-20 00:57:11 +00:00
timedout 79c9f7da30 chore: Tidy up backoff helper code 2026-08-20 00:57:11 +00:00
timedout bc1826de66 feat: Hook transaction senders into health tracking 2026-08-20 00:57:11 +00:00
timedout 98466e5243 style: Remove unsafe arithmetic 2026-08-20 00:57:11 +00:00
timedout 8c1a84e907 fix: Don't honour unhealthy hits unless the block period has already expired 2026-08-20 00:57:11 +00:00
timedout 8f66cbb6b9 feat: Clear remote health tracking map when cache is cleared 2026-08-20 00:57:11 +00:00
timedout e1866df682 feat: Trace why remotes get health marked 2026-08-20 00:57:11 +00:00
timedout 213bf6fb70 feat: Refuse to send requests to unhealthy servers
Also marks them as online if a request succeeds
2026-08-20 00:57:11 +00:00
timedout 785db0bdba chore: Move health tracking to federation service
Otherwise federation would have to depend on sender
2026-08-20 00:57:11 +00:00
timedout 6ae66eed1b feat: Mark servers as online/offline based on transaction responses 2026-08-20 00:57:11 +00:00
timedout 077338792f feat: Mark servers as healthy when they successfully make an inbound request 2026-08-20 00:57:11 +00:00
timedout 0c8b51c0f4 feat: Add server health tracking 2026-08-20 00:57:11 +00:00
timedout 67c9f76840 style: Fix EOF and whitespace 2026-08-19 19:41:03 +01:00
timedout bcdd7ca82a feat(meta): Discourage drive-by PRs 2026-08-19 19:35:22 +01:00
timedout 5d0ac05e95 feat(meta): Add feature request template, disable blank issues 2026-08-19 19:29:40 +01:00
timedout 0f606b224f fix(meta): The ref does not need to be main 2026-08-19 19:12:45 +01:00
timedout cdb460dcc6 fix(meta): Apply validations 2026-08-19 19:12:22 +01:00
timedout 88d5446987 feat(meta): Add issue template 2026-08-19 19:07:11 +01:00
Erwan Leboucher 1ecfb21aea fix(spaces): Correct hierarchy traversal 2026-08-19 03:33:41 +00:00
Erwan Leboucher 39b08f73f7 fix(state-res): Derive sender power from the create event when sorting 2026-08-18 20:22:38 +00:00
Erwan Leboucher 3efb66c76c fix: Do not make late-arriving events forward extremities 2026-08-18 16:55:47 +00:00
timedout 7b3e3a26bb fix: Don't panic when receiving PDUs with illegal auth events
Apparently some servers do this??
2026-08-18 17:50:18 +01:00
Erwan Leboucher 1cdf369a80 fix(sync): Populate sliding sync num_live 2026-08-18 15:44:52 +00:00
Erwan Leboucher 1d655fda53 fix(timeline): Keep extremities a local event did not reference 2026-08-18 15:38:43 +00:00
stratself a1c51adb04 fix(docs): Correct docker network name in caddy labels compose 2026-08-18 09:06:28 +00:00
Renovate Bot 3f250032f0 chore(deps): update https://github.com/taiki-e/install-action digest to b6b84cf 2026-08-18 05:02:53 +00:00
ginger b502f74c34 fix: Remove mystery additional admin room notice 2026-08-17 17:55:59 +00:00
Jade Ellis e1d7974dbb chore: Delete archived element web deployment 2026-08-16 19:11:51 +00:00
stratself 2a714d3e37 docs: Add quick redirs to /dns, /livekit and /source(_code) 2026-08-16 12:45:02 +00:00
timedout a148174c59 style: Rephrase error message 2026-08-15 16:10:39 +00:00
timedout 75e857dffe chore: Add newsfrag 2026-08-15 16:10:39 +00:00
timedout 2dc6051d67 fix(federation): Make transactions infallible
Previously, a transaction panicking in the handle() call would cause the
transaction to be indefinitely logged as "running" in the transaction
handler. This means subsequent transactions from the sending server
would be met with the "You're still sending me a txn!" 429 response,
forever, effectively causing defederation between the two servers, until
continuwuity is fully restarted.

I could just fix the known panics in the handle function and internal
calls, however there's so many subsystems that could reasonably panic
that it is just better to have a safer approach and ensure that the
handle call is infallible.
2026-08-15 16:10:39 +00:00
stratself 3c07f46451 docs(livekit): Link file for nginx conf and do UI codeblock folding 2026-08-15 15:08:18 +00:00
stratself 65b32b8610 docs(turn): Coturn --> coturn 2026-08-15 15:08:18 +00:00
stratself 200a75dfb0 docs(livekit): Fix wordings according to PR comments
- Use proper capitalization to match software brandings
- websocket -> WebSocket
- resolve other wording issues
2026-08-15 15:08:18 +00:00
stratself aa417aa0f8 chore: Add changelog for Livekit Docker loopback changes 2026-08-15 15:08:18 +00:00
stratself 68f4b71cb2 docs(livekit): Use "official" Docker method of host loopbacking
As lk-jwt-service is hosted in a bridge network, the previous
`extra_hosts` using 127.0.0.1 would just loop back to the container
itself. Using `network_mode: host` is unnecessary, and the
`host-gateway` approach works well for both Podman and Docker

Host loopback issues are prevalent in non-Livekit scenarios too: push
gateways is another example. Considering moving these to a dedicated
Docker section of the troubleshooting page.
2026-08-15 15:08:18 +00:00
stratself 0471f8c24c docs(livekit): Use tabs and move caddy label compose to own file 2026-08-15 15:08:18 +00:00
stratself 19662f389b docs(livekit,turn): Standardize wording of TURN-over-TLS (on 443) 2026-08-15 15:08:18 +00:00
stratself 4d44f74235 fix: Trailing whitespaces 2026-08-15 15:08:18 +00:00
stratself 7a4b1bf407 fix(docs): Use official "Caddy-L4" name 2026-08-15 15:08:18 +00:00
stratself 7494d32f35 fix(docs): Address wording suggestions on PR comments 2026-08-15 15:08:18 +00:00
stratself 48d2c373e7 docs(livekit,turn): Various sweepfixes from #1740 comments 2026-08-15 15:08:18 +00:00
Erwan Leboucher 918070c512 fix(spaces): Expose restricted children over federation 2026-08-14 12:51:09 +02:00
timedout 5c59acc380 feat(meta): Publish linkification script 2026-08-14 00:38:44 +01:00
timedout df26ab4cda style: Re-run linkifier on changelog 2026-08-14 00:22:27 +01:00
timedout cefb2edb55 chore: Release v26.8.0-alpha.1 2026-08-14 00:12:40 +01:00
timedout 08d3d8445f chore: Merge branch 'nex/feat/registration-messages' 2026-08-12 14:25:15 +01:00
nex b4a8d2095e chore: Update admin announcement 2026-08-12 00:24:39 +00:00
Ginger ad182417da fix: SEC26
Reviewed-By: timedout <git@nexy7574.co.uk>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-08-11 17:56:29 -04:00
Ginger 7377074f6d fix: SEC28 2026-08-11 17:56:29 -04:00
Ginger 973aeed0a2 chore: Release 2026-08-11 17:56:29 -04:00
Ginger e4d35e7121 chore: Update changelog 2026-08-11 17:56:29 -04:00
Erwan Leboucher 7472faa096 fix(sync): Remove sync wake before membership commit point 2026-08-11 14:10:23 +00:00
Erwan Leboucher 2998dc9b40 fix(sync): Deliver left rooms missing from timeline index 2026-08-11 14:10:23 +00:00
Renovate Bot e335cde0dd chore(deps): update github-actions-digest 2026-08-11 05:01:27 +00:00
Erwan Leboucher 18139ea891 feat(sync): Add MSC4508 typing extension 2026-08-08 14:07:08 +00:00
Renovate Bot 9080494464 chore(deps): update rust crate validator to 0.21.0 2026-08-08 12:25:34 +00:00
Renovate Bot e13c6990d2 chore(deps): update node-patch-updates to v2.0.19 2026-08-08 12:24:11 +00:00
Renovate Bot 26d5c03a0d chore(deps): update rust-non-major 2026-08-08 12:23:54 +00:00
stratself 9c8c38496d chore: Add changelog because it seems important 2026-08-08 05:44:06 +00:00
stratself 534ff1fe07 fix(docs): Use canonical Caddyfile location 2026-08-08 05:35:35 +00:00
Michel-Marie MAUDET f0493a7ba8 fix(oauth): Use unauthorized_client for unregistered grant types
The token endpoint already refused grant types the client had not
registered, but reported it as `invalid_grant`. RFC 6749 section 5.2
reserves `invalid_grant` for an authorization grant which is "invalid,
expired, revoked, does not match the redirection URI used in the
authorization request, or was issued to another client", and defines
`unauthorized_client` for a client which "is not authorized to use this
authorization grant type".

Report the condition with the error code the specification assigns to it,
matching the device authorization endpoint.
2026-08-07 08:52:20 +00:00
Michel-Marie MAUDET 8c1bbf3d1a fix(oauth): Reject device code requests from unauthorised clients
The device authorization endpoint issued a device code to any registered
client, without checking that the client had registered the
`urn:ietf:params:oauth:grant-type:device_code` grant type. Such a client
could therefore start a device authorization flow and have the server
show an approval prompt to a user, even though the subsequent token
request was always going to be refused.

RFC 8628 section 3.2 states that, in the event of an error such as an
invalidly configured client, the device authorization endpoint responds
in the same way as the token endpoint specified in RFC 6749 section 5.2,
which defines `unauthorized_client` as "the authenticated client is not
authorized to use this authorization grant type".

Apply the same grant type check the token endpoint already performs, and
add the `unauthorized_client` error code it requires.
2026-08-07 08:52:20 +00:00
renegadespork 02bee2e898 docs: Reference latest version of matrix spec 2026-08-06 15:34:46 -07:00
renegadespork 1c23cf3a93 docs: Fix servernameevent_data_cache_capacity default description. 2026-08-06 14:18:32 +00:00
renegadespork 30be07fe8f chore: Fix changelog news fragment formatting 2026-08-06 14:18:32 +00:00
renegadespork a530eaa3a8 chore: Add changelog for config documentation. 2026-08-06 14:18:32 +00:00
renegadespork 97d37a9bb3 docs: Corrected description of auth chain logic. 2026-08-06 14:18:32 +00:00
renegadespork 4ff7a88df0 docs: Add missing documentation to config parameters. 2026-08-06 14:18:32 +00:00
Erwan Leboucher 1b6bc83b9f fix(sync): Preserve batched read receipts 2026-08-06 14:01:52 +00:00
PerformativeJade cdf07a8811 chore: Add changelog line 2026-08-06 12:18:26 +00:00
PerformativeJade 69b6431213 refactor: Swapped admin command names and aliases 2026-08-06 12:18:26 +00:00
timedout 21ea9d3ea7 feat: Validate event references in prev and auth events
Also threw in some lovely unit tests, as a treat.
2026-08-05 21:11:05 +00:00
timedout d79ffe6ef0 chore: Throwing newsfrag! 2026-08-05 21:11:05 +00:00
timedout 8f0c7a99d7 fix: Don't accidentally continue with fallback room version
Fixes a potential issue where continuwuity correctly defaults to room v1
when encountering an unknown room version, but then fails to *stop*
processing when it encounters the room version it doesn't actually
understand.
2026-08-05 21:11:05 +00:00
Jacob Taylor f1755dd36f fix: Fix link preview unfurl source 2026-08-05 18:02:14 +00:00
stratself 3b4665a171 fix: Small grammar 2026-08-05 18:00:11 +00:00
stratself 9c9d15d601 fix(docs): Incorporate change requests from PR comments II 2026-08-05 18:00:11 +00:00
stratself 5402c4f208 chore: Add changelog for docker command change 2026-08-05 18:00:11 +00:00
stratself c7160edc13 docs: Replace docker-compose with docker compose 2026-08-05 18:00:11 +00:00
stratself 2144317933 fix(docs): Incorporate change requests from PR comments
These are mostly grammar fixes. Furthermore:

* docs(docker,delegation): Use `important` admonitions in some places
* docs(maintenance): Elaborate on `immutable` directive in media header
2026-08-05 18:00:11 +00:00
stratself e19f634ffa chore: Add changelogs for some important doc things 2026-08-05 18:00:11 +00:00
stratself 7b020e8563 docs(maintenance): Remove S3 and MMR reference
* Also subsectioned btrfs stuff for database
2026-08-05 18:00:11 +00:00
stratself d24245a68e fix: Minor changes from feedback of PR 2026-08-05 18:00:11 +00:00
stratself 3c3e3b5316 fix(docs): Small fixes 2026-08-05 18:00:11 +00:00
stratself d0ca302347 docs(maintenance): Update the database backup section
* Also update some links and media mgmt functionality
2026-08-05 18:00:11 +00:00
stratself 37ddb8f37f docs(troubleshooting,performance): Small changes
Add links to admin command reference pages and reword some nits
2026-08-05 18:00:11 +00:00
stratself a5fe5b531d docs(docker): Add update instructions 2026-08-05 18:00:11 +00:00
stratself 144ff89447 docs(docker,delegation): Edit compose examples with Caddy
* Use 2-spaces indentation instead of 4
* Use `proxy` as network name instead of `caddy` to be consistent
* Mount Caddyfile for delegated example as well
2026-08-05 18:00:11 +00:00
stratself 6915bca11c docs(dns): Add workaround notes for connecting to containers via IPs
* docs(appservices): Fix registration command and also add Docker DNS caveats
* docs(docker): A word
2026-08-05 18:00:11 +00:00
stratself 519ebc96cc docs(docker): Use Caddyfile mount for Caddy example
The `configs.content` approach only works for Docker, so doing this
would be more inclusive for Podman users

Also removed Nexy's forge as it is currently limited access
2026-08-05 18:00:11 +00:00
stratself 39ca63afe5 docs(delegation): Improve structure and wording
* Delineate 2 options for serving well-knowns
* Move SRV stuff to Appendix section
* Other small changes
2026-08-05 18:00:11 +00:00
stratself 77c22ca82d docs: Add title and version caveat for config file reference 2026-08-05 18:00:11 +00:00
Renovate Bot f463cbab4f chore(deps): update pre-commit hook crate-ci/typos to v1.49.0 2026-08-05 13:04:52 +01:00
nex 80e98a2299 fix: Fixup v26.7.2 link in announcement 2026-08-04 23:35:20 +00:00
nex 20cdcee68c chore: Backdate release notes
I am a very responsible and organised maintainer and this was a deliberate plan to see how many users are keeping an active watch on the project's releases /j
2026-08-04 21:29:27 +00:00
alexia 6647d405f4 chore(ci): fix formatting so prek/CI doesn't complain 2026-08-04 19:03:13 +00:00
alexia 4e9ed55c6b chore: add changelog 2026-08-04 19:03:13 +00:00
alexia 679b75eb66 chore: update generated config file 2026-08-04 19:03:13 +00:00
alexia c3bd6d697a docs: fix default user-agent example being outdated
is it fine that this is wrapped? :p
2026-08-04 19:03:13 +00:00
stratself 4fea19b0e3 fix: Separate changelogs for important configuration changes 2026-08-04 18:18:54 +00:00
stratself ecb52af225 fix: Fix grammatical vulnerability reported by @thetayloredman 2026-08-04 18:18:54 +00:00
stratself 61be6aa7c6 chore: Fix changelog to better reflect changes 2026-08-04 18:18:54 +00:00
stratself 95dfa2c389 docs(livekit): Add more Element Call UI error cases 2026-08-04 18:18:54 +00:00
stratself 5ca21de3ca docs(livekit): Make room.auto_create false following recs
Recs from lk-jwt-service README page, also:

* Remove statement about Docker-only LiveKit
* Retitle some section
2026-08-04 18:18:54 +00:00
stratself c11a30bb0d docs(turn,livekit): Add troubleshooting steps for incorrect IPs 2026-08-04 18:18:54 +00:00
stratself a73cdbeff2 docs(turn,livekit): Small changes
* Small wording changes on calls.mdx
* Add env var sample for livekit foci
* Simplify TURNS-over-443 Caddyfile (livekit + turn)
* Improve TURNS-over-443 wordings (livekit + turn)
* Link to MRTC room on turn documentation
2026-08-04 18:18:54 +00:00
stratself e14a86026a chore: Update changelogs 2026-08-04 18:18:54 +00:00
stratself e62d74197e docs(turn): Use coturn for compose 2026-08-04 18:18:54 +00:00
stratself 7b4729e48c docs(livekit): Add caveat for livekit + caddy-in-docker 2026-08-04 18:18:54 +00:00
stratself 3b5aa44229 docs(livekit): Rewrite TURN stuff with 443-TLS and move to Appendix section 2026-08-04 18:18:54 +00:00
stratself da547a7b89 docs: Remove guest access section due to feature removal 2026-08-04 18:18:54 +00:00
stratself bb2d93e42e docs(turn,livekit): Add references to example conf files and ref URLs indirectly 2026-08-04 18:18:54 +00:00
stratself 0d7c82cf5f docs(turn): Add proxy protocol example for TURNS SNI routing 2026-08-04 18:18:54 +00:00
stratself 486b50f328 fix(docs): Put lengthy Caddyfile in details div section 2026-08-04 18:18:54 +00:00
stratself c2641488bf chore: Update changelog in detail 2026-08-04 18:18:54 +00:00
stratself 04ae2cb7fc docs(turn): Add instructions on TURNS-over-443 and L4 multiplexing 2026-08-04 18:18:54 +00:00
stratself a7b5fa4edc chore: Add changelog and fix trailing whitespace 2026-08-04 18:18:54 +00:00
stratself 52293ad55a docs: Refactor TURN documentation with many changes (see below)
* Make all links indirect for better maintenance
* Add Domain section with `coturn.example.com` and use it in subsequent
  examples
* Add standard ports for TURN and TURNS
* Remove TURNS-over-UDP (unknown whether it is supported)
* Add section on opening ports with ufw commands
* IMPORTANT: Move password auth/guest access instructions into the
  Appendix as they are very insecure
* Small improvements in Testing section
* Rewrite Troubleshooting section to be more concise and cut down on
  errors
* Add note to Eturnal in Appendix section
2026-08-04 18:18:54 +00:00
theS1LV3R 3bdfaa55dc chore: Update resolvematrix 2026-08-04 16:03:03 +00:00
theS1LV3R e6ae6b83e6 chore: Fix errors for resolvematrix update 2026-08-04 16:03:03 +00:00
theS1LV3R 668a9c9ada chore: Update resolvematrix
Temporarily using revision until a full release can be made.

This update includes more trace logging to help with debugging
possible resolution errors.
2026-08-04 16:03:03 +00:00
Henry-Hiles 9f20633457 fix: Add missing double quote in about template 2026-08-04 15:16:47 +00:00
Renovate Bot f0ff4dbcc9 chore(deps): update github-actions-digest 2026-08-04 05:02:51 +00:00
Erwan Leboucher aa884fad6b feat(sync): Add MSC4480 sticky events 2026-08-03 14:35:53 +00:00
timedout 98bc859023 fix: Actually default to core count for sender_workers
Closes #2092
2026-08-03 14:18:32 +01:00
Renovate Bot 618b1c1a11 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v43.288.0 2026-08-03 05:01:33 +00:00
Erwan Leboucher 43197f695c feat(sync): Add MSC4354 sticky events 2026-08-02 17:28:00 +00:00
Erwan Leboucher 7789399ba5 fix(sync): Apply MSC4186 room filters 2026-08-02 18:33:57 +02:00
Erwan Leboucher 27a559a751 fix(sync): Wake sync loops on typing updates 2026-08-02 18:05:27 +02:00
Erwan Leboucher 74591d24e5 fix(sync): Avoid missed long-poll wake-ups 2026-08-02 15:22:18 +00:00
Jacob Taylor 4146e0f1da fix: Resolve membership service by correct name for auto-join 2026-08-01 22:32:25 -07:00
Erwan Leboucher 8481efb482 chore(deps): Update Ruma 2026-08-01 23:50:48 +02:00
timedout 3f69334f9a chore: Update changelog 2026-07-30 19:10:53 +01:00
timedout 0c96170063 fix: Ensure client IP is logged in all registration alert paths 2026-07-27 16:07:32 +01:00
timedout 4ccb4463b6 chore: Add newsfrag 2026-07-27 15:56:30 +01:00
timedout 9a80f1c2a1 fix: Re-introduce registration alerts 2026-07-27 15:33:38 +01:00
117 changed files with 5102 additions and 2100 deletions

No files matched your search

@@ -44,7 +44,7 @@ runs:
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ${{ env.BUILTIN_REGISTRY }}
username: ${{ inputs.registry_user }}
@@ -79,7 +79,7 @@ runs:
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ${{ env.BUILTIN_REGISTRY }}
username: ${{ inputs.registry_user }}
+1 -1
View File
@@ -71,7 +71,7 @@ runs:
- name: Install timelord-cli and git-warp-time
if: steps.check-binaries.outputs.need-install == 'true'
uses: https://github.com/taiki-e/install-action@41049aa56687c35e0afa74eed4f09cec4f9afabf # v2
uses: https://github.com/taiki-e/install-action@b6b84cf49ebfe0176417bdce007c624f0db37f20 # v2
with:
tool: git-warp-time,timelord-cli@3.0.1
+48
View File
@@ -0,0 +1,48 @@
name: Bug Report
about: Report a bug or some other undesirable behaviour
title: 'bug: '
labels:
- Bug
- 'Status/Needs Investigation'
body:
- type: markdown
attributes:
value: |
**Please ask for help in #main:continuwuity.org to ensure that what you are experiencing is actually a bug.**
**Do not report security or security-aligned issues here. See [/SECURITY.md] for that.**
Note that issue descriptions generated in part or in whole by AI tools will be closed without review.
Please instead describe the problem you are having to the best of your own ability.
[/SECURITY.md]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/SECURITY.md
- type: textarea
attributes:
label: What is the bug?
description: Provide a detailed description of the issue you are experiencing.
placeholder: |
Continuwuity does not do xyz, which causes abc to happen. I expected it to do this, but instead it did that.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Provide a step-by-step description of how to reproduce the issue.
placeholder: |
1. Do this
2. Then do that
3. Finally, observe the issue
validations:
required: true
- type: input
attributes:
label: Server name and version
description: |
What server did this happen on (e.g: continuwuity.org) and what Continuwuity version is running (e.g: v26.7.3)?
placeholder: |
continuwuity.example 26.8.0-alpha.1 (47eb39843)
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Anything else you think might be relevant to the issue
+8
View File
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Get support
url: https://matrix.to/#/#continuwuity:continuwuity.org
about: Open a web portal to join our support room
- name: Report a security issue
url: https://continuwuity.org/security
about: Report a security issue to the Continuwuity team
@@ -0,0 +1,48 @@
name: Feature request
about: Suggest a new feature or improvement
title: 'FR: '
labels:
- Enhancement
- 'Status/Needs Investigation'
body:
- type: markdown
attributes:
value: |
**Do not report security or security-aligned issues here. See [/SECURITY.md] for that.**
Keep in mind that continuwuity is developed by a small team of volunteers and as such your
feature request may take a long time to get attention. If you want something implemented
sooner, feel free to open a pull request after getting a go-ahead from the maintainer team.
Note that issue descriptions generated in part or in whole by AI tools will be closed without review.
Please instead describe the problem you are having to the best of your own ability.
[/SECURITY.md]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/SECURITY.md
- type: textarea
attributes:
label: What new feature do you want to see? What problem does it solve?
description: |
Provide a detailed description of the feature you would like to see, describing what it does,
how it will be used, and how this is beneficial to the broader Matrix community.
placeholder: |
I would like to see a new feature that allows users to do xyz.
validations:
required: true
- type: textarea
attributes:
label: Further reading
description: |
A lot of changes in Matrix software will require Matrix Spec Change proposals.
If your feature request is related to a change in the Matrix specification,
please link any relevant proposals here.
Likewise, if there are any discussions elsewhere related to this feature request
(e.g. issues or pull requests on other issue trackers), please link them here too.
placeholder: |
- https://github.com/matrix-org/matrix-spec-proposals/pull/1234
- #1234 (issue/PR in continuwuity's repo)
- https://gitlab.com/other-matrix-project/other-matrix-project/-/issues/1234
- type: textarea
attributes:
label: Additional context
description: Anything else you think might be relevant to the issue
-132
View File
@@ -1,132 +0,0 @@
name: Deploy Element Web
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
pull_request:
paths:
- ".forgejo/workflows/element.yml"
push:
branches:
- main
paths:
- ".forgejo/workflows/element.yml"
concurrency:
group: "element-${{ github.ref }}"
cancel-in-progress: true
jobs:
build-and-deploy:
name: 🏗️ Build and Deploy
runs-on: ubuntu-latest
steps:
- name: 📦 Setup Node.js
uses: https://github.com/actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: "22"
- name: 🔨 Clone, setup, and build Element Web
run: |
echo "Cloning Element Web..."
git clone https://github.com/maunium/element-web
cd element-web
git checkout develop
git pull
echo "Cloning matrix-js-sdk..."
git clone https://github.com/matrix-org/matrix-js-sdk.git
echo "Installing Yarn..."
npm install -g yarn
echo "Installing dependencies..."
yarn install
echo "Preparing build environment..."
mkdir -p .home
echo "Cleaning up specific node_modules paths..."
rm -rf node_modules/@types/eslint-scope/ matrix-*-sdk/node_modules/@types/eslint-scope || echo "Cleanup paths not found, continuing."
echo "Getting matrix-js-sdk commit hash..."
cd matrix-js-sdk
jsver=$(git rev-parse HEAD)
jsver=${jsver:0:12}
cd ..
echo "matrix-js-sdk version hash: $jsver"
echo "Getting element-web commit hash..."
ver=$(git rev-parse HEAD)
ver=${ver:0:12}
echo "element-web version hash: $ver"
chmod +x ./build-sh
export VERSION="$ver-js-$jsver"
echo "Building Element Web version: $VERSION"
./build-sh
echo "Checking for build output..."
ls -la webapp/
- name: ⚙️ Create config.json
run: |
cat <<EOF > ./element-web/webapp/config.json
{
"default_server_name": "continuwuity.org",
"default_server_config": {
"m.homeserver": {
"base_url": "https://matrix.continuwuity.org"
}
},
"default_country_code": "GB",
"default_theme": "dark",
"mobile_guide_toast": false,
"show_labs_settings": true,
"room_directory": [
"continuwuity.org",
"matrixrooms.info"
],
"settings_defaults": {
"UIFeature.urlPreviews": true,
"UIFeature.feedback": false,
"UIFeature.voip": false,
"UIFeature.shareQrCode": false,
"UIFeature.shareSocial": false,
"UIFeature.locationSharing": false,
"enableSyntaxHighlightLanguageDetection": true
},
"features": {
"feature_pinning": true,
"feature_custom_themes": true
}
}
EOF
echo "Created ./element-web/webapp/config.json"
cat ./element-web/webapp/config.json
- name: 📤 Upload Artifact
uses: forgejo/upload-artifact@v4
with:
name: element-web
path: ./element-web/webapp/
retention-days: 14
- name: 🛠️ Install Wrangler
run: npm install --save-dev wrangler@latest
- name: 🚀 Deploy to Cloudflare Pages
if: vars.CLOUDFLARE_PROJECT_NAME != ''
id: deploy
uses: https://github.com/cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: >-
pages deploy ./element-web/webapp
--branch="${{ github.ref == 'refs/heads/main' && 'main' || github.head_ref || github.ref_name }}"
--commit-dirty=true
--project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}-element"
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
# repositories: continuwuity
- name: Install regsync
uses: https://github.com/regclient/actions/regsync-installer@c48159175b58fb90cccd0f98410927a81e04a166 # main
uses: https://github.com/regclient/actions/regsync-installer@78eb729dbdb4ef6480e85ff697b4410e22112583 # main
- name: Check what images need mirroring
run: |
+1 -1
View File
@@ -53,7 +53,7 @@ jobs:
persist-credentials: false
- name: Check for file changes
uses: https://github.com/dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
uses: https://github.com/dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4
id: filter
with:
filters: |
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
name: Renovate
runs-on: ubuntu-latest
container:
image: ghcr.io/renovatebot/renovate:43.281.1@sha256:34c2dd58f58e8976be2024a24fec23bbee805f0bf887837d9aaee7daeb09ccfc
image: ghcr.io/renovatebot/renovate:44.35.3@sha256:822fd48b8ca3a0ab7b5c6b35088a097729190eb710e7bc4a4b073e605bf23c0f
options: --tmpfs /tmp:exec
steps:
- name: Checkout
+1 -1
View File
@@ -24,7 +24,7 @@ repos:
- id: check-added-large-files
- repo: https://github.com/crate-ci/typos
rev: v1.48.0
rev: v1.49.0
hooks:
- id: typos
- id: typos
+260 -176
View File
@@ -1,11 +1,95 @@
# Continuwuity 26.8.1 (2026-08-22)
No significant changes.
# Continuwuity v26.8.0 (2026-08-22)
## Features
- Added new health tracking to monitor the health of remote servers and intelligently back-off federation globally with automatic stale re-resolution.
([#2097](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2097))
- Added [MSC4354](https://github.com/matrix-org/matrix-spec-proposals/pull/4354) sticky events (and [MSC4480](https://github.com/matrix-org/matrix-spec-proposals/pull/4480) for sliding sync), behind the `allow_sticky_events` config option. Contributed by @eleboucher.
- Added scoped typing updates to Simplified Sliding Sync ([MSC4508](https://github.com/matrix-org/matrix-spec-proposals/pull/4508)). Contributed by @eleboucher.
- Added [MSC4186](https://github.com/matrix-org/matrix-spec-proposals/pull/4186) direct, encrypted, and room-type list filters to Simplified Sliding Sync, resolving invited rooms from their stripped invite state. Contributed by
@eleboucher.
## Bugfixes
- Re-introduced admin room registration alerts that were accidentally removed in the OAuth2 update. ([#2057](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2057))
- Fixed federation PDUs received during remote joins being dropped before their room state was available. Contributed by @eleboucher.
([#2063](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2063))
- Resolve membership service by correct name for auto-join. Contributed by @Aranjedeath ([#2082](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2082))
- Fixed simplified sliding sync reporting the number of live timeline events. Contributed by @eleboucher. ([#2083](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2083))
- Plugged a logic gap that may have been allowing Continuwuity to process events with incorrect room versions under certain conditions. Contributed by @nex.
([#2106](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2106))
- The OAuth 2.0 device authorization endpoint now rejects clients which did not register the device code grant type, instead of issuing them a device code. The token endpoint now returns the
`unauthorized_client` error code when a client requests a grant type it did not register, instead of `invalid_grant`. Contributed by @mmaudet.
([#2110](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2110))
- Events arriving after one of their children has already been backfilled are no longer used as forward extremities. Contributed by @eleboucher.
([#2115](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2115))
- Fixed federated space hierarchies omitting rooms restricted to members of private spaces. Contributed by @eleboucher. ([#2132](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2132))
- A panic during transaction handling will no longer cause the handle tracker to reference a stale transaction, which caused federation between two servers to fail until continuwuity was restarted.
Contributed by @nex. ([#2137](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2137))
- Fixed event tracking forgetting to mark soft-failed/rejected events as referenced, which caused a build-up of incorrectly unreferenced events, triggering frequent dummy squashes and associated state
resets. ([#2164](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2164))
- Fixed left/banned rooms sometimes not coming down sync.
- Fixed local events dropping forward extremities they did not reference. Contributed by @eleboucher.
- Fixed missed wake-ups and stale responses in legacy and sliding sync long polls. Contributed by @eleboucher.
- Fixed space hierarchy depth limits, child ordering, and non-space child traversal. Contributed by @eleboucher.
- Fixed state resolution ordering room creators as having no power level. Contributed by @eleboucher.
- Fixed sync loops being woken before membership changes are fully committed.
- Fixed typing notifications not interrupting a sync long poll. Contributed by @eleboucher.
- Preserve all users' read receipts when batching room receipt updates.
- Fixed [MSC4323](https://github.com/matrix-org/matrix-spec-proposals/pull/4323) suspend/lock admin endpoints: the lock endpoint now locks instead of suspending users, and error codes match the
ratified spec. Contributed by @eleboucher.
## Improved Documentation
- Refactor TURN docs and remove unsafe setups. Polish LiveKit docs. Add guidance for TURNS-over-443 multiplexing for both LiveKit and legacy calls. Contributed by @stratself
([#1740](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1740))
- Updated the docs to reflect the current default User-Agent for URL previews ([#2079](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2079))
- Added missing documentation to config parameters. Contributed by @renegadespork ([#2107](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2107))
- Generic deployment documentation: Use `/etc/caddy/Caddyfile` instead of `/etc/caddy/conf.d/*` paths, which do not exist on a majority of Caddy installations.
([#2117](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2117))
- Add caveat and workaround for container resolution (e.g. for dockerized appservices) when using mounted `/etc/resolv.conf`. Contributed by @stratself
- Livekit docs, troubleshooting section: Advise using `host-gateway` magic address for `lk-jwt-service` container to loop back to host, instead of the other incomplete/incorrect workarounds.
Contributed by @stratself
- Livekit docs: `room.auto_create: false` is now included in default `livekit.yaml`, following `lk-jwt-service` recommendation.
- Replace deprecated `docker-compose` commands with `docker compose` to reflect latest Docker changes.
- Update backup instructions: the right paths for `.sst` files are now in `$DATABASE_BACKUP_PATH/private/<number>` path instead of `$DATABASE_BACKUP_PATH/<number>`. Contributed by @stratself
## Misc
- Updated admin command names (list-users -> list, list-rooms -> list, and reload-mods -> reload), old names are now aliases. Contributed by @PerformativeJade ([#2033](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2033))
- Updated Ruma dependencies. Contributed by @eleboucher.
# Continuwuity 26.7.3 (2026-08-11)
## Bugfixes
- Fixed a vulnerability that enabled the server to leak certain events over federation. Contributed by @eleboucher. (SEC26)
- Fixed an issue that allowed an attacker to take over another account on the same server under certain conditions.
([GHSA-v2x6-m99h-vqxx](https://github.com/continuwuity/continuwuity/security/advisories/GHSA-v2x6-m99h-vqxx)) Contributed by @gingershaped and reported by GlitchedAxiom. (SEC28)
# Continuwuity 26.7.2 (2026-07-30)
## Bugfixes
- Sliding sync no longer continues streaming data to a user after they are removed from a room. Contributed by @eleboucher. (SEC10)
- Valid redaction events no longer arbitrarily soft-fail and are applied correctly as expected.
- Fixed a regression that caused the server to process events for rooms it no longer has any local users in, which caused users to be reset back *into* rooms.
# Continuwuity 26.7.0 (2026-07-27)
## Features
- Build and publish arm64 .deb packages alongside amd64 for all supported Debian and Ubuntu releases. (#1235)
- Dehydrated devices are now visible in the account panel. Contributed by @ginger. (#1970)
- Introduce `accepted_ip_sources` as a multiple options variant of `request_ip_source`, allowing for more advanced deployments and making fallbacks an explicit choice. Contributed by @Omar007 (#1985)
- Added an admin command to issue an access token for a bot account, to allow legacy bots to function while legacy authentication is disabled. Contributed by @ginger (#2044)
- Build and publish arm64 .deb packages alongside amd64 for all supported Debian and Ubuntu releases. ([#1235](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1235))
- Dehydrated devices are now visible in the account panel. Contributed by @ginger. ([#1970](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1970))
- Introduce `accepted_ip_sources` as a multiple options variant of `request_ip_source`, allowing for more advanced deployments and making fallbacks an explicit choice. Contributed by @Omar007
([#1985](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1985))
- Added an admin command to issue an access token for a bot account, to allow legacy bots to function while legacy authentication is disabled. Contributed by @ginger
([#2044](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2044))
- Added support for the OAuth2 device authorization flow. Contributed by @ginger
- Added support for the stable mutual rooms query endpoint. Contributed by @ginger
- Fetch the joined member count once per event instead of once per notified user.
@@ -13,126 +97,138 @@
## Bugfixes
- Fix joining restricted rooms over federation failing with signature verification error. (fix-federation-signature)
- Fixed the client space hierarchy endpoint returning a 500 "Space hierarchy is unreasonably large" error for cyclic space graphs (e.g. a space containing itself). Rooms are now deduplicated during traversal as required by the spec, and the traversal depth is bounded even when the client does not specify `max_depth`. (space-hierarchy-cycle)
- Fixed the client space hierarchy endpoint returning a 500 "Space hierarchy is unreasonably large" error for cyclic space graphs (e.g. a space containing itself). Rooms are now deduplicated during
traversal as required by the spec, and the traversal depth is bounded even when the client does not specify `max_depth`. (space-hierarchy-cycle)
- Fixed simplified sliding sync holding account data for up to 30 seconds, which made encryption setup and cross-signing resets appear to hang. (sss-account-data-longpoll)
- Fixed local invites and invite acceptances not being reflected in sync promptly. Contributed by @eleboucher (wake-local-member-sync)
- Fixed the deeplink redirect for deleting devices. Contributed by @koen (#1965)
- Fix status code for oauth registration. Contributed by @n00byking (#1984)
- Exempt m.room.create from auth_events check. Contributed by @eleboucher (#1987)
- Fixed `create` being returned as a supported prompt value regardless of if registration is enabled or not. Contributed by @ginger (#1994)
- Fixed high CPU usage when multiple clients from the same account were connected at once. Each sync woke the account's other sync loops, causing them to wake each other in a loop. (#2006)
- Fixed MSC4190 appservice device creation registering a random device ID instead of the requested one (and dropping the requested display name), which prevented encrypted mautrix bridges from starting on OIDC-enabled servers and leaked an orphan device on the bridge bot per startup attempt. (#2015)
- Deactivated users and appservice puppets are no longer counted by `/_continuwuity/local_user_count`. Contributed by @ginger. (#2040)
- Re-introduced admin room registration alerts that were accidentally removed in the OAuth2 update. (#2057)
- Fixed the deeplink redirect for deleting devices. Contributed by @koen ([#1965](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1965))
- Fix status code for oauth registration. Contributed by @n00byking ([#1984](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1984))
- Exempt m.room.create from auth_events check. Contributed by @eleboucher ([#1987](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1987))
- Fixed `create` being returned as a supported prompt value regardless of if registration is enabled or not. Contributed by @ginger
([#1994](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1994))
- Fixed high CPU usage when multiple clients from the same account were connected at once. Each sync woke the account's other sync loops, causing them to wake each other in a loop.
([#2006](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2006))
- Fixed [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) appservice device creation registering a random device ID instead of the requested one (and dropping the requested
display name), which prevented encrypted mautrix bridges from starting on OIDC-enabled servers and leaked an orphan device on the bridge bot per startup attempt.
([#2015](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2015))
- Deactivated users and appservice puppets are no longer counted by `/_continuwuity/local_user_count`. Contributed by @ginger.
([#2040](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2040))
- Re-introduced admin room registration alerts that were accidentally removed in the OAuth2 update. ([#2057](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2057))
- Appservices are now properly able to create devices for E2EE.
- Appservices may now specify both the unstable and stable `device_id` query parameters in a request. The stable parameter will take priority. Contributed by @ginger.
- Fixed `roomuserid_lastnotificationread` being aliased to the highlight count table, which clobbered highlight counts when setting a read marker. Contributed by @eleboucher
- Fixed freshly left room failing to sync.
- Fixed newly created rooms failing to sync properly in clients using legacy sync.
- Fixed newly joined rooms failing to sync their full state (including the room name) to clients using legacy sync.
- Fixed requests returning `500 Internal Server Error` when the header selected by `request_ip_source` is absent, duplicated, or malformed (for example Envoy omitting `X-Envoy-External-Address` on internal requests). The client IP now falls back to the connection peer address instead of failing the request. Contributed by @eleboucher
- Fixed requests returning `500 Internal Server Error` when the header selected by `request_ip_source` is absent, duplicated, or malformed (for example Envoy omitting `X-Envoy-External-Address` on
internal requests). The client IP now falls back to the connection peer address instead of failing the request. Contributed by @eleboucher
- Resolve alias service by correct name for auto-join. Contributed by @eleboucher
## Improved Documentation
- Updated an out-of-date statement about Oracle Linux release cadences. (#1999)
- Updated an out-of-date statement about Oracle Linux release cadences. ([#1999](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1999))
# Continuwuity 26.6.2 (2026-07-12)
## Bugfixes
- Fixed the server returning 500 errors if `admin_console_automatic` is enabled and no TTY is available. Contributed by @s1lv3r. (#1975)
- Fixed the server returning 500 errors if `admin_console_automatic` is enabled and no TTY is available. Contributed by @s1lv3r.
([#1975](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1975))
- Fixed `global.oauth.compatibility_mode` being required, despite being ignored, when the `[global.oauth.oidc]` config section is provided.
- Fixed an issue with a migration that could cause user accounts imported from an identity provider to be marked as deactivated when the server started. If you have accounts affected by this issue, use `!admin users reset-password --convert-to-local-account` to reactivate them.
- Fixed an issue with a migration that could cause user accounts imported from an identity provider to be marked as deactivated when the server started. If you have accounts affected by this issue,
use `!admin users reset-password --convert-to-local-account` to reactivate them.
# Continuwuity 26.6.1 (2026-07-12)
## Features
- Added enforcement for new federated invite checks and corrected a bunch of related spec compliance issues along the way. Contributed by @nex. (#1952)
- Added enforcement for new federated invite checks and corrected a bunch of related spec compliance issues along the way. Contributed by @nex.
([#1952](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1952))
## Bugfixes
- Fixed existing accounts failing to link when logging in with OIDC if `prompt_for_localpart` was `false`. (#1942)
- Authentication is no longer required on the `/_matrix/client/v3/account/3pid/email/requestToken` endpoint. (#1953)
- Fixed existing accounts failing to link when logging in with OIDC if `prompt_for_localpart` was `false`. ([#1942](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1942))
- Authentication is no longer required on the `/_matrix/client/v3/account/3pid/email/requestToken` endpoint. ([#1953](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1953))
- Fixed newly created rooms failing to sync properly in clients using legacy sync.
- Stopped appservice users from being erroneously marked as deactivated during a 26.6 database migration.
- Whitespace will now automatically be trimmed from the start and end of the `global.oauth.oidc.client_secret_file`.
# Continuwuity 26.6.0 (2026-07-10)
## Features
- Added support for linking an external identity provider with OIDC. Contributed by @ginger. (#765)
- Updated [MSC4284: Policy Servers](https://github.com/matrix-org/matrix-spec-proposals/pull/4284) implementation to support the newly stabilised proposal. Contributed by @nex. (#1487)
- Added config option for default room ACLs. Contributed by @eve. (#1691)
- Added support for fallback encryption keys. (#1710)
- Add `!admin users reject-all-invites` to clean invite spam (#1741)
- Implemented event rejection, which should resolve and prevent future netsplits of the kinds observed
within some Continuwuity rooms.
Also resolved several bugs related to both soft-failing events, and event backfilling, which should
improve state resolution stability.
The `!admin debug get-pdu` command was updated to disambiguate event acceptance status, and
`!admin debug show-auth-chain` was added to visually display event auth chains, which may assist
developers in debugging strangely complex events.
- Updated [MSC4284: Policy Servers](https://github.com/matrix-org/matrix-spec-proposals/pull/4284) implementation to support the newly stabilised proposal. Contributed by @nex.
([#1487](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1487))
- Added config option for default room ACLs. Contributed by @eve. ([#1691](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1691))
- Added support for fallback encryption keys. ([#1710](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1710))
- Add `!admin users reject-all-invites` to clean invite spam ([#1741](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1741))
- Implemented event rejection, which should resolve and prevent future netsplits of the kinds observed within some Continuwuity rooms. Also resolved several bugs related to both soft-failing events,
and event backfilling, which should improve state resolution stability. The `!admin debug get-pdu` command was updated to disambiguate event acceptance status, and
`!admin debug show-auth-chain` was added to visually display event auth chains, which may assist developers in debugging strangely complex events.
Contributed by @nex. (#1747)
- Added full support for [MSC4168: Update `m.space.*` state on room upgrade](https://github.com/matrix-org/matrix-spec-proposals/pull/4168). Contributed by @nex. (#1807)
- Improved the performance and reliability of fetching missing events, improving network partition recovery. Contributed
by @nex. (#1818)
- Added static builds using Nix, allowing for Continuwuity on musl. During this, we also introduced a `max-perf-haswell` package, separating it from `max-perf`, so you may want to swap to this if you are on NixOS. Contributed by @Henry-Hiles (QuadRadical). (#1853)
- Added support for MSC4380 invite blocking, which has become part of the Matrix specification in v1.18. Contributed by @nex. (#1875)
- Added `!admin debug get-state-at` command (#1877)
- Added a configuration option to allow choosing a client IP source that is not the TCP connecting IP. Contributed by @nex. (#1931)
- Added support for MSC4466, which allows clients to customize how changes to a user's global profile are propagated. Contributed by @ginger.
Contributed by @nex. ([#1747](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1747))
- Added full support for [MSC4168: Update `m.space.*` state on room upgrade](https://github.com/matrix-org/matrix-spec-proposals/pull/4168). Contributed by @nex.
([#1807](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1807))
- Improved the performance and reliability of fetching missing events, improving network partition recovery. Contributed by @nex.
([#1818](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1818))
- Added static builds using Nix, allowing for Continuwuity on musl. During this, we also introduced a `max-perf-haswell` package, separating it from `max-perf`, so you may want to swap to this if you
are on NixOS. Contributed by @Henry-Hiles (QuadRadical). ([#1853](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1853))
- Added support for [MSC4380](https://github.com/matrix-org/matrix-spec-proposals/pull/4380) invite blocking, which has become part of the Matrix specification in v1.18. Contributed by @nex.
([#1875](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1875))
- Added `!admin debug get-state-at` command ([#1877](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1877))
- Added a configuration option to allow choosing a client IP source that is not the TCP connecting IP. Contributed by @nex. ([#1931](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1931))
- Added support for [MSC4466](https://github.com/matrix-org/matrix-spec-proposals/pull/4466), which allows clients to customize how changes to a user's global profile are propagated. Contributed by
@ginger.
- Added support for Matrix 1.16's `state_after` feature, allowing clients which understand it to sync room state changes more reliably. Contributed by @ginger.
- Added support for authenticating clients using the new OAuth 2.0 login API. Contributed by @ginger.
- Appservice device management as outlined in MSC4190 (part of Matrix 1.17) is now fully supported. Contributed by @ginger.
- Appservice device management as outlined in [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) (part of Matrix 1.17) is now fully supported. Contributed by @ginger.
- Users may now be forbidden from deactivating their own accounts with the new `allow_deactivation` config option. Contributed by @ginger.
## Bugfixes
- Adjusted legacy sync logic to allow the `roomsynctoken_shortstatehash` database column to be dropped, massively reducing database sizes, especially for old deployments. Contributed by @ginger. (#917)
- Fixed a bug that caused the server to drop events during processing if several events for the same room were sent in a singular transaction. Contributed by @nex. (#1711)
- fix `!admin query account-data account-data-get` not returning the content (#1742)
- Fixed an issue where Continuwuity would only advertise support for the unstable endpoint for Mutual Rooms (MSC2666), despite only supporting the stable endpoint. Contributed by @Henry-Hiles (QuadRadical) (#1752)
- Fixed admin commands being ignored when they had leading whitespace before admin commands. Contributed by @kitvonsnookerz. (#1804)
- Fixed several bugs in the `POST /_matrix/client/v3/rooms/{roomId}/upgrade` endpoint. Contributed by @nex. (#1807)
- Adjusted legacy sync logic to allow the `roomsynctoken_shortstatehash` database column to be dropped, massively reducing database sizes, especially for old deployments. Contributed by @ginger.
(#917)
- Fixed a bug that caused the server to drop events during processing if several events for the same room were sent in a singular transaction. Contributed by @nex.
([#1711](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1711))
- fix `!admin query account-data account-data-get` not returning the content ([#1742](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1742))
- Fixed an issue where Continuwuity would only advertise support for the unstable endpoint for Mutual Rooms ([MSC2666](https://github.com/matrix-org/matrix-spec-proposals/pull/2666)), despite only
supporting the stable endpoint. Contributed by @Henry-Hiles (QuadRadical) ([#1752](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1752))
- Fixed admin commands being ignored when they had leading whitespace before admin commands. Contributed by @kitvonsnookerz.
([#1804](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1804))
- Fixed several bugs in the `POST /_matrix/client/v3/rooms/{roomId}/upgrade` endpoint. Contributed by @nex. ([#1807](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1807))
- Devices which set their presence as "offline" will no longer be considered for presence updates. Contributed by @timedout.
- Improved invite and join reliability in clients using legacy sync. Contributed by @ginger
- The invite recipient's membership event is now included in invite stripped state, which should fix flaky invite display in some clients. Contributed by @ginger
## Improved Documentation
- Add performance tuning documentation. Contributed by @stratself. (#1498)
- Explain accessing Continuwuity's server console when deployed via Docker. (#1671)
- Clarified in the config that `max_request_size` affects federated media as well. (#1706)
- Added example configuration using caddy-docker-proxy in the livekit setup section of the docs. Contributed by @Cease (#1762)
- Updated deployment docs to account for new RPM package availability across more distros. Contributed by @julian45. (#1912)
- Add performance tuning documentation. Contributed by @stratself. ([#1498](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1498))
- Explain accessing Continuwuity's server console when deployed via Docker. ([#1671](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1671))
- Clarified in the config that `max_request_size` affects federated media as well. ([#1706](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1706))
- Added example configuration using caddy-docker-proxy in the livekit setup section of the docs. Contributed by @Cease ([#1762](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1762))
- Updated deployment docs to account for new RPM package availability across more distros. Contributed by @julian45. ([#1912](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1912))
## Deprecations and Removals
- Removed support for LDAP. (#1701)
- Removed support for LDAP. ([#1701](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1701))
- Removed support for guest user registration, a little-used and deprecated approach to room previews.
- Removed the `/_conduwuit/` versions of the `local_user_count` and `version` routes. These routes are still accessible under the `/_continuwuity` prefix.
- Support for server-side blurhashing (part of MSC2448) has been removed.
- Support for server-side blurhashing (part of [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448)) has been removed.
- The deprecated `well_known.rtc_focus_server_urls` config option has been removed. MatrixRTC foci should be configured using the `matrix_rtc.foci` config option.
## Misc
- #1505, #1829, #1927, #1933, #1934
- Switched from Continuwuity's fork of Ruma back to upstream Ruma. Contributed by @ginger.
- The version of Debian that the Docker-based build process uses has been upgraded from Bookworm to Trixie, meaning that standalone binaries now have a minimum glibc of 2.41, and can no longer be used on distro versions from before 2025-01-30
- The version of Debian that the Docker-based build process uses has been upgraded from Bookworm to Trixie, meaning that standalone binaries now have a minimum glibc of 2.41, and can no longer be used
on distro versions from before 2025-01-30
# Continuwuity 0.5.8 (2026-04-24)
## Features
- LDAP can now optionally be connected to using StartTLS, and you may unsafely skip verification. Contributed by @getz (#1389)
- LDAP can now optionally be connected to using StartTLS, and you may unsafely skip verification. Contributed by @getz ([#1389](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1389))
- Users will now be prevented from removing their email if the server is configured to require an email when registering an account.
## Bugfixes
@@ -141,51 +237,57 @@
## Improved Documentation
- Updated config docs to state we support room version 12, and set it as default. Contributed by @ezera. (#1622)
- Improve instructions for generic deployments, removing unnecessary parts and documenting the new initial registration token flow. Contributed by @stratself (#1677)
- Updated config docs to state we support room version 12, and set it as default. Contributed by @ezera. ([#1622](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1622))
- Improve instructions for generic deployments, removing unnecessary parts and documenting the new initial registration token flow. Contributed by @stratself
([#1677](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1677))
# Continuwuity v0.5.7 (2026-04-17)
## Features
- Re-added support for reading registration tokens from a file. Contributed by @ginger and @benbot. (#1371)
- Add new config option to allow or disallow search engine indexing through a `<meta ../>` tag. Defaults to blocking indexing (`content="noindex"`). Contributed by @s1lv3r and @ginger. (#1527)
- Re-added support for reading registration tokens from a file. Contributed by @ginger and @benbot. ([#1371](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1371))
- Add new config option to allow or disallow search engine indexing through a `<meta ../>` tag. Defaults to blocking indexing (`content="noindex"`). Contributed by @s1lv3r and @ginger.
([#1527](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1527))
- Add new config option for [MSC4439](https://github.com/matrix-org/matrix-spec-proposals/pull/4439)
PGP key URIs. Contributed by LogN. (#1609)
- Added `!admin users reset-push-rules` command to reset the notification settings of users. Contributed by @nex. (#1613)
- Notification pushers are now automatically removed when their associated device is. Admin commands now exist for manual cleanup too. Contributed by @nex. (#1614)
- Implemented option to deprioritize servers for room join requests. Contributed by @ezera. (#1624)
- Added admin commands to get build information and features. Contributed by @Jade (#1629)
PGP key URIs. Contributed by LogN. ([#1609](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1609))
- Added `!admin users reset-push-rules` command to reset the notification settings of users. Contributed by @nex. ([#1613](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1613))
- Notification pushers are now automatically removed when their associated device is. Admin commands now exist for manual cleanup too. Contributed by @nex.
([#1614](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1614))
- Implemented option to deprioritize servers for room join requests. Contributed by @ezera. ([#1624](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1624))
- Added admin commands to get build information and features. Contributed by @Jade ([#1629](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1629))
- Added support for associating email addresses with accounts, requiring email addresses for registration, and resetting passwords via email. Contributed by @ginger
- Added support for requiring users to accept terms and conditions when registering.
- Added support for using an admin command to issue self-service password reset links.
## Bugfixes
- Fixed corrupted appservice registrations causing the server to enter a crash loop. Contributed by @nex. (#1265)
- Prevent removing the admin room alias (`#admins`) to avoid accidentally breaking admin room functionality. Contributed by @0xnim (#1448)
- Stripped `join_authorised_via_users_server` from json if user is already in room (@partha:cxy.run) (#1542)
- Fixed internal server errors for fetching thumbnails. Contributed by @PerformativeJade (#1572)
- Fixed error 500 when joining non-existent rooms. Contributed by @ezera. (#1579)
- Refactored nix package. Breaking, since `all-features` package no longer exists. Continuwuity is now built with jemalloc and liburing by default. Contributed by @Henry-Hiles (QuadRadical). (#1596)
- Fixed resolving IP of servers that only use SRV delegation. Contributed by @tulir. (#1615)
- Fixed "Sender must be a local user" error for make_join, make_knock, and make_leave federation routes. Contributed by @nex. (#1623)
- Fixed restricted joins not being signed when we are being used as an authorising server. Contributed by @nex, reported by [vel](matrix:u/vel:nhjkl.com?action=chat). (#1630)
- Fixed corrupted appservice registrations causing the server to enter a crash loop. Contributed by @nex. ([#1265](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1265))
- Prevent removing the admin room alias (`#admins`) to avoid accidentally breaking admin room functionality. Contributed by @0xnim
([#1448](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1448))
- Stripped `join_authorised_via_users_server` from json if user is already in room (@partha:cxy.run) ([#1542](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1542))
- Fixed internal server errors for fetching thumbnails. Contributed by @PerformativeJade ([#1572](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1572))
- Fixed error 500 when joining non-existent rooms. Contributed by @ezera. ([#1579](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1579))
- Refactored nix package. Breaking, since `all-features` package no longer exists. Continuwuity is now built with jemalloc and liburing by default. Contributed by @Henry-Hiles (QuadRadical).
([#1596](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1596))
- Fixed resolving IP of servers that only use SRV delegation. Contributed by @tulir. ([#1615](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1615))
- Fixed "Sender must be a local user" error for make_join, make_knock, and make_leave federation routes. Contributed by @nex.
([#1623](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1623))
- Fixed restricted joins not being signed when we are being used as an authorising server. Contributed by @nex, reported by [vel](matrix:u/vel:nhjkl.com?action=chat).
([#1630](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1630))
- Fixed room alias deletion so removing one local alias no longer removes other aliases from room alias listings.
- Stopped left rooms from being unconditionally sent on initial sync, hopefully fixing spurious appearances of left rooms in some clients (and making sync faster as a bonus). Contributed by @ginger
- Correct the response field name for MatrixRTC transports. Contributed by @spaetz
## Improved Documentation
- Added Testing and Troubleshooting instructions for Livekit documentation. Contributed by @stratself. (#1429)
- Refactored docker docs to include new initial token workflow, and add Caddyfile example. Contributed by @stratself. (#1594)
- Add DNS tuning guide for Continuwuity. Users are recommended to set up a local caching resolver following the guide's advice. Contributed by @stratself (#1601)
- Added Testing and Troubleshooting instructions for Livekit documentation. Contributed by @stratself. ([#1429](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1429))
- Refactored docker docs to include new initial token workflow, and add Caddyfile example. Contributed by @stratself. ([#1594](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1594))
- Add DNS tuning guide for Continuwuity. Users are recommended to set up a local caching resolver following the guide's advice. Contributed by @stratself
([#1601](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1601))
## Misc
- Fixed compiler warning in cf_opts.rs when building in release. Contributed by @ezera. (#1620)
- Fixed compiler warning in cf_opts.rs when building in release. Contributed by @ezera. ([#1620](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1620))
# Continuwuity 0.5.6 (2026-03-03)
@@ -196,22 +298,33 @@
## Features
- Outgoing presence is now disabled by default, and the config option documentation has been adjusted to more accurately represent the weight of presence, typing indicators, and read receipts. Contributed by @nex. ([#1399](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1399))
- Improved the concurrency handling of federation transactions, vastly improving performance and reliability by more accurately handling inbound transactions and reducing the amount of repeated wasted work. Contributed by @nex and @Jade. ([#1428](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1428))
- Added [MSC3202](https://github.com/matrix-org/matrix-spec-proposals/pull/3202) Device masquerading (not all of MSC3202). This should fix issues with enabling [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) for some Mautrix bridges. Contributed by @Jade ([#1435](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1435))
- Added [MSC3814](https://github.com/matrix-org/matrix-spec-proposals/pull/3814) Dehydrated Devices - you can now decrypt messages sent while all devices were logged out. ([#1436](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1436))
- Implement [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143) MatrixRTC transport discovery endpoint. Move RTC foci configuration from `[global.well_known]` to a new `[global.matrix_rtc]` section with a `foci` field. Contributed by @0xnim ([#1442](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1442))
- Outgoing presence is now disabled by default, and the config option documentation has been adjusted to more accurately represent the weight of presence, typing indicators, and read receipts.
Contributed by @nex. ([#1399](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1399))
- Improved the concurrency handling of federation transactions, vastly improving performance and reliability by more accurately handling inbound transactions and reducing the amount of repeated wasted
work. Contributed by @nex and @Jade. ([#1428](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1428))
- Added [MSC3202](https://github.com/matrix-org/matrix-spec-proposals/pull/3202) Device masquerading (not all of [MSC3202](https://github.com/matrix-org/matrix-spec-proposals/pull/3202)). This should
fix issues with enabling [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) for some Mautrix bridges. Contributed by @Jade
([#1435](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1435))
- Added [MSC3814](https://github.com/matrix-org/matrix-spec-proposals/pull/3814) Dehydrated Devices - you can now decrypt messages sent while all devices were logged out.
([#1436](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1436))
- Implement [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143) MatrixRTC transport discovery endpoint. Move RTC foci configuration from `[global.well_known]` to a new
`[global.matrix_rtc]` section with a `foci` field. Contributed by @0xnim ([#1442](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1442))
- Updated `list-backups` admin command to output one backup per line. ([#1394](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1394))
- Improved URL preview fetching with a more compatible user agent for sites like YouTube Music. Added `!admin media delete-url-preview <url>` command to clear cached URL previews that were stuck and broken. ([#1434](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1434))
- Improved URL preview fetching with a more compatible user agent for sites like YouTube Music. Added `!admin media delete-url-preview <url>` command to clear cached URL previews that were stuck and
broken. ([#1434](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1434))
## Bugfixes
- Removed non-compliant nor functional room alias lookups over federation. Contributed by @nex ([#1393](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1393))
- Removed ability to set rocksdb as read only. Doing so would cause unintentional and buggy behaviour. Contributed by @Terryiscool160. ([#1418](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1418))
- Fixed a startup crash in the sender service if we can't detect the number of CPU cores, even if the `sender_workers` config option is set correctly. Contributed by @katie. ([#1421](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1421))
- Removed ability to set rocksdb as read only. Doing so would cause unintentional and buggy behaviour. Contributed by @Terryiscool160.
([#1418](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1418))
- Fixed a startup crash in the sender service if we can't detect the number of CPU cores, even if the `sender_workers` config option is set correctly. Contributed by @katie.
([#1421](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1421))
- Removed the `allow_public_room_directory_without_auth` config option. Contributed by @0xnim. ([#1441](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1441))
- Fixed sliding sync v5 list ranges always starting from 0, causing extra rooms to be unnecessarily processed and returned. Contributed by @0xnim ([#1445](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1445))
- Fixed a bug that (repairably) caused a room split between continuwuity and non-continuwuity servers when the room had both `m.room.policy` and `org.matrix.msc4284.policy` in its room state. Contributed by @nex ([#1481](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1481))
- Fixed sliding sync v5 list ranges always starting from 0, causing extra rooms to be unnecessarily processed and returned. Contributed by @0xnim
([#1445](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1445))
- Fixed a bug that (repairably) caused a room split between continuwuity and non-continuwuity servers when the room had both `m.room.policy` and `org.matrix.msc4284.policy` in its room state.
Contributed by @nex ([#1481](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1481))
- Fixed `!admin media delete --mxc <url>` responding with an error message when the media was deleted successfully. Contributed by @lynxize
- Fixed spurious 404 media errors in the logs. Contributed by @benbot.
- Fixed spurious warn about needed backfill via federation for non-federated rooms. Contributed by @kraem.
@@ -221,19 +334,15 @@
## Features
- Added unstable support for [MSC4406:
`M_SENDER_IGNORED`](https://github.com/matrix-org/matrix-spec-proposals/pull/4406).
Contributed by @nex ([#1308](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1308))
- Introduce a resolver command to allow flushing a server from the cache or to flush the complete cache. Contributed by
@Omar007 ([#1349](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1349))
- Improved the handling of restricted join rules and improved the performance of local-first joins. Contributed by
@nex. ([#1368](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1368))
- You can now set a custom User Agent for URL previews; the default one has been modified to be less likely to be
rejected. Contributed by @trashpanda ([#1372](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1372))
`M_SENDER_IGNORED`](https://github.com/matrix-org/matrix-spec-proposals/pull/4406). Contributed by @nex ([#1308](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1308))
- Introduce a resolver command to allow flushing a server from the cache or to flush the complete cache. Contributed by @Omar007
([#1349](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1349))
- Improved the handling of restricted join rules and improved the performance of local-first joins. Contributed by @nex. ([#1368](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1368))
- You can now set a custom User Agent for URL previews; the default one has been modified to be less likely to be rejected. Contributed by @trashpanda
([#1372](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1372))
- Improved the first-time setup experience for new homeserver administrators:
- Account registration is disabled on the first run, except for with a new special registration token that is logged
to the console.
- Other helpful information is logged to the console as well, including a giant warning if open registration is
enabled.
- Account registration is disabled on the first run, except for with a new special registration token that is logged to the console.
- Other helpful information is logged to the console as well, including a giant warning if open registration is enabled.
- The default index page now says to check the console for setup instructions if no accounts have been created.
- Once the first admin account is created, an improved welcome message is sent to the admin room.
@@ -241,10 +350,10 @@
## Bugfixes
- Fixed invites sent to other users in the same homeserver not being properly sent down sync. Users with missing or
broken invites should clear their client caches after updating to make them appear. ([#1249](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1249))
- LDAP-enabled servers will no longer have all admins demoted when LDAP-controlled admins are not configured.
Contributed by @Jade ([#1307](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1307))
- Fixed invites sent to other users in the same homeserver not being properly sent down sync. Users with missing or broken invites should clear their client caches after updating to make them appear.
([#1249](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1249))
- LDAP-enabled servers will no longer have all admins demoted when LDAP-controlled admins are not configured. Contributed by @Jade
([#1307](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1307))
- Fixed sliding sync not resolving wildcard state key requests, enabling Video/Audio calls in Element X. ([#1370](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1370))
## Misc
@@ -255,100 +364,78 @@
## Features
- The announcement checker will now announce errors it encounters in the first run to the admin room, plus a few other
misc improvements. Contributed by @Jade ([#1288](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1288))
- Drastically improved the performance and reliability of account deactivations. Contributed by
@nex ([#1314](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1314))
- Refuse to process requests for and events in rooms that we no longer have any local users in (reduces state resets
and improves performance). Contributed by
@nex ([#1316](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1316))
- Added server-specific admin API routes to ban and unban rooms, for use with moderation bots. Contributed by @nex
([#1301](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1301))
- The announcement checker will now announce errors it encounters in the first run to the admin room, plus a few other misc improvements. Contributed by @Jade
([#1288](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1288))
- Drastically improved the performance and reliability of account deactivations. Contributed by @nex ([#1314](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1314))
- Refuse to process requests for and events in rooms that we no longer have any local users in (reduces state resets and improves performance). Contributed by @nex
([#1316](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1316))
- Added server-specific admin API routes to ban and unban rooms, for use with moderation bots. Contributed by @nex ([#1301](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1301))
## Bugfixes
- Fix the generated configuration containing uncommented optional sections. Contributed by
@Jade ([#1290](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1290))
- Fixed specification non-compliance when handling remote media errors. Contributed by
@nex ([#1298](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1298))
- UIAA requests which check for out-of-band success (sent by matrix-js-sdk) will no longer create unhelpful errors in
the logs. Contributed by @ginger ([#1305](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1305))
- Use exists instead of contains to save writing to a buffer in `src/service/users/mod.rs`: `is_login_disabled`.
Contributed
by @aprilgrimoire. ([#1340](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1340))
- Fixed backtraces being swallowed during panics. Contributed by
@jade ([#1337](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1337))
- Fixed a potential vulnerability that could allow an evil remote server to return malicious events during the room join
and knock process. Contributed by @nex, reported by violet & [mat](https://matdoes.dev).
- Fixed a race condition that could result in outlier PDUs being incorrectly marked as visible to a remote server.
Contributed by @nex, reported by violet & [mat](https://matdoes.dev).
- Fix the generated configuration containing uncommented optional sections. Contributed by @Jade ([#1290](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1290))
- Fixed specification non-compliance when handling remote media errors. Contributed by @nex ([#1298](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1298))
- UIAA requests which check for out-of-band success (sent by matrix-js-sdk) will no longer create unhelpful errors in the logs. Contributed by @ginger
([#1305](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1305))
- Use exists instead of contains to save writing to a buffer in `src/service/users/mod.rs`: `is_login_disabled`. Contributed by @aprilgrimoire.
([#1340](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1340))
- Fixed backtraces being swallowed during panics. Contributed by @jade ([#1337](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1337))
- Fixed a potential vulnerability that could allow an evil remote server to return malicious events during the room join and knock process. Contributed by @nex, reported by
violet & [mat](https://matdoes.dev).
- Fixed a race condition that could result in outlier PDUs being incorrectly marked as visible to a remote server. Contributed by @nex, reported by violet & [mat](https://matdoes.dev).
- ACLs are no longer case-sensitive. Contributed by @nex, reported by [vel](matrix:u/vel:nhjkl.com?action=chat).
## Docs
- Fixed Fedora install instructions. Contributed by
@julian45 ([#1342](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1342))
- Fixed Fedora install instructions. Contributed by @julian45 ([#1342](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1342))
# Continuwuity 0.5.3 (2026-01-12)
## Features
- Improve the display of nested configuration with the `!admin server show-config` command. Contributed by
@Jade ([#1279](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1279))
- Improve the display of nested configuration with the `!admin server show-config` command. Contributed by @Jade ([#1279](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1279))
## Bugfixes
- Fixed `M_BAD_JSON` error when sending invites to other servers or when providing joins. Contributed by
@nex ([#1286](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1286))
- Fixed `M_BAD_JSON` error when sending invites to other servers or when providing joins. Contributed by @nex ([#1286](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1286))
## Docs
- Improve admin command documentation generation. Contributed by
@ginger ([#1280](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1280))
- Improve admin command documentation generation. Contributed by @ginger ([#1280](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1280))
## Misc
- Improve timeout-related code for federation and URL previews. Contributed by
@Jade ([#1278](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1278))
- Improve timeout-related code for federation and URL previews. Contributed by @Jade ([#1278](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1278))
# Continuwuity 0.5.2 (2026-01-09)
## Features
- Added support for issuing additional registration tokens, stored in the database, which supplement the existing
registration token hardcoded in the config file. These tokens may optionally expire after a certain number of uses or
after a certain amount of time has passed. Additionally, the `registration_token_file` configuration option is
superseded by this feature and **has been removed**. Use the new `!admin token` command family to manage registration
tokens. Contributed by @ginger (#783).
- Implemented a configuration defined admin list independent of the admin room. Contributed by
@Terryiscool160. ([#1253](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1253))
- Added support for invite and join anti-spam via Draupnir and Meowlnir, similar to that of synapse-http-antispam.
Contributed by @nex. ([#1263](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1263))
- Implemented account locking functionality, to complement user suspension. Contributed by
@nex. ([#1266](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1266))
- Added admin command to forcefully log out all of a user's existing sessions. Contributed by
@nex. ([#1271](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1271))
- Added support for issuing additional registration tokens, stored in the database, which supplement the existing registration token hardcoded in the config file. These tokens may optionally expire
after a certain number of uses or after a certain amount of time has passed. Additionally, the `registration_token_file` configuration option is superseded by this feature and **has been removed**.
Use the new `!admin token` command family to manage registration tokens. Contributed by @ginger (#783).
- Implemented a configuration defined admin list independent of the admin room. Contributed by @Terryiscool160. ([#1253](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1253))
- Added support for invite and join anti-spam via Draupnir and Meowlnir, similar to that of synapse-http-antispam. Contributed by @nex.
([#1263](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1263))
- Implemented account locking functionality, to complement user suspension. Contributed by @nex. ([#1266](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1266))
- Added admin command to forcefully log out all of a user's existing sessions. Contributed by @nex. ([#1271](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1271))
- Implemented toggling the ability for an account to log in without mutating any of its data. Contributed by @nex. (
[#1272](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1272))
- Add support for custom room create event timestamps, to allow generating custom prefixes in hashed room IDs.
Contributed by @nex. ([#1277](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1277))
- Certain potentially dangerous admin commands are now restricted to only be usable in the admin room and server
console. Contributed by @ginger.
- Add support for custom room create event timestamps, to allow generating custom prefixes in hashed room IDs. Contributed by @nex.
([#1277](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1277))
- Certain potentially dangerous admin commands are now restricted to only be usable in the admin room and server console. Contributed by @ginger.
## Bugfixes
- Fixed unreliable room summary fetching and improved error messages. Contributed by
@nex. ([#1257](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1257))
- Client requested timeout parameter is now applied to e2ee key lookups and claims. Related federation requests are now
also concurrent. Contributed by @nex. ([#1261](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1261))
- Fixed the whoami endpoint returning HTTP 404 instead of HTTP 403, which confused some appservices. Contributed by
@nex. ([#1276](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1276))
- Fixed unreliable room summary fetching and improved error messages. Contributed by @nex. ([#1257](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1257))
- Client requested timeout parameter is now applied to e2ee key lookups and claims. Related federation requests are now also concurrent. Contributed by @nex.
([#1261](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1261))
- Fixed the whoami endpoint returning HTTP 404 instead of HTTP 403, which confused some appservices. Contributed by @nex. ([#1276](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1276))
## Misc
- The `console` feature is now enabled by default, allowing the server console to be used for running admin commands
directly. To automatically open the console on startup, set the `admin_console_automatic` config option to `true`.
Contributed by @ginger.
- The `console` feature is now enabled by default, allowing the server console to be used for running admin commands directly. To automatically open the console on startup, set the
`admin_console_automatic` config option to `true`. Contributed by @ginger.
- We now (finally) document our container image mirrors. Contributed by @Jade
# Continuwuity 0.5.0 (2025-12-30)
@@ -357,12 +444,9 @@
## Features
- Enabled the OTLP exporter in default builds, and allow configuring the exporter protocol. (
@Jade). ([#1251](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1251))
- Enabled the OTLP exporter in default builds, and allow configuring the exporter protocol. (@Jade). ([#1251](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1251))
## Bug Fixes
- Don't allow admin room upgrades, as this can break the admin room (
@timedout) ([#1245](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1245))
- Fix invalid creators in power levels during upgrade to v12 (
@timedout) ([#1245](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1245))
- Don't allow admin room upgrades, as this can break the admin room (@timedout) ([#1245](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1245))
- Fix invalid creators in power levels during upgrade to v12 (@timedout) ([#1245](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/1245))
Generated
+124 -119
View File
@@ -227,9 +227,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.91"
version = "0.1.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec"
checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
dependencies = [
"proc-macro2",
"quote",
@@ -259,9 +259,9 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "aws-lc-rs"
version = "1.17.3"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00bdb5da18dac48ca2cc7cd4a98e533e8635a58e2361d13a1a4ee3888e0d72f1"
checksum = "ce2b2dcc879c3bae0d371e77c99f2238400ef24ec001394befa67b6e543add9e"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -269,9 +269,9 @@ dependencies = [
[[package]]
name = "aws-lc-sys"
version = "0.43.0"
version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43103168cc76fe62678a375e722fc9cb3a0146159ac5828bc4f0dfd755c2224c"
checksum = "f09fae7be8bb3174e05c6afdb34199e6dc0c7c04ba9fa237b1967adfbde27483"
dependencies = [
"cc",
"cmake",
@@ -428,6 +428,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "base64"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
[[package]]
name = "base64ct"
version = "1.8.3"
@@ -571,9 +577,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "bytesize"
version = "2.4.2"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7c8918969267b2932ffd5655509bbbea0833823058c378876953217f5fc50e"
checksum = "7354288c522e7e980fafd2075d63d1285794c3a6a16cdd492f189ea406e5f18b"
[[package]]
name = "bzip2-sys"
@@ -615,7 +621,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
@@ -626,7 +632,7 @@ checksum = "aa61aec073ec94791433ddf3df2323ff9d1711557c2a0eefb0f99cb4f8dca520"
dependencies = [
"semver",
"serde",
"toml 1.1.3+spec-1.1.0",
"toml 1.1.4+spec-1.1.0",
]
[[package]]
@@ -709,9 +715,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.6.4"
version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7"
checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca"
dependencies = [
"clap_builder",
"clap_derive",
@@ -719,9 +725,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.6.2"
version = "4.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b"
checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889"
dependencies = [
"anstyle",
"clap_lex",
@@ -816,7 +822,7 @@ dependencies = [
[[package]]
name = "conduwuit"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"aws-lc-rs",
"clap",
@@ -854,7 +860,7 @@ dependencies = [
[[package]]
name = "conduwuit_admin"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"assign",
"clap",
@@ -880,7 +886,7 @@ dependencies = [
[[package]]
name = "conduwuit_api"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"assign",
"async-trait",
@@ -918,7 +924,7 @@ dependencies = [
[[package]]
name = "conduwuit_build_metadata"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"built",
"cargo_metadata",
@@ -926,7 +932,7 @@ dependencies = [
[[package]]
name = "conduwuit_core"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"argon2",
"arrayvec",
@@ -979,13 +985,13 @@ dependencies = [
"sha2 0.11.0",
"smallstr",
"smallvec",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tikv-jemalloc-ctl",
"tikv-jemalloc-sys",
"tikv-jemallocator",
"tokio",
"tokio-metrics",
"toml 1.1.3+spec-1.1.0",
"toml 1.1.4+spec-1.1.0",
"tracing",
"tracing-core",
"tracing-subscriber",
@@ -994,7 +1000,7 @@ dependencies = [
[[package]]
name = "conduwuit_database"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"async-channel",
"conduwuit_core",
@@ -1015,7 +1021,7 @@ dependencies = [
[[package]]
name = "conduwuit_macros"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"cargo_toml",
"itertools 0.15.0",
@@ -1026,7 +1032,7 @@ dependencies = [
[[package]]
name = "conduwuit_router"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"assign",
"axum",
@@ -1063,7 +1069,7 @@ dependencies = [
[[package]]
name = "conduwuit_service"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"askama",
"assign",
@@ -1115,7 +1121,7 @@ dependencies = [
[[package]]
name = "conduwuit_web"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"askama",
"assign",
@@ -1140,7 +1146,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tower-http 0.7.0",
"tower-sec-fetch",
"tower-sessions",
@@ -1452,9 +1458,9 @@ dependencies = [
[[package]]
name = "ctor"
version = "1.0.11"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9bb72bb94fdc1bd619f4c18cc91ecf6302aeb333d31b3c6ec0bb841cd920209"
checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d"
dependencies = [
"link-section",
"linktime-proc-macro",
@@ -1655,9 +1661,9 @@ dependencies = [
[[package]]
name = "dtor"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d738e43aa64edab57c983d56de890d65fea7dc05605490c74451ce721dfd84b"
checksum = "cd3f6c362b2bbd7063090886afd78978f5dbf1f11da7efcc40f81d32c943fac1"
dependencies = [
"linktime-proc-macro",
]
@@ -1789,7 +1795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -1939,9 +1945,9 @@ dependencies = [
[[package]]
name = "futures"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218"
checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"
dependencies = [
"futures-channel",
"futures-core",
@@ -1954,9 +1960,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae"
checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
dependencies = [
"futures-core",
"futures-sink",
@@ -1964,15 +1970,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
[[package]]
name = "futures-executor"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458"
checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"
dependencies = [
"futures-core",
"futures-task",
@@ -1981,32 +1987,32 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a"
checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
[[package]]
name = "futures-macro"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b"
checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
"syn 3.0.3",
]
[[package]]
name = "futures-sink"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307"
checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
[[package]]
name = "futures-task"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
[[package]]
name = "futures-timer"
@@ -2016,9 +2022,9 @@ checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968"
[[package]]
name = "futures-util"
version = "0.3.33"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
dependencies = [
"futures-channel",
"futures-core",
@@ -2293,7 +2299,7 @@ dependencies = [
"ipnet",
"jni",
"rand 0.10.2",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tinyvec",
"tokio",
"tracing",
@@ -2315,7 +2321,7 @@ dependencies = [
"rand 0.10.2",
"ring",
"serde",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tinyvec",
"tracing",
"url",
@@ -2343,7 +2349,7 @@ dependencies = [
"serde",
"smallvec",
"system-configuration",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tokio",
"tracing",
]
@@ -2402,9 +2408,9 @@ dependencies = [
[[package]]
name = "http"
version = "1.4.2"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425"
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
"bytes",
"itoa",
@@ -2431,9 +2437,9 @@ dependencies = [
[[package]]
name = "http-body-util"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2"
checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
dependencies = [
"bytes",
"futures-core",
@@ -2823,7 +2829,7 @@ dependencies = [
"jni-sys",
"log",
"simd_cesu8",
"thiserror 2.0.19",
"thiserror 2.0.20",
"walkdir",
"windows-link",
]
@@ -2943,12 +2949,12 @@ dependencies = [
[[package]]
name = "lettre"
version = "0.11.22"
version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0da65617f6cb926332d039cb578aad56178da86e128db6a1b09f4c94fa5b3349"
checksum = "f2c646bd5cc763b1087b15493e29a64be6147ba8f19342004fa52048ee596eae"
dependencies = [
"async-trait",
"base64 0.22.1",
"base64 0.23.1",
"email-encoding",
"email_address",
"fastrand",
@@ -3016,9 +3022,9 @@ dependencies = [
[[package]]
name = "link-section"
version = "0.19.1"
version = "0.19.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dc98458dfe90986c5e2f6ddcf68360c7e5c4252600153e06aa4ee8176c0f8d1"
checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9"
[[package]]
name = "linked-hash-map"
@@ -3028,9 +3034,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linktime-proc-macro"
version = "0.2.0"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c7b0a3383c2a1002d11349c92c85a666a5fb679e96c79d782cf0dbe557fd6ee"
checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616"
[[package]]
name = "linux-raw-sys"
@@ -3686,7 +3692,7 @@ dependencies = [
"futures-sink",
"js-sys",
"pin-project-lite",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
@@ -3716,7 +3722,7 @@ dependencies = [
"opentelemetry_sdk",
"prost",
"reqwest 0.13.4",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tokio",
"tonic",
"tonic-types",
@@ -3748,7 +3754,7 @@ dependencies = [
"percent-encoding",
"portable-atomic",
"rand 0.9.5",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tokio",
"tokio-stream",
]
@@ -4188,7 +4194,7 @@ dependencies = [
"rustc-hash",
"rustls",
"socket2",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tokio",
"tracing",
"web-time",
@@ -4211,7 +4217,7 @@ dependencies = [
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tinyvec",
"tracing",
"web-time",
@@ -4228,7 +4234,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -4505,9 +4511,9 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7"
[[package]]
name = "resolvematrix"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a68b9735d8c1096d8152d4dfb5a705c0135dd14d181542fd87301f8d3cb4ed03"
checksum = "f072176a8b0cbe7c3df2281991ef00a09889d8ec789f2878e7fee43a3b978a6f"
dependencies = [
"futures",
"hickory-resolver",
@@ -4516,7 +4522,7 @@ dependencies = [
"reqwest 0.13.4",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
@@ -4567,7 +4573,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.16.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"assign",
"js_int",
@@ -4586,7 +4592,7 @@ dependencies = [
[[package]]
name = "ruma-appservice-api"
version = "0.16.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"js_int",
"ruma-common",
@@ -4598,7 +4604,7 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.24.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"as_variant",
"assign",
@@ -4612,7 +4618,7 @@ dependencies = [
"serde",
"serde_html_form",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"url",
"web-time",
]
@@ -4620,7 +4626,7 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.19.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"as_variant",
"base64 0.22.1",
@@ -4640,7 +4646,7 @@ dependencies = [
"serde",
"serde_html_form",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"time",
"tracing",
"url",
@@ -4653,7 +4659,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.34.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"as_variant",
"indexmap 2.14.0",
@@ -4664,7 +4670,7 @@ dependencies = [
"ruma-macros",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
"web-time",
"wildmatch",
@@ -4674,7 +4680,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.15.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"bytes",
"headers",
@@ -4690,23 +4696,23 @@ dependencies = [
"ruma-signatures",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
[[package]]
name = "ruma-identifiers-validation"
version = "0.12.1"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"js_int",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
name = "ruma-macros"
version = "0.19.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"as_variant",
"cfg-if",
@@ -4716,13 +4722,13 @@ dependencies = [
"ruma-identifiers-validation",
"serde",
"syn 2.0.119",
"toml 1.1.3+spec-1.1.0",
"toml 1.1.4+spec-1.1.0",
]
[[package]]
name = "ruma-push-gateway-api"
version = "0.15.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"js_int",
"ruma-common",
@@ -4734,7 +4740,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.21.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
@@ -4745,13 +4751,13 @@ dependencies = [
"ruma-events",
"serde_json",
"sha2 0.10.9",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
name = "ruma-state-res"
version = "0.17.0"
source = "git+https://github.com/ruma/ruma.git?rev=e7284c31da289f0a3b885191f5b2b6b307fa059f#e7284c31da289f0a3b885191f5b2b6b307fa059f"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"js_int",
"ruma-common",
@@ -4759,13 +4765,13 @@ dependencies = [
"ruma-signatures",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
[[package]]
name = "ruminuwuity"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"assign",
"ruma",
@@ -4832,14 +4838,14 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
name = "rustls"
version = "0.23.42"
version = "0.23.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"
checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
dependencies = [
"aws-lc-rs",
"log",
@@ -4891,7 +4897,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -4928,7 +4934,7 @@ dependencies = [
"futures-util",
"pin-project",
"thingbuf",
"thiserror 2.0.19",
"thiserror 2.0.20",
"unicode-segmentation",
]
@@ -5178,7 +5184,7 @@ dependencies = [
"rand 0.9.5",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"time",
"url",
"uuid",
@@ -5699,9 +5705,9 @@ dependencies = [
[[package]]
name = "termimad"
version = "0.35.1"
version = "0.35.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d53d4b1294b87e81925b7ae7f8f4d000376e3a5b3349d978429665428a793fcb"
checksum = "bc986efe2e680fbd1051790103f01b176eb6b1bbc926e41d46adfe44ea43614c"
dependencies = [
"coolor",
"crokey",
@@ -5709,7 +5715,7 @@ dependencies = [
"lazy-regex",
"minimad",
"serde",
"thiserror 2.0.19",
"thiserror 2.0.20",
"unicode-width 0.1.14",
]
@@ -5734,11 +5740,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.19"
version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
dependencies = [
"thiserror-impl 2.0.19",
"thiserror-impl 2.0.20",
]
[[package]]
@@ -5754,9 +5760,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.19"
version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
dependencies = [
"proc-macro2",
"quote",
@@ -5943,9 +5949,9 @@ dependencies = [
[[package]]
name = "toml"
version = "1.1.3+spec-1.1.0"
version = "1.1.4+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53c96ecdfa941c8fc4fcaed14f99ada8ebed502eef533015095a07e3301d4c3c"
checksum = "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5"
dependencies = [
"indexmap 2.14.0",
"serde_core",
@@ -6002,9 +6008,9 @@ dependencies = [
[[package]]
name = "toml_parser"
version = "1.1.2+spec-1.1.0"
version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
dependencies = [
"winnow 1.0.3",
]
@@ -6210,7 +6216,7 @@ dependencies = [
"rand 0.9.5",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"time",
"tokio",
"tracing",
@@ -6433,12 +6439,11 @@ dependencies = [
[[package]]
name = "validator"
version = "0.20.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43fb22e1a008ece370ce08a3e9e4447a910e92621bb49b85d6e48a45397e7cfa"
checksum = "c3d68c6633c483df6780cc5277a417c7c2d1bceee2649d06c8ab6b0fd2dd3c81"
dependencies = [
"idna",
"once_cell",
"regex",
"serde",
"serde_derive",
@@ -6670,7 +6675,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -6874,7 +6879,7 @@ dependencies = [
[[package]]
name = "xtask"
version = "26.7.2"
version = "26.8.1"
dependencies = [
"askama",
"cargo_metadata",
+5 -4
View File
@@ -12,7 +12,7 @@ license = "Apache-2.0"
# See also `rust-toolchain.toml`
readme = "README.md"
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
version = "26.7.2"
version = "26.8.1"
[workspace.metadata.crane]
name = "conduwuit"
@@ -343,7 +343,7 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
git = "https://github.com/ruma/ruma.git"
rev = "e7284c31da289f0a3b885191f5b2b6b307fa059f"
rev = "c1100793d2fd464be34052773360f3f3773d0fc4"
features = [
"appservice-api-c",
"client-api",
@@ -358,7 +358,6 @@ features = [
"compat-get-3pids",
"unstable-msc2867",
"unstable-msc2870",
"unstable-msc3061",
"unstable-msc3814",
"unstable-msc3245",
"unstable-msc3381",
@@ -377,6 +376,8 @@ features = [
"unstable-msc4293",
"unstable-msc4406",
"unstable-msc4439",
"unstable-msc4354",
"unstable-msc4480",
"unstable-msc4466",
"unstable-extensible-events",
]
@@ -562,7 +563,7 @@ features = ["std"]
version = "0.3.0"
[workspace.dependencies.resolvematrix]
version = "1.2.0"
version = "1.3.0"
[workspace.dependencies.serde_urlencoded]
version = "0.7.1"
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""
Nexy's magic changelog linkifier script! Linkify that changelog! Make it clickable!
The masses LOVE being able to click things!
Usage:
python3 bin/linkify-changelog.py
Assumes CHANGELOG.md is in the current directory.
Will not write if subsequent calls to linkify would change the output (to avoid nested linkification).
"""
import os
import re
import shutil
def linkify(text: str) -> str:
# ARCANE REGEX RUNES I CALL UPON THEE TO LINKIFY MY SHIT! GO!
# Linkify issues and PRs
reformatted = re.sub(
r"\(#(\d{4})\)",
r"([#\1](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/\1))",
text
)
# Linkify MSCs
reformatted = re.sub(
r"([^\[])(MSC(\d{4}))([^\]])",
r"\1[\2](https://github.com/matrix-org/matrix-spec-proposals/pull/\3)\4",
reformatted
)
return reformatted
def main():
with open("CHANGELOG.md") as fd:
changelog = fd.read()
linkified = linkify(changelog)
# verify that double-writes are idempotent
linkified2 = linkify(linkified)
assert linkified == linkified2, "Double-linkification was not idempotent!"
try:
os.mkdir("out")
except FileExistsError:
pass
shutil.copy("CHANGELOG.md", "out" + os.sep + "CHANGELOG.md.old")
with open("CHANGELOG.md", "w") as fd:
fd.write(linkified)
if __name__ == "__main__":
main()
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# This script is supposed to be run by cargo-release.
# It updates the changelog as necessary.
set -euo pipefail
cd $WORKSPACE_ROOT
towncrier build --name Continuwuity --version $NEW_VERSION --date "$(date -I)"
"`dirname $0`"/linkify-changelog.py
-1
View File
@@ -1 +0,0 @@
**TODO - embargoed until next release** (maintainers see security issue 10 when writing rls notes). Contributed by @eleboucher.
+169 -23
View File
@@ -170,46 +170,129 @@
#
#db_write_buffer_capacity_mb = varies by system
# This item is undocumented. Please contribute documentation for it.
# The maximum number of Persisted Data Units (PDUs) to cache.
# Accepts any 32-bit integer.
#
# PDUs are events broadcast from one homeserver to any others that have
# joined the same room (identified by Room ID). They are persisted in
# long-term storage and record the history of messages and state
# for a room.
#
# An example of a PDU would be a message or joining a room.
#
# Setting this higher might be useful if the server has a large memory
# capacity and is noticeably I/O limited.
#
# This defaults to 100,000 + (10,000 * CPU core count)
#
#pdu_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# The maximum number of auth chains to cache.
# Accepts any 32-bit integer.
#
# When determining is a user is authorized to send an event,
# the server will first check the cache for an auth chain.
# If the auth chain is not present in the cache,
# The server will read the auth chain from the database
# and add it to the cache.
#
# This defaults to 100,000 + (10,000 * CPU core count)
#
#auth_chain_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for eventid data references.
# Accepts any 32-bit integer.
#
# Each matrix event can be referenced in the database via either
# an eventid (string) or a shorteventid (64-bit integer).
# This caps the capacity of cached eventids referenced
# by their shorteventid.
#
# This defaults to 100,000 + (50,000 * CPU core count)
#
#shorteventid_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for eventid data references.
# Accepts any 32-bit integer.
#
# Each matrix event can be referenced in the database via either
# an eventid (string) or a shorteventid (64-bit integer).
# This caps the capacity of cached shorteventids referenced
# by their eventid.
#
# This defaults to 100,000 + (25,000 * CPU core count)
#
#eventidshort_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for pdu data references.
# Accepts any 32-bit integer.
#
# This caps the capacity of cached pdus referenced
# by their eventid.
#
# This defaults to 100,000 + (25,000 * CPU core count)
#
#eventid_pdu_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for state key data references.
# Accepts any 32-bit integer.
#
# State keys are used by the server to verify that a token
# from a third-party invite event was actually generated
# by the server where the room resides.
#
# These state keys can be referenced in the database via either
# a statekey (string) or a shortstatekey (64-bit integer).
# This caps the capacity of cached statekeys referenced
# by shortstatekeys.
#
# This defaults to 100,000 + (10,000 * CPU core count)
#
#shortstatekey_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for state key data references.
# Accepts any 32-bit integer.
#
# State keys are used by the server to verify that a token
# from a third-party invite event was actually generated
# by the server where the room resides.
#
# These state keys can be referenced in the database via either
# a statekey (string) or a shortstatekey (64-bit integer).
# This caps the capacity of cached shortstatekeys referenced
# by statekeys.
#
# This defaults to 100,000 + (10,000 * CPU core count)
#
#statekeyshort_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for event_data references scoped
# by server_name.
# Accepts any 32-bit integer.
#
# Event data can be referenced in the database by server name.
# This is useful if the server needs to clear all events associated
# with a particular federated server, for example.
# This caps the capacity of cached event_data referenced
# by server_name.
#
# This defaults to 500,000 + (100,000 * CPU core count)
#
#servernameevent_data_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
# Determines the cache size for room states.
# Accepts any 32-bit integer.
#
# To ensure data integrity of room events across asynchronous
# requests from federated servers, Matrix tracks the state
# of a room using a statehash and the changes since the
# previous (parent) statehash.
# This caps the capacity of cached room state data.
#
# This defaults to 100 * CPU core count.
#
#stateinfo_cache_capacity = varies by system
# This item is undocumented. Please contribute documentation for it.
#
#roomid_spacehierarchy_cache_capacity = varies by system
# 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
@@ -347,7 +430,13 @@
#
#max_request_size = 20971520
# This item is undocumented. Please contribute documentation for it.
# Maximum number of prev_events the server will request from
# other servers.
#
# When requesting room events from another server, this server will
# specify a maximum prev_events for the other server to return in its
# response. This can be used for things like backfilling room data and
# getting missing events.
#
#max_fetch_prev_events = 1024
@@ -360,6 +449,10 @@
#
#max_concurrent_inbound_transactions = 150
# Maximum number of federation PDUs queued while completing a remote join.
#
#remote_join_pdu_queue_capacity = 50
# Maximum age (in seconds) for cached federation transaction responses.
# Entries older than this will be removed during cleanup.
#
@@ -455,9 +548,28 @@
#
#sender_idle_timeout = 180
# Federation sender transaction retry backoff limit (seconds).
# Federation sender retry backoff base (seconds).
#
#sender_retry_backoff_limit = 86400
# This period will be doubled for each failed federation request until
# either the remote server becomes healthy, or the value is clamped to
# `sender_retry_backoff_limit`.
#
#sender_retry_backoff_base = 10
# Federation sender retry backoff limit (seconds).
#
# Defaults to one week. Requests will never stop being retried if their
# backoff period exceeds this value, however the maximum amount of time
# between each request will instead be clamped at this value.
#
# The backoff period is reset if a successful request is made, or
# continuwuity receives a request from the server that is being backed off
# from.
#
# It is not recommended to lower this value below 48 hours or above
# 1 year.
#
#sender_retry_backoff_limit = 604800
# Appservice URL request connection timeout. Defaults to 35 seconds as
# generally appservices are hosted within the same network.
@@ -732,11 +844,15 @@
#
#tracing_flame = false
# This item is undocumented. Please contribute documentation for it.
# Which log level tracing_flame will trace.
#
# See "tracing_flame" for more details.
#
#tracing_flame_filter = "info"
# This item is undocumented. Please contribute documentation for it.
# The output path for tracing_flame data.
#
# See "tracing_flame" for more details.
#
#tracing_flame_output_path = "./tracing.folded"
@@ -964,7 +1080,7 @@
#
#rocksdb_log_level = "error"
# This item is undocumented. Please contribute documentation for it.
# Whether to output RocksDB errors to stderr.
#
#rocksdb_log_stderr = false
@@ -1214,7 +1330,17 @@
#
#emergency_password =
# This item is undocumented. Please contribute documentation for it.
# Specifies the path where push notifications will be sent to a
# push gateway.
#
# When a Matrix client registers for push notifications, it will specify
# a push gateway url where notification events will be sent.
# According to the current spec for Matrix Push Gateways, the path should
# always be "/_matrix/push/v1/notify".
# You should only change this if you have configured your own push gateway
# that requires a different path.
#
# For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
#
#notification_push_path = "/_matrix/push/v1/notify"
@@ -1306,6 +1432,12 @@
#
#allow_incoming_typing = true
# Allow the use of unstable persistent "sticky events" ([MSC4354])
#
# MSC4354: https://c10y.cc/MSC4354
#
#allow_sticky_events = false
# Maximum time federation user can indicate typing.
#
#typing_federation_timeout_s = 30
@@ -1365,7 +1497,10 @@
#
#allow_legacy_media = true
# This item is undocumented. Please contribute documentation for it.
# If set to true, prevents fetching new legacy remote media.
#
# Legacy media may still be accessible if it was already fetched
# previously and allow_legacy_media is true.
#
#freeze_legacy_media = true
@@ -1595,7 +1730,7 @@
# User agent that is used specifically when fetching url previews.
#
#url_preview_user_agent = "continuwuity/<version> (bot; +https://continuwuity.org)"
#url_preview_user_agent = "continuwuity/<version> (embedbot; facebookexternalhit/1.1; +https://continuwuity.org)"
# Determines whether audio and video files will be downloaded for URL
# previews.
@@ -1773,7 +1908,18 @@
#
#tokio_console = false
# This item is undocumented. Please contribute documentation for it.
# A list of flags that modify startup behavior.
# Accepts an array of strings.
#
# During startup, the program will check for the presence of certain
# strings in this array. Matching values will modify how the program runs
# those startup tasks.
#
# If this variable is empty or contains no matches, the server will start
# normally.
#
# Currently this only checks for "smoke" which enables "Smoketest mode."
# This mode exits the program after running startup tasks.
#
#test = false
+19 -11
View File
@@ -20,17 +20,19 @@ 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
```
~~~txt
!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`
@@ -51,3 +53,9 @@ To remove an appservice go to your admin room and execute
`!admin appservices unregister <name>`
where `<name>` one of the output of `appservices list`.
## Caveats
### Docker DNS
If you follow the [DNS tuning guide](./guides/dns.mdx#for-docker-users) and mount a custom `/etc/resolv.conf`, you may not be able to connect to appservices' containers using their hostnames. Follow the [workaround in the guide](./guides/dns.mdx#for-docker-users) to connect to your appservice using static IPs.
+3 -3
View File
@@ -3,11 +3,11 @@
Matrix supports two types of calls:
- Element Call powered by [MatrixRTC](https://half-shot.github.io/msc-crafter/#msc/4143) and [LiveKit](https://github.com/livekit/livekit)
- Legacy calls, sometimes using Jitsi
- Legacy calls, supported by a STUN/TURN server.
Both types of calls are supported by different sets of clients, but most clients are moving towards MatrixRTC / Element Call.
For either one to work correctly, you have to do some additional setup.
For either one to work correctly, you have to do some additional setup:
- For legacy calls to work, you need to set up a TURN/STUN server. [Read the TURN guide for tips on how to set up coturn](./calls/turn.mdx)
- For MatrixRTC / Element Call to work, you have to set up the LiveKit backend (foci). LiveKit also uses TURN/STUN to increase reliability - you can set up its built-in TURN server, or integrate with an existing one. [Read the LiveKit guide](./calls/livekit.mdx)
- For MatrixRTC / Element Call to work, you have to set up the LiveKit backend. LiveKit also uses TURN/STUN to increase reliability - you can set up its built-in TURN server, or integrate with an existing one. [Read the LiveKit guide](./calls/livekit.mdx)
+274 -228
View File
@@ -1,8 +1,8 @@
# Matrix RTC/Element Call Setup
import { Tab, Tabs} from '@rspress/core/theme';
:::info
This guide assumes that you are using docker compose for deployment. LiveKit only provides Docker images.
:::
# MatrixRTC/Element Call Setup
This guide assumes that you are using docker compose for deployment.
:::tip
You can find help setting up MatrixRTC in our dedicated room - [#matrixrtc:continuwuity.org](https://matrix.to/#/%23matrixrtc%3Acontinuwuity.org)
@@ -10,15 +10,15 @@ You can find help setting up MatrixRTC in our dedicated room - [#matrixrtc:conti
## Instructions
### 1. Domain
### 1. Set up your domain
LiveKit should live on its own domain or subdomain. In this guide we use `livekit.example.com` - this should be replaced with a domain you control.
Make sure the DNS record for the (sub)domain you plan to use is pointed to your server.
### 2. Services
### 2. Set up the LiveKit services
Using LiveKit with Matrix requires two services - LiveKit itself, and a service (`lk-jwt-service`) that grants Matrix users permission to connect to it.
Using LiveKit with Matrix requires two services - LiveKit itself, and a brokering service (`lk-jwt-service`) that grants Matrix users permission to connect to it.
You must generate a key and secret to allow the Matrix service to authenticate with LiveKit. `LK_MATRIX_KEY` should be around 20 random characters, and `LK_MATRIX_SECRET` should be around 64. Remember to replace these with the actual values!
@@ -81,15 +81,23 @@ keys:
LK_MATRIX_KEY: LK_MATRIX_SECRET
# replace these with your key-secret pair. Example:
# APIUxUnMnSkuFWV: t93ZVjPeoEdyx7Wbet3kG4L3NGZIZVEFvqe0UuiVc22A
# do not create rooms by default
room:
auto_create: false
```
Consult [`config-sample.yaml`][livekit-config-sample-yaml] for all LiveKit options.
[livekit-config-sample-yaml]: https://github.com/livekit/livekit/blob/master/config-sample.yaml
#### Firewall hints
You will need to allow ports `7881/tcp` and `50100:50200/udp` through your firewall. If you use UFW, the commands are: `ufw allow 7881/tcp` and `ufw allow 50100:50200/udp`.
### 3. Telling clients where to find LiveKit
To tell clients where to find LiveKit, you need to add the address of your `lk-jwt-service` to the `[global.matrix_rtc]` config section using the `foci` option.
To tell clients where to find LiveKit, you need to add your `lk-jwt-service`'s address to the `foci` field of the `[global.matrix_rtc]` section of your Continuwuity config file.
The variable should be a list of servers serving as MatrixRTC endpoints. Replace the URL with the address you are deploying your instance of lk-jwt-service to:
@@ -100,6 +108,12 @@ foci = [
]
```
If you configure Continuwuity via environment variables, use the following:
```bash
CONTINUWUITY_MATRIX_RTC__FOCI=[{ type = "livekit", livekit_service_url = "https://livekit.example.com" }]
```
This will expose LiveKit information on the following endpoints for clients to discover:
- `/_matrix/client/unstable/org.matrix.msc4143/rtc/transports` (MSC4143 unstable, behind auth)
@@ -115,225 +129,100 @@ All paths should be forwarded to LiveKit by default, with the exception of the f
- `/healthz`
- `/get_token`
<details>
<summary>Example caddy config</summary>
<Tabs groupId="reverse-proxy">
<Tab label="Caddy (on host)">
```
livekit.example.com {
```ini
livekit.example.com {
# for lk-jwt-service
@lk-jwt-service path /sfu/get* /healthz* /get_token*
route @lk-jwt-service {
reverse_proxy 127.0.0.1:8081
}
# for livekit
reverse_proxy 127.0.0.1:7880
# for lk-jwt-service
@lk-jwt-service path /sfu/get* /healthz* /get_token*
route @lk-jwt-service {
reverse_proxy 127.0.0.1:8081
}
```
</details>
# for livekit
reverse_proxy 127.0.0.1:7880
}
```
<details>
<summary>Example nginx config</summary>
</Tab>
<Tab label="Caddy (in container)">
```
server {
server_name livekit.example.com;
Requires `livekit` and `lk-jwt-service` to be on the same Docker bridge network as Caddy.
# for lk-jwt-service
location ~ ^/(sfu/get|healthz|get_token) {
proxy_pass http://127.0.0.1:8081$request_uri;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_buffering off;
}
```ini
livekit.example.com {
# for LiveKit
location / {
proxy_pass http://127.0.0.1:7880$request_uri;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_buffering off;
# websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# for lk-jwt-service
@lk-jwt-service path /sfu/get* /healthz* /get_token*
route @lk-jwt-service {
reverse_proxy lk-jwt-service:8081
}
```
Note that for websockets to work, you need to have this somewhere outside your server block:
```
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
```
# for livekit
reverse_proxy livekit:7880
}
```
</Tab>
<Tab label="Caddy (via Docker labels)">
</details>
<details>
<summary>Example traefik router</summary>
```
# on LiveKit itself
traefik.http.routers.livekit.rule=Host(`livekit.example.com`)
# on the JWT service
traefik.http.routers.livekit-jwt.rule=Host(`livekit.example.com`) && (PathPrefix(`/sfu/get`) || PathPrefix(`/healthz`) || PathPrefix(`/get_token`))
```
</details>
<details>
<summary>Example docker compose file with caddy-docker-proxy labels</summary>
```yaml
# This setup assumes all containers share the same bridge network
services:
lk-jwt-service:
image: ghcr.io/element-hq/lk-jwt-service:latest
container_name: lk-jwt-service
# lk-jwt-service environment config here..
labels:
caddy: livekit.example.com
caddy.@lk-jwt-service.path: "/sfu/get* /healthz* /get_token*"
caddy.reverse_proxy: "@lk-jwt-service {{upstreams 8081}}"
This setup assumes all containers share the same bridge network.
livekit:
image: livekit/livekit-server:latest
container_name: livekit
command: --config /etc/livekit.yaml
restart: unless-stopped
labels:
caddy: livekit.example.com
caddy.reverse_proxy: "{{upstreams 7880}}"
volumes:
- ./livekit.yaml:/etc/livekit.yaml:ro
ports:
- "127.0.0.1:7880:7880/tcp"
- "7881:7881/tcp"
- "50100-50200:50100-50200/udp"
```yaml title="docker-compose.yml" fold height="200" file="../public/calls/livekit.docker-compose.with-caddy-labels.yml"
```
caddy:
image: lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
labels:
# If you already configured `[global.well_known]` with Continuwuity,
# comment out the *_respond labels and add this line
# caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008
caddy.1_respond: /.well-known/matrix/server {"m.server":"matrix.example.com:443"}
caddy.2_respond: /.well-known/matrix/client {"m.server":{"base_url":"https://matrix.example.com"},"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc4143.rtc_foci":[{"type":"livekit","livekit_service_url":"https://livekit.example.com"}]}
([view raw](/calls/livekit.docker-compose.with-caddy-labels.yml))
# If you are having problems with continuwuity serving headers uncomment
# the header section below.
</Tab>
<Tab label="Traefik (via Docker labels)">
# caddy: example.com
# caddy.0_header: "*"
# caddy.0_header.Access-Control-Allow-Origin: "*"
# caddy.0_header.Access-Control-Allow-Methods: "GET, POST, OPTIONS"
# caddy.0_header.Access-Control-Allow-Headers: "Authorization"
# caddy.0_header.Content-Type: "application/json"
Requires `livekit` and `lk-jwt-service` to be on the same Docker bridge network as Traefik.
homeserver:
image: forgejo.ellis.link/continuwuation/continuwuity:latest
restart: unless-stopped
# add additional environment, volume, and network config here...
labels:
caddy: matrix.example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
```
# on LiveKit itself
traefik.http.routers.livekit.rule=Host(`livekit.example.com`)
# on the JWT service
traefik.http.routers.livekit-jwt.rule=Host(`livekit.example.com`) && (PathPrefix(`/sfu/get`) || PathPrefix(`/healthz`) || PathPrefix(`/get_token`))
```
```
</details>
</Tab>
<Tab label="nginx">
```nginx title="nginx.conf" file="../public/calls/livekit.nginx.conf"
```
([view raw](/calls/livekit.nginx.conf))
Note: To enable WebSockets proxying functionality, include the following snippet somewhere outside your server block:
```nginx
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
```
See nginx's [WebSocket proxying documentation][nginx-websockets] for further details.
[nginx-websockets]: https://nginx.org/en/docs/http/websocket.html
</Tab>
</Tabs>
### 6. Start Everything
Start up the services using your usual method - for example `docker compose up -d`.
## Additional TURN configuration
### Using LiveKit's built-in TURN server
LiveKit includes a built-in TURN server which can be used in place of an external option. This TURN server will only work with LiveKit, so you can't use it for legacy Matrix calling or anything else.
If you don't want to set up a separate TURN server, you can enable this with the following changes:
```yaml
### add this to livekit.yaml ###
turn:
enabled: true
udp_port: 3478
relay_range_start: 50300
relay_range_end: 50400
domain: livekit.example.com
```
```yaml
### add these to livekit's docker-compose ###
ports:
- "3478:3478/udp"
- "50300-50400:50300-50400/udp"
### if you're using `network_mode: host`, you can skip this part
```
Recreate the LiveKit container (with `docker-compose up -d livekit`) to apply these changes. Remember to allow the new `3478/udp` and `50300:50400/udp` ports through your firewall.
### Integration with an external TURN server
If you've already [set up coturn](./turn), you can configure Livekit to use it.
:::tip Avoid port clashes between the two services
Before continuing, make sure coturn's `min-port` and `max-port` do not overlap with LiveKit's port range:
```ini
# in your coturn.conf
min-port=50201
max-port=65535
```
:::
Generate a long random secret for LiveKit, and add it to your coturn config under the `static-auth-secret` option. You can add as many secrets as you want, so set a different one for LiveKit to use.
Then configure LiveKit, making sure to replace `COTURN_SECRET` with the one you generated:
```yaml
# livekit.yaml
rtc:
turn_servers:
- host: coturn.example.com
port: 3478
protocol: udp
secret: "COTURN_SECRET"
- host: coturn.example.com
port: 3478
protocol: tcp
secret: "COTURN_SECRET"
- host: coturn.example.com
port: 5349
protocol: tls # Only if you have already set up TLS in your coturn
secret: "COTURN_SECRET"
```
Restart LiveKit and coturn to apply these changes.
## Testing
To test that LiveKit is successfully integrated with Continuwuity, you will need to replicate its [Token Exchange Flow](https://github.com/element-hq/lk-jwt-service#%EF%B8%8F-how-it-works--token-exchange-flow). Follow the steps below while checking Docker logs (`docker-compose logs --follow`), in order to help [troubleshooting](#troubleshooting) any issues.
To test that LiveKit is successfully integrated with Continuwuity, you will need to replicate its [Token Exchange Flow](https://github.com/element-hq/lk-jwt-service#%EF%B8%8F-how-it-works--token-exchange-flow). Follow the steps below while checking Docker logs (`docker compose logs --follow`), in order to help [troubleshooting](#troubleshooting) any issues.
First, you will need an access token for your current login session. These can be found in your client's settings or obtained via [this website](https://timedout.uk/mxtoken.html).
First, you will need an access token for your current login session. These can be found in your client's settings or obtained via [this website][starstruck-mxtoken2].
[starstruck-mxtoken2]: https://starstruck.systems/matrix/tools/mxtoken2
Then, using that token, fetch the discovery endpoints for MatrixRTC services:
@@ -396,22 +285,25 @@ The lk-jwt-service will, after checking against Continuwuity, answer with a `jwt
{"url":"wss://livekit.example.com","jwt":"a_really_really_long_string"}
```
Use this token to test at the [LiveKit Connection Tester](https://livekit.io/connection-test). If everything works there, then you have set up LiveKit successfully!
Use this token to test at the [LiveKit Connection Tester][livekit-connection-test]. If everything works there, then you have set up LiveKit successfully!
[livekit-connection-test]: https://livekit.com/webrtc/connection-test
## Troubleshooting
To debug any issues, you can place a call or redo the Testing instructions, and check the container logs for any specific errors. Use `docker-compose logs --follow` to follow these logs in real-time.
To debug any issues, you can place a call or redo the Testing instructions, and check the container logs for any specific errors. Use `docker compose logs --follow` to follow these logs in real-time.
### Common errors in Element Call UI
- `MISSING_MATRIX_RTC_FOCUS`: LiveKit is missing from Continuwuity's config file
- "Waiting for media" popup always showing: a LiveKit URL has been configured in Continuwuity, but your client cannot connect to it for some reason
- `MISSING_MATRIX_RTC_FOCUS`/`MISSING_MATRIX_RTC_TRANSPORT`: LiveKit is missing from Continuwuity's config file
- "Waiting for media" popup always showing for yourself: a LiveKit URL has been configured in Continuwuity, but your client cannot connect to it for some reason
- `OPEN_ID_ERROR`: Your client can reach out to `lk-jwt-service`, but has problems authenticating with it. In this case, check `lk-jwt-service` logs for more details
For browser-based clients, you can also inspect connections using DevTools' Networking tab, to see which requests are erroring out.
### Docker loopback networking issues
Some distros do not allow Docker containers to connect to its host's public IP by default. This would cause `lk-jwt-service` to fail connecting to `livekit` or `continuwuity` on the same host. As a result, you would see connection refused/connection timeouts log entries in the JWT service, even when `LIVEKIT_URL` has been configured correctly.
Some distros do not allow Docker containers in bridge networks to connect to their host's public IP by default. This makes `lk-jwt-service` fail connecting to `livekit` or `continuwuity` on the same host, causing refused and timed out connections to appear in the log entries of the JWT service, even when `LIVEKIT_URL` has been configured correctly.
You can also test that this is the case by cURLing from a sidecar container:
@@ -420,26 +312,38 @@ docker run --rm --net container:lk-jwt-service docker.io/curlimages/curl https:/
# --- some errors ---
```
To alleviate this, you can try one of the following workarounds:
To resolve this, configure an `extra_hosts` file mapping LiveKit's and Continuwuity's domain names to Docker's custom host loopback address, represented here by `host-gateway`:
- Use `network_mode: host` for the `lk-jwt-service` container (instead of the default bridge networking).
- Add an `extra_hosts` file mapping livekit's (and continuwuity's) domain name to a locally-reachable address:
```diff
# in docker-compose.yaml
services:
lk-jwt-service:
...
+ extra_hosts:
+ - "livekit.example.com:127.0.0.1"
+ - "matrix.example.com:127.0.0.1"
```
- (**untested, use at your own risk**) Implement an iptables workaround as shown [here](https://forums.docker.com/t/unable-to-connect-to-host-service-from-inside-docker-container/145749/6).
```diff
# in docker-compose.yaml
services:
lk-jwt-service:
...
+ extra_hosts:
+ - "livekit.example.com:host-gateway"
+ - "matrix.example.com:host-gateway"
```
After implementing the changes and restarting your compose, `lk-jwt-service` should now connect to your other services. The sidecar container test above should now return an `OK` from LiveKit.
For more information about the `host-gateway` parameter, kindly refer to the `--add-host` documentation for [Docker][docker-add-host] and [Podman][podman-add-host]. Should you have further difficulties, feel free to enquire in the support rooms.
[docker-add-host]: https://docs.docker.com/reference/cli/docker/container/run/#add-host
[podman-add-host]: https://docs.podman.io/en/latest/markdown/podman-run.1.html#add-host-hostname-hostname-ip
### Incorrect IP address for LiveKit
By default, LiveKit automatically finds its public IP address(es), which can be seen in the "Establishing WebRTC connection" section of the connection test page. If these IPs are incorrect, you may want to hardcode your own IP by doing the following:
```diff
### in your livekit.yaml ###
rtc:
# ... other configs here ...
- use_external_ip: true
+ use_external_ip: false
+ node_ip: "1.2.3.4"
```
### Workaround for non-federating servers
When deploying on servers with federation disabled (`allow_federation = false`), LiveKit will fail as it can't fetch the required [OpenID endpoint](https://spec.matrix.org/v1.17/server-server-api/#get_matrixfederationv1openiduserinfo) via federation paths.
@@ -458,17 +362,159 @@ Subscribe to issue [!1440](https://forgejo.ellis.link/continuwuation/continuwuit
Guides:
- [Element Call self-hosting documentation](https://github.com/element-hq/element-call/blob/livekit/docs/self-hosting.md)
- [Community guide with overview of LiveKit's mechanisms](https://tomfos.tr/matrix/livekit/)
- [Community guide using systemd](https://blog.kimiblock.top/2024/12/24/hosting-element-call/)
- [Element Call self-hosting documentation from element-hq][element-call-selfhosting]
- [Community guide with overview of LiveKit's mechanisms][tom-livekit-guide]
- [Community guide using systemd][kimiblock-livekit-guide]
[element-call-selfhosting]: https://github.com/element-hq/element-call/blob/livekit/docs/self-hosting.md
[tom-livekit-guide]: https://tomfos.tr/matrix/livekit/
[kimiblock-livekit-guide]: https://blog.kimiblock.top/2024/12/24/hosting-element-call/
Configurations:
- [Livekit's `config-sample.yaml`][livekit-config-sample-yaml] - LiveKit configuration file with full options
Specifications:
- [MSC4143 - MatrixRTC proposal](https://github.com/matrix-org/matrix-spec-proposals/pull/4143)
- [MSC4195 - LiveKit proposal](https://github.com/matrix-org/matrix-spec-proposals/pull/4195)
- [MSC4143: MatrixRTC \- Real-time communication over Matrix][MSC4143]
- [MSC4195: MatrixRTC Transport using LiveKit Backend][MSC4195]
[MSC4143]: https://github.com/matrix-org/matrix-spec-proposals/pull/4143
[MSC4195]: https://github.com/matrix-org/matrix-spec-proposals/pull/4195
Source code:
- [Element Call](https://github.com/element-hq/element-call)
- [lk-jwt-service](https://github.com/element-hq/lk-jwt-service)
- [LiveKit server](https://github.com/livekit/livekit)
- [Element Call][element-call-github]
- [lk-jwt-service][lk-jwt-service-github]
- [LiveKit server][livekit-server-github]
[element-call-github]: https://github.com/element-hq/element-call
[lk-jwt-service-github]: https://github.com/element-hq/lk-jwt-service
[livekit-server-github]: https://github.com/livekit/livekit
Other:
- [Matrix VOIP and LiveKit][sspaeth-matrix-voip] - Community member deep dive on current VOIP solutions on Matrix
[sspaeth-matrix-voip]: https://sspaeth.de/2026/04/matrix-voip-and-livekit/
## Appendix
### Additional TURN-over-TLS on 443 configuration
Most of the time, LiveKit [**does not need TURN**][sspaeth-matrix-voip-turn] to function. However, there are situations where clients may be unable to use nonstandard ports or UDP connections, such as in highly restrictive networks. In such cases, a TURN-over-TLS server on port 443 could relay traffic for the clients.
[sspaeth-matrix-voip-turn]: https://sspaeth.de/2026/04/matrix-voip-and-livekit/#turn
You can either use LiveKit's built-in TURN server, or integrate LiveKit with [coturn](./turn).
<details>
<summary>Using LiveKit's built-in TURN server</summary>
First, set up LiveKit's built-in TURN server with its own domain - this example will use `livekit-turn.example.com` in our example.
```yaml
## add this to `livekit.yaml` ##
turn:
enabled: true
# Note: LiveKit will always advertise its TURN-over-TLS port on 443,
# so further load balancing is needed to route back from port 443
# on the host to the port being configured here
tls_port: 5349
# Optional: configure an extra UDP port
# udp_port: 3478
relay_range_start: 50300
relay_range_end: 50400
domain: livekit-turn.example.com
# replace these with your actual certificate and key files
cert_file: /path/to/livekit-turn.example.com.crt
key_file: /path/to/livekit-turn.example.com.key
```
```yaml
### add these ports to livekit's docker-compose.yml ###
### if you're using `network_mode: host`, you can skip this part
ports:
- "127.0.0.1:5349:5349/tcp"
- "50300-50400:50300-50400/udp"
# "3478:3478/udp" # (optional UDP port)
```
Recreate the LiveKit container (with `docker compose up -d livekit`) to apply these changes. Remember to allow the new `50300:50400/udp` ports through your firewall.
Then, configure a route from port 443 on the host back to the `livekit-turn.example.com` service on port 5349. To multiplex the service and LiveKit's WebSocket on the same port, use a layer 4 reverse proxy with SNI routing capabilities, such as [Caddy-L4][caddy-l4], on the host system.
```
## in your Caddyfile ##
{
servers {
listener_wrappers {
# intercept packets meant for the TURN domain first
# before forwarding other packets to "normal" HTTP listeners
layer4 {
@turn tls sni livekit-turn.example.com
route @turn {
# forward packages to LiveKit's TURN-over-TLS port
proxy 127.0.0.1:5349
}
}
}
tls
}
}
}
# Configuration for the LiveKit modules
livekit.example.com {
@lk-jwt-service path /healthz /get_token /sfu/get
route @lk-jwt-service {
reverse_proxy 127.0.0.1:8081
}
reverse_proxy http://127.0.0.1:7880
}
```
[caddy-l4]: https://github.com/mholt/caddy-l4
</details>
<details>
<summary>Using an external TURN server (coturn)</summary>
First, make sure coturn's `min-port` and `max-port` do not overlap with LiveKit's port range:
```ini
# in your coturn.conf
min-port=50201
max-port=65535
```
Then, generate a long random TURN secret for LiveKit, and add it to your coturn config under the `static-auth-secret` option. coturn allows multiple secrets in its configuration, so set a different one for LiveKit to use.
After that, refer to the following [TURN-over-TLS on 443 instructions](./turn#turn-over-tls-on-443) to set up coturn with TLS, as well as multiplexing with LiveKit's WebSocket on port 443.
Then configure LiveKit, making sure to replace `COTURN_SECRET` with the one you generated:
```yaml
### in your livekit.yaml ###
rtc:
# ... other configs here ...
turn_servers:
- host: coturn.example.com
port: 443
protocol: tls
secret: "COTURN_SECRET"
```
Restart LiveKit, coturn, and Caddy-L4 to apply these changes.
</details>
Once the services are configured, run the Testing steps again to check that TURN-over-TLS on 443 is working. There should now be a green tick in the [LiveKit connection test page][livekit-connection-test] showing "Can connect to TURN" to confirm this is set up successfully.
+285 -121
View File
@@ -1,36 +1,94 @@
# Setting up TURN/STUN
[TURN](https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT) and [STUN](https://en.wikipedia.org/wiki/STUN) are used as a component in many calling systems. Matrix uses them directly for legacy calls and indirectly for MatrixRTC via Livekit.
[TURN][turn] and [STUN][stun] are used as components in many calling systems. Matrix uses them directly for legacy calls and indirectly for MatrixRTC via Livekit.
Continuwuity recommends using [Coturn](https://github.com/coturn/coturn) as your TURN/STUN server, which is available as a Docker image or a distro package.
Continuwuity recommends using [coturn][coturn] as your TURN/STUN server, which is available as a Docker image or a distro package. This guide assumes that you are using docker compose for deployment.
## Installing Coturn
:::tip
You can find help setting up TURN/STUN in our MatrixRTC room - [#matrixrtc:continuwuity.org](https://matrix.to/#/%23matrixrtc%3Acontinuwuity.org)
:::
### Configuration
[turn]: https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT
[stun]: https://en.wikipedia.org/wiki/STUN
[coturn]: https://github.com/coturn/coturn
## Installing coturn
### 1. Set up your domain
coturn should live on its own domain or subdomain. In this guide we use `coturn.example.com` - this should be replaced with a domain you control.
### 2. Configuring coturn
Create a configuration file called `coturn.conf` containing:
```ini
use-auth-secret
static-auth-secret=<a secret key>
realm=<your server domain>
realm=coturn.example.com
```
:::tip Generating a secure secret
A common way to generate a suitable alphanumeric secret key is by using:
:::tip Tip: Generate a long, secure secret with the following command
```bash
pwgen -s 64 1
```
:::
#### Port Configuration
If you want to enable TURN-over-TLS (TURNS), add the appropriate certificate and key paths to your `coturn.conf` by adding the following lines:
```ini
cert=/etc/letsencrypt/coturn.example.com.crt
pkey=/etc/letsencrypt/coturn.example.com.key
```
The cert and key must be encoded in PEM format and must be readable by the `coturn` user.
Check out the [`turnserver.conf`][turnserver-conf] example for all coturn options.
[turnserver-conf]: https://github.com/coturn/coturn/blob/master/examples/etc/turnserver.conf
### 3. Running the coturn container
Next, we will start the coturn container with the [official image][coturn-image]. **Host networking mode** is used here for better performance and reduced configuration complexity (see [coturn's Docker docs][coturn-docker-docs] for rationale).
[coturn-image]: https://hub.docker.com/r/coturn/coturn
[coturn-docker-docs]: https://github.com/coturn/coturn/blob/master/docker/coturn/README.md#why-so-many-ports-opened
Create a `docker-compose.yml` file as follows and run `docker compose up -d`:
```yaml
services:
coturn:
container_name: coturn
image: docker.io/coturn/coturn
restart: unless-stopped
network_mode: "host"
volumes:
- ./coturn.conf:/etc/coturn/turnserver.conf
# replace this with actual paths to your certificates
- /path/to/certs:/etc/letsencrypt
```
### 4. Opening ports
By default, coturn uses the following ports:
- `3478` (UDP/TCP): Standard TURN/STUN port
- `5349` (UDP/TCP): TURN/STUN over TLS
- `49152-65535` (UDP): Media relay ports
If you're also running LiveKit, you'll need to avoid port conflicts. Configure non-overlapping port ranges:
You will need to allow them through your firewall. If you use UFW, the commands are:
```bash
ufw allow 3478/udp
ufw allow 3478/tcp
ufw allow 5349/tcp
ufw allow 5349/udp
ufw allow 49152-65535/udp
```
:::tip For LiveKit users
If you're also running LiveKit, you'll need configure non-overlapping port ranges to avoid port conflicts:
```ini
# In coturn.conf
@@ -38,57 +96,32 @@ min-port=50201
max-port=65535
```
```bash
# With ufw
ufw allow 50201:65535/udp
```
This leaves ports `50100-50200` available for LiveKit's default configuration.
### Running with Docker
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
```
### Running with Docker Compose
Create a `docker-compose.yml` file and run `docker compose up -d`:
```yaml
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
```
:::info Why host networking?
Coturn uses host networking mode because it needs to bind to multiple ports and work with various network protocols. Using host networking is better for performance, and reduces configuration complexity. To understand alternative configuration options, visit [Coturn's Docker documentation](https://github.com/coturn/coturn/blob/master/docker/coturn/README.md).
:::
### Security Recommendations
### 5. Security Recommendations
For security best practices, see Synapse's [Coturn documentation](https://element-hq.github.io/synapse/latest/turn-howto.html), which includes important firewall and access control recommendations.
For coturn hardening and security best practices, see [Synapse's coturn documentation][synapse-coturn-guide], which includes important firewall and access control recommendations.
[synapse-coturn-guide]: https://element-hq.github.io/synapse/latest/setup/turn/coturn.html#configuration
## Configuring Continuwuity
Once your TURN server is running, configure Continuwuity to provide credentials to clients. Add the following to your Continuwuity configuration file:
### Shared Secret Authentication (Recommended)
This is the most secure method and generates time-limited credentials automatically:
```toml
# TURN URIs that clients should connect to
turn_uris = [
"turn:coturn.example.com?transport=udp",
"turn:coturn.example.com?transport=tcp",
"turns:coturn.example.com?transport=udp",
"turns:coturn.example.com?transport=tcp"
"turn:coturn.example.com:3478?transport=udp",
"turn:coturn.example.com:3478?transport=tcp",
# Add this if you're using TURN-over-TLS (note the `turns:` prefix)
"turns:coturn.example.com:5349?transport=tcp"
]
# Shared secret for generating credentials (must match coturn's static-auth-secret)
@@ -98,54 +131,20 @@ turn_secret = "<your coturn static-auth-secret>"
# turn_secret_file = "/etc/continuwuity/.turn_secret"
# TTL for generated credentials in seconds (default: 86400 = 24 hours)
turn_ttl = 86400
turn_ttl = 10800
```
:::tip Using TLS
The `turns:` URI prefix instructs clients to connect to TURN over TLS, which is highly recommended for security. Make sure you've configured TLS in your coturn server first.
:::
### Static Credentials (Alternative)
If you prefer static username/password credentials instead of shared secrets:
```toml
turn_uris = [
"turn:coturn.example.com?transport=udp",
"turn:coturn.example.com?transport=tcp"
]
turn_username = "your_username"
turn_password = "your_password"
```
:::warning
Static credentials are less secure than shared secrets because they don't expire and must be configured in coturn separately. It is strongly advised you use shared secret authentication.
:::
### Guest Access
By default, TURN credentials require client authentication. To allow unauthenticated access:
```toml
turn_allow_guests = true
```
:::caution
This is not recommended as it allows unauthenticated users to access your TURN server, potentially enabling abuse by bots. All major Matrix clients that support legacy calls *also* support authenticated TURN access.
:::
### Important Notes
- Replace `coturn.example.com` with your actual TURN server domain (the `realm` from coturn.conf)
- The `turn_secret` must match the `static-auth-secret` in your coturn configuration
- Restart or reload Continuwuity after making configuration changes
Restart Continuwuity, and the new changes should now be applied.
## Testing Your TURN Server
### Testing Credentials
Verify that Continuwuity is correctly serving TURN credentials to clients:
Get an access token for your current login session. These can be found in your client's settings or obtained via [this website][starstruck-mxtoken2].
[starstruck-mxtoken2]: https://starstruck.systems/matrix/tools/mxtoken2
Then, using that token, verify that Continuwuity is correctly serving TURN credentials to clients:
```bash
curl "https://matrix.example.com/_matrix/client/r0/voip/turnServer" \
@@ -159,56 +158,221 @@ You should receive a response like this:
"username": "1752792167:@jade:example.com",
"password": "KjlDlawdPbU9mvP4bhdV/2c/h65=",
"uris": [
"turns:coturn.example.com?transport=udp",
"turns:coturn.example.com?transport=tcp",
"turn:coturn.example.com?transport=udp",
"turn:coturn.example.com?transport=tcp"
"turns:coturn.example.com:3478?transport=tcp",
"turn:coturn.example.com:3478?transport=udp",
"turn:coturn.example.com:5349?transport=tcp"
],
"ttl": 86400
}
```
:::note MSC4166 Compliance
If no TURN URIs are configured (`turn_uris` is empty), Continuwuity will return a 404 Not Found response, as specified in MSC4166.
:::
### Testing Connectivity
Use [Trickle ICE](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/) to verify that the TURN credentials actually work:
Open the [Trickle ICE][trickle-ice] testing page in a browser and then:
1. Copy the credentials from the response above
2. Paste them into the Trickle ICE testing tool
3. Click "Gather candidates"
4. Look for successful `relay` candidates in the results
1. Copy the URIs and credentials from the response above
2. Paste them into the Trickle ICE testing tool, and click on "Add server"
3. Once all the URIs and credentials have been added, click "Gather candidates"
If you see relay candidates, your TURN server is working correctly!
If you see `relay` candidates in the results, your TURN/STUN server is working correctly! You should now be able to place and receive legacy calls.
[trickle-ice]: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
## Troubleshooting
### Clients can't connect to TURN server
To gather debug logs while troubleshooting coturn, add `verbose` to your `coturn.conf`. You can then view these logs with `docker compose logs --follow coturn`.
- Verify firewall rules allow the necessary ports (3478, 5349, and your media port range)
- Check that DNS resolves correctly for your TURN domain
- Ensure your `turn_secret` matches coturn's `static-auth-secret`
- Test with Trickle ICE to isolate the issue
### Errors with Trickle ICE
### Port conflicts with LiveKit
- `code=701` - the TURN server is not reachable
- Verify firewall rules allow the necessary ports (3478, 5349, and your media port range)
- Verify via logs that coturn is exposed on the correct addresses and interfaces
- Check that DNS resolves correctly for your TURN domain
- `code=401` - unauthorized credentials
- Ensure your `turn_secret` matches coturn's `static-auth-secret`
- Ensure the credentials you obtained from the Testing steps has not expired yet. You can adjust `turn_ttl` in your Continuwuity configuration to increase this, or simply re-request a new one
- Wrong IP address advertised
- This may be caused by coturn not recognizing its public-facing IP correctly. You can configure `external-ip=<desired-public-ip>` to fix this issue.
- Make sure coturn's `min-port` starts above LiveKit's `port_range_end` (default: 50200)
- Or adjust LiveKit's port range to avoid coturn's default range
### 404 when calling the turnServer endpoint
### 404 when calling turnServer endpoint
This is the correct response when no TURN servers are configured, as per [MSC4166][msc4166]. Verify that your `turn_uris` is not empty in your Continuwuity config and try again.
- Verify that `turn_uris` is not empty in your Continuwuity config
- This behavior is correct per MSC4166 if no TURN URIs are configured
[msc4166]: https://github.com/matrix-org/matrix-spec-proposals/pull/4166
### Credentials expire too quickly
- Adjust the `turn_ttl` value in your Continuwuity configuration
- Default is 86400 seconds (24 hours)
### Related Documentation
## Related Documentation
- [MatrixRTC/LiveKit Setup](./livekit.mdx) - Configure group calling with LiveKit
- [Coturn GitHub](https://github.com/coturn/coturn) - Official coturn repository
- [Synapse TURN Guide](https://element-hq.github.io/synapse/latest/turn-howto.html) - Additional security recommendations
- [coturn GitHub][coturn] - Official coturn repository
- [`turnserver.conf`][turnserver-conf] - Coturn TURN SERVER configuration file with full options
- [Synapse TURN Guide][synapse-turn-guide] - TURN server guide for Synapse
- [Synapse coturn Guide][synapse-coturn-guide] - Coturn-specific guide for Synapse, with important security recommendations
[synapse-turn-guide]: https://element-hq.github.io/synapse/latest/turn-howto.html
## Appendix
### Using Eturnal
If you instead prefer to use [eturnal][eturnal], you can refer to the guides below:
- [Community guidance][eturnal-continuwuity] on using eturnal with Legacy Calls, LiveKit calls, and more
- Synapse's [eturnal documentation][synapse-eturnal-guide]
[eturnal]: https://eturnal.net
[eturnal-continuwuity]: https://muoi.me/~stratself/articles/an-eturnal-to-rule-them-all/
[synapse-eturnal-guide]: https://element-hq.github.io/synapse/latest/setup/turn/eturnal.html
### TURN-over-TLS on 443
TURN servers are generally reachable on their default ports, as configured above. However, there are situations where clients may be unable to use nonstandard ports or UDP connections, such as in highly restrictive networks. In such cases, a TURN-over-TLS server on port 443 could relay traffic for the clients.
However, port 443 is usually used by other HTTPS services. Therefore, one would need to multiplex both TURN-over-TLS and HTTPS on these ports, and filter packets to them via SNI routing.
Below are examples to multiplex coturn and [LiveKit](./livekit.mdx) on port 443, using [Caddy-L4][caddy-l4] on the host system.
<details>
<summary>Caddyfile with TLS passthrough</summary>
This Caddyfile:
- Route `turn.example.com` to the TURN-over-TLS port for coturn (port 5349) without TLS termination, and
- Route `livekit.example.com` to the [LiveKit services](./livekit.mdx) with TLS termination by Caddy
Please note that all traffic from coturn's perspective will be coming from Caddy-L4's IP now.
```
{
servers {
listener_wrappers {
# intercept packets meant for the TURN domain first
# before forwarding other packets to "normal" HTTP listeners
layer4 {
@turn tls sni turn.example.com
route @turn {
proxy 127.0.0.1:5349 # forward to normal TURNS port
}
}
tls
}
}
}
# livekit stuff
https://livekit.example.com {
@lk-jwt-service path /healthz /get_token /sfu/get
route @lk-jwt-service {
reverse_proxy 127.0.0.1:8081
}
reverse_proxy http://127.0.0.1:7880
}
```
</details>
<details>
<summary>Caddyfile with TLS termination and PROXY protocol forwarding</summary>
This setup:
- Terminates TLS for `turn.example.com`,
- Tag the decrypted packets with PROXY protocol, and route it to coturn's `tcp-proxy-port`
- Route `livekit.example.com` to the [LiveKit services](./livekit.mdx) with TLS termination by Caddy
It allows coturn to see real client IPs, but the TLS handling is done on Caddy's side.
First, enable coturn's PROXY-protocol accepting port by adding this:
```ini
# in coturn.conf
tcp-proxy-port=5555
```
Then, in the Caddyfile:
```
{
servers {
listener_wrappers {
# intercept packets meant for the TURN domain first
# before forwarding other packets to "normal" HTTP listeners
layer4 {
@turn tls sni turn.example.com
route @turn {
tls # terminate TLS for the turn.example.com packets
proxy {
# then, proxy them to tcp-proxy-port and enable PROXY protocol version 2
upstream 127.0.0.1:5555
proxy_protocol v2
}
}
}
tls
}
}
}
# livekit stuff
https://livekit.example.com {
@lk-jwt-service path /healthz /get_token /sfu/get
route @lk-jwt-service {
reverse_proxy 127.0.0.1:8081
}
reverse_proxy http://127.0.0.1:7880
}
# placeholder block to obtain certs for turn.example.com
https://turn.example.com {
respond "OK" 200
}
```
**Note**: the setup will disable TURN-over-TLS functionality on port 5349/tcp.
</details>
After configuration and spin-up, the destination `turns:turn.example.com:443?transport=tcp` should work with Trickle ICE tests. You can now advertise it as an address in your `turn_uris` as well as [LiveKit](./livekit#additional-turn-over-tls-on-443-configuration).
[caddy-l4]: https://github.com/mholt/caddy-l4
### Unsafe TURN setups (not recommended)
<details>
<summary>Using static credentials</summary>
:::caution
Static credentials are less secure than shared secrets because they don't expire and must be configured in coturn separately. It is strongly advised you use [shared secret authentication](#2-configuration).
:::
If you prefer static username/password credentials instead of shared secrets:
```ini
# In coturn.conf
# Comment out options to use a secret
# use-auth-secret
# static-auth-secret=<a secret key>
# Define a username-password pair
user=your_username:your_password
```
```toml
# In continuwuity.toml
turn_uris = [
"turn:coturn.example.com?transport=udp",
"turn:coturn.example.com?transport=tcp"
]
turn_username = "your_username"
turn_password = "your_password"
```
</details>
+29 -6
View File
@@ -9,7 +9,7 @@ The following OCI images are available for Continuwuity:
| Image | Notes |
| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**latest**][latest] | Latest tagged release. (recommended) |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main**][main] | Latest `main` branch commit. |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main**][main] | Latest `main` branch commit. Built with [CI][release-image] |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**latest-maxperf**][latest-maxperf] | Latest tagged release, [performance optimised version](./generic.mdx#performance-optimised-builds). |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main-maxperf**][main-maxperf] | Latest `main` branch commit, [performance optimised version](./generic.mdx#performance-optimised-builds). |
@@ -17,6 +17,7 @@ The following OCI images are available for Continuwuity:
[main]: https://forgejo.ellis.link/continuwuation/-/packages/container/continuwuity/main
[latest-maxperf]: https://forgejo.ellis.link/continuwuation/-/packages/container/continuwuity/latest-maxperf
[main-maxperf]: https://forgejo.ellis.link/continuwuation/-/packages/container/continuwuity/main-maxperf
[release-image]: https://forgejo.ellis.link/continuwuation/continuwuity/actions/?workflow=release-image.yml
If you want a specific version or commit hash, you can browse for them [here][oci-all-versions].
@@ -25,13 +26,11 @@ Images are also mirrored to these locations automatically, on a schedule:
- `ghcr.io/continuwuity/continuwuity` ([Github Registry][ghcr-io])
- `docker.io/jadedblueeyes/continuwuity` ([Docker Hub][docker-hub])
- `registry.gitlab.com/continuwuity/continuwuity` ([Gitlab Registry][gitlab-registry])
- `git.nexy7574.co.uk/mirrored/continuwuity` ([Nexy's forge][nexy-forge]. Releases only, no `main` tags)
[oci-all-versions]: https://forgejo.ellis.link/continuwuation/-/packages/container/continuwuity/versions
[ghcr-io]: https://github.com/continuwuity/continuwuity/pkgs/container/continuwuity/versions?filters%5Bversion_type%5D=tagged
[docker-hub]: https://hub.docker.com/r/jadedblueeyes/continuwuity/
[gitlab-registry]: https://gitlab.com/continuwuity/continuwuity/container_registry/8871720
[nexy-forge]: https://git.nexy7574.co.uk/mirrored/-/packages/container/continuwuity/versions
### Prerequisites
@@ -63,8 +62,8 @@ See the [reference configuration](../reference/config) page for all config optio
These examples include reverse proxy configurations for Matrix federation, which will route your Matrix domain (and optionally .well-known paths) to Continuwuity.
:::note Docker DNS Performance
Docker's default DNS resolver are known to [cause timeout issues](../troubleshooting#dns-issues) for Matrix federation. To bypass it and use a more performant resolver, mount a custom `/etc/resolv.conf` config file into the Continuwuity container.
:::important Docker DNS Performance
Docker's default DNS resolver is known to [**cause timeout issues**](../troubleshooting#dns-issues) for Matrix federation. To bypass it and use a more performant resolver, mount a custom `/etc/resolv.conf` config file into the Continuwuity container:
```yaml title='docker-compose.yml'
services:
@@ -85,8 +84,19 @@ Consult the [**DNS tuning guide (recommended)**](../guides/dns.mdx) for full sol
#### Caddy (using Caddyfile)
<details>
<summary>docker-compose.with-caddy.yml ([view raw](/deploying/docker-compose.with-caddy.yml))</summary>
Create a Caddyfile with the following content:
```
https://example.com:443, https://example.com:8448 {
reverse_proxy http://homeserver:8008
}
```
Then, for the docker-compose:
```yaml file="../public/deploying/docker-compose.with-caddy.yml"
```
@@ -164,7 +174,7 @@ See the [Other reverse proxies](generic.mdx#setting-up-the-reverse-proxy) sectio
4. Check your server logs for a registration token:
```bash
docker-compose logs continuwuity 2>&1
docker compose logs continuwuity 2>&1
```
You'll see output as below.
@@ -187,6 +197,19 @@ Test that your setup works by following these [instructions](./generic.mdx#how-d
Check your container logs using `docker-compose logs --follow` to debug any issues. See the [Troubleshooting](../troubleshooting.mdx) page for common errors and how to fix them.
## Updating
To update to a new version of Continuwuity, use the following commands:
```bash
# stop the services in docker-compose.yaml
docker compose down
# pull latest images for the services in docker-compose.yaml
docker compose pull
# spin up the containers again
docker compose up -d
```
## Other deployment methods
### Docker - Quick Run
+33 -37
View File
@@ -29,19 +29,12 @@ we can't cross-build static binaries - contributions are welcome here.
#### Performance-optimised builds
For x86_64 systems with CPUs from the last ~15 years, use the
`-haswell-` optimised binaries for best performance. These
binaries enable hardware-accelerated CRC32 checksumming in
RocksDB, which significantly improves database performance.
The haswell instruction set provides an excellent balance of
compatibility and speed.
Continuwuity provides `*-maxperf` tagged binaries, which uses the `release-max-perf` build profile with [link-time optimisation (LTO)][lto-rust-docs]. For the x86_64 architecture, these binaries specifically target the Haswell architecture (hence the `-haswell-` name extension), and enables hardware-accelerated CRC32 checksumming in
RocksDB which significantly improves database performance. If you're using an x86_64 system with CPUs from the last ~15 years, consider using these images for best performance.
If you're using Docker instead, equivalent performance-optimised
images are available with the `-maxperf` suffix (e.g.
`forgejo.ellis.link/continuwuation/continuwuity:latest-maxperf`).
These images use the `release-max-perf` build profile with
[link-time optimisation (LTO)][lto-rust-docs]
and, for amd64, target the haswell CPU architecture.
[lto-rust-docs]: https://doc.rust-lang.org/cargo/reference/profiles.html#lto
@@ -59,28 +52,7 @@ If you wish to generate a static binary, you can do so using Nix: `nix build git
### Compiling
Alternatively, you may compile the binary yourself.
#### Using Docker
See the [Building Docker Images](../development/index.mdx#building-docker-images)
section in the development documentation.
#### Manual
##### Dependencies
- Run `nix develop` to get a devshell with everything you need
- Or, install the following:
- (On linux) `liburing-dev` on the compiling machine, and `liburing` on the target host
- (On linux) `pkg-config` on the compiling machine to allow finding `liburing`
- A C++ compiler and (on linux) `libclang` for RocksDB
##### Build
You can now build Continuwuity using `cargo build --release`.
Continuwuity supports various optional features that can be enabled during compilation. Please see the Cargo.toml file for a comprehensive list, or ask in our rooms.
Alternatively, you may compile the binary yourself. See the [Appendix subsection](#compiling-continuwuity) for more details.
## Adding a Continuwuity user
@@ -179,12 +151,11 @@ If you would like to use only port 443, a different port, or a subdomain for the
Caddy is the recommended reverse proxy as it is easy to use, has good defaults,
and handle TLS certificates automatically. After installing Caddy via your preferred
method, create `/etc/caddy/conf.d/conduwuit_caddyfile` and enter the following
method, add the following content to your `/etc/caddy/Caddyfile` file
(substitute `example.com` with your actual server name):
```
example.com, example.com:8448 {
# TCP reverse_proxy
reverse_proxy 127.0.0.1:8008
}
```
@@ -207,7 +178,7 @@ For more granular controls, you will need to proxy everything under these follow
- `/_matrix/client` - core Client-Server APIs. These should be available on port :443
- `/_continuwuity/` - Continuwuity's integrated account management interface for OAuth-compatible clients
- `/_continuwuity/` - Continuwuity's integrated account management interface and authentication path for OAuth-compatible clients
You can optionally reverse proxy the following individual routes:
@@ -215,7 +186,7 @@ You can optionally reverse proxy the following individual routes:
Continuwuity to perform delegation (see the `[global.well_known]` config section)
- `/.well-known/matrix/support` if using Continuwuity to send the homeserver admin
[contact and support page][well-known-support]
- `/` and `/_continuwuity/logo.svg` if you would like to see the Continuwuity landing page
- `/` and `/_continuwuity/resources` if you would like to see the Continuwuity landing page
Refer to the respective software's documentation and online guides on how to do so.
@@ -286,10 +257,10 @@ and verify that your federation endpoints are opened and forwarded correctly.
As a quick health check, you can also use these cURL commands:
```bash
curl https://example.com/_conduwuit/server_version
curl https://example.com/_continuwuity/server_version
# If using port 8448
curl https://example.com:8448/_conduwuit/server_version
curl https://example.com:8448/_continuwuity/server_version
# If federation is enabled
curl https://example.com:8448/_matrix/federation/v1/version
@@ -305,3 +276,28 @@ curl https://example.com/_matrix/client/versions
- For Audio/Video call functionality see the [**Calls**](../calls.md) page.
- Consult the [Maintenance](../maintenance.mdx) page for guidance on maintaining your homeserver.
- If you want to set up an appservice, take a look at the [**Appservice Guide**](../appservices.md).
## Appendix
### Compiling Continuwuity
#### Using Docker
See the [Building Docker Images](../development/index.mdx#building-docker-images)
section in the development documentation.
#### Manual
##### DEPENDENCIES
- Run `nix develop` to get a devshell with everything you need
- Or, install the following:
- (On linux) `liburing-dev` on the compiling machine, and `liburing` on the target host
- (On linux) `pkg-config` on the compiling machine to allow finding `liburing`
- A C++ compiler and (on linux) `libclang` for RocksDB
##### BUILD
You can now build Continuwuity using `cargo build --release`.
Continuwuity supports various optional features that can be enabled during compilation. Please see the Cargo.toml file for a comprehensive list, or ask in our rooms.
+82 -64
View File
@@ -53,12 +53,19 @@ services:
After doing the steps above, Continuwuity will serve these 3 JSON files:
- `/.well-known/matrix/client`: for Client-Server discovery
- `/.well-known/matrix/server`: for Server-Server (federation) discovery
- `/.well-known/matrix/support`: admin contact details (strongly recommended to have)
- `/.well-known/matrix/support`: admin contact details (strongly recommended).
- By default, this include members of the admin room.
To enable full discovery, you will need to reverse proxy these paths from the base domain back to Continuwuity.
## Reverse proxying well-known files to Continuwuity
## Serving well-known files
You can either reverse proxy the well-known paths to Continuwuity, or serve static JSON files yourself.
### Option 1: Reverse proxying well-known files to Continuwuity
<details>
@@ -96,7 +103,7 @@ services:
For **Docker** users, consult the compose files in the [Appendix section](#docker-compose-examples).
After applying these changes, restart Continuwuity and your reverse proxy.Visit these routes and check that the responses match the examples below:
After applying these changes, restart Continuwuity and your reverse proxy. Visit these routes and check that the responses match the examples below:
<details open>
@@ -122,12 +129,12 @@ After applying these changes, restart Continuwuity and your reverse proxy.Visit
</details>
### Serving well-known files manually
### Option 2: Manually serving static files for well-known
Instead of reverse proxying well-known URIs, you can serve these files directly as static JSON that match the ones above. This is useful if your base domain points to a different physical server, and reverse proxying isn't feasible.
:::warning
Even if you choose to serve the well-known files manually, if you are using delegation at all, you **must** still set the `global.well_known.client` configuration option to the domain you're delegating to. Continuwuity needs to know the domain it runs on for OAuth-compatible clients to work correctly.
:::important Important: always configure [global.well_known]
Even if you choose to serve the well-known files manually, you **must** still set the `global.well_known.client` configuration option to the domain you're delegating to. Continuwuity needs to know the domain it runs on in order to redirect clients properly to email, OAuth, and account management endpoints.
:::
<details>
@@ -190,15 +197,78 @@ As Matrix clients prioritize well-known URIs for their destination, this can lea
In these scenarios, further configurations would be needed. Refer to the [Related Documentation](#related-documentation) section for resolution steps and see how they could apply to your use case.
---
## Related Documentation
## Using SRV records (not recommended)
### Matrix Specification
See the following sections of the Matrix Specification for more details on client and server resolution mechanisms:
- [Server-to-Server resolution](https://spec.matrix.org/latest/server-server-api/#resolving-server-names)
- [Client-to-Server resolution](https://spec.matrix.org/latest/client-server-api/#server-discovery)
- [MSC1929: Homeserver Admin Contact and Support page](https://github.com/matrix-org/matrix-spec-proposals/pull/1929)
### Community guides
- [Federation Setup guide by MTRNord](https://connectivity-tester.mtrnord.blog/docs/getting-started/federation-setup)
## Appendix
### Docker Compose examples
The following Compose files are taken from [Docker deployment instructions](../deploying/docker.mdx) and reconfigured to support split-domain delegation. Note the updated `CONTINUWUITY_WELL_KNOWN` variable and relevant changes in reverse proxy rules.
<details>
<summary>Caddy (using Caddyfile) - delegated.docker-compose.with-caddy.yml ([view raw](/advanced/delegated.docker-compose.with-caddy.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-caddy.yml"
```
```txt title="Caddyfile"
https://matrix.example.com:443 {
reverse_proxy http://homeserver:8008
}
https://example.com:443 {
reverse_proxy /.well-known/matrix* http://homeserver:8008
}
```
</details>
<details>
<summary>Caddy (using labels) - delegated.docker-compose.with-caddy-labels.yml ([view raw](/advanced/delegated.docker-compose.with-caddy-labels.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-caddy-labels.yml"
```
</details>
<details>
<summary>Traefik (for existing setup) - delegated.docker-compose.for-traefik.yml ([view raw](/advanced/delegated.docker-compose.for-traefik.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.for-traefik.yml"
```
</details>
<details>
<summary>Traefik included - delegated.docker-compose.with-traefik.yml ([view raw](/advanced/delegated.docker-compose.with-traefik.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-traefik.yml"
```
</details>
### Using SRV records (not recommended)
:::warning
The following methods are **not recommended** due to increased complexity with little benefits. If you have already set up `.well-known` delegation as above, you can safely skip this part.
:::
The following methods use DNS SRV records, and are **not recommended** due to increased complexity with few benefits. Additionally, they only work for federation traffic.
The following methods uses SRV DNS records and only work with federation traffic. They are only included for completeness.
If you have already set up well-known delegation as above, you can safely skip this part.
:::
<details>
@@ -241,7 +311,7 @@ On the target's IP at port 443, you'll need to provide a valid route and cert fo
<details>
<summary>Using SRV records as a fallback for .well-known delegation</summary>
<summary>Using SRV records as a fallback for well-known delegation</summary>
Assume your delegation is as below:
@@ -263,55 +333,3 @@ If you want other servers to default to using port :443 even when it is offline,
On the target's IP at port 443, you'll need to provide a valid route and cert for `example.com`.
</details>
---
## Related Documentation
See the following Matrix Specs for full details on client/server resolution mechanisms:
- [Server-to-Server resolution](https://spec.matrix.org/v1.17/server-server-api/#resolving-server-names) (see this for more information on SRV records)
- [Client-to-Server resolution](https://spec.matrix.org/v1.17/client-server-api/#server-discovery)
- [MSC1929: Homeserver Admin Contact and Support page](https://github.com/matrix-org/matrix-spec-proposals/pull/1929)
## Appendix
### Docker Compose examples
The following Compose files are taken from [Docker instructions](../deploying/docker.mdx) and reconfigured to support split-domain delegation. Note the updated `CONTINUWUITY_WELL_KNOWN` variable and relevant changes in reverse proxy rules.
<details>
<summary>Caddy (using Caddyfile) - delegated.docker-compose.with-caddy.yml ([view raw](/advanced/delegated.docker-compose.with-caddy.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-caddy.yml"
```
</details>
<details>
<summary>Caddy (using labels) - delegated.docker-compose.with-caddy-labels.yml ([view raw](/advanced/delegated.docker-compose.with-caddy-labels.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-caddy-labels.yml"
```
</details>
<details>
<summary>Traefik (for existing setup) - delegated.docker-compose.for-traefik.yml ([view raw](/advanced/delegated.docker-compose.for-traefik.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.for-traefik.yml"
```
</details>
<details>
<summary>Traefik included - delegated.docker-compose.with-traefik.yml ([view raw](/advanced/delegated.docker-compose.with-traefik.yml))</summary>
```yaml file="../public/advanced/delegated.docker-compose.with-traefik.yml"
```
</details>
+55 -18
View File
@@ -8,7 +8,7 @@ To solve this issue, it is strongly recommended to self-host a high-quality, ext
## Overview
For generic deployments, install your resolver of choice and configure `/etc/resolv.conf` to point to it. The resolver should ideally reside on the same host as Continuwuity.
For generic deployments, install your resolver of choice and configure your host system's `/etc/resolv.conf` to point to it. The resolver should ideally reside on the same host as Continuwuity.
```txt title="/etc/resolv.conf"
nameserver 127.0.0.1
@@ -18,7 +18,7 @@ nameserver 127.0.0.1
### For Docker users
Docker bridge networks uses a non-performant resolver to intercept and respond to container hostnames, and **this should also be avoided**. Instead, mount a custom `/etc/resolv.conf` file into the container, and hardcode a resolver address to bypass Docker's.
By default, Docker bridge networks uses a poorly performing resolver to intercept and respond to container hostnames. **This resolver should also be avoided**. Instead, mount a custom `/etc/resolv.conf` file into the container, and hardcode a resolver address to bypass Docker's.
It is recommended to run a dedicated resolver container for Continuwuity, as to separate from the host's resolver setup. To do this, create a custom bridge network and IP range, and explicitly define an IP address for the resolver container.
@@ -27,23 +27,28 @@ It is recommended to run a dedicated resolver container for Continuwuity, as to
```yaml title="docker-compose.yml"
networks:
matrix_net:
# re-use the `proxy` network, as shown in the Docker deployment docs
# (https://continuwuity.org/deploying/docker#choose-your-reverse-proxy)
# and configure it with a custom subnet
proxy:
ipam:
driver: default
config:
- subnet: "10.10.10.0/24"
services:
homeserver:
# ...
volume:
- ./continuwuity-resolv.conf:/etc/resolv.conf:ro
homeserver:
# ...
volume:
- ./continuwuity-resolv.conf:/etc/resolv.conf:ro
networks:
- proxy
unbound:
# ...
networks:
matrix_net:
ipv4_address: 10.10.10.20
unbound:
# ...
networks:
proxy:
ipv4_address: 10.10.10.20
```
```txt title="continuwuity-resolv.conf"
@@ -52,9 +57,41 @@ nameserver 10.10.10.20
</details>
:::warning Breaking resolution with container hostnames
After you mount a custom `/etc/resolv.conf`, you won't be able to connect to other containers using their hostnames, such as for [appservices](../appservices.mdx) in the same Docker network. To work around this, force your appservice to use a static IP address, and refer to its static IP during registration.
<details>
<summary>Example Docker deployment with an appservice</summary>
```yaml title="docker-compose.yml"
# ... other parts of compose file ...
appservice:
# ...
networks:
proxy:
ipv4_address: 10.10.10.30
```
~~~txt
!admin appservices register
```
id: appservice-name
url: http://10.10.10.30:29318
# rest of the registration file
```
~~~
</details>
:::
### For IPv4-only users
If you don't have IPv6 connectivity, changing `ip_lookup_strategy` to only resolve for IPv4 will reduce unnecessary AAAA queries.
If you don't have IPv6 connectivity, change `ip_lookup_strategy` to `1` in Continuwuity's configuration in order to onlyresolve IPv4 addresses and remove unnecessary IPv6 queries.
```toml title="continuwuity.toml"
[global]
@@ -72,13 +109,13 @@ Some values that are commonly tuned include:
- Increase `rrset-cache-size` and `msg-cache-size` to something much higher than the default `4M`, such as `64M`.
- Increase `discard-timeout` to something like `4800` to wait longer for upstream resolvers, as recursion can take a long time to respond to some domains. Continuwuity default to `dns_timeout = 10` seconds, so dropping requests early would lead to unnecessary retries and/or failures.
- Increase `discard-timeout` to something like `4800` to wait longer for upstream resolvers, as recursion can take a long time to respond to some domains. Continuwuity defaults to `dns_timeout = 10` seconds, so dropping requests early would lead to unnecessary retries and/or failures.
### Recursion versus forwarding
### Using a forwarder (optional)
Unbound by default employs **recursive resolution** and contacts many servers around the world. While this allows updated and authoritative answers and are generally viable for most users, sometimes these recursive queries can be too slow to fully resolve. As an alternative, you can consider **forwarding** your queries to public resolvers, and benefit from faster responses from their CDNs.
Unbound employs **recursive resolution** by default, contacting many nameservers around the world in the process. While this is generally viable for most users, sometimes these recursive queries can be too slow to fully resolve. As an alternative, you may consider **forwarding** your queries to public resolvers, and benefit from faster responses from their caches.
Do note that most popular upstreams (such as Google DNS or Quad9) employ IP ratelimiting, so a generous cache is still needed to avoid making too many queries.
However, do note that most popular upstreams (such as Google DNS or Quad9) employ IP ratelimiting, so a generous Unbound cache is still needed to avoid making too many queries.
If you want to use forwarders, configure it as follows:
@@ -144,7 +181,7 @@ You may consult this [community guide][technitium-continuwuity] for more details
## Testing
As a rough stress test, you can run `!admin query resolver flush-cache -a` or `!admin server clear-caches` to trigger a netburst of DNS queries. If your resolver can handle these loads without problem, then it should be ready for regular Continuwuity activity.
As a rough stress test, you can run `!admin query resolver flush-cache -a` or `!admin server clear-caches` to clear your destinations cache - this will then trigger a netburst of DNS queries. If your resolver can handle this load without issue, then it should be ready for regular Continuwuity activity.
To test connectivity against a specific server, use `!admin debug ping <SERVER_NAME>` and `!admin debug resolve-true-destination <SERVER_NAME>`.
+3 -1
View File
@@ -6,7 +6,7 @@ This page aims to outline various performance tweaks for Continuwuity and their
## DNS tuning (recommended)
Please see the dedicated [DNS tuning guide](./dns.mdx).
DNS tuning is important to ensure a smooth experience for federated servers. Please see the dedicated [DNS tuning guide](./dns.mdx).
## Cache capacities
@@ -115,6 +115,8 @@ https://matrix.example.com {
:::info Vet your trusted servers!
Trusted servers are your first point of contact when obtaining public keys from other servers, and they could theoretically impersonate other servers and cause significant harm to your deployment. Please thoroughly verify your trusted servers' credibility before adding them to your configuration.
If you need suggestions for trusted servers, ask in the Continuwuity main room.
:::
Trusted servers are queried sequentially in the order they are listed. If you have multiple trusted servers configured, put the faster ones first:
+48 -35
View File
@@ -42,12 +42,16 @@ running compaction is not recommended, or compaction via a timer, due to
creating unnecessary I/O amplification. RocksDB is built with io_uring support
via liburing for improved read performance.
RocksDB troubleshooting can be found [in the RocksDB section of troubleshooting](troubleshooting.md).
RocksDB troubleshooting can be found [in the RocksDB section of troubleshooting](./troubleshooting.mdx#rocksdb--database-issues).
### Compression
Some RocksDB settings can be adjusted such as the compression method chosen. See
the RocksDB section in the [example config](./reference/config.mdx).
Some RocksDB settings can be adjusted, such as the chosen compression method and level.
See the RocksDB section in the [example config](./reference/config.mdx), and the
[database compression section](./guides/performance.mdx#tuning-database-compression)
in the performance tuning documentation for more.
#### Caveats for btrfs users
btrfs users have reported that database compression does not need to be disabled
on Continuwuity as the filesystem already does not attempt to compress. This can be
@@ -57,10 +61,12 @@ to ensure no additional filesystem compression takes place as this can render
unbuffered Direct IO inoperable, significantly slowing down read and write
performance. See [the Btrfs docs](https://btrfs.readthedocs.io/en/latest/Compression.html#compatibility).
> Compression is done using the COW mechanism so it’s incompatible with
> nodatacow. Direct IO read works on compressed files but will fall back to
> buffered writes and leads to no compression even if force compression is set.
> Currently nodatasum and compression don’t work together.
:::important
Compression is done using the COW mechanism so it’s incompatible with
`nodatacow`. Direct IO read works on compressed files but will fall back to
buffered writes and leads to no compression even if force compression is set.
Currently `nodatasum` and compression don’t work together.
:::
### Files in database
@@ -78,37 +84,47 @@ config option.
## 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.
### Database online backup
f you'd like to run an online backup of your database - that is, a backup with
no downtime - check the [`!admin server` command](./reference/admin/server.md)
for the required 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 as the
format of offline backups. 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 Continuwuity
- create a new directory for merging together the data
- in the online backup created, copy all `.sst` files in
- Shutdown Continuwuity
- 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
- Copy all the files in `$DATABASE_BACKUP_PATH/private/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
- Set your `database_path` config option to your new directory, or replace your
old one with the new one you crafted
- start up Continuwuity again and it should open as normal
- Start up Continuwuity again and it should open as normal
Note: You can verify the necessary files to copy by comparing them with contents in the `$DATABASE_BACKUP_PATH/meta/1` (or latest backup number) file.
### Database offline backup
If you'd like to do an offline backup, shutdown Continuwuity 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 backup
## Media
Media is stored in the `media/` subdirectory from your database directory.
Backing up media is also just copying that subdirectory.
## Media management
Media still needs various work, however Continuwuity implements media deletion via:
@@ -117,19 +133,16 @@ 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`)
- Delete all media from a local user
- Delete all media from a remote server
- Delete cached URL previews
See the `!admin media` command for further information. All media in Continuwuity
is stored at `$DATABASE_DIR/media`. This will be configurable soon.
See the [`!admin media` commands](./reference/admin/media.md) for further information.
All media in Continuwuity is stored at `$DATABASE_DIR/media`.
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). Continuwuity 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. Continuwuity 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.
While Continuwuity does not implement built-in S3 support, using an S3 filesystem
mount on the `media/` path will work. Continuwuity also sends a `Cache-Control`
header of 1 year with the `immutable` directive for all media requests
(download and thumbnail) to reduce unnecessary bandwidth and load.
[rocksdb-compaction]: https://github.com/facebook/rocksdb/wiki/Compaction
@@ -6,10 +6,10 @@
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
},
{
"id": 16,
"id": 18,
"mention_room": true,
"date": "2026-07-13",
"message": "[Continuwuity 26.6.2](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.6.1) has just been released! This release fixes a severe bug with OIDC that could cause users' accounts to be flagged as deactivated. If you use OIDC, please update as soon as possible."
"date": "2026-08-12",
"message": "[Continuwuity 26.7.3](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.7.3) has just been released - this is a security hotfix release that fixes two security vulnerabilities. Please read the release notes for more information, before updating as soon as possible. There are no new features in this release, only the couple fixes.\n\nAny questions? Ask in our [support room](https://matrix.to/#/#continuwuity:continuwuity.org)."
}
]
}
@@ -1,54 +1,55 @@
# Continuwuity - With Caddy Labels
services:
caddy:
# This compose file uses caddy-docker-proxy as the reverse proxy for Continuwuity!
# For more info, visit https://github.com/lucaslorentz/caddy-docker-proxy
image: "docker.io/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.reverse_proxy: /.well-known/matrix/* homeserver:8008
caddy:
# This compose file uses caddy-docker-proxy as the reverse proxy for Continuwuity!
# For more info, visit https://github.com/lucaslorentz/caddy-docker-proxy
image: "docker.io/lucaslorentz/caddy-docker-proxy:ci-alpine"
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
labels:
caddy: example.com
caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
#- ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com # EDIT THIS
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
#CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
# - ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com # EDIT THIS
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
# CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
# Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://matrix.example.com,
server=matrix.example.com:443
}
# Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://matrix.example.com,
server=matrix.example.com:443
}
networks:
- proxy
labels:
caddy: matrix.example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
networks:
- caddy
labels:
caddy: matrix.example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
volumes:
db:
networks:
caddy:
proxy:
@@ -1,57 +1,46 @@
# Continuwuity - Using Caddy Docker Image
services:
caddy:
image: "docker.io/caddy:latest"
ports:
- 80:80
- 443:443
networks:
- caddy
volumes:
- ./data:/data
restart: unless-stopped
configs:
- source: Caddyfile
target: /etc/caddy/Caddyfile
caddy:
image: "docker.io/caddy:latest"
ports:
- 80:80
- 443:443
networks:
- caddy
volumes:
- ./data:/data
# mount your created Caddyfile into the container
- ./Caddyfile:/etc/caddy/Caddyfile
restart: unless-stopped
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
#- ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
#CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
# - ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
# CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
## Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://matrix.example.com,
server=matrix.example.com:443
}
## Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://example.com,
server=example.com:443
}
networks:
- caddy
networks:
- proxy
networks:
caddy:
proxy:
volumes:
db:
configs:
Caddyfile:
content: |
https://matrix.example.com:443 {
reverse_proxy http://homeserver:8008
}
https://example.com:443 {
reverse_proxy /.well-known/matrix* http://homeserver:8008
}
@@ -0,0 +1,59 @@
services:
lk-jwt-service:
image: ghcr.io/element-hq/lk-jwt-service:latest
container_name: lk-jwt-service
# lk-jwt-service environment config here..
labels:
caddy: livekit.example.com
caddy.@lk-jwt-service.path: "/sfu/get* /healthz* /get_token*"
caddy.reverse_proxy: "@lk-jwt-service {{upstreams 8081}}"
livekit:
image: docker.io/livekit/livekit-server:latest
container_name: livekit
command: --config /etc/livekit.yaml
restart: unless-stopped
labels:
caddy: livekit.example.com
caddy.reverse_proxy: "{{upstreams 7880}}"
volumes:
- ./livekit.yaml:/etc/livekit.yaml:ro
ports:
- "7881:7881/tcp"
- "50100-50200:50100-50200/udp"
caddy:
image: docker.io/lucaslorentz/caddy-docker-proxy:ci-alpine
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
labels:
caddy.1_respond: /.well-known/matrix/server {"m.server":"matrix.example.com:443"}
caddy.2_respond: /.well-known/matrix/client {"m.server":{"base_url":"https://matrix.example.com"},"m.homeserver":{"base_url":"https://matrix.example.com"},"org.matrix.msc4143.rtc_foci":[{"type":"livekit","livekit_service_url":"https://livekit.example.com"}]}
# If you already configured `[global.well_known]` with Continuwuity,
# comment out the *_respond labels and uncomment the line below:
# caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008
# If you are having problems with continuwuity serving headers,
# uncomment the header section below.
# caddy: example.com
# caddy.0_header: "*"
# caddy.0_header.Access-Control-Allow-Origin: "*"
# caddy.0_header.Access-Control-Allow-Methods: "GET, POST, OPTIONS"
# caddy.0_header.Access-Control-Allow-Headers: "Authorization"
# caddy.0_header.Content-Type: "application/json"
homeserver:
image: forgejo.ellis.link/continuwuation/continuwuity:latest
restart: unless-stopped
# add additional environment, volume, and network config here...
labels:
caddy: matrix.example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
+26
View File
@@ -0,0 +1,26 @@
server {
server_name livekit.example.com;
# for lk-jwt-service
location ~ ^/(sfu/get|healthz|get_token) {
proxy_pass http://127.0.0.1:8081$request_uri;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_buffering off;
}
# for LiveKit
location / {
proxy_pass http://127.0.0.1:7880$request_uri;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_buffering off;
# WebSocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
@@ -1,51 +1,52 @@
# Continuwuity - With Caddy Labels
services:
caddy:
# This compose file uses caddy-docker-proxy as the reverse proxy for Continuwuity!
# For more info, visit https://github.com/lucaslorentz/caddy-docker-proxy
image: "docker.io/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
caddy:
# This compose file uses caddy-docker-proxy as the reverse proxy for Continuwuity!
# For more info, visit https://github.com/lucaslorentz/caddy-docker-proxy
image: "docker.io/lucaslorentz/caddy-docker-proxy:ci-alpine"
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=proxy
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
#- ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
#CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
# - ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
# CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
# Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://example.com,
server=example.com:443
}
# Serve .well-known files to tell others to reach Continuwuity on port :443
CONTINUWUITY_WELL_KNOWN: |
{
client=https://example.com,
server=example.com:443
}
networks:
- proxy
labels:
caddy: example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
networks:
- caddy
labels:
caddy: example.com
caddy.reverse_proxy: "{{upstreams 8008}}"
volumes:
db:
db:
networks:
caddy:
proxy:
@@ -1,56 +1,48 @@
# Continuwuity - Using Caddy Docker Image
services:
caddy:
image: "docker.io/caddy:latest"
ports:
- 80:80
- 443:443
- 8448:8448
networks:
- caddy
volumes:
- ./data:/data
restart: unless-stopped
configs:
- source: Caddyfile
target: /etc/caddy/Caddyfile
caddy:
image: "docker.io/caddy:latest"
ports:
- 80:80
- 443:443
- 8448:8448
networks:
- proxy
volumes:
- ./data:/data
# mount your created Caddyfile into the container
- ./Caddyfile:/etc/caddy/Caddyfile
restart: unless-stopped
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
#- ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
#CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
homeserver:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
volumes:
- db:/var/lib/continuwuity
- ./continuwuity-resolv.conf:/etc/resolv.conf # use custom resolvers rather than Docker's
# - ./continuwuity.toml:/etc/continuwuity.toml
environment:
CONTINUWUITY_SERVER_NAME: example.com
CONTINUWUITY_DATABASE_PATH: /var/lib/continuwuity
CONTINUWUITY_ADDRESS: 0.0.0.0
CONTINUWUITY_PORT: 8008
# CONTINUWUITY_CONFIG: '/etc/continuwuity.toml' # Uncomment if you mapped config toml above
## (Optional) Serve .well-known files to tell others to reach Continuwuity on port :443
## If you do this, remove all routes to port :8448 from the compose and Caddyfile
# CONTINUWUITY_WELL_KNOWN: |
# {
# client=https://example.com,
# server=example.com:443
# }
## (Optional) Serve .well-known files to tell others to reach Continuwuity on port :443
## If you do this, remove all routes to port :8448 from the compose and Caddyfile
# CONTINUWUITY_WELL_KNOWN: |
# {
# client=https://example.com,
# server=example.com:443
# }
networks:
- caddy
networks:
- proxy
networks:
caddy:
proxy:
volumes:
db:
configs:
Caddyfile:
content: |
https://example.com:443, https://example.com:8448 {
reverse_proxy http://homeserver:8008
}
db:
+1 -1
View File
@@ -4,7 +4,7 @@
Commands for managing rooms
## `!admin rooms list-rooms`
## `!admin rooms list`
List all rooms the server knows about
+1 -1
View File
@@ -36,7 +36,7 @@ List database backups
Send a message to the admin room
## `!admin server reload-mods`
## `!admin server reload`
Hot-reload the server
+2 -2
View File
@@ -4,7 +4,7 @@
Commands for managing local users
## `!admin users create-user`
## `!admin users create`
Create a new user
@@ -92,7 +92,7 @@ Disable login for a user
Disables login for the specified user without deactivating or locking their account. This prevents the user from obtaining new access tokens, but does not invalidate existing sessions.
## `!admin users list-users`
## `!admin users list`
List local users in the database
+5
View File
@@ -1,3 +1,8 @@
## Configuration file reference
This configuration file reflect the latest developments on the `main` branch. To check the configuration from a specific Continuwuity version, browse the [tags](https://forgejo.ellis.link/continuwuation/continuwuity/tags) and navigate to the `conduwuit-example.toml` file for that version.
---
```toml file="../../conduwuit-example.toml"
+5 -3
View File
@@ -13,7 +13,7 @@ Please check that your issues are not due to problems with your Docker setup.
Some slowness is to be expected if you're the first person on your homeserver to join a room (which will
always be the case for single-user homeservers). In this situation, your homeserver has to verify the signatures of
all of the state events sent by other servers before your join. To make this process as fast as possible, make sure you have
multiple fast, trusted servers listed in `trusted_servers` in your configuration, and ensure
[multiple fast, trusted servers](./guides/performance.mdx#tuning-your-trusted-servers) listed in `trusted_servers` in your configuration, and ensure
`query_trusted_key_servers_first_on_join` is set to true (the default).
If you need suggestions for trusted servers, ask in the Continuwuity main room.
@@ -23,6 +23,8 @@ which is a longstanding bug with synchronizing room joins to clients. In this si
the bug caused your homeserver to forget to tell your client. **To fix this, clear your client's cache.** Both Element and Cinny
have a button to clear their cache in the "About" section of their settings.
[Tuning your DNS](./guides/dns.mdx) can also help make initial joins faster.
### Configuration not working as expected
Sometimes you can make a mistake in your configuration that
@@ -64,7 +66,7 @@ Follow the [**DNS tuning guide**](./guides/dns) for details on setting it up.
### Intermittent federation failures to a specific server
There may be circumstances where servers fail to connect to each other, probably due to a bad DNS cache. In such cases, issuing `!admin debug ping <SERVER_NAME>` would return some errors.
There may be circumstances where servers fail to connect to each other, probably due to a bad DNS cache. In such cases, issuing `!admin debug ping <SERVER_NAME>` would return some errors, and `!admin query resolver cache <SERVER_NAME>` would return a wrong destination endpoint.
To fix this, you can run `!admin query resolver flush-cache <SERVER_NAME>` to clear the bad cache for that domain, and outbound requests should work again.
@@ -121,7 +123,7 @@ much possible corruption is restored
Note that users should not really need to debug 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`.
Various debug commands can be [found in `!admin debug`](./reference/admin/debug).
### Debug/Trace log level
+110 -126
View File
@@ -16,21 +16,21 @@
}
},
"node_modules/@emnapi/core": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
"integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
"integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.2",
"@emnapi/wasi-threads": "1.2.3",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
"integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
"integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -39,9 +39,9 @@
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
"integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==",
"dev": true,
"license": "MIT",
"optional": true,
@@ -125,13 +125,13 @@
}
},
"node_modules/@rsbuild/core": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.1.5.tgz",
"integrity": "sha512-7TW4U1SH7VxQZzSTIOzvwj5lo9uNTmGpsmTXFr4axQAE4giLDKP3kVUA1ZW4P3/Mz4QQJJyvZP29mVcb8kZCfg==",
"version": "2.1.10",
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.1.10.tgz",
"integrity": "sha512-lwxC5w88U2AMv6aNwG3VH7+AV33N4JJQjD//egVWFsMbV+OE/bnfCsurSpX8s3lGyRYkJMwUVN+YXMbmmYZFfw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rspack/core": "~2.1.3",
"@rspack/core": "~2.1.8",
"@swc/helpers": "^0.5.23"
},
"bin": {
@@ -169,30 +169,30 @@
}
},
"node_modules/@rspack/binding": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.1.3.tgz",
"integrity": "sha512-4UGXJqUHmm36tWG1GgFZz3p8sQ5JuSgWI+gq1xPPoihS41uYJL3cXuJnirTeWsmVrusmYZTQhgU3tl3VYGcJYg==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.1.8.tgz",
"integrity": "sha512-tmAyHzDbPiy8V7HvQqtuPsbs6dPgwV0YjzW5XrPRV9gzf+Hdm7pvsZJKE1QKO9WV5RuvGYav98xIX6O+abZxzQ==",
"dev": true,
"license": "MIT",
"optionalDependencies": {
"@rspack/binding-darwin-arm64": "2.1.3",
"@rspack/binding-darwin-x64": "2.1.3",
"@rspack/binding-linux-arm64-gnu": "2.1.3",
"@rspack/binding-linux-arm64-musl": "2.1.3",
"@rspack/binding-linux-riscv64-gnu": "2.1.3",
"@rspack/binding-linux-riscv64-musl": "2.1.3",
"@rspack/binding-linux-x64-gnu": "2.1.3",
"@rspack/binding-linux-x64-musl": "2.1.3",
"@rspack/binding-wasm32-wasi": "2.1.3",
"@rspack/binding-win32-arm64-msvc": "2.1.3",
"@rspack/binding-win32-ia32-msvc": "2.1.3",
"@rspack/binding-win32-x64-msvc": "2.1.3"
"@rspack/binding-darwin-arm64": "2.1.8",
"@rspack/binding-darwin-x64": "2.1.8",
"@rspack/binding-linux-arm64-gnu": "2.1.8",
"@rspack/binding-linux-arm64-musl": "2.1.8",
"@rspack/binding-linux-riscv64-gnu": "2.1.8",
"@rspack/binding-linux-riscv64-musl": "2.1.8",
"@rspack/binding-linux-x64-gnu": "2.1.8",
"@rspack/binding-linux-x64-musl": "2.1.8",
"@rspack/binding-wasm32-wasi": "2.1.8",
"@rspack/binding-win32-arm64-msvc": "2.1.8",
"@rspack/binding-win32-ia32-msvc": "2.1.8",
"@rspack/binding-win32-x64-msvc": "2.1.8"
}
},
"node_modules/@rspack/binding-darwin-arm64": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.1.3.tgz",
"integrity": "sha512-oOGI0RSL89Ehu9T22rugmfUY9OC2eBqLMeWRYsu7bhlUrjoXeVfGBBSEXCse666BQ1sAiM8hD/k7nqVria/okQ==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.1.8.tgz",
"integrity": "sha512-kia+eWtyWPvR4ntg1bWYoVU8nLPbUg2fG3zgBEocsTcsh5ZENSiEPxEKymDgMyIMONUqj611E0775cdUBoNmqw==",
"cpu": [
"arm64"
],
@@ -204,9 +204,9 @@
]
},
"node_modules/@rspack/binding-darwin-x64": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.1.3.tgz",
"integrity": "sha512-sVqWXNiFTMXAyN362y6IA+eJc8LXZKfHdhEJ/zDuMmRp+u2IvhgaF8tk3vX/OmeB9jydVjySijuiqk8No/FoCA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.1.8.tgz",
"integrity": "sha512-08pBkFhlD3Y3Qzh94w/Fc3skaIE3e96kl2P14m8+tnYTcglpOfpA2OwS3iHt9fOqy0HjoAVe6/MW3cBgs5iabA==",
"cpu": [
"x64"
],
@@ -218,9 +218,9 @@
]
},
"node_modules/@rspack/binding-linux-arm64-gnu": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.1.3.tgz",
"integrity": "sha512-aCy9Zli/2Qf+Ee5otXfFQ6mhv5fEyn0wIoBVmouqtJoqOO21et6UTtJ+LHLsMDolwGLyHERAljeSFSmYX3/O5A==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.1.8.tgz",
"integrity": "sha512-KLniMc9GzhKpVqhPzaJo3KJwzdAllXVVqZIk/uL1QipXOxs57fgM4u7IexKPFVla0o/u1PQG/Ah2YLDmda24Ow==",
"cpu": [
"arm64"
],
@@ -235,9 +235,9 @@
]
},
"node_modules/@rspack/binding-linux-arm64-musl": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.1.3.tgz",
"integrity": "sha512-flIE7eluz0d21Fn28EVm3vPwoJooOSqtmjLFVSuOMcoCbwV9clfor195oIrAppp/W7dL/3XquFuVfrsa01Jy8Q==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.1.8.tgz",
"integrity": "sha512-yUKAxHNGnICtw5RnxFWu4dHtsz/tdt7rbeFcsINNVre9HcrRxf5XP+FbOGL/SMxd9oM9XCo10paU2WckTKwbEA==",
"cpu": [
"arm64"
],
@@ -252,9 +252,9 @@
]
},
"node_modules/@rspack/binding-linux-riscv64-gnu": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.1.3.tgz",
"integrity": "sha512-yojg8elye1nhsNeGncw0NrZ4pMGF7NVebR80CLg72TXyzfYwFJlFTdU5yUYb1Gy+JXIvrSCwzQt2QkyiEvmkfg==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.1.8.tgz",
"integrity": "sha512-gg4S1jaitwYPHR9HZ3zNGH1EK2GXINm66p4kEpOP1gbc+akyOouVF/dMcu9NGPlRg58FbEhVRZYKu7Z/zcpKHg==",
"cpu": [
"riscv64"
],
@@ -269,9 +269,9 @@
]
},
"node_modules/@rspack/binding-linux-riscv64-musl": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.1.3.tgz",
"integrity": "sha512-6PvbXb3FOK4X3S5QGvoSW/sqExmsvAoPnQ/YSFrXvTphkXFezA7wnobmGBHT8JQP31hcFRzJHIZSIOKktzSzzg==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.1.8.tgz",
"integrity": "sha512-b/aU5j1h368SLNyz5u+flqpZVhzSZ1UIslaj9sZJuAvqkGWv3xsjc/28/PTo/RYXCxd0FNVAxTxWHKvRiAAS8w==",
"cpu": [
"riscv64"
],
@@ -286,9 +286,9 @@
]
},
"node_modules/@rspack/binding-linux-x64-gnu": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.1.3.tgz",
"integrity": "sha512-lMXjoGKf0SnviH596fmTszgtnXLHmWOoE90G8grG9MvKVa3pelRmfps5ewZL9s8ENf3NXRfOxIhIf/M9as6MqA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.1.8.tgz",
"integrity": "sha512-EyegohSx0BJRqieCg9f/caCqFARRWkqI5hwJt6k530MoOTLeq8I3vsbeg24/2MktwIC1dmJi8bl0+WhPKQs4eQ==",
"cpu": [
"x64"
],
@@ -303,9 +303,9 @@
]
},
"node_modules/@rspack/binding-linux-x64-musl": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.1.3.tgz",
"integrity": "sha512-0esT35v7pW2ZsJTMc/zDUHwpNXlPqyUCyuiLJvrAAUcdENrgOVe4DmFrgVJ2hwqI4GjeN1VBnGRJ8c+edAHH5w==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.1.8.tgz",
"integrity": "sha512-I6E+goN+UQ297q4r1qdbiAyNCI3t0+a5Y0xDIAPOZfRDRxDTnH/LF8/y65gjsJoKRKyn7zxRC0T/NURTkRNQ9A==",
"cpu": [
"x64"
],
@@ -320,9 +320,9 @@
]
},
"node_modules/@rspack/binding-wasm32-wasi": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.1.3.tgz",
"integrity": "sha512-UsrDjD59UEP0mhfN/Z+uTc3vLgiUvIr+mn92WC1sbQi9gtZohTYvaQYFhWuMkBqsACGcmZp704JAbbSrVrVYCA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.1.8.tgz",
"integrity": "sha512-om7GAKWAU3lcSvbCon2m7mzw8v9OTrO2LW2MZ1lGe/uVJJmwGGkl9HVoXFyWFLrN6YVFyx8iP+AkN4owDWB9Cw==",
"cpu": [
"wasm32"
],
@@ -330,15 +330,15 @@
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "1.11.1",
"@emnapi/runtime": "1.11.1",
"@emnapi/core": "1.11.3",
"@emnapi/runtime": "1.11.3",
"@napi-rs/wasm-runtime": "1.1.6"
}
},
"node_modules/@rspack/binding-win32-arm64-msvc": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.1.3.tgz",
"integrity": "sha512-42RS/SwKBTkNvXIPZXqTn0yEFN8zwGRfRe/ly0GDvPp/KxpLMFWxJmLxgtoLompU+0UCGvV4KpcBENt3oWs6BA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.1.8.tgz",
"integrity": "sha512-WDnsP/SUb9zbxyGX9XjPw5AXrX86u5oidn0MDdfJduOOqdCSpHwmRjlQ8NUJhbBq9WqVJMFlcab7NwZVWX/yyg==",
"cpu": [
"arm64"
],
@@ -350,9 +350,9 @@
]
},
"node_modules/@rspack/binding-win32-ia32-msvc": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.1.3.tgz",
"integrity": "sha512-thk43H1JHHbetNF3txcsGXeOwZi2m6Luf/uVUqNORXjxr5VV8woHAgaAx4QXVZRg70z1VDjd8mBWnHBnKI0FGA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.1.8.tgz",
"integrity": "sha512-QiMQMPNDiY3dhhaIdaFPzcPDC06cEYkNY89ea+EmDvNVgZq6V+2mFS/WnzZVMeEbGAYJCjsv/ABhhLT1hlYMvg==",
"cpu": [
"ia32"
],
@@ -364,9 +364,9 @@
]
},
"node_modules/@rspack/binding-win32-x64-msvc": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.1.3.tgz",
"integrity": "sha512-ObaUcj+BHo/aBL1weyM3orApaHyAR5Phr3YNEpQEifxjZbNKM1iO5X5prN4OqEv3H+7o5e/Wh9Fy3N7Vvd+psA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.1.8.tgz",
"integrity": "sha512-b7sA5eB64vo2mbsuc//MOYzVLeCKHPn0dfP/GmNEoHdWbhRgZ/orZLWurYMQj04ELTLW6YCJEy59g5KRzNYHfw==",
"cpu": [
"x64"
],
@@ -378,13 +378,13 @@
]
},
"node_modules/@rspack/core": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.1.3.tgz",
"integrity": "sha512-1iGnxLrP+iyY0ZSjLZeQTaxrISpQz4yLyqJPmaF/l4uw27/dBcrloszAeLOJQ9jiv7EJtU0T5zB+LOFPpivIxA==",
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.1.8.tgz",
"integrity": "sha512-na1kyA6Mj8/LWw9O3A8NsrG9rNKN3Iq2WiXrEuIwsU5r/Nl/evm3hO7bWKHxgsRyydI6W7okwx3MXgf8rzel6g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rspack/binding": "2.1.3"
"@rspack/binding": "2.1.8"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
@@ -419,20 +419,21 @@
}
},
"node_modules/@rspress/core": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.18.tgz",
"integrity": "sha512-DBpsr/6XAItQkZPL5FSjthLGuzdG9ks/7EOxkqaaXp93uAT54LO0PD5Dkoy6ydup1PnvkpHyiHpUyDcnHHTVhg==",
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.19.tgz",
"integrity": "sha512-m0KfQNNXxjP975652nIOwUTqrvbJapRp4NpnoQMc5heawGhkC4+F7zTHvxY+huvzGYnKtL2fMMTrgWhEjKkrug==",
"dev": true,
"license": "MIT",
"dependencies": {
"@mdx-js/mdx": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@rsbuild/core": "^2.1.5",
"@rsbuild/core": "^2.1.8",
"@rsbuild/plugin-react": "~2.1.0",
"@rspress/shared": "2.0.18",
"@rspress/shared": "2.0.19",
"@shikijs/rehype": "^4.2.0",
"@types/unist": "^3.0.3",
"@unhead/react": "^2.1.15",
"@types/mdast": "^4.0.4",
"@types/react": "^19.2.17",
"@unhead/react": "^2.1.16",
"body-scroll-lock": "4.0.0-beta.0",
"clsx": "2.1.1",
"copy-to-clipboard": "^3.3.3",
@@ -443,10 +444,9 @@
"mdast-util-mdxjs-esm": "^2.0.1",
"medium-zoom": "1.1.0",
"nprogress": "^0.2.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-lazy-with-preload": "^2.2.1",
"react-reconciler": "0.33.0",
"react-render-to-markdown": "19.1.0",
"react-router-dom": "^7.18.1",
"rehype-external-links": "^3.0.0",
@@ -460,9 +460,9 @@
"scroll-into-view-if-needed": "^3.1.0",
"shiki": "^4.2.0",
"unified": "^11.0.5",
"unist-util-remove": "^4.0.0",
"unist-util-visit": "^5.1.0",
"unist-util-visit-children": "^3.0.0"
"unist-util-visit-children": "^3.0.0",
"vfile": "^6.0.3"
},
"bin": {
"rspress": "bin/rspress.js"
@@ -472,9 +472,9 @@
}
},
"node_modules/@rspress/plugin-client-redirects": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.18.tgz",
"integrity": "sha512-q70ufN0S125kl0QlucO7JuiZ0WJaxFOtPPoGu7eWwam9fb+i4YsWnOWtAKSKGH4JP5+897mgpDPP+dmfl9DPCw==",
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.19.tgz",
"integrity": "sha512-BUwgEyj8vCkU58cV3Gp97aTSnfGJm7aXh40K0Dot1BqsCQ8ekdsMuaLXrICROdP9/ctd4oALtLBkOE+PKTa4Sg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -485,9 +485,9 @@
}
},
"node_modules/@rspress/plugin-sitemap": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.18.tgz",
"integrity": "sha512-XfaXzZx+ASN9OMTc0fOvW8QmbmyCyDWkO8xJj4XF4E0YJtsu7j/65+v8/KXXdwpywOfUIQ6M94/meRTy2urNmQ==",
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.19.tgz",
"integrity": "sha512-9ydrpj9hmmXWKWKIXUqJ1UrfxSvfxhHZRBZLb5OkTlOuQBNAg6BpsrW1WHoJqJr7p+3zqlz7S/9HTzSA3+EYcA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -498,14 +498,16 @@
}
},
"node_modules/@rspress/shared": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.18.tgz",
"integrity": "sha512-GJswqJQCPSxvBt5r+gJzz8Em8EEK/sOmCQjTpemTvldvxr1Lva85BGVnSQZOgofnM0nrjt18kn4mmnuuSstbpA==",
"version": "2.0.19",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.19.tgz",
"integrity": "sha512-INrETllWuR49lksqCz+xeLSO6rKtHA+5Ix2YQWcP9nerCuTSyGYwH8eBC0HrIacJkGHxB8wkkbV99tyzGtY8Wg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rsbuild/core": "^2.1.5",
"@rsbuild/core": "^2.1.8",
"@shikijs/rehype": "^4.2.0",
"@types/react": "^19.2.17",
"mdast-util-mdx-jsx": "^3.2.0",
"unified": "^11.0.5"
}
},
@@ -723,7 +725,6 @@
"integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
@@ -1083,13 +1084,13 @@
"license": "ISC"
},
"node_modules/@unhead/react": {
"version": "2.1.15",
"resolved": "https://registry.npmjs.org/@unhead/react/-/react-2.1.15.tgz",
"integrity": "sha512-5hfAaZ3XJq9JkspRzZdSPsMrXXA8v/SKiEOxZcN9L40o44byF/50bcQuOLgSSCAx8802mI5VG32KZXWTtsLu9Q==",
"version": "2.1.17",
"resolved": "https://registry.npmjs.org/@unhead/react/-/react-2.1.17.tgz",
"integrity": "sha512-KmcYksDjlLozL0fxUjIDwH/0k6+Lg2HWHLUPlkRW8Gl08hdB1AbLB5iU9QxFvkaT8p0Q4dFEqZWnz3g6RMeiRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"unhead": "2.1.15"
"unhead": "2.1.17"
},
"funding": {
"url": "https://github.com/sponsors/harlan-zw"
@@ -1272,8 +1273,7 @@
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"dev": true,
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/debug": {
"version": "4.4.3",
@@ -3176,9 +3176,9 @@
}
},
"node_modules/react": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.7.tgz",
"integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==",
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -3186,16 +3186,16 @@
}
},
"node_modules/react-dom": {
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.7.tgz",
"integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==",
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"scheduler": "^0.27.0"
},
"peerDependencies": {
"react": "^19.2.7"
"react": "^19.2.8"
}
},
"node_modules/react-lazy-with-preload": {
@@ -3736,9 +3736,9 @@
}
},
"node_modules/unhead": {
"version": "2.1.15",
"resolved": "https://registry.npmjs.org/unhead/-/unhead-2.1.15.tgz",
"integrity": "sha512-MCt5T90mCWyr3Z6pUCdM9lVRXoMoVBlL7z7U4CYVIiaDiuzad/UCfLuMqz5MeNmpZUgoBCQnrucJimU7EZR+XA==",
"version": "2.1.17",
"resolved": "https://registry.npmjs.org/unhead/-/unhead-2.1.17.tgz",
"integrity": "sha512-HLMKXOszRhAPBrr6VlqCeVeJq2kbC4kXwzGLEZvvojPLWNYTJw22xG7Bfwhsvs31+IBet3Wl8ADg9dwYdyphfQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -3810,22 +3810,6 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-remove": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/unist-util-remove/-/unist-util-remove-4.0.0.tgz",
"integrity": "sha512-b4gokeGId57UVRX/eVKej5gXqGlc9+trkORhFJpu9raqZkZhU0zm8Doi05+HaiBsMEIJowL+2WtQ5ItjsngPXg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/unist": "^3.0.0",
"unist-util-is": "^6.0.0",
"unist-util-visit-parents": "^6.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/unist-util-stringify-position": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz",
+12 -1
View File
@@ -25,6 +25,8 @@ export default defineConfig({
'/advanced/delegated.docker-compose.with-caddy-labels.yml',
'/advanced/delegated.docker-compose.for-traefik.yml',
'/advanced/delegated.docker-compose.with-traefik.yml',
'/calls/livekit.docker-compose.with-caddy-labels.yml',
'/calls/livekit.nginx.conf'
]
},
},
@@ -75,8 +77,17 @@ export default defineConfig({
from: '/community$',
to: '/community/guidelines'
}, {
from: "^/turn",
from: "^/turn$",
to: "/calls/turn",
}, {
from: "^/livekit$",
to: "/calls/livekit",
}, {
from: "^/dns",
to: "/guides/dns",
}, {
from: "^/source(|_code)$",
to: "https://forgejo.ellis.link/continuwuation/continuwuity",
}
]
})],
+56
View File
@@ -1237,4 +1237,60 @@ impl crate::Context<'_> {
))
.await
}
pub(super) async fn servers_in_backoff(
&self,
room_id: Option<OwnedRoomId>,
name: Option<OwnedServerName>,
) -> Result {
let backoff_map = self.services.federation.remote_health();
if backoff_map.is_empty() {
return self.write_str("No servers are currently in backoff.").await;
}
let stale_map = self.services.federation.stale_destinations();
if let Some(specific_server_name) = name {
let entry = backoff_map.get(&specific_server_name);
return match entry {
| Some((retries, next_retry)) =>
self.write_str(&format!(
"{specific_server_name}: {retries} retries, next retry at {next_retry}"
))
.await,
| None =>
self.write_str(&format!("Server {specific_server_name} is not in backoff."))
.await,
};
}
self.write_str("| Server Name | Retries | Next connection attempt | Is stale |\n")
.await?;
self.write_str("| ----------- | ------- | ----------------------- | -------- |\n")
.await?;
if let Some(specific_room) = room_id {
let mut servers_in_room =
self.services.rooms.state_cache.room_servers(&specific_room);
while let Some(server_name) = servers_in_room.next().await {
let Some((retries, retry_at)) = backoff_map.get(&server_name) else { continue };
let is_stale = if stale_map.contains(&server_name) { "Yes" } else { "No" };
self.write_str(&format!(
"| {server_name} | {retries} | {retry_at} | {is_stale} |\n"
))
.await?;
}
return Ok(());
}
for (server_name, (retries, retry_at)) in &backoff_map {
let is_stale = if stale_map.contains(server_name) { "Yes" } else { "No" };
self.write_str(&format!("| {server_name} | {retries} | {retry_at} | {is_stale} |\n"))
.await?;
}
Ok(())
}
}
+14
View File
@@ -250,6 +250,20 @@ pub enum DebugCommand {
page: Option<usize>,
},
/// Lists remote servers that are currently in a "backoff" state.
///
/// Servers in this list will not be contacted until the retry time elapses,
/// or they make contact first.
///
/// "Stale" indicates that routing information may be out of date, and the
/// remote will be re-resolved immediately before the next contact attempt.
ServersInBackoff {
#[arg(short, long, alias = "room")]
room_id: Option<OwnedRoomId>,
#[arg(short, long)]
name: Option<OwnedServerName>,
},
/// Developer test stubs
#[command(subcommand)]
#[allow(non_snake_case)]
+1 -1
View File
@@ -18,7 +18,7 @@ use crate::admin_command_dispatch;
#[derive(Debug, Subcommand)]
pub enum RoomCommand {
/// List all rooms the server knows about
#[clap(alias = "list")]
#[command(name = "list", alias = "list-rooms")]
ListRooms {
page: Option<usize>,
+1 -1
View File
@@ -40,7 +40,7 @@ pub enum ServerCommand {
},
/// Hot-reload the server
#[clap(alias = "reload")]
#[command(name = "reload", alias = "reload-mods")]
ReloadMods,
#[cfg(unix)]
+2 -2
View File
@@ -10,7 +10,7 @@ use crate::admin_command_dispatch;
#[derive(Debug, Subcommand)]
pub enum UserCommand {
/// Create a new user
#[clap(alias = "create")]
#[command(name = "create", alias = "create-user")]
CreateUser {
/// Username of the new user
username: String,
@@ -163,7 +163,7 @@ pub enum UserCommand {
},
/// List local users in the database
#[clap(alias = "list")]
#[command(name = "list", alias = "list-users")]
ListUsers,
/// Lists all the rooms (local and remote) that the specified user is
+20
View File
@@ -138,6 +138,26 @@ pub(crate) async fn register_route(
};
debug_info!(%user_id, ?device, "New account created via legacy registration");
// Only log if the user wasn't registered via an appservice.
if body.identity.is_none() {
let notice = if device.is_some()
&& let Some(device_name) = body.initial_device_display_name.as_ref()
{
format!(
"New user \"{user_id}\" registered on this server from IP {client} and device \
display name \"{device_name}\" via legacy registration",
)
} else {
format!(
"New user \"{user_id}\" registered on this server from IP {client} via legacy \
registration."
)
};
info!("{notice}");
if services.server.config.admin_room_notices {
services.admin.notice(&notice).await;
}
}
Ok(assign!(register::v3::Response::new(user_id), {
access_token: token.map(DeviceToken::into_token),
+39 -22
View File
@@ -1,6 +1,5 @@
use axum::extract::State;
use conduwuit::{Err, Result};
use futures::future::{join, join3};
use ruma::api::client::admin::{is_user_locked, lock_user};
use crate::Ruma;
@@ -12,17 +11,32 @@ pub(crate) async fn get_lock_status(
State(services): State<crate::State>,
body: Ruma<is_user_locked::v1::Request>,
) -> Result<is_user_locked::v1::Response> {
let (admin, status) = join(
services.users.is_admin(body.identity.expect_sender_user()?),
services.users.status(&body.user_id),
)
.await;
let sender_user = body.identity.expect_sender_user()?;
let sender_is_admin = services.users.is_admin(sender_user).await;
if !admin {
if !sender_is_admin {
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
status.ensure_active()?;
if body.user_id != *sender_user {
let target_is_admin = services.users.is_admin(&body.user_id).await;
if target_is_admin {
return Err!(Request(Forbidden(
"You cannot view the lock status of another server administrator"
)));
}
}
if !services.globals.user_is_local(&body.user_id) {
return Err!(Request(InvalidParam("User does not belong to the local server")));
}
let status = services.users.status(&body.user_id).await;
if !status.is_active() {
return Err!(Request(NotFound("This account does not exist")));
}
Ok(is_user_locked::v1::Response::new(
services.users.is_locked(&body.user_id).await?,
@@ -37,28 +51,31 @@ pub(crate) async fn put_lock_status(
body: Ruma<lock_user::v1::Request>,
) -> Result<lock_user::v1::Response> {
let sender_user = body.identity.expect_sender_user()?;
let sender_is_admin = services.users.is_admin(sender_user).await;
let (sender_admin, status, target_admin) = join3(
services.users.is_admin(sender_user),
services.users.status(&body.user_id),
services.users.is_admin(&body.user_id),
)
.await;
if !sender_admin {
if !sender_is_admin {
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
status.ensure_active()?;
if body.user_id == *sender_user {
return Err!(Request(Forbidden("You cannot lock yourself")));
}
if target_admin {
let target_is_admin = services.users.is_admin(&body.user_id).await;
if target_is_admin {
return Err!(Request(Forbidden("You cannot lock another server administrator")));
}
if !services.globals.user_is_local(&body.user_id) {
return Err!(Request(InvalidParam("User does not belong to the local server")));
}
let status = services.users.status(&body.user_id).await;
if !status.is_active() {
return Err!(Request(NotFound("This account does not exist")));
}
if services.users.is_locked(&body.user_id).await? == body.locked {
// No change
return Ok(lock_user::v1::Response::new(body.locked));
@@ -67,16 +84,16 @@ pub(crate) async fn put_lock_status(
let action = if body.locked {
services
.users
.suspend_account(&body.user_id, sender_user)
.lock_account(&body.user_id, sender_user)
.await;
"locked"
} else {
services.users.unsuspend_account(&body.user_id).await;
services.users.unlock_account(&body.user_id).await;
"unlocked"
};
if services.config.admin_room_notices {
// Notify the admin room that an account has been un/suspended
// Notify the admin room that an account has been un/locked
services
.admin
.send_text(&format!("{} has been {} by {}.", body.user_id, action, sender_user))
+36 -19
View File
@@ -1,6 +1,5 @@
use axum::extract::State;
use conduwuit::{Err, Result};
use futures::future::{join, join3};
use ruma::api::client::admin::{is_user_suspended, suspend_user};
use crate::Ruma;
@@ -12,17 +11,32 @@ pub(crate) async fn get_suspended_status(
State(services): State<crate::State>,
body: Ruma<is_user_suspended::v1::Request>,
) -> Result<is_user_suspended::v1::Response> {
let (admin, status) = join(
services.users.is_admin(body.identity.expect_sender_user()?),
services.users.status(&body.user_id),
)
.await;
let sender_user = body.identity.expect_sender_user()?;
let sender_is_admin = services.users.is_admin(sender_user).await;
if !admin {
if !sender_is_admin {
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
status.ensure_active()?;
if body.user_id != *sender_user {
let target_is_admin = services.users.is_admin(&body.user_id).await;
if target_is_admin {
return Err!(Request(Forbidden(
"You cannot view the suspension status of another server administrator"
)));
}
}
if !services.globals.user_is_local(&body.user_id) {
return Err!(Request(InvalidParam("User does not belong to the local server")));
}
let status = services.users.status(&body.user_id).await;
if !status.is_active() {
return Err!(Request(NotFound("This account does not exist")));
}
Ok(is_user_suspended::v1::Response::new(
services.users.is_suspended(&body.user_id).await?,
@@ -37,28 +51,31 @@ pub(crate) async fn put_suspended_status(
body: Ruma<suspend_user::v1::Request>,
) -> Result<suspend_user::v1::Response> {
let sender_user = body.identity.expect_sender_user()?;
let sender_is_admin = services.users.is_admin(sender_user).await;
let (sender_admin, status, target_admin) = join3(
services.users.is_admin(sender_user),
services.users.status(&body.user_id),
services.users.is_admin(&body.user_id),
)
.await;
if !sender_admin {
if !sender_is_admin {
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
status.ensure_active()?;
if body.user_id == *sender_user {
return Err!(Request(Forbidden("You cannot suspend yourself")));
}
if target_admin {
let target_is_admin = services.users.is_admin(&body.user_id).await;
if target_is_admin {
return Err!(Request(Forbidden("You cannot suspend another server administrator")));
}
if !services.globals.user_is_local(&body.user_id) {
return Err!(Request(InvalidParam("User does not belong to the local server")));
}
let status = services.users.status(&body.user_id).await;
if !status.is_active() {
return Err!(Request(NotFound("This account does not exist")));
}
if services.users.is_suspended(&body.user_id).await? == body.suspended {
// No change
return Ok(suspend_user::v1::Response::new(body.suspended));
+1
View File
@@ -541,6 +541,7 @@ pub(crate) async fn create_room_route(
&content,
&state_key,
None,
None,
)
.boxed()
.await
+11 -1
View File
@@ -1,7 +1,11 @@
use std::collections::BTreeMap;
use axum::extract::State;
use conduwuit::{Err, Result, err, matrix::pdu::PartialPdu, utils};
use conduwuit::{
Err, Result, err,
matrix::pdu::{PartialPdu, sticky},
utils,
};
use ruma::{api::client::message::send_message_event, events::MessageLikeEventType};
use serde_json::from_str;
@@ -81,6 +85,12 @@ pub(crate) async fn send_message_event_route(
PartialPdu {
event_type: body.event_type.clone().into(),
content,
sticky: services
.config
.allow_sticky_events
.then_some(body.sticky_duration_ms)
.flatten()
.map(sticky::object),
unsigned: Some(unsigned),
timestamp: if body.identity.is_appservice() {
body.timestamp
+1
View File
@@ -49,6 +49,7 @@ pub(crate) async fn send_state_event_for_key_route(
&body.event_type,
&body.body.body,
&body.state_key,
body.sticky_duration_ms,
if body.identity.is_appservice() {
body.timestamp
} else {
+81 -4
View File
@@ -4,7 +4,7 @@ use conduwuit::{
Result, at, debug_warn, err, extract_variant,
matrix::{
Event,
pdu::{PduCount, PduEvent},
pdu::{PduCount, PduEvent, sticky},
},
trace,
utils::{
@@ -20,12 +20,12 @@ use futures::{
future::{OptionFuture, join, join3, join4, try_join, try_join3},
};
use ruma::{
OwnedRoomId, OwnedUserId, RoomId, UserId,
MilliSecondsSinceUnixEpoch, OwnedRoomId, OwnedUserId, RoomId, UserId,
api::client::sync::sync_events::{
UnreadNotificationsCount,
v3::{
Ephemeral, JoinedRoom, RoomAccountData, RoomSummary, State as RoomState, StateEvents,
Timeline,
Sticky, Timeline,
},
},
assign,
@@ -42,7 +42,7 @@ use tokio::pin;
use super::{load_timeline, share_encrypted_room};
use crate::client::{
TimelinePdus, ignored_filter,
TimelinePdus, ignored_filter, is_ignored_pdu,
sync::v3::{
DEFAULT_TIMELINE_LIMIT, DeviceListUpdates, SyncContext, prepare_lazily_loaded_members,
state::{build_state_incremental, build_state_initial},
@@ -76,6 +76,7 @@ pub(super) async fn load_joined_room(
StateAndTimeline {
state_events,
timeline,
sticky,
summary,
notification_counts,
device_list_updates,
@@ -111,6 +112,7 @@ pub(super) async fn load_joined_room(
RoomState::Before(state_events)
},
ephemeral,
sticky,
unread_thread_notifications: BTreeMap::new(),
});
@@ -251,11 +253,82 @@ async fn build_ephemeral(
struct StateAndTimeline {
state_events: Vec<PduEvent>,
timeline: Timeline,
sticky: Sticky,
summary: Option<RoomSummary>,
notification_counts: Option<UnreadNotificationsCount>,
device_list_updates: DeviceListUpdates,
}
async fn build_sticky_events(
services: &Services,
sync_context: SyncContext<'_>,
room_id: &RoomId,
timeline: &TimelinePdus,
joined_since_last_sync: bool,
) -> Sticky {
if !services.config.allow_sticky_events {
return Sticky::new();
}
let SyncContext {
syncing_user,
last_sync_end_count,
current_count,
..
} = sync_context;
let timeline_event_ids: HashSet<_> =
timeline.pdus.iter().map(|(_, pdu)| &pdu.event_id).collect();
let now = u64::from(MilliSecondsSinceUnixEpoch::now().get());
// on join the client needs every unexpired sticky event, not just the ones
// since its last sync
let since = (!joined_since_last_sync)
.then_some(last_sync_end_count)
.flatten()
.map(PduCount::Normal);
// nothing older than this can still be sticky, so the walk back never goes far
let oldest_sticky_ts = now.saturating_sub(sticky::MAX_DURATION_MS);
let mut events = Vec::new();
let pdus = services
.rooms
.timeline
.pdus_rev(room_id, Some(PduCount::Normal(current_count).saturating_add(1)))
.ignore_err();
pin!(pdus);
while let Some((count, mut pdu)) = pdus.next().await {
if since.is_some_and(|since| count <= since)
|| u64::from(pdu.origin_server_ts) < oldest_sticky_ts
{
break;
}
let is_sticky = pdu
.sticky
.as_deref()
.is_some_and(|sticky| sticky::is_sticky(pdu.origin_server_ts, sticky, now));
if !is_sticky
|| timeline_event_ids.contains(&pdu.event_id)
|| is_ignored_pdu(services, &pdu, syncing_user)
.await
.unwrap_or(true)
{
continue;
}
pdu.set_unsigned(Some(syncing_user));
events.push(Event::into_format(pdu));
}
events.reverse();
assign!(Sticky::new(), { events })
}
/// Compute changes to the room's state and timeline.
#[tracing::instrument(level = "debug", skip_all)]
async fn build_state_and_timeline(
@@ -274,6 +347,9 @@ async fn build_state_and_timeline(
check_joined_since_last_sync(services, shortstatehashes, sync_context),
)
.await?;
let sticky =
build_sticky_events(services, sync_context, room_id, &timeline, joined_since_last_sync)
.await;
let state_events = build_state_events(
services,
@@ -342,6 +418,7 @@ async fn build_state_and_timeline(
prev_batch: prev_batch.as_ref().map(ToString::to_string),
events: filtered_timeline,
}),
sticky,
summary,
notification_counts,
device_list_updates,
+10 -3
View File
@@ -215,12 +215,18 @@ async fn build_left_state_and_timeline(
.get_pdu_count(&prev_membership_event.event_id)
.await?;
// end the timeline at the user's leave event
let timeline_end_count = services
// end the timeline at the user's leave event. for federated events, the
// membership cache is updated before the PDU is appended to the timeline,
// so the leave event may not be in the timeline index yet.
let timeline_end_count = match services
.rooms
.timeline
.get_pdu_count(leave_membership_event.event_id())
.await?;
.await
{
| Ok(count) => count,
| Err(_) => services.rooms.timeline.last_timeline_count(room_id).await?,
};
// limit the timeline using the same logic as for joined rooms
let timeline_limit = filter
@@ -328,6 +334,7 @@ fn create_dummy_leave_event(
.expect("Timestamp is valid js_int value"),
kind: TimelineEventType::RoomMember,
content: RawValue::from_string(r#"{"membership": "leave"}"#.to_owned()).unwrap(),
sticky: None,
state_key: Some(syncing_user.as_str().into()),
unsigned: None,
// The following keys are dropped on conversion
+2 -1
View File
@@ -201,6 +201,7 @@ pub(crate) async fn sync_events_route(
.update_device_last_seen(sender_user, Some(sender_device), client_ip)
.await;
let mut wake_receiver = services.sync.subscribe_to_wake(sender_user).await;
let response = build_sync_events(&services, &body).await?;
if body.body.full_state
|| !(response.rooms.is_empty()
@@ -216,7 +217,7 @@ pub(crate) async fn sync_events_route(
// Stop hanging if new info arrives
let default = Duration::from_secs(30);
let duration = cmp::min(body.body.timeout.unwrap_or(default), default);
_ = tokio::time::timeout(duration, services.sync.wait_for_wake(sender_user)).await;
_ = tokio::time::timeout(duration, wake_receiver.changed()).await;
// Retry returning data
build_sync_events(&services, &body).await
+753 -126
View File
File diff suppressed because it is too large. Load diff
+11 -4
View File
@@ -21,12 +21,19 @@ use crate::Ruma;
/// Note: Unstable features are used while developing new features. Clients
/// should avoid using unstable features in their stable releases
pub(crate) async fn get_supported_versions_route(
State(services): State<crate::State>,
_body: Ruma<get_supported_versions::Request>,
) -> Result<get_supported_versions::Response> {
Ok(assign!(
get_supported_versions::Response::new(versions()),
{ unstable_features: unstable_features() }
))
let mut unstable_features = unstable_features();
if services.config.allow_sticky_events {
// sticky events (https://github.com/matrix-org/matrix-spec-proposals/pull/4354)
unstable_features.insert("org.matrix.msc4354".to_owned(), true);
}
Ok(assign!(get_supported_versions::Response::new(versions()), {
unstable_features
}))
}
/// # `GET /_continuwuity/server_version`
+10 -1
View File
@@ -1,6 +1,6 @@
use std::any::{Any, TypeId};
use conduwuit::{Err, Error, Result, err};
use conduwuit::{Err, Error, Result, err, utils::IterStream};
use http::StatusCode;
use ruma::{
DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId, UserId,
@@ -149,6 +149,15 @@ impl CheckAuth for ServerSignatures {
)));
}
// Ping the server as healthy
if services.federation.mark_healthy(&output.origin) {
services
.sending
.flush_servers([output.origin.clone()].stream())
.await
.ok();
}
Ok(output.origin)
},
| Err(err) =>
+10 -14
View File
@@ -1,9 +1,9 @@
use std::{borrow::Borrow, iter::once};
use axum::extract::State;
use conduwuit::{Err, Error, Result, err, info, utils::stream::ReadyExt};
use conduwuit::{Err, Event, Result, info, utils::stream::ReadyExt};
use futures::StreamExt;
use ruma::{RoomId, api::federation::authorization::get_event_authorization};
use ruma::api::federation::authorization::get_event_authorization;
use super::AccessCheck;
use crate::Ruma;
@@ -48,25 +48,21 @@ pub(crate) async fn get_event_authorization_route(
return Err!(Request(NotFound("This server is not participating in that room.")));
}
let event = services
// The event must be in the room we just authorised access to
if !services
.rooms
.timeline
.get_pdu_json(&body.event_id)
.get_pdu(&body.event_id)
.await
.map_err(|_| err!(Request(NotFound("Event not found."))))?;
let room_id_str = event
.get("room_id")
.and_then(|val| val.as_str())
.ok_or_else(|| Error::bad_database("Invalid event in database."))?;
let room_id = <&RoomId>::try_from(room_id_str)
.map_err(|_| Error::bad_database("Invalid room_id in event in database."))?;
.is_ok_and(|pdu| pdu.room_id_or_hash() == body.room_id)
{
return Err!(Request(NotFound("Event not found.")));
}
let auth_chain = services
.rooms
.auth_chain
.event_ids_iter(room_id, once(body.event_id.borrow()))
.event_ids_iter(&body.room_id, once(body.event_id.borrow()))
.ready_filter_map(Result::ok)
.filter_map(|id| async move { services.rooms.timeline.get_pdu_json(&id).await.ok() })
.then(|pdu| services.sending.convert_to_outgoing_federation_event(pdu))
+43 -11
View File
@@ -9,7 +9,7 @@ use conduwuit::{
result::LogErr,
trace,
utils::{
IterStream, ReadyExt, millis_since_unix_epoch,
IterStream, millis_since_unix_epoch,
stream::{BroadbandExt, TryBroadbandExt, automatic_width},
},
warn,
@@ -142,13 +142,26 @@ async fn process_inbound_transaction(
sender: Sender<WrappedTransactionResponse>,
) {
let txn_start_time = Instant::now();
let pdus = body
.pdus
.iter()
.stream()
.broad_then(|pdu| services.rooms.event_handler.parse_incoming_pdu(pdu, None))
.inspect_err(|e| warn!("Could not parse incoming PDU: {e}"))
.ready_filter_map(Result::ok);
let pdus = body.pdus.iter().stream().broad_filter_map(|pdu| async {
match services
.rooms
.event_handler
.parse_incoming_pdu(pdu, None)
.await
{
| Ok(pdu) => Some(pdu),
| Err(error) => {
if !services
.rooms
.event_handler
.queue_pending_join_pdu(&body.identity, pdu.clone())
{
warn!("Could not parse incoming PDU: {error}");
}
None
},
}
});
let edus = body
.edus
@@ -159,12 +172,26 @@ async fn process_inbound_transaction(
.stream();
debug!(pdus = body.pdus.len(), edus = body.edus.len(), "Processing transaction",);
let results = match handle(&services, &body.identity, pdus, edus).await {
| Ok(results) => results,
| Err(err) => {
// We have an additional panic catch here because if there's a panic in the
// handle, the sender will effectively become defederated until restart after
// never being removed from the tracking map. Ideally the handle function
// doesn't panic, but when has "ideally" ever worked for us.
let handle_result =
std::panic::AssertUnwindSafe(handle(&services, &body.identity, pdus, edus))
.catch_unwind()
.map_err(Error::from_panic)
.await;
let results = match handle_result {
| Ok(Ok(results)) => results,
| Ok(Err(err)) => {
fail_federation_txn(services, &txn_key, &sender, err);
return;
},
| Err(err) => {
error!(error=?err, "Fatal error while processing incoming transaction");
fail_federation_txn(services, &txn_key, &sender, TransactionError::Unexpected);
return;
},
};
for (id, result) in &results {
@@ -228,6 +255,11 @@ fn transaction_error_to_response(err: &TransactionError) -> Error {
"Server is shutting down, please retry later".into(),
StatusCode::SERVICE_UNAVAILABLE,
),
| TransactionError::Unexpected => Error::Request(
ErrorKind::Unknown,
err.to_string().into(),
StatusCode::INTERNAL_SERVER_ERROR,
),
}
}
async fn handle(
+12 -1
View File
@@ -1,7 +1,7 @@
use std::{borrow::Borrow, iter::once};
use axum::extract::State;
use conduwuit::{Err, Result, at, err, info, utils::IterStream};
use conduwuit::{Err, Event, Result, at, err, info, utils::IterStream};
use futures::{FutureExt, StreamExt, TryStreamExt};
use ruma::{OwnedEventId, api::federation::event::get_room_state};
@@ -24,6 +24,17 @@ pub(crate) async fn get_room_state_route(
.assert()
.await?;
// The event must be in the room we just authorised access to
if !services
.rooms
.timeline
.get_pdu(&body.event_id)
.await
.is_ok_and(|pdu| pdu.room_id_or_hash() == body.room_id)
{
return Err!(Request(NotFound("Event not found.")));
}
if services
.rooms
.pdu_metadata
+12 -1
View File
@@ -1,7 +1,7 @@
use std::{borrow::Borrow, iter::once};
use axum::extract::State;
use conduwuit::{Err, Result, at, err, info};
use conduwuit::{Err, Event, Result, at, err, info};
use futures::{StreamExt, TryStreamExt};
use ruma::{OwnedEventId, api::federation::event::get_room_state_ids};
@@ -25,6 +25,17 @@ pub(crate) async fn get_room_state_ids_route(
.assert()
.await?;
// The event must be in the room we just authorised access to
if !services
.rooms
.timeline
.get_pdu(&body.event_id)
.await
.is_ok_and(|pdu| pdu.room_id_or_hash() == body.room_id)
{
return Err!(Request(NotFound("Event not found.")));
}
if services
.rooms
.pdu_metadata
+7
View File
@@ -115,6 +115,13 @@ pub fn check(config: &Config) -> Result {
));
}
if config.remote_join_pdu_queue_capacity == 0 {
return Err!(Config(
"remote_join_pdu_queue_capacity",
"The remote join PDU queue capacity must be greater than zero"
));
}
// yeah, unless the user built a debug build hopefully for local testing only
if cfg!(not(debug_assertions)) && config.server_name == "your.server.name" {
return Err!(Config(
+204 -10
View File
@@ -238,46 +238,147 @@ pub struct Config {
#[serde(default = "default_db_write_buffer_capacity_mb")]
pub db_write_buffer_capacity_mb: f64,
/// The maximum number of Persisted Data Units (PDUs) to cache.
/// Accepts any 32-bit integer.
///
/// PDUs are events broadcast from one homeserver to any others that have
/// joined the same room (identified by Room ID). They are persisted in
/// long-term storage and record the history of messages and state
/// for a room.
///
/// An example of a PDU would be a message or joining a room.
///
/// Setting this higher might be useful if the server has a large memory
/// capacity and is noticeably I/O limited.
///
/// This defaults to 100,000 + (10,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_pdu_cache_capacity")]
pub pdu_cache_capacity: u32,
/// The maximum number of auth chains to cache.
/// Accepts any 32-bit integer.
///
/// When determining is a user is authorized to send an event,
/// the server will first check the cache for an auth chain.
/// If the auth chain is not present in the cache,
/// The server will read the auth chain from the database
/// and add it to the cache.
///
/// This defaults to 100,000 + (10,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_auth_chain_cache_capacity")]
pub auth_chain_cache_capacity: u32,
/// Determines the cache size for eventid data references.
/// Accepts any 32-bit integer.
///
/// Each matrix event can be referenced in the database via either
/// an eventid (string) or a shorteventid (64-bit integer).
/// This caps the capacity of cached eventids referenced
/// by their shorteventid.
///
/// This defaults to 100,000 + (50,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_shorteventid_cache_capacity")]
pub shorteventid_cache_capacity: u32,
/// Determines the cache size for eventid data references.
/// Accepts any 32-bit integer.
///
/// Each matrix event can be referenced in the database via either
/// an eventid (string) or a shorteventid (64-bit integer).
/// This caps the capacity of cached shorteventids referenced
/// by their eventid.
///
/// This defaults to 100,000 + (25,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_eventidshort_cache_capacity")]
pub eventidshort_cache_capacity: u32,
/// Determines the cache size for pdu data references.
/// Accepts any 32-bit integer.
///
/// This caps the capacity of cached pdus referenced
/// by their eventid.
///
/// This defaults to 100,000 + (25,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_eventid_pdu_cache_capacity")]
pub eventid_pdu_cache_capacity: u32,
/// Determines the cache size for state key data references.
/// Accepts any 32-bit integer.
///
/// State keys are used by the server to verify that a token
/// from a third-party invite event was actually generated
/// by the server where the room resides.
///
/// These state keys can be referenced in the database via either
/// a statekey (string) or a shortstatekey (64-bit integer).
/// This caps the capacity of cached statekeys referenced
/// by shortstatekeys.
///
/// This defaults to 100,000 + (10,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_shortstatekey_cache_capacity")]
pub shortstatekey_cache_capacity: u32,
/// Determines the cache size for state key data references.
/// Accepts any 32-bit integer.
///
/// State keys are used by the server to verify that a token
/// from a third-party invite event was actually generated
/// by the server where the room resides.
///
/// These state keys can be referenced in the database via either
/// a statekey (string) or a shortstatekey (64-bit integer).
/// This caps the capacity of cached shortstatekeys referenced
/// by statekeys.
///
/// This defaults to 100,000 + (10,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_statekeyshort_cache_capacity")]
pub statekeyshort_cache_capacity: u32,
/// Determines the cache size for event_data references scoped
/// by server_name.
/// Accepts any 32-bit integer.
///
/// Event data can be referenced in the database by server name.
/// This is useful if the server needs to clear all events associated
/// with a particular federated server, for example.
/// This caps the capacity of cached event_data referenced
/// by server_name.
///
/// This defaults to 500,000 + (100,000 * CPU core count)
///
/// default: varies by system
#[serde(default = "default_servernameevent_data_cache_capacity")]
pub servernameevent_data_cache_capacity: u32,
/// Determines the cache size for room states.
/// Accepts any 32-bit integer.
///
/// To ensure data integrity of room events across asynchronous
/// requests from federated servers, Matrix tracks the state
/// of a room using a statehash and the changes since the
/// previous (parent) statehash.
/// This caps the capacity of cached room state data.
///
/// This defaults to 100 * CPU core count.
///
/// default: varies by system
#[serde(default = "default_stateinfo_cache_capacity")]
pub stateinfo_cache_capacity: u32,
/// default: varies by system
#[serde(default = "default_roomid_spacehierarchy_cache_capacity")]
pub roomid_spacehierarchy_cache_capacity: u32,
/// 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
@@ -431,6 +532,14 @@ pub struct Config {
#[serde(default = "default_max_request_size")]
pub max_request_size: usize,
/// Maximum number of prev_events the server will request from
/// other servers.
///
/// When requesting room events from another server, this server will
/// specify a maximum prev_events for the other server to return in its
/// response. This can be used for things like backfilling room data and
/// getting missing events.
///
/// default: 1024
#[serde(default = "default_max_fetch_prev_events")]
pub max_fetch_prev_events: u16,
@@ -446,6 +555,12 @@ pub struct Config {
#[serde(default = "default_max_concurrent_inbound_transactions")]
pub max_concurrent_inbound_transactions: usize,
/// Maximum number of federation PDUs queued while completing a remote join.
///
/// default: 50
#[serde(default = "default_remote_join_pdu_queue_capacity")]
pub remote_join_pdu_queue_capacity: usize,
/// Maximum age (in seconds) for cached federation transaction responses.
/// Entries older than this will be removed during cleanup.
///
@@ -573,9 +688,30 @@ pub struct Config {
#[serde(default = "default_sender_idle_timeout")]
pub sender_idle_timeout: u64,
/// Federation sender transaction retry backoff limit (seconds).
/// Federation sender retry backoff base (seconds).
///
/// default: 86400
/// This period will be doubled for each failed federation request until
/// either the remote server becomes healthy, or the value is clamped to
/// `sender_retry_backoff_limit`.
///
/// default: 10
#[serde(default = "default_sender_retry_backoff_base")]
pub sender_retry_backoff_base: u64,
/// Federation sender retry backoff limit (seconds).
///
/// Defaults to one week. Requests will never stop being retried if their
/// backoff period exceeds this value, however the maximum amount of time
/// between each request will instead be clamped at this value.
///
/// The backoff period is reset if a successful request is made, or
/// continuwuity receives a request from the server that is being backed off
/// from.
///
/// It is not recommended to lower this value below 48 hours or above
/// 1 year.
///
/// default: 604800
#[serde(default = "default_sender_retry_backoff_limit")]
pub sender_retry_backoff_limit: u64,
@@ -890,13 +1026,23 @@ pub struct Config {
///
/// [1]: https://github.com/jonhoo/inferno
/// [2]: www.speedscope.app
///
/// default: false
#[serde(default)]
pub tracing_flame: bool,
/// Which log level tracing_flame will trace.
///
/// See "tracing_flame" for more details.
///
/// default: "info"
#[serde(default = "default_tracing_flame_filter")]
pub tracing_flame_filter: String,
/// The output path for tracing_flame data.
///
/// See "tracing_flame" for more details.
///
/// default: "./tracing.folded"
#[serde(default = "default_tracing_flame_output_path")]
pub tracing_flame_output_path: String,
@@ -1158,6 +1304,9 @@ pub struct Config {
#[serde(default = "default_rocksdb_log_level")]
pub rocksdb_log_level: String,
/// Whether to output RocksDB errors to stderr.
///
/// default: false
#[serde(default)]
pub rocksdb_log_stderr: bool,
@@ -1430,6 +1579,18 @@ pub struct Config {
/// display: sensitive
pub emergency_password: Option<String>,
/// Specifies the path where push notifications will be sent to a
/// push gateway.
///
/// When a Matrix client registers for push notifications, it will specify
/// a push gateway url where notification events will be sent.
/// According to the current spec for Matrix Push Gateways, the path should
/// always be "/_matrix/push/v1/notify".
/// You should only change this if you have configured your own push gateway
/// that requires a different path.
///
/// For more information on Push Gateways: https://spec.matrix.org/latest/push-gateway-api/
///
/// default: "/_matrix/push/v1/notify"
#[serde(default = "default_notification_push_path")]
pub notification_push_path: String,
@@ -1526,6 +1687,14 @@ pub struct Config {
#[serde(default = "true_fn")]
pub allow_incoming_typing: bool,
/// Allow the use of unstable persistent "sticky events" ([MSC4354])
///
/// MSC4354: https://c10y.cc/MSC4354
///
/// default: false
#[serde(default)]
pub allow_sticky_events: bool,
/// Maximum time federation user can indicate typing.
///
/// default: 30
@@ -1588,9 +1757,17 @@ pub struct Config {
///
/// Defaults to true for now, but this is highly subject to change, likely
/// in the next release.
///
/// default: true
#[serde(default = "true_fn")]
pub allow_legacy_media: bool,
/// If set to true, prevents fetching new legacy remote media.
///
/// Legacy media may still be accessible if it was already fetched
/// previously and allow_legacy_media is true.
///
/// default: true
#[serde(default = "true_fn")]
pub freeze_legacy_media: bool,
@@ -1846,7 +2023,7 @@ pub struct Config {
/// User agent that is used specifically when fetching url previews.
///
/// default: "continuwuity/<version> (bot; +https://continuwuity.org)"
/// default: "continuwuity/<version> (embedbot; facebookexternalhit/1.1; +https://continuwuity.org)"
pub url_preview_user_agent: Option<String>,
/// Determines whether audio and video files will be downloaded for URL
@@ -2050,6 +2227,20 @@ pub struct Config {
#[serde(default)]
pub tokio_console: bool,
/// A list of flags that modify startup behavior.
/// Accepts an array of strings.
///
/// During startup, the program will check for the presence of certain
/// strings in this array. Matching values will modify how the program runs
/// those startup tasks.
///
/// If this variable is empty or contains no matches, the server will start
/// normally.
///
/// Currently this only checks for "smoke" which enables "Smoketest mode."
/// This mode exits the program after running startup tasks.
///
/// default: false
#[serde(default)]
pub test: BTreeSet<String>,
@@ -2629,6 +2820,7 @@ const DEPRECATED_KEYS: &[&str] = &[
"cache_capacity",
"conduit_cache_capacity_modifier",
"max_concurrent_requests",
"roomid_spacehierarchy_cache_capacity",
"well_known_client",
"well_known_server",
"well_known_support_page",
@@ -2758,8 +2950,6 @@ fn default_servernameevent_data_cache_capacity() -> u32 {
fn default_stateinfo_cache_capacity() -> u32 { parallelism_scaled_u32(100) }
fn default_roomid_spacehierarchy_cache_capacity() -> u32 { parallelism_scaled_u32(1000) }
fn default_dns_cache_entries() -> u32 { 32768 }
fn default_dns_min_ttl() -> u64 { 60 * 180 }
@@ -2804,7 +2994,9 @@ fn default_sender_timeout() -> u64 { 180 }
fn default_sender_idle_timeout() -> u64 { 180 }
fn default_sender_retry_backoff_limit() -> u64 { 86400 }
fn default_sender_retry_backoff_base() -> u64 { 10 }
fn default_sender_retry_backoff_limit() -> u64 { 604_800 }
fn default_appservice_timeout() -> u64 { 35 }
@@ -2820,6 +3012,8 @@ fn default_max_fetch_prev_events() -> u16 { 1024 }
fn default_max_concurrent_inbound_transactions() -> usize { 150 }
fn default_remote_join_pdu_queue_capacity() -> usize { 50 }
fn default_transaction_id_cache_max_age_secs() -> u64 { 60 * 60 * 2 }
fn default_transaction_id_cache_max_entries() -> usize { 8192 }
+7 -1
View File
@@ -88,7 +88,9 @@ pub enum Error {
#[error(transparent)]
YamlSer(#[from] serde_saphyr::ser_error::Error),
#[error(transparent)]
ResolveServer(#[from] resolvematrix::error::ResolveServerError),
ResolveServer(#[from] resolvematrix::error::ServerResolverBuilderError),
#[error(transparent)]
ServerResolutionError(#[from] resolvematrix::error::ServerResolutionError),
// ruma/conduwuit
#[error("Arithmetic operation failed: {0}")]
@@ -285,3 +287,7 @@ impl From<reqwest::Error> for FormattedReqwestError {
impl From<reqwest::Error> for Error {
fn from(err: reqwest::Error) -> Self { Self::Reqwest(err.into()) }
}
impl From<FormattedReqwestError> for reqwest::Error {
fn from(val: FormattedReqwestError) -> Self { val.0 }
}
+4
View File
@@ -181,6 +181,10 @@ pub trait Event: Clone + Debug {
/// The state key for this event.
fn state_key(&self) -> Option<&str>;
/// The MSC4354 sticky object, verbatim, if the event has one.
#[inline]
fn sticky(&self) -> Option<&RawJsonValue> { None }
/// The event type.
fn kind(&self) -> &TimelineEventType;
+10
View File
@@ -9,6 +9,7 @@ use ruma::{
use serde_json::json;
use super::{Event, redact};
use crate::matrix::pdu::sticky;
pub struct Owned<E: Event>(pub(super) E);
@@ -36,6 +37,9 @@ impl<'a, E: Event> From<Ref<'a, E>> for Raw<AnySyncTimelineEvent> {
if let Some(state_key) = event.state_key() {
json["state_key"] = json!(state_key);
}
if let Some(sticky_object) = event.sticky() {
json[sticky::PDU_KEY] = json!(sticky_object);
}
if let Some(unsigned) = event.unsigned() {
json["unsigned"] = json!(unsigned);
}
@@ -67,6 +71,9 @@ impl<'a, E: Event> From<Ref<'a, E>> for Raw<AnyTimelineEvent> {
if let Some(state_key) = event.state_key() {
json["state_key"] = json!(state_key);
}
if let Some(sticky_object) = event.sticky() {
json[sticky::PDU_KEY] = json!(sticky_object);
}
if let Some(unsigned) = event.unsigned() {
json["unsigned"] = json!(unsigned);
}
@@ -98,6 +105,9 @@ impl<'a, E: Event> From<Ref<'a, E>> for Raw<AnyMessageLikeEvent> {
if let Some(state_key) = event.state_key() {
json["state_key"] = json!(state_key);
}
if let Some(sticky_object) = event.sticky() {
json[sticky::PDU_KEY] = json!(sticky_object);
}
if let Some(unsigned) = event.unsigned() {
json["unsigned"] = json!(unsigned);
}
+10 -4
View File
@@ -1,4 +1,7 @@
use ruma::{CanonicalJsonObject, OwnedEventId, room_version_rules::RoomVersionRules};
use ruma::{
CanonicalJsonObject, EventId, OwnedEventId,
room_version_rules::{EventIdFormatVersion, RoomVersionRules},
};
use serde_json::value::RawValue as RawJsonValue;
use crate::{Result, err};
@@ -24,8 +27,11 @@ pub fn gen_event_id(
value: &CanonicalJsonObject,
room_version_rules: &RoomVersionRules,
) -> Result<OwnedEventId> {
assert_ne!(
room_version_rules.event_id_format,
EventIdFormatVersion::V1,
"Continuwuity does not support PDU v1"
);
let reference_hash = ruma::signatures::reference_hash(value, room_version_rules)?;
let event_id: OwnedEventId = format!("${reference_hash}").try_into()?;
Ok(event_id)
Ok(EventId::new_v2_or_v3(&reference_hash)?)
}
+12
View File
@@ -3,6 +3,7 @@ mod id;
mod partial;
mod raw_id;
mod redact;
pub mod sticky;
#[cfg(test)]
mod tests;
mod unsigned;
@@ -46,6 +47,11 @@ pub struct Pdu {
pub content: Box<RawJsonValue>,
/// MSC4354 sticky object, kept verbatim because it is signed. Interpret it
/// with [`sticky`], never by rewriting it.
#[serde(rename = "msc4354_sticky", default, skip_serializing_if = "Option::is_none")]
pub sticky: Option<Box<RawJsonValue>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub state_key: Option<StateKey>,
@@ -137,6 +143,9 @@ impl Event for Pdu {
#[inline]
fn state_key(&self) -> Option<&str> { self.state_key.as_deref() }
#[inline]
fn sticky(&self) -> Option<&RawJsonValue> { self.sticky.as_deref() }
#[inline]
fn kind(&self) -> &TimelineEventType { &self.kind }
@@ -208,6 +217,9 @@ impl Event for &Pdu {
#[inline]
fn state_key(&self) -> Option<&str> { self.state_key.as_deref() }
#[inline]
fn sticky(&self) -> Option<&RawJsonValue> { self.sticky.as_deref() }
#[inline]
fn kind(&self) -> &TimelineEventType { &self.kind }
+3
View File
@@ -20,6 +20,8 @@ pub struct PartialPdu {
pub content: Box<RawJsonValue>,
pub sticky: Option<Box<RawJsonValue>>,
pub unsigned: Option<Unsigned>,
pub state_key: Option<StateKey>,
@@ -66,6 +68,7 @@ impl Default for PartialPdu {
Self {
event_type: "m.room.message".into(),
content: to_raw_value(&json!({})).unwrap(),
sticky: None,
unsigned: None,
state_key: None,
redacts: None,
+3
View File
@@ -11,6 +11,9 @@ impl super::Pdu {
self.unsigned = None;
// a redacted sticky event is just a normal event (MSC4354)
self.sticky = None;
let mut content = serde_json::from_str(self.content.get()).map_err(|e| {
err!(Request(BadJson("Failed to deserialize content into type: {e}")))
})?;
+155
View File
@@ -0,0 +1,155 @@
//! Sticky event helpers, as defined by [MSC4354].
//!
//! [MSC4354]: https://github.com/matrix-org/matrix-spec-proposals/pull/4354
use ruma::{UInt, events::sticky::StickyDurationMs};
use serde::Deserialize;
use serde_json::{
json,
value::{RawValue as RawJsonValue, to_raw_value},
};
/// Name of the sticky object at the top level of a PDU. Unstable prefix.
pub const PDU_KEY: &str = "msc4354_sticky";
/// Name of the expiry hint injected into `unsigned`. Unstable prefix.
pub const TTL_UNSIGNED_KEY: &str = "msc4354_sticky_duration_ttl_ms";
/// The longest an event may remain sticky (one hour).
#[allow(clippy::as_conversions)]
pub const MAX_DURATION_MS: u64 = StickyDurationMs::MAX as u64;
#[derive(Deserialize)]
struct Object {
duration_ms: u64,
}
/// Build the sticky object for an event we are creating locally.
#[must_use]
pub fn object(duration_ms: StickyDurationMs) -> Box<RawJsonValue> {
to_raw_value(&json!({ "duration_ms": duration_ms }))
.expect("a StickyDurationMs always produces a valid sticky object")
}
/// The sticky duration of `sticky`, clamped to [`MAX_DURATION_MS`], or `None`
/// if this is not a valid sticky object.
///
/// A malformed object leaves the event unsticky rather than invalidating it, so
/// a peer more lenient than us cannot split the room DAG.
#[must_use]
pub fn duration_ms(sticky: &RawJsonValue) -> Option<u64> {
serde_json::from_str::<Object>(sticky.get())
.ok()
.map(|sticky| sticky.duration_ms.min(MAX_DURATION_MS))
}
/// The time at which an event stops being sticky, in milliseconds since the
/// unix epoch, or `None` if the event was never sticky.
///
/// MSC4354 starts the clock at `min(received_ts, origin_server_ts)` so a server
/// cannot extend stickiness by dating its events forward. We keep no receive
/// time per PDU, so instead we deny stickiness to events dated further ahead
/// than any event could still be sticky for.
#[must_use]
pub fn expires_at(origin_server_ts: UInt, sticky: &RawJsonValue, now: u64) -> Option<u64> {
let origin_server_ts = u64::from(origin_server_ts);
if origin_server_ts.saturating_sub(now) > MAX_DURATION_MS {
return None;
}
let start = origin_server_ts.min(now);
duration_ms(sticky).map(|duration_ms| start.saturating_add(duration_ms))
}
#[must_use]
pub fn is_sticky(origin_server_ts: UInt, sticky: &RawJsonValue, now: u64) -> bool {
expires_at(origin_server_ts, sticky, now).is_some_and(|expires_at| expires_at > now)
}
#[cfg(test)]
mod tests {
use ruma::{UInt, events::sticky::StickyDurationMs};
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
use super::{MAX_DURATION_MS, duration_ms, expires_at, is_sticky, object};
fn raw(json: &serde_json::Value) -> Box<RawJsonValue> { to_raw_value(json).unwrap() }
fn ts(millis: u64) -> UInt { UInt::try_from(millis).unwrap() }
#[test]
fn duration_of_valid_object() {
let sticky = raw(&serde_json::json!({ "duration_ms": 300_000 }));
assert_eq!(duration_ms(&sticky), Some(300_000));
}
#[test]
fn duration_is_clamped_to_one_hour() {
let sticky = raw(&serde_json::json!({ "duration_ms": 9_999_999_999_u64 }));
assert_eq!(duration_ms(&sticky), Some(MAX_DURATION_MS));
}
#[test]
fn malformed_objects_are_not_sticky() {
for malformed in [
serde_json::json!({}),
serde_json::json!({ "duration_ms": -1 }),
serde_json::json!({ "duration_ms": "300000" }),
serde_json::json!({ "duration_ms": 3000.5 }),
serde_json::json!("nonsense"),
serde_json::json!(null),
] {
let sticky = raw(&malformed);
assert_eq!(duration_ms(&sticky), None, "{malformed} should not be sticky");
}
}
#[test]
fn object_round_trips_through_duration_ms() {
let sticky = object(StickyDurationMs::new_clamped(600_000_u32));
assert_eq!(duration_ms(&sticky), Some(600_000));
}
#[test]
fn expiry_is_origin_server_ts_plus_duration() {
let sticky = raw(&serde_json::json!({ "duration_ms": 300_000 }));
assert_eq!(expires_at(ts(1_000_000), &sticky, 1_100_000), Some(1_300_000));
}
#[test]
fn expiry_uses_the_clamped_duration() {
let sticky = raw(&serde_json::json!({ "duration_ms": 9_999_999_999_u64 }));
assert_eq!(
expires_at(ts(1_000_000), &sticky, 1_000_000),
Some(1_000_000 + MAX_DURATION_MS)
);
}
#[test]
fn timestamps_far_in_the_future_are_not_sticky() {
let sticky = raw(&serde_json::json!({ "duration_ms": 300_000 }));
let now = 1_000_000;
// a little ahead of us is tolerated, and starts the clock at `now`
let slightly_ahead = ts(now + MAX_DURATION_MS);
assert_eq!(expires_at(slightly_ahead, &sticky, now), Some(now + 300_000));
// beyond the point any honest event could still be sticky, it is not
let far_ahead = ts(now + MAX_DURATION_MS + 1);
assert_eq!(expires_at(far_ahead, &sticky, now), None);
}
#[test]
fn stickiness_ends_at_the_expiry() {
let sticky = raw(&serde_json::json!({ "duration_ms": 300_000 }));
assert!(is_sticky(ts(1_000_000), &sticky, 1_299_999));
assert!(!is_sticky(ts(1_000_000), &sticky, 1_300_000));
assert!(!is_sticky(ts(1_000_000), &sticky, 1_300_001));
}
#[test]
fn zero_duration_is_never_sticky() {
let sticky = raw(&serde_json::json!({ "duration_ms": 0 }));
assert!(!is_sticky(ts(1_000_000), &sticky, 1_000_000));
}
}
+93
View File
@@ -15,3 +15,96 @@ fn normal_parse() {
assert!(!backfilled, "backfilled variant");
}
fn sticky_pdu(sticky: &serde_json::Value) -> super::Pdu {
serde_json::from_value(serde_json::json!({
"event_id": "$test:example.com",
"room_id": "!test:example.com",
"sender": "@test:example.com",
"origin_server_ts": 1_000_000,
"type": "m.room.message",
"content": { "msgtype": "m.text", "body": "test" },
"msc4354_sticky": sticky,
"prev_events": [],
"depth": 1,
"auth_events": [],
"hashes": { "sha256": "test_hash" },
}))
.expect("PDU is valid")
}
#[test]
fn sticky_object_round_trips_verbatim() {
// the object is signed, so serialization must not touch it
let pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000, "unknown": "key" }));
let value = serde_json::to_value(&pdu).expect("PDU serializes");
assert_eq!(
value["msc4354_sticky"],
serde_json::json!({ "duration_ms": 300_000, "unknown": "key" })
);
}
#[test]
fn out_of_range_sticky_object_is_clamped_not_rejected() {
let pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 9_999_999_999_u64 }));
let sticky = pdu.sticky.as_deref().expect("sticky object is kept");
assert_eq!(super::sticky::duration_ms(sticky), Some(super::sticky::MAX_DURATION_MS));
}
#[test]
fn nonsense_sticky_object_does_not_reject_the_pdu() {
let pdu = sticky_pdu(&serde_json::json!("nonsense"));
let sticky = pdu.sticky.as_deref().expect("sticky object is kept");
assert_eq!(super::sticky::duration_ms(sticky), None);
}
#[test]
fn redaction_removes_stickiness() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.redact(&ruma::RoomVersionId::V11, serde_json::json!({}))
.expect("redaction succeeds");
assert!(pdu.sticky.is_none());
}
#[test]
fn sticky_ttl_is_added_to_unsigned() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.add_sticky_duration_ttl().expect("ttl is added");
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
.expect("unsigned is valid");
let ttl = unsigned["msc4354_sticky_duration_ttl_ms"]
.as_u64()
.expect("ttl is a number");
assert!(ttl > 0 && ttl <= 300_000, "ttl {ttl} out of range");
}
#[test]
fn no_ttl_for_events_that_are_not_sticky() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": "nonsense" }));
pdu.add_sticky_duration_ttl().expect("ttl is skipped");
assert!(pdu.unsigned.is_none());
}
#[test]
fn set_unsigned_adds_the_sticky_ttl() {
// sticky events in the timeline get the hint through here, not the sticky
// section
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.set_unsigned(None);
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
.expect("unsigned is valid");
assert!(unsigned["msc4354_sticky_duration_ttl_ms"].is_number());
}
+27 -1
View File
@@ -3,7 +3,7 @@ use std::{borrow::Borrow, collections::BTreeMap};
use ruma::MilliSecondsSinceUnixEpoch;
use serde_json::value::{RawValue as RawJsonValue, Value as JsonValue, to_raw_value};
use super::Pdu;
use super::{Pdu, sticky};
use crate::{Result, err, result::LogErr};
impl Pdu {
@@ -17,6 +17,7 @@ impl Pdu {
self.remove_transaction_id().log_err().ok();
}
self.add_age().log_err().ok();
self.add_sticky_duration_ttl().log_err().ok();
}
pub fn remove_transaction_id(&mut self) -> Result {
@@ -58,6 +59,31 @@ impl Pdu {
Ok(())
}
pub fn add_sticky_duration_ttl(&mut self) -> Result {
use BTreeMap as Map;
let now = u64::from(MilliSecondsSinceUnixEpoch::now().get());
let Some(expires_at) = self
.sticky
.as_deref()
.and_then(|sticky| sticky::expires_at(self.origin_server_ts, sticky, now))
else {
return Ok(());
};
let mut unsigned: Map<&str, Box<RawJsonValue>> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
unsigned.insert(sticky::TTL_UNSIGNED_KEY, to_raw_value(&expires_at.saturating_sub(now))?);
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
}
pub fn add_relation(&mut self, name: &str, pdu: Option<&Self>) -> Result {
use serde_json::Map;
+1
View File
@@ -414,6 +414,7 @@ where
content,
origin: None,
redacts: None,
sticky: None,
unsigned: None,
auth_events,
prev_events,
+183 -279
View File
@@ -7,26 +7,22 @@ use futures::{
use ruma::{
Int, OwnedUserId, RoomVersionId, UserId,
events::room::{
create::RoomCreateEventContent,
join_rules::{JoinRule, RoomJoinRulesEventContent},
member::{MembershipState, ThirdPartyInvite},
power_levels::RoomPowerLevelsEventContent,
power_levels::{RoomPowerLevelsEventContent, UserPowerLevel},
},
int,
room_version_rules::{RoomIdFormatVersion, RoomVersionRules},
serde::Raw,
};
use serde::{
Deserialize,
de::{Error as _, IgnoredAny},
};
use serde::Deserialize;
use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
use super::{
Error, Event, Result, StateEventType, StateKey, TimelineEventType,
power_levels::{
deserialize_power_levels, deserialize_power_levels_content_fields,
deserialize_power_levels_content_invite, deserialize_power_levels_content_redact,
deserialize_power_levels, deserialize_power_levels_content_invite,
deserialize_power_levels_content_redact,
},
};
use crate::{debug, error, trace, warn};
@@ -46,7 +42,7 @@ struct RoomMemberContentFields {
#[derive(Deserialize)]
struct RoomCreateContentFields {
room_version: Option<Raw<RoomVersionId>>,
creator: Option<Raw<IgnoredAny>>,
creator: Option<Raw<OwnedUserId>>,
additional_creators: Option<Vec<Raw<OwnedUserId>>>,
#[serde(rename = "m.federate", default = "ruma::serde::default_true")]
federate: bool,
@@ -137,6 +133,31 @@ pub fn auth_types_for_event(
Ok(auth_types)
}
fn get_user_power_level(
room_version_rules: &RoomVersionRules,
creator: &UserId,
additional_creators: &[Raw<OwnedUserId>],
power_levels: Option<&RoomPowerLevelsEventContent>,
user_id: &UserId,
) -> UserPowerLevel {
if room_version_rules
.authorization
.explicitly_privilege_room_creators
&& (user_id == creator
|| additional_creators
.iter()
.any(|c| c.deserialize().ok() == Some(user_id.to_owned())))
{
return UserPowerLevel::Infinite;
}
if let Some(pls) = power_levels {
UserPowerLevel::Int(pls.users.get(user_id).copied().unwrap_or(pls.users_default))
} else {
UserPowerLevel::Int(if user_id == creator { int!(100) } else { int!(0) })
}
}
/// Authenticate the incoming `event`.
///
/// The steps of authentication are:
@@ -478,69 +499,43 @@ where
return Ok(false);
}
// If type is m.room.third_party_invite
let mut sender_power_level = match &power_levels_event {
| Some(pl) => {
let content =
deserialize_power_levels_content_fields(pl.content().get(), room_version)?;
match content.get_user_power(sender) {
| Some(level) => *level,
| _ => content.users_default,
}
},
| _ => {
// If no power level event found the creator gets 100 everyone else gets 0
let is_creator = if room_version.authorization.use_room_create_sender {
room_create_event.sender() == sender
} else {
#[allow(deprecated)]
from_json_str::<RoomCreateEventContent>(room_create_event.content().get())
.is_ok_and(|create| create.creator.unwrap() == *sender)
};
if is_creator { int!(100) } else { int!(0) }
},
let creator = if room_version.authorization.use_room_create_sender {
room_create_event.sender().to_owned()
} else {
room_create_content
.creator
.clone()
.ok_or_else(|| {
Error::InvalidPdu("Missing creator field in m.room.create event".to_owned())
})?
.deserialize()?
};
if room_version
.authorization
.explicitly_privilege_room_creators
{
// If the user sent the create event, or is listed in additional_creators, just
// give them Int::MAX
if sender == room_create_event.sender()
|| room_create_content
.additional_creators
.as_ref()
.is_some_and(|creators| {
creators
.iter()
.any(|c| c.deserialize().is_ok_and(|c| c == *sender))
}) {
trace!("privileging room creator or additional creator");
// This user is the room creator or an additional creator, give them max power
// level
sender_power_level = Int::MAX;
}
}
let power_levels: Option<RoomPowerLevelsEventContent> = power_levels_event
.as_ref()
.map(|pl| from_json_str(pl.content().get()))
.transpose()?;
let effective_power_levels = power_levels
.clone()
.unwrap_or_else(|| RoomPowerLevelsEventContent::new(&room_version.authorization));
let sender_power_level = get_user_power_level(
room_version,
&creator,
room_create_content
.additional_creators
.as_deref()
.unwrap_or_default(),
power_levels.as_ref(),
sender,
);
// Allow if and only if sender's current power level is greater than
// or equal to the invite level
if *incoming_event.event_type() == TimelineEventType::RoomThirdPartyInvite {
let invite_level = match &power_levels_event {
| Some(power_levels) =>
deserialize_power_levels_content_invite(
power_levels.content().get(),
room_version,
)?
.invite,
| None => int!(0),
};
if sender_power_level < invite_level {
if sender_power_level < effective_power_levels.invite {
warn!(
%sender,
has=%sender_power_level,
required=%invite_level,
has=?sender_power_level,
required=%effective_power_levels.invite,
"sender cannot send invites in this room"
);
return Ok(false);
@@ -615,7 +610,7 @@ where
if !check_redaction(room_version, incoming_event, sender_power_level, redact_level)? {
warn!(
%sender,
%sender_power_level,
?sender_power_level,
%redact_level,
"redaction event was not allowed"
);
@@ -627,34 +622,6 @@ where
Ok(true)
}
fn is_creator<EV>(
v: &RoomVersionRules,
c: &BTreeSet<OwnedUserId>,
ce: &EV,
user_id: &UserId,
have_pls: bool,
) -> bool
where
EV: Event + Send + Sync,
{
if v.authorization.explicitly_privilege_room_creators {
c.contains(user_id)
} else if v.authorization.use_room_create_sender && !have_pls {
ce.sender() == user_id
} else if !have_pls {
#[allow(deprecated)]
let creator = from_json_str::<RoomCreateEventContent>(ce.content().get())
.unwrap()
.creator
.ok_or_else(|| serde_json::Error::missing_field("creator"))
.unwrap();
creator == user_id
} else {
false
}
}
// TODO deserializing the member, power, join_rules event contents is done in
// conduit just before this is called. Could they be passed in?
/// Does the user who sent this member event have required power levels to do
@@ -691,6 +658,17 @@ where
third_party_invite: Option<Raw<ThirdPartyInvite>>,
}
let create_content = from_json_str::<RoomCreateContentFields>(create_room.content().get())?;
let creator = if room_version.authorization.use_room_create_sender {
create_room.sender().to_owned()
} else {
create_content
.creator
.clone()
.ok_or_else(|| {
Error::InvalidPdu("Missing creator field in m.room.create event".to_owned())
})?
.deserialize()?
};
let content = current_event.content();
let target_membership = from_json_str::<GetMembership>(content.get())?.membership;
@@ -708,44 +686,33 @@ where
| None => MembershipState::Leave,
};
let power_levels: RoomPowerLevelsEventContent = match &power_levels_event {
| Some(ev) => from_json_str(ev.content().get())?,
| None => RoomPowerLevelsEventContent::new(&room_version.authorization),
};
let power_levels: Option<RoomPowerLevelsEventContent> = power_levels_event
.map(|ev| from_json_str(ev.content().get()))
.transpose()?;
let effective_power_levels: RoomPowerLevelsEventContent = power_levels
.clone()
.unwrap_or_else(|| RoomPowerLevelsEventContent::new(&room_version.authorization));
let mut sender_power = power_levels
.users
.get(sender)
.or_else(|| sender_is_joined.then_some(&power_levels.users_default));
let mut target_power = power_levels.users.get(target_user).or_else(|| {
(target_membership == MembershipState::Join).then_some(&power_levels.users_default)
});
let mut creators = BTreeSet::new();
creators.insert(create_room.sender().to_owned());
if room_version
.authorization
.explicitly_privilege_room_creators
{
// Explicitly privilege room creators
// If the sender sent the create event, or in additional_creators, give them
// Int::MAX. Same case for target.
if let Some(additional_creators) = &create_content.additional_creators {
for c in additional_creators {
if let Ok(c) = c.deserialize() {
creators.insert(c);
}
}
}
if creators.contains(sender) {
sender_power = Some(&Int::MAX);
}
if creators.contains(target_user) {
target_power = Some(&Int::MAX);
}
}
trace!(?creators, "creators for room");
let sender_power = get_user_power_level(
room_version,
&creator,
create_content
.additional_creators
.as_deref()
.unwrap_or_default(),
power_levels.as_ref(),
sender,
);
let target_power = get_user_power_level(
room_version,
&creator,
create_content
.additional_creators
.as_deref()
.unwrap_or_default(),
power_levels.as_ref(),
target_user,
);
let join_rules = if let Some(jr) = &join_rules_event {
from_json_str::<RoomJoinRulesEventContent>(jr.content().get())?.join_rule
@@ -765,54 +732,29 @@ where
let invite =
deserialize_power_levels_content_invite(pl.content().get(), room_version)?.invite;
let content =
deserialize_power_levels_content_fields(pl.content().get(), room_version)?;
let user_pl = match content.get_user_power(user_for_join_auth) {
| Some(level) => *level,
| _ => content.users_default,
};
let user_pl = get_user_power_level(
room_version,
&creator,
create_content
.additional_creators
.as_deref()
.unwrap_or_default(),
power_levels.as_ref(),
user_for_join_auth,
);
(user_pl, invite)
} else {
(int!(0), int!(0))
(UserPowerLevel::Int(int!(0)), int!(0))
};
let user_joined = user_for_join_auth_membership == &MembershipState::Join;
let okay_power = is_creator(
room_version,
&creators,
create_room,
user_for_join_auth,
power_levels_event.as_ref().is_some(),
) || auth_user_pl >= invite_level;
trace!(
%auth_user_pl,
%auth_user_pl,
%invite_level,
%user_joined,
%okay_power,
passing=%(user_joined && okay_power),
"user for join auth is valid check details"
);
let okay_power = auth_user_pl >= invite_level;
user_joined && okay_power
} else {
// No auth user was given
trace!("No auth user given for join auth");
false
};
let sender_creator = is_creator(
room_version,
&creators,
create_room,
sender,
power_levels_event.as_ref().is_some(),
);
let target_creator = is_creator(
room_version,
&creators,
create_room,
target_user,
power_levels_event.as_ref().is_some(),
);
Ok(match target_membership {
| MembershipState::Join => {
@@ -828,16 +770,7 @@ where
let no_more_prev_events = prev_events.next().is_none();
if prev_event_is_create_event && no_more_prev_events {
trace!(
%sender,
target_user = %target_user,
?sender_creator,
?target_creator,
"checking if sender is a room creator for initial membership event"
);
let is_creator = sender_creator && target_creator;
if is_creator {
if sender == creator {
debug!("sender is room creator, allowing join");
return Ok(true);
}
@@ -1001,15 +934,12 @@ where
);
false
} else {
let allow = sender_creator
|| sender_power
.as_ref()
.is_some_and(|&p| p >= &power_levels.invite);
if !allow {
let allow = sender_power >= effective_power_levels.invite;
if allow {
warn!(
%sender,
has=?sender_power,
required=?power_levels.invite,
required=?effective_power_levels.invite,
"sender does not have enough power to produce invites",
);
}
@@ -1020,7 +950,7 @@ where
?target_user_membership_event_id,
?target_user_current_membership,
sender_pl=?sender_power,
required_pl=?power_levels.invite,
required_pl=?effective_power_levels.invite,
"allowing invite"
);
allow
@@ -1028,47 +958,9 @@ where
}
},
| MembershipState::Leave => {
let can_unban = if target_user_current_membership == MembershipState::Ban {
sender_creator
|| sender_power
.as_ref()
.is_some_and(|&p| p >= &power_levels.ban)
} else {
true
};
let can_kick = if !matches!(
target_user_current_membership,
MembershipState::Ban | MembershipState::Leave
) {
if sender_creator {
// sender is a creator
true
} else if sender_power
.as_ref()
.is_none_or(|&p| p < &power_levels.kick)
{
// sender lacks kick power level
false
} else if let Some(sp) = sender_power {
if let Some(tp) = target_power {
// sender must have more power than target
sp > tp
} else {
// target has default power level
true
}
} else {
// sender has default power level
false
}
} else {
true
};
if sender == target_user {
// self-leave
// let allow = target_user_current_membership == MembershipState::Join
// || target_user_current_membership == MembershipState::Invite
// || target_user_current_membership == MembershipState::Knock;
// If the sender matches state_key, allow if that user's current membership
// state is invite, join, or knock.
let allow = matches!(
target_user_current_membership,
MembershipState::Join | MembershipState::Invite | MembershipState::Knock
@@ -1084,48 +976,52 @@ where
trace!(sender=%sender, "allowing leave");
allow
} else if !sender_is_joined {
// If the sender's current membership state is not join, reject.
warn!(
%sender,
?sender_membership_event_id,
"sender cannot kick another user as they are not joined to the room",
);
false
} else if !(can_unban && can_kick) {
// If the target is banned, only a room creator or someone with ban power
// level can unban them
warn!(
%sender,
?target_user_membership_event_id,
?power_levels_event_id,
"sender lacks the power level required to unban users",
);
false
} else if !can_kick {
warn!(
%sender,
%target_user,
?target_user_membership_event_id,
?target_user_current_membership,
?power_levels_event_id,
"sender does not have enough power to kick the target",
);
false
} else {
trace!(
%sender,
%target_user,
?target_user_membership_event_id,
?target_user_current_membership,
sender_pl=?sender_power,
target_pl=?target_power,
required_pl=?power_levels.kick,
"allowing kick/unban",
);
true
// If the target user's current membership state is ban, and the sender's power
// level is less than the ban level, reject. If the sender's power level is
// greater than or equal to the kick level, and the target user's power level is
// less than the sender's power level, allow.
let cannot_unban = target_user_current_membership == MembershipState::Ban
&& sender_power < effective_power_levels.ban;
let can_kick =
sender_power >= effective_power_levels.kick && target_power < sender_power;
if cannot_unban {
warn!(
%sender,
?target_user_membership_event_id,
?power_levels_event_id,
"sender lacks the power level required to unban users",
);
false
} else if can_kick {
trace!(%sender, "allowing kick or unban");
true
} else {
warn!(
%sender,
%target_user,
?target_user_membership_event_id,
?target_user_current_membership,
?power_levels_event_id,
sender_pl=?sender_power,
target_pl=?target_power,
required_pl=?effective_power_levels.kick,
"sender does not have enough power to kick the target",
);
false
}
}
},
| MembershipState::Ban =>
if !sender_is_joined {
// If the sender's current membership state is not join, reject.
warn!(
%sender,
?sender_membership_event_id,
@@ -1133,11 +1029,11 @@ where
);
false
} else {
let allow = sender_creator
|| (sender_power
.as_ref()
.is_some_and(|&p| p >= &power_levels.ban)
&& target_power < sender_power);
// If the sender's power level is greater than or equal to the ban level, and
// the target user's power level is less than the sender's power level, allow.
// Otherwise, reject.
let allow =
sender_power >= effective_power_levels.ban && target_power < sender_power;
if !allow {
warn!(
%sender,
@@ -1213,13 +1109,19 @@ where
///
/// Does the event have the correct userId as its state_key if it's not the ""
/// state_key.
fn can_send_event(event: &impl Event, ple: Option<&impl Event>, user_level: Int) -> bool {
// TODO(hydra): This function does not care about creators!
fn can_send_event(
event: &impl Event,
ple: Option<&impl Event>,
user_level: UserPowerLevel,
) -> bool {
if user_level == UserPowerLevel::Infinite {
return true;
}
let event_type_power_level = get_send_level(event.event_type(), event.state_key(), ple);
debug!(
required_level = i64::from(event_type_power_level),
user_level = i64::from(user_level),
?user_level,
state_key = ?event.state_key(),
power_level_event_id = ?ple.map(|e| e.event_id().as_str()),
"permissions factors",
@@ -1233,7 +1135,7 @@ fn can_send_event(event: &impl Event, ple: Option<&impl Event>, user_level: Int)
&& event.state_key() != Some(event.sender().as_str())
{
warn!(
%user_level,
?user_level,
required=%event_type_power_level,
state_key=?event.state_key(),
sender=%event.sender(),
@@ -1251,7 +1153,7 @@ fn check_power_levels(
room_version: &RoomVersionRules,
power_event: &impl Event,
previous_power_event: Option<&impl Event>,
user_level: Int,
user_level: UserPowerLevel,
creators: &BTreeSet<OwnedUserId>,
) -> Option<bool> {
match power_event.state_key() {
@@ -1327,12 +1229,14 @@ fn check_power_levels(
}
// If the current value is equal to the sender's current power level, reject
if user != power_event.sender() && old_level == Some(&user_level) {
if user != power_event.sender()
&& old_level.map(|i| UserPowerLevel::Int(*i)) == Some(user_level)
{
warn!(
?old_level,
?new_level,
?user,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot alter the power level of a user with the same power level as sender's own"
);
@@ -1341,14 +1245,14 @@ fn check_power_levels(
// If the current value is higher than the sender's current power level, reject
// If the new value is higher than the sender's current power level, reject
let old_level_too_big = old_level > Some(&user_level);
let new_level_too_big = new_level > Some(&user_level);
let old_level_too_big = old_level.map(|i| UserPowerLevel::Int(*i)) > Some(user_level);
let new_level_too_big = new_level.map(|i| UserPowerLevel::Int(*i)) > Some(user_level);
if old_level_too_big {
warn!(
?old_level,
?new_level,
?user,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot alter the power level of a user with a higher power level than sender's own"
);
@@ -1359,7 +1263,7 @@ fn check_power_levels(
?old_level,
?new_level,
?user,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot set the power level of a user to a level higher than sender's own"
);
@@ -1377,14 +1281,14 @@ fn check_power_levels(
// If the current value is higher than the sender's current power level, reject
// If the new value is higher than the sender's current power level, reject
let old_level_too_big = old_level > Some(&user_level);
let new_level_too_big = new_level > Some(&user_level);
let old_level_too_big = old_level.map(|i| UserPowerLevel::Int(*i)) > Some(user_level);
let new_level_too_big = new_level.map(|i| UserPowerLevel::Int(*i)) > Some(user_level);
if old_level_too_big {
warn!(
?old_level,
?new_level,
?ev_type,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot alter the power level of an event with a higher power level than sender's own"
);
@@ -1395,7 +1299,7 @@ fn check_power_levels(
?old_level,
?new_level,
?ev_type,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot set the power level of an event to a level higher than sender's own"
);
@@ -1416,7 +1320,7 @@ fn check_power_levels(
warn!(
?old_level,
?new_level,
%user_level,
?user_level,
sender=%power_event.sender(),
"cannot alter the power level of notifications greater than sender's own"
);
@@ -1446,7 +1350,7 @@ fn check_power_levels(
warn!(
?old_lvl,
?new_lvl,
%user_level,
?user_level,
sender=%power_event.sender(),
action=%lvl_name,
"cannot alter the power level of action greater than sender's own",
@@ -1475,7 +1379,7 @@ fn get_deserialize_levels(
fn check_redaction(
_room_version: &RoomVersionRules,
redaction_event: &impl Event,
user_level: Int,
user_level: UserPowerLevel,
redact_level: Int,
) -> Result<bool> {
if user_level >= redact_level {
+228 -25
View File
@@ -20,14 +20,16 @@ use std::{
use futures::{Future, FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt, future};
use ruma::{
EventId, Int, MilliSecondsSinceUnixEpoch, OwnedEventId,
EventId, Int, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedUserId,
events::{
StateEventType, TimelineEventType,
room::member::{MembershipState, RoomMemberEventContent},
},
int,
room_version_rules::{RoomIdFormatVersion, RoomVersionRules, StateResolutionVersion},
serde::Raw,
};
use serde::Deserialize;
use serde_json::from_str as from_json_str;
pub(crate) use self::error::Error;
@@ -155,8 +157,13 @@ where
// Sort the control events based on power_level/clock/event_id and
// outgoing/incoming edges
let sorted_control_levels =
reverse_topological_power_sort(control_events, &all_conflicted, &event_fetch).await?;
let sorted_control_levels = reverse_topological_power_sort(
control_events,
&all_conflicted,
room_version,
&event_fetch,
)
.await?;
debug!(count = sorted_control_levels.len(), "power events");
trace!(list = ?sorted_control_levels, "sorted power events");
@@ -357,6 +364,7 @@ where
async fn reverse_topological_power_sort<E, F, Fut>(
events_to_sort: Vec<OwnedEventId>,
auth_diff: &HashSet<OwnedEventId>,
room_version: &RoomVersionRules,
fetch_event: &F,
) -> Result<Vec<OwnedEventId>>
where
@@ -377,7 +385,7 @@ where
.cloned()
.stream()
.broad_filter_map(async |event_id| {
let pl = get_power_level_for_sender(&event_id, fetch_event)
let pl = get_power_level_for_sender(&event_id, room_version, fetch_event)
.await
.ok()?;
@@ -533,50 +541,141 @@ where
Ok(sorted)
}
/// Find the power level for the sender of `event_id` or return a default value
/// of zero.
/// Find the power level for the sender of `event_id`, falling back to the
/// room creator's power and then to `users_default`.
///
/// Do NOT use this any where but topological sort, we find the power level for
/// the eventId at the eventId's generation (we walk backwards to `EventId`s
/// most recent previous power level event).
async fn get_power_level_for_sender<E, F, Fut>(
event_id: &EventId,
room_version: &RoomVersionRules,
fetch_event: &F,
) -> serde_json::Result<Int>
where
F: Fn(OwnedEventId) -> Fut + Sync,
Fut: Future<Output = Option<E>> + Send,
E: Event + Send,
E: Event + Send + Sync,
{
debug!("fetch event ({event_id}) senders power level");
let event = fetch_event(event_id.to_owned()).await;
let Some(event) = fetch_event(event_id.to_owned()).await else {
return Ok(int!(0));
};
let auth_events = event.as_ref().map(Event::auth_events);
let pl = auth_events
.into_iter()
.flatten()
let auth_events: Vec<E> = event
.auth_events()
.map(ToOwned::to_owned)
.stream()
.broadn_filter_map(5, |aid| fetch_event(aid.to_owned()))
.ready_find(|aev| is_type_and_key(aev, &TimelineEventType::RoomPowerLevels, ""))
.broadn_filter_map(5, fetch_event)
.collect()
.await;
let sender_is_creator =
sender_is_creator(&event, room_version, &auth_events, fetch_event).await?;
// Since v12 the room creators outrank any m.room.power_levels event, so their
// ordering position does not depend on one being in scope.
if sender_is_creator
&& room_version
.authorization
.explicitly_privilege_room_creators
{
return Ok(Int::MAX);
}
let pl = auth_events
.iter()
.find(|aev| is_type_and_key(*aev, &TimelineEventType::RoomPowerLevels, ""));
let content: PowerLevelsContentFields = match pl {
| None => return Ok(int!(0)),
// With no m.room.power_levels in scope the create event's defaults apply,
// under which the room creator holds 100 and everyone else 0.
| None => return Ok(if sender_is_creator { int!(100) } else { int!(0) }),
| Some(ev) => from_json_str(ev.content().get())?,
};
if let Some(ev) = event {
if let Some(&user_level) = content.get_user_power(ev.sender()) {
debug!("found {} at power_level {user_level}", ev.sender());
return Ok(user_level);
}
if let Some(&user_level) = content.get_user_power(event.sender()) {
debug!("found {} at power_level {user_level}", event.sender());
return Ok(user_level);
}
Ok(content.users_default)
}
#[derive(Deserialize)]
struct RoomCreateContentFields {
creator: Option<Raw<OwnedUserId>>,
additional_creators: Option<Vec<Raw<OwnedUserId>>>,
}
/// Whether the sender of `event` created the room, either by sending the
/// create event, by being named as the creator in it (room versions 1-10) or
/// by being named in its `additional_creators`.
async fn sender_is_creator<E, F, Fut>(
event: &E,
room_version: &RoomVersionRules,
auth_events: &[E],
fetch_event: &F,
) -> serde_json::Result<bool>
where
F: Fn(OwnedEventId) -> Fut + Sync,
Fut: Future<Output = Option<E>> + Send,
E: Event + Send + Sync,
{
let create_event = auth_events
.iter()
.find(|aev| is_type_and_key(*aev, &TimelineEventType::RoomCreate, ""))
.cloned();
// Since v12 the create event is no longer listed in auth_events; the room ID
// is its event ID.
let create_event = match create_event {
| Some(create_event) => Some(create_event),
| None =>
match OwnedEventId::try_from(event.room_id_or_hash().as_str().replace('!', "$")) {
| Ok(create_event_id) => fetch_event(create_event_id).await,
| Err(_) => None,
},
};
let Some(create_event) = create_event else {
return Ok(false);
};
let content: RoomCreateContentFields = from_json_str(create_event.content().get())?;
// Before v11 the creator is recorded in the create event's content and can
// differ from its sender.
let is_creator = if room_version.authorization.use_room_create_sender {
create_event.sender() == event.sender()
} else {
content
.creator
.iter()
.filter_map(|creator| creator.deserialize().ok())
.any(|creator| creator == event.sender())
};
if is_creator {
return Ok(true);
}
if !room_version
.authorization
.explicitly_privilege_room_creators
{
return Ok(false);
}
Ok(content
.additional_creators
.iter()
.flatten()
.filter_map(|creator| creator.deserialize().ok())
.any(|creator| creator == event.sender()))
}
/// Check the that each event is authenticated based on the events before it.
///
/// ## Returns
@@ -1002,6 +1101,106 @@ mod tests {
utils::stream::IterStream,
};
/// Events at the start of a room have no `m.room.power_levels` in their
/// auth events, so the sender's power for sort ordering comes from the
/// create event instead.
#[tokio::test]
async fn power_level_for_sender_falls_back_to_creator() {
use futures::future::ready;
let create = to_pdu_event::<&str>(
"CREATE",
alice(),
TimelineEventType::RoomCreate,
Some(""),
to_raw_json_value(&json!({ "creator": alice() })).unwrap(),
&[],
&[],
);
// alice created the room, and there is no m.room.power_levels yet.
let alice_join = to_pdu_event(
"IMA",
alice(),
TimelineEventType::RoomMember,
Some(alice().as_str()),
member_content_join(),
&["CREATE"],
&["CREATE"],
);
let events: HashMap<OwnedEventId, PduEvent> = [create, alice_join]
.into_iter()
.map(|ev| (ev.event_id.clone(), ev))
.collect();
let fetcher = |id: OwnedEventId| ready(events.get(&id).cloned());
let power_level =
super::get_power_level_for_sender(&event_id("IMA"), &RoomVersionRules::V6, &fetcher)
.await
.unwrap();
assert_eq!(power_level, int!(100), "the creator should sort with their default power");
}
#[tokio::test]
async fn power_level_for_sender_uses_create_content_creator() {
use futures::future::ready;
// bob sent the create event, but alice is named as the creator in it.
let create = to_pdu_event::<&str>(
"CREATE",
bob(),
TimelineEventType::RoomCreate,
Some(""),
to_raw_json_value(&json!({ "creator": alice() })).unwrap(),
&[],
&[],
);
let alice_join = to_pdu_event(
"IMA",
alice(),
TimelineEventType::RoomMember,
Some(alice().as_str()),
member_content_join(),
&["CREATE"],
&["CREATE"],
);
let bob_join = to_pdu_event(
"IMB",
bob(),
TimelineEventType::RoomMember,
Some(bob().as_str()),
member_content_join(),
&["CREATE"],
&["CREATE"],
);
let events: HashMap<OwnedEventId, PduEvent> = [create, alice_join, bob_join]
.into_iter()
.map(|ev| (ev.event_id.clone(), ev))
.collect();
let fetcher = |id: OwnedEventId| ready(events.get(&id).cloned());
let alice_power =
super::get_power_level_for_sender(&event_id("IMA"), &RoomVersionRules::V6, &fetcher)
.await
.unwrap();
assert_eq!(alice_power, int!(100), "the content creator should sort with creator power");
let bob_power =
super::get_power_level_for_sender(&event_id("IMB"), &RoomVersionRules::V6, &fetcher)
.await
.unwrap();
assert_eq!(bob_power, int!(0), "the create event's sender is not the creator");
}
async fn test_event_sort() {
use futures::future::ready;
@@ -1024,10 +1223,14 @@ mod tests {
.collect::<Vec<_>>();
let fetcher = |id| ready(events.get(&id).cloned());
let sorted_power_events =
super::reverse_topological_power_sort(power_events, &auth_chain, &fetcher)
.await
.unwrap();
let sorted_power_events = super::reverse_topological_power_sort(
power_events,
&auth_chain,
&RoomVersionRules::V6,
&fetcher,
)
.await
.unwrap();
let resolved_power = super::iterative_auth_check(
&RoomVersionRules::V6,
-24
View File
@@ -180,30 +180,6 @@ impl From<IntPowerLevelsContentFields> for PowerLevelsContentFields {
}
}
#[inline]
pub(crate) fn deserialize_power_levels_content_fields(
content: &str,
room_version: &RoomVersionRules,
) -> Result<PowerLevelsContentFields, Error> {
if room_version.authorization.integer_power_levels {
deserialize_integer_power_levels_content_fields(content)
} else {
deserialize_legacy_power_levels_content_fields(content)
}
}
fn deserialize_integer_power_levels_content_fields(
content: &str,
) -> Result<PowerLevelsContentFields, Error> {
from_json_str::<IntPowerLevelsContentFields>(content).map(Into::into)
}
fn deserialize_legacy_power_levels_content_fields(
content: &str,
) -> Result<PowerLevelsContentFields, Error> {
from_json_str(content)
}
#[derive(Deserialize)]
pub(crate) struct PowerLevelsContentInvite {
#[serde(default, deserialize_with = "deserialize_v1_powerlevel")]
+2
View File
@@ -414,6 +414,7 @@ pub(crate) fn to_init_pdu_event(
content,
origin: None,
redacts: None,
sticky: None,
unsigned: None,
auth_events: vec![],
prev_events: vec![],
@@ -462,6 +463,7 @@ where
content,
origin: None,
redacts: None,
sticky: None,
unsigned: None,
auth_events,
prev_events,
+1 -4
View File
@@ -37,10 +37,7 @@ pub use self::{
stream::{IterStream, ReadyExt, Tools as StreamTools, TryReadyExt},
string::{str_from_bytes, string_from_bytes},
sys::compute::available_parallelism,
time::{
exponential_backoff::{continue_exponential_backoff, continue_exponential_backoff_secs},
now_millis as millis_since_unix_epoch, timepoint_ago, timepoint_from_now,
},
time::{now_millis as millis_since_unix_epoch, timepoint_ago, timepoint_from_now},
};
#[inline]
-1
View File
@@ -1,4 +1,3 @@
pub mod exponential_backoff;
pub mod jitter;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
@@ -1,38 +0,0 @@
use std::{cmp, time::Duration};
/// Returns false if the exponential backoff has expired based on the inputs
#[inline]
#[must_use]
pub fn continue_exponential_backoff_secs(
min: u64,
max: u64,
elapsed: Duration,
tries: u32,
) -> bool {
let min = Duration::from_secs(min);
let max = Duration::from_secs(max);
continue_exponential_backoff(min, max, elapsed, tries)
}
/// Returns false if the exponential backoff has expired based on the inputs
#[inline]
#[must_use]
pub fn continue_exponential_backoff(
min: Duration,
max: Duration,
elapsed: Duration,
tries: u32,
) -> bool {
let min = min.saturating_mul(tries).saturating_mul(tries);
let min = cmp::min(min, max);
elapsed < min
}
/// Determines the minimum number of backoff seconds
#[must_use]
pub fn min_exp_backoff_duration(min: u64, max: u64, retries: u32) -> Duration {
let min = Duration::from_secs(min)
.saturating_mul(retries)
.saturating_mul(retries);
Duration::from_secs(max).min(min)
}
+3
View File
@@ -11,6 +11,9 @@ repository.workspace = true
version.workspace = true
metadata.crane.workspace = true
[package.metadata.release]
pre-release-hook = [ "sh", "-c", "$WORKSPACE_ROOT/bin/release-script" ]
[lib]
path = "mod.rs"
crate-type = [
+41 -15
View File
@@ -1,6 +1,5 @@
use std::{borrow::Cow, fmt::Debug, mem, time::Instant};
use bytes::Bytes;
use conduwuit::{
Err, Error, Result, debug, debug_error, debug_info, debug_warn, err, trace,
utils::response::LimitReadExt,
@@ -11,7 +10,8 @@ use resolvematrix::resolution::Resolution;
use ruma::{
ServerName,
api::{
EndpointError, IncomingResponse, OutgoingRequest, OutgoingRequestExt, SupportedVersions,
EndpointError, IncomingResponseExt, OutgoingRequest, OutgoingRequestExt,
SupportedVersions,
auth_scheme::{AuthScheme, NoAuthentication},
error::Error as RumaError,
federation::authentication::{ServerSignatures, ServerSignaturesInput},
@@ -131,6 +131,8 @@ impl super::Service {
))));
}
self.ensure_remote_is_healthy(dest)?;
let actual = self
.services
.client
@@ -183,8 +185,25 @@ impl super::Service {
| Ok(response) =>
self.handle_response::<T>(dest, actual, &method, &url, response)
.await,
| Err(error) =>
Err(handle_error(actual, &method, &url, error).expect_err("always returns error")),
| Err(error) => {
// This awful wrapping hack is required because `reqwest::Error` does not
// implement `Clone`, but we need to convert it into a local error type to pass
// to should_mark_stale, but handle_error then itself expects the original
// reqwest error.
// handle_error *could* just take the wrapped error, but it'd have to unwrap it
// anyway.
let wrapped = Error::Reqwest(error.into());
if self.should_mark_stale(&wrapped) {
debug_info!("{dest} is unhealthy & stale due to a connect error");
self.mark_destination_stale(dest);
self.hit_unhealthy(dest.to_owned());
}
let Error::Reqwest(unwrapped) = wrapped else {
unreachable!("wrapped reqwest error must unwrap to a reqwest error");
};
Err(handle_error(actual, &method, &url, unwrapped.into())
.expect_err("always returns error"))
},
}
}
@@ -232,8 +251,20 @@ impl super::Service {
let response =
into_http_response(dest, actual, method, url, response, size_limit).await?;
T::IncomingResponse::try_from_http_response(response)
.map_err(|e| err!(BadServerResponse("Server returned bad 200 response: {e:?}")))
let (parts, body) = response.into_parts();
T::IncomingResponse::try_from_http_response(http::Response::from_parts(
parts,
body.as_ref(),
))
.inspect(|_| {
self.mark_healthy(dest);
})
.map_err(|e| {
// Bad 200 response is usually a sign of bad routing, so we'll mark as stale.
// We won't mark as offline though since we technically got a response.
self.mark_destination_stale(dest);
err!(BadServerResponse("Server returned bad 200 response: {e:?}"))
})
}
}
@@ -244,7 +275,7 @@ async fn into_http_response(
url: &Url,
mut response: Response,
max_size: u64,
) -> Result<http::Response<Bytes>> {
) -> Result<http::Response<Vec<u8>>> {
let status = response.status();
trace!(
%status, %method,
@@ -267,20 +298,15 @@ async fn into_http_response(
trace!("Waiting for response body...");
let http_response = http_response_builder
.body(
response
.limit_read(max_size)
.await
.unwrap_or_default()
.into(),
)
.body(response.limit_read(max_size).await.unwrap_or_default())
.expect("reqwest body is valid http body");
debug!("Got {status:?} for {method} {url}");
if !status.is_success() {
let (parts, body) = http_response.into_parts();
return Err(Error::Federation(
dest.to_owned(),
RumaError::from_http_response(http_response),
RumaError::from_http_response(http::Response::from_parts(parts, body.as_ref())),
));
}
+178 -2
View File
@@ -1,13 +1,27 @@
mod execute;
use std::sync::Arc;
use conduwuit::{Result, Server};
use std::{
collections::{HashMap, HashSet},
sync::Arc,
time::Duration,
};
use assign::assign;
use async_trait::async_trait;
use conduwuit::{Error, Result, Server, SyncRwLock, debug, utils::millis_since_unix_epoch};
pub(crate) use execute::FederationPathBuilderInput;
use http::StatusCode;
use ruma::{
OwnedServerName, ServerName,
api::error::{ErrorKind, LimitExceededErrorData, RetryAfter},
};
use crate::{Dep, client, moderation, server_keys};
pub struct Service {
services: Services,
pub remote_health: SyncRwLock<HashMap<OwnedServerName, (u32, u64)>>,
pub stale_destinations: SyncRwLock<HashSet<OwnedServerName>>,
}
struct Services {
@@ -17,6 +31,7 @@ struct Services {
moderation: Dep<moderation::Service>,
}
#[async_trait]
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
Ok(Arc::new(Self {
@@ -26,8 +41,169 @@ impl crate::Service for Service {
server_keys: args.depend::<server_keys::Service>("server_keys"),
moderation: args.depend::<moderation::Service>("moderation"),
},
remote_health: SyncRwLock::new(HashMap::new()),
stale_destinations: SyncRwLock::new(HashSet::new()),
}))
}
fn name(&self) -> &str { crate::service::make_name(std::module_path!()) }
async fn clear_cache(&self) {
let mut map = self.remote_health.write();
map.clear();
}
}
impl Service {
/// Checks if a remote is "healthy". "Healthy" is defined by either:
///
/// * The remote has not been marked as having a failed request, OR
/// * The next retry timestamp is in the past
pub fn is_healthy(&self, server_name: &ServerName) -> bool {
let map = self.remote_health.read();
let unix_now = millis_since_unix_epoch();
if let Some((_, next_retry)) = map.get(server_name) {
unix_now >= *next_retry
} else {
true
}
}
/// Returns how long the server should wait before attempting to contact the
/// remote again.
pub fn retry_after(&self, server_name: &ServerName) -> Option<Duration> {
let map = self.remote_health.read();
let unix_now = millis_since_unix_epoch();
map.get(server_name)
.map(|(_, next_retry)| Duration::from_millis((*next_retry).saturating_sub(unix_now)))
}
/// Marks or updates a remote's health status as unhealthy. If the remote is
/// not already marked as unhealthy, a new entry is created. Otherwise, the
/// retry count is incremented and next retry window is updated.
///
/// Does not update the marker if the backoff period is already in effect.
pub fn hit_unhealthy(&self, server_name: OwnedServerName) {
let unix_now = millis_since_unix_epoch();
let mut map = self.remote_health.write();
let sn2 = server_name.clone(); // for logging since map.entry() moves
let (retries, next_retry) = map.entry(server_name).or_default();
if *next_retry > unix_now {
// Don't update the retry marker if we are already in a backoff
// period. This prevents the backoff skyrocketing if multiple
// concurrent or closely-related requests fail and consequently try
// to mark as offline.
return;
}
let min = Duration::from_secs(self.services.server.config.sender_retry_backoff_base);
let max = Duration::from_secs(self.services.server.config.sender_retry_backoff_limit);
*retries = retries.saturating_add(1);
let next_interval = min.saturating_mul(*retries).min(max);
*next_retry = unix_now.saturating_add(
u64::try_from(next_interval.as_millis())
.expect("backoff milliseconds should not exceed u64::MAX"),
);
debug!(
"{} is (now) unhealthy ({} retries, blocked until: {})",
sn2, *retries, *next_retry
);
}
/// Marks a server as "healthy" by removing it from the health map.
///
/// Returns true if the server was previously marked as unhealthy, false
/// otherwise.
pub fn mark_healthy(&self, server_name: &ServerName) -> bool {
let mut health_map = self.remote_health.write();
let was_unhealthy = health_map.remove(server_name).is_some();
if was_unhealthy {
debug!("{} is now healthy", server_name);
}
// The lock for remote_health is deliberately retained until the end of the
// function to prevent parallel requests from marking the server as healthy
// and then immediately marking it as unhealthy again due to the stale cache
// we might be about to clear
let mut stale_destinations = self.stale_destinations.write();
if stale_destinations.remove(server_name) {
debug!(
"{server_name} is no longer unhealthy but was stale, clearing destination cache \
entry"
);
self.services
.client
.matrix_resolver
.remove_cache_entry(server_name.as_str());
}
was_unhealthy
}
/// Returns a rate-limited error if the remote is unhealthy.
fn ensure_remote_is_healthy(&self, server_name: &ServerName) -> Result<()> {
if self.is_healthy(server_name) {
Ok(())
} else {
let retry_after = self
.retry_after(server_name)
.expect("remote is unhealthy and must have an accompanying retry timestamp");
Err(Error::Request(
ErrorKind::LimitExceeded(assign!(LimitExceededErrorData::new(), {
retry_after: Some(RetryAfter::Delay(retry_after)),
})),
format!(
"Remote server {} is currently unhealthy (not retrying for another {} \
seconds)",
server_name,
retry_after.as_secs()
)
.into(),
StatusCode::TOO_MANY_REQUESTS,
))
}
}
/// Marks a destination as stale, which will cause the destination cache to
/// be invalidated next time we receive a request FROM that destination.
/// This does not inherently mark the remote as "unhealthy".
///
/// Typically, this should only be done if a connection error is
/// encountered, which might indicate that the address of the destination
/// is incorrect or has since moved.
pub fn mark_destination_stale(&self, server_name: &ServerName) {
self.stale_destinations
.write()
.insert(server_name.to_owned());
}
/// Determines whether a destination should be marked "stale" depending on
/// the returned error.
pub fn should_mark_stale(&self, error: &Error) -> bool {
if let Error::Reqwest(error) = error {
if error.is_connect() {
return true;
}
}
match error.status_code() {
// Some special servers account for this specifically
| StatusCode::MISDIRECTED_REQUEST
// Common error codes observed for misdirected requests
// | StatusCode::NOT_FOUND This one can be encountered naturally
| StatusCode::METHOD_NOT_ALLOWED
| StatusCode::IM_A_TEAPOT => true,
_ => false,
}
}
/// Returns a clone of the internal remote health tracking map.
pub fn remote_health(&self) -> HashMap<OwnedServerName, (u32, u64)> {
self.remote_health.read().clone()
}
/// Returns a clone of the internal stale destinations set.
pub fn stale_destinations(&self) -> HashSet<OwnedServerName> {
self.stale_destinations.read().clone()
}
}
+6
View File
@@ -178,6 +178,11 @@ impl OAuthError {
pub const fn invalid_grant(error_description: &'static str) -> Self {
Self::new_static(ErrorCode::InvalidGrant, error_description)
}
#[must_use]
pub const fn unauthorized_client(error_description: &'static str) -> Self {
Self::new_static(ErrorCode::UnauthorizedClient, error_description)
}
}
impl Display for OAuthError {
@@ -197,6 +202,7 @@ pub enum ErrorCode {
InvalidGrant,
InvalidClient,
InvalidClientMetadata,
UnauthorizedClient,
AuthorizationPending,
ExpiredToken,
}
+6 -2
View File
@@ -20,7 +20,7 @@ use url::Url;
use crate::{
Dep, config,
oauth::{
client_metadata::{ApplicationType, ClientMetadata, ResponseType},
client_metadata::{ApplicationType, ClientMetadata, GrantType, ResponseType},
grant::{
AuthorizationCodeQuery, AuthorizationCodeResponse, CodeChallengeMethod,
DeviceCodeRequest, DeviceCodeResponse, ErrorCode, OAuthError, ResponseMode, Scope,
@@ -329,6 +329,10 @@ impl Service {
return Err(OAuthError::new_static(ErrorCode::InvalidClient, "Invalid client ID"));
};
if !client_metadata.grant_types.contains(&GrantType::DeviceCode) {
return Err(OAuthError::unauthorized_client("Client cannot request this grant type"));
}
let requested_scopes = query
.scope
.to_scopes()
@@ -438,7 +442,7 @@ impl Service {
};
if !client_metadata.grant_types.contains(&request.grant_type()) {
return Err(OAuthError::invalid_grant("Client cannot request this grant type"));
return Err(OAuthError::unauthorized_client("Client cannot request this grant type"));
}
match request {
+6 -4
View File
@@ -13,7 +13,7 @@ use ipaddress::IPAddress;
use ruma::{
DeviceId, OwnedDeviceId, RoomId, UInt, UserId,
api::{
IncomingResponse, OutgoingRequest, OutgoingRequestExt,
IncomingResponseExt, OutgoingRequest, OutgoingRequestExt,
auth_scheme::NoAuthentication,
client::push::{Pusher, PusherKind, set_pusher},
path_builder::SinglePath,
@@ -266,10 +266,12 @@ impl Service {
)));
}
let (parts, body) = http_response_builder
.body(body)
.expect("reqwest body is valid http body")
.into_parts();
let response = T::IncomingResponse::try_from_http_response(
http_response_builder
.body(body)
.expect("reqwest body is valid http body"),
http::Response::from_parts(parts, body.as_ref()),
);
response.map_err(|e| {
err!(BadServerResponse(warn!(
@@ -154,9 +154,9 @@ impl super::Service {
.stream()
.fold(0_u8, |i, event_id| async move {
if self.services.timeline.pdu_exists(event_id).await {
i.expected_add(1)
} else {
i
} else {
i.expected_add(1)
}
})
.await;
@@ -170,12 +170,13 @@ impl super::Service {
.expect("we just checked that we have all auth events")
.to_owned();
let key = auth_event.kind().with_state_key(
auth_event
.state_key
.clone()
.expect("all auth events must have state keys"),
);
let Some(state_key) = auth_event.state_key() else {
self.reject_and_persist(event_id, &incoming_pdu);
return Err!(Request(Forbidden(debug_warn!(
"Event references non-state event as an auth event: {id}",
))));
};
let key = auth_event.kind().with_state_key(state_key);
match auth_events_by_key.entry(key) {
| hash_map::Entry::Vacant(v) => {
v.insert(auth_event);
+10 -1
View File
@@ -7,6 +7,7 @@ mod handle_incoming_pdu;
mod handle_outlier_pdu;
mod parse_incoming_pdu;
pub mod pdu_checks;
mod pending_join_pdus;
mod policy_server;
mod resolve_state;
mod state_at_incoming;
@@ -20,9 +21,10 @@ pub use fetch_and_handle_outliers::{
DagBuilderTree, GET_MISSING_EVENTS_MAX_BATCH_SIZE, build_local_dag,
};
use ruma::{
OwnedEventId, OwnedRoomId, events::room::create::RoomCreateEventContent,
OwnedEventId, OwnedRoomId, OwnedServerName, events::room::create::RoomCreateEventContent,
room_version_rules::RoomVersionRules,
};
use serde_json::value::RawValue as RawJsonValue;
use tokio::sync::{Notify, mpsc};
use crate::{Dep, globals, rooms, sending, server_keys};
@@ -30,6 +32,7 @@ pub struct Service {
pub mutex_federation: RoomMutexMap,
pub federation_handletime: SyncRwLock<HandleTimeMap>,
pub extremity_squashers: SyncRwLock<HashMap<OwnedRoomId, mpsc::Sender<(usize, bool)>>>,
joining_rooms: SyncRwLock<HashMap<OwnedRoomId, mpsc::Sender<PendingJoinPdu>>>,
services: Services,
server_shutdown: Notify,
me: std::sync::Weak<Self>,
@@ -55,6 +58,11 @@ struct Services {
type RoomMutexMap = MutexMap<OwnedRoomId, ()>;
type HandleTimeMap = HashMap<OwnedRoomId, (OwnedEventId, Instant)>;
enum PendingJoinPdu {
Pdu(OwnedServerName, Box<RawJsonValue>),
Complete,
}
#[async_trait]
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
@@ -63,6 +71,7 @@ impl crate::Service for Service {
mutex_federation: RoomMutexMap::new(),
federation_handletime: HandleTimeMap::new().into(),
extremity_squashers: SyncRwLock::new(HashMap::new()),
joining_rooms: HashMap::new().into(),
services: Services {
globals: args.depend::<globals::Service>("globals"),
sending: args.depend::<sending::Service>("sending"),
@@ -1,13 +1,15 @@
use std::str::FromStr;
use conduwuit::{
Err, Result, err,
Err, Error, Result, err,
matrix::event::{gen_event_id, gen_event_id_canonical_json},
};
use itertools::Itertools;
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId, RoomId,
RoomVersionId, room_version_rules::RoomVersionRules,
RoomVersionId,
api::error::{ErrorKind, IncompatibleRoomVersionErrorData},
room_version_rules::RoomVersionRules,
};
use serde_json::value::RawValue as RawJsonValue;
@@ -102,14 +104,25 @@ impl super::Service {
let room_version_rules = match room_version_rules {
| Some(r) => r,
| None => &self
.services
.state
.get_room_version(&room_id)
.await
.unwrap_or(RoomVersionId::V1)
.rules()
.expect("room version must be supported"),
| None => {
let room_version = self
.services
.state
.get_room_version(&room_id)
.await
.map_err(|_| err!(Request(NotFound("no version associated with room ID"))))?;
if matches!(room_version, RoomVersionId::V1 | RoomVersionId::V2) {
return Err(Error::BadRequest(
ErrorKind::IncompatibleRoomVersion(
IncompatibleRoomVersionErrorData::new(room_version),
),
"Room version is too old.",
));
}
&room_version
.rules()
.expect("room version must be supported")
},
};
let (event_id, value) =
+127 -2
View File
@@ -1,5 +1,6 @@
use std::collections::HashMap;
use base64::Engine;
use conduwuit::{
Err, Event, EventTypeExt, PduEvent, Result, debug, debug::DebugInspect, debug_error,
debug_info, err, info, matrix::StateKey, state_res, trace,
@@ -7,14 +8,43 @@ use conduwuit::{
use futures::future::ready;
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, ServerName,
api::error::ErrorKind, canonical_json::redact, events::StateEventType,
room_version_rules::RoomVersionRules,
api::error::ErrorKind,
canonical_json::redact,
events::StateEventType,
room_version_rules::{EventIdFormatVersion, RoomVersionRules},
};
use crate::rooms::{
event_handler::parse_incoming_pdu::expect_event_id_array, timeline::pdu_fits,
};
/// Checks that the given event ID matches the expected format by attempting to
/// decode the base64 string.
fn check_event_id_format(
event_id: &EventId,
room_version_rules: &RoomVersionRules,
) -> Result<Vec<u8>> {
let event_id_without_sigil = event_id
.as_str()
.strip_prefix("$")
.expect("event ID must start with a $ sigil");
let b64_alphabet = match room_version_rules.event_id_format {
| EventIdFormatVersion::V2 => base64::alphabet::STANDARD,
| EventIdFormatVersion::V3 => base64::alphabet::URL_SAFE,
| _ => return Err!("Unsupported event ID Format"),
};
let b64_engine = base64::engine::GeneralPurpose::new(
&b64_alphabet,
base64::engine::general_purpose::NO_PAD,
);
b64_engine.decode(event_id_without_sigil).map_err(|e| {
err!(Request(InvalidParam(debug_error!(
error=?e,
"PDU references an invalid event ID: {event_id}"
))))
})
}
impl super::Service {
/// Checks that the PDU conforms to the PDU format (check 1). This is
/// already mostly done during deserialisation, so this function just checks
@@ -42,6 +72,9 @@ impl super::Service {
if auth_events.len() > 10 {
return Err!(Request(BadJson("PDU has too many auth events")));
}
for auth_event_id in &auth_events {
check_event_id_format(auth_event_id, room_version_rules)?;
}
// The m.room.create event is the genesis event and has empty auth_events
// by definition, so it is exempt from the checks below requiring or
@@ -70,6 +103,9 @@ impl super::Service {
if prev_events.len() > 20 {
return Err!(Request(BadJson("PDU has too many prev events")));
}
for prev_event_id in &prev_events {
check_event_id_format(prev_event_id, room_version_rules)?;
}
Ok(())
}
@@ -306,3 +342,92 @@ impl super::Service {
Ok(true)
}
}
#[cfg(test)]
mod tests {
use ruma::server_name;
use super::*;
#[test]
fn v1_event_id_always_errors() {
let v1_event_id = EventId::new_v1(server_name!("example.com"));
assert!(
check_event_id_format(&v1_event_id, &RoomVersionRules::V3).is_err(),
"V1 event ID should not be valid in room V3"
);
assert!(
check_event_id_format(&v1_event_id, &RoomVersionRules::V4).is_err(),
"V1 event ID should not be valid in room V4"
);
}
#[test]
fn v2_event_id_ok_in_room_v3_only() {
let v2_event_id = EventId::new_v2_or_v3("KtY/RFXNXYxprwSOypvTlZsbohReRw19qcPATZDda4E")
.expect("fixture event hash must be valid");
let decoded_bytes = check_event_id_format(&v2_event_id, &RoomVersionRules::V3)
.expect("V2 event ID should be valid in room V3");
assert_eq!(
decoded_bytes,
vec![
42, 214, 63, 68, 85, 205, 93, 140, 105, 175, 4, 142, 202, 155, 211, 149, 155, 27,
162, 20, 94, 71, 13, 125, 169, 195, 192, 77, 144, 221, 107, 129
],
"V2 event reference hash did not decode to expected bytes"
);
assert!(
check_event_id_format(&v2_event_id, &RoomVersionRules::V4).is_err(),
"V2 event ID should not be valid in room V4"
);
}
#[test]
fn v3_event_id_errors_in_room_v3() {
let v3_event_id = EventId::new_v2_or_v3("zsj67_pqjr5qqh5GMTXqxLM0FqjP5OLrvXO0PjwWe88")
.expect("fixture event hash must be valid");
// Since the urlsafe replacements aren't in the standard base64 alphabet, this
// simply errors instead of decoding to potentially incorrect bytes.
assert!(
check_event_id_format(&v3_event_id, &RoomVersionRules::V3).is_err(),
"V3 event ID should not be valid in room V3"
);
}
#[test]
fn v3_event_id_ok_in_room_v4_onward() {
let v3_event_id = EventId::new_v2_or_v3("zsj67_pqjr5qqh5GMTXqxLM0FqjP5OLrvXO0PjwWe88")
.expect("fixture event hash must be valid");
// Since the urlsafe replacements aren't in the standard base64 alphabet, this
// simply errors instead of decoding to potentially incorrect bytes.
let expected_bytes = vec![
206, 200, 250, 239, 250, 106, 142, 190, 106, 170, 30, 70, 49, 53, 234, 196, 179, 52,
22, 168, 207, 228, 226, 235, 189, 115, 180, 62, 60, 22, 123, 207,
];
assert_eq!(
check_event_id_format(&v3_event_id, &RoomVersionRules::V4)
.expect("V3 event should be valid room V4"),
expected_bytes,
"V3 event ID in room V4 did not decode to expected bytes"
);
// These versions didn't change the algorithm, but might as well test them
// anyway
assert_eq!(
check_event_id_format(&v3_event_id, &RoomVersionRules::V6)
.expect("V3 event should be valid room V6"),
expected_bytes,
"V3 event ID in room V6 did not decode to expected bytes"
);
assert_eq!(
check_event_id_format(&v3_event_id, &RoomVersionRules::V10)
.expect("V3 event should be valid room V10"),
expected_bytes,
"V3 event ID in room V10 did not decode to expected bytes"
);
assert_eq!(
check_event_id_format(&v3_event_id, &RoomVersionRules::V12)
.expect("V3 event should be valid room V12"),
expected_bytes,
"V3 event ID in room V12 did not decode to expected bytes"
);
}
}
@@ -0,0 +1,82 @@
use conduwuit::{debug, debug_warn};
use ruma::{CanonicalJsonObject, RoomId, ServerName};
use serde_json::value::RawValue as RawJsonValue;
impl super::Service {
pub fn begin_remote_join(&self, room_id: &RoomId) {
let (tx, mut rx) = tokio::sync::mpsc::channel(
self.services.server.config.remote_join_pdu_queue_capacity,
);
self.joining_rooms.write().insert(room_id.to_owned(), tx);
let Some(service) = self.me.upgrade() else {
return;
};
let room_id = room_id.to_owned();
self.services.server.runtime().spawn(async move {
let mut pdus = Vec::new();
let mut complete = false;
while let Some(pdu) = rx.recv().await {
match pdu {
| super::PendingJoinPdu::Pdu(origin, pdu) => pdus.push((origin, pdu)),
| super::PendingJoinPdu::Complete => {
complete = true;
break;
},
}
}
if !complete {
return;
}
let _room_lock = service.mutex_federation.lock(room_id.as_str()).await;
for (origin, pdu) in pdus {
let Ok((room_id, event_id, value)) = service.parse_incoming_pdu(&pdu, None).await
else {
debug_warn!("Failed to parse PDU queued during remote join");
continue;
};
if let Err(error) = service
.handle_incoming_pdu(&origin, &room_id, &event_id, value, false)
.await
{
debug_warn!(%room_id, %event_id, "Failed to process PDU queued during remote join: {error}");
}
}
});
}
pub fn cancel_remote_join(&self, room_id: &RoomId) {
self.joining_rooms.write().remove(room_id);
}
pub fn queue_pending_join_pdu(&self, origin: &ServerName, pdu: Box<RawJsonValue>) -> bool {
let Ok(value) = serde_json::from_str::<CanonicalJsonObject>(pdu.get()) else {
return false;
};
let Some(room_id) = value.get("room_id").and_then(|value| value.as_str()) else {
return false;
};
let Ok(room_id) = RoomId::parse(room_id) else {
return false;
};
let joining_rooms = self.joining_rooms.read();
let Some(tx) = joining_rooms.get(&room_id) else {
return false;
};
let pdu = super::PendingJoinPdu::Pdu(origin.to_owned(), pdu);
if tx.try_send(pdu).is_err() {
debug_warn!(%room_id, "Dropping PDU received during remote join because the queue is full");
} else {
debug!(%room_id, "Queued PDU received during remote join");
}
true
}
pub async fn process_pending_join_pdus(&self, room_id: &RoomId) {
let Some(tx) = self.joining_rooms.write().remove(room_id) else {
return;
};
let _ = tx.send(super::PendingJoinPdu::Complete).await;
}
}
+8 -1
View File
@@ -1,7 +1,8 @@
use std::{collections::HashMap, sync::Arc};
use conduwuit::{
Err, Event, Pdu, Result, Server, debug, debug_info, debug_warn, err, error, info, is_true,
Err, Event, Pdu, Result, Server, debug, debug_info, debug_warn, defer, err, error, info,
is_true,
matrix::{
StateKey,
event::{gen_event_id, gen_event_id_canonical_json},
@@ -404,6 +405,8 @@ impl Service {
.mutex_federation
.lock(room_id.as_str())
.await;
self.services.event_handler.begin_remote_join(room_id);
defer! {{ self.services.event_handler.cancel_remote_join(room_id); }}
info!("Asking {remote_server} for send_join in room {room_id}");
let send_join_response = match self
.services
@@ -675,6 +678,10 @@ impl Service {
drop(cork);
self.services.sync.wake_all_joined(room_id).await;
self.services
.event_handler
.process_pending_join_pdus(room_id)
.await;
Ok(())
}
@@ -281,6 +281,7 @@ mod tests {
origin_server_ts: UInt::try_from(1_234_567_890_u64).unwrap(),
kind: TimelineEventType::RoomMessage,
content: to_raw_value(&json!({"msgtype": "m.text", "body": "test"})).unwrap(),
sticky: None,
state_key: None,
prev_events: vec![],
depth: UInt::from(1_u32),
@@ -445,6 +446,7 @@ mod tests {
origin_server_ts: UInt::try_from(1_234_567_890_u64).unwrap(),
kind: event_type,
content: to_raw_value(&content).unwrap(),
sticky: None,
state_key: state_key.map(Into::into),
prev_events: vec![],
depth: UInt::from(1_u32),
+52 -3
View File
@@ -152,15 +152,21 @@ pub fn pack_receipts<I>(receipts: I) -> Raw<SyncEphemeralRoomEvent<ReceiptEventC
where
I: Iterator<Item = Raw<AnySyncEphemeralRoomEvent>>,
{
let mut json = BTreeMap::new();
let mut json: BTreeMap<OwnedEventId, Receipts> = BTreeMap::new();
for value in receipts {
let receipt = serde_json::from_str::<SyncEphemeralRoomEvent<ReceiptEventContent>>(
value.json().get(),
);
match receipt {
| Ok(value) =>
for (event, receipt) in value.content {
json.insert(event, receipt);
for (event, receipt_types) in value.content {
let event_receipts = json.entry(event).or_default();
for (receipt_type, users) in receipt_types {
event_receipts
.entry(receipt_type)
.or_default()
.extend(users);
}
},
| _ => {
debug!("failed to parse receipt: {:?}", receipt);
@@ -175,3 +181,46 @@ where
.expect("received valid json"),
)
}
#[cfg(test)]
mod tests {
use ruma::{
events::receipt::{Receipt, ReceiptType},
user_id,
};
use super::*;
fn receipt(event_id: OwnedEventId, user_id: OwnedUserId) -> Raw<AnySyncEphemeralRoomEvent> {
let content = ReceiptEventContent::from_iter([(
event_id,
BTreeMap::from([(
ReceiptType::Read,
BTreeMap::from([(user_id, Receipt::default())]),
)]),
)]);
Raw::from_json(
serde_json::value::to_raw_value(&SyncEphemeralRoomEvent::new(content))
.expect("receipt event serializes"),
)
}
#[test]
fn pack_receipts_keeps_users_reading_the_same_event() {
let event_id: OwnedEventId = "$event:example.org".try_into().expect("valid event ID");
let packed = pack_receipts(
[
receipt(event_id.clone(), user_id!("@alice:example.org").to_owned()),
receipt(event_id.clone(), user_id!("@bob:example.org").to_owned()),
]
.into_iter(),
);
let packed: SyncEphemeralRoomEvent<ReceiptEventContent> =
serde_json::from_str(packed.json().get()).expect("packed receipt is valid");
let users = &packed.content[&event_id][&ReceiptType::Read];
assert_eq!(users.len(), 2);
assert!(users.contains_key(user_id!("@alice:example.org")));
assert!(users.contains_key(user_id!("@bob:example.org")));
}
}
+1 -5
View File
@@ -16,9 +16,7 @@ use ruma::{
serde::Raw,
};
use crate::{
Dep, account_data, appservice::RegistrationInfo, config, globals, rooms, sync, users,
};
use crate::{Dep, account_data, appservice::RegistrationInfo, config, globals, rooms, users};
pub struct Service {
appservice_in_room_cache: AppServiceInRoomCache,
@@ -33,7 +31,6 @@ struct Services {
metadata: Dep<rooms::metadata::Service>,
state: Dep<rooms::state::Service>,
state_accessor: Dep<rooms::state_accessor::Service>,
sync: Dep<sync::Service>,
users: Dep<users::Service>,
}
@@ -70,7 +67,6 @@ impl crate::Service for Service {
state: args.depend::<rooms::state::Service>("rooms::state"),
state_accessor: args
.depend::<rooms::state_accessor::Service>("rooms::state_accessor"),
sync: args.depend::<sync::Service>("sync"),
users: args.depend::<users::Service>("users"),
},
db: Data {
-7
View File
@@ -133,13 +133,6 @@ impl super::Service {
self.update_joined_count(room_id).await;
}
// Kick the target user's sync loop if they're local and this isn't a join to
// make sure that membership changes like invites or invite rejections get
// synced
if is_local && !matches!(membership.membership, MembershipState::Join) {
self.services.sync.wake(user_id).await;
}
Ok(())
}
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff. Show more