Compare commits

...
Author SHA1 Message Date
timedout c95f3afc85 fix: Work around MSC4484 lockout when disabled 2026-11-15 15:44:13 +00:00
timedout 66a30abff8 chore: Add changelog 2026-11-15 14:18:47 +00:00
timedout 42fedc55dc chore: Regenerate config reference 2026-11-15 14:15:24 +00:00
timedout 557f64a9bc fix: Don't unconditionally advertise MSC4174 as enabled in capabilities 2026-11-15 14:13:30 +00:00
timedout 00dd16e7df fix: Gate MSC4406 behind an experiment 2026-11-15 14:11:22 +00:00
timedout 3f15d2c9ef fix: Add an experiment for MSC3814
This proposal is still itself a draft, not even ready for review, so we definitely shouldn't enable it by default per the policy.
2026-11-15 14:00:09 +00:00
timedout 1fd01cf4d9 fix: Actually config-gate MSC4560 support 2026-11-15 13:46:25 +00:00
timedout 5489688420 fix: Actually config-gate MSC4484 support 2026-11-15 13:16:21 +00:00
timedout d7e9e68008 fix: Actually config-gate MSC4174 support 2026-11-15 12:48:05 +00:00
timedout 4ebbfb719f fix: Actually config-gate MSC4155 support 2026-11-15 12:23:05 +00:00
Jade Ellis 6e7ebe66c9 docs: Fix changelog 2026-11-14 23:09:44 +00:00
Jade Ellis 24e962a656 chore: Release 2026-11-14 21:14:00 +00:00
Jade EllisandHenry-Hiles c5cd82a6a3 fix: SEC45
Co-authored-by: Henry-Hiles <henry@henryhiles.com>
2026-11-14 20:12:45 +00:00
theS1LV3R add66bd0b7 chore: Update resolvematrix to 1.4.2 2026-11-14 18:43:41 +00:00
theS1LV3R 700c11d758 docs: Disable even more llm stuff
fuck off LLM bullshit

ew x3
2026-11-14 14:36:46 +01:00
theS1LV3R 559f76908e docs: Disable webMcp
ew x2
2026-11-14 14:28:16 +01:00
theS1LV3R 7ade8c4899 docs: Disable LLM buttons in documentation
ew
2026-11-14 14:22:11 +01:00
timedout 20943c6210 docs: Explain everything that was mentioned in 1884 2026-11-14 13:03:16 +00:00
timedout 4811ad831d feat: Call out experiments and staleness in the config reference 2026-11-14 13:03:16 +00:00
Henry-Hiles bfb611d9e4 fix(config): Include experiments in the generated example config 2026-11-14 13:03:16 +00:00
timedout d4c6decdd6 feat: Theoretically add experiments to the config reference
For some reason it doesn't *actually* embed. I'm not too sure how the config generator works, so maybe im just missing something.
2026-11-14 13:03:16 +00:00
timedout 82e42696aa chore: Fix display for experiments 2026-11-14 13:03:16 +00:00
timedout f6c9b53e17 chore: Update reference config file 2026-11-14 13:03:16 +00:00
timedout 39035d735e refactor: Configuration-gate experiments 2026-11-14 13:03:16 +00:00
Niklas Wojtkowiak b34dfe343a docs(changelog): Add fragment for createRoom bad JSON fix 2026-11-14 00:22:45 -09:00
Niklas Wojtkowiak 26ec038418 fix(client): Return 400, not 500, for non-canonical createRoom 2026-11-14 00:20:01 -09:00
Erwan Leboucher 7afe5885e9 feat(media): Remove legacy unauthenticated media support 2026-11-13 21:24:34 +00:00
Erwan Leboucher 77e8a6b41b fix(membership): Return the local join error when there are no remote servers to try 2026-11-13 16:57:29 +01:00
Erwan Leboucher 4ebcf299e2 fix: Refetch OIDC signing keys on unknown key id 2026-11-13 06:22:35 +00:00
Erwan Leboucher c72156cb04 fix: Keep one account data entry per type when updates race
Signed-off-by: Erwan Leboucher <erwanleboucher@gmail.com>
2026-11-13 06:21:54 +00:00
ginger b5594c3061 fix: I am god's most intelligent catgirl 2026-11-13 03:35:10 +00:00
ginger ae0a2d1797 Return 404 instead of 403 for summaries of missing rooms 2026-11-13 03:32:50 +00:00
theS1LV3R 5d0dc8b137 chore: Update variable name, improve doc comment 2026-11-12 14:26:17 +00:00
theS1LV3R 4d271a5621 chore: stupid fucking rustrover 2026-11-12 14:26:17 +00:00
theS1LV3R 23a51bcf96 fix: Set initial backoff time to 90 days immediately
As per the MSC:
> This MSC recommends homeservers should wait a minimum of 24 hours
> and should wait no longer than 90 days, balancing the need to respect
> the server's intent to be offline whilst allowing for potential future
> changes in server operation or domain ownership.

And as per nex:
> Technically the MSC said it should be up to 90 days, but they'll never
> make me parse cache-control!
2026-11-12 14:26:17 +00:00
theS1LV3R 326348ec1a chore: Changelog 2026-11-12 14:26:17 +00:00
theS1LV3R 4f63edac33 feat: Support marking servers as unhealthy+stale during resolution
For when the server resolution process returns an error or Gone
2026-11-12 14:26:17 +00:00
theS1LV3R 79a2cbc7be chore: Enable unstable-msc4188 in resolvematrix 2026-11-12 14:26:17 +00:00
Renovate Bot c8d87b3a0d chore(deps): update dependency cargo-bins/cargo-binstall to v1.27.0 2026-11-12 14:24:16 +00:00
Renovate Bot 49171ec1ed chore(deps): update node-patch-updates to v2.1.2 2026-11-12 05:03:29 +00:00
Erwan Leboucher ea3beb628a chore: regenerate env 2026-11-11 23:34:51 +01:00
Erwan Leboucher 8603ae21cc fix: Address redacted content review nitpicks 2026-11-11 21:52:50 +00:00
Erwan Leboucher f154ecb542 feat: Expire retained unredacted content and address review 2026-11-11 21:52:50 +00:00
Erwan Leboucher 98fe280de4 feat: Allow room moderators to view redacted event content (MSC2815) 2026-11-11 21:52:50 +00:00
Erwan Leboucher 2c605151eb fix: Don't apply get_missing_events limit to earliest_events 2026-11-11 21:51:52 +00:00
timedout 4bd09a6d88 fix: Find some zen
Non-successful media responses get the `application/json` treatment, and the content-type is lowercased for case-insensitive matching, per RFC something or other I forgot already
2026-11-11 21:42:37 +00:00
timedout cb37a9cf0b feat: Assert content type on federation responses 2026-11-11 21:42:37 +00:00
Erwan Leboucher aefededfc8 test: Skip system CA roots in state_at_incoming test services 2026-11-11 21:31:39 +00:00
Erwan Leboucher 9be45212f1 fix: Don't require resolv.conf when dns_servers is configured 2026-11-11 21:31:39 +00:00
theS1LV3R fca19a983d chore: Update resolvematrix to 1.4.1
Also includes other updates cuz thats what cargo does
2026-11-11 18:26:25 +01:00
Renovate Bot 4ebf44412c chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.227.4 2026-11-11 14:31:22 +00:00
Renovate Bot cacf6ff912 chore(deps): update rust crate syn to v3.0.10 2026-11-11 14:30:59 +00:00
Henry-Hiles aef031c9d7 fix(sync): Give each sliding sync response its own pos 2026-11-11 14:28:43 +00:00
Henry-Hiles 7b927196a2 chore: Use up-to-date Ruma
Some changes to sticky events were needed for this also.
2026-11-11 14:28:43 +00:00
Renovate Bot 93173313ea chore(deps): update pre-commit hook crate-ci/typos to v1.52.2 2026-11-11 05:08:21 +00:00
Jade Ellis 38fb7897bb chore: Release 2026-11-10 23:23:41 +00:00
stratself ba0ea752a9 docs(generic): Recommend the MTRNord tester 2026-11-10 23:12:53 +00:00
stratself c7c54f880a docs(arch): Link to AUR/archlinuxcn instructions 2026-11-10 23:12:53 +00:00
stratself c65eb6de91 docs(push): Update some things (see commit comments)
* Make "gateway discovery" test from both client and server
* Add docker caveat to locally-hosted push components
* Edit a name to match author
2026-11-10 23:12:53 +00:00
stratself 596f269a90 docs(performance): Update trusted servers tuning info 2026-11-10 23:12:53 +00:00
stratself 49ebbcc63e fix(docs): Don't say "check Maintenance for Maintenance" 2026-11-10 23:12:53 +00:00
stratself 7241150204 docs(arch-linux): Add some wordings
Ideally want the installation commands here, but will leave for a future
commit
2026-11-10 23:12:53 +00:00
stratself c66a863bb2 docs(kubernetes): Small wording improvements and postinstall section 2026-11-10 23:12:53 +00:00
stratself 6dbe40238d docs(nixos): Beautify nix a bit
* Add well-known config example to nixfile
* Add postinstall redirect section
2026-11-10 23:12:53 +00:00
stratself 77bc7476f3 docs(auth): Reword registration defaults 2026-11-10 23:12:53 +00:00
stratself 94270e732c docs(livekit): Address review comments, add note for EC's dev mode 2026-11-10 23:00:08 +00:00
stratself 0bc55cb590 docs(livekit): Use "MatrixRTC" phrasing in lieu of "Element Call"
The calling protocol matters not the client product
2026-11-10 23:00:08 +00:00
stratself 0375643ade docs(livekit): Add stun_servers to TURN instructions too 2026-11-10 23:00:08 +00:00
stratself c67f08a208 docs(livekit): Add appendix sectionon creating livekit tokens via livekit-cli 2026-11-10 23:00:08 +00:00
stratself fb3113ea69 docs(livekit): Add appendix section on calling modes 2026-11-10 23:00:08 +00:00
stratself 6f6fba4310 docs(livekit): Pin token exchange flow link to jwt-svc 0.6.0 2026-11-10 23:00:08 +00:00
stratself 9ace03c107 docs(livekit): Add more relevant MSCs 2026-11-10 23:00:08 +00:00
stratself 304bf69c32 docs(livekit): Add LiveKit advertised IP addresses restrictions 2026-11-10 23:00:08 +00:00
stratself 2173577bac docs(livekit): Update Element Call UI errors 2026-11-10 23:00:08 +00:00
stratself bbf3bd1294 docs(calls): Small fixup of wordings
* Use indirect links and fix them
* Make Livekit's TURN configuration optional
2026-11-10 23:00:08 +00:00
stratself dd11fc5a25 docs(livekit): Remove workaround for non-federating servers
Fixed by #2326
2026-11-10 23:00:08 +00:00
stratself f1798c004a docs(calls): Redirect to support room 2026-11-10 23:00:08 +00:00
Erwan Leboucher b570420b9f fix: preserve predecessors sharing a state-before ID
Signed-off-by: Erwan Leboucher <erwanleboucher@gmail.com>
2026-11-10 23:56:33 +01:00
timedout 0a52421b65 fix: Re-introduce edge reference tracking 2026-11-10 21:18:13 +00:00
Jade Ellis 79b49134f4 fix: Correct conflict in patch 2026-11-10 21:01:48 +00:00
timedout 4a721dad07 fix: SEC15
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 20:42:04 +00:00
timedout 3abb32dd75 fix: SEC31
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 20:41:38 +00:00
timedout 7a6bea70b2 fix: SEC34
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
Reviewed-By: Jacob Taylor <jacob@explodie.org>
2026-11-10 20:41:19 +00:00
timedoutandGinger b2b9c79927 fix: SEC39
Reviewed-By: timedout <git@nexy7574.co.uk>
Co-Authored-By: Ginger <ginger@gingershaped.computer>
2026-11-10 20:40:28 +00:00
timedout 23a3ada393 fix: SEC36
Reviewed-By: Jacob Taylor <jacob@explodie.org>
Reviewed-By: Jade Ellis <jade@ellis.link>
Reviewed-By: Ginger <ginger@gingershaped.computer>
2026-11-10 20:39:13 +00:00
Jade Ellis 88441a409a refactor(rooms/timeline): Simplify deduplication of read receipts 2026-11-10 20:02:21 +00:00
Jade Ellis e21d86161c chore: Add changelog 2026-11-10 20:02:21 +00:00
Jade Ellis f42955602e test: Add unit test for merging threaded and private receipts 2026-11-10 20:02:21 +00:00
Jade Ellis c7aebd2b52 fix: Deduplicate read receipts and preserve per-thread state 2026-11-10 20:02:20 +00:00
Jade Ellis 61a50a627b fix(client): Add membership checks to read markers 2026-11-10 20:02:20 +00:00
Jade Ellis 76ace2bc09 fix(client): Allow setting read receipts on backfilled events 2026-11-10 20:02:20 +00:00
Jade Ellis e0d3d12654 fix(sync/v3): Pack room receipts into single m.receipt event 2026-11-10 20:02:20 +00:00
Jade Ellis be2f540a9d fix(client): Accurately include receipt senders in lazy loading 2026-11-10 20:02:19 +00:00
Jade Ellis 0368097791 fix(service/sending): Prevent panics and fix receipt limit in federation sender 2026-11-10 20:02:18 +00:00
Ginger 4d7a7d6cdc chore(deps): Clean up features and remove unused dependencies 2026-11-10 13:24:05 -05:00
Ginger d677486100 chore: Fix docs build failing 2026-11-10 11:45:37 -05:00
Renovate Bot 684b83491b chore(deps): update github-actions-digest 2026-11-10 05:17:14 +00:00
Henry-Hiles db83bc4c63 fix(nix): Disable broken checks for tzdata and sqlite 2026-11-09 20:58:37 +00:00
Henry-Hiles bf028274f8 fix(nix): fix linking to RocksDB 2026-11-09 18:03:34 +00:00
Jade Ellis 779374bb54 fix(deps): Properly use intended crypto backends 2026-11-08 20:34:05 +00:00
Jade Ellis e217ebb5e0 chore(ci): Remove debug logs
This was an artifact that has long outlived its usefulness
2026-11-08 19:58:13 +00:00
Jade Ellis 87b2ca81a3 fix(ci): Kill the permissions blocks entirely, they don't do anything 2026-11-08 19:42:39 +00:00
theS1LV3R a9bb74df6d chore: Disable hickory-dns feature from reqwest
As we now pass in our own resolver (and hickory instance) for every client,
having the hickory-dns feature enabled isn't necessary.
2026-11-08 19:40:49 +00:00
theS1LV3R 144777dab0 fix: Add DNS resolver to oidc crate as well
Because openidconnect vendors reqwest (??), we have to re-implement
the entire Resolve trait.

No I don't like it, but I can't think of a better solution.
2026-11-08 19:40:49 +00:00
theS1LV3R 60a0784a36 chore: Changelog 2026-11-08 19:40:49 +00:00
theS1LV3R a484c28f99 fix: Don't try to use system resolv.conf when other servers are configured
Previously, only HTTP clients targeting matrix servers (and using the
resolution spec) would use the DNS servers configured in the c10y config.
This happened because reqwest requires any DNS resolvers passed in to
implement reqwest::dns::Resolve, which only the matrix resolver did,
and no other HTTP client had a proper DNS resolver (which used the
configured DNS servers) passed into it.

To fix this we make a custom resolution struct based on reqwest's
reqwest::dns::HickoryDnsResolver, which implements Request with no
other modifications to the DNS response. HickoryDnsResolver itself isn't
exported, which is why we re-created it instead of using it directly.

no im not an LLM i just wrote this to remember my own changes later on

Fixes: continuwuation/continuwuity#2441
2026-11-08 19:40:49 +00:00
Renovate Bot f4f0a69fe4 chore(deps): lock file maintenance 2026-11-08 19:35:37 +00:00
Renovate Bot fcde5634da chore(deps): update dependency cargo-bins/cargo-binstall to v1.26.2 2026-11-08 19:35:04 +00:00
Renovate Bot 2edd61062c chore(deps): pin dependencies 2026-11-08 19:34:54 +00:00
Renovate Bot bfabac095f chore(deps): update pre-commit hook crate-ci/committed to v1.1.12 2026-11-08 19:34:41 +00:00
Renovate Bot d6710a9f00 chore(deps): update dependency @rspress/plugin-sitemap to v2.1.1 2026-11-08 19:34:36 +00:00
Henry-Hiles be5ff91eb3 chore: break out of loop when level is empty 2026-11-08 19:34:25 +00:00
Henry-Hiles 5ff6d71e7c chore: Make walk use counts only 2026-11-08 19:34:25 +00:00
Henry-Hiles 6782e12231 chore: Add changelog to #2465 2026-11-08 19:34:25 +00:00
Henry-Hiles 2e43797d95 chore: Make Clippy happy 2026-11-08 19:34:25 +00:00
Henry-Hiles 15b4e8e2f9 fix: Correct relations pagination and recursion
Ended up rewriting a fair bit, but should work better.
2026-11-08 19:34:25 +00:00
Jade Ellis 7c451888ae fix(ci): Pull base images on build to prevent using outdated base images 2026-11-08 18:22:19 +00:00
Jade Ellis 1716913b1a fix(ci): Move permissions fields causing workflow warnings 2026-11-08 18:19:30 +00:00
Jade Ellis ce986d9c40 docs: Changelog 2026-11-08 17:49:03 +00:00
Jade Ellis 6075e6e3ad chore: Upgrade other dependencies 2026-11-08 17:41:23 +00:00
renovate 02f96d311b chore(Nix): Updated flake hashes 2026-11-08 17:04:25 +00:00
Jade Ellis 1af92add88 chore(deps): Upgrade rocksdb and jemalloc 2026-11-08 16:54:23 +00:00
Jade Ellis c3f0d2ffa5 chore(deps): Upgrade rustls
Closes #2472
2026-11-08 15:06:06 +00:00
Ginger 02aed4fb23 chore: News fragment 2026-11-05 16:49:48 +00:00
Ginger 4a3b0366ac feat: Ratelimit CSAPI endpoints 2026-11-05 16:49:48 +00:00
Bardi Harborow 15f7aabca6 fix(complement): Build with the openreg feature
Since challengeless registration was gated behind the `openreg` feature,
building with plain `cargo build -p conduwuit` produces a server that
refuses Complement's registrations, so almost every test fails.

This commit updates the testing docs and the runner's build hints to
enable the feature.
2026-11-05 16:16:11 +00:00
stratself a57e0945eb chore: Add changelog for continuwuity --> homeserver 2026-11-05 16:10:27 +00:00
stratself b095103e23 docs: Use continuwuity instead of homeserver for the docker service
This commit replaces all references of `homeserver` to `continuwuity`

The `docker-compose.yml` file also receives 2-space linting
2026-11-05 16:10:27 +00:00
161 changed files with 4359 additions and 2911 deletions

No files matched your search

@@ -44,7 +44,7 @@ runs:
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4
with:
registry: ${{ env.BUILTIN_REGISTRY }}
username: ${{ inputs.registry_user }}
@@ -79,7 +79,7 @@ runs:
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4
with:
registry: ${{ env.BUILTIN_REGISTRY }}
username: ${{ inputs.registry_user }}
+1 -1
View File
@@ -7,7 +7,7 @@ runs:
using: composite
steps:
- name: Install sccache
uses: https://forgejo.ellis.link/continuwuation/sccache-action@v1
uses: https://forgejo.ellis.link/continuwuation/sccache-action@b5ae5b4541ed5fb0f616e3cb616bf213fefa1c40 # v1
- name: Configure sccache
uses: https://github.com/actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
@@ -29,7 +29,7 @@ runs:
steps:
- name: Detect runner OS
id: runner-os
uses: https://forgejo.ellis.link/continuwuation/detect-versions@v1
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
- name: Configure cross-compilation architecture
if: inputs.dpkg-arch != ''
+2 -2
View File
@@ -39,7 +39,7 @@ runs:
steps:
- name: Detect runner OS
id: runner-os
uses: https://forgejo.ellis.link/continuwuation/detect-versions@v1
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
- name: Configure Cargo environment
shell: bash
@@ -147,7 +147,7 @@ runs:
run: echo "::group::📦 Restoring build cache"
- name: Setup sccache
uses: https://forgejo.ellis.link/continuwuation/sccache-action@v1
uses: https://forgejo.ellis.link/continuwuation/sccache-action@b5ae5b4541ed5fb0f616e3cb616bf213fefa1c40 # v1
- name: End build cache restore group
shell: bash
+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@682ce6c3c696a4cd5168a05f98e51aa02b877941 # v2
uses: https://github.com/taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2
with:
tool: git-warp-time,timelord-cli@3.0.1
-5
View File
@@ -4,11 +4,6 @@ on:
pull_request_target:
types: [opened, reopened]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
auto-label:
name: Apply labels based on changed files
+1 -1
View File
@@ -60,7 +60,7 @@ jobs:
cargo-debian-${{ steps.debian-version.outputs.distribution }}-${{ matrix.arch }}-
- name: Setup sccache
uses: https://forgejo.ellis.link/continuwuation/sccache-action@v1
uses: https://forgejo.ellis.link/continuwuation/sccache-action@b5ae5b4541ed5fb0f616e3cb616bf213fefa1c40 # v1
- name: Configure sccache environment
run: |
+1 -3
View File
@@ -54,8 +54,6 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download binary artifacts
@@ -65,7 +63,7 @@ jobs:
path: binaries
merge-multiple: true
- name: Create Release and Upload
uses: https://github.com/softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3
uses: https://github.com/softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3
with:
draft: true
files: binaries/*
-5
View File
@@ -4,11 +4,6 @@ on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
check-changelog:
name: Check changelog is added
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Detect runner environment
id: runner-env
uses: https://forgejo.ellis.link/continuwuation/detect-versions@v1
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
- name: Setup Node.js
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
-4
View File
@@ -7,10 +7,6 @@ on:
- main
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
fast-checks:
name: Pre-commit & Formatting
+3 -13
View File
@@ -31,11 +31,6 @@ jobs:
build-release:
name: "Build ${{ matrix.slug }} (release)"
runs-on: dind
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
include:
@@ -84,6 +79,7 @@ jobs:
outputs: |
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
type=local,dest=/tmp/binaries
pull: true # Base images were becoming out of date
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Upload Docker artifacts
@@ -117,11 +113,6 @@ jobs:
name: "Build ${{ matrix.slug }} (max-perf)"
runs-on: dind
needs: build-release
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
include:
@@ -172,6 +163,7 @@ jobs:
outputs: |
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
type=local,dest=/tmp/binaries
pull: true # Base images were becoming out of date
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Upload max-perf Docker artifacts
@@ -207,8 +199,6 @@ jobs:
needs:
- build-release
- build-maxperf
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download binary artifacts
@@ -218,7 +208,7 @@ jobs:
path: binaries
merge-multiple: true
- name: Create Release and Upload
uses: https://github.com/softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3
uses: https://github.com/softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3
with:
draft: true
files: binaries/*
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
name: Renovate
runs-on: ubuntu-latest
container:
image: ghcr.io/renovatebot/renovate:44.210.1@sha256:45cc73346c44a9afe037f2d19766f2b545b59b2ed31b937b5b09017d2958e45f
image: ghcr.io/renovatebot/renovate:44.227.4@sha256:e09d40686f73d43b2c1e4667cb47d3c1d24a6ac730b74ce7aced9c84f68594f1
options: --tmpfs /tmp:exec
steps:
- name: Checkout
+2 -2
View File
@@ -24,7 +24,7 @@ repos:
- id: check-added-large-files
- repo: https://github.com/crate-ci/typos
rev: v1.51.1
rev: v1.52.2
hooks:
- id: typos
- id: typos
@@ -32,7 +32,7 @@ repos:
stages: [ commit-msg ]
- repo: https://github.com/crate-ci/committed
rev: v1.1.11
rev: v1.1.12
hooks:
- id: committed
+151
View File
@@ -1,3 +1,154 @@
# Continuwuity v26.11.0-alpha.2 (2026-11-14)
## Features
- Added opt-in OpenTelemetry metrics, exported over OTLP or scraped by Prometheus from `/_continuwuity/metrics`, and a Grafana dashboard. Contributed by @eleboucher. (prometheus-metrics)
- Add support for using custom DNS servers instead of using /etc/resolv.conf. Contributed by @s1lv3r. ([#2056](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2056))
- Continuwuity now supports configuring additional trusted audience values for deployments using OIDC with an IDP that sends them. Contributed by @ginger ([#2226](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2226))
- "!admin users list" now hides deactivated users by default, but can display them with the optional "--show-deactivated" flag. "--hide-suspended" and "--hide-locked" have been added as well, which stop suspended and locked users from being displayed respectively. Contributed by @Clubs. ([#2292](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2292))
- Added support for [MSC4494: Membership-based invite blocking](https://github.com/matrix-org/matrix-spec-proposals/pull/4494) ([#2297](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2297))
- Appservices now receive typing indicators and read receipts. Contributed by @Jade ([#2327](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2327))
- Added support for servers returning 410 gone to indicate they are no longer serving a Matrix server ([MSC4188](https://github.com/matrix-org/matrix-spec-proposals/pull/4188)). Contributed by @nex and @silversys ([#2355](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2355))
- Changed the policy on unstable features, disabling most by default and making them configurable in a tidy little `experiments` configuration. See also: #1884. ([#2517](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2517))
- Added support for [MSC4363](https://github.com/matrix-org/matrix-spec-proposals/pull/4363) (OAuth step-up authentication). Contributed by @ginger.
- Added support for [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815), allowing room moderators to fetch the original content of redacted events, behind the `allow_moderators_to_view_redacted_content` config option. Contributed by @eleboucher.
- Added support for [MSC4484](https://github.com/matrix-org/matrix-spec-proposals/pull/4484). Clients which use the built-in Matrix server administration APIs will need to ask for the appropriate scope when signing in with OAuth. Contributed by @ginger.
- Check content-type header on federation responses, ignoring any that don't match (spec compliance)
- Implemented unstable support for [MSC4560] (Stripped state requests over federation). Contributed by @ginger.
[MSC4560]: https://github.com/matrix-org/matrix-spec-proposals/pull/4560
- Profile banners are now treated as images when imported from OIDC claims, like avatars already were.
- Remove support for legacy, unauthenticated media, including the `allow_legacy_media` and `freeze_legacy_media` options.
- The first-run version of the web UI now includes a link to the registration page. Contributed by @ginger
## Bugfixes
- Fixed `/get_missing_events` rejecting requests with more `earliest_events` than the `limit`. Contributed by @eleboucher. (get-missing-events-earliest-limit)
- Invitees are now added as room creators when creating a v12+ trusted private chat. Contributed by @ginger. ([#2162](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2162))
- Fixed push gateway URLs containing the configured notification path outside of their suffix. Contributed by @eleboucher. ([#2261](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2261))
- "!admin users change-email" now verifies a user exists before attempting to change their email. Contributed by @Clubs. ([#2298](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2298))
- Fixed URL preview image MIME types and rejected failed downloads. Contributed by @eleboucher. ([#2308](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2308))
- Correctly set RocksDB column options, including enabling block caches. Contributed by @Jade ([#2345](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2345))
- Fix some possible deadlocks/freezes and reduce lock contention (improving performance). Contributed by @Jade ([#2351](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2351))
- Once again fixed how room extremities are handled, fixing a problem that made continuwuity gradually make rooms needlessly complex, which also caused more frequent state resets. ([#2356](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2356))
- The OAuth identity reset page is no longer linked from the account management UI to reduce confusion. Contributed by @ginger. ([#2383](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2383))
- Fixed a worker panic when knocking on a room over federation. Contributed by @eleboucher. ([#2387](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2387))
- Perform more validation on events received during atomic gapfill from remote servers, fixing a panic if bad data was persisted by another server and later lazily fetched by us. ([#2400](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2400))
- Redirect URIs in OAuth clients' metadata are now properly validated to be on a subdomain of the OAuth issuer URL domain. Contributed by @ginger. ([#2421](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2421))
- Fix v12 rooms created by the same user in the same millisecond ending up as the same room. Contributed by @eleboucher. ([#2424](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2424))
- Client-server API endpoints are now properly ratelimited for unauthenticated requests. Contributed by @ginger. ([#2444](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2444))
- Setting a profile key longer than 255 bytes now returns 400 `M_KEY_TOO_LARGE` as required by the spec, instead of 413 `M_TOO_LARGE`. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Setting `m.fully_read` via the account data endpoints now returns 405 `M_BAD_JSON` as required by the spec, instead of 400. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Appservices masquerading as a device that does not exist now receive 400 `M_UNKNOWN_DEVICE` as required by the spec, instead of 403 `M_FORBIDDEN`. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Setting profile data that would make the profile exceed 64 KiB now returns 400 `M_PROFILE_TOO_LARGE` as required by the spec, instead of a 500 error. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- The `m.forget_forced_upon_leave` capability now reflects the `forget_forced_upon_leave` config option instead of always being advertised as enabled. ([#2452](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2452))
- Fixed push notifications for membership events setting `user_is_target` based on the sender rather than the user being notified. ([#2454](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2454))
- Ensure HTTP clients actually follow the `dns_servers` config option. Contributed by @silversys ([#2460](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2460))
- Reworked event relations to follow the spec more closely. Pagination of `/relations` now returns the correct pages and `next_batch` tokens, recursive relations are returned in the right order without duplicates, and bundled `m.reference` aggregations now include every reference. Contributed by @Henry-Hiles (QuadRadical). ([#2465](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2465))
- Read receipts are now more spec compliant, will work better in threads and are less likely to end up causing loops with other software. Contributed by @Jade ([#2481](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2481))
- Fix the DNS resolver failing to start without `/etc/resolv.conf` when `dns_servers` is configured. Contributed by @eleboucher. ([#2495](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2495))
- Fixed OIDC logins failing after the identity provider rotates its signing keys. Contributed by @eleboucher. ([#2497](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2497))
- Creating a room with valid but non-canonical JSON now returns `400 M_BAD_JSON` instead of panicking the worker and returning `500 M_UNKNOWN`.
- Fix account data updates sent at the same time leaving old copies behind, which every initial sync then returned. Existing copies are removed on startup. Contributed by @eleboucher.
- Fix gap filling skipping outlier events that are missing their previous events. Contributed by @eleboucher.
- Fix incoming federation events losing state changes when predecessors share the same state-before snapshot. Contributed by @eleboucher.
- Fix new devices sometimes never reaching other users' device lists. Contributed by @eleboucher.
- Fix state resolution applying events out of order, which could undo room joins. Contributed by @eleboucher.
- Fix to-device messages, including room keys, sometimes being lost before delivery. Contributed by @eleboucher.
- For deployments using OIDC with `profile_key_import_mode` set to `on_login`, users' avatars will no longer be clobbered if they didn't change their avatar since their last login.
- Joining a local room the user is not allowed to join now returns `403 M_FORBIDDEN` instead of `500 M_UNKNOWN` when there are no other servers to try.
- Room summary visibility checks are no longer incorrectly applied for remote rooms. Contributed by @ginger.
- The userinfo endpoint is now accessible even if federation is disabled, allowing LiveKit to be used on servers with federation disabled without using the server name whitelist.
- `!admin token issue` can no longer issue registration tokens when `allow_registration` is false. Contributed by @Clubs.
## Improved Documentation
- Add the Authentication section to document available auth methods for Continuwuity. The "delegated authentication" guide has also been migrated to here. Contributed by @stratself. ([#2234](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2234))
- Add a guide for push notifications, detailing how it works, push gateway specifics, troubleshooting common issues, and pointing to external guides for UnifiedPush backends. Contributed by @stratself ([#2244](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2244))
- The deploying page now includes vital general information about installing Continuwuity: release tracks, update steps, and post-installation recommendations. Contributed by @stratself ([#2252](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2252))
- Add some missing instructions on configuring Continuwuity on the RPM page. Users are encouraged to use the [generic deploying docs](https://continuwuity.org/deploying/generic) for the bulk of guidance anyhow. Contributed by @stratself ([#2275](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2275))
- Better, more succinct [introduction page](https://continuwuity.org/introduction.html). Contributed by @stratself ([#2279](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2279))
- Add a section on [troubleshooting Docker issues](https://continuwuity.org/troubleshooting#docker-issues). Contributed by @stratself. ([#2324](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2324))
- Instructions for Authelia added to the [OIDC guide](https://continuwuity.org/authentication/oidc.html). Contributed by @fhoekstra ([#2341](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2341))
- Docker compose examples now use bind mounts by default, instead of Docker volumes, as they are easier to work with esp. for backup/restore. Contributed by @stratself. ([#2353](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2353))
- The documentation now refers to the Continuwuity Docker service as `continuwuity` instead of `homeserver`.
## Misc
- Updated internal Sentry integration setup to the new pattern required by the SDK. #2423
- Upgraded rocksdb from 11.1.1 to 11.12.0 and jemalloc to 5.4.0.
# Continuwuity v26.11.0-alpha.1 (2026-11-10)
## Features
- Added opt-in OpenTelemetry metrics, exported over OTLP or scraped by Prometheus from `/_continuwuity/metrics`, and a Grafana dashboard. Contributed by @eleboucher. (prometheus-metrics)
- Add support for using custom DNS servers instead of using /etc/resolv.conf. Contributed by @s1lv3r. ([#2056](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2056))
- Continuwuity now supports configuring additional trusted audience values for deployments using OIDC with an IDP that sends them. Contributed by @ginger ([#2226](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2226))
- "!admin users list" now hides deactivated users by default, but can display them with the optional "--show-deactivated" flag. "--hide-suspended" and "--hide-locked" have been added as well, which stop suspended and locked users from being displayed respectively. Contributed by @Clubs. ([#2292](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2292))
- Added support for [MSC4494: Membership-based invite blocking](https://github.com/matrix-org/matrix-spec-proposals/pull/4494) ([#2297](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2297))
- Appservices now receive typing indicators and read receipts. Contributed by @Jade ([#2327](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2327))
- Added support for [MSC4363](https://github.com/matrix-org/matrix-spec-proposals/pull/4363) (OAuth step-up authentication). Contributed by @ginger.
- Added support for [MSC4484](https://github.com/matrix-org/matrix-spec-proposals/pull/4484). Clients which use the built-in Matrix server administration APIs will need to ask for the appropriate scope when signing in with OAuth. Contributed by @ginger.
- Implemented unstable support for [MSC4560] (Stripped state requests over federation). Contributed by @ginger.
[MSC4560]: https://github.com/matrix-org/matrix-spec-proposals/pull/4560
- Profile banners are now treated as images when imported from OIDC claims, like avatars already were.
- The first-run version of the web UI now includes a link to the registration page. Contributed by @ginger
## Bugfixes
- Invitees are now added as room creators when creating a v12+ trusted private chat. Contributed by @ginger. ([#2162](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2162))
- Fixed push gateway URLs containing the configured notification path outside of their suffix. Contributed by @eleboucher. ([#2261](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2261))
- "!admin users change-email" now verifies a user exists before attempting to change their email. Contributed by @Clubs. ([#2298](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2298))
- Fixed URL preview image MIME types and rejected failed downloads. Contributed by @eleboucher. ([#2308](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2308))
- Correctly set RocksDB column options, including enabling block caches. Contributed by @Jade ([#2345](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2345))
- Fix some possible deadlocks/freezes and reduce lock contention (improving performance). Contributed by @Jade ([#2351](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2351))
- Once again fixed how room extremities are handled, fixing a problem that made continuwuity gradually make rooms needlessly complex, which also caused more frequent state resets. ([#2356](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2356))
- The OAuth identity reset page is no longer linked from the account management UI to reduce confusion. Contributed by @ginger. ([#2383](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2383))
- Fixed a worker panic when knocking on a room over federation. Contributed by @eleboucher. ([#2387](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2387))
- Perform more validation on events received during atomic gapfill from remote servers, fixing a panic if bad data was persisted by another server and later lazily fetched by us. ([#2400](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2400))
- Redirect URIs in OAuth clients' metadata are now properly validated to be on a subdomain of the OAuth issuer URL domain. Contributed by @ginger. ([#2421](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2421))
- Fix v12 rooms created by the same user in the same millisecond ending up as the same room. Contributed by @eleboucher. ([#2424](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2424))
- Client-server API endpoints are now properly ratelimited for unauthenticated requests. Contributed by @ginger. ([#2444](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2444))
- Setting a profile key longer than 255 bytes now returns 400 `M_KEY_TOO_LARGE` as required by the spec, instead of 413 `M_TOO_LARGE`. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Setting `m.fully_read` via the account data endpoints now returns 405 `M_BAD_JSON` as required by the spec, instead of 400. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Appservices masquerading as a device that does not exist now receive 400 `M_UNKNOWN_DEVICE` as required by the spec, instead of 403 `M_FORBIDDEN`. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- Setting profile data that would make the profile exceed 64 KiB now returns 400 `M_PROFILE_TOO_LARGE` as required by the spec, instead of a 500 error. ([#2451](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2451))
- The `m.forget_forced_upon_leave` capability now reflects the `forget_forced_upon_leave` config option instead of always being advertised as enabled. ([#2452](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2452))
- Fixed push notifications for membership events setting `user_is_target` based on the sender rather than the user being notified. ([#2454](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2454))
- Ensure HTTP clients actually follow the `dns_servers` config option. Contributed by @silversys ([#2460](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2460))
- Reworked event relations to follow the spec more closely. Pagination of `/relations` now returns the correct pages and `next_batch` tokens, recursive relations are returned in the right order without duplicates, and bundled `m.reference` aggregations now include every reference. Contributed by @Henry-Hiles (QuadRadical). ([#2465](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2465))
- Read receipts are now more spec compliant, will work better in threads and are less likely to end up causing loops with other software. Contributed by @Jade ([#2481](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2481))
- Fix gap filling skipping outlier events that are missing their previous events. Contributed by @eleboucher.
- Fix incoming federation events losing state changes when predecessors share the same state-before snapshot. Contributed by @eleboucher.
- Fix new devices sometimes never reaching other users' device lists. Contributed by @eleboucher.
- Fix state resolution applying events out of order, which could undo room joins. Contributed by @eleboucher.
- Fix to-device messages, including room keys, sometimes being lost before delivery. Contributed by @eleboucher.
- For deployments using OIDC with `profile_key_import_mode` set to `on_login`, users' avatars will no longer be clobbered if they didn't change their avatar since their last login.
- Room summary visibility checks are no longer incorrectly applied for remote rooms. Contributed by @ginger.
- The userinfo endpoint is now accessible even if federation is disabled, allowing LiveKit to be used on servers with federation disabled without using the server name whitelist.
- `!admin token issue` can no longer issue registration tokens when `allow_registration` is false. Contributed by @Clubs.
## Improved Documentation
- Add the Authentication section to document available auth methods for Continuwuity. The "delegated authentication" guide has also been migrated to here. Contributed by @stratself. ([#2234](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2234))
- Add a guide for push notifications, detailing how it works, push gateway specifics, troubleshooting common issues, and pointing to external guides for UnifiedPush backends. Contributed by @stratself ([#2244](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2244))
- The deploying page now includes vital general information about installing Continuwuity: release tracks, update steps, and post-installation recommendations. Contributed by @stratself ([#2252](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2252))
- Add some missing instructions on configuring Continuwuity on the RPM page. Users are encouraged to use the [generic deploying docs](https://continuwuity.org/deploying/generic) for the bulk of guidance anyhow. Contributed by @stratself ([#2275](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2275))
- Better, more succinct [introduction page](https://continuwuity.org/introduction.html). Contributed by @stratself ([#2279](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2279))
- Add a section on [troubleshooting Docker issues](https://continuwuity.org/troubleshooting#docker-issues). Contributed by @stratself. ([#2324](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2324))
- Instructions for Authelia added to the [OIDC guide](https://continuwuity.org/authentication/oidc.html). Contributed by @fhoekstra ([#2341](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2341))
- Docker compose examples now use bind mounts by default, instead of Docker volumes, as they are easier to work with esp. for backup/restore. Contributed by @stratself. ([#2353](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2353))
- The documentation now refers to the Continuwuity Docker service as `continuwuity` instead of `homeserver`.
## Misc
- Updated internal Sentry integration setup to the new pattern required by the SDK. #2423
- Upgraded rocksdb from 11.1.1 to 11.12.0 and jemalloc to 5.4.0.
# Continuwuity v26.9.1 (2026-09-28)
## Features
Generated
+621 -608
View File
File diff suppressed because it is too large. Load diff
+81 -67
View File
@@ -12,17 +12,17 @@ license = "Apache-2.0"
# See also `rust-toolchain.toml`
readme = "README.md"
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
version = "26.9.1"
version = "26.11.0-alpha.2"
[workspace.metadata.crane]
name = "conduwuit"
[workspace.dependencies.arrayvec]
version = "0.7.6"
version = "0.7.8"
features = ["serde"]
[workspace.dependencies.smallvec]
version = "1.14.0"
version = "1.16.5"
features = [
"const_generics",
"const_new",
@@ -39,10 +39,10 @@ features = ["ffi", "std", "union"]
version = "1.1.0"
[workspace.dependencies.ctor]
version = "1.0.6"
version = "1.0.13"
[workspace.dependencies.dtor]
version = "1.0.0"
version = "1.0.6"
[workspace.dependencies.cargo_toml]
version = "1.0"
@@ -50,7 +50,7 @@ default-features = false
features = ["features"]
[workspace.dependencies.toml]
version = "1.1.2"
version = "1.2.1"
default-features = false
features = ["parse", "serde"]
@@ -58,7 +58,7 @@ features = ["parse", "serde"]
version = "0.6.0"
[workspace.dependencies.base64]
version = "0.23.0"
version = "0.23.1"
default-features = false
# used for TURN server authentication
@@ -71,36 +71,36 @@ version = "0.5.0"
default-features = false
[workspace.dependencies.p256]
version = "0.13.2"
version = "0.14.0"
default-features = false
features = ["ecdsa", "std"]
# used for checking if an IP is in specific subnets / CIDR ranges easier
[workspace.dependencies.ipaddress]
version = "0.2.0"
version = "0.2.11"
[workspace.dependencies.rand]
version = "0.10.1"
version = "0.10.3"
# Used for the http request / response body type for Ruma endpoints used with reqwest
[workspace.dependencies.bytes]
version = "1.10.1"
version = "1.12.1"
[workspace.dependencies.http-body-util]
version = "0.1.3"
version = "0.1.5"
[workspace.dependencies.http]
version = "1.3.1"
version = "1.5.0"
# parses the HTTP-date form of Retry-After
[workspace.dependencies.httpdate]
version = "1.0.3"
[workspace.dependencies.regex]
version = "1.11.1"
version = "1.13.1"
[workspace.dependencies.axum]
version = "0.8.8"
version = "0.8.9"
default-features = false
features = [
"form",
@@ -114,7 +114,7 @@ features = [
]
[workspace.dependencies.axum-extra]
version = "0.12.0"
version = "0.12.6"
default-features = false
features = ["typed-header", "tracing", "cookie"]
@@ -133,12 +133,12 @@ default-features = false
version = "0.2"
[workspace.dependencies.tower]
version = "0.5.2"
version = "0.5.3"
default-features = false
features = ["util"]
[workspace.dependencies.tower-http]
version = "0.7.0"
version = "0.7.1"
default-features = false
features = [
"add-extension",
@@ -152,38 +152,46 @@ features = [
]
[workspace.dependencies.rustls]
version = "0.23.25"
version = "0.23.46"
default-features = false
[workspace.dependencies.reqwest]
version = "0.13.2"
version = "0.13.5"
default-features = false
features = [
"rustls-no-provider",
"socks",
"hickory-dns",
"http2",
"stream",
"form",
]
# Needed for as long as openidconnect is on an outdated reqwest
[workspace.dependencies.reqwest_0_12]
package = "reqwest"
version = "0.12"
default-features = false
features = [
"rustls-tls-native-roots-no-provider",
]
[workspace.dependencies.serde]
version = "1.0.219"
version = "1.0.229"
default-features = false
features = ["rc"]
[workspace.dependencies.serde_json]
version = "1.0.140"
version = "1.0.154"
default-features = false
features = ["raw_value"]
# Used for appservice registration files
[workspace.dependencies.serde-saphyr]
version = "1.0.0"
version = "2.1.1"
# Used to load forbidden room/user regex from config
[workspace.dependencies.serde_regex]
version = "1.1.0"
version = "1.2.0"
# Used for password hashing
[workspace.dependencies.argon2]
@@ -193,7 +201,7 @@ default-features = false
# Used to generate thumbnails for images
[workspace.dependencies.image]
version = "0.25.5"
version = "0.25.10"
default-features = false
features = [
"jpeg",
@@ -204,29 +212,29 @@ features = [
# logging
[workspace.dependencies.log]
version = "0.4.27"
version = "0.4.35"
default-features = false
[workspace.dependencies.tracing]
version = "0.1.41"
version = "0.1.44"
default-features = false
[workspace.dependencies.tracing-subscriber]
version = "0.3.20"
version = "0.3.23"
default-features = false
features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"]
[workspace.dependencies.tracing-journald]
version = "0.3.1"
version = "0.3.2"
[workspace.dependencies.tracing-core]
version = "0.1.34"
version = "0.1.36"
default-features = false
# for URL previews
[workspace.dependencies.webpage]
version = "2.0.1"
version = "2.1.0"
default-features = false
# used for conduwuit's CLI and admin room command parsing
[workspace.dependencies.clap]
version = "4.5.35"
version = "4.6.7"
default-features = false
features = [
"derive",
@@ -239,12 +247,12 @@ features = [
]
[workspace.dependencies.futures]
version = "0.3.31"
version = "0.3.34"
default-features = false
features = ["std", "async-await"]
[workspace.dependencies.tokio]
version = "1.44.2"
version = "1.54.1"
default-features = false
features = [
"fs",
@@ -259,25 +267,25 @@ features = [
]
[workspace.dependencies.tokio-metrics]
version = "0.5.0"
version = "0.5.2"
[workspace.dependencies.libloading]
version = "0.9.0"
# Validating urls in config, was already a transitive dependency
[workspace.dependencies.url]
version = "2.5.4"
version = "2.5.8"
default-features = false
features = ["serde"]
# standard date and time tools
[workspace.dependencies.chrono]
version = "0.4.38"
version = "0.4.45"
features = ["alloc", "std"]
default-features = false
[workspace.dependencies.hyper]
version = "1.6.0"
version = "1.12.0"
default-features = false
features = [
"server",
@@ -296,7 +304,7 @@ features = [
# to support multiple variations of setting a config option
[workspace.dependencies.either]
version = "1.15.0"
version = "1.19.0"
default-features = false
features = ["serde"]
@@ -307,7 +315,7 @@ default-features = false
features = ["env", "toml"]
[workspace.dependencies.hickory-resolver]
version = "0.26.0"
version = "0.26.3"
default-features = false
features = [
"serde",
@@ -317,7 +325,7 @@ features = [
# Used for conduwuit::Error type
[workspace.dependencies.thiserror]
version = "2.0.12"
version = "2.0.21"
default-features = false
# Used to make working with iterators easier, was already a transitive depdendency
@@ -338,7 +346,7 @@ version = "0.6.0"
version = "2.5.0"
[workspace.dependencies.async-trait]
version = "0.1.88"
version = "0.1.92"
[workspace.dependencies.lru-cache]
version = "0.1.2"
@@ -349,7 +357,7 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
git = "https://github.com/ruma/ruma.git"
rev = "0ed7fba34213f18a628a56f527c6cc795cd7eef5"
rev = "472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
features = [
"appservice-api-c",
"client-api",
@@ -395,7 +403,7 @@ features = [
[workspace.dependencies.rust-rocksdb]
git = "https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1"
rev = "0a25ff92f7c09b55eec496b9c192c7d5136ab2b8"
rev = "6021299f3e0e9455dc3f2e39c65e1dc217be8903"
default-features = false
features = [
"multi-threaded-cf",
@@ -406,7 +414,7 @@ features = [
]
[workspace.dependencies.sha2]
version = "0.11.0"
version = "0.11.1"
default-features = false
[workspace.dependencies.sha1]
@@ -414,11 +422,13 @@ version = "0.11.0"
default-features = false
[workspace.dependencies.openidconnect]
version = "4.0.1"
version = "4.1.0"
default-features = false
features = ["reqwest"]
# optional opentelemetry, performance measurements, flamegraphs, etc for performance measurements and monitoring
[workspace.dependencies.opentelemetry]
version = "0.33.0"
version = "0.33.1"
[workspace.dependencies.opentelemetry-instrumentation-tower]
version = "0.19.0"
@@ -426,7 +436,7 @@ default-features = false
features = ["axum"]
[workspace.dependencies.opentelemetry-semantic-conventions]
version = "0.33.0"
version = "0.33.1"
features = ["semconv_experimental"]
[workspace.dependencies.tracing-flame]
@@ -436,25 +446,25 @@ version = "0.2.0"
version = "0.34.0"
[workspace.dependencies.opentelemetry_sdk]
version = "0.33.0"
version = "0.33.1"
features = ["rt-tokio"]
[workspace.dependencies.opentelemetry-prometheus]
version = "0.33.0"
version = "0.33.1"
[workspace.dependencies.prometheus]
version = "0.14.0"
default-features = false
[workspace.dependencies.opentelemetry-otlp]
version = "0.33.0"
version = "0.33.1"
features = ["http", "grpc-tonic", "trace", "logs", "metrics"]
# optional sentry metrics for crash/panic reporting
[workspace.dependencies.sentry]
version = "0.49.0"
version = "0.49.5"
default-features = false
features = [
"backtrace",
@@ -469,14 +479,14 @@ features = [
]
[workspace.dependencies.sentry-tracing]
version = "0.49.0"
version = "0.49.5"
[workspace.dependencies.sentry-tower]
version = "0.49.0"
version = "0.49.5"
# jemalloc usage
[workspace.dependencies.tikv-jemalloc-sys]
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
rev = "df86ff89d4b1e223b9f7d2dd2fbb7f202da7f554"
rev = "ac4d4861b335b199f812807996e8c9166961041a"
default-features = false
features = [
"background_threads_runtime_support",
@@ -484,7 +494,7 @@ features = [
]
[workspace.dependencies.tikv-jemallocator]
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
rev = "df86ff89d4b1e223b9f7d2dd2fbb7f202da7f554"
rev = "ac4d4861b335b199f812807996e8c9166961041a"
default-features = false
features = [
"background_threads_runtime_support",
@@ -492,7 +502,7 @@ features = [
]
[workspace.dependencies.tikv-jemalloc-ctl]
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
rev = "df86ff89d4b1e223b9f7d2dd2fbb7f202da7f554"
rev = "ac4d4861b335b199f812807996e8c9166961041a"
default-features = false
features = ["use_std"]
@@ -500,7 +510,7 @@ features = ["use_std"]
version = "0.5"
[workspace.dependencies.nix]
version = "0.31.0"
version = "0.31.3"
default-features = false
features = ["resource"]
@@ -522,7 +532,7 @@ version = "0.4.9"
default-features = false
[workspace.dependencies.termimad]
version = "0.35.0"
version = "0.35.5"
default-features = false
[workspace.dependencies.checked_ops]
@@ -548,7 +558,7 @@ features = ["hardware-lock-elision", "deadlock_detection"] # TODO: Check if dead
version = "0.5.0"
[workspace.dependencies.bytesize]
version = "2.0"
version = "2.7"
[workspace.dependencies.core_affinity]
version = "0.8.3"
@@ -560,11 +570,11 @@ version = "0.2"
version = "0.2"
[workspace.dependencies.minicbor]
version = "2.1.1"
version = "2.3.1"
features = ["std"]
[workspace.dependencies.minicbor-serde]
version = "0.7.0"
version = "0.7.2"
features = ["std"]
[workspace.dependencies.maplit]
@@ -574,10 +584,10 @@ version = "1.0.2"
version = "1.0.1"
[workspace.dependencies.askama]
version = "0.16.0"
version = "0.16.1"
[workspace.dependencies.lettre]
version = "0.11.19"
version = "0.11.23"
default-features = false
features = ["smtp-transport", "pool", "hostname", "builder", "rustls", "rustls-native-certs", "tokio1", "rustls-no-provider", "tokio1-rustls", "tracing", "serde"]
@@ -590,7 +600,8 @@ features = ["std"]
version = "0.3.0"
[workspace.dependencies.resolvematrix]
version = "1.3.0"
version = "1.4.2"
features = ["unstable-msc4188"]
[workspace.dependencies.serde_urlencoded]
version = "0.7.1"
@@ -1010,4 +1021,7 @@ collapsible_if = "allow"
cognitive_complexity = "allow"
[workspace.metadata.cargo-shear]
ignored = ["const-str", "ctor", "dtor"]
# All of these crates provide macros that are used across the codebase
# and that every crate depends on. cargo-shear can't tell this because
# it doesn't expand macros.
ignored = ["const-str", "ctor", "dtor", "tracing"]
+2 -2
View File
@@ -53,7 +53,7 @@ fi
# The base docker image to use for complement tests
# You can build the default with `docker build -t continuwuity:complement -f ./docker/complement.Dockerfile .`
# after running `cargo build`. Only the debug binary is used.
# after running `cargo build -p conduwuit --features openreg`. Only the debug binary is used.
COMPLEMENT_BASE_IMAGE="${COMPLEMENT_BASE_IMAGE:-continuwuity:complement}"
# Complement tests that are skipped due to flakiness/reliability issues or we don't implement such features and won't for a long time
@@ -99,7 +99,7 @@ fi
if ! docker image inspect "$COMPLEMENT_BASE_IMAGE" > /dev/null 2>&1; then
echo "Complement base image not found: $COMPLEMENT_BASE_IMAGE"
echo "Build it with: cargo build -p conduwuit && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."
echo "Build it with: cargo build -p conduwuit --features openreg && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."
exit 1
fi
+1
View File
@@ -0,0 +1 @@
Upgraded rocksdb from 11.1.1 to 11.12.0 and jemalloc to 5.4.0.
+1
View File
@@ -0,0 +1 @@
Check content-type header on federation responses, ignoring any that don't match (spec compliance)
@@ -0,0 +1 @@
Fix account data updates sent at the same time leaving old copies behind, which every initial sync then returned. Existing copies are removed on startup. Contributed by @eleboucher.
@@ -0,0 +1 @@
Creating a room with valid but non-canonical JSON now returns `400 M_BAD_JSON` instead of panicking the worker and returning `500 M_UNKNOWN`.
+1
View File
@@ -0,0 +1 @@
The documentation now refers to the Continuwuity Docker service as `continuwuity` instead of `homeserver`.
@@ -0,0 +1 @@
Joining a local room the user is not allowed to join now returns `403 M_FORBIDDEN` instead of `500 M_UNKNOWN` when there are no other servers to try.
@@ -0,0 +1 @@
Added support for [MSC2815](https://github.com/matrix-org/matrix-spec-proposals/pull/2815), allowing room moderators to fetch the original content of redacted events, behind the `allow_moderators_to_view_redacted_content` config option. Contributed by @eleboucher.
@@ -0,0 +1 @@
Remove support for legacy, unauthenticated media, including the `allow_legacy_media` and `freeze_legacy_media` options.
@@ -0,0 +1 @@
Fix incoming federation events losing state changes when predecessors share the same state-before snapshot. Contributed by @eleboucher.
+1
View File
@@ -0,0 +1 @@
Added support for servers returning 410 gone to indicate they are no longer serving a Matrix server (MSC4188). Contributed by @nex and @silversys
+1
View File
@@ -0,0 +1 @@
Client-server API endpoints are now properly ratelimited for unauthenticated requests. Contributed by @ginger.
+1
View File
@@ -0,0 +1 @@
Ensure HTTP clients actually follow the `dns_servers` config option. Contributed by @silversys
+1
View File
@@ -0,0 +1 @@
Reworked event relations to follow the spec more closely. Pagination of `/relations` now returns the correct pages and `next_batch` tokens, recursive relations are returned in the right order without duplicates, and bundled `m.reference` aggregations now include every reference. Contributed by @Henry-Hiles (QuadRadical).
+1
View File
@@ -0,0 +1 @@
Read receipts are now more spec compliant, will work better in threads and are less likely to end up causing loops with other software. Contributed by @Jade
+1
View File
@@ -0,0 +1 @@
Fix the DNS resolver failing to start without `/etc/resolv.conf` when `dns_servers` is configured. Contributed by @eleboucher.
+1
View File
@@ -0,0 +1 @@
Fixed OIDC logins failing after the identity provider rotates its signing keys. Contributed by @eleboucher.
+1
View File
@@ -0,0 +1 @@
Changed the policy on unstable features, disabling most by default and making them configurable in a tidy little `experiments` configuration. See also: #1884.
+1
View File
@@ -0,0 +1 @@
Fixed the experiments implementation in #2517 not properly disabling some functionality when associated experiments weren't enabled.
@@ -0,0 +1 @@
Fixed `/get_missing_events` rejecting requests with more `earliest_events` than the `limit`. Contributed by @eleboucher.
-1
View File
@@ -31,7 +31,6 @@ rocksdb_log_level = "info"
rocksdb_max_log_files = 1
rocksdb_recovery_mode = 0
rocksdb_paranoid_file_checks = true
allow_legacy_media = true
startup_netburst = true
startup_netburst_keep = -1
allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure = true
+148 -30
View File
@@ -685,6 +685,13 @@
# env: CONTINUWUITY_SENDER_SHUTDOWN_TIMEOUT
#sender_shutdown_timeout = 5
# Maximum number of requests per minute that unauthenticated clients
# may make to ratelimited client-server API routes. This ratelimit is
# global across all endpoints for each IP.
#
# env: CONTINUWUITY_UNAUTHENTICATED_REQUEST_RATELIMIT
#unauthenticated_request_ratelimit = 30
# Enables registration. If set to false, no users can register on this
# server.
#
@@ -1650,13 +1657,6 @@
# env: CONTINUWUITY_ALLOW_INCOMING_TYPING
#allow_incoming_typing = true
# Allow the use of unstable persistent "sticky events" ([MSC4354])
#
# MSC4354: https://c10y.cc/MSC4354
#
# env: CONTINUWUITY_ALLOW_STICKY_EVENTS
#allow_sticky_events = false
# Maximum time federation user can indicate typing.
#
# env: CONTINUWUITY_TYPING_FEDERATION_TIMEOUT_S
@@ -1707,29 +1707,6 @@
# env: CONTINUWUITY_BROTLI_COMPRESSION
#brotli_compression = false
# Enable the legacy unauthenticated Matrix media repository endpoints.
# These endpoints consist of:
# - /_matrix/media/*/config
# - /_matrix/media/*/upload
# - /_matrix/media/*/preview_url
# - /_matrix/media/*/download/*
# - /_matrix/media/*/thumbnail/*
#
# The authenticated equivalent endpoints are always enabled.
#
# Defaults to false, as unauthenticated media has been sunsetted.
#
# env: CONTINUWUITY_ALLOW_LEGACY_MEDIA
#allow_legacy_media = false
# If set to true, prevents fetching new legacy remote media.
#
# Legacy media may still be accessible if it was already fetched
# previously and allow_legacy_media is true.
#
# env: CONTINUWUITY_FREEZE_LEGACY_MEDIA
#freeze_legacy_media = true
# Check consistency of the media directory at startup:
# 1. When `media_compat_file_link` is enabled, this check will upgrade
# media when switching back and forth between Conduit and conduwuit.
@@ -2680,3 +2657,144 @@
#
# env: CONTINUWUITY_OAUTH__OIDC__PROFILE_KEY_IMPORT_MODE
#profile_key_import_mode = "on_registration"
[global.experiments]
# Continuwuity's experimental features are frequently updated.
# If you got this configuration via a package manager, chances are it's outdated.
# Check out the configuration reference online to see a fresh version:
# https://continuwuity.org/reference/config.html#:~:text=global.experiments
#
# Please keep in mind that experiments are used to enable unstable features.
# You probably don't need to enable any of these unless you know what they are,
# and consequently know why you should enable them.
# MSC3814: Dehydrated devices with SSSS
#
# Enables server-side support for "dehydrated devices", which are
# server-side devices (created by supporting clients) that can collect
# encryption keys when there are no online devices, which supporting
# clients can then "hydrate" to download any encryption keys that were
# sent while they were offline.
#
# Important: this is NOT required to receive encrypted messages while you
# are offline. Devices can still receive encrypted messages while they are
# offline, but to share those keys with new devices, they have to be
# online. Dehydrated devices work around this by providing a "shared"
# device new sessions can bootstrap from, to receive keys from before they
# logged in that haven't been uploaded to the server-side key backup yet.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/3814
#
# env: CONTINUWUITY_EXPERIMENTS__MSC3814
#msc3814 = false
# MSC4155: Invite filtering
#
# Provides advanced invite filtering rules for users, allowing complex
# configurations that can allow, ignore, and reject invites from users and
# servers broadly.
#
# Requires a supporting client to set up on an account.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4155
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4155
#msc4155 = false
# MSC4174: Web push
#
# Adds server-side support for web push, allowing web clients to receive
# push notifications directly without the need for an intermediary push
# gateway like Sygnal.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4174
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4174
#msc4174 = false
# MSC4406: `M_SENDER_IGNORED` error code
#
# Introduces a new error code that explicitly informs clients the reason
# they cannot access an event if it is sent by an ignored user. Without
# this proposal, clients will simply get a "not found" or "forbidden"
# error when requesting events sent by users that have been ignored, which
# leads to replies being shown as "this message could not be found".
# The new error code allows clients to distinguish unknown/forbidden
# events from ignored senders, allowing them to display an error message
# like "you have blocked this sender" instead.
#
# Requires a supporting client to be useful.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4406
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4406
#msc4406 = false
# MSC4484: Server Administration OAuth Scope
#
# Adds a new OAuth2 scope that explicitly grants a token temporary
# homeserver administrator privileges, granting temporary token access
# to administrator endpoints like locking & suspension.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4484
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4484
#msc4484 = false
# MSC4494: Membership-based invite blocking
#
# Adds a new invite blocking action that will reject all invites coming
# from users who do not share a room with the invitee that is not `public`
# (the join rule).
#
# This is not related to MSC4155, this proposal instead builds on the
# "invite blocking" proposal that landed in the specification in v1.17,
# which simply allows enabling or disabling invites altogether.
#
# MSC4494 is a good middle-ground between the allowlisting possible with
# MSC4155, and the general desire to block invites from users you may not
# know.
#
# Requires a supporting client to enable on an account.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4494
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4494
#msc4494 = false
# MSC4560: Stripped state requests over federation
#
# Implements a more efficient way for servers to acquire and serve
# "stripped state" to clients, which is typically only used for displaying
# rooms. The display of space hierarchies and room summaries is
# significantly faster when this proposal is enabled and used.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/4560
#
# env: CONTINUWUITY_EXPERIMENTS__MSC4560
#msc4560 = false
#[global.experiments.msc2815]
# MSC2815: Proposal to allow room moderators to view redacted event content
#
# Allows the server to retain unredacted copies of events that have been
# redacted for a limited period of time, which allows room moderators and
# server administrators to reveal redacted contents. Useful for moderation
# and investigating reports.
#
# Requires a supporting client to use.
#
# https://github.com/matrix-org/matrix-spec-proposals/pull/2815
# Whether to enable MSC2815.
#
# env: CONTINUWUITY_EXPERIMENTS__MSC2815__ENABLED
#enabled = false
# How long, in seconds, to retain the original content of redacted
# events before it is permanently erased. Defaults to 90 days.
#
# env: CONTINUWUITY_EXPERIMENTS__MSC2815__UNREDACTED_CONTENT_MAX_AGE_SECS
#unredacted_content_max_age_secs = 7776000
+2 -2
View File
@@ -50,7 +50,7 @@ EOF
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.26.1
ENV BINSTALL_VERSION=1.27.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
@@ -192,7 +192,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
jq -r ".target_directory"))
mkdir /out/sbin
PACKAGE=conduwuit
CARGO_LOG=debug xx-cargo build --locked --profile ${RUST_PROFILE} \
xx-cargo build --locked --profile ${RUST_PROFILE} \
--no-default-features --features ${CARGO_FEATURES} \
-p $PACKAGE;
BINARIES=($(cargo metadata --no-deps --format-version 1 | \
+1 -1
View File
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.26.1
ENV BINSTALL_VERSION=1.27.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
+3 -1
View File
@@ -4,7 +4,7 @@ Continuwuity comes with an internal database for user authentication, which it u
## Registration
Registration is disabled by default. To enable it, set `allow_registration = true` in your config file and use at least one of the registration methods below.
The following registration methods are available for Continuwuity:
| Method | Description | Additional configuration needed |
| ------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
@@ -19,6 +19,8 @@ Admin-issued tokens are the recommended registration method. These tokens are we
Other registration methods are meant for **untrusted, public registration**. Care must be taken when allowing these modes of operation.
If you wish to disable registration entirely, set `allow_registration = false` in your config file.
## Email configuration
Continuwuity can be configured to send emails via an SMTP relay of your choice. These are used for verifying user email addresses and sending password reset links to them.
+9 -5
View File
@@ -2,12 +2,16 @@
Matrix supports two types of calls:
- Element Call powered by [MatrixRTC](https://half-shot.github.io/msc-crafter/#msc/4143) and [LiveKit](https://github.com/livekit/livekit)
- Legacy calls, supported by a STUN/TURN server.
- [MatrixRTC][MSC4143] calls, powered by [LiveKit][livekit-server-github] and frontends such as [Element Call][element-call].
- Legacy 1-to-1 calls, supported by a STUN/TURN server.
Both types of calls are supported by different sets of clients, but most clients are moving towards MatrixRTC / Element Call.
[MSC4143]: https://github.com/matrix-org/matrix-spec-proposals/pull/4143
[element-call-github]: https://github.com/element-hq/element-call/
[livekit-server-github]: https://github.com/livekit/livekit
Both types of calls are supported by different sets of clients, but most clients are moving towards MatrixRTC.
For either one to work correctly, you have to do some additional setup:
- For legacy calls to work, you need to set up a TURN/STUN server. [Read the TURN guide for tips on how to set up coturn](./calls/turn.mdx)
- For MatrixRTC / Element Call to work, you have to set up the LiveKit backend. LiveKit also uses TURN/STUN to increase reliability - you can set up its built-in TURN server, or integrate with an existing one. [Read the LiveKit guide](./calls/livekit.mdx)
- For legacy calls to work, you need to set up a TURN/STUN server. [Read the TURN guide for instructions on how to set up coturn](./calls/turn.mdx)
- For MatrixRTC calls to work, you have to set up the LiveKit backend, and optionally configure a TURN server for increased reliability. [Read the LiveKit guide](./calls/livekit.mdx)
+86 -23
View File
@@ -1,13 +1,15 @@
import { Tab, Tabs} from '@rspress/core/theme';
import { Tab, Tabs } from '@rspress/core/theme';
# MatrixRTC/Element Call Setup
# MatrixRTC/LiveKit Setup
This guide assumes that you are using docker compose for deployment.
This guide assumes that you are using `docker compose` for deployment.
:::tip
You can find help setting up MatrixRTC in our dedicated room - [#matrixrtc:continuwuity.org](https://matrix.to/#/%23matrixrtc%3Acontinuwuity.org)
You can find help setting up MatrixRTC in our support room - [`#continuwuity:continuwuity.org`][support-room]
:::
[support-room]: https://matrix.to/#/%23continuwuity:continuwuity.org
## Instructions
### 1. Set up your domain
@@ -58,7 +60,9 @@ services:
- ./livekit.yaml:/etc/livekit.yaml:ro
network_mode: "host" # /!\ LiveKit binds to all addresses by default.
# Make sure port 7880 is blocked by your firewall to prevent access bypassing your reverse proxy
# Alternatively, uncomment the lines below and comment `network_mode: "host"` above to specify port mappings.
# Alternatively, uncomment the lines below and comment out `network_mode: "host"`
# above to use bridge networking and manually specify port mappings.
# ports:
# - "127.0.0.1:7880:7880/tcp"
# - "7881:7881/tcp"
@@ -218,7 +222,9 @@ Start up the services using your usual method - for example `docker compose up -
## Testing
To test that LiveKit is successfully integrated with Continuwuity, you will need to replicate its [Token Exchange Flow](https://github.com/element-hq/lk-jwt-service#%EF%B8%8F-how-it-works--token-exchange-flow). Follow the steps below while checking Docker logs (`docker compose logs --follow`), in order to help [troubleshooting](#troubleshooting) any issues.
To test that LiveKit is successfully integrated with Continuwuity, you will need to replicate its [Token Exchange Flow][token-exchange-flow]. Follow the steps below while checking Docker logs (`docker compose logs --follow`), in order to help [troubleshooting](#troubleshooting) any issues.
[token-exchange-flow]: https://github.com/element-hq/lk-jwt-service/tree/v0.6.0#%EF%B8%8F-how-it-works--token-exchange-flow
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].
@@ -279,7 +285,7 @@ You can then send this payload to the lk-jwt-service:
curl -X POST -d @payload.json https://livekit.example.com/get_token
```
The lk-jwt-service will, after checking against Continuwuity, answer with a `jwt` token to create a LiveKit media room:
The lk-jwt-service will, after checking against Continuwuity, answer with a `jwt` token to [create a LiveKit media room](#livekit-cli):
```json
{"url":"wss://livekit.example.com","jwt":"a_really_really_long_string"}
@@ -293,13 +299,20 @@ Use this token to test at the [LiveKit Connection Tester][livekit-connection-tes
To debug any issues, you can place a call or redo the Testing instructions, and check the container logs for any specific errors. Use `docker compose logs --follow` to follow these logs in real-time.
Before debugging, ensure the following prerequisites:
- The user has permissions to send call events into the room. See the Appendix section on [call modes](#call-modes) for more details.
- WebRTC is enabled, if using a browser client.
### 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 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
- `MISSING_MATRIX_RTC_FOCUS`/`MISSING_MATRIX_RTC_TRANSPORT`: the client cannot find a suitable SFU. This is likely due to LiveKit being missing from Continuwuity's config file, and therefore not being exposed properly.
For browser-based clients, you can also inspect connections using DevTools' Networking tab, to see which requests are erroring out.
- `OPEN_ID_ERROR`: Your client can reach out to `lk-jwt-service`, but `lk-jwt-service` has problems authenticating you against Continuwuity. In this case, check `lk-jwt-service` logs for more details. The section below on [Docker loopback networking issues](#docker-loopback-networking-issues) may be of help.
- Calls fail to start with `ServerUnreachable` error: a LiveKit URL has been properly configured and exposed in Continuwuity, but the client cannot connect to it for some reason.
For browser-based clients, you can inspect connections using DevTools' Networking tab, to see which requests are erroring out. You may also want to toggle on Element Call's Developer tab via _Settings > Preferences > Developer mode_ \- various call details and advanced settings can be further tweaked there.
### Docker loopback networking issues
@@ -312,9 +325,9 @@ docker run --rm --net container:lk-jwt-service docker.io/curlimages/curl https:/
To resolve this, follow the steps in [Docker loopback networking issues](../troubleshooting.mdx#docker-loopback-networking-issues) of the Troubleshooting page.
### Incorrect IP address for LiveKit
### Incorrect IP addresses for LiveKit
By default, LiveKit automatically finds its public IP address(es), which can be seen in the "Establishing WebRTC connection" section of the connection test page. If these IPs are incorrect, you may want to hardcode your own IP by doing the following:
By default, LiveKit automatically finds its public IP address(es), which are 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:
```diff
### in your livekit.yaml ###
@@ -325,20 +338,21 @@ rtc:
+ node_ip: "1.2.3.4"
```
### Workaround for non-federating servers
Run the LiveKit tests again, and the new updated `node_ip` should be included as one of the candidates.
When deploying on servers with federation disabled (`allow_federation = false`), LiveKit will fail as it can't fetch the required [OpenID endpoint](https://spec.matrix.org/v1.17/server-server-api/#get_matrixfederationv1openiduserinfo) via federation paths.
You may further restrict the advertised address to only the `node_ip` with the following configurations:
As a workaround, you can enable federation, but forbid all remote servers via the following config parameters:
```toml
### in your continuwuity.toml file ###
allow_federation = true
forbidden_remote_server_names = [".*"]
```diff
### in your livekit.yaml ###
rtc:
# ... other configs here ...
+ enable_loopback_candidate: false
+ interfaces:
+ includes: []
+ ips:
+ includes: [ "1.2.3.4/32" ]
```
Subscribe to issue [!1440](https://forgejo.ellis.link/continuwuation/continuwuity/issues/1440) for future updates on this matter.
## Related Documentation
Guides:
@@ -359,9 +373,15 @@ Specifications:
- [MSC4143: MatrixRTC \- Real-time communication over Matrix][MSC4143]
- [MSC4195: MatrixRTC Transport using LiveKit Backend][MSC4195]
- [MSC3401: Native Group VoIP Signalling][MSC3401] - state events for legacy calls
- [MSC4075: MatrixRTC invites and notifications][MSC4075] - for ringing users
- [MSC4354: Sticky Events][MSC4354] - for MatrixRTC 2.0 calls
[MSC4143]: https://github.com/matrix-org/matrix-spec-proposals/pull/4143
[MSC4195]: https://github.com/matrix-org/matrix-spec-proposals/pull/4195
[MSC3401]: https://github.com/matrix-org/matrix-spec-proposals/pull/3401
[MSC4075]: https://github.com/matrix-org/matrix-spec-proposals/pull/4075
[MSC4354]: https://github.com/matrix-org/matrix-spec-proposals/pull/4354
Source code:
@@ -381,6 +401,47 @@ Other:
## Appendix
### MatrixRTC calling modes and enabling sticky events {#call-modes}
MatrixRTC currently supports 3 calling modes:
- **Legacy mode** (deprecated): calls are established by sending state events to a room. The call initiator's SFU hosts the entire call for all remote and local participants.
- **Compatibility mode*: same as Legacy mode, but utilizes multiple SFUs between federating servers. Clients publish media streams to their own SFUs, and fetch remote streams from remote SFUs. This is the most commonly used mode nowadays.
- **MatrixRTC 2.0 mode**: also utilizes multiple SFUs, but establishes calls with [sticky events] instead of state events.
To support Legacy and Compatibility mode, ensure that the user is allowed to send the relevant state events. Usually, this means promoting them to a power level of 50 or above. Alternatively, set the power level required to send `org.matrix.msc3401.call.member` events to 0.
To support MatrixRTC 2.0 mode, sticky events has to be enabled on the Matrix server. In Continuwuity, this is as easy as setting `enable_sticky_events = true` in the config file.
### Creating LiveKit tokens via `livekit-cli` {#livekit-cli}
To create room tokens directly without going through `lk-jwt-service`, use the [Livekit CLI tool][livekit-cli].
<Tabs groupId="livekit">
<Tab label="Bare Binary">
First, download the [release tarball][livekit-cli-releases] and extract it. Then:
```sh
./lk --url https://livekit.example.com \
--api-key APIUxUnMnSkuFWV \
--api-secret t93ZVjPeoEdyx7Wbet3kG4L3NGZIZVEFvqe0UuiVc22A \
token create --create --join
```
</Tab>
<Tab label="Docker">
```sh
docker run --rm docker.io/livekit/livekit-cli --url https://livekit.example.com \
--api-key APIUxUnMnSkuFWV \
--api-secret t93ZVjPeoEdyx7Wbet3kG4L3NGZIZVEFvqe0UuiVc22A \
token create --create --join
```
</Tab>
</Tabs>
[livekit-cli]: https://github.com/livekit/livekit-cli
[livekit-cli-releases]: https://github.com/livekit/livekit-cli
### Additional TURN-over-TLS on 443 configuration
Most of the time, LiveKit [**does not need TURN**][sspaeth-matrix-voip-turn] to function. However, there are situations where clients may be unable to use nonstandard ports or UDP connections, such as in highly restrictive networks. In such cases, a TURN-over-TLS server on port 443 could relay traffic for the clients.
@@ -487,6 +548,8 @@ Then configure LiveKit, making sure to replace `COTURN_SECRET` with the one you
### in your livekit.yaml ###
rtc:
# ... other configs here ...
stun_servers:
- coturn.example.com
turn_servers:
- host: coturn.example.com
port: 443
+5 -4
View File
@@ -1,16 +1,17 @@
# Setting up TURN/STUN
[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.
[TURN][turn] and [STUN][stun] are used as components in many calling systems. Matrix uses them directly for legacy 1-to-1 calls and indirectly to assist MatrixRTC calls 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)
You can find help setting up TURN/STUN in our support room - [`#continuwuity:continuwuity.org`][support-room]
:::
[turn]: https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT
[stun]: https://en.wikipedia.org/wiki/STUN
[coturn]: https://github.com/coturn/coturn
[support-room]: https://matrix.to/#/%23continuwuity:continuwuity.org
## Installing coturn
@@ -348,7 +349,7 @@ After configuration and spin-up, the destination `turns:turn.example.com:443?tra
<summary>Using static credentials</summary>
:::caution
Static credentials are less secure than shared secrets because they don't expire and must be configured in coturn separately. It is strongly advised you use [shared secret authentication](#2-configuration).
Static credentials are less secure than shared secrets because they don't expire and must be configured in coturn separately. It is strongly advised you use [shared secret authentication](#2-configuring-coturn).
:::
If you prefer static username/password credentials instead of shared secrets:
+1 -1
View File
@@ -101,7 +101,7 @@ After Continuwuity is up and running, consider the following:
- See the [**Authentication chapter**](./authentication.mdx) for various ways to access to your homeserver, such as logging in with an external OIDC provider.
- Consult the [**Maintenance**](./maintenance.mdx) page for guidance on maintaining your homeserver.
- Consult the [**Maintenance**](./maintenance.mdx) page for guidance on backups, moderation, and other topics for homeserver management.
- If you want to set up an appservice, take a look at the [**Appservice Guide**](./appservices.mdx).
+8 -2
View File
@@ -2,10 +2,16 @@
Continuwuity is available in the [`archlinuxcn`][archlinuxcn] repository and AUR with the same package name, [`continuwuity`][aur-continuwuity].
The development version is available on the AUR as [`continuwuity-git`][aur-continuwuity-git].
For instructions on adding the archlinuxcn repo to your machine, see the [archlinuxcn README][archlinuxcn-readme] page. For AUR instructions, consult its [entry][aur-archwiki] on the Arch Wiki.
The development version, which tracks latest commits to the main branch, is also available on the AUR as [`continuwuity-git`][aur-continuwuity-git].
[archlinuxcn]: https://www.archlinuxcn.org/
[archlinuxcn-readme]: https://github.com/archlinuxcn/repo#usage
[aur-archwiki]: https://wiki.archlinux.org/title/Arch_User_Repository
[aur-continuwuity]: https://aur.archlinux.org/packages/continuwuity
[aur-continuwuity-git]: https://aur.archlinux.org/packages/continuwuity-git
Simply install the `continuwuity` package. Configure the service in `/etc/conduwuit/conduwuit.toml`, then enable and start the `continuwuity.service`.
Once you're done configuring your repos, simply install the `continuwuity` package with `pacman -S continuwuity`. Consult the [generic deployment instructions](./generic.mdx) for detailed steps, which involves editing `/etc/conduwuit/conduwuit.toml` and setting up a reverse proxy. Finally, enable and start the `continuwuity.service`.
After successfully setting up Continuwuity, navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
+3 -3
View File
@@ -69,7 +69,7 @@ Docker's default DNS resolver is known to [**cause timeout issues**](../troubles
```yaml title='docker-compose.yml'
services:
homeserver:
continuwuity:
# ...
volumes:
- ./continuwuity-resolv.conf:/etc/resolv.conf
@@ -95,7 +95,7 @@ Then, create a Caddyfile with the following content:
```
https://example.com:443, https://example.com:8448 {
reverse_proxy http://homeserver:8008
reverse_proxy http://continuwuity:8008
}
```
@@ -297,7 +297,7 @@ For Docker Compose deployments this means adding `stdin_open: true` and `tty: tr
```yaml
services:
homeserver:
continuwuity:
stdin_open: true
tty: true
# ...
+2 -2
View File
@@ -246,8 +246,8 @@ to the `#admin:example.com` room and be able to [issue admin commands](../refere
To check if your server can communicate with other homeservers,
use an external testing tool:
- [Matrix Connectivity Tester](https://federationtester.mtrnord.blog/)
- [Matrix Federation Tester](https://federationtester.matrix.org/)
- [Matrix Connectivity Tester](https://federationtester.mtrnord.blog/) by MTRNord (recommended, with more tests).
- [Matrix Federation Tester](https://federationtester.matrix.org/) by f0x.
If you can register your account but cannot join federated rooms, check your configuration
and verify that your federation endpoints are opened and forwarded correctly.
+17 -9
View File
@@ -1,11 +1,11 @@
# Continuwuity for Kubernetes
Continuwuity doesn't support horizontal scalability or distributed loading
natively. However, a deployment in Kubernetes is very similar to the docker
setup. This is because Continuwuity can be fully configured using environment
variables. A sample StatefulSet is shared below. The only thing missing is
natively. However, a deployment in Kubernetes is very similar to the [docker setup](./docker.mdx).
This is because Continuwuity can be fully configured using environment
variables. A sample `StatefulSet` is shared below. The only thing missing is
a PVC definition (named `continuwuity-data`) for the volume mounted to
the StatefulSet, an Ingress resources to point your webserver to the
the `StatefulSet`, an Ingress resources to point your webserver to the
Continuwuity Pods, and a Service resource (targeting `app.kubernetes.io/name: continuwuity`)
to glue the Ingress and Pod together.
@@ -103,10 +103,18 @@ spec:
---
Apart from manually configuring the containers,
[a community-maintained Helm Chart is available here to run
conduwuit on Kubernetes](https://gitlab.cronce.io/charts/conduwuit)
## Community maintained Helm Chart
This should be compatible with Continuwuity, but you will need to change the image reference.
Apart from manually configuring the containers, you can consult
a community-maintained Helm Chart for the former `conduwuit` project,
which is available [here][community-helm-chart].
If changes need to be made, please reach out to the maintainer, as this is not maintained or controlled by the Continuwuity maintainers.
[community-helm-chart]: https://gitlab.cronce.io/charts/conduwuit
This should be compatible with Continuwuity, but you will need to switch the image reference.
If changes are needed to be made, please reach out to the maintainer of that repository, as it is not maintained nor controlled by the Continuwuity maintainers.
## Post-installation
After successfully setting up your Continuwuity, navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
+14 -1
View File
@@ -31,7 +31,14 @@ services.matrix-continuwuity = {
# address and port are handled automatically
# You can add any further configuration here, e.g.
# trusted_servers = [ "matrix.org" ];
# trusted_servers = [ "matrix.org" ];
## (if using well-known delegation)
# well_known = {
# client = "https://matrix.example.com";
# server = "matrix.example.com:443";
# }
};
};
};
@@ -79,3 +86,9 @@ client = "https://matrix.example.com"
You'll need to set up a reverse proxy (like NGINX or Caddy) to expose Continuwuity to the internet. You can configure your reverse proxy using NixOS options (e.g. `services.caddy`).
See the [reverse proxy setup guide](./generic.mdx#setting-up-the-reverse-proxy) for information on correct reverse proxy configuration.
Then, test that your setup works by following these [instructions](./generic.mdx#how-do-i-know-it-works).
## What's next?
Navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
+4 -1
View File
@@ -12,11 +12,14 @@ Install Git, Rust, Docker, Go, and `jq`. From this repository's root, build the
server image and run the suite:
```bash
cargo build -p conduwuit
cargo build -p conduwuit --features openreg
docker build -t continuwuity:complement -f docker/complement.Dockerfile .
./bin/complement
```
The `openreg` feature is required: without it the server refuses the open
registrations Complement uses to create test users, and almost every test fails.
The run can take up to an hour. The runner writes the full Go test stream to
`tests/test_results/complement/test_logs.jsonl` and a sorted pass/fail/skip
summary to `tests/test_results/complement/test_results.jsonl`. It exits nonzero
+105
View File
@@ -0,0 +1,105 @@
# Unstable features policy
Like several other homeservers in the Matrix ecosystem, Continuwuity adopts a "disable by default"
approach to experimental features. This ensures every deployment gets the same baseline stability,
allowing users to opt in to potentially unstable features.
Historically, Continuwuity used maintainer discretion to decide whether an unstable feature should
be enabled by default. However, as the project has grown, and the pace of spec development has
increased, keeping up with unstable proposals becomes less and less feasible by the day, and this
causes the implementation of unstable proposals to gradually drift. This can lead to implementations
becoming so stale they're incompatible, with no bandwidth to get them fixed up.
Continuwuity is already selective about which unstable features it implements: the maintainer team
typically only accept implementations of proposals that seem like they are a net positive for a
large portion of the Matrix ecosystem, rather than aiming to "implement everything". As such, the
unstable feature list should typically be small and manageable.
**All** unstable proposals require an experiment before their implementation can be accepted.
Likewise, all experiments should default to being disabled, requiring explicit configuration to
enable.
**Draft proposals** will not be merged until their proposal is undrafted. Likewise, the pull request
that implements the draft proposal should itself be marked "WIP", to avoid being merged or
prioritised for review. Review is still possible for WIP PRs, so feel free to request a round of
feedback.
## Adding an unstable feature
First, navigate to `src/core/config/experiments.rs`. There, you have two options for adding an
experiment to the `Experiments` struct:
1. Use `SimpleExperiment` if the experiment only requires enabling with no further configuration.
2. Define a new struct that implements the `ToggledExperiment` trait.
All experiments must be optional and default to off (i.e. `is_enabled()` returns `false`).
`SimpleExperiment` is actually a wrapper around `Option<bool>`, and the omission of the
configuration OR setting it to `false` disables the experiment. `ToggledExperiment` impls should
copy similar behaviour.
Then, add a public field to the `Experiments` struct that is named the MSC's ID in lowercase.
Add a docstring to it, starting with the proposal title (including ID), then a brief paragraph or
so explaining what the proposal does in simple terms, and then finally end the docstring with a link
to the proposal.
### Advertising support for unstable features
If the proposal requires advertising an unstable feature flag, that flag must be added to
`unstable_features` in `src/core/matrix/versions.rs`. For example:
```diff
pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
BTreeMap::from_iter([
// Always enabled feature (https://github.com/matrix-org/matrix-spec-proposals/pull/0000)
// Expected for spec v1.20
("org.matrix.msc0000".to_owned(), true),
+ // MSC9999: My Cool Feature (https://github.com/matrix-org/matrix-spec-proposals/pull/9999)
+ ("example.matrix.msc9999".to_owned(), experiments.msc9999.is_enabled())
])
}
```
This will allow the `/_matrix/client/versions` endpoint to dynamically advertise whether the unstable
feature is enabled on the current server.
## Removing unstable features
If a proposal is abandoned, becomes obsolete, or is accepted into the specification, the unstable
configuration should be removed (and possibly migrated) as soon as possible.
After removing a field from `experiments`, the key should be added to the `DEPRECATED_KEYS` slice in
`src/core/config/mod.rs` (really far down). This will ensure that a warning is printed on startup
when a configuration is using a now-removed config key. For example:
```diff
pub struct Experiments {
- pub msc9999: SimpleExperiment,
}
```
```diff
const DEPRECATED_KEYS: &[&str] = [
"foo",
+ "experiments.msc9999",
];
```
## Always-on experiments
Some experiments can be forcefully enabled (i.e. always-on), or enabled by default. This should only
be the case in exceptional circumstances, and must be adequately well documented. Some examples of
situations that may warrant an experiment being always-enabled:
* A proposal was implemented AFTER it was merged, but BEFORE it had a merged spec PR.
These proposals are typically as stable as they'll get, as major changes post-factum of an MSC
merge requires another MSC, so only minor changes can be made in the spec PR phase.
* The daily experience of users would be at a great detriment without the experiment being enabled.
* A proposal is so simple that making it opt-in would be pointless. This is *incredibly* rare.
The latter two require explicit maintainer approval, so discuss those with the maintainer team
first. You can exercise your own judgement for the first.
Always-on or enabled-by-default experiments must explain in detail why they're exempt from the
standard experiments policy via comments in surrounding areas, like
`src/core/config/experiments.rs` and `src/core/matrix/versions.rs`. Ideally, these features are not
unstable for too long, so explaining a timescale for how long before the feature is stabilised is
also helpful.
+2 -2
View File
@@ -226,10 +226,10 @@ The following Compose files are taken from [Docker deployment instructions](../d
```txt title="Caddyfile"
https://matrix.example.com:443 {
reverse_proxy http://homeserver:8008
reverse_proxy http://continuwuity:8008
}
https://example.com:443 {
reverse_proxy /.well-known/matrix* http://homeserver:8008
reverse_proxy /.well-known/matrix* http://continuwuity:8008
}
```
+1 -1
View File
@@ -37,7 +37,7 @@ networks:
- subnet: "10.10.10.0/24"
services:
homeserver:
continuwuity:
# ...
volume:
- ./continuwuity-resolv.conf:/etc/resolv.conf:ro
+15 -19
View File
@@ -82,6 +82,21 @@ Consult these documents for more information on compression tuning and levels:
## Other tweaks
### Tuning your trusted servers
:::important Important: Vet your trusted servers!
Trusted servers are your first point of contact when obtaining public keys from the wider federated network. They could theoretically impersonate other servers and cause significant harm to your deployment. Please thoroughly verify your trusted servers' credibility before adding them to your configuration.
If you need suggestions for trusted servers, ask in the Continuwuity support room.
:::
For performance and reliability, it is recommended to set up 3 to 5 trusted servers for your deployment. Currently, these must all be Synapse servers.
```toml
# Example config, using maintainers' recommended homeservers
trusted_servers = ["codestorm.net","starstruck.systems","unredacted.org","matrix.org"]
```
### Using UNIX sockets
If your homeserver and reverse proxy live on the same machine, you may wish to expose Continuwuity on a UNIX socket instead of a port. This removes TCP overhead between the two programs.
@@ -111,25 +126,6 @@ https://matrix.example.com {
</details>
### Tuning your trusted servers
:::important Important: Vet your trusted servers!
Trusted servers are your first point of contact when obtaining public keys from other servers, and they could theoretically impersonate other servers and cause significant harm to your deployment. Please thoroughly verify your trusted servers' credibility before adding them to your configuration.
If you need suggestions for trusted servers, ask in the Continuwuity main room.
:::
Trusted servers are queried sequentially in the order they are listed. If you have multiple trusted servers configured, put the faster ones first:
```toml
# Example config, using maintainers' recommended homeservers
trusted_servers = ["codestorm.net","starstruck.systems","unredacted.org","matrix.org"]
```
Avoid prioritising `matrix.org` as your primary trusted server, as it tends to be quite slow.
Some users have also reported that increasing `trusted_server_batch_size` helps with faster joins for huge rooms. Start with doubling the default to `2048` until you find a suitable value.
### Enable HTTP/3 on your reverse proxy
Consider enabling the newer **HTTP/3** protocol for inbound connections to Continuwuity. In Caddy HTTP/3 is allowed by default, but you must expose port :443/**udp** on your firewall.
+6 -4
View File
@@ -78,9 +78,9 @@ To debug and test your UnifiedPush installation, use the [UP-Example] app for An
### UnifiedPush and push gateways
The push gateway URL is usually pre-configured by the client app. However, some clients (such as Element X) implement UnifiedPush's [Gateway Discovery] mechanism, and attempt to detect a push gateway _on the same domain as the push provider_, before falling back to a hardcoded one.
Normally, the push gateway URL is pre-configured by the client app. However, some clients (such as Element X) implement UnifiedPush's [Gateway Discovery] mechanism, and attempt to detect a push gateway _on the same domain as the push provider_ to use before falling back to a hardcoded one. Users of these clients can therefore self-host their own push gateway.
Per the [spec][spec-push-gateway-api], these push gateways must be available on the `/_matrix/push/v1/notify` path of said domain. To test that a push gateway is accessible to the homeserver, make a request for it from the homeserver's IP:
Per the [spec][spec-push-gateway-api], these push gateways must be available on the `/_matrix/push/v1/notify` path of said domain. To test that a push gateway is usable, make a request to it from both the homeserver and the client. The returned response should look like the following:
```txt
curl https://push.example.com/_matrix/push/v1/notify
@@ -122,7 +122,7 @@ Community tutorials for selfhosting some of these stacks are listed below. Unles
- Push gateway: [common-proxies]
- Push server: [ejabberd's mod_unified_push]
- Push app: [Conversations] (and forks)
- [Element X push notifications via Conversations][alfredolin-xmpp], by Alfredo Lin.
- [Element X push notifications via Conversations][alfredolin-xmpp], by Alfredolin.
- Push gateway: [common-proxies]
- Push server: [Prosody's mod_unified_push]
- Push app: [Conversations]
@@ -156,6 +156,8 @@ WARN conduwuit_service::pusher: Pusher URL is a forbidden remote address url=htt
To fix this, remove your push gateway or push server's address from `ip_range_denylist`, and restart Continuwuity to apply the changes.
Docker deployments with the push server/gateway on the same host as Continuwuity may run into some further network issues. In this case, consult the [Docker loopback networking issues] section and its workarounds.
### Push notifications not audible/not displaying
This is likely an issue with your account's _push rules_, which determines which events are shown to to the user as notifications. Check these push rules in the client's notifications settings and tweak accordingly. Continuwuity also provides an [`!admin users reset-push-rules`](../reference/admin/users#admin-users-reset-push-rules) command, which restores the rules to the default of notifying for every message.
@@ -175,7 +177,7 @@ If you find spurious log entries like this in your Continuwuity deployment:
WARN push{user_id="@user:example.com" pushkey="very-long-string-of-letters" events=1}:send_push_notice:send_notice:send_request: conduwuit_service::pusher: Could not send request to pusher https//push.example.com: error sending request for url (https://push.example.com/_matrix/push/v1/notify)
```
Then, your server is most likely sending push requests to too many invalid targets. This could be due to one of the following reasons:
Then, your server is sending push requests to too many invalid targets. This could be due to one of the following reasons:
#### Connection issues between the server and the push gateway
+1 -1
View File
@@ -17,7 +17,7 @@ Continuwuity has moderation admin commands for:
- fetching `/.well-known/matrix/support` from servers (`!admin federation`)
- blocking incoming federation for certain rooms (not the same as room banning)
(`!admin federation`)
- deleting media (see [the media section](#media))
- deleting media
Any commands with `-list` in them will require a codeblock in the message with
each object being newline delimited. An example of doing this is:
@@ -1,7 +1,7 @@
# Continuwuity - Behind Traefik Reverse Proxy
services:
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -16,9 +16,9 @@ services:
restart: unless-stopped
labels:
caddy: example.com
caddy.reverse_proxy: /.well-known/matrix/* homeserver:8008
caddy.reverse_proxy: /.well-known/matrix/* continuwuity:8008
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -14,7 +14,7 @@ services:
- ./Caddyfile:/etc/caddy/Caddyfile
restart: unless-stopped
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -1,7 +1,7 @@
# Continuwuity - With Traefik Reverse Proxy
services:
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -37,7 +37,7 @@ services:
# 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
# caddy.reverse_proxy: /.well-known/matrix/* continuwuity:8008
# If you are having problems with continuwuity serving headers,
# uncomment the header section below.
@@ -48,7 +48,7 @@ services:
# caddy.0_header.Access-Control-Allow-Headers: "Authorization"
# caddy.0_header.Content-Type: "application/json"
homeserver:
continuwuity:
image: forgejo.ellis.link/continuwuation/continuwuity:latest
restart: unless-stopped
# add additional environment, volume, and network config here...
@@ -1,7 +1,7 @@
# Continuwuity - Behind Traefik Reverse Proxy
services:
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -1,7 +1,7 @@
# Continuwuity - Traefik Reverse Proxy Labels (override file)
services:
homeserver:
continuwuity:
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy" # Change this to the name of your Traefik docker proxy network
@@ -15,7 +15,7 @@ services:
- ./caddy-data:/data
restart: unless-stopped
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -15,7 +15,7 @@ services:
- ./Caddyfile:/etc/caddy/Caddyfile
restart: unless-stopped
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
@@ -1,7 +1,7 @@
# Continuwuity - With Traefik Reverse Proxy
services:
homeserver:
continuwuity:
image: "forgejo.ellis.link/continuwuation/continuwuity:latest"
restart: unless-stopped
command: /sbin/conduwuit
Generated
+24 -24
View File
@@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1789329924,
"narHash": "sha256-mykGMFabQ7yP6G373M3VHkrac9PJPKJstrhQz2D/Rdc=",
"lastModified": 1793979272,
"narHash": "sha256-oUcBtPbtS7PlEMuSrgTAN4wv49cXYbwKbQqhH2pah5w=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "455fd4bac659b5f1fca3810661c2d8b3c25dad05",
"rev": "309392b18f6b17022f82c701f300433126901068",
"type": "github"
},
"original": {
@@ -18,11 +18,11 @@
},
"crane": {
"locked": {
"lastModified": 1788465171,
"narHash": "sha256-Y1/TTVXjYXGF068IThQH9fPSZ0SIE74PABlUxnWTUH0=",
"lastModified": 1793836618,
"narHash": "sha256-TREenflwEjxOSq292FYwbc3kEm7TDRtXCZRNWEdjBmg=",
"owner": "ipetkov",
"repo": "crane",
"rev": "eb35abda9f232cc6610b1d1e3200d15c49b7ac54",
"rev": "79fd63528501446749c09f08cad486a58c7d173e",
"type": "github"
},
"original": {
@@ -39,11 +39,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1789298866,
"narHash": "sha256-6eaV5+MdWy1tAlN4HAFr64pTnYc9jiKGXBsu18cyVjE=",
"lastModified": 1794142885,
"narHash": "sha256-xWFSr7q8IerDAVRk4W7/CgTmi05hMy2qjZ0z3VYpOVk=",
"owner": "nix-community",
"repo": "fenix",
"rev": "1fc6f36a23fa16e3740987957266f6e4b915c3cd",
"rev": "f7d416b5073152c7f2e4de1a28d1a4330dd30a26",
"type": "github"
},
"original": {
@@ -74,11 +74,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1788450739,
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
"lastModified": 1793576659,
"narHash": "sha256-V1h85lUaJBQoHFrB2vpXZOE0Ju1MYSnIpsehoVZYlDo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
"rev": "ea2630b7470978622c7689a1ff75d2b389175399",
"type": "github"
},
"original": {
@@ -89,11 +89,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1789149629,
"narHash": "sha256-H6GwaZzZf+4npqv0tph94w9tZddSjFjmQrVsW0z78uk=",
"lastModified": 1794042290,
"narHash": "sha256-ziZn2PvCJE5JEEpqTdxXwJpPB+L3YqoCpTAMCzyaP3U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eaad089433ca2bb662274377d33df3d0e51ef28b",
"rev": "f4a03c008967841f2a0b3cb7c436fc6fc31671f6",
"type": "github"
},
"original": {
@@ -105,11 +105,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1788057806,
"narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=",
"lastModified": 1793504054,
"narHash": "sha256-ThkfL3D/FhCiZFc9+3BtxwuMmpuK+/bGtXCSo1+yVew=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c",
"rev": "7851ba61fd862b277cb6a9cef37394bc18bb94e4",
"type": "github"
},
"original": {
@@ -132,11 +132,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1789128286,
"narHash": "sha256-KRxxgHiKIBp7R2n41IJuE5K4IUiLOpg47EEi3AxuSp8=",
"lastModified": 1794096810,
"narHash": "sha256-dWC+YtMX+cwH3e9ndiFB77ijTsKtO5I2OxfcvUY4j3k=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "6aeeb8cf02741e5da07a1615a05faa506cecb21a",
"rev": "03ae6be57aa063bb373f69eead3b8e15168a45d2",
"type": "github"
},
"original": {
@@ -153,11 +153,11 @@
]
},
"locked": {
"lastModified": 1786901030,
"narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
"lastModified": 1791885023,
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
"type": "github"
},
"original": {
+6 -13
View File
@@ -42,7 +42,12 @@ let
env = {
CARGO_PROFILE = profile;
RUSTFLAGS = rustflags;
# Rust links with its bundled rust-lld by default on linux-gnu targets.
# This bypasses nixpkgs' linker wrapper (and its rpaths), so we make it use the system one.
# `-C linker-features=-lld` is only stable on x86_64, but cc takes the last `-fuse-ld`.
RUSTFLAGS = lib.concatStringsSep " " (
lib.optional stdenv.hostPlatform.isLinux "-C link-arg=-fuse-ld=bfd" ++ [ rustflags ]
);
GIT_COMMIT_HASH = self.rev or self.dirtyRev or "";
GIT_COMMIT_HASH_SHORT = self.shortRev or self.dirtyShortRev or "";
}
@@ -60,18 +65,6 @@ craneLib.buildPackage (
inherit cargoExtraArgs;
cargoArtifacts = craneLib.buildDepsOnly attrs;
# Needed to make continuwuity link to rocksdb
postFixup = lib.optionalString (stdenv.hostPlatform.isLinux && rocksdb != null) ''
old_rpath="$(patchelf --print-rpath $out/bin/conduwuit)"
extra_rpath="${
lib.makeLibraryPath [
rocksdb
]
}"
patchelf --set-rpath "$old_rpath:$extra_rpath" $out/bin/conduwuit
'';
meta = {
description = "A community-driven Matrix homeserver in Rust";
mainProgram = "conduwuit";
+19
View File
@@ -18,6 +18,23 @@
{
packages =
let
# These musl deps aren't in the binary cache, so they're built locally, and their
# test suites run (and break) when the builder can execute musl binaries.
#
# TODO: drop tzdata override once https://github.com/NixOS/nixpkgs/pull/582577 reaches nixos-unstable
# - tzdata: `now.ck` checks against the current date.
# TODO: drop sqlite override once https://github.com/NixOS/nixpkgs/issues/580629 is resolved
# - sqlite: its test runner fails to build `testfixture` when cross-compiling to musl.
muslOverlay =
_final: prev:
lib.genAttrs [ "tzdata" "sqlite" ] (
name:
if prev.stdenv.hostPlatform.isMusl then
prev.${name}.overrideAttrs { doCheck = false; }
else
prev.${name}
);
mkPackages =
pkgs:
let
@@ -78,6 +95,7 @@
import inputs.nixpkgs {
localSystem = system;
crossSystem = "x86_64-unknown-linux-musl";
overlays = [ muslOverlay ];
}
)
))
@@ -86,6 +104,7 @@
import inputs.nixpkgs {
localSystem = system;
crossSystem = "aarch64-unknown-linux-musl";
overlays = [ muslOverlay ];
}
)
));
+3 -3
View File
@@ -18,13 +18,13 @@
inherit enableJemalloc;
}).overrideAttrs
({
version = "continuwuity-v0.5.0-unstable-2026-05-19";
version = "continuwuity-v0.5.0-unstable-2026-11-08";
src = fetchFromGitea {
domain = "forgejo.ellis.link";
owner = "continuwuation";
repo = "rocksdb";
rev = "3756b2b905e13216d8b56bcc783d814e7b073aff";
hash = "sha256-rSv4fr2bf9JJwdodgeuPCuceeh7k97KVxrAOC0wyPQY=";
rev = "722fa3219df4169610fda8962221a1ff74026fdb";
hash = "sha256-ZuXXp83Hgj0B5v499CNxa9oNQUS/ZKYOAZEhmarUifc=";
};
# We have this already at https://forgejo.ellis.link/continuwuation/rocksdb/commit/a935c0273e1ba44eacf88ce3685a9b9831486155
+373 -336
View File
File diff suppressed because it is too large. Load diff
+3
View File
@@ -11,6 +11,7 @@ export default defineConfig({
light: '/assets/logo.svg',
dark: '/assets/logo.svg',
},
llms: false,
// Use `.no-zoom` class to disable image zooms
mediumZoom: {
selector: '.rspress-doc :not(.no-zoom *) > img',
@@ -40,7 +41,9 @@ export default defineConfig({
},
},
},
webMcp: false,
themeConfig: {
llmsUI: false,
socialLinks: [
{
icon: {
-3
View File
@@ -62,8 +62,6 @@ release_max_log_level = [
"conduwuit-service/release_max_log_level",
"tracing/max_level_trace",
"tracing/release_max_level_info",
"log/max_level_trace",
"log/release_max_level_info",
]
zstd_compression = [
"conduwuit-api/zstd_compression",
@@ -84,7 +82,6 @@ ctor.workspace = true
dtor.workspace = true
futures.workspace = true
lettre.workspace = true
log.workspace = true
ruma.workspace = true
serde_json.workspace = true
serde-saphyr.workspace = true
+2 -1
View File
@@ -983,7 +983,8 @@ impl crate::Context<'_> {
let resolver: &MatrixResolver = if no_cache {
&MatrixResolverBuilder::new()
.dangerous_tls_accept_invalid_certs(self.services.server.config.allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure)
.http_client(self.services.client.dns.clone())
.http_client(self.services.client.matrix_http_client.clone())
.dns_resolver(self.services.client.dns_resolver.clone())
.build()?
} else {
&self.services.client.matrix_resolver
-3
View File
@@ -51,8 +51,6 @@ jemalloc_stats = [
release_max_log_level = [
"conduwuit-core/release_max_log_level",
"conduwuit-service/release_max_log_level",
"log/max_level_trace",
"log/release_max_level_info",
"tracing/max_level_trace",
"tracing/release_max_level_info",
]
@@ -80,7 +78,6 @@ http-body-util.workspace = true
hyper.workspace = true
itertools.workspace = true
lettre.workspace = true
log.workspace = true
rand.workspace = true
reqwest.workspace = true
ruma.workspace = true
+10 -4
View File
@@ -1,7 +1,7 @@
use std::collections::{BTreeMap, BTreeSet};
use axum::extract::State;
use conduwuit::{Result, Server};
use conduwuit::{Result, Server, config::experiments::ToggledExperiment};
use ruma::{
RoomVersionId,
api::{
@@ -53,8 +53,11 @@ pub(crate) async fn get_capabilities_route(
capabilities.account_moderation.lock = true;
capabilities.account_moderation.suspend = true;
capabilities.admin =
AdminCapability::new(BTreeSet::from_iter([OAuthClientScope::ServerAdministration]));
if services.config.experiments.msc4484.is_enabled() {
capabilities.admin = AdminCapability::new(BTreeSet::from_iter([
OAuthClientScope::ServerAdministration,
]));
}
}
capabilities.profile_fields = Some(
@@ -63,7 +66,10 @@ pub(crate) async fn get_capabilities_route(
capabilities.set(
"org.matrix.msc4174.webpush",
json!({ "enabled": true, "vapid": services.pusher.webpush_vapid_public_key() }),
json!({
"enabled": services.config.experiments.msc4174.is_enabled(),
"vapid": services.pusher.webpush_vapid_public_key()
}),
)?;
Ok(get_capabilities::v3::Response::new(capabilities))
+4 -4
View File
@@ -3,10 +3,10 @@ use conduwuit::{Err, Result, at};
use futures::StreamExt;
use ruma::{
api::client::dehydrated_device::{
delete_dehydrated_device::unstable as delete_dehydrated_device,
get_dehydrated_device::unstable as get_dehydrated_device,
get_events::unstable as get_events,
put_dehydrated_device::unstable as put_dehydrated_device,
delete_dehydrated_device::msc3814 as delete_dehydrated_device,
get_dehydrated_device::msc3814 as get_dehydrated_device,
get_events::msc3814 as get_events,
put_dehydrated_device::msc3814 as put_dehydrated_device,
},
assign,
};
+18 -3
View File
@@ -523,7 +523,22 @@ where
for (server, response) in futures {
match response {
| Ok(response) => {
for (user, master_key) in response.master_keys {
let is_wanted = |user_id: &UserId| {
user_id.server_name() == server && device_keys_input.contains_key(user_id)
};
let filtered_master_keys = response
.master_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
let filtered_self_signing_keys = response
.self_signing_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
let filtered_device_keys = response
.device_keys
.into_iter()
.filter(|(user_id, _)| is_wanted(user_id));
for (user, master_key) in filtered_master_keys {
let (master_key_id, mut master_key) = parse_master_key(&user, &master_key)?;
if let Ok(our_master_key) = services
@@ -549,8 +564,8 @@ where
}
}
self_signing_keys.extend(response.self_signing_keys);
device_keys.extend(response.device_keys);
self_signing_keys.extend(filtered_self_signing_keys);
device_keys.extend(filtered_device_keys);
},
| Err(e) => {
failures.insert(server.to_string(), json!({ "error": e.to_string() }));
+2 -2
View File
@@ -30,9 +30,9 @@ pub(crate) async fn get_media_config_route(
State(services): State<crate::State>,
_body: Ruma<get_media_config::v1::Request>,
) -> Result<get_media_config::v1::Response> {
Ok(get_media_config::v1::Response::new(ruma_from_usize(
Ok(get_media_config::v1::Response::new(Some(ruma_from_usize(
services.server.config.max_request_size,
)))
))))
}
/// # `POST /_matrix/media/v3/upload`
-398
View File
@@ -1,398 +0,0 @@
#![allow(deprecated)]
use axum::extract::State;
use conduwuit::{
Err, Result, err,
utils::{content_disposition::make_content_disposition, math::ruma_from_usize},
};
use conduwuit_service::media::{CORP_CROSS_ORIGIN, Dim, FileMeta};
use reqwest::Url;
use ruma::{
api::client::media::{
create_content, get_content, get_content_as_filename, get_content_thumbnail,
get_media_config, get_media_preview,
},
assign,
};
use service::media::mxc::Mxc;
use crate::{Ruma, RumaResponse, client::create_content_route};
/// # `GET /_matrix/media/v3/config`
///
/// Returns max upload size.
pub(crate) async fn get_media_config_legacy_route(
State(services): State<crate::State>,
_body: Ruma<get_media_config::v3::Request>,
) -> Result<get_media_config::v3::Response> {
Ok(get_media_config::v3::Response::new(ruma_from_usize(
services.server.config.max_request_size,
)))
}
/// # `GET /_matrix/media/v1/config`
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// Returns max upload size.
pub(crate) async fn get_media_config_legacy_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_media_config::v3::Request>,
) -> Result<RumaResponse<get_media_config::v3::Response>> {
get_media_config_legacy_route(State(services), body)
.await
.map(RumaResponse)
}
/// # `GET /_matrix/media/v3/preview_url`
///
/// Returns URL preview.
pub(crate) async fn get_media_preview_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_media_preview::v3::Request>,
) -> Result<get_media_preview::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
let url = &body.url;
let url = Url::parse(&body.url).map_err(|e| {
err!(Request(InvalidParam(
debug_warn!(%sender_user, %url, "Requested URL is not valid: {e}")
)))
})?;
if !services.media.url_preview_allowed(&url) {
return Err!(Request(Forbidden(
debug_warn!(%sender_user, %url, "URL is not allowed to be previewed")
)));
}
let preview = services.media.get_url_preview(&url).await.map_err(|e| {
err!(Request(Unknown(
debug_error!(%sender_user, %url, "Failed to fetch a URL preview: {e}")
)))
})?;
serde_json::value::to_raw_value(&preview)
.map(get_media_preview::v3::Response::from_raw_value)
.map_err(|error| {
err!(Request(Unknown(
debug_error!(%sender_user, %url, "Failed to parse URL preview: {error}")
)))
})
}
/// # `GET /_matrix/media/v1/preview_url`
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// Returns URL preview.
pub(crate) async fn get_media_preview_legacy_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_media_preview::v3::Request>,
) -> Result<RumaResponse<get_media_preview::v3::Response>> {
get_media_preview_legacy_route(State(services), body)
.await
.map(RumaResponse)
}
/// # `POST /_matrix/media/v1/upload`
///
/// Permanently save media in the server.
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// - Some metadata will be saved in the database
/// - Media will be saved in the media/ directory
pub(crate) async fn create_content_legacy_route(
State(services): State<crate::State>,
body: Ruma<create_content::v3::Request>,
) -> Result<RumaResponse<create_content::v3::Response>> {
create_content_route(State(services), body)
.await
.map(RumaResponse)
}
/// # `GET /_matrix/media/v3/download/{serverName}/{mediaId}`
///
/// Load media from our server or over federation.
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content::v3::Request>,
) -> Result<get_content::v3::Response> {
let mxc = Mxc {
server_name: &body.server_name,
media_id: &body.media_id,
};
match services.media.get(&mxc).await? {
| Some(FileMeta {
content,
content_type,
content_disposition,
}) => {
let content_disposition = make_content_disposition(
content_disposition.as_ref(),
content_type.as_deref(),
None,
);
Ok(assign!(
get_content::v3::Response::new(
content.expect("entire file contents"),
content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.into()),
}
))
},
| _ =>
if !services.globals.server_is_ours(&body.server_name) && body.allow_remote {
let response = services
.media
.fetch_remote_content_legacy(&mxc, body.allow_redirect, body.timeout_ms)
.await
.map_err(|e| {
err!(Request(NotFound(debug_warn!(%mxc, "Fetching media failed: {e:?}"))))
})?;
let content_disposition = make_content_disposition(
response.content_disposition.as_ref(),
response.content_type.as_deref(),
None,
);
Ok(assign!(
get_content::v3::Response::new(
response.file,
response.content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.into()),
}
))
} else {
Err!(Request(NotFound("Media not found.")))
},
}
}
/// # `GET /_matrix/media/v1/download/{serverName}/{mediaId}`
///
/// Load media from our server or over federation.
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_legacy_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content::v3::Request>,
) -> Result<RumaResponse<get_content::v3::Response>> {
get_content_legacy_route(State(services), body)
.await
.map(RumaResponse)
}
/// # `GET /_matrix/media/v3/download/{serverName}/{mediaId}/{fileName}`
///
/// Load media from our server or over federation, permitting desired filename.
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_as_filename_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content_as_filename::v3::Request>,
) -> Result<get_content_as_filename::v3::Response> {
let mxc = Mxc {
server_name: &body.server_name,
media_id: &body.media_id,
};
match services.media.get(&mxc).await? {
| Some(FileMeta {
content,
content_type,
content_disposition,
}) => {
let content_disposition = make_content_disposition(
content_disposition.as_ref(),
content_type.as_deref(),
Some(&body.filename),
);
Ok(assign!(get_content_as_filename::v3::Response::new(
content.expect("entire file contents"),
content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.into()),
}
))
},
| _ =>
if !services.globals.server_is_ours(&body.server_name) && body.allow_remote {
let response = services
.media
.fetch_remote_content_legacy(&mxc, body.allow_redirect, body.timeout_ms)
.await
.map_err(|e| {
err!(Request(NotFound(debug_warn!(%mxc, "Fetching media failed: {e:?}"))))
})?;
let content_disposition = make_content_disposition(
response.content_disposition.as_ref(),
response.content_type.as_deref(),
None,
);
Ok(assign!(
get_content_as_filename::v3::Response::new(
response.file,
response.content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.into()),
}
))
} else {
Err!(Request(NotFound("Media not found.")))
},
}
}
/// # `GET /_matrix/media/v1/download/{serverName}/{mediaId}/{fileName}`
///
/// Load media from our server or over federation, permitting desired filename.
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_as_filename_legacy_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content_as_filename::v3::Request>,
) -> Result<RumaResponse<get_content_as_filename::v3::Response>> {
get_content_as_filename_legacy_route(State(services), body)
.await
.map(RumaResponse)
}
/// # `GET /_matrix/media/v3/thumbnail/{serverName}/{mediaId}`
///
/// Load media thumbnail from our server or over federation.
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_thumbnail_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content_thumbnail::v3::Request>,
) -> Result<get_content_thumbnail::v3::Response> {
let mxc = Mxc {
server_name: &body.server_name,
media_id: &body.media_id,
};
let dim = Dim::from_ruma(body.width, body.height, body.method.clone())?;
match services.media.get_thumbnail(&mxc, &dim).await? {
| Some(FileMeta {
content,
content_type,
content_disposition,
}) => {
let content_disposition = make_content_disposition(
content_disposition.as_ref(),
content_type.as_deref(),
None,
);
Ok(assign!(
get_content_thumbnail::v3::Response::new(
content.expect("entire file contents"),
content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.to_owned()),
}
))
},
| _ =>
if !services.globals.server_is_ours(&body.server_name) && body.allow_remote {
let response = services
.media
.fetch_remote_thumbnail_legacy(&body)
.await
.map_err(|e| {
err!(Request(NotFound(debug_warn!(%mxc, "Fetching media failed: {e:?}"))))
})?;
let content_disposition = make_content_disposition(
response.content_disposition.as_ref(),
response.content_type.as_deref(),
None,
);
Ok(assign!(
get_content_thumbnail::v3::Response::new(
response.file,
response.content_type.unwrap_or_default(),
content_disposition,
),
{
cross_origin_resource_policy: Some(CORP_CROSS_ORIGIN.to_owned()),
}
))
} else {
Err!(Request(NotFound("Media not found.")))
},
}
}
/// # `GET /_matrix/media/v1/thumbnail/{serverName}/{mediaId}`
///
/// Load media thumbnail from our server or over federation.
///
/// This is a legacy endpoint ("/v1/") that some very old homeservers and/or
/// clients may call. conduwuit adds these for compatibility purposes.
/// See <https://spec.matrix.org/legacy/legacy/#id27>
///
/// - Only allows federation if `allow_remote` is true
/// - Only redirects if `allow_redirect` is true
/// - Uses client-provided `timeout_ms` if available, else defaults to 20
/// seconds
pub(crate) async fn get_content_thumbnail_legacy_legacy_route(
State(services): State<crate::State>,
body: Ruma<get_content_thumbnail::v3::Request>,
) -> Result<RumaResponse<get_content_thumbnail::v3::Response>> {
get_content_thumbnail_legacy_route(State(services), body)
.await
.map(RumaResponse)
}
+39 -32
View File
@@ -1,6 +1,8 @@
use axum::extract::State;
use conduwuit::{
Err, Error, Result, at, debug_warn,
Err, Error, Result, at,
config::experiments::ToggledExperiment,
debug_warn,
matrix::{
event::{Event, Matches},
pdu::PduCount,
@@ -22,7 +24,7 @@ use conduwuit_service::{
};
use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture, pin_mut};
use ruma::{
RoomId, UserId,
EventId, RoomId, UserId,
api::{
Direction,
client::{filter::RoomEventFilter, message::get_message_events},
@@ -30,8 +32,9 @@ use ruma::{
},
assign,
events::{
AnyStateEvent, StateEventType,
AnyStateEvent, StateEventType, SyncEphemeralRoomEvent,
TimelineEventType::{self, *},
receipt::ReceiptEventContent,
},
serde::Raw,
};
@@ -209,36 +212,32 @@ pub(crate) async fn lazy_loading_witness<'a, I>(
where
I: Iterator<Item = &'a PdusIterItem> + Clone + Send,
{
let oldest = events
.clone()
.map(|(count, _)| count)
.copied()
.min()
.unwrap_or_else(PduCount::max);
let newest = events
.clone()
.map(|(count, _)| count)
.copied()
.max()
.unwrap_or_else(PduCount::max);
let chunk_event_ids: std::collections::HashSet<&EventId> =
events.clone().map(|(_, event)| event.event_id()).collect();
let receipts = services
.rooms
.read_receipt
.readreceipts_since(lazy_loading_context.room_id, Some(oldest.into_unsigned()));
.readreceipts_since(lazy_loading_context.room_id, None);
pin_mut!(receipts);
let receipt_users = receipts.ready_filter_map(|(user_id, _, raw)| {
let event =
serde_json::from_str::<SyncEphemeralRoomEvent<ReceiptEventContent>>(raw.json().get())
.ok()?;
event
.content
.keys()
.any(|id| chunk_event_ids.contains(&**id))
.then_some(user_id)
});
let witness: MemberSet = events
.stream()
.map(ref_at!(1))
.map(Event::sender)
.map(ToOwned::to_owned)
.chain(
receipts
.ready_take_while(|(_, c, _)| *c <= newest.into_unsigned())
.map(|(user_id, ..)| user_id),
)
.chain(receipt_users)
.collect()
.await;
@@ -318,21 +317,29 @@ where
if server_ignored {
// the sender's server is ignored, so ignore this event
return Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::new()),
"The sender's server is ignored by this server.",
));
return if services.config.experiments.msc4406.is_enabled() {
Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::new()),
"The sender's server is ignored by this server.",
))
} else {
Err!(Request(NotFound("This event's sender's homeserver is ignored by this server.")))
};
}
if user_ignored && !services.config.send_messages_from_ignored_users_to_client {
// the recipient of this PDU has the sender ignored, and we're not
// configured to send ignored messages to clients
return Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
event.sender().to_owned(),
)),
"You have ignored this sender.",
));
return if services.config.experiments.msc4406.is_enabled() {
Err(Error::BadRequest(
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
event.sender().to_owned(),
)),
"You have ignored this sender.",
))
} else {
Err!(Request(NotFound("You have ignored the sender of this event.")))
};
}
Ok(false)
-2
View File
@@ -12,7 +12,6 @@ pub(super) mod directory;
pub(super) mod filter;
pub(super) mod keys;
pub(super) mod media;
pub(super) mod media_legacy;
pub(super) mod membership;
pub(super) mod message;
pub(super) mod mutual_rooms;
@@ -57,7 +56,6 @@ pub(super) use directory::*;
pub(super) use filter::*;
pub(super) use keys::*;
pub(super) use media::*;
pub(super) use media_legacy::*;
pub(super) use membership::*;
pub use membership::{leave_all_rooms, leave_room, remote_leave_room};
pub(super) use message::*;
+3 -3
View File
@@ -13,8 +13,8 @@ use crate::Ruma;
#[tracing::instrument(skip_all, name = "mutual_rooms", level = "info")]
pub(crate) async fn get_mutual_rooms_unstable_route(
State(services): State<crate::State>,
body: Ruma<get_mutual_rooms::unstable::Request>,
) -> Result<get_mutual_rooms::unstable::Response> {
body: Ruma<get_mutual_rooms::msc2666::Request>,
) -> Result<get_mutual_rooms::msc2666::Response> {
let sender_user = body.identity.expect_sender_user()?;
if sender_user == body.user_id {
@@ -28,7 +28,7 @@ pub(crate) async fn get_mutual_rooms_unstable_route(
.collect()
.await;
Ok(get_mutual_rooms::unstable::Response::new(mutual_rooms))
Ok(get_mutual_rooms::msc2666::Response::new(mutual_rooms))
}
/// # `GET /_matrix/client/v1/mutual_rooms`
+54 -38
View File
@@ -1,14 +1,14 @@
use std::collections::BTreeMap;
use axum::extract::State;
use conduwuit::{Err, PduCount, Result, err};
use conduwuit::{Err, Result, err};
use ruma::{
MilliSecondsSinceUnixEpoch,
api::client::{read_marker::set_read_marker, receipt::create_receipt},
events::{
RoomAccountDataEventType,
fully_read::{FullyReadEvent, FullyReadEventContent},
receipt::{Receipt, ReceiptEvent, ReceiptEventContent, ReceiptType},
receipt::{Receipt, ReceiptEvent, ReceiptEventContent, ReceiptThread, ReceiptType},
},
};
@@ -27,6 +27,15 @@ pub(crate) async fn set_read_marker_route(
) -> Result<set_read_marker::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
if !services
.rooms
.state_cache
.is_joined(sender_user, &body.room_id)
.await
{
return Err!(Request(Forbidden("You are not in this room.")));
}
if let Some(event) = &body.fully_read {
let fully_read_event = FullyReadEvent::new(FullyReadEventContent::new(event.to_owned()));
@@ -92,13 +101,8 @@ pub(crate) async fn set_read_marker_route(
.timeline
.get_pdu_count(event)
.await
.map_err(|_| err!(Request(NotFound("Event not found."))))?;
let PduCount::Normal(count) = count else {
return Err!(Request(InvalidParam(
"Event is a backfilled PDU and cannot be marked as read."
)));
};
.map_err(|_| err!(Request(NotFound("Event not found."))))?
.into_unsigned();
services
.rooms
@@ -122,11 +126,26 @@ pub(crate) async fn create_receipt_route(
) -> Result<create_receipt::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
if !services
.rooms
.state_cache
.is_joined(sender_user, &body.room_id)
.await
{
return Err!(Request(Forbidden("You are not in this room.")));
}
services
.users
.update_device_last_seen(sender_user, body.identity.sender_device(), client_ip)
.await;
if body.receipt_type == create_receipt::v3::ReceiptType::FullyRead
&& body.thread != ReceiptThread::Unthreaded
{
return Err!(Request(InvalidParam("thread_id cannot be specified for m.fully_read")));
}
if matches!(
&body.receipt_type,
create_receipt::v3::ReceiptType::Read | create_receipt::v3::ReceiptType::ReadPrivate
@@ -159,44 +178,41 @@ pub(crate) async fn create_receipt_route(
)
.await?;
},
| create_receipt::v3::ReceiptType::Read => {
let receipt_content = [(
body.event_id.clone(),
BTreeMap::from_iter([(
ReceiptType::Read,
| create_receipt::v3::ReceiptType::Read =>
if services.config.allow_local_read_receipts
&& !services.users.is_suspended(sender_user).await?
{
let mut receipt = Receipt::new(MilliSecondsSinceUnixEpoch::now());
receipt.thread = body.thread.clone();
let receipt_content = [(
body.event_id.clone(),
BTreeMap::from_iter([(
sender_user.to_owned(),
Receipt::new(MilliSecondsSinceUnixEpoch::now()),
ReceiptType::Read,
BTreeMap::from_iter([(sender_user.to_owned(), receipt)]),
)]),
)]),
)];
)];
services
.rooms
.read_receipt
.readreceipt_update(
sender_user,
&body.room_id,
ReceiptEvent::new(
body.room_id.clone(),
ReceiptEventContent::from_iter(receipt_content),
),
)
.await;
},
services
.rooms
.read_receipt
.readreceipt_update(
sender_user,
&body.room_id,
ReceiptEvent::new(
body.room_id.clone(),
ReceiptEventContent::from_iter(receipt_content),
),
)
.await;
},
| create_receipt::v3::ReceiptType::ReadPrivate => {
let count = services
.rooms
.timeline
.get_pdu_count(&body.event_id)
.await
.map_err(|_| err!(Request(NotFound("Event not found."))))?;
let PduCount::Normal(count) = count else {
return Err!(Request(InvalidParam(
"Event is a backfilled PDU and cannot be marked as read."
)));
};
.map_err(|_| err!(Request(NotFound("Event not found."))))?
.into_unsigned();
services
.rooms
+46 -38
View File
@@ -2,7 +2,7 @@ use axum::extract::State;
use conduwuit::{
Err, Result, at, debug_warn, err,
matrix::{Event, event::RelationTypeEqual, pdu::PduCount},
utils::{IterStream, ReadyExt, result::FlatOk, stream::WidebandExt},
utils::{IterStream, result::FlatOk, stream::WidebandExt},
};
use conduwuit_service::Services;
use futures::StreamExt;
@@ -98,6 +98,10 @@ pub(crate) async fn get_relating_events_route(
.await
}
// Spec (v1.10) recommends a depth of at least 3
const RECURSION_DEPTH: u8 = 3;
const LEVELS_BELOW: u8 = RECURSION_DEPTH - 1;
#[allow(clippy::too_many_arguments)]
async fn paginate_relations_with_filter(
services: &Services,
@@ -147,28 +151,49 @@ async fn paginate_relations_with_filter(
.unwrap_or(30)
.min(100);
// Spec (v1.10) recommends depth of at least 3
let depth: u8 = if recurse { 3 } else { 1 };
let max_depth = if recurse { LEVELS_BELOW } else { 0 };
let events: Vec<_> = services
// One more than the limit, to know whether there's another page
let mut events = services
.rooms
.pdu_metadata
.get_relations(sender_user, room_id, target, start, limit, depth, dir)
.await
.get_relations(
sender_user,
room_id,
target,
start,
limit.saturating_add(1),
max_depth,
dir,
|pdu| {
filter_event_type
.as_ref()
.is_none_or(|kind| kind == pdu.kind())
&& filter_rel_type
.as_ref()
.is_none_or(|rel_type| rel_type.relation_type_equal(pdu))
},
)
.await;
let past_to = to.and_then(|to| {
events
.iter()
.position(|(count, _)| !to.is_after(*count, dir))
});
if let Some(past_to) = past_to {
events.truncate(past_to);
}
let has_more = past_to.is_none() && events.len() > limit;
events.truncate(limit);
let next_batch =
has_more.then(|| events.last().map_or(start, |(count, _)| *count).to_string());
let chunk: Vec<_> = events
.into_iter()
.filter(|(_, pdu)| {
filter_event_type
.as_ref()
.is_none_or(|kind| kind == pdu.kind())
})
.filter(|(_, pdu)| {
filter_rel_type
.as_ref()
.is_none_or(|rel_type| rel_type.relation_type_equal(pdu))
})
.stream()
.ready_take_while(|(count, _)| Some(*count) != to)
.take(limit)
.wide_filter_map(|item| visibility_filter(services, sender_user, item))
.wide_filter_map(|item| ignored_filter(services, item, sender_user))
.then(async |mut pdu| {
@@ -182,32 +207,15 @@ async fn paginate_relations_with_filter(
}
pdu
})
.collect()
.await;
// Determine if there are more events to fetch
let has_more = events.len() >= limit;
let next_batch = if has_more {
match dir {
| Direction::Forward => events.last(),
| Direction::Backward => events.first(),
}
.map(|(count, _)| count.to_string())
} else {
None
};
let chunk: Vec<_> = events
.into_iter()
.map(at!(1))
.map(Event::into_format)
.collect();
.collect()
.await;
Ok(assign!(get_relating_events::v1::Response::new(chunk), {
next_batch,
prev_batch: from.map(Into::into),
recursion_depth: recurse.then_some(depth.into()),
recursion_depth: recurse.then_some(RECURSION_DEPTH.into()),
}))
}
+8 -2
View File
@@ -121,7 +121,10 @@ pub(crate) async fn create_room_route(
// ID exactly matches this, and abort if it doesn't. Otherwise, we use it
// as the room ID itself.
let expect_room_id = {
let body_ref = body.json_body.as_ref().unwrap();
let body_ref = body
.json_body
.as_ref()
.ok_or_else(|| err!(Request(BadJson("Invalid JSON body"))))?;
if let Some(CanonicalJsonValue::String(room_id)) = body_ref
.get("fi.mau.room_id")
.or_else(|| body_ref.get("room_id"))
@@ -302,7 +305,10 @@ pub(crate) async fn create_room_route(
// Allow requesters to override the `origin_server_ts` to customize room ids
// from v12 onwards
let custom_origin_server_ts = {
let body_ref = body.json_body.as_ref().unwrap();
let body_ref = body
.json_body
.as_ref()
.ok_or_else(|| err!(Request(BadJson("Invalid JSON body"))))?;
body_ref
.get("origin_server_ts")
.or_else(|| body_ref.get("fi.mau.origin_server_ts"))
+89 -5
View File
@@ -1,14 +1,30 @@
use axum::extract::State;
use conduwuit::{Err, Event, Result, debug_warn, err};
use ruma::api::client::room::get_room_event;
use axum::extract::{Query, State};
use conduwuit::{
Err, Error, Event, PduEvent, Result, config::experiments::ToggledExperiment, debug_warn, err,
};
use futures::TryFutureExt;
use http::StatusCode;
use ruma::{
UserId,
api::{client::room::get_room_event, error::ErrorKind},
};
use serde::Deserialize;
use serde_json::json;
use crate::{Ruma, client::is_ignored_pdu};
#[derive(Deserialize)]
pub(crate) struct Msc2815Params {
#[serde(rename = "fi.mau.msc2815.include_unredacted_content", default)]
include_unredacted_content: Option<bool>,
}
/// # `GET /_matrix/client/r0/rooms/{roomId}/event/{eventId}`
///
/// Gets a single event.
pub(crate) async fn get_room_event_route(
State(ref services): State<crate::State>,
Query(params): Query<Msc2815Params>,
ref body: Ruma<get_room_event::v3::Request>,
) -> Result<get_room_event::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
@@ -24,7 +40,7 @@ pub(crate) async fn get_room_event_route(
services.rooms.state_accessor.is_world_readable(room_id)
);
if !joined && !world_readable {
return Err!(Request(NotFound("Event {} not found.", event_id)));
return Err!(Request(NotFound("Event {event_id} not found.")));
}
services
@@ -32,10 +48,15 @@ pub(crate) async fn get_room_event_route(
.timeline
.get_remote_pdu(room_id, event_id)
.await
.map_err(|_| err!(Request(NotFound("Event {} not found.", event_id))))?
.map_err(|_| err!(Request(NotFound("Event {event_id} not found."))))?
},
| Err(e) => return Err(e),
};
if !event.room_id_or_hash().eq(room_id) {
// Return not found instead of invalid param to avoid revealing the
// existence of events the user might not be allowed to know about.
return Err!(Request(NotFound("Event {event_id} not found.")));
}
// NOTE: checked after fetching, as visibility of an unknown event cannot
// be determined (user_can_see_event returns true for those).
@@ -49,6 +70,13 @@ pub(crate) async fn get_room_event_route(
return Err!(Request(Forbidden("You don't have permission to view this event.")));
}
if services.config.experiments.msc2815.is_enabled()
&& params.include_unredacted_content.unwrap_or(false)
&& event.is_redacted()
{
unredact(services, sender_user, &mut event).await?;
}
if let Err(e) = services
.rooms
.pdu_metadata
@@ -67,3 +95,59 @@ pub(crate) async fn get_room_event_route(
Ok(get_room_event::v3::Response::new(event.into_format()))
}
async fn unredact(services: &crate::State, sender_user: &UserId, event: &mut PduEvent) -> Result {
if !services.users.is_admin(sender_user).await {
let power_levels = services
.rooms
.state_accessor
.get_room_power_levels(&event.room_id_or_hash())
.await;
if power_levels.for_user(sender_user) < power_levels.redact {
return Err!(Request(Forbidden(
"You don't have permission to view redacted content in this room."
)));
}
}
let content = services
.rooms
.timeline
.get_pdu_id(event.event_id())
.and_then(async |pdu_id| {
services
.rooms
.timeline
.get_unredacted_content(&pdu_id)
.await
})
.await;
let Ok(content) = content else {
// CustomErrorKind has private fields; only serde can build one.
let keep_ms = services
.config
.experiments
.msc2815
.expect("msc2815 config is disabled but unredact() attempted to access it anyway")
.unredacted_content_max_age_secs
.saturating_mul(1000);
let kind = serde_json::from_value::<ErrorKind>(json!({
"errcode": "FI.MAU.MSC2815_UNREDACTED_CONTENT_DELETED",
"fi.mau.msc2815.content_keep_ms": keep_ms,
}))
.expect("errcode is a valid custom error kind");
return Err(Error::Request(
kind,
"The unredacted content of this event is not available.".into(),
StatusCode::NOT_FOUND,
));
};
event.content = content;
Ok(())
}
+4 -4
View File
@@ -15,11 +15,11 @@ use crate::{Ruma, router::ClientIdentity};
#[tracing::instrument(skip_all, name = "stripped_state", level = "info")]
pub(crate) async fn get_stripped_state_route(
State(services): State<crate::State>,
body: Ruma<get_stripped_state::unstable::Request>,
) -> Result<get_stripped_state::unstable::Response> {
body: Ruma<get_stripped_state::msc4560::Request>,
) -> Result<get_stripped_state::msc4560::Response> {
let user_id = body.identity.as_ref().and_then(ClientIdentity::sender_user);
if body.via.len() > get_stripped_state::unstable::MAX_VIAS {
if body.via.len() > get_stripped_state::msc4560::MAX_VIAS {
return Err!(Request(TooLarge("Too many vias, please be less indecisive.")));
}
@@ -59,7 +59,7 @@ pub(crate) async fn get_stripped_state_route(
via,
RoomStrippedState { state, num_joined_members, .. },
)) => Ok(
assign!(get_stripped_state::unstable::Response::new(via), { state, num_joined_members }),
assign!(get_stripped_state::msc4560::Response::new(via), { state, num_joined_members }),
),
| Accessibility::Inaccessible => {
Err!(Request(Forbidden("You may not request this room's stripped state.")))
+1 -1
View File
@@ -39,7 +39,7 @@ pub(crate) async fn get_room_summary(
Err!(Request(Forbidden("You may not preview this room."), FORBIDDEN))
},
| Accessibility::NotFound => {
Err!(Request(Forbidden("This room does not exist."), FORBIDDEN))
Err!(Request(NotFound("This room does not exist.")))
},
}
}
+1 -6
View File
@@ -95,12 +95,7 @@ pub(crate) async fn send_message_event_route(
PartialPdu {
event_type: body.event_type.clone().into(),
content,
sticky: services
.config
.allow_sticky_events
.then_some(body.sticky_duration_ms)
.flatten()
.map(sticky::object),
sticky: body.sticky_duration_ms.map(sticky::object),
unsigned: Some(unsigned),
timestamp: if body.identity.is_appservice()
|| services.admin.user_is_admin(sender_user).await
+8 -7
View File
@@ -15,7 +15,7 @@ use conduwuit::{
},
warn,
};
use conduwuit_service::Services;
use conduwuit_service::{Services, rooms::read_receipt::pack_receipts};
use futures::{
FutureExt, StreamExt, TryFutureExt,
future::{OptionFuture, join, join3, join4, try_join, try_join3},
@@ -243,9 +243,14 @@ async fn build_ephemeral(
let (receipt_events, typing_event, private_read_event) =
join3(receipt_events, typing_event, private_read_event).await;
let mut edus = receipt_events;
let mut all_receipts = receipt_events;
all_receipts.extend(private_read_event);
let mut edus = Vec::new();
if !all_receipts.is_empty() {
edus.push(pack_receipts(all_receipts.into_iter()).cast());
}
edus.extend(typing_event);
edus.extend(private_read_event);
Ok(assign!(Ephemeral::new(), { events: edus }))
}
@@ -268,10 +273,6 @@ async fn build_sticky_events(
timeline: &TimelinePdus,
joined_since_last_sync: bool,
) -> Sticky {
if !services.config.allow_sticky_events {
return Sticky::new();
}
let SyncContext {
syncing_user,
last_sync_end_count,
+127 -129
View File
@@ -24,7 +24,7 @@ use conduwuit::{
use conduwuit_service::{
Services,
rooms::read_receipt::pack_receipts,
sync::{SnakeConnectionsKey, into_snake_key},
sync::{SnakeConnectionsKey, StickyDelivered, into_snake_key},
};
use futures::{
FutureExt, StreamExt, TryFutureExt,
@@ -34,7 +34,7 @@ use futures::{
use ruma::{
DeviceId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, RoomId, UInt, UserId,
api::client::sync::sync_events::{
self, DeviceLists, UnreadNotificationsCount, v5::request::ExtensionRoomConfig,
self, DeviceLists, UnreadNotificationsCount, msc4186::request::ExtensionRoomConfig,
},
assign,
directory::RoomTypeFilter,
@@ -63,7 +63,7 @@ use crate::{
client_ip::ClientIp,
};
type SyncInfo<'a> = (&'a UserId, &'a DeviceId, u64, &'a sync_events::v5::Request);
type SyncInfo<'a> = (&'a UserId, &'a DeviceId, u64, &'a sync_events::msc4186::Request);
type TodoRooms = BTreeMap<OwnedRoomId, (BTreeSet<TypeStateKey>, usize, u64)>;
type KnownRooms = BTreeMap<String, BTreeMap<OwnedRoomId, u64>>;
type KnownRoomUpdates = BTreeMap<String, BTreeSet<OwnedRoomId>>;
@@ -86,8 +86,9 @@ fn num_live_events<'a>(
}
struct SyncCollection {
response: sync_events::v5::Response,
response: sync_events::msc4186::Response,
known_room_updates: KnownRoomUpdates,
sticky_delivered: StickyDelivered,
}
/// `POST /_matrix/client/unstable/org.matrix.simplified_msc3575/sync`
@@ -103,8 +104,8 @@ struct SyncCollection {
pub(crate) async fn sync_events_v5_route(
State(ref services): State<crate::State>,
ClientIp(client_ip): ClientIp, // NOTE: Required for updating device metadata
body: Ruma<sync_events::v5::Request>,
) -> Result<sync_events::v5::Response> {
body: Ruma<sync_events::msc4186::Request>,
) -> Result<sync_events::msc4186::Response> {
let sender_user = body.identity.expect_sender_user()?;
let sender_device = body.identity.expect_sender_device()?;
@@ -142,7 +143,7 @@ pub(crate) async fn sync_events_v5_route(
}
// Get sticky parameters from cache
let known_rooms =
let (known_rooms, sticky_delivered) =
services
.sync
.update_snake_sync_request_with_cache(&snake_key, globalsince, &mut body);
@@ -155,6 +156,7 @@ pub(crate) async fn sync_events_v5_route(
&body,
globalsince,
&known_rooms,
&sticky_delivered,
)
.await?;
@@ -173,6 +175,7 @@ pub(crate) async fn sync_events_v5_route(
&body,
globalsince,
&known_rooms,
&sticky_delivered,
)
.await?;
}
@@ -202,13 +205,13 @@ async fn collect_sync_response(
services: &Services,
sender_user: &UserId,
sender_device: &DeviceId,
body: &sync_events::v5::Request,
body: &sync_events::msc4186::Request,
globalsince: u64,
known_rooms: &KnownRooms,
sticky_delivered: &StickyDelivered,
) -> Result<SyncCollection> {
// Bounds every read below and becomes the `pos` returned to the client.
// Zero would be echoed back as a request for an initial sync.
let next_batch = services.globals.current_count()?.max(1);
let next_batch = services.globals.next_count()?;
let all_joined_rooms = services
.rooms
@@ -262,7 +265,6 @@ async fn collect_sync_response(
let pos = next_batch.to_string();
let mut todo_rooms: TodoRooms = BTreeMap::new();
let mut sticky_rooms = BTreeSet::new();
let sync_info: SyncInfo<'_> = (sender_user, sender_device, globalsince, body);
@@ -277,16 +279,16 @@ async fn collect_sync_response(
let (account_data, e2ee, to_device, receipts) =
try_join4(account_data, e2ee, to_device, receipts).await?;
let extensions = assign!(sync_events::v5::response::Extensions::default(), {
let extensions = assign!(sync_events::msc4186::response::Extensions::default(), {
account_data,
e2ee,
to_device,
receipts,
typing: sync_events::v5::response::Typing::default(),
sticky_events: sync_events::v5::response::StickyEvents::default(),
typing: sync_events::msc4186::response::Typing::default(),
sticky_events: sync_events::msc4186::response::StickyEvents::default(),
});
let mut response = assign!(sync_events::v5::Response::new(pos), {
let mut response = assign!(sync_events::msc4186::Response::new(pos), {
txn_id: body.txn_id.clone(),
lists: BTreeMap::new(),
rooms: BTreeMap::new(),
@@ -319,7 +321,6 @@ async fn collect_sync_response(
all_rooms,
&direct_rooms,
&mut todo_rooms,
&mut sticky_rooms,
known_rooms,
&mut response,
)
@@ -329,7 +330,6 @@ async fn collect_sync_response(
"subscriptions".to_owned(),
fetch_subscriptions(services, body, known_rooms, &allowed_rooms, &mut todo_rooms).await,
);
sticky_rooms.extend(body.room_subscriptions.keys().cloned());
let mut timeline_event_ids = BTreeSet::new();
response.rooms = process_rooms(
@@ -346,25 +346,31 @@ async fn collect_sync_response(
)
.await?;
response.extensions.sticky_events = collect_sticky_events(
let (sticky_events, sticky_delivered) = collect_sticky_events(
services,
sender_user,
body,
&sticky_rooms,
next_batch,
sticky_delivered,
&known_room_updates,
&joined_room_ids,
&todo_rooms,
&timeline_event_ids,
)
.await?;
.await;
response.extensions.sticky_events = sticky_events;
response.extensions.typing =
collect_typing_events(services, sender_user, body, &todo_rooms, &known_room_updates)
.await?;
Ok(SyncCollection { response, known_room_updates })
Ok(SyncCollection {
response,
known_room_updates,
sticky_delivered,
})
}
fn response_is_empty(response: &sync_events::v5::Response) -> bool {
fn response_is_empty(response: &sync_events::msc4186::Response) -> bool {
let no_account_data = response.extensions.account_data.global.is_empty()
&& response
.extensions
@@ -395,7 +401,7 @@ async fn commit_sync_collection(
services: &Services,
sender_user: &UserId,
sender_device: &DeviceId,
body: &sync_events::v5::Request,
body: &sync_events::msc4186::Request,
globalsince: u64,
snake_key: &SnakeConnectionsKey,
collection: &SyncCollection,
@@ -408,9 +414,10 @@ async fn commit_sync_collection(
.parse()
.expect("generated sync position"),
collection.known_room_updates.clone(),
collection.sticky_delivered.clone(),
);
if body.extensions.to_device.enabled.unwrap_or(false) {
if body.extensions.to_device.enabled {
services
.users
.remove_to_device_events(sender_user, sender_device, globalsince)
@@ -420,7 +427,7 @@ async fn commit_sync_collection(
async fn fetch_subscriptions(
services: &Services,
body: &sync_events::v5::Request,
body: &sync_events::msc4186::Request,
known_rooms: &KnownRooms,
allowed_rooms: &BTreeSet<OwnedRoomId>,
todo_rooms: &mut TodoRooms,
@@ -480,15 +487,14 @@ async fn fetch_subscriptions(
async fn handle_lists<'a, Rooms, AllRooms>(
services: &Services,
sender_user: &UserId,
body: &sync_events::v5::Request,
body: &sync_events::msc4186::Request,
all_invited_rooms: Rooms,
all_joined_rooms: Rooms,
all_rooms: AllRooms,
direct_rooms: &HashSet<OwnedRoomId>,
todo_rooms: &'a mut TodoRooms,
sticky_rooms: &mut BTreeSet<OwnedRoomId>,
known_rooms: &'a KnownRooms,
response: &'_ mut sync_events::v5::Response,
response: &'_ mut sync_events::msc4186::Response,
) -> KnownRoomUpdates
where
Rooms: Iterator<Item = &'a RoomId> + Clone + Send + 'a,
@@ -579,7 +585,6 @@ where
.await;
sort_rooms_by_activity(&mut active_rooms);
let active_rooms: Vec<_> = active_rooms.into_iter().map(at!(0)).collect();
sticky_rooms.extend(active_rooms.iter().map(|room_id| (*room_id).to_owned()));
let mut new_known_rooms: BTreeSet<OwnedRoomId> = BTreeSet::new();
@@ -631,7 +636,7 @@ where
}
response.lists.insert(
list_id.clone(),
assign!(sync_events::v5::response::List::default(), {
assign!(sync_events::msc4186::response::List::default(), {
count: ruma_from_usize(active_rooms.len()),
}),
);
@@ -749,10 +754,10 @@ async fn process_rooms<'a, Rooms>(
all_invited_rooms: Rooms,
all_knocked_rooms: Rooms,
todo_rooms: &TodoRooms,
response: &mut sync_events::v5::Response,
body: &sync_events::v5::Request,
response: &mut sync_events::msc4186::Response,
body: &sync_events::msc4186::Request,
timeline_event_ids: &mut BTreeSet<OwnedEventId>,
) -> Result<BTreeMap<OwnedRoomId, sync_events::v5::response::Room>>
) -> Result<BTreeMap<OwnedRoomId, sync_events::msc4186::response::Room>>
where
Rooms: Iterator<Item = &'a RoomId> + Clone + Send + 'a,
{
@@ -787,7 +792,7 @@ where
rooms.insert(
room_id.clone(),
assign!(sync_events::v5::response::Room::new(), {
assign!(sync_events::msc4186::response::Room::new(), {
initial: Some(roomsince == &0),
invite_state,
limited: true,
@@ -821,7 +826,7 @@ where
rooms.insert(
room_id.clone(),
assign!(sync_events::v5::response::Room::new(), {
assign!(sync_events::msc4186::response::Room::new(), {
initial: Some(roomsince == &0),
invite_state: Some(knock_state),
limited: true,
@@ -988,7 +993,7 @@ where
.state_accessor
.get_member(room_id, &user_id)
.map_ok(|member_event| {
assign!(sync_events::v5::response::Hero::new(user_id.clone()), {
assign!(sync_events::msc4186::response::Hero::new(user_id.clone()), {
name: member_event.displayname,
avatar: member_event.avatar_url,
})
@@ -1032,7 +1037,7 @@ where
rooms.insert(
room_id.clone(),
assign!(sync_events::v5::response::Room::new(), {
assign!(sync_events::msc4186::response::Room::new(), {
name: services
.rooms
.state_accessor
@@ -1103,64 +1108,61 @@ where
Ok(rooms)
}
#[expect(clippy::too_many_arguments)]
async fn collect_sticky_events(
services: &Services,
sender_user: &UserId,
body: &sync_events::v5::Request,
sticky_rooms: &BTreeSet<OwnedRoomId>,
body: &sync_events::msc4186::Request,
next_batch: u64,
sticky_delivered: &StickyDelivered,
known_room_updates: &KnownRoomUpdates,
joined_room_ids: &BTreeSet<OwnedRoomId>,
todo_rooms: &TodoRooms,
timeline_event_ids: &BTreeSet<OwnedEventId>,
) -> Result<sync_events::v5::response::StickyEvents> {
if !services.config.allow_sticky_events
|| !body.extensions.sticky_events.enabled.unwrap_or(false)
{
return Ok(sync_events::v5::response::StickyEvents::default());
) -> (sync_events::msc4186::response::StickyEvents, StickyDelivered) {
let mut response = sync_events::msc4186::response::StickyEvents::default();
let mut delivered = StickyDelivered::new();
let sticky_events = &body.extensions.sticky_events;
if !sticky_events.enabled.unwrap_or(false) {
return (response, delivered);
}
let since = body
.extensions
.sticky_events
.since
.as_deref()
.and_then(|token| token.parse::<u64>().ok())
.unwrap_or(0);
let limit = body
.extensions
.sticky_events
let scope = extension_scope(
sticky_events.lists.as_deref(),
sticky_events.rooms.as_deref(),
body.lists.keys().map(String::as_str),
known_room_updates,
);
let limit = sticky_events
.limit
.map_or(DEFAULT_STICKY_LIMIT, usize_from_ruma)
.clamp(1, DEFAULT_STICKY_LIMIT);
let now = u64::from(MilliSecondsSinceUnixEpoch::now().get());
let oldest_sticky_ts = now.saturating_sub(sticky::MAX_DURATION_MS);
let mut backlog = Vec::new();
let mut stream = Vec::new();
for room_id in sticky_rooms
.iter()
.filter(|room_id| joined_room_ids.contains(*room_id))
{
// a room the client has not seen before needs its whole backlog, which
// a single stream position cannot express
let initial = todo_rooms
.get(room_id)
.is_some_and(|&(_, _, roomsince)| roomsince == 0);
for room_id in scope.intersection(joined_room_ids) {
let since = sticky_delivered.get(room_id).copied();
let mut pending = Vec::new();
let pdus = services.rooms.timeline.pdus_rev(room_id, None).ignore_err();
pin_mut!(pdus);
while let Some((count, pdu)) = pdus.next().await {
// nothing older than this can still be sticky, and on the stream we
// have already delivered everything up to `since`
if u64::from(pdu.origin_server_ts) < oldest_sticky_ts
|| (!initial && count <= PduCount::Normal(since))
{
break;
}
let PduCount::Normal(count) = count else {
continue;
};
if count > next_batch {
continue;
}
// Nothing older than this can still be sticky, and everything up to
// `since` has already been delivered
if u64::from(pdu.origin_server_ts) < oldest_sticky_ts
|| since.is_some_and(|since| count <= since)
{
break;
}
let is_sticky = pdu
.sticky
.as_deref()
@@ -1177,38 +1179,26 @@ async fn collect_sticky_events(
continue;
}
if count > since {
stream.push((count, room_id.clone(), pdu));
} else {
backlog.push((room_id.clone(), pdu));
}
pending.push((count, pdu));
}
}
stream.sort_by_key(|(count, ..)| *count);
let mut response = sync_events::v5::response::StickyEvents::default();
pending.reverse();
let truncated = pending.len() > limit;
let mut last_count = next_batch;
for (count, pdu) in pending.into_iter().take(limit) {
push_sticky_event(services, &mut response, sender_user, room_id.clone(), pdu).await;
last_count = count;
}
// MSC4480 lets us ignore the limit for a newly visible room's backlog
for (room_id, pdu) in backlog {
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
delivered.insert(room_id.clone(), if truncated { last_count } else { next_batch });
}
let mut next_batch = None;
for (count, room_id, pdu) in stream.into_iter().take(limit) {
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
next_batch = Some(count);
}
if !response.rooms.is_empty() {
response.next_batch = Some(next_batch.unwrap_or(since).to_string());
}
Ok(response)
(response, delivered)
}
async fn push_sticky_event(
services: &Services,
response: &mut sync_events::v5::response::StickyEvents,
response: &mut sync_events::msc4186::response::StickyEvents,
sender_user: &UserId,
room_id: OwnedRoomId,
mut pdu: PduEvent,
@@ -1275,12 +1265,12 @@ async fn collect_required_state(
async fn collect_typing_events(
services: &Services,
sender_user: &UserId,
body: &sync_events::v5::Request,
body: &sync_events::msc4186::Request,
todo_rooms: &TodoRooms,
known_room_updates: &KnownRoomUpdates,
) -> Result<sync_events::v5::response::Typing> {
) -> Result<sync_events::msc4186::response::Typing> {
if !body.extensions.typing.enabled.unwrap_or(false) {
return Ok(sync_events::v5::response::Typing::default());
return Ok(sync_events::msc4186::response::Typing::default());
}
let typing = &body.extensions.typing;
let scope = extension_scope(
@@ -1290,10 +1280,10 @@ async fn collect_typing_events(
known_room_updates,
);
if scope.is_empty() {
return Ok(sync_events::v5::response::Typing::default());
return Ok(sync_events::msc4186::response::Typing::default());
}
let mut typing_response = sync_events::v5::response::Typing::default();
let mut typing_response = sync_events::msc4186::response::Typing::default();
for (room_id, (_, _, roomsince)) in todo_rooms {
if !scope.contains(room_id) {
continue;
@@ -1373,12 +1363,17 @@ fn extension_scope<'a>(
async fn collect_account_data(
services: &Services,
(sender_user, _, globalsince, body): (&UserId, &DeviceId, u64, &sync_events::v5::Request),
) -> sync_events::v5::response::AccountData {
let mut account_data = sync_events::v5::response::AccountData::default();
(sender_user, _, globalsince, body): (
&UserId,
&DeviceId,
u64,
&sync_events::msc4186::Request,
),
) -> sync_events::msc4186::response::AccountData {
let mut account_data = sync_events::msc4186::response::AccountData::default();
if !body.extensions.account_data.enabled.unwrap_or(false) {
return sync_events::v5::response::AccountData::default();
return sync_events::msc4186::response::AccountData::default();
}
account_data.global = services
@@ -1413,15 +1408,15 @@ async fn collect_e2ee<'a, Rooms>(
&UserId,
&DeviceId,
u64,
&sync_events::v5::Request,
&sync_events::msc4186::Request,
),
all_joined_rooms: Rooms,
) -> Result<sync_events::v5::response::E2EE>
) -> Result<sync_events::msc4186::response::E2EE>
where
Rooms: Iterator<Item = &'a RoomId> + Send + 'a,
{
if !body.extensions.e2ee.enabled.unwrap_or(false) {
return Ok(sync_events::v5::response::E2EE::default());
if !body.extensions.e2ee.enabled {
return Ok(sync_events::msc4186::response::E2EE::default());
}
let mut left_encrypted_users = HashSet::new(); // Users that have left any encrypted rooms the sender was in
let mut device_list_changes = HashSet::new();
@@ -1608,7 +1603,7 @@ where
}
}
Ok(assign!(sync_events::v5::response::E2EE::default(), {
Ok(assign!(sync_events::msc4186::response::E2EE::default(), {
device_unused_fallback_key_types: None,
device_one_time_keys_count: services
@@ -1627,12 +1622,12 @@ async fn collect_to_device(
services: &Services,
(sender_user, sender_device, globalsince, body): SyncInfo<'_>,
next_batch: u64,
) -> Option<sync_events::v5::response::ToDevice> {
if !body.extensions.to_device.enabled.unwrap_or(false) {
) -> Option<sync_events::msc4186::response::ToDevice> {
if !body.extensions.to_device.enabled {
return None;
}
Some(assign!(sync_events::v5::response::ToDevice::default(), {
Some(assign!(sync_events::msc4186::response::ToDevice::default(), {
next_batch: next_batch.to_string(),
events: services
.users
@@ -1643,9 +1638,9 @@ async fn collect_to_device(
}))
}
async fn collect_receipts(_services: &Services) -> sync_events::v5::response::Receipts {
async fn collect_receipts(_services: &Services) -> sync_events::msc4186::response::Receipts {
// TODO: get explicitly requested read receipts
sync_events::v5::response::Receipts::default()
sync_events::msc4186::response::Receipts::default()
}
#[cfg(test)]
@@ -1658,23 +1653,25 @@ mod tests {
fn custom_room_type() -> RoomTypeFilter { RoomTypeFilter::from(Some("com.example")) }
fn response() -> sync_events::v5::Response { sync_events::v5::Response::new("1".to_owned()) }
fn response() -> sync_events::msc4186::Response {
sync_events::msc4186::Response::new("1".to_owned())
}
fn typing_scope_request() -> sync_events::v5::Request {
let mut request = sync_events::v5::Request::new();
fn typing_scope_request() -> sync_events::msc4186::Request {
let mut request = sync_events::msc4186::Request::new();
request
.lists
.insert("first".to_owned(), sync_events::v5::request::List::default());
.insert("first".to_owned(), sync_events::msc4186::request::List::default());
request
.lists
.insert("second".to_owned(), sync_events::v5::request::List::default());
.insert("second".to_owned(), sync_events::msc4186::request::List::default());
request.room_subscriptions.insert(
owned_room_id!("!subscription-a:example.com"),
sync_events::v5::request::RoomSubscription::default(),
sync_events::msc4186::request::RoomSubscription::default(),
);
request.room_subscriptions.insert(
owned_room_id!("!subscription-b:example.com"),
sync_events::v5::request::RoomSubscription::default(),
sync_events::msc4186::request::RoomSubscription::default(),
);
request
}
@@ -1768,9 +1765,10 @@ mod tests {
#[test]
fn a_room_with_no_events_is_still_empty() {
let mut response = response();
response
.rooms
.insert(owned_room_id!("!a:example.com"), sync_events::v5::response::Room::default());
response.rooms.insert(
owned_room_id!("!a:example.com"),
sync_events::msc4186::response::Room::default(),
);
assert!(response_is_empty(&response));
}
@@ -1781,7 +1779,7 @@ mod tests {
let mut response = response();
response
.rooms
.insert(room_id.to_owned(), sync_events::v5::response::Room::default());
.insert(room_id.to_owned(), sync_events::msc4186::response::Room::default());
response
.extensions
.receipts
@@ -1846,7 +1844,7 @@ mod tests {
#[test]
fn to_device_without_events_is_empty() {
let mut response = response();
response.extensions.to_device = Some(sync_events::v5::response::ToDevice::default());
response.extensions.to_device = Some(sync_events::msc4186::response::ToDevice::default());
assert!(response_is_empty(&response));
}
+1 -6
View File
@@ -27,12 +27,7 @@ pub(crate) async fn get_supported_versions_route(
State(services): State<crate::State>,
_body: Ruma<get_supported_versions::Request>,
) -> Result<get_supported_versions::Response> {
let mut unstable_features = unstable_features();
if services.config.allow_sticky_events {
// sticky events (https://github.com/matrix-org/matrix-spec-proposals/pull/4354)
unstable_features.insert("org.matrix.msc4354".to_owned(), true);
}
let unstable_features = unstable_features(&services.config.experiments);
Ok(assign!(get_supported_versions::Response::new(versions()), {
unstable_features
+3 -3
View File
@@ -43,9 +43,9 @@ pub(crate) async fn well_known_client(
/// homeserver, implementing MSC4143.
pub(crate) async fn get_rtc_transports(
State(services): State<crate::State>,
_body: Ruma<ruma::api::client::rtc::transports::v1::Request>,
) -> Result<ruma::api::client::rtc::transports::v1::Response> {
Ok(ruma::api::client::rtc::transports::v1::Response::new(
_body: Ruma<ruma::api::client::rtc::transports::msc4143::Request>,
) -> Result<ruma::api::client::rtc::transports::msc4143::Response> {
Ok(ruma::api::client::rtc::transports::msc4143::Response::new(
services.config.matrix_rtc.foci.clone(),
))
}
+25 -47
View File
@@ -8,9 +8,9 @@ use std::str::FromStr;
use axum::{
Router,
response::{IntoResponse, Redirect},
routing::{any, get, post},
routing::{any, get},
};
use conduwuit::err;
use conduwuit::{config::experiments::ToggledExperiment, err};
pub(super) use conduwuit_service::state::State;
use http::{Uri, uri};
@@ -162,10 +162,6 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::update_device_route)
.ruma_route(&client::delete_device_route)
.ruma_route(&client::delete_devices_route)
.ruma_route(&client::put_dehydrated_device_route)
.ruma_route(&client::delete_dehydrated_device_route)
.ruma_route(&client::get_dehydrated_device_route)
.ruma_route(&client::get_dehydrated_events_route)
.ruma_route(&client::get_tags_route)
.ruma_route(&client::update_tag_route)
.ruma_route(&client::delete_tag_route)
@@ -184,7 +180,6 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::get_mutual_rooms_unstable_route)
.ruma_route(&client::get_mutual_rooms_route)
.ruma_route(&client::get_room_summary)
.ruma_route(&client::get_stripped_state_route)
.ruma_route(&client::get_suspended_status)
.ruma_route(&client::put_suspended_status)
.ruma_route(&client::get_lock_status)
@@ -199,6 +194,16 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.route("/_continuwuity/server_version", get(client::continuwuity_server_version))
.ruma_route(&admin::rooms::ban::ban_room)
.ruma_route(&admin::rooms::list::list_rooms);
if config.experiments.msc3814.is_enabled() {
router = router
.ruma_route(&client::put_dehydrated_device_route)
.ruma_route(&client::delete_dehydrated_device_route)
.ruma_route(&client::get_dehydrated_device_route)
.ruma_route(&client::get_dehydrated_events_route);
}
if config.experiments.msc4560.is_enabled() {
router = router.ruma_route(&client::get_stripped_state_route);
}
if config.allow_prometheus_metrics {
router = router.route("/_continuwuity/metrics", get(client::continuwuity_metrics));
@@ -230,11 +235,13 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&server::get_keys_route)
.ruma_route(&server::claim_keys_route)
.ruma_route(&server::get_hierarchy_route)
.ruma_route(&server::get_stripped_state_route)
.ruma_route(&server::well_known_server)
.ruma_route(&server::get_content_route)
.ruma_route(&server::get_content_thumbnail_route)
.route("/_continuwuity/local_user_count", get(client::continuwuity_local_user_count));
if config.experiments.msc4560.is_enabled() {
router = router.ruma_route(&server::get_stripped_state_route);
}
} else {
router = router
.route("/_matrix/federation/{*path}", any(federation_disabled))
@@ -247,45 +254,16 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
// and other functionality will continue to work
router = router.ruma_route(&server::get_openid_userinfo_route);
if config.allow_legacy_media {
router = router
.ruma_route(&client::get_media_config_legacy_route)
.ruma_route(&client::get_media_preview_legacy_route)
.ruma_route(&client::get_content_legacy_route)
.ruma_route(&client::get_content_as_filename_legacy_route)
.ruma_route(&client::get_content_thumbnail_legacy_route)
.route("/_matrix/media/v1/config", get(client::get_media_config_legacy_legacy_route))
.route("/_matrix/media/v1/upload", post(client::create_content_legacy_route))
.route(
"/_matrix/media/v1/preview_url",
get(client::get_media_preview_legacy_legacy_route),
)
.route(
"/_matrix/media/v1/download/{server_name}/{media_id}",
get(client::get_content_legacy_legacy_route),
)
.route(
"/_matrix/media/v1/download/{server_name}/{media_id}/{file_name}",
get(client::get_content_as_filename_legacy_legacy_route),
)
.route(
"/_matrix/media/v1/thumbnail/{server_name}/{media_id}",
get(client::get_content_thumbnail_legacy_legacy_route),
);
} else {
router = router
.route("/_matrix/media/v1/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/config", any(legacy_media_disabled))
.route("/_matrix/media/v3/download/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/thumbnail/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/preview_url", any(redirect_legacy_preview))
.route("/_matrix/media/r0/config", any(legacy_media_disabled))
.route("/_matrix/media/r0/download/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/r0/thumbnail/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/r0/preview_url", any(redirect_legacy_preview));
}
router
.route("/_matrix/media/v1/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/config", any(legacy_media_disabled))
.route("/_matrix/media/v3/download/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/thumbnail/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/v3/preview_url", any(redirect_legacy_preview))
.route("/_matrix/media/r0/config", any(legacy_media_disabled))
.route("/_matrix/media/r0/download/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/r0/thumbnail/{*path}", any(legacy_media_disabled))
.route("/_matrix/media/r0/preview_url", any(redirect_legacy_preview))
}
async fn redirect_legacy_preview(uri: Uri) -> impl IntoResponse {
@@ -306,7 +284,7 @@ async fn redirect_legacy_preview(uri: Uri) -> impl IntoResponse {
}
async fn legacy_media_disabled() -> impl IntoResponse {
err!(Request(Forbidden("Unauthenticated media is disabled.")))
err!(Request(NotFound("Unauthenticated media is disabled.")))
}
async fn federation_disabled() -> impl IntoResponse {
+13 -4
View File
@@ -1,18 +1,21 @@
use std::ops::Deref;
use std::{
net::{IpAddr, Ipv4Addr},
ops::Deref,
};
use axum::{
RequestExt, RequestPartsExt,
body::Body,
extract::{FromRequest, Path, Query},
};
use conduwuit::{Error, Result, err};
use conduwuit::{Error, Result, err, error};
use ruma::{
CanonicalJsonObject,
api::{IncomingRequest, IncomingRequestExt, auth_scheme::AuthScheme},
};
use serde::Deserialize;
use crate::{State, router::auth::CheckAuth};
use crate::{State, client_ip::ClientIp, router::auth::CheckAuth};
/// Query parameters needed to authenticate requests
#[derive(Deserialize)]
@@ -87,6 +90,11 @@ where
let Path(path): Path<Vec<String>> = parts.extract().await?;
let borrowed_path: Vec<_> = path.iter().map(String::as_str).collect();
let Query(auth_query): Query<AuthQueryParams> = parts.extract().await?;
let ClientIp(ip) = parts
.extract_with_state(services)
.await
.inspect_err(|err| error!("Failed to extract client IP: {err:?}"))
.unwrap_or(ClientIp(IpAddr::V4(Ipv4Addr::UNSPECIFIED)));
// Assemble a new request from the read body and parts
let request = hyper::Request::from_parts(parts, body.as_ref());
@@ -102,7 +110,8 @@ where
})?;
let identity =
R::Authentication::check::<R>(services, &request, authentication, auth_query).await?;
R::Authentication::check::<R>(services, &request, ip, authentication, auth_query)
.await?;
// Deserialize the body
let body = R::try_from_http_request(request, &borrowed_path)
+50 -10
View File
@@ -1,10 +1,13 @@
use std::{
any::{Any, TypeId},
collections::BTreeSet,
net::IpAddr,
};
use conduwuit::{
Err, Error, Result, err,
Err, Error, Result,
config::experiments::ToggledExperiment,
err,
utils::{IterStream, millis_since_unix_epoch},
};
use http::StatusCode;
@@ -18,7 +21,10 @@ use ruma::{
AuthScheme, NoAccessToken, NoAuthentication,
},
client,
error::{ErrorKind, InsufficientUserAuthenticationErrorData, UnknownTokenErrorData},
error::{
ErrorKind, InsufficientUserAuthenticationErrorData, LimitExceededErrorData,
UnknownTokenErrorData,
},
federation::authentication::ServerSignatures,
},
assign,
@@ -90,6 +96,7 @@ pub(crate) trait CheckAuth: AuthScheme {
fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
incoming_request: &hyper::Request<&[u8]>,
request_ip: IpAddr,
authentication: Self::Output,
query: AuthQueryParams,
) -> impl Future<Output = Result<Self::Identity>> + Send;
@@ -101,6 +108,7 @@ impl CheckAuth for ServerSignatures {
async fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
incoming_request: &hyper::Request<&[u8]>,
_request_ip: IpAddr,
authentication: Self::Output,
_query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -161,6 +169,7 @@ impl CheckAuth for AccessToken {
async fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
_incoming_request: &hyper::Request<&[u8]>,
_request_ip: IpAddr,
authentication: Self::Output,
query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -181,6 +190,7 @@ impl CheckAuth for AccessTokenOptional {
async fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
_incoming_request: &hyper::Request<&[u8]>,
request_ip: IpAddr,
authentication: Self::Output,
query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -195,6 +205,10 @@ impl CheckAuth for AccessTokenOptional {
.await
.map(Some)
} else {
if R::RATE_LIMITED {
check_unauthenticated_request_ratelimiting(services, request_ip)?;
}
Ok(None)
}
}
@@ -206,6 +220,7 @@ impl CheckAuth for AppserviceToken {
async fn check<R: IncomingRequest + Any>(
services: &Services,
_incoming_request: &hyper::Request<&[u8]>,
_request_ip: IpAddr,
authentication: Self::Output,
_query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -219,6 +234,7 @@ impl CheckAuth for AppserviceTokenOptional {
async fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
_incoming_request: &hyper::Request<&[u8]>,
_request_ip: IpAddr,
authentication: Self::Output,
_query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -238,6 +254,7 @@ impl CheckAuth for NoAuthentication {
fn check<R: IncomingRequest<Authentication = Self> + Any>(
_services: &Services,
_incoming_request: &hyper::Request<&[u8]>,
_request_ip: IpAddr,
_authentication: Self::Output,
_query: AuthQueryParams,
) -> impl Future<Output = Result<Self::Identity>> + Send {
@@ -251,6 +268,7 @@ impl CheckAuth for NoAccessToken {
async fn check<R: IncomingRequest<Authentication = Self> + Any>(
services: &Services,
incoming_request: &hyper::Request<&[u8]>,
request_ip: IpAddr,
_authentication: Self::Output,
query: AuthQueryParams,
) -> Result<Self::Identity> {
@@ -267,6 +285,10 @@ impl CheckAuth for NoAccessToken {
.await
.map(Some)
} else {
if R::RATE_LIMITED {
check_unauthenticated_request_ratelimiting(services, request_ip)?;
}
Ok(None)
}
}
@@ -318,17 +340,19 @@ async fn check_access_token(
.map(Box::new);
// Make sure the user has the right scopes to use the route
let user_scopes = if let Some(session_info) = &session_info {
let mut user_scopes = if let Some(session_info) = &session_info {
session_info.scopes()
} else {
let mut scopes = BTreeSet::from_iter([OAuthClientScope::ApiFullAccess]);
if services.admin.user_is_admin(&sender_user).await {
scopes.insert(OAuthClientScope::ServerAdministration);
}
scopes
BTreeSet::from_iter([OAuthClientScope::ApiFullAccess])
};
if (!services.config.experiments.msc4484.is_enabled() || session_info.is_none())
&& services.admin.user_is_admin(&sender_user).await
{
// This is required to make sure admin APIs still work when msc4484
// is disabled.
// https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2533#issuecomment-40042
user_scopes.insert(OAuthClientScope::ServerAdministration);
}
if !required_scopes
.iter()
@@ -408,3 +432,19 @@ async fn check_appservice_token(services: &Services, token: &str) -> Result<Regi
Ok(appservice_info)
}
fn check_unauthenticated_request_ratelimiting(services: &Services, ip: IpAddr) -> Result<()> {
if services
.config
.unauthenticated_request_ratelimit
.check_key(&ip)
.is_err()
{
return Err(Error::BadRequest(
ErrorKind::LimitExceeded(LimitExceededErrorData::new()),
"Rate limit exceeded.",
));
}
Ok(())
}
Loaded 100 of 161 files, more files were not shown because too many files have changed in this diff. Show more