Compare commits

...
83 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
75 changed files with 1908 additions and 1078 deletions

No files matched your search

+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@7f4eb899022d8fe70b20c4f3de697aa85c309026 # 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
@@ -43,7 +43,7 @@ jobs:
name: Renovate
runs-on: ubuntu-latest
container:
image: ghcr.io/renovatebot/renovate:43.288.0@sha256:bcde7a061ab42d1ae6d4500769d80727e5694bb889dbcbf1005e9f4e741ab76d
image: ghcr.io/renovatebot/renovate:44.35.3@sha256:822fd48b8ca3a0ab7b5c6b35088a097729190eb710e7bc4a4b073e605bf23c0f
options: --tmpfs /tmp:exec
steps:
- name: Checkout
+137 -87
View File
@@ -1,49 +1,76 @@
# Continuwuity v26.8.0-alpha.1 (2026-08-14)
# Continuwuity 26.8.1 (2026-08-22)
No significant changes.
# Continuwuity v26.8.0 (2026-08-22)
## Features
- Added MSC4354 sticky events, behind the `allow_sticky_events` config option. Contributed by @eleboucher.
- Added MSC4480 sticky events to simplified sliding sync. Contributed by @eleboucher.
- Added scoped typing updates to simplified Sliding Sync (MSC4508). Contributed by @eleboucher.
- 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
- 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)
- Re-introduced admin room registration alerts that were accidentally removed in the OAuth2 update. (#2057)
- Resolve membership service by correct name for auto-join. Contributed by @Aranjedeath (#2082)
- Plugged a logic gap that may have been allowing Continuwuity to process events with incorrect room versions under certain conditions. Contributed by @nex. (#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)
- Added MSC4186 direct, encrypted, and room-type list filters, resolving invited rooms from their stripped invite state. Contributed by @eleboucher.
- 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)
- Updated the docs to reflect the current default User-Agent for URL previews (#2079)
- Added missing documentation to config parameters. Contributed by @renegadespork (#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)
- 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
- #2033
- 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)
- 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)
@@ -57,10 +84,12 @@
## 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.
@@ -72,15 +101,19 @@
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
@@ -93,13 +126,14 @@
## 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.
@@ -108,12 +142,13 @@
## 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`.
@@ -123,56 +158,63 @@
## 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)
- 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)
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)
- 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.
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)
- 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
@@ -186,7 +228,7 @@
## 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
@@ -195,49 +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)
@@ -252,8 +302,8 @@
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
- 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))
Generated
+92 -86
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",
@@ -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"
@@ -615,7 +621,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
@@ -816,7 +822,7 @@ dependencies = [
[[package]]
name = "conduwuit"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"aws-lc-rs",
"clap",
@@ -854,7 +860,7 @@ dependencies = [
[[package]]
name = "conduwuit_admin"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"assign",
"clap",
@@ -880,7 +886,7 @@ dependencies = [
[[package]]
name = "conduwuit_api"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"assign",
"async-trait",
@@ -918,7 +924,7 @@ dependencies = [
[[package]]
name = "conduwuit_build_metadata"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"built",
"cargo_metadata",
@@ -926,7 +932,7 @@ dependencies = [
[[package]]
name = "conduwuit_core"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"argon2",
"arrayvec",
@@ -979,7 +985,7 @@ dependencies = [
"sha2 0.11.0",
"smallstr",
"smallvec",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tikv-jemalloc-ctl",
"tikv-jemalloc-sys",
"tikv-jemallocator",
@@ -994,7 +1000,7 @@ dependencies = [
[[package]]
name = "conduwuit_database"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"async-channel",
"conduwuit_core",
@@ -1015,7 +1021,7 @@ dependencies = [
[[package]]
name = "conduwuit_macros"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"cargo_toml",
"itertools 0.15.0",
@@ -1026,7 +1032,7 @@ dependencies = [
[[package]]
name = "conduwuit_router"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"assign",
"axum",
@@ -1063,7 +1069,7 @@ dependencies = [
[[package]]
name = "conduwuit_service"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"askama",
"assign",
@@ -1115,7 +1121,7 @@ dependencies = [
[[package]]
name = "conduwuit_web"
version = "26.8.0-alpha.1"
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.12"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d83cb7e7a873830708d6b02a78cd36a592c6fa14bf267b68725103b85c0d77f"
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",
]
@@ -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.2"
version = "0.19.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee1a0d6e252afe82e7bc2db42fba60e02ddf3b1accaf8cb21d96e34ba61f3d4"
checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9"
[[package]]
name = "linked-hash-map"
@@ -3028,9 +3034,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linktime-proc-macro"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348d0075b1fc163b26d72a7f75fc5141daf2fd1bdf128d873cbaf6785d495bdf"
checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616"
[[package]]
name = "linux-raw-sys"
@@ -3447,7 +3453,7 @@ version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d"
dependencies = [
"base64 0.22.1",
"base64 0.21.7",
"chrono",
"getrandom 0.2.17",
"http",
@@ -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]]
@@ -4516,7 +4522,7 @@ dependencies = [
"reqwest 0.13.4",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
@@ -4612,7 +4618,7 @@ dependencies = [
"serde",
"serde_html_form",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"url",
"web-time",
]
@@ -4640,7 +4646,7 @@ dependencies = [
"serde",
"serde_html_form",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"time",
"tracing",
"url",
@@ -4664,7 +4670,7 @@ dependencies = [
"ruma-macros",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
"web-time",
"wildmatch",
@@ -4690,7 +4696,7 @@ dependencies = [
"ruma-signatures",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
@@ -4700,7 +4706,7 @@ version = "0.12.1"
source = "git+https://github.com/ruma/ruma.git?rev=c1100793d2fd464be34052773360f3f3773d0fc4#c1100793d2fd464be34052773360f3f3773d0fc4"
dependencies = [
"js_int",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
@@ -4745,7 +4751,7 @@ dependencies = [
"ruma-events",
"serde_json",
"sha2 0.10.9",
"thiserror 2.0.19",
"thiserror 2.0.20",
]
[[package]]
@@ -4759,13 +4765,13 @@ dependencies = [
"ruma-signatures",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"tracing",
]
[[package]]
name = "ruminuwuity"
version = "26.8.0-alpha.1"
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",
@@ -5202,7 +5208,7 @@ checksum = "7bd22781911de0ca6debda95f073c8f18bec65d1a94f1fa9573f3102e514cea4"
dependencies = [
"ahash",
"annotate-snippets",
"base64 0.22.1",
"base64 0.21.7",
"encoding_rs_io",
"getrandom 0.3.4",
"granit-parser",
@@ -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",
@@ -6210,7 +6216,7 @@ dependencies = [
"rand 0.9.5",
"serde",
"serde_json",
"thiserror 2.0.19",
"thiserror 2.0.20",
"time",
"tokio",
"tracing",
@@ -6669,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]]
@@ -6873,7 +6879,7 @@ dependencies = [
[[package]]
name = "xtask"
version = "26.8.0-alpha.1"
version = "26.8.1"
dependencies = [
"askama",
"cargo_metadata",
+1 -2
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.8.0-alpha.1"
version = "26.8.1"
[workspace.metadata.crane]
name = "conduwuit"
@@ -358,7 +358,6 @@ features = [
"compat-get-3pids",
"unstable-msc2867",
"unstable-msc2870",
"unstable-msc3061",
"unstable-msc3814",
"unstable-msc3245",
"unstable-msc3381",
+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 @@
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
-1
View File
@@ -1 +0,0 @@
Added MSC4480 sticky events to simplified sliding sync. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Added scoped typing updates to simplified Sliding Sync (MSC4508). Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Replace deprecated `docker-compose` commands with `docker compose` to reflect latest Docker changes.
-1
View File
@@ -1 +0,0 @@
Fixed typing notifications not interrupting a sync long poll. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Updated Ruma dependencies. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Fixed missed wake-ups and stale responses in legacy and sliding sync long polls. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Livekit docs: `room.auto_create: false` is now included in default `livekit.yaml`, following `lk-jwt-service` recommendation.
-1
View File
@@ -1 +0,0 @@
Add caveat and workaround for container resolution (e.g. for dockerized appservices) when using mounted `/etc/resolv.conf`. Contributed by @stratself
-1
View File
@@ -1 +0,0 @@
Added MSC4354 sticky events, behind the `allow_sticky_events` config option. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Added MSC4186 direct, encrypted, and room-type list filters, resolving invited rooms from their stripped invite state. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
Fixed left/banned rooms sometimes not coming down sync.
-1
View File
@@ -1 +0,0 @@
Preserve all users' read receipts when batching room receipt updates.
@@ -1 +0,0 @@
Fixed sync loops being woken before membership changes are fully committed.
-1
View File
@@ -1 +0,0 @@
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
-1
View File
@@ -1 +0,0 @@
Updated admin command names (list-users -> list, list-rooms -> list, and reload-mods -> reload), old names are now aliases. Contributed by @PerformativeJade
-1
View File
@@ -1 +0,0 @@
Re-introduced admin room registration alerts that were accidentally removed in the OAuth2 update.
-1
View File
@@ -1 +0,0 @@
Updated the docs to reflect the current default User-Agent for URL previews
-1
View File
@@ -1 +0,0 @@
Resolve membership service by correct name for auto-join. Contributed by @Aranjedeath
-1
View File
@@ -1 +0,0 @@
Plugged a logic gap that may have been allowing Continuwuity to process events with incorrect room versions under certain conditions. Contributed by @nex.
-1
View File
@@ -1 +0,0 @@
Added missing documentation to config parameters. Contributed by @renegadespork
-1
View File
@@ -1 +0,0 @@
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.
-1
View File
@@ -1 +0,0 @@
Generic deployment documentation: Use `/etc/caddy/Caddyfile` instead of `/etc/caddy/conf.d/*` paths, which do not exist on a majority of Caddy installations.
-1
View File
@@ -1 +0,0 @@
Fixed a vulnerability that enabled the server to leak certain events over federation. Contributed by @eleboucher.
-1
View File
@@ -1 +0,0 @@
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.
+25 -12
View File
@@ -293,16 +293,6 @@
#
#stateinfo_cache_capacity = varies by system
# Determines the cache size for spacehierarchy data.
# Accepts any 32-bit integer.
#
# Each roomid contains info on its place in the space hierarchy.
# This caps the capacity of cached spacehierarchy data.
#
# This defaults to 1,000 * CPU core count.
#
#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
@@ -459,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.
#
@@ -554,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.
+107 -167
View File
@@ -1,3 +1,5 @@
import { Tab, Tabs} from '@rspress/core/theme';
# MatrixRTC/Element Call Setup
This guide assumes that you are using docker compose for deployment.
@@ -95,7 +97,7 @@ You will need to allow ports `7881/tcp` and `50100:50200/udp` through your firew
### 3. Telling clients where to find LiveKit
To tell clients where to find LiveKit, you need to add your `lk-jwt-service`'s address to the `[global.matrix_rtc] > foci` field of your Continuwuity config file.
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:
@@ -127,154 +129,88 @@ 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
}
```
**Note**: if you run Caddy inside a container (e.g. by following the example [here](../deploying/docker.mdx#caddy-using-caddyfile)) instead of on the host, then:
# for livekit
reverse_proxy 127.0.0.1:7880
}
```
- Put these containers on the same bridge network as caddy (by defining `networks: [ caddy ]` in each of the services), and
- Use appropriate container hostnames (`lk-jwt-service` and `livekit`) instead of `127.0.0.1` in the Caddyfile
</Tab>
<Tab label="Caddy (in container)">
</details>
Requires `livekit` and `lk-jwt-service` to be on the same Docker bridge network as Caddy.
<details>
<summary>Example nginx config</summary>
```ini
livekit.example.com {
```
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;
}
# 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
@@ -284,7 +220,9 @@ Start up the services using your usual method - for example `docker compose up -
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:
@@ -358,14 +296,14 @@ To debug any issues, you can place a call or redo the Testing instructions, and
### Common errors in Element Call UI
- `MISSING_MATRIX_RTC_FOCUS`/`MISSING_MATRIX_RTC_TRANSPORT`: 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
- "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:
@@ -374,29 +312,28 @@ 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 auto-discovers its public IP address(es), which is reflected 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:
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 ###
@@ -439,8 +376,8 @@ Configurations:
Specifications:
- [MSC4143 - MatrixRTC proposal][MSC4143]
- [MSC4195 - LiveKit proposal][MSC4195]
- [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
@@ -463,9 +400,9 @@ Other:
## Appendix
### Additional TURNS-over-443 configuration
### 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 are in very restrictive networks that disallows non-standard ports and UDP. In these cases, a TURN-over-TLS server on port :443 could be employed to relay traffic for them.
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
@@ -475,17 +412,19 @@ You can either use LiveKit's built-in TURN server, or integrate LiveKit with [co
<summary>Using LiveKit's built-in TURN server</summary>
First, set up LiveKit's built-in TURN server with its own domain - we'll use `livekit-turn.example.com` in our example.
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: the TLS port will always be advertised as :443
# 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 on :3478
# Optional: configure an extra UDP port
# udp_port: 3478
relay_range_start: 50300
@@ -493,13 +432,13 @@ turn:
domain: livekit-turn.example.com
# replace these with your actual cert/key files
# 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 ###
### 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"
@@ -509,7 +448,7 @@ ports:
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, we will configure a route from port 443 of the host back to our `livekit-turn.example.com` service on port 5349. To both **multiplex** this and LiveKit's websocket on the same port, we will use a layer-4 reverse proxy with **SNI routing** capabilities, such as [caddy-l4][caddy-l4] on the host system.
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 ##
@@ -522,7 +461,8 @@ Then, we will configure a route from port 443 of the host back to our `livekit-t
layer4 {
@turn tls sni livekit-turn.example.com
route @turn {
proxy 127.0.0.1:5349 # forward to normal TURNS port
# forward packages to LiveKit's TURN-over-TLS port
proxy 127.0.0.1:5349
}
}
}
@@ -531,8 +471,8 @@ Then, we will configure a route from port 443 of the host back to our `livekit-t
}
}
# livekit stuff
https://livekit.example.com {
# 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
@@ -548,7 +488,7 @@ https://livekit.example.com {
<details>
<summary>Using an external TURN server (coturn)</summary>
Before continuing, make sure coturn's `min-port` and `max-port` do not overlap with LiveKit's port range:
First, make sure coturn's `min-port` and `max-port` do not overlap with LiveKit's port range:
```ini
# in your coturn.conf
@@ -556,9 +496,9 @@ min-port=50201
max-port=65535
```
Then, 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, 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 instructions**](./turn#turns-over-443) to set up coturn with TLS, as well as multiplexing with LiveKit's websocket on port 443.
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:
@@ -573,8 +513,8 @@ rtc:
secret: "COTURN_SECRET"
```
Restart LiveKit, coturn, and Caddy-l4 to apply these changes.
Restart LiveKit, coturn, and Caddy-L4 to apply these changes.
</details>
After finishing configuration, you can run the Testing steps again to check that TURN-over-TLS is working. In the LiveKit connection test page, there should be a green tick saying "Can connect to TURN".
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.
+27 -27
View File
@@ -1,8 +1,8 @@
# Setting up TURN/STUN
[TURN][turn] and [STUN][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][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.
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.
:::tip
You can find help setting up TURN/STUN in our MatrixRTC room - [#matrixrtc:continuwuity.org](https://matrix.to/#/%23matrixrtc%3Acontinuwuity.org)
@@ -12,13 +12,13 @@ You can find help setting up TURN/STUN in our MatrixRTC room - [#matrixrtc:conti
[stun]: https://en.wikipedia.org/wiki/STUN
[coturn]: https://github.com/coturn/coturn
## Installing Coturn
## Installing coturn
### 1. Domain
### 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.
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. Configuration
### 2. Configuring coturn
Create a configuration file called `coturn.conf` containing:
@@ -34,14 +34,14 @@ pwgen -s 64 1
```
:::
If you want to enable TURN-over-TLS (TURNS), add the appropriate cert/key paths to your `coturn.conf` by adding the following lines:
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 are readable by the coturn user.
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.
@@ -49,7 +49,7 @@ Check out the [`turnserver.conf`][turnserver-conf] example for all coturn option
### 3. Running the coturn container
Next, we will start the Coturn container with the [official image][coturn-image]. **Host networking mode** will be used, as it is better for performance and reduces configuration complexity (see [Coturn Docker docs][coturn-docker-docs] for rationale).
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
@@ -57,7 +57,6 @@ Next, we will start the Coturn container with the [official image][coturn-image]
Create a `docker-compose.yml` file as follows and run `docker compose up -d`:
```yaml
version: '3'
services:
coturn:
container_name: coturn
@@ -87,7 +86,7 @@ ufw allow 5349/udp
ufw allow 49152-65535/udp
```
::: tip For LiveKit users
:::tip For LiveKit users
If you're also running LiveKit, you'll need configure non-overlapping port ranges to avoid port conflicts:
@@ -108,8 +107,7 @@ This leaves ports `50100-50200` available for LiveKit's default configuration.
### 5. Security Recommendations
For Coturn hardening and security best practices, see Synapse's [Coturn documentation][synapse-coturn-guide],
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
@@ -142,7 +140,9 @@ Restart Continuwuity, and the new changes should now be applied.
### Testing Credentials
Get 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).
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:
@@ -172,7 +172,7 @@ Open the [Trickle ICE][trickle-ice] testing page in a browser and then:
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. When finished adding all URIs and credentials, click "Gather candidates"
3. Once all the URIs and credentials have been added, click "Gather candidates"
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.
@@ -180,7 +180,7 @@ If you see `relay` candidates in the results, your TURN/STUN server is working c
## Troubleshooting
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`.
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`.
### Errors with Trickle ICE
@@ -192,7 +192,7 @@ To gather debug logs while troubleshooting Coturn, add `verbose` to your `coturn
- 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, due to particular network setups. You can configure `external-ip=<desired-public-ip>` to fix this issue.
- 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.
### 404 when calling the turnServer endpoint
@@ -203,10 +203,10 @@ This is the correct response when no TURN servers are configured, as per [MSC416
## Related Documentation
- [MatrixRTC/LiveKit Setup](./livekit.mdx) - Configure group calling with LiveKit
- [Coturn GitHub][coturn] - Official coturn repository
- [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 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
@@ -223,13 +223,13 @@ If you instead prefer to use [eturnal][eturnal], you can refer to the guides bel
[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
### TURNS-over-443
### TURN-over-TLS on 443
Normally, TURN would work on their default setups. However, there are situations where clients are in very restrictive networks that disallows non-standard ports and UDP. In these cases, a TURN-over-TLS server on port :443 could be employed to relay traffic for them.
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 utilized by other HTTPS services. Therefore, one would need to **multiplex** both TURN HTTPS on these ports, and filter packets to them via **SNI routing**.
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.
Below are examples to multiplex coturn and [LiveKit](./livekit.mdx) on port 443, using [Caddy-L4][caddy-l4] on the host system.
<details>
@@ -237,10 +237,10 @@ Below are examples to multiplex Coturn and [LiveKit](./livekit.mdx) on port 443,
This Caddyfile:
- Route `turn.example.com` to the TURNS port for Coturn without TLS termination, and
- 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.
Please note that all traffic from coturn's perspective will be coming from Caddy-L4's IP now.
```
{
@@ -302,7 +302,7 @@ Then, in the Caddyfile:
# intercept packets meant for the TURN domain first
# before forwarding other packets to "normal" HTTP listeners
layer4 {
@turn tlssni turn.example.com
@turn tls sni turn.example.com
route @turn {
tls # terminate TLS for the turn.example.com packets
@@ -337,7 +337,7 @@ https://turn.example.com {
</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-turns-over-443-configuration).
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
@@ -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;
}
}
@@ -9,7 +9,7 @@ services:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
- CADDY_INGRESS_NETWORKS=proxy
networks:
- proxy
volumes:
+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)]
+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));
+46 -5
View File
@@ -70,6 +70,20 @@ type KnownRoomUpdates = BTreeMap<String, BTreeSet<OwnedRoomId>>;
/// Default and maximum number of sticky events returned per response.
const DEFAULT_STICKY_LIMIT: usize = 100;
fn num_live_events<'a>(
counts: impl DoubleEndedIterator<Item = &'a PduCount>,
globalsince: u64,
) -> usize {
if globalsince == 0 {
return 0;
}
counts
.rev()
.take_while(|count| matches!(count, PduCount::Normal(count) if *count > globalsince))
.count()
}
struct SyncCollection {
response: sync_events::v5::Response,
known_room_updates: KnownRoomUpdates,
@@ -314,6 +328,7 @@ async fn collect_sync_response(
response.rooms = process_rooms(
services,
sender_user,
globalsince,
next_batch,
all_invited_rooms.clone(),
all_knocked_rooms.clone(),
@@ -697,6 +712,7 @@ fn matches_room_type(
async fn process_rooms<'a, Rooms>(
services: &Services,
sender_user: &UserId,
globalsince: u64,
next_batch: u64,
all_invited_rooms: Rooms,
all_knocked_rooms: Rooms,
@@ -899,17 +915,16 @@ where
let required_state =
collect_required_state(services, room_id, required_state_request).await;
let room_events: Vec<_> = timeline_pdus
let timeline_pdus: Vec<_> = timeline_pdus
.iter()
.stream()
.filter_map(|item| ignored_filter(services, item.clone(), sender_user))
.map(at!(1))
.map(Event::into_format)
.collect()
.await;
let num_live = num_live_events(timeline_pdus.iter().map(|(count, _)| count), globalsince);
timeline_event_ids.extend(timeline_pdus.iter().map(|(_, pdu)| pdu.event_id.clone()));
for (_, pdu) in timeline_pdus {
for (_, pdu) in &timeline_pdus {
let ts = pdu.origin_server_ts;
if DEFAULT_BUMP_TYPES.binary_search(&pdu.kind).is_ok()
&& timestamp.is_none_or(|time| time <= ts)
@@ -917,6 +932,11 @@ where
timestamp = Some(ts);
}
}
let room_events = timeline_pdus
.into_iter()
.map(at!(1))
.map(Event::into_format)
.collect();
// Heroes
let heroes: Vec<_> = services
@@ -1036,7 +1056,7 @@ where
.try_into()
.unwrap_or_else(|_| uint!(0)),
),
num_live: None, // Count events in timeline greater than global sync counter
num_live: Some(ruma_from_usize(num_live)),
bump_stamp: timestamp,
heroes: Some(heroes),
}),
@@ -1772,4 +1792,25 @@ mod tests {
assert!(response_is_empty(&response));
}
#[test]
fn num_live_events_counts_the_new_normal_suffix() {
let counts = [
PduCount::Backfilled(-2),
PduCount::Normal(8),
PduCount::Normal(11),
PduCount::Normal(12),
];
assert_eq!(num_live_events(counts.iter(), 0), 0);
assert_eq!(num_live_events(counts.iter(), 10), 2);
assert_eq!(num_live_events(counts.iter(), 12), 0);
}
#[test]
fn num_live_events_stops_at_history() {
let counts = [PduCount::Normal(11), PduCount::Normal(9), PduCount::Normal(12)];
assert_eq!(num_live_events(counts.iter(), 10), 1);
}
}
+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) =>
+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(
+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(
+35 -17
View File
@@ -379,18 +379,6 @@ pub struct Config {
#[serde(default = "default_stateinfo_cache_capacity")]
pub stateinfo_cache_capacity: u32,
/// Determines the cache size for spacehierarchy data.
/// Accepts any 32-bit integer.
///
/// Each roomid contains info on its place in the space hierarchy.
/// This caps the capacity of cached spacehierarchy data.
///
/// This defaults to 1,000 * CPU core count.
///
/// 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
@@ -567,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.
///
@@ -694,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,
@@ -2805,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",
@@ -2934,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 }
@@ -2980,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 }
@@ -2996,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 }
+4
View File
@@ -287,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 }
}
+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")]
+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 = [
+30 -3
View File
@@ -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"))
},
}
}
@@ -237,7 +256,15 @@ impl super::Service {
parts,
body.as_ref(),
))
.map_err(|e| err!(BadServerResponse("Server returned bad 200 response: {e:?}")))
.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:?}"))
})
}
}
+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()
}
}
@@ -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"),
@@ -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(())
}
+46 -17
View File
@@ -17,7 +17,7 @@ use ruma::{
StateEventType,
space::child::{HierarchySpaceChildEvent, SpaceChildEventContent},
},
room::{JoinRuleSummary, RestrictedSummary, RoomSummary},
room::{JoinRuleSummary, RestrictedSummary, RoomSummary, RoomType},
serde::Raw,
};
@@ -124,7 +124,7 @@ impl Service {
via: Option<&[OwnedServerName]>,
suggested_only: bool,
) -> Result<Accessibility<SpaceSummaryAndChildren>> {
let (summary, inaccessible_children) = {
let (mut summary, inaccessible_children) = {
if let Some(summary) = self.build_local_room_summary(room_id).await {
// We have this room locally.
let children_state = self.get_space_child_events(room_id).await;
@@ -159,15 +159,27 @@ impl Service {
return Ok(Accessibility::Inaccessible);
}
let children = summary
if !matches!(summary.summary.room_type.as_ref(), Some(RoomType::Space)) {
summary.children_state.clear();
}
let mut children: Vec<_> = summary
.children_state
.iter()
// Ignore deserialization failures
.flat_map(Raw::deserialize)
// Filter out non-suggested children if suggested_only is set
.filter(|child| !suggested_only || child.content.suggested)
.map(|child| SpaceChild { room_id: child.state_key, via: child.content.via })
.collect();
.collect();
children.sort();
let children = children
.into_iter()
.rev()
.map(|child| SpaceChild {
room_id: child.state_key,
via: child.content.via,
})
.collect();
Ok(Accessibility::Accessible(SpaceSummaryAndChildren {
summary,
@@ -223,6 +235,13 @@ impl Service {
continue;
};
// The root room is at depth zero, so the current layer is the depth of
// the child about to be processed.
let depth = u64::try_from(queue.len()).expect("hierarchy depth should fit into u64");
if max_depth.is_some_and(|max_depth| depth > max_depth.into()) {
continue;
}
// Do not request rooms which have been determined to be inaccessible
if inaccessible_children.contains(&room_id) {
continue;
@@ -261,17 +280,6 @@ impl Service {
summaries.push(summary.summary);
inaccessible_children.extend(summary.inaccessible_children);
// Don't traverse the tree deeper than max_depth
#[allow(
clippy::as_conversions,
clippy::arithmetic_side_effects,
reason = "queue.len() should never be large enough to cause strange behavior \
here"
)]
if max_depth.is_some_and(|max_depth| (queue.len() as u64 + 1) > max_depth.into()) {
continue;
}
// Bail out if queue length exceeds 50 to keep cycles in the space graph from
// blowing up the traversal. If you actually have over fifty nested spaces,
// and you're looking at this function to figure out what the issue is, I
@@ -306,7 +314,11 @@ impl Service {
return Accessibility::Inaccessible;
}
let children_state = self.get_space_child_events(room_id).await;
let children_state = if matches!(summary.room_type.as_ref(), Some(RoomType::Space)) {
self.get_space_child_events(room_id).await
} else {
vec![]
};
let (accessible_children, inaccessible_children) = children_state
.iter()
@@ -598,6 +610,23 @@ impl Service {
return true;
}
// For restricted rooms, federation responses must include the summary when
// a user on the querying server can satisfy one of the join conditions.
if let JoinRuleSummary::Restricted(RestrictedSummary { allowed_room_ids, .. }) =
&summary.join_rule
{
for room_id in allowed_room_ids {
if self
.services
.state_cache
.server_in_room(querying_server, room_id)
.await
{
return true;
}
}
}
// If the server isn't in the room, the same visibility rules apply as for
// anonymous summary requests.
self.user_may_see_summary(None, summary).await
+72 -22
View File
@@ -1,12 +1,14 @@
use std::{
borrow::Borrow,
collections::{BTreeMap, HashMap, HashSet},
collections::{BTreeMap, HashMap, HashSet, VecDeque},
iter::once,
ops::Not,
sync::Arc,
time::Instant,
};
use conduwuit::{
Result, debug, debug_warn, is_equal_to,
Err, Result, debug, debug_warn,
matrix::{Event, PduEvent},
pdu::{Count, ShortRoomId},
trace,
@@ -164,7 +166,7 @@ impl super::Service {
incoming_pdu: &PduEvent,
room_version_rules: &RoomVersionRules,
state_before: HashMap<u64, OwnedEventId>,
forward_extremities: Vec<OwnedEventId>,
current_extremities: Vec<OwnedEventId>,
state_lock: &Guard<OwnedRoomId, ()>,
) -> Result<Vec<OwnedEventId>> {
if incoming_pdu.state_key().is_some() {
@@ -173,35 +175,83 @@ impl super::Service {
.await?;
}
// Now we calculate the set of extremities this room has after the incoming
// event has been applied. We start with the previous extremities
let start = Instant::now();
trace!("Calculating extremities");
let mut forward_extremities = forward_extremities
// Start with the current extremity set, to avoid dropping unreferenced events.
let mut new_extremities: HashSet<OwnedEventId> =
current_extremities.into_iter().collect();
// Add the incoming event
new_extremities.insert(incoming_pdu.event_id().to_owned());
// Remove any extremities that have since been referenced but not removed(?)
new_extremities = new_extremities
.into_iter()
.stream()
.ready_filter(|event_id| {
// Remove any that are referenced by this incoming event's prev_events
!incoming_pdu.prev_events().any(is_equal_to!(event_id))
})
.broad_filter_map(|event_id| async move {
// Only keep those extremities were not referenced yet
.broad_filter_map(|extremity| async {
self.services
.pdu_metadata
.is_event_referenced(&incoming_pdu.room_id_or_hash(), &event_id)
.is_event_referenced(&incoming_pdu.room_id_or_hash(), &extremity)
.await
.eq(&false)
.then_some(event_id)
.not()
.then_some(extremity)
})
.collect::<Vec<_>>()
.collect()
.await;
forward_extremities.push(incoming_pdu.event_id().to_owned());
// Also iteratively walk prev events to ensure we drop any ancestors which are
// referenced regardless of soft-fail or rejection status. Soft-failed events
// and rejected events are not added as forward extremities, and as such do not
// remove their own prevs from the extremity set. This can lead to a situation
// where extremities build up because there's lots of soft-fails in the room,
// ultimately resulting in excessive cross-state boundary dummy events being
// created to squash the references. By walking the prevs until we stop
// reaching soft-fails, we can ensure that we properly prune all events which
// have actually been referenced, regardless of their soft-fail or rejection
// status.
let mut ancestors_todo: VecDeque<OwnedEventId> =
VecDeque::from_iter(incoming_pdu.prev_events.clone());
let room_id = incoming_pdu.room_id_or_hash();
while let Some(prev_event_id) = ancestors_todo.pop_front() {
new_extremities.remove(&prev_event_id);
self.services
.pdu_metadata
.mark_as_referenced(&room_id, once(prev_event_id.as_ref()));
let Ok(prev_event) = self.get_pdu(&prev_event_id).await else {
continue;
};
// Only retain prevs which are themselves not referenced AND
// soft-failed/rejected/outlier.
let outlier_prevs = prev_event
.prev_events()
.map(ToOwned::to_owned)
.stream()
.broad_filter_map(|prev_id| async {
let (referenced, is_outlier, is_soft_failed, is_rejected) = tokio::join!(
self.services
.pdu_metadata
.is_event_referenced(&room_id, &prev_id),
self.db.outlier_pdu_exists(&prev_id).is_ok(),
self.services.pdu_metadata.is_event_soft_failed(&prev_id),
self.services.pdu_metadata.is_event_rejected(&prev_id)
);
(!referenced && (is_outlier || is_soft_failed || is_rejected))
.then_some(prev_id)
})
.collect::<Vec<_>>()
.await;
ancestors_todo.extend(outlier_prevs);
}
debug!(
"Retained {} extremities checked against {} prev_events",
forward_extremities.len(),
incoming_pdu.prev_events().count()
"Retained {} extremities against {} prev_events in {:?}",
new_extremities.len(),
incoming_pdu.prev_events().count(),
start.elapsed(),
);
assert!(!forward_extremities.is_empty(), "resolved extremities cannot be empty");
Ok(forward_extremities)
if new_extremities.is_empty() {
Err!("Resolved extremity set was empty after processing incoming event")
} else {
Ok(new_extremities.into_iter().collect())
}
}
/// Derives a new room state by adding the incoming PDU to the state before
+6
View File
@@ -213,6 +213,12 @@ impl super::Service {
drop(insert_lock);
// Backfilled events skip append_pdu, so this is the only place their
// prev_events can be marked as referenced. See issue #2115.
self.services
.pdu_metadata
.mark_as_referenced(&room_id, pdu.prev_events().map(AsRef::as_ref));
if pdu.kind == TimelineEventType::RoomMessage {
let content: ExtractBody = pdu.get_content()?;
if let Some(body) = content.body {
+17 -4
View File
@@ -8,7 +8,7 @@ use conduwuit_core::{
};
use futures::{FutureExt, StreamExt};
use ruma::{
OwnedEventId, OwnedServerName, RoomId, UserId,
EventId, OwnedEventId, OwnedServerName, RoomId, UserId,
events::{
TimelineEventType,
room::{
@@ -112,14 +112,27 @@ impl super::Service {
let statehashid = self.services.state.append_to_state(&pdu, &room_id).await?;
trace!("State hash ID for {room_id}: {statehashid:?}");
// prev_events is capped at the room version's limit, so this PDU does not
// necessarily reference every extremity. Any it did not reference is still a
// head of the DAG and has to be kept.
let prev_events: HashSet<&EventId> = pdu.prev_events().collect();
let unreferenced: Vec<OwnedEventId> = self
.services
.state
.get_forward_extremities(&room_id)
.ready_filter(|extremity| !prev_events.contains(&**extremity))
.collect()
.await;
trace!("Generating raw ID for PDU {}", pdu.event_id());
let pdu_id = self
.append_pdu(
&pdu,
pdu_json,
// Since this PDU references all pdu_leaves we can update the leaves
// of the room
once(pdu.event_id()),
unreferenced
.iter()
.map(AsRef::as_ref)
.chain(once(pdu.event_id())),
state_lock,
&room_id,
)
+3 -3
View File
@@ -132,11 +132,11 @@ impl crate::Service for Service {
while let Some(ret) = senders.join_next_with_id().await {
match ret {
| Ok((id, _)) => {
debug!(?id, "sender worker finished");
| Ok((id, error)) => {
debug!(?id, ?error, "sender worker finished");
},
| Err(error) => {
error!(id = ?error.id(), ?error, "sender worker finished");
error!(id = ?error.id(), ?error, "sender worker failed");
},
}
}
+80 -21
View File
@@ -9,15 +9,13 @@ use std::{
};
use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD};
use conduwuit::{
debug_info, debug_warn, info, utils::time::exponential_backoff::min_exp_backoff_duration,
};
use conduwuit::{debug_info, debug_warn, info, trace};
use conduwuit_core::{
Error, Event, Result, at, debug, err, error,
matrix::pdu::sticky,
result::LogErr,
utils::{
ReadyExt, calculate_hash, continue_exponential_backoff_secs,
ReadyExt, calculate_hash,
future::TryExtExt,
stream::{BroadbandExt, IterStream, WidebandExt},
},
@@ -29,6 +27,7 @@ use futures::{
join, pin_mut,
stream::FuturesUnordered,
};
use http::StatusCode;
use ruma::{
CanonicalJsonObject, MilliSecondsSinceUnixEpoch, OwnedRoomId, OwnedServerName, OwnedUserId,
RoomId, ServerName, UInt,
@@ -142,20 +141,37 @@ impl Service {
) {
match response {
| Ok(dest) => self.handle_response_ok(&dest, futures, statuses).await,
| Err((dest, e)) => Self::handle_response_err(dest, statuses, &e),
| Err((dest, e)) => {
if let Destination::Federation(dest) = &dest {
if self.services.federation.should_mark_stale(&e)
|| e.status_code() == StatusCode::NOT_FOUND
{
debug!("{dest} is now unhealthy & stale due to a connect error: {e:?}");
self.services.federation.mark_destination_stale(dest);
self.services.federation.hit_unhealthy(dest.clone());
} else if e.status_code() != StatusCode::OK {
debug!("{dest} is now unhealthy due to error response: {e:?}");
self.services.federation.hit_unhealthy(dest.clone());
}
}
Self::handle_response_err(dest, statuses, &e);
},
}
}
/// Handles a response error, incrementing the backoff factor.
fn handle_response_err(dest: Destination, statuses: &mut CurTransactionStatus, e: &Error) {
debug!(dest = ?dest, "{e:?}");
fn handle_response_err(dest: Destination, statuses: &mut CurTransactionStatus, er: &Error) {
debug!(dest = ?dest, "{er:?}");
let dest2 = dest.clone();
statuses.entry(dest).and_modify(|e| {
*e = match e {
| TransactionStatus::Running => TransactionStatus::Failed(1, Instant::now()),
| &mut TransactionStatus::Retrying(ref n) =>
TransactionStatus::Failed(n.saturating_add(1), Instant::now()),
| TransactionStatus::Failed(..) => {
panic!("Request that was not even running failed?!")
panic!(
"Request to {dest2:?} that was not even running ({e:?}) failed: {er:?}"
)
},
}
});
@@ -171,6 +187,9 @@ impl Service {
) {
let _cork = self.db.db.cork();
self.db.delete_all_active_requests_for(dest).await;
if let Destination::Federation(server_name) = dest {
self.services.federation.mark_healthy(server_name);
}
// Find events that have been added since starting the last request
let new_events = self
@@ -203,12 +222,22 @@ impl Service {
statuses: &mut CurTransactionStatus,
) {
let iv = vec![(msg.queue_id, msg.event)];
if let Ok(Some(events)) = self.select_events(&msg.dest, iv, statuses).await {
if !events.is_empty() {
futures.push(self.send_events(msg.dest, events));
} else {
statuses.remove(&msg.dest);
}
match self.select_events(&msg.dest, iv, statuses).await {
| Ok(Some(events)) => {
if events.is_empty() {
// Nothing more to send to this remote
statuses.remove(&msg.dest);
} else {
futures.push(self.send_events(msg.dest, events));
}
},
| Ok(None) => {
trace!(
?msg.dest,
"Ignoring request to send to destination (nothing to send/already busy)"
);
},
| Err(e) => error!(error=?e, ?msg.dest, "Failed to select events"),
}
}
@@ -383,17 +412,43 @@ impl Service {
statuses: &mut CurTransactionStatus,
) -> Result<(bool, bool)> {
let (mut allow, mut retry) = (true, false);
if let Destination::Federation(server_name) = dest {
if let Some(retry_after) = self.services.federation.retry_after(server_name) {
allow = retry_after.is_zero();
}
statuses
.entry(dest.clone())
.and_modify(|e| match e {
| TransactionStatus::Running | TransactionStatus::Retrying(_) => {
allow = false; // already running
trace!("Transaction is already running for {dest:?}");
},
| TransactionStatus::Failed(tries, _) => {
if allow {
*e = TransactionStatus::Retrying(*tries);
trace!(
"Previous transaction failed for {dest:?} ({e:?}), will retry"
);
}
retry = true;
},
})
.or_insert_with(|| {
trace!("Inserting running status for {dest:?}");
TransactionStatus::Running
});
return Ok((allow, retry));
}
// Legacy backoff tracking for non-server remotes
statuses
.entry(dest.clone())
.and_modify(|e| match e {
| TransactionStatus::Failed(tries, time) => {
// Fail if a request has failed recently (exponential backoff)
let min = self.server.config.sender_timeout;
let max = self.server.config.sender_retry_backoff_limit;
if continue_exponential_backoff_secs(min, max, time.elapsed(), *tries)
&& !matches!(dest, Destination::Appservice(_))
{
let retry_after = min_exp_backoff_duration(min, max, *tries);
let min = Duration::from_secs(self.server.config.sender_retry_backoff_base);
let max = Duration::from_secs(self.server.config.sender_retry_backoff_limit);
let retry_after = min.saturating_mul(*tries).min(max);
if time.elapsed() < retry_after {
debug_warn!("Not retrying destination for another {retry_after:?}");
allow = false;
} else {
@@ -446,6 +501,8 @@ impl Service {
events.extend(presence.into_iter().flatten());
events.extend(receipts.into_iter().flatten());
// TODO(nex): some EDUs like typing need flattening
Ok((events, max_edu_count.load(Ordering::Acquire)))
}
@@ -902,6 +959,7 @@ impl Service {
%txn_id,
pdus=pdu_count,
edus=edu_count,
%server,
"Sending transaction to remote"
);
let start = Instant::now();
@@ -915,6 +973,7 @@ impl Service {
pdus=pdu_count,
edus=edu_count,
elapsed=?start.elapsed(),
%server,
"Finished sending transaction"
);
+2
View File
@@ -32,12 +32,14 @@ pub enum TransactionError {
/// Server is shutting down - the sender should retry the entire
/// transaction.
ShuttingDown,
Unexpected,
}
impl fmt::Display for TransactionError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
| Self::ShuttingDown => write!(f, "Server is shutting down"),
| Self::Unexpected => write!(f, "Unhandled internal server error"),
}
}
}
+1 -8
View File
@@ -7,7 +7,7 @@ use axum::{
routing::{get, on},
};
use conduwuit_api::client_ip::ClientIp;
use conduwuit_core::{config::TermsDocument, info, warn};
use conduwuit_core::{config::TermsDocument, warn};
use conduwuit_service::{
mailer::messages,
registration_tokens::ValidToken,
@@ -536,13 +536,6 @@ async fn complete_registration(
.mark_token_as_used(registration_token);
}
let notice = format!("New user \"{user_id}\" registered on this server from IP {client}.");
info!("{notice}");
if services.server.config.admin_room_notices {
services.admin.notice(&notice).await;
}
let user_session = UserSession { user_id, last_login: SystemTime::now() };
session_store