Compare commits

...
Author SHA1 Message Date
timedout ce178d86d5 feat(admin): List user memberships route 2026-10-10 23:58:24 +01:00
timedout 02f4f9d88d feat(admin): Create user route 2026-10-10 23:11:37 +01:00
timedout 1deaf99409 feat(admin): List users endpoint 2026-10-05 05:08:36 +01:00
Jade Ellis 1e34bd2ed9 style: Run formatting 2026-10-05 00:27:12 +01:00
stratself d83da6ada7 docs(deploying: Fixes from PR comments 2026-10-03 15:52:20 +00:00
stratself 9377ff7abd fix: Trailing whitespace 2026-10-03 15:52:20 +00:00
stratself 2118eb8501 docs: Move Configuration page below Deploying section 2026-10-03 15:52:20 +00:00
stratself ef0483feb9 docs(deploying): Note the conduwuit name and other small style changes 2026-10-03 15:52:20 +00:00
stratself 25f59e3e2c docs(deploying): Add baseline instructions and buttons for installation
The OverviewGroup thingy is hardcoded for now because figuring out
rspress hooks to read from _meta.json is a pain.
2026-10-03 15:52:20 +00:00
stratself 060eee983d chore: Add changelog to #2252 2026-10-03 15:52:20 +00:00
stratself 7fba194bff docs(deploying): Add missing links and small wording changes to some pages 2026-10-03 15:52:20 +00:00
stratself 7bf6f3bd11 docs(deploying): Shorten the release tracks section 2026-10-03 15:52:20 +00:00
stratself 8b77a559e0 docs(generic): Add small intro 2026-10-03 15:52:20 +00:00
stratself c1d75183d1 docs(deploying): Prioritize FreeBSD page above Nomad and K8s 2026-10-03 15:52:20 +00:00
stratself f9a6171cc5 docs(debian): Add "next steps" redir and fix headings' levels 2026-10-03 15:52:20 +00:00
stratself 5fcc43e803 docs(deploying): redirect all 'next steps' section to main deploying page 2026-10-03 15:52:20 +00:00
stratself 26646f9df6 docs(deploying): Populate the stub Deploying page with useful info
* Detail Continuwuity's release tracks
* Add general update advises
* Add installation and post-installation sections
2026-10-03 15:52:20 +00:00
stratself c221d60654 docs(rpm): Remove instructions to disable GPG checking 2026-10-03 15:40:15 +00:00
stratself 70cce17b7f fix(docs,rpm): Correct path of config file 2026-10-03 15:40:15 +00:00
stratself 2f45a5c794 docs(rpm): Fixes from PR comments 2026-10-03 15:40:15 +00:00
stratself b64f8a76ac chore: Add changelog for #2275 2026-10-03 15:40:15 +00:00
stratself aab456e0e0 docs(rpm): Add basic configuration instructions
Needed as the docs implied it works OOTB. Also moved building and
uninstallation instructions to an Appendix section
2026-10-03 15:40:15 +00:00
Clubs b40204a6c7 docs: changelog for adding !admin token issue registration conditional 2026-10-03 15:37:58 +00:00
Clubs ea16e78092 fix: ensure that registration is enabled before giving tokens from !admin token issue 2026-10-03 15:37:58 +00:00
Erwan Leboucher 56c2d8d901 refactor(media): Simplify preview image handling 2026-10-03 15:35:18 +00:00
Erwan Leboucher 7d8a5f6bab fix(media): Preserve remote preview dimensions without decoding images 2026-10-03 15:35:18 +00:00
Erwan Leboucher de578c2163 fix(media): Validate preview image downloads 2026-10-03 15:35:18 +00:00
timedout c94fa39fd1 fix: Don't panic when a join doesn't include a create event 2026-10-03 15:19:10 +00:00
Ginger 2773ff3e16 feat: Import images correctly from OIDC claims 2026-10-03 15:04:07 +00:00
Ginger 6bbea25034 feat: Allow configuring additional trusted OIDC audiences 2026-10-03 15:03:47 +00:00
Ginger 39bee607c0 refactor: Remove recaptcha-verify 2026-10-03 15:03:34 +00:00
timedout 935ddf1d0f style: Change Allow to Default etc
`ExplicitAllow` -> `Allow`
2026-10-02 18:10:18 +01:00
timedout 495eeedd24 style: Don't return Allow in an else block 2026-10-02 18:10:17 +01:00
timedout 63294f8775 fix: Inverted check 2026-10-02 18:10:17 +01:00
timedout 7243c92dbc chore: add newsfrag 2026-10-02 18:10:17 +01:00
timedout 43ee11bb00 feat: Support MSC4494 2026-10-02 18:10:17 +01:00
Ginger f1d9537b14 fix: Fix startup panic in old migrations 2026-10-02 11:41:37 -04:00
Ginger cb7af18bc2 fix: Make unembed_unsigned_info infallible 2026-10-01 18:43:54 +00:00
Ginger a6fae7498d fix: Don't bump version if it's already bumped 2026-10-01 18:43:54 +00:00
Ginger 48c36d6f17 refactor: Remove some unnecessary macro logic 2026-10-01 18:43:54 +00:00
Ginger 23d07e3d4f refactor: Clean up migration logic 2026-10-01 18:43:54 +00:00
stratself 1220144495 fix: Uncenter 2026-10-01 16:18:43 +00:00
stratself a718aa92eb fix: A word 2026-10-01 16:11:22 +00:00
stratself 4a97dc8c96 docs: Add donate section and backers count badge to README 2026-10-01 16:11:22 +00:00
stratself 8414af2349 fix: Trailing whitespace 2026-10-01 16:11:22 +00:00
stratself 4daf674337 fix: Use div align and br instead of inline css for donate button 2026-10-01 16:11:22 +00:00
stratself 847412367b docs(README): Better colors for some buttons 2026-10-01 16:11:22 +00:00
stratself 95e99a393d docs(README): Add Open Collective donation button 2026-10-01 16:11:22 +00:00
stratself a4faa82f38 docs(README): Tagline concision 2026-10-01 16:11:22 +00:00
stratself e931fdca15 docs(README): Smart linking the contrib page and other improvements
CONTRIBUTION.md is now linked directly when viewed from the repo.

When viewed in the website, links to /CONTRIBUTION.md will be redirected
towards /development/contributing using the `pluginClientRedirects`
options

The other dev docs can also benefit from these hackarounds
2026-10-01 16:11:22 +00:00
stratself db6e70eae8 docs(README): Remove "what are we working on" section
Not a very useful indicator of project progress for now
2026-10-01 16:11:22 +00:00
stratself d97fcc9acd style(docs,README): Remove anchor tags (seems unused for anything) 2026-10-01 16:11:22 +00:00
stratself c087c3cdb8 style(docs,README): Cleanup badge using indirect links 2026-10-01 16:11:22 +00:00
stratself c186879138 fix(docs): Fix header levels in README.md 2026-10-01 16:11:22 +00:00
Renovate Bot 92bc1111ee chore(deps): update dependency cargo-bins/cargo-binstall to v1.24.0 2026-10-01 16:07:21 +00:00
stratself 0989155929 docs(intro): Dehyphenate 2026-10-01 16:05:59 +00:00
stratself 15bb2f7bf5 docs(intro): Fixes from PR comments 2026-10-01 16:05:59 +00:00
stratself a62f7ecc28 docs(intro): Use fednex's tagline from the website 2026-10-01 16:05:59 +00:00
stratself 30266fe3b5 docs: New Jade link 2026-10-01 16:05:59 +00:00
stratself 7d1163e35d fix: Newline 2026-10-01 16:05:59 +00:00
stratself a88da6fd5c fix(docs): Intro page logo resizing 2026-10-01 16:05:59 +00:00
stratself d413a3ebdc chore: Add changelog for #2279 2026-10-01 16:05:59 +00:00
stratself 4dd538219a docs: Rename meta for introduction page to "Introduction" 2026-10-01 16:05:59 +00:00
stratself 413ebc0061 docs(intro): Draw the rest of the introduction page (see notes)
* Add stub Deploying section
* Add Try it out section with short instructions for partnered
  homeservers
* Add Donate section with OC button and individual links
* Add Contact section, move all chatroom and source code buttons there
* Use new `no-zoom` html class to disable image zooms
2026-10-01 16:05:59 +00:00
stratself 2eda5de86b docs(intro): Rewrite intro page from hidden sections of main index 2026-10-01 16:05:59 +00:00
Ginger 931686e84e fix: Fix panic in room creation 2026-09-30 18:49:03 +00:00
Ginger eb602e83a1 chore: Fix clippy lints 2026-09-30 14:47:46 -04:00
Renovate Bot 5c4066cbfd chore(deps): update pre-commit hook crate-ci/typos to v1.50.3 2026-09-30 05:03:27 +00:00
timedout 58d135bc57 fix: Return the actual state at in !admin debug get-state-at
Previously this command actually returned the state *before*, which made debugging with it confusing.
2026-09-29 22:06:48 +01:00
Clubs 684820c7c1 fix: check for user account status before attemping to process email change. 2026-09-29 18:36:35 +00:00
Ginger cbdf978b84 fix: Preserve custom fields in create event content 2026-09-29 17:52:32 +00:00
Ginger 38b7987335 fix: Add invitees as creators for v12+ trusted private chats 2026-09-29 17:52:32 +00:00
stratself 612a261b61 docs(auth): with --> to 2026-09-29 16:26:07 +00:00
stratself b1e51ab0fb docs(internal auth): Redo rego methods (see commit notes)
* Tokens + recaptcha combinations have been removed since they don't
  work. Docstring in config tomlto be removed later
* Method 3 expanded to include both static and admin issued tokens
* Methods 1-3 are the "trusted token flow" and 4-6 are the "untrusted
  captcha flow"
2026-09-29 16:26:07 +00:00
stratself 8f56f99e2f docs(oidc): Incorporate wording fixes wrt subject claim from PR review 2026-09-29 16:26:07 +00:00
stratself 95f65fdba4 docs(auth): Wording fixes according to PR review 2026-09-29 16:26:07 +00:00
stratself 23a0fc1b0f docs(oidc): kanidm --> Kanidm 2026-09-29 16:26:07 +00:00
stratself f49bda81d2 docs(auth): Incorporate changes from PR review comments 2026-09-29 16:26:07 +00:00
stratself f35eb7677c fix: Typo 2026-09-29 16:26:07 +00:00
stratself b2a90f118d docs(deploying): Fix OIDC links
The deploying stub page will be rewritten sooon and the "What's next"
steps should migrate there. In the meantime this helps npm not break
when building the docs
2026-09-29 16:26:07 +00:00
stratself 4b79acba97 chore: Changelog for #2234 2026-09-29 16:26:07 +00:00
stratself 01a83067c6 docs: Remove OIDC page from Guides section
It now resides in the Authentication section
2026-09-29 16:26:07 +00:00
stratself 84cf4196e2 docs(auth): Fix wordings and add links to admin commands
* Add confirmed email + reCAPTCHA registration method as well
2026-09-29 16:26:07 +00:00
stratself 83341062af docs(oidc): Add advanced options section, and more notes for linked accounts 2026-09-29 16:26:07 +00:00
stratself 1d196f24ec docs(auth): Reword sources section a bit 2026-09-29 16:26:07 +00:00
stratself 4631854325 docs(auth): Address concerns from feedback part 1 2026-09-29 16:26:07 +00:00
stratself 26b8e527aa docs(oidc): Add important notice to OIDC breaking legacy logins 2026-09-29 16:26:07 +00:00
stratself c07922fff2 docs(auth): Simplify auth sources section & add client well-known notice 2026-09-29 16:26:07 +00:00
stratself e41435f13c docs(auth): Rename rego page to "internal auth" & add pwd reset details
* Moved around a few paragraphs to fit new title as well
2026-09-29 16:26:07 +00:00
stratself 8c0fcfd108 chore: Add few todos 2026-09-29 16:26:07 +00:00
stratself 516f94d83f docs(auth): Copy stuff from the OIDC guide
The guide would be removed at a later time
2026-09-29 16:26:07 +00:00
stratself 97533eea05 docs(auth): Writeup on auth sources and flows 2026-09-29 16:26:07 +00:00
stratself 062cb5b412 docs(registration): Remove challengeless rego mentions, add rego platforms 2026-09-29 16:26:07 +00:00
stratself 17084a363b docs(registration): Number all the rego methods and add admin commands for emails 2026-09-29 16:26:07 +00:00
stratself ac96b57506 chore(docs): Add some todos 2026-09-29 16:26:07 +00:00
stratself 385f6639c4 docs(auth): Move legacy auth page to rego page (see desc)
The commit moves legacy.mdx to registration.mdx and significantly
shortens it. Instead of explaining every registration option now a table
is provided. Renaming the page because besides registration there is not
much else to explain about legacy auth. If anything, those should be
elaborated on the main authentication.mdx page (i.e. difference between
OAuth and UIAA)

The email section has also been updated with (some) relevant info.
2026-09-29 16:26:07 +00:00
stratself b3a15fc305 docs(auth): Add token-based registration instructions 2026-09-29 16:26:07 +00:00
stratself 979c1b2fc7 docs: Initialize authentication chapter 2026-09-29 16:26:07 +00:00
Ginger 8f2f7f09ed docs: Remove cards from index page 2026-09-29 15:39:26 +00:00
Renovate Bot b59e697ed6 chore(deps): update github-actions-digest 2026-09-29 05:01:36 +00:00
nex 9c0b88f67c chore: Publish admin announcement 2026-09-29 02:30:34 +00:00
Renovate Bot 76e87c93d8 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.115.13 2026-09-28 05:03:08 +00:00
nex aa40142b87 fix(ci): Disable GitLab mirror 2026-09-28 03:13:34 +00:00
timedout 046074bbc2 chore: Release 2026-09-28 02:04:54 +01:00
timedout 550dd0160a fix: SEC8
Reviewed-By: Ginger <ginger@gingershaped.computer>
Reviewed-By: Jade <jade@ellis.link>
Reviewed-By: Jacob Taylor <jacob@explodie.org>
2026-09-28 02:00:37 +01:00
timedout c0ad864d57 fix: Make unembed unsigned run in bg 2026-09-27 22:58:08 +01:00
timedout 451c44800b chore: Add news frag 2026-09-27 19:19:50 +01:00
timedout a61026912c feat: Add a migration to fix up unsigned data 2026-09-27 18:31:46 +01:00
timedout 05d6922351 style: Take an optional context instead of deconstructed parameters 2026-09-27 17:33:26 +01:00
timedout f0a0596d12 fix: Remove undocumented prev_sender unsigned field 2026-09-27 17:32:47 +01:00
timedout fbedf994db fix: Don't unnecessarily embed prev_content in populate_unsigned 2026-09-27 17:32:47 +01:00
timedout 1de16fed9e style: English is a difficult language 2026-09-27 17:32:47 +01:00
timedout 4812837d13 fix: Don't allow set_unsigned to panic
While an error in this function is probably bad, detonating a metric tonne of TNT on the call tree is probably worse
2026-09-27 17:32:47 +01:00
timedout 90793eaaf4 fix: Actually set unsigned in PDU after set_unsigned 2026-09-27 17:32:47 +01:00
timedout 744928b206 style: Update docstring for Pdu.set_unsigned 2026-09-27 17:32:47 +01:00
timedout 05ee24df7d fix: Move helper to helpers.rs, rename field, don't recurse unsigned in redacted_because
Renamed `redacted_because_id` to `org.continuwuity.redacted_by` for proper namespacing; `get_unsigned_context` now lives in helpers.rs instead of `mod.rs`. The helper function also now explicitly wipes `unsigned` for `redacted_because` to avoid leaks (see comment).
2026-09-27 17:32:46 +01:00
timedout 89eecd2bf7 fix: Record redacted_because_id instead of redacted_because 2026-09-27 17:32:46 +01:00
timedout b2072baf59 perf: Strip unsigned over federation and generate it on the fly locally 2026-09-27 17:32:46 +01:00
timedout 286897de88 feat: Don't send unsigned data over federation 2026-09-27 17:32:46 +01:00
stratself 3ee4ab7c09 chore: Add changelog for #2259 2026-09-26 23:03:21 +00:00
stratself 173091624c docs(styling): Use lighter colors for nav bars in dark mode 2026-09-26 23:03:21 +00:00
stratself 0f21f42787 docs(landing): Style action buttons to add punch and match c10y's themes
The buttons are an attempt to match colors found on c10y's account
management landing page. With less round corners and a punchier color
scheme they should be more visible than previous versions (which were
reported to be a bit dull)

The donation button is stylized in green
2026-09-26 23:03:21 +00:00
stratself 31a0c4c9b5 docs: Add OpenCollective link and donate button 2026-09-26 23:03:21 +00:00
stratself 8d60b8dada docs: Stricter shortcut link redirections
Avoids some recursion and 404 endpoint issues. Serves as good
examples for future additions.

The "Intermittent federation failures to a specific server"
section is now ID'd as #intermittent for easier reachability.
2026-09-26 23:01:15 +00:00
Renovate Bot 84222bfc7b chore(deps): update rust crate smallvec to v1.16.2 2026-09-26 05:04:12 +00:00
Renovate Bot a4d2d4a720 chore(deps): update rust-zerover-patch-updates 2026-09-25 05:02:56 +00:00
Renovate BotandGinger 02d245afe5 chore(deps): Update ruma digest to e7384f0
Co-authored-by: Ginger <ginger@gingershaped.computer>
2026-09-24 14:16:55 -04:00
Renovate Bot 3e5ea8f850 chore(deps): update node-patch-updates to v2.0.22 2026-09-24 14:11:17 +00:00
Renovate Bot 5878594698 chore(deps): update dependency node to v24 2026-09-24 14:11:11 +00:00
Renovate Bot 4e8643147d chore(deps): update rust-non-major 2026-09-24 13:57:09 +00:00
Ginger 4ea4e15edb chore: Reformat with latest nightly 2026-09-24 09:53:59 -04:00
Erwan Leboucher cee69b4c8d fix: Walk auth events once instead of re-queueing parents 2026-09-22 21:19:25 +02:00
Renovate Bot 457b884491 chore(deps): update github-actions-digest 2026-09-22 05:03:35 +00:00
timedout d3ed175264 fix(stateres): Inject dummy create event when none is available
I'm not sure how this doesn't cause more panics. When running an auth check on the create event during iterative auth checks, there's obviously no create event in the base state nor auth map, so the call to fetch_state() will return nothing and thus panic.
This just inserts the incoming event if it's a create event and there isn't an existing one in the auth state. It's not used for the create event checks anyway so this has no effect aside from plugging the panic.
2026-09-22 02:04:39 +01:00
timedout 7924e96589 chore: add todo to fix 2026-09-22 00:16:27 +00:00
timedout d1b1274900 style: Unchain if statement 2026-09-22 00:16:27 +00:00
timedout 6299df3552 style: Document fetch_and_handle_auth_events control flow 2026-09-22 00:16:27 +00:00
Erwan Leboucher 20d146bd5e fix: Throttle client-triggered remote event fetches 2026-09-22 00:16:27 +00:00
Erwan Leboucher 03f60c7002 fix: Don't re-fetch auth events that can never be resolved 2026-09-22 00:16:27 +00:00
Erwan Leboucher ed1e634579 feat(push): Add MSC4174 web push 2026-09-21 23:35:05 +00:00
Renovate Bot dbcffe8af0 chore(deps): update ghcr.io/renovatebot/renovate docker tag to v44.104.2 2026-09-21 05:02:42 +00:00
timedout 8891adfba3 fix(stateres): Enforce state ownership checks against creators too
Previously being a room creator short-circuited the `can_send_event`
check, which allowed creators to send state events "owned" (state key
starting with @ but not being the sender's user ID), in effect skipping
auth check 9 in v12 rooms. This removes that short circuit condition,
since `Infinite < Int` always returns false anyway, allowing the state
key check block to execute.

Fixes #2266
2026-09-18 18:57:57 +01:00
Renovate Bot 4c8dc59f7a chore(deps): update rust-non-major 2026-09-17 05:03:15 +00:00
timedout 1a8e5ccc09 fix: Gracefully handle extremityless rooms when gapfilling
See also: #2259
2026-09-17 00:06:17 +01:00
timedout c8720a6ebc chore: Update admin room announcement 2026-09-16 22:12:25 +01:00
153 changed files with 5938 additions and 2381 deletions

No files matched your search

@@ -52,7 +52,7 @@ runs:
- name: Set up Docker Buildx
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
with:
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
@@ -67,7 +67,7 @@ runs:
uses: ./.forgejo/actions/rust-toolchain
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
with:
# Use persistent BuildKit if BUILDKIT_ENDPOINT is set (e.g. tcp://buildkit:8125)
driver: ${{ env.BUILDKIT_ENDPOINT != '' && 'remote' || 'docker-container' }}
@@ -75,7 +75,7 @@ runs:
- name: Set up QEMU
if: ${{ env.BUILDKIT_ENDPOINT == '' }}
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4
- name: Login to builtin registry
if: ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' }}
+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@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2
uses: https://github.com/taiki-e/install-action@4cef1412cce204788f482e778a0b9187f9626a29 # v2
with:
tool: git-warp-time,timelord-cli@3.0.1
+7 -7
View File
@@ -37,9 +37,9 @@ creds:
- registry: forgejo.ellis.link
user: "{{env \"BUILTIN_REGISTRY_USER\"}}"
pass: "{{env \"BUILTIN_REGISTRY_PASSWORD\"}}"
- registry: registry.gitlab.com
user: "{{env \"GITLAB_USERNAME\"}}"
pass: "{{env \"GITLAB_TOKEN\"}}"
# - registry: registry.gitlab.com
# user: "{{env \"GITLAB_USERNAME\"}}"
# pass: "{{env \"GITLAB_TOKEN\"}}"
- registry: git.nexy7574.co.uk
user: "{{env \"N7574_GIT_USERNAME\"}}"
pass: "{{env \"N7574_GIT_TOKEN\"}}"
@@ -58,10 +58,10 @@ defaults:
# Sync configuration - each registry gets different image sets
sync:
- source: *source
target: registry.gitlab.com/continuwuity/continuwuity
type: repository
<<: *tags-main
#- source: *source
# target: registry.gitlab.com/continuwuity/continuwuity
# type: repository
# <<: *tags-main
- source: *source
target: ghcr.io/continuwuity/continuwuity
type: repository
+3 -3
View File
@@ -34,7 +34,7 @@ jobs:
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
uses: https://github.com/actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 22
node-version: 24
- name: Cache npm dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
@@ -56,7 +56,7 @@ jobs:
- name: Deploy to Cloudflare Pages (Production)
if: github.ref == 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
uses: https://github.com/cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4
uses: https://github.com/cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
- name: Deploy to Cloudflare Pages (Preview)
if: github.ref != 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
uses: https://github.com/cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4
uses: https://github.com/cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+2 -2
View File
@@ -62,7 +62,7 @@ jobs:
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push Docker image by digest
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: "docker/Dockerfile"
@@ -150,7 +150,7 @@ jobs:
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push max-perf Docker image by digest
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: "docker/Dockerfile"
+1 -1
View File
@@ -43,7 +43,7 @@ jobs:
name: Renovate
runs-on: ubuntu-latest
container:
image: ghcr.io/renovatebot/renovate:44.83.2@sha256:7c83dd134ede3fd12ffbdaa67e426aafebd592f4ffdff8fdbae92d48f98324af
image: ghcr.io/renovatebot/renovate:44.115.13@sha256:c19ab7a16ed7cbe8f7f11e2435e67c727ba90107930d3324c8d1cdec808f0055
options: --tmpfs /tmp:exec
steps:
- name: Checkout
+18 -30
View File
@@ -10,31 +10,31 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-merge-conflict
- id: check-added-large-files
- repo: https://github.com/crate-ci/typos
rev: v1.50.2
rev: v1.50.3
hooks:
- id: typos
- id: typos
name: commit-msg-typos
stages: [commit-msg]
stages: [ commit-msg ]
- repo: https://github.com/crate-ci/committed
rev: v1.1.11
hooks:
- id: committed
- id: committed
- repo: local
hooks:
@@ -42,10 +42,10 @@ repos:
name: cargo fmt
entry: cargo +nightly fmt --
language: system
types: [rust]
types: [ rust ]
pass_filenames: false
stages:
- pre-commit
- pre-commit
- repo: local
hooks:
@@ -54,18 +54,6 @@ repos:
entry: cargo clippy -- -D warnings
language: system
pass_filenames: false
types: [rust]
types: [ rust ]
stages:
- pre-push
- repo: local
hooks:
- id: docs-build
name: docs build
entry: npm run docs:build
language: system
pass_filenames: false
files: docs/
types: [mdx]
stages:
- pre-commit
+18
View File
@@ -1,3 +1,21 @@
# Continuwuity v26.9.1 (2026-09-28)
## Features
- The server now calculates some data for `unsigned` data when sending it to clients, rather than embedding it at rest. This brings decreased storage costs and improved access control checks.
Contributed by @nex. ([#2270](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2270))
- Added encrypted Web Push ([MSC4174](https://github.com/matrix-org/matrix-spec-proposals/pull/4174)), enabled by default. Contributed by @eleboucher.
## Bugfixes
- Fixed exponential blowup in auth event fetching for deep auth chains, which caused runaway CPU and RAM until restart. Contributed by @eleboucher. (auth-event-walk)
- Fixed events being repeatedly re-requested over federation when they were fetched successfully but could not be resolved, and throttled remote event fetches made on behalf of clients. Contributed by @eleboucher. ([#2090](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2090))
## Improved Documentation
- Add Open Collective links to docs and restyle action buttons. Contributed by @stratself ([#2269](https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2269))
# Continuwuity v26.9.0 (2026-09-16)
## Features
Generated
+301 -142
View File
File diff suppressed because it is too large. Load diff
+22 -2
View File
@@ -12,7 +12,7 @@ license = "Apache-2.0"
# See also `rust-toolchain.toml`
readme = "README.md"
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
version = "26.9.0"
version = "26.9.1"
[workspace.metadata.crane]
name = "conduwuit"
@@ -66,6 +66,15 @@ default-features = false
version = "0.13.0"
default-features = false
[workspace.dependencies.web-push-native]
version = "0.5.0"
default-features = false
[workspace.dependencies.p256]
version = "0.13.2"
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"
@@ -83,6 +92,10 @@ version = "0.1.3"
[workspace.dependencies.http]
version = "1.3.1"
# parses the HTTP-date form of Retry-After
[workspace.dependencies.httpdate]
version = "1.0.3"
[workspace.dependencies.regex]
version = "1.11.1"
@@ -150,6 +163,7 @@ features = [
"hickory-dns",
"http2",
"stream",
"form",
]
[workspace.dependencies.serde]
@@ -334,7 +348,7 @@ version = "1.1.1"
# Used for matrix spec type definitions and helpers
[workspace.dependencies.ruma]
git = "https://github.com/ruma/ruma.git"
rev = "83d80c8d869e0ba09becbf7e7378eefc7377cfdb"
rev = "e7384f01eacd454c593683de50491201e2160fd1"
features = [
"appservice-api-c",
"client-api",
@@ -370,6 +384,7 @@ features = [
"unstable-msc4354",
"unstable-msc4480",
"unstable-msc4466",
"unstable-msc4494",
"unstable-extensible-events",
]
@@ -644,6 +659,9 @@ default-features = false
[workspace.dependencies.ruminuwuity]
package = "ruminuwuity"
path = "src/ruminuwuity"
features = [
"unstable-msc4484"
]
###############################################################################
#
@@ -962,6 +980,8 @@ let_underscore_future = { level = "allow", priority = 1 }
# rust doesnt understand conduwuit's custom log macros
literal_string_with_formatting_args = { level = "allow", priority = 1 }
# This lint is stupid, there's no point defining generics for simple trait params
impl-trait-in-params = { level = "allow", priority = 1 }
needless_raw_string_hashes = "allow"
+66 -45
View File
@@ -1,49 +1,77 @@
# continuwuity
# Continuwuity
<!-- ANCHOR: catchphrase -->
## A community-driven [Matrix](https://matrix.org/) homeserver
## A community-driven [Matrix](https://matrix.org/) homeserver in Rust
[![Chat on Matrix][matrix-chat-badge]][matrix-chatroom]
[![Join the space][matrix-space-badge]][matrix-space]
[![Open Collective backers and sponsors][opencollective-contributors-badge]][opencollective]
[![Chat on Matrix](https://img.shields.io/matrix/continuwuity%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix)](https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) [![Join the space](https://img.shields.io/matrix/space%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix&label=space)](https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org)
<!-- ANCHOR_END: catchphrase -->
[matrix-chat-badge]: https://img.shields.io/matrix/continuwuity%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix
[matrix-chatroom]: https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
[matrix-space-badge]: https://img.shields.io/matrix/space%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix&label=space
[matrix-space]: https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
[opencollective-contributors-badge]: https://img.shields.io/opencollective/all/continuwuity
[opencollective]: https://opencollective.com/continuwuity
[continuwuity] is a Matrix homeserver written in Rust.
It's the official community continuation of the [conduwuit](https://github.com/girlbossceo/conduwuit) homeserver.
<!-- ANCHOR: body -->
[![forgejo.ellis.link][forge-badge]][forge-link]
[![Stars][forge-stars-badge]][forge-stars-link]
[![Issues][forge-issues-badge]][forge-issues-link]
[![Pull Requests][forge-pulls-badge]][forge-pulls-link]
[![forgejo.ellis.link](https://img.shields.io/badge/Ellis%20Git-main+packages-green?style=flat&logo=forgejo&labelColor=fff)](https://forgejo.ellis.link/continuwuation/continuwuity) [![Stars](https://forgejo.ellis.link/continuwuation/continuwuity/badges/stars.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/stars) [![Issues](https://forgejo.ellis.link/continuwuation/continuwuity/badges/issues/open.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/issues?state=open) [![Pull Requests](https://forgejo.ellis.link/continuwuation/continuwuity/badges/pulls/open.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/pulls?state=open)
[![GitHub][github-badge]][github-link] ![Stars][github-stars-badge] -
[![Codeberg][codeberg-badge]][codeberg-link] [![Stars][codeberg-stars-badge]][codeberg-stars-link] -
[![GitLab][gitlab-badge]][gitlab-link] [![Stars][gitlab-stars-badge]][gitlab-stars-link]
[![GitHub](https://img.shields.io/badge/GitHub-mirror-blue?style=flat&logo=github&labelColor=fff&logoColor=24292f)](https://github.com/continuwuity/continuwuity) [![Stars](https://img.shields.io/github/stars/continuwuity/continuwuity?style=flat)](https://github.com/continuwuity/continuwuity/stargazers)
<br>
<a href="https://opencollective.com/continuwuity" target="_blank">
<img src="https://opencollective.com/webpack/donate/button.png?color=blue" width="250"/>
</a>
[![GitLab](https://img.shields.io/badge/GitLab-mirror-blue?style=flat&logo=gitlab&labelColor=fff)](https://gitlab.com/continuwuity/continuwuity) [![Stars](https://img.shields.io/gitlab/stars/continuwuity/continuwuity?style=flat)](https://gitlab.com/continuwuity/continuwuity/-/starrers)
[forge-badge]: https://img.shields.io/badge/Ellis%20Git-main+packages-green?style=flat&logo=forgejo&labelColor=fff
[forge-link]: https://forgejo.ellis.link/continuwuation/continuwuity
[forge-stars-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/stars.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-stars-link]: https://forgejo.ellis.link/continuwuation/continuwuity/stars
[forge-issues-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/issues/open.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-issues-link]: https://forgejo.ellis.link/continuwuation/continuwuity/issues?state=open
[forge-pulls-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/pulls/open.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-pulls-link]: https://forgejo.ellis.link/continuwuation/continuwuity/pulls?state=open
[![Codeberg](https://img.shields.io/badge/Codeberg-mirror-2185D0?style=flat&logo=codeberg&labelColor=fff)](https://codeberg.org/continuwuity/continuwuity) [![Stars](https://codeberg.org/continuwuity/continuwuity/badges/stars.svg?style=flat)](https://codeberg.org/continuwuity/continuwuity/stars)
[github-badge]: https://img.shields.io/badge/GitHub-mirror-blue?style=flat&logo=github&labelColor=fff&logoColor=24292f
[github-link]: https://github.com/continuwuity/continuwuity
[github-stars-badge]: https://img.shields.io/github/stars/continuwuity/continuwuity?style=flat
[gitlab-badge]:https://img.shields.io/badge/GitLab-mirror-blue?style=flat&logo=gitlab&labelColor=fff
[gitlab-link]: https://gitlab.com/continuwuity/continuwuity
[gitlab-stars-badge]: https://img.shields.io/gitlab/stars/continuwuity/continuwuity?style=flat
[gitlab-stars-link]: https://gitlab.com/continuwuity/continuwuity/-/starrers
[codeberg-badge]:https://img.shields.io/badge/Codeberg-mirror-2185D0?style=flat&logo=codeberg&labelColor=fff
[codeberg-link]: https://codeberg.org/continuwuity/continuwuity
[codeberg-stars-badge]: https://codeberg.org/continuwuity/continuwuity/badges/stars.svg?style=flat
[codeberg-stars-link]: https://codeberg.org/continuwuity/continuwuity/stars
### Why does this exist?
## Why does this exist?
The original conduwuit project has been archived and is no longer maintained. Rather than letting this Rust-based Matrix homeserver disappear, a group of community contributors have forked the project to continue its development, fix outstanding issues, and add new features.
We aim to provide a stable, well-maintained alternative for current conduwuit users and welcome newcomers seeking a lightweight, efficient Matrix homeserver.
### Who are we?
## Who are we?
We are a group of Matrix enthusiasts, developers and system administrators who have used conduwuit and believe in its potential. Our team includes both previous
contributors to the original project and new developers who want to help maintain and improve this important piece of Matrix infrastructure.
We operate as an open community project, welcoming contributions from anyone interested in improving continuwuity.
### What is Matrix?
## What is Matrix?
[Matrix](https://matrix.org) is an open, federated, and extensible network for
decentralized communication. Users from any Matrix homeserver can chat with users from all
other homeservers over federation. Matrix is designed to be extensible and built on top of.
You can even use bridges such as Matrix Appservices to communicate with users outside of Matrix, like a community on Discord.
### What are the project's goals?
## What are the project's goals?
Continuwuity aims to:
@@ -55,11 +83,11 @@ Continuwuity aims to:
- Create a sustainable development model for long-term maintenance
- Keep a lightweight, efficient codebase that can run on modest hardware
### Can I try it out?
## Can I try it out?
Check out the [documentation](https://continuwuity.org) for installation instructions.
Check out our [website](https://continuwuity.org) for installation instructions. Start with the [deployment section](https://continuwuity.org/deploying).
If you want to try it out as a user, we have some partnered homeservers you can use:
If you want to try it out as a user, we have some partnered homeservers you can join:
* You can head over to [https://federated.nexus](https://federated.nexus/) in your browser.
* Hit the `Apply to Join` button. Once your request has been accepted, you will receive an email with your username and password.
* Head over to [https://app.federated.nexus](https://app.federated.nexus/) and you can sign in there, or use any other matrix chat client you wish elsewhere.
@@ -67,31 +95,20 @@ If you want to try it out as a user, we have some partnered homeservers you can
* There's also [https://continuwuity.rocks/](https://continuwuity.rocks/). You can register a new account using Cinny via [this convenient link](https://app.cinny.in/register/continuwuity.rocks), or you can use Element or another matrix client *that supports registration*.
### What are we working on?
## Can I migrate my data from X?
We're working our way through all of the issues in the [Forgejo project](https://forgejo.ellis.link/continuwuation/continuwuity/issues).
- [Packaging & availability in more places](https://forgejo.ellis.link/continuwuation/continuwuity/issues/747)
- [Appservices bugs & features](https://forgejo.ellis.link/continuwuation/continuwuity/issues?q=&type=all&state=open&labels=178&milestone=0&assignee=0&poster=0)
- [Improving compatibility and spec compliance](https://forgejo.ellis.link/continuwuation/continuwuity/issues?labels=119)
- Automated testing
- [Admin API](https://forgejo.ellis.link/continuwuation/continuwuity/issues/748)
- [Policy-list controlled moderation](https://forgejo.ellis.link/continuwuation/continuwuity/issues/750)
### Can I migrate my data from x?
- Conduwuit: Yes
- Conduit: No, database is now incompatible
- Grapevine: No, database is now incompatible
- Dendrite: No
- Synapse: No
- **Conduwuit**: Yes
- **Conduit**: No, database is now incompatible
- **Grapevine**: No, database is now incompatible
- **Dendrite**: No
- **Synapse**: No
We haven't written up a guide on migrating from incompatible homeservers yet. Reach out to us if you need to do this!
<!-- ANCHOR_END: body -->
## Contribution
See our [Contributing page](CONTRIBUTING.md) for more details.
### Development flow
- Features / changes must developed in a separate branch
@@ -104,7 +121,6 @@ We haven't written up a guide on migrating from incompatible homeservers yet. Re
The main branch is always green!
### Policy on pulling from other forks
We welcome contributions from other forks of conduwuit, subject to our review process.
@@ -117,13 +133,18 @@ When incorporating code from other forks:
- We prioritize stability and compatibility when evaluating external contributions
- Features that align with our project goals will be given priority consideration
<!-- ANCHOR: footer -->
## Donate to us!
#### Contact
If you like what we're doing, consider donating to our [**Open Collective**][opencollective]!
You can also donate individually to each of the maintainers:
- Nex: https://timedout.uk/donate.html
- Jade: https://jade.ellis.link/sponsors
- Ginger: https://github.com/sponsors/gingershaped
## Contact
Join our [Matrix room](https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) and [space](https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) to chat with us about the project!
<!-- ANCHOR_END: footer -->
[continuwuity]: https://forgejo.ellis.link/continuwuation/continuwuity
+1
View File
@@ -0,0 +1 @@
Profile banners are now treated as images when imported from OIDC claims, like avatars already were.
+1
View File
@@ -0,0 +1 @@
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.
+1
View File
@@ -0,0 +1 @@
Invitees are now added as room creators when creating a v12+ trusted private chat. Contributed by @ginger.
+1
View File
@@ -0,0 +1 @@
Continuwuity now supports configuring additional trusted audience values for deployments using OIDC with an IDP that sends them. Contributed by @ginger
+1
View File
@@ -0,0 +1 @@
Add the Authentication section to document available auth methods for Continuwuity. The "delegated authentication" guide has also been migrated to here. Contributed by @stratself.
+1
View File
@@ -0,0 +1 @@
The deploying page now includes vital general information about installing Continuwuity: release tracks, update steps, and post-installation recommendations. Contributed by @stratself
+1
View File
@@ -0,0 +1 @@
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
+1
View File
@@ -0,0 +1 @@
Better, more succinct [introduction page](https://continuwuity.org/introduction.html). Contributed by @stratself
+1
View File
@@ -0,0 +1 @@
Added support for [MSC4494: Membership-based invite blocking](https://github.com/matrix-org/matrix-spec-proposals/pull/4494)
+1
View File
@@ -0,0 +1 @@
"!admin users change-email" now verifies a user exists before attempting to change their email. Contributed by @Clubs.
+1
View File
@@ -0,0 +1 @@
`!admin token issue` can no longer issue registration tokens when `allow_registration` is false. Contributed by @Clubs.
+1
View File
@@ -0,0 +1 @@
Fixed URL preview image MIME types and rejected failed downloads. Contributed by @eleboucher.
+89 -34
View File
@@ -891,48 +891,88 @@
#proxy = "none"
# Servers listed here will be used to gather public keys of other servers
# (notary trusted key servers).
# (trusted key notary servers), as well as serve as trusted servers for
# other operations like backfill and event fetching.
#
# Currently, continuwuity doesn't support inbound batched key requests, so
# Currently, continuwuity doesn't support inbound key requests, so
# this list should only contain other Synapse servers.
#
# example: ["matrix.org", "tchncs.de"]
# example: ["matrix.org", "starstruck.systems"]
#
# It is possible to restrict which signing keys trusted servers are
# allowed to sign responses with. Without configuring this, all responses
# from trusted servers will be implicitly trusted, which is fine for most
# users. Strict verification is only necessary if TLS interception is part
# of your threat model. Even without strict verification, signatures from
# the originating server must be valid, regardless of whether the trusted
# server's is valid or not.
#
# To enable strict validation, you need to pass a TOML table containing
# the trusted server name, and any public keys (not key IDs!) that you
# expect to sign responses. You can fetch the current public keys a remote
# server uses with `!admin federation get-signing-keys <server name>`.
# Only add public keys that aren't expired, and make sure to remove any
# that expire at a later date!
#
# Example:
# ```ignore
# trusted_servers = [{server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]}]
# ```
#
# You can also mix-and-match strict verification and lax verification
# trusted servers:
#
# ```ignore
# trusted_servers = [
# {server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]},
# "matrix.org"
# ]
# ```
#
# Trusted servers are queried in parallel, so order does not matter. You
# should not have more than five entries. You can set this value to an
# empty list (`[]`) to operate without trusted server assistance, but this
# is discouraged for performance and reliability reasons.
#
#trusted_servers = ["matrix.org"]
# Whether to query the servers listed in trusted_servers first or query
# the origin server first. For best security, querying the origin server
# first is advised to minimize the exposure to a compromised trusted
# server. For maximum federation/join performance this can be set to true,
# however other options exist to query trusted servers first under
# specific high-load circumstances and should be evaluated before setting
# this to true.
# Whether to prioritise trusted server lookups over origin server lookups.
#
# By default, both notaries and origin servers are queried in parallel,
# and handled on a first-come-first-serve basis, meaning the server always
# uses the fastest response(s).
#
# If you wish to prioritise handling responses from trusted servers
# *before* handling responses from origin servers, set this to true.
#
#query_trusted_key_servers_first = false
# Whether to query the servers listed in trusted_servers first
# specifically on room joins. This option limits the exposure to a
# compromised trusted server to room joins only. The join operation
# requires gathering keys from many origin servers which can cause
# significant delays. Therefor this defaults to true to mitigate
# unexpected delays out-of-the-box. The security-paranoid or those willing
# to tolerate delays are advised to set this to false. Note that setting
# query_trusted_key_servers_first to true causes this option to be
# ignored.
# Any old signing keys that were used to sign events using this server
# name.
#
#query_trusted_key_servers_first_on_join = true
# Only query trusted servers for keys and never the origin server. This is
# intended for clusters or custom deployments using their trusted_servers
# as forwarding-agents to cache and deduplicate requests. Notary servers
# do not act as forwarding-agents by default, therefor do not enable this
# unless you know exactly what you are doing.
# You do not need to populate this unless you previously used a different
# server software with the same server_name configured, and then have
# migrated to continuwuity.
#
#only_query_trusted_key_servers = false
# Maximum number of keys to request in each trusted server batch query.
# The expiry timestamp should be as exact as you can get it, as making it
# too old may inadvertently invalidate historical events sent by your
# server, and potentially make it impossible for you to use some rooms as
# a result. If your key was compromised, and you set the expiry timestamp
# too late, some forged events may continue to be allowed.
#
#trusted_server_batch_size = 1024
# If not configured, continuwuity will discover its own historical keys
# through trusted servers. For improved security, you can set this to an
# empty map ({}) to disable this behaviour, if you know you have no old
# signing keys.
#
# Example:
# {"ed25519:1"={expired_ts=1790506890859,key="d29vZndvb2Z3b29md29vZg"}}
#
# The map key should be the key ID, expired_ts should be unix
# milliseconds, and the actual key value should be the unpadded base64
# representation of the public key component of the expired signing key.
#
#old_verify_keys =
# Max log level for continuwuity. Allows debug, info, warn, or error.
#
@@ -2279,6 +2319,16 @@
#
#additional_scopes = []
# Additional trusted audiences that Continuwuity will accept in the `aud`
# claim of the OIDC token returned by the IDP. If your identity
# provider includes other values in the `aud` claim in addition to the
# client ID, they must be listed here for Continuwuity to accept them.
#
# Most deployments will not need to set this, because most identity
# providers only include the client ID in the `aud` claim by default.
#
#additional_trusted_audiences = []
# The name of the identity provider. If this is set, the login page's
# button reads "Continue with <name>" instead of just "Continue".
#
@@ -2328,10 +2378,15 @@
# Per-room overrides to the user's display name or avatar will be
# preserved by the import process.
#
# SECURITY NOTE: If the `avatar_url` field is set, Continuwuity will
# perform a HTTP GET to the URL in the mapped claim and use the returned
# file as the user's profile picture. Make sure your users are not able
# to set the value of the mapped claim to an arbitrary URL.
# SECURITY NOTE: For the following profile fields, Continuwuity will treat
# the value of the mapped claim as an HTTP URL and upload the file located
# at that URL to its internal media repository:
#
# - `avatar_url`
# - `chat.commet.profile_banner`
#
# If you map these fields to claims, make sure your users cannot set those
# claims to arbitrary URLs.
#
#profile_key_map = { displayname = "name" }
+1 -1
View File
@@ -50,7 +50,7 @@ EOF
# Developer tool versions
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
ENV BINSTALL_VERSION=1.23.0
ENV BINSTALL_VERSION=1.24.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
+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.23.0
ENV BINSTALL_VERSION=1.24.0
# renovate: datasource=github-releases depName=psastras/sbom-rs
ENV CARGO_SBOM_VERSION=0.9.1
# renovate: datasource=crate depName=lddtree
+8 -3
View File
@@ -2,7 +2,12 @@
{
"type": "file",
"name": "introduction",
"label": "Continuwuity"
"label": "Introduction"
},
{
"type": "dir",
"name": "deploying",
"label": "Deploying"
},
{
"type": "file",
@@ -11,8 +16,8 @@
},
{
"type": "dir",
"name": "deploying",
"label": "Deploying"
"name": "authentication",
"label": "Authentication"
},
{
"type": "dir",
+35
View File
@@ -0,0 +1,35 @@
# Authentication
This chapter describes various ways to authenticate to Continuwuity.
## Authentication flows
Continuwuity implements the following authentication flows:
- **OAuth login** (also known as **next-gen auth**): clients redirect the user to Continuwuity's own login and registration page to complete the authentication process.
- **Legacy login** (also known as the **User Interactive Authentication** framework): clients provide their own UI to log in to or register with the server directly.
Different sets of clients support different flows, but most clients are moving towards next-gen auth. One can set which login modes are allowed via the `compatibility_mode` variable of the `[global.oauth]` config file section.
:::important Configure your client well-known for OAuth logins
To ensure OAuth logins work, Continuwuity must know the base URL its Client-Server API is being served on:
```toml
[global.well_known]
client = "https://matrix.example.com"
```
Refer to the [delegation](./guides/delegation) documentation for more details.
:::
## Authentication sources
Continuwuity can read user authentication data from the following sources:
- **Internal authentication** - this is the default setup, where Continuwuity reads user authentication data from its local database. It allows for registration, email, and password reset self-service. See the [**internal authentication documentation**](./authentication/internal).
- **Delegated authentication** - in this mode, the server connects to an OpenID Connect identity provider for user authentication. This method allows for integrating with single sign-on services, but enabling it will disable legacy logins. See the [**delegated authentication documentation**](./authentication/oidc).
Only one authentication source can be used at a time.
+12
View File
@@ -0,0 +1,12 @@
[
{
"type": "file",
"name": "internal",
"label": "Internal authentication"
},
{
"type": "file",
"name": "oidc",
"label": "Delegated authentication (OIDC)"
}
]
+46
View File
@@ -0,0 +1,46 @@
# Internal authentication
Continuwuity comes with an internal database for user authentication, which it uses by default. This allows for self-servicing of account registration, linking emails, and password resets.
## 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.
| Method | Description | Additional configuration needed |
| ------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Admin-issued tokens (recommended) | None. Use the [`!admin token issue`](../reference/admin/token#admin-token-issue) command |
| 2 | Static registration token | `registration_token` or `registration_token_file` |
| 3 | Token + email | Method 1 or 2 + `require_email_for_token_registration = true` in `[global.smtp]`. See [Email configuration](#email-configuration) |
| 4 | Email-only registration | `require_email_for_registration = true` in `[global.smtp]` section. See [Email configuration](#email-configuration) |
| 5 | reCAPTCHA-only registration | `recaptcha_site_key` and `recaptcha_private_site_key` |
| 6 | Email + reCAPTCHA registration | Methods 4 + 5 |
Admin-issued tokens are the recommended registration method. These tokens are well suited for private or invite-only servers, and they can be scoped with an expiry duration or given a usage limit. See the [`!admin token`](../reference/admin/token) commands for more details.
Other registration methods are meant for **untrusted, public registration**. Care must be taken when allowing these modes of operation.
## 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.
A user is associated with only **one** email address at a time.
All email options are in the `[global.smtp]` block of the [configuration file](../reference/config.mdx), and are toggled on when the block is uncommented. For example:
```toml
[global.smtp]
# Example URI for the user john@example.com on the `mail.example.net` mail server
connection_uri = "smtps://john%40example.com:password@mail.example.net:465"
sender = "John's Continuwuity server <john@example.com>"
```
A user's email address can also be modified by the [`!admin users change-email`](../reference/admin/users#admin-users-change-email) command. To view current user-email associations, use the `!admin users get-email` and `!admin users get-user-by-email` command.
Use [`!admin debug send-test-email`](../reference/admin/debug#admin-debug-send-test-email) to test that your email setup is working.
## Password resets
Password resets in Continuwuity can be made via:
- Self-service password resets. This requires a user's email to have been set up and verified.
- Using the [`!admin users reset-password`](../reference/admin/users#admin-users-reset-password) command.
+103
View File
@@ -0,0 +1,103 @@
# Delegated authentication with OIDC
Continuwuity supports delegating user authentication to an external identity provider that implements the OpenID Connect (OIDC) specification, such as Authentik, Kanidm, or Keycloak.
:::important Delegated authentication and legacy logins
When delegated authentication is configured, Continuwuity will disable its support for legacy logins. **Only clients that support OAuth** will be able to login.
:::
An account on the homeserver can only be associated with one OIDC subject claim - that is, one account on the identity provider - at a time. Linking an account will also prevent the user from deactivating it themselves.
## Instructions
A simple OIDC configuration is as easy as creating a new OIDC application in your identity provider's settings and supplying Continuwuity with the client ID and client secret.
### Configuring the OIDC provider
This guide will use [**Kanidm**][kanidm] as an example, but the described steps are broadly applicable to other identity providers. Contributions for them are welcome.
First, create a new application for Continuwuity in your identity provider.
```sh
# Here, `c10y` is the client ID that Kanidm will use, and `Continuwuity` is the display name.
# Other identity providers may generate a client ID for you.
# Use the domain that clients can reach Continuwuity at, which may not be the same as your server name
# if you have configured well-known delegation.
kanidm system oauth2 create c10y Continuwuity https://matrix.yourdomain.com
```
Configure the redirect URL that Continuwuity uses.
```sh
kanidm system oauth2 add-redirect-url c10y https://matrix.yourdomain.com/_continuwuity/oidc/complete
```
Allow Continuwuity to request the `openid` scope. Other identity providers may not require this step.
```sh
kanidm system oauth2 update-scope-map c10y idm_all_persons openid
```
Find the client secret that was generated. Other identity providers may show this information in their web UI.
```sh
kanidm system oauth2 show-basic-secret c10y
d1qgx352kkuvs1j70b6w293d65x68jve1f7b27fyk90gjhpr
```
[kanidm]: https://kanidm.com
### Configuring Continuwuity
Configure Continuwuity with the client ID, client secret, and discovery URL provided from the steps above. Kanidm has a different discovery URL for each client, but other identity providers may have a single discovery URL at the root of their domain.
```toml
[global.oauth.oidc]
# `/.well-known/openid-configuration` will be appended automatically
discovery_url = "https://idm.example.com/oauth2/openid/c10y"
# This may be randomly generated by your identity provider. Kanidm requires
# you to set it manually when you create the application.
client_id = "c10y"
# From the previous step
client_secret = "d1qgx352kkuvs1j70b6w293d65x68jve1f7b27fyk90gjhpr"
```
### Testing that it works
Finally, restart Continuwuity, and log out and back in again. Your client should prompt you to continue in your web browser and open a webpage with the Continuwuity logo that allows you to continue in your identity provider. Once you log in successfully there, you will be prompted to choose a user ID -- to link your existing account, enter its user ID, and then your old password.
Continuwuity offers several additional configuration options to tweak its integration with your identity provider. Review the `[global.oauth.oidc]` section towards the bottom of the [reference configuration](../reference/config) for a complete list of options and documentation.
## Advanced options
### Minting tokens for non-OIDC accounts
With OIDC delegation enabled, accounts without an OIDC mapping (such as bot accounts) can still be created via the admin commands, but will not be able to log in to the homeserver. To accommodate this, homeserver admins can use the [`!admin users issue-token`](../reference/admin/users#admin-users-issue-token) command to issue tokens for them. This command requires the account to have set a local password, which can be done with [`!admin users reset-password`](../reference/admin/users#admin-users-reset-password).
### Manually linking users to OIDC claims
To view associations between local users and their linked subject claim, issue the following command:
```
!admin query raw raw-iter openidsubject_localpart
("1d3fc994-3947-406d-b22c-0fc529baf235", "john")
("ba543628-e6a5-45d8-9bd2-6cc497400136", "jane")
```
These associations can be changed manually with the [`!admin oidc`](../reference/admin/oidc) commands, which are useful to debug some account linkage issues. For example, to link the user `jane` to a new Subject Identifier claim of `721c36a8-ce04-4474-8e97-b62655b07340`:
```
!admin oidc unlink ba543628-e6a5-45d8-9bd2-6cc497400136
Subject `ba543628-e6a5-45d8-9bd2-6cc497400136` unlinked.
!admin oidc link jane 721c36a8-ce04-4474-8e97-b62655b07340
Subject `721c36a8-ce04-4474-8e97-b62655b07340` linked to account @jane:example.com.
!admin query raw raw-iter openidsubject_localpart
("1d3fc994-3947-406d-b22c-0fc529baf235", "john")
("721c36a8-ce04-4474-8e97-b62655b07340", "jane")
```
### Decommissioning OIDC delegation
It is possible to revert to using the internal database for authentication. First, comment out the `[global.oauth.oidc]` section in your config file and restart the homeserver. Then, execute the [`!admin users reset-password --convert-to-local-account`](../reference/admin/users#admin-users-reset-password) for each user to assign them a local password and convert their linked accounts into local ones.
+106 -1
View File
@@ -1,3 +1,108 @@
import { OverviewGroup } from '@rspress/core/theme';
# Deploying
This chapter describes various ways to deploy Continuwuity.
This chapter describes various ways to deploy Continuwuity. Start reading on this page for useful general information, and then proceed to one of the deployment methods.
:::tip Getting help
If you run into any problems while setting up Continuwuity, ask us in [`#continuwuity:continuwuity.org`][support-room] or [open an issue on Forgejo][forgejo-new-issue].
:::
[support-room]: https://matrix.to/#/%23continuwuity:continuwuity.org
[forgejo-new-issue]: https://forgejo.ellis.link/continuwuation/continuwuity/issues/new
## Release tracks
Continuwuity offers two release tracks to accommodate different needs: tracking the **main branch** of the [repository], and following the regular **release schedule**.
### Main branch
As Continuwuity is rapidly evolving software, we encourage deployments to follow the main branch to receive the latest fixes and features. Commits in main are stable and have been thoroughly tested by the maintainers before merging.
To be notified of updates to main, it is best to [**track the `/changelog.d` directory**][changelog-d] in the repository, which contains changelog snippets from merged pull requests. These may contain breaking changes. Then, proceed to update or build Continuwuity according to your deployment method.
[repository]: https://forgejo.ellis.link/continuwuation/continuwuity
[changelog-d]: https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/main/changelog.d
### Regular releases
Regular releases are periodic, versioned cutoffs from the main branch from time to time, and can be found on the [Releases] page. They are suitable in cases where updating more frequently is not viable, such as when using third-party packaging.
For regular releases, **always read the release notes before upgrading to a new version**, as they may contain breaking changes that affect your deployment.
[Releases]: https://forgejo.ellis.link/continuwuation/continuwuity/releases
## Installation
:::info Mind the name!
The binary for Continuwuity is called `conduwuit`, and the configuration file `conduwuit.toml`.
:::
To have Continuwuity working, you will generally need to:
1. Have a domain name pointing to your server's IP address - we will be using `example.com` in our guides.
2. Download or build Continuwuity from your preferred source.
3. Configure Continuwuity via the config file or environment variables. See the [Configuration](./configuration.mdx) page for more.
4. Employ a reverse proxy in front of Continuwuity - we will mainly provide examples for Caddy in our guides.
5. And finally, start the Continuwuity service.
Navigate to your preferred method of deploying Continuwuity as listed below, and follow the instructions there.
<OverviewGroup
group={{
items: [
{
"link": "deploying/generic",
"text": "Generic"
},
{
"link": "deploying/docker",
"text": "Docker"
},
{
"link": "deploying/debian",
"text": "Debian"
},
{
"link": "deploying/rpm",
"text": "RPM"
},
{
"link": "deploying/nixos",
"text": "NixOS"
},
{
"link": "deploying/arch-linux",
"text": "Arch Linux"
},
{
"link": "deploying/freebsd",
"text": "FreeBSD"
},
{
"link": "deploying/kubernetes",
"text": "Kubernetes"
},
{
"link": "deploying/nomad",
"text": "Nomad"
}
],
}}
/>
## Post-installation
After Continuwuity is up and running, consider the following:
- For smooth federation, set up a caching resolver according to the [**DNS tuning guide**](./guides/dns.mdx) (strongly recommended).
- To set up Audio/Video communication, see the [**Calls**](./calls.mdx) page.
- See the [**Authentication chapter**] 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.
- If you want to set up an appservice, take a look at the [**Appservice Guide**](./appservices.mdx).
- See the [**Troubleshooting**](./troubleshooting.mdx) page for commonly diagnosed issues.
+5 -5
View File
@@ -29,6 +29,11 @@
"name": "arch-linux",
"label": "Arch Linux"
},
{
"type": "file",
"name": "freebsd",
"label": "FreeBSD"
},
{
"type": "file",
"name": "kubernetes",
@@ -38,10 +43,5 @@
"type": "file",
"name": "nomad",
"label": "Nomad"
},
{
"type": "file",
"name": "freebsd",
"label": "FreeBSD"
}
]
+8 -2
View File
@@ -1,5 +1,11 @@
# Continuwuity for Arch Linux
Continuwuity is available in the `archlinuxcn` repository and AUR with the same package name `continuwuity`, which includes the latest tagged version. The development version is available on AUR as `continuwuity-git`.
Continuwuity is available in the [`archlinuxcn`][archlinuxcn] repository and AUR with the same package name, [`continuwuity`][aur-continuwuity].
Simply install the `continuwuity` package. Configure the service in `/etc/conduwuit/conduwuit.toml`, then enable and start the continuwuity.service.
The development version is available on the AUR as [`continuwuity-git`][aur-continuwuity-git].
[archlinuxcn]: https://www.archlinuxcn.org/
[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`.
+12 -11
View File
@@ -1,15 +1,17 @@
# Continuwuity for Docker
This page describes how to deploy Continuwuity via Docker containers. Make sure that you have installed `docker` on your system before continuing.
## Preparation
### Choose an image
The following OCI images are available for Continuwuity:
| Image | Notes |
| Image | Notes |
| ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**latest**][latest] | Latest tagged release. (recommended) |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main**][main] | Latest `main` branch commit. Built with [CI][release-image] |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**latest**][latest] | Latest tagged release. |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main**][main] | Latest `main` branch commit. Built with [CI][release-image] |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**latest-maxperf**][latest-maxperf] | Latest tagged release, [performance optimised version](./generic.mdx#performance-optimised-builds). |
| [https://forgejo.ellis.link/continuwuation/continuwuity:**main-maxperf**][main-maxperf] | Latest `main` branch commit, [performance optimised version](./generic.mdx#performance-optimised-builds). |
@@ -210,7 +212,13 @@ docker compose pull
docker compose up -d
```
## Other deployment methods
## What's next?
Navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
---
## Appendix - Other deployment methods
### Docker - Quick Run
@@ -289,10 +297,3 @@ From there you can access the server's console by running `docker attach <contai
Note that using `CTRL+c` within `docker attach`'s context will forward the signal to the server, stopping it. See [Docker's reference][docker-attach-reference] for more information.
[docker-attach-reference]: https://docs.docker.com/reference/cli/docker/container/attach/
## Next steps
- For smooth federation, set up a caching resolver according to the [**DNS tuning guide**](../guides/dns.mdx) (recommended)
- To set up Audio/Video communication, see the [**Calls**](../calls.mdx) page.
- Consult the [Maintenance](../maintenance.mdx) page for guidance on maintaining your homeserver.
- If you want to set up an appservice, take a look at the [**Appservice Guide**](../appservices.mdx).
+3 -1
View File
@@ -4,4 +4,6 @@ Continuwuity doesn't provide official FreeBSD packages; however, a community-mai
Please see the installation instructions in that repository. Direct any questions to its issue tracker or to [@katie:kat5.dev](https://matrix.to/#/@katie:kat5.dev).
For general BSD support, please join our [Continuwuity BSD](https://matrix.to/#/%23bsd:continuwuity.org) community room.
For general BSD support, please join our [Continuwuity support room][support-room].
[support-room]: https://matrix.to/#/%23continuwuity:continuwuity.org
+4 -12
View File
@@ -1,12 +1,6 @@
# Generic deployment documentation
:::tip Getting help
If you run into any problems while setting up Continuwuity, ask us in
`#continuwuity:continuwuity.org` or [open an issue on
Forgejo][forgejo-new-issue].
:::
[forgejo-new-issue]: https://forgejo.ellis.link/continuwuation/continuwuity/issues/new
This page provides instructions on deploying Continuwuity on a generic Linux distro via a systemd service file. It also contains common routing instructions for reverse proxies.
## Installing Continuwuity
@@ -270,11 +264,9 @@ curl https://example.com/_matrix/client/versions
## What's next?
- For smooth federation, set up a caching resolver according to the [**DNS tuning guide**](../guides/dns.mdx) (recommended)
- To configure OIDC login with an identity provider, see the [**delegated authentication guide**](../guides/oidc.mdx).
- For Audio/Video call functionality see the [**Calls**](../calls.md) page.
- Consult the [Maintenance](../maintenance.mdx) page for guidance on maintaining your homeserver.
- If you want to set up an appservice, take a look at the [**Appservice Guide**](../appservices.md).
Navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
---
## Appendix
+36 -20
View File
@@ -1,4 +1,4 @@
import { Tab, Tabs} from '@rspress/core/theme';
import { Tab, Tabs } from '@rspress/core/theme';
# RPM Installation Guide
@@ -28,7 +28,7 @@ Available for openSUSE Tumbleweed, Slowroll, and [supported Leap versions](https
## Installation methods
### Stable releases (recommended)
### Stable releases
<Tabs groupId="distro">
<Tab label="Fedora">
@@ -49,6 +49,7 @@ openSUSE packages are available through an openSUSE Build Service project namesp
</Tabs>
### Nightly releases
Nightly versions are built from the latest commit on the `main` branch every 24 hours.
<Tabs groupId="distro">
@@ -68,14 +69,22 @@ In the meantime, you may follow the [generic deployment instructions](generic).
</Tab>
</Tabs>
## Service management and removal
## Configuration
**Systemd service commands**
Consult the [generic deployment instructions](./generic.mdx) for detailed steps. You will at least need to adjust the config file located at `/etc/conduwuit/conduwuit.toml` to suit your needs, and configure a [reverse proxy](./generic.mdx#setting-up-the-reverse-proxy).
## Service management
Now, you can start your Continuwuity service with:
```bash
# Start the service
sudo systemctl start conduwuit
```
Other useful commands include:
```bash
# Enable on boot
sudo systemctl enable conduwuit
@@ -84,27 +93,13 @@ sudo systemctl status conduwuit
# View logs
sudo journalctl -u conduwuit -f
```
**Uninstallation**
```bash
# Stop and disable the service
# Stopping the service
sudo systemctl stop conduwuit
sudo systemctl disable conduwuit
# Remove the package
sudo dnf remove continuwuity # replace `dnf` with `zypper` on openSUSE
```
## Troubleshooting
**GPG key errors**: Temporarily disable GPG checking
```bash
sudo dnf --nogpgcheck install continuwuity
```
**Repository metadata issues**: Clear and rebuild cache
```bash
@@ -122,7 +117,28 @@ dnf --showduplicates list continuwuity
sudo dnf install continuwuity-<version>
```
## Building locally
## What's next?
Navigate to [Post-installation](../deploying.mdx#post-installation) for next steps.
---
## Appendix
### Uninstallation
To uninstall Continuwuity:
```bash
# Stop and disable the service
sudo systemctl stop conduwuit
sudo systemctl disable conduwuit
# Remove the package
sudo dnf remove continuwuity # replace `dnf` with `zypper` on openSUSE
```
### Building locally
<Tabs groupId="distro">
<Tab label="Fedora">
-5
View File
@@ -13,10 +13,5 @@
"type": "file",
"name": "performance",
"label": "Performance tuning"
},
{
"type": "file",
"name": "oidc",
"label": "Delegated authentication"
}
]
-56
View File
@@ -1,56 +0,0 @@
# Configuring delegated authentication
Continuwuity supports delegating user authentication to an external identity provider that implements the OpenID Connect specification, such as Authentik, kanidm, or Keycloak.
:::warning{title="OIDC versus OAuth, and supported clients"}
**OIDC** is not to be confused with **OAuth**. In the context of Matrix, OAuth is the protocol that Matrix clients use to authenticate with the _homeserver_. OIDC is the protocol that the _homeserver_ uses to communicate with the _identity provider_. Continuwuity supports OAuth by default, alongside the legacy **UIAA** authentication framework.
When OIDC is configured, Continuwuity will disable its support for legacy authentication. **Only clients that support OAuth**, such as the Element family of clients, will be able to log in when OIDC is configured. If your client of choice shows an error when you try to log in after configuring OIDC, it likely does not support OAuth. This is an issue with your client, not Continuwuity, and should be reported to your client's developers.
:::
A simple OIDC configuration is as easy as creating a new OIDC application in your identity provider's settings and supplying Continuwuity with the client ID and client secret. This guide will use kanidm as an example, but the described steps are broadly applicable to other identity providers.
First, create a new application for Continuwuity in your identity provider.
```sh
# Here, `c10y` is the client ID that kanidm will use, and `Continuwuity` is the display name.
# Other identity providers may generate a client ID for you.
# Use the domain that clients can reach Continuwuity at, which may not be the same as your server name
# if you have configured well-known delegation.
kanidm system oauth2 create c10y Continuwuity https://matrix.yourdomain.com
```
Configure the redirect URL that Continuwuity uses.
```sh
kanidm system oauth2 add-redirect-url c10y https://matrix.yourdomain.com/_continuwuity/oidc/complete
```
Allow Continuwuity to request the `openid` scope. Other identity providers may not require this step.
```sh
kanidm system oauth2 update-scope-map c10y idm_all_persons openid
```
Find the client secret that was generated. Other identity providers may show this information in their web UI.
```sh
kanidm system oauth2 show-basic-secret c10y
d1qgx352kkuvs1j70b6w293d65x68jve1f7b27fyk90gjhpr
```
Configure Continuwuity with the client ID, client secret, and discovery URL. kanidm has a different discovery URL for each client, but other identity providers may have a single discovery URL at the root of their domain.
```toml
[global.oauth.oidc]
# `/.well-known/openid-configuration` will be appended automatically
discovery_url = "https://idm.example.com/oauth2/openid/c10y"
# This may be randomly generated by your identity provider. kanidm requires
# you to set it manually when you create the application.
client_id = "c10y"
# From the previous step
client_secret = "d1qgx352kkuvs1j70b6w293d65x68jve1f7b27fyk90gjhpr"
```
Finally, restart Continuwuity, and log out and back in again. Your client should prompt you to continue in your web browser and open a webpage with the Continuwuity logo that allows you to continue in your identity provider. Once you log in successfully, you will be prompted to choose a user ID -- to link your existing account, enter its user ID, and then your old password when prompted.
Continuwuity offers several additional configuration options to tweak its integration with your identity provider. Review the `[global.oauth.oidc]` section towards the bottom of the [reference configuration](../reference/config) for a complete list of options and documentation.
+3 -28
View File
@@ -15,6 +15,9 @@ hero:
- theme: alt
text: Star on GitHub
link: https://github.com/continuwuity/continuwuity
- theme: alt
text: Donate to us!
link: https://opencollective.com/continuwuity
image:
src: /assets/logo.svg
alt: continuwuity logo
@@ -29,33 +32,5 @@ beforeFeatures:
link: https://matrix.org/docs/matrix-concepts/elements-of-matrix/
buttonText: Read the Guide
features:
- title: 🚀 High Performance
details: Built with Rust for exceptional speed and efficiency. Designed to run smoothly even on modest hardware.
- title: 🔒 Secure by Default
details: Memory-safe Rust implementation with built-in security features to protect your communication.
- title: 🌐 Matrix Protocol
details: Fully compatible with the Matrix ecosystem. Connect with users across the federated network.
- title: 🛠️ Community Maintained
details: Actively developed by a dedicated community of Matrix enthusiasts and contributors.
- title: 📦 Easy to Deploy
details: Multiple deployment options including Docker, NixOS, and traditional package managers.
- title: 🔌 Appservice Support
details: Bridge to other platforms like Discord, Telegram, and more with Matrix appservices.
doc: false
---
## What is Continuwuity?
Continuwuity is a Matrix homeserver.
Matrix is an open chat network that lets anyone talk to anyone, no matter what server or address they use - sort of like email.
Continuwuity receives and keeps track of all your messages, and delivers what you send to the right people.
## Why is Continuwuity different?
Continuwuity is light and fast, using a fraction of the memory of other major homeservers. It's also simple to set up, and secure by default.
We are a community run project, filled with diverse and friendly people. Everything is built by people who care about the project volunteering their free time.
+86 -70
View File
@@ -1,98 +1,114 @@
<div align="center">
<img src="/assets/logo.svg" width="150"/>
# Continuwuity
## A community-driven [Matrix](https://matrix.org/) homeserver in Rust
</div>
[![Chat on Matrix](https://img.shields.io/matrix/continuwuity%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix)](https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) [![Join the space](https://img.shields.io/matrix/space%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix&label=space)](https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org)
## What is Continuwuity?
[continuwuity] is a Matrix homeserver written in Rust.
It's the official community continuation of the [conduwuit](https://github.com/girlbossceo/conduwuit) homeserver.
Continuwuity is a Matrix homeserver. [Matrix] is an open chat network that lets anyone talk to anyone, no matter what server or address they use, like email.
[![forgejo.ellis.link](https://img.shields.io/badge/Ellis%20Git-main+packages-green?style=flat&logo=forgejo&labelColor=fff)](https://forgejo.ellis.link/continuwuation/continuwuity) [![Stars](https://forgejo.ellis.link/continuwuation/continuwuity/badges/stars.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/stars) [![Issues](https://forgejo.ellis.link/continuwuation/continuwuity/badges/issues/open.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/issues?state=open) [![Pull Requests](https://forgejo.ellis.link/continuwuation/continuwuity/badges/pulls/open.svg?style=flat)](https://forgejo.ellis.link/continuwuation/continuwuity/pulls?state=open)
Continuwuity receives and keeps track of all your messages, and delivers what you send to the right people.
[![GitHub](https://img.shields.io/badge/GitHub-mirror-blue?style=flat&logo=github&labelColor=fff&logoColor=24292f)](https://github.com/continuwuity/continuwuity) [![Stars](https://img.shields.io/github/stars/continuwuity/continuwuity?style=flat)](https://github.com/continuwuity/continuwuity/stargazers)
[Matrix]: https://matrix.org
[![GitLab](https://img.shields.io/badge/GitLab-mirror-blue?style=flat&logo=gitlab&labelColor=fff)](https://gitlab.com/continuwuity/continuwuity) [![Stars](https://img.shields.io/gitlab/stars/continuwuity/continuwuity?style=flat)](https://gitlab.com/continuwuity/continuwuity/-/starrers)
## Why is Continuwuity different?
[![Codeberg](https://img.shields.io/badge/Codeberg-mirror-2185D0?style=flat&logo=codeberg&labelColor=fff)](https://codeberg.org/continuwuity/continuwuity) [![Stars](https://codeberg.org/continuwuity/continuwuity/badges/stars.svg?style=flat)](https://codeberg.org/continuwuity/continuwuity/stars)
Continuwuity is light and fast, using a fraction of the resources of other major homeservers. It's also simple to set up, and secure by default.
## Why does this exist?
We are a community-run project, made up of friendly and diverse people. Everything is built by people who care about the project volunteering their free time.
The original conduwuit project has been archived and is no longer maintained. Rather than letting this Rust-based Matrix homeserver disappear, a group of community contributors have forked the project to continue its development, fix outstanding issues, and add new features.
## Deploying Continuwuity
We aim to provide a stable, well-maintained alternative for current conduwuit users and welcome newcomers seeking a lightweight, efficient Matrix homeserver.
Head over to the [**Deploying chapter**](./deploying.mdx) to get started.
## Who are we?
## Try it out!
We are a group of Matrix enthusiasts, developers and system administrators who have used conduwuit and believe in its potential. Our team includes both previous
contributors to the original project and new developers who want to help maintain and improve this important piece of Matrix infrastructure.
If you want to try it out as a user, we have some [partnered homeservers](./community/ops-guidelines.mdx) you can use:
We operate as an open community project, welcoming contributions from anyone interested in improving continuwuity.
**`federated.nexus`** - A community resource hosting multiple FOSS (especially federated) services.
- Go to https://federated.nexus, click on "Apply to Join", and follow the prompts.
- Once your request has been accepted, you will receive an email with your username and password, which you can use to sign in from any Matrix client.
- Remember to change your password after logging in!
## What is Matrix?
**`continuwuity.rocks`** - the demo server, run by us.
- Sign up using any Matrix client, or via this [convenient link][cinny-register] for Cinny.
[Matrix](https://matrix.org) is an open, federated, and extensible network for
decentralized communication. Users from any Matrix homeserver can chat with users from all
other homeservers over federation. Matrix is designed to be extensible and built on top of.
You can even use bridges such as Matrix Appservices to communicate with users outside of Matrix, like a community on Discord.
[cinny-register]: https://app.cinny.in/register/continuwuity.rocks
## What are the project's goals?
## Donate to us {#donate}
continuwuity aims to:
If you like what we're doing, consider donating to our Open Collective via the button below!
- Maintain a stable, reliable Matrix homeserver implementation in Rust
- Improve compatibility and specification compliance with the Matrix protocol
- Fix bugs and performance issues from the original conduwuit
- Add missing features needed by homeserver administrators
- Provide comprehensive documentation and easy deployment options
- Create a sustainable development model for long-term maintenance
- Keep a lightweight, efficient codebase that can run on modest hardware
<div class="no-zoom" align="center">
<br/>
<a href="https://opencollective.com/continuwuity" target="_blank">
<img src="https://opencollective.com/webpack/donate/button@2x.png?color=blue" width="250"/>
</a>
</div>
## Can I try it out?
You can also donate individually to each of the maintainers
Check out the [documentation](https://continuwuity.org) for installation instructions.
- Nex: https://timedout.uk/donate.html
If you want to try it out as a user, we have some partnered homeservers you can use:
* You can head over to [https://federated.nexus](https://federated.nexus/) in your browser.
* Hit the `Apply to Join` button. Once your request has been accepted, you will receive an email with your username and password.
* Head over to [https://app.federated.nexus](https://app.federated.nexus/) and you can sign in there, or use any other matrix chat client you wish elsewhere.
* Your username for matrix will be in the form of `@username:federated.nexus`, however you can simply use the `username` part to log in. Your password is your password.
- Jade: https://jade.ellis.link/sponsors
* There's also [https://continuwuity.rocks/](https://continuwuity.rocks/). You can register a new account using Cinny via [this convenient link](https://app.cinny.in/register/continuwuity.rocks), or you can use Element or another matrix client *that supports registration*.
## What are we working on?
We're working our way through all of the issues in the [Forgejo project](https://forgejo.ellis.link/continuwuation/continuwuity/issues).
- [Packaging & availability in more places](https://forgejo.ellis.link/continuwuation/continuwuity/issues/747)
- [Appservices bugs & features](https://forgejo.ellis.link/continuwuation/continuwuity/issues?q=&type=all&state=open&labels=178&milestone=0&assignee=0&poster=0)
- [Improving compatibility and spec compliance](https://forgejo.ellis.link/continuwuation/continuwuity/issues?labels=119)
- Automated testing
- [Admin API](https://forgejo.ellis.link/continuwuation/continuwuity/issues/748)
- [Policy-list controlled moderation](https://forgejo.ellis.link/continuwuation/continuwuity/issues/750)
## Can I migrate my data from x?
- **Conduwuit**: Yes
- **Conduit**: No, database is now incompatible
- **Grapevine**: No, database is now incompatible
- **Dendrite**: No
- **Synapse**: No
We haven't written up a guide on migrating from incompatible homeservers yet. Reach out to us if you need to do this!
## How can I deploy my own?
- [Deployment options](deploying)
If you want to connect an appservice to continuwuity, take a look at the
[appservices documentation](appservices).
## How can I contribute?
See the [contributor's guide](development/contributing)
- Ginger: https://github.com/sponsors/gingershaped
## Contact
Join our [Matrix room](https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) and [space](https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org) to chat with us about the project!
[continuwuity]: https://forgejo.ellis.link/continuwuation/continuwuity
<div class="no-zoom" align="center">
[![Chat on Matrix][matrix-chat-badge]][matrix-chatroom]
[![Join the space][matrix-space-badge]][matrix-space]
</div>
[matrix-chat-badge]: https://img.shields.io/matrix/continuwuity%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix
[matrix-chatroom]: https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
[matrix-space-badge]: https://img.shields.io/matrix/space%3Acontinuwuity.org?server_fqdn=matrix.continuwuity.org&fetchMode=summary&logo=matrix&label=space
[matrix-space]: https://matrix.to/#/#space:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
Our source code and mirrors can be accessed through these buttons:
<div class="no-zoom" align="center">
[![forgejo.ellis.link][forge-badge]][forge-link]
[![Releases][forge-releases-badge]][forge-releases-link]
[![Stars][forge-stars-badge]][forge-stars-link]
[![Issues][forge-issues-badge]][forge-issues-link]
[![Pull Requests][forge-pulls-badge]][forge-pulls-link]
[![GitHub][github-badge]][github-link] ![Stars][github-stars-badge] -
[![Codeberg][codeberg-badge]][codeberg-link] [![Stars][codeberg-stars-badge]][codeberg-stars-link] -
[![GitLab][gitlab-badge]][gitlab-link] [![Stars][gitlab-stars-badge]][gitlab-stars-link]
</div>
[forge-badge]: https://img.shields.io/badge/Ellis%20Git-main+packages-green?style=flat&logo=forgejo&labelColor=fff
[forge-link]: https://forgejo.ellis.link/continuwuation/continuwuity
[forge-releases-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/release.svg?style=flat&label=Latest%20release&labelColor=fff&color=green
[forge-releases-link]: https://forgejo.ellis.link/continuwuation/continuwuity
[forge-stars-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/stars.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-stars-link]: https://forgejo.ellis.link/continuwuation/continuwuity/stars
[forge-issues-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/issues/open.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-issues-link]: https://forgejo.ellis.link/continuwuation/continuwuity/issues?state=open
[forge-pulls-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/pulls/open.svg?style=flat&labelColor=fff&color=8a5cd0
[forge-pulls-link]: https://forgejo.ellis.link/continuwuation/continuwuity/pulls?state=open
[github-badge]: https://img.shields.io/badge/GitHub-mirror-blue?style=flat&logo=github&labelColor=fff&logoColor=24292f
[github-link]: https://github.com/continuwuity/continuwuity
[github-stars-badge]: https://img.shields.io/github/stars/continuwuity/continuwuity?style=flat&logo=github
[gitlab-badge]:https://img.shields.io/badge/GitLab-mirror-blue?style=flat&logo=gitlab&labelColor=fff
[gitlab-link]: https://gitlab.com/continuwuity/continuwuity
[gitlab-stars-badge]: https://img.shields.io/gitlab/stars/continuwuity/continuwuity?style=flat
[gitlab-stars-link]: https://gitlab.com/continuwuity/continuwuity/-/starrers
[codeberg-badge]:https://img.shields.io/badge/Codeberg-mirror-2185D0?style=flat&logo=codeberg&labelColor=fff
[codeberg-link]: https://codeberg.org/continuwuity/continuwuity
[codeberg-stars-badge]: https://codeberg.org/continuwuity/continuwuity/badges/stars.svg?style=flat
[codeberg-stars-link]: https://codeberg.org/continuwuity/continuwuity/stars
@@ -6,10 +6,10 @@
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
},
{
"id": 19,
"id": 21,
"mention_room": true,
"date": "2026-08-24",
"message": "[Continuwuity 26.8.1](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.8.1) has just been released - this is a bug fix and feature release, with one small security patch. Please read the release notes for more information, before updating as soon as possible.\n\nAny questions? Ask in our [support room](https://matrix.to/#/#continuwuity:continuwuity.org)."
"date": "2026-09-29",
"message": "[Continuwuity 26.9.1](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.9.1) has just been released - this update features a fix for a **critical** security issue, please read the release notes for more information."
}
]
}
+1 -1
View File
@@ -64,7 +64,7 @@ Matrix federation is extremely heavy and sends wild amounts of DNS requests. Thi
Follow the [**DNS tuning guide**](./guides/dns) for details on setting it up.
### Intermittent federation failures to a specific server
### Intermittent federation failures to a specific server {#intermittent}
There may be circumstances where servers fail to connect to each other, probably due to a bad DNS cache. In such cases, issuing `!admin debug ping <SERVER_NAME>` would return some errors, and `!admin query resolver cache <SERVER_NAME>` would return a wrong destination endpoint.
+16 -16
View File
@@ -455,17 +455,17 @@
}
},
"node_modules/@rspress/core": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.21.tgz",
"integrity": "sha512-QxhVqhHhN4guA24MlvlsFTb96pE/X8gBd5RBfp4j1kn5tAu1nJ7A9itKcRAuEw0WYJHcsWtI+WUnd7JPioHtlw==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.0.22.tgz",
"integrity": "sha512-mS/+xJYxVSR72GAjTz8GIGcJwwb2NSbbduq1fQOSv7k73EJ2aa0Q/o14nnnI4DRmRSEmK0t81vkVGcKHWQzPcA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@mdx-js/mdx": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@rsbuild/core": "^2.1.13",
"@rsbuild/core": "^2.2.5",
"@rsbuild/plugin-react": "~2.1.0",
"@rspress/shared": "2.0.21",
"@rspress/shared": "2.0.22",
"@shikijs/rehype": "^4.2.0",
"@types/mdast": "^4.0.4",
"@types/react": "^19.2.18",
@@ -484,7 +484,7 @@
"react-dom": "^19.2.8",
"react-lazy-with-preload": "^2.2.1",
"react-render-to-markdown": "19.1.0",
"react-router-dom": "^7.18.2",
"react-router-dom": "^7.18.3",
"rehype-external-links": "^3.0.0",
"rehype-raw": "^7.0.0",
"remark-cjk-friendly": "^2.3.1",
@@ -508,9 +508,9 @@
}
},
"node_modules/@rspress/plugin-client-redirects": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.21.tgz",
"integrity": "sha512-21giX10Blom+dOJBJOxXZUS+pjez1Tb9iNA7L7km8uUkn5L45KfdQvYqbBHY6Nv6L46zaDdz0Mt97eAqBPgNoA==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.0.22.tgz",
"integrity": "sha512-pyOLIfxji1xbh//H0egdmhXVdO5hfp9dLXCTnZKcet9K3FJpre21/syuhRbRwWviMpcKtE73PZVcSaNVTYQYZw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -521,9 +521,9 @@
}
},
"node_modules/@rspress/plugin-sitemap": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.21.tgz",
"integrity": "sha512-PldjjLDFqtQZ3yPHHsWxmxGNlmoNH7nSx76ww7QkPzkO9rPrlr71sBLZR3MMc1s6cd5Csyd+gHjfIJiP7o77XQ==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.0.22.tgz",
"integrity": "sha512-2SNLW8Oh4osCyqnzea1WDVA9469Luwu0piNuh5HNjlzcgjguzynA3447WRFpqBL1Z/B7H5IB5SMcwYaMsgFhvQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -534,13 +534,13 @@
}
},
"node_modules/@rspress/shared": {
"version": "2.0.21",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.21.tgz",
"integrity": "sha512-siCWkv1a4n6y7JdVRII+fwCRZGZtG5KGFfKi2w/Tt33UnIgh4XGqozZ5F/K0iZ/QUwg0wi93SoVdOQm2Q+wf8w==",
"version": "2.0.22",
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.0.22.tgz",
"integrity": "sha512-1UXwG6gAhWBw5vClv3wb2Oy8hPXYNgQwQ5zWXEG8auY5ZcMywvHCBi6pFJtYNOgXe5327lNgiOG0S1R8l0OLeg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rsbuild/core": "^2.1.13",
"@rsbuild/core": "^2.2.5",
"@shikijs/rehype": "^4.2.0",
"@types/react": "^19.2.18",
"mdast-util-mdx-jsx": "^3.2.0",
+7 -3
View File
@@ -2,7 +2,7 @@
This document provides information about downloading and deploying the Debian package. You can also use this guide for other deb-based distributions such as Ubuntu.
### Installation
## Installation
To add the Continuwuation apt repository:
```bash
@@ -26,16 +26,20 @@ The `continuwuity` package conflicts with the old `conduwuit` package and will r
See the [generic deployment guide](/deploying/generic.mdx) for additional information about using the Debian package.
### Configuration
## Configuration
After installation, Continuwuity places the example configuration at `/etc/conduwuit/conduwuit.toml` as the default configuration file. The configuration file indicates which settings you must change before starting the service.
You can customize additional settings by uncommenting and modifying the configuration options in `/etc/conduwuit/conduwuit.toml`.
### Running
## Running
The package uses the `conduwuit.service` systemd unit file to start and stop Continuwuity. The binary installs at `/usr/bin/conduwuit`.
By default, this package assumes that Continuwuity runs behind a reverse proxy. The default configuration options apply (listening on `localhost` and TCP port `6167`). Matrix federation requires a valid domain name and TLS. To federate properly, you must set up TLS certificates and certificate renewal.
For information about setting up a reverse proxy and TLS, consult online documentation and guides. The [generic deployment guide](/deploying/generic.md#setting-up-the-reverse-proxy) documents Caddy, which is the most user-friendly option for reverse proxy configuration.
## What's next?
Navigate to [Post-installation](/deploying#post-installation) for next steps.
+20 -8
View File
@@ -11,6 +11,10 @@ export default defineConfig({
light: '/assets/logo.svg',
dark: '/assets/logo.svg',
},
// Use `.no-zoom` class to disable image zooms
mediumZoom: {
selector: '.rspress-doc :not(.no-zoom *) > img',
},
markdown: {
link: {
checkDeadLinks: {
@@ -26,7 +30,8 @@ export default defineConfig({
'/advanced/delegated.docker-compose.for-traefik.yml',
'/advanced/delegated.docker-compose.with-traefik.yml',
'/calls/livekit.docker-compose.with-caddy-labels.yml',
'/calls/livekit.nginx.conf'
'/calls/livekit.nginx.conf',
'CONTRIBUTING.md'
]
},
},
@@ -52,6 +57,13 @@ export default defineConfig({
mode: 'link',
content: 'https://github.com/continuwuity/continuwuity',
},
{
icon: {
svg: `<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Open Collective</title><path fill="currentColor" d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12c2.54 0 4.894-.79 6.834-2.135l-3.107-3.109a7.715 7.715 0 1 1 0-13.512l3.107-3.109A11.943 11.943 0 0 0 12 0zm9.865 5.166l-3.109 3.107A7.67 7.67 0 0 1 19.715 12a7.682 7.682 0 0 1-.959 3.727l3.109 3.107A11.943 11.943 0 0 0 24 12c0-2.54-.79-4.894-2.135-6.834z"/></svg>`
},
mode: 'link',
content: 'https://opencollective.com/continuwuity',
},
],
lastUpdated: true,
enableContentAnimation: true,
@@ -65,16 +77,13 @@ export default defineConfig({
}),
pluginClientRedirects({
redirects: [{
from: '/configuration/examples',
from: '^/config_reference$',
to: '/reference/config'
}, {
from: '/admin_reference',
from: '^/admin_reference$',
to: '/reference/admin'
}, {
from: '/server_reference',
to: '/reference/server'
}, {
from: '/community$',
from: '^/community$',
to: '/community/guidelines'
}, {
from: "^/turn$",
@@ -83,11 +92,14 @@ export default defineConfig({
from: "^/livekit$",
to: "/calls/livekit",
}, {
from: "^/dns",
from: "^/dns$",
to: "/guides/dns",
}, {
from: "^/source(|_code)$",
to: "https://forgejo.ellis.link/continuwuation/continuwuity",
}, {
from: "^/(CONTRIBUTING.md|contributing)$",
to: "/development/contributing"
}
]
})],
+37 -70
View File
@@ -8,13 +8,15 @@ use std::{
use conduwuit::{
Err, Result, at, debug_error, err, info,
matrix::{
Event,
Event, StateKey,
pdu::{PduEvent, PduId, RawPduId},
},
state_res::EventTypeExt,
trace, utils,
utils::{
stream::{IterStream, ReadyExt},
string::EMPTY,
to_canonical_object,
},
warn,
};
@@ -27,7 +29,9 @@ use resolvematrix::{
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId, UInt,
api::federation::event::get_room_state, events::AnyStateEvent, serde::Raw,
api::federation::event::get_room_state,
events::{AnyStateEvent, StateEventType},
serde::Raw,
};
use service::rooms::{
short::{ShortEventId, ShortRoomId},
@@ -533,19 +537,36 @@ impl crate::Context<'_> {
.collect()
.await;
let pdus: Vec<CanonicalJsonObject> = state_ids
let mut pdus: HashMap<(StateEventType, StateKey), CanonicalJsonObject> = state_ids
.iter()
.try_stream()
.and_then(|id| self.services.rooms.timeline.get_pdu_json(id))
.try_stream::<conduwuit::Error>()
.and_then(|id| async {
let pdu_json = self.services.rooms.timeline.get_pdu_json(id).await?;
let event_type = pdu_json
.get("type")
.and_then(CanonicalJsonValue::as_str)
.expect("event type must be present in events");
let state_key = pdu_json
.get("state_key")
.and_then(CanonicalJsonValue::as_str)
.expect("state keys must be present for events in the room state");
Ok(((event_type.into(), state_key.into()), pdu_json))
})
.try_collect()
.await?;
let json = serde_json::to_string_pretty(&pdus).map_err(|e| {
err!(Database(
"Failed to convert room state events to pretty JSON, possible invalid room \
state events in our database {e}",
))
})?;
let pdu = self.services.rooms.timeline.get_pdu(&event_id).await?;
if let Some(state_key) = pdu.state_key() {
pdus.insert(pdu.kind().with_state_key(state_key), to_canonical_object(pdu)?);
}
let json =
serde_json::to_string_pretty(&pdus.values().collect::<Vec<_>>()).map_err(|e| {
err!(Database(
"Failed to convert room state events to pretty JSON, possible invalid room \
state events in our database {e}",
))
})?;
let out = format!("```json\n{json}\n```");
self.write_str(&out).await
@@ -694,11 +715,11 @@ impl crate::Context<'_> {
| Ok(value) => match self
.services
.server_keys
.verify_json(&value, &room_version_rules)
.verify_event_json(&value, &room_version_rules)
.await
{
| Err(e) => return Err!("Signature verification failed: {e}"),
| Ok(()) => write!(self, "Signature correct"),
| Ok(_) => write!(self, "Signature correct"),
},
}
.await
@@ -714,7 +735,7 @@ impl crate::Context<'_> {
let msg = match self
.services
.server_keys
.verify_event(&event, &room_version_rules)
.verify_event_json(&event, &room_version_rules)
.await
{
| Err(e) => return Err(e),
@@ -849,7 +870,7 @@ impl crate::Context<'_> {
for result in remote_state_response.pdus.iter().map(|pdu| {
self.services
.server_keys
.validate_and_add_event_id(pdu, &room_version_rules)
.verify_event_json_no_fetch_add_event_id(pdu, &room_version_rules)
}) {
let Ok((event_id, value)) = result.await else {
continue;
@@ -887,7 +908,7 @@ impl crate::Context<'_> {
for result in remote_state_response.auth_chain.iter().map(|pdu| {
self.services
.server_keys
.validate_and_add_event_id(pdu, &room_version_rules)
.verify_event_json_no_fetch_add_event_id(pdu, &room_version_rules)
}) {
let Ok((event_id, value)) = result.await else {
continue;
@@ -943,60 +964,6 @@ impl crate::Context<'_> {
.await
}
pub(super) async fn get_signing_keys(
&self,
server_name: Option<OwnedServerName>,
notary: Option<OwnedServerName>,
query: bool,
) -> Result {
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
if let Some(notary) = notary {
let signing_keys = self
.services
.server_keys
.notary_request(&notary, &server_name)
.await?;
let out = format!("```rs\n{signing_keys:#?}\n```");
return self.write_str(&out).await;
}
let signing_keys = if query {
self.services
.server_keys
.server_request(&server_name)
.await?
} else {
self.services
.server_keys
.signing_keys_for(&server_name)
.await?
};
let out = format!("```rs\n{signing_keys:#?}\n```");
self.write_str(&out).await
}
pub(super) async fn get_verify_keys(&self, server_name: Option<OwnedServerName>) -> Result {
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone());
let keys = self
.services
.server_keys
.verify_keys_for(&server_name)
.await;
let mut out = String::new();
writeln!(out, "| Key ID | Public Key |")?;
writeln!(out, "| --- | --- |")?;
for (key_id, key) in keys {
writeln!(out, "| {key_id} | {key:?} |")?;
}
self.write_str(&out).await
}
pub(super) async fn resolve_true_destination(
&self,
server_name: OwnedServerName,
-16
View File
@@ -103,22 +103,6 @@ pub enum DebugCommand {
event_id: OwnedEventId,
},
/// Get and display signing keys from local cache or remote server.
GetSigningKeys {
server_name: Option<OwnedServerName>,
#[arg(long)]
notary: Option<OwnedServerName>,
#[arg(short, long)]
query: bool,
},
/// Get and display signing keys from local cache or remote server.
GetVerifyKeys {
server_name: Option<OwnedServerName>,
},
/// Sends a federation request to the remote server's
/// `/_matrix/federation/v1/version` endpoint and measures the latency it
/// took for the server to respond
+27 -1
View File
@@ -2,7 +2,7 @@ use std::fmt::Write;
use conduwuit::{Err, Result, utils::response::LimitReadExt};
use futures::StreamExt;
use ruma::{OwnedRoomId, OwnedServerName, OwnedUserId};
use ruma::{MilliSecondsSinceUnixEpoch, OwnedRoomId, OwnedServerName, OwnedUserId};
use crate::get_room_info;
@@ -131,4 +131,30 @@ impl crate::Context<'_> {
self.write_str(&format!("Rooms {user_id} shares with us ({num}):\n```\n{body}\n```"))
.await
}
pub(super) async fn get_signing_keys(&self, server_name: OwnedServerName) -> Result {
let response = self
.services
.server_keys
.origin_request(server_name, MilliSecondsSinceUnixEpoch::now())
.await?;
self.write_str("| Key ID | Public Key | Expired (unix milliseconds) |\n")
.await?;
self.write_str("| ------ | ---------- | --------------------------- |\n")
.await?;
for (key_id, key) in &response.verify_keys {
self.write_str(&format!("| {key_id} | {} | |\n", key.key))
.await?;
}
for (key_id, old_key) in &response.old_verify_keys {
self.write_str(&format!(
"| {key_id} | {} | {:0<13} |\n",
old_key.key,
old_key.expired_ts.get().to_string()
))
.await?;
}
Ok(())
}
}
+5
View File
@@ -39,4 +39,9 @@ pub enum FederationCommand {
RemoteUserInRooms {
user_id: OwnedUserId,
},
/// Queries the remote server for their current signing keys.
GetSigningKeys {
server_name: OwnedServerName,
},
}
-1
View File
@@ -32,7 +32,6 @@ use crate::{admin, admin::AdminCommand, context::Context};
#[must_use]
pub(super) fn complete(line: &str) -> String { complete_command(AdminCommand::command(), line) }
#[must_use]
pub(super) fn dispatch(services: Arc<Services>, command: CommandInput) -> ProcessorFuture {
Box::pin(handle_command(services, command))
}
-14
View File
@@ -1,6 +1,5 @@
use clap::Subcommand;
use conduwuit::Result;
use ruma::OwnedServerName;
use crate::Context;
@@ -12,12 +11,6 @@ pub enum GlobalsCommand {
CurrentCount,
LastCheckForAnnouncementsId,
/// This returns an empty `Ok(BTreeMap<..>)` when there are no keys found
/// for the server.
SigningKeysFor {
origin: OwnedServerName,
},
}
/// All the getters and iterators from src/database/key_value/globals.rs
@@ -47,13 +40,6 @@ pub(super) async fn process(subcommand: GlobalsCommand, context: &Context<'_>) -
.await;
let query_time = timer.elapsed();
write!(context, "Query completed in {query_time:?}:\n\n```rs\n{results:#?}\n```")
},
| GlobalsCommand::SigningKeysFor { origin } => {
let timer = tokio::time::Instant::now();
let results = services.server_keys.verify_keys_for(&origin).await;
let query_time = timer.elapsed();
write!(context, "Query completed in {query_time:?}:\n\n```rs\n{results:#?}\n```")
},
}
+1 -1
View File
@@ -204,7 +204,7 @@ impl crate::Context<'_> {
},
};
room_ids.push(room_id.clone());
room_ids.push(room_id);
}
if room_alias_or_id.is_room_alias_id() {
+3
View File
@@ -4,6 +4,9 @@ use service::registration_tokens::TokenExpires;
impl crate::Context<'_> {
pub(super) async fn issue_registration_token(&self, expires: super::TokenExpires) -> Result {
if !self.services.config.allow_registration {
return Err!("Registration has been disabled on this homeserver.");
}
let expires = {
if expires.immortal {
None
+3
View File
@@ -1083,6 +1083,9 @@ impl crate::Context<'_> {
pub(super) async fn change_email(&self, user_id: String, email: Option<String>) -> Result {
let user_id = parse_local_user_id(self.services, &user_id)?;
if matches!(self.services.users.status(&user_id).await, AccountStatus::NotFound) {
return Err!("This account does not exist.");
}
let Ok(new_email) = email.map(Address::try_from).transpose() else {
return Err!("Invalid email address.");
};
+1
View File
@@ -1 +1,2 @@
pub mod rooms;
pub mod users;
+1 -1
View File
@@ -6,7 +6,7 @@ use ruminuwuity::admin::continuwuity::rooms;
use crate::{Ruma, client::leave_room};
/// # `PUT /_continuwuity/admin/rooms/{roomID}/ban`
/// # `PUT /_continuwuity/admin/v1/rooms/{roomID}/ban`
///
/// Bans or unbans a room.
pub(crate) async fn ban_room(
+1 -1
View File
@@ -6,7 +6,7 @@ use ruminuwuity::admin::continuwuity::rooms;
use crate::Ruma;
/// # `GET /_continuwuity/admin/rooms/list`
/// # `GET /_continuwuity/admin/v1/rooms/list`
///
/// Lists all rooms known to this server, excluding banned ones.
pub(crate) async fn list_rooms(
+69
View File
@@ -0,0 +1,69 @@
use axum::extract::State;
use conduwuit::{Err, error};
use ruma::{api::client::profile::PropagateTo, profile::ProfileFieldValue};
use ruminuwuity::admin::continuwuity::users::create::v1::{Request, Response};
use service::users::{HashedPassword, ProfileFieldChange};
use crate::router::Ruma;
/// # `POST /_continuwuity/admin/v1/users`
///
/// Creates a new user on the homeserver.
pub(crate) async fn create_user(
State(services): State<crate::State>,
body: Ruma<Request>,
) -> conduwuit::Result<Response> {
let sender_user = body.identity.expect_sender_user()?;
if !services.users.is_admin(sender_user).await {
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
if !services.globals.user_is_local(&body.user_id) {
return Err!(Request(InvalidParam("User ID does not belong to this server.")));
}
if services.users.status(&body.user_id).await.is_found() {
return Err!(Request(UserInUse("An account with this user ID already exists.")));
}
services
.users
.create_local_account(
&body.user_id,
body.password
.as_ref()
.and_then(|raw| HashedPassword::new(raw).ok()),
None,
None,
None,
)
.await?;
if body.locked {
services
.users
.lock_account(&body.user_id, sender_user)
.await;
}
if body.suspended {
services
.users
.suspend_account(&body.user_id, sender_user)
.await;
}
for (key, value) in body.profile.clone().unwrap_or_default() {
services
.users
.set_profile_field(
&body.user_id,
ProfileFieldChange::Set(ProfileFieldValue::new(&key, value)?),
PropagateTo::All,
)
.await
.inspect_err(|e| error!(error=?e, %key, "Failed to set profile field"))
.ok();
}
if body.admin {
services.admin.make_user_admin(&body.user_id).await?;
}
Ok(Response::default())
}
+99
View File
@@ -0,0 +1,99 @@
use std::collections::BTreeMap;
use axum::extract::State;
use conduwuit::{
Err,
utils::{TryFutureExtExt, stream::WidebandExt},
};
use futures::StreamExt;
use ruminuwuity::admin::continuwuity::users::list::v1::{QueryFilter, Request, Response, User};
use service::users::AccountStatus;
use crate::router::Ruma;
/// # `GET /_continuwuity/admin/v1/users`
///
/// Lists users on this homeserver
pub(crate) async fn list_users(
State(services): State<crate::State>,
body: Ruma<Request>,
) -> conduwuit::Result<Response> {
if !services
.users
.is_admin(body.identity.expect_sender_user()?)
.await
{
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
let limit = body.limit.unwrap_or(100);
let offset = limit.saturating_mul(body.page.unwrap_or_default());
let users = services
.users
.stream_local_users()
.wide_filter_map(|user_id| {
let body = &body;
async move {
let status = services.users.status(&user_id).await;
assert_ne!(
status,
AccountStatus::NotFound,
"Not found users should not appear in stream_local_users"
);
let (deactivated, locked, suspended, admin) = tokio::join!(
std::future::ready(status == AccountStatus::Deactivated),
services.users.is_locked(&user_id).unwrap_or_default(),
services.users.is_suspended(&user_id).unwrap_or_default(),
services.users.is_admin(&user_id),
);
// Exclude deactivated accounts by default
if !deactivated && body.active == Some(QueryFilter::Exclude) {
return None;
}
if deactivated
&& body
.deactivated
.as_ref()
.is_none_or(|d| *d == QueryFilter::Include)
{
return None;
}
// Exclude locked accounts by default
if locked && body.locked != Some(QueryFilter::Include) {
return None;
}
// Include suspended accounts by default
if suspended && body.suspended == Some(QueryFilter::Exclude) {
return None;
}
// Include admins by default
if admin && body.admin == Some(QueryFilter::Exclude) {
return None;
}
Some((user_id, deactivated, suspended, locked, admin))
}
})
.skip(offset)
.wide_then(|(user_id, deactivated, suspended, locked, admin)| async move {
let (displayname, avatar_url) = tokio::join!(
services.users.displayname(&user_id).ok(),
services.users.avatar_url(&user_id).ok(),
);
let user = User {
displayname,
avatar_url,
suspended,
locked,
deactivated,
admin,
};
(user_id, user)
})
.take(limit)
.collect::<BTreeMap<_, _>>()
.await;
Ok(Response::new(users))
}
+3
View File
@@ -0,0 +1,3 @@
pub mod create;
pub mod list;
pub mod rooms;
+134
View File
@@ -0,0 +1,134 @@
use axum::extract::State;
use conduwuit::{
Err, Event, at,
utils::{IterStream, ReadyExt, TryFutureExtExt, stream::WidebandExt},
};
use futures::StreamExt;
use ruma::events::room::member::MembershipState;
use ruminuwuity::admin::continuwuity::users::rooms::v1::{Request, Response, RoomInfo};
use serde::Deserialize;
use crate::router::Ruma;
/// # `GET /_continuwuity/admin/v1/users/{user_id}/rooms`
///
/// Lists the memberships of a user on this server.
pub(crate) async fn list_user_rooms(
State(services): State<crate::State>,
body: Ruma<Request>,
) -> conduwuit::Result<Response> {
if !services
.users
.is_admin(body.identity.expect_sender_user()?)
.await
{
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
}
let limit = body.limit.unwrap_or(100).try_into()?;
let offset = body
.limit
.unwrap_or(100)
.saturating_mul(body.page.unwrap_or_default())
.try_into()?;
let room_ids: Vec<_> = match body.state {
| MembershipState::Join =>
services
.rooms
.state_cache
.rooms_joined(&body.user_id)
.skip(offset)
.take(limit)
.collect()
.await,
| MembershipState::Invite =>
services
.rooms
.state_cache
.rooms_invited(&body.user_id)
.skip(offset)
.take(limit)
.map(at!(0))
.collect()
.await,
| MembershipState::Knock =>
services
.rooms
.state_cache
.rooms_knocked(&body.user_id)
.skip(offset)
.take(limit)
.map(at!(0))
.collect()
.await,
| MembershipState::Leave =>
services
.rooms
.state_cache
.rooms_left(&body.user_id)
.skip(offset)
.take(limit)
.ready_filter_map(|(room_id, pdu)| {
pdu.is_some_and(|pdu| {
pdu.get_content::<ExtractMembership>()
.expect("membership PDU must have a membership field")
.membership
== MembershipState::Leave
})
.then_some(room_id)
})
.collect()
.await,
| MembershipState::Ban =>
services
.rooms
.state_cache
.rooms_left(&body.user_id)
.skip(offset)
.take(limit)
.ready_filter_map(|(room_id, pdu)| {
pdu.is_some_and(|pdu| {
pdu.get_content::<ExtractMembership>()
.expect("membership PDU must have a membership field")
.membership
== MembershipState::Ban
})
.then_some(room_id)
})
.collect()
.await,
| _ => return Err!(Request(InvalidParam("Unknown membership kind: {:?}", body.state))),
};
let resp = room_ids
.into_iter()
.stream()
.wide_then(|room_id| async move {
let (name, avatar, alias, members) = tokio::join!(
services.rooms.state_accessor.get_name(&room_id).ok(),
services.rooms.state_accessor.get_avatar(&room_id),
services
.rooms
.state_accessor
.get_canonical_alias(&room_id)
.ok(),
services.rooms.state_cache.room_members(&room_id).count(),
);
(room_id, RoomInfo {
name,
avatar_url: avatar.into_option().and_then(|a| a.url),
canonical_alias: alias,
member_count: members.try_into().unwrap_or(0),
})
})
.collect()
.await;
Ok(Response::new(resp))
}
#[derive(Deserialize)]
struct ExtractMembership {
pub membership: MembershipState,
}
+6
View File
@@ -13,6 +13,7 @@ use ruma::{
},
assign,
};
use serde_json::json;
use crate::Ruma;
@@ -55,5 +56,10 @@ pub(crate) async fn get_capabilities_route(
assign!(ProfileFieldsCapability::new(true), { disallowed: Some(services.oidc.restricted_profile_fields()) }),
);
capabilities.set(
"org.matrix.msc4174.webpush",
json!({ "enabled": true, "vapid": services.pusher.webpush_vapid_public_key() }),
)?;
Ok(get_capabilities::v3::Response::new(capabilities))
}
+13 -2
View File
@@ -1,6 +1,7 @@
use axum::extract::State;
use conduwuit::{
Err, Event, Result, at, debug_warn, err, ref_at,
result::LogErr,
utils::{
IterStream,
future::TryExtExt,
@@ -98,7 +99,12 @@ pub(crate) async fn get_context_route(
.pdus_rev(room_id, Some(base_count))
.ignore_err()
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
@@ -121,7 +127,12 @@ pub(crate) async fn get_context_route(
.pdus(room_id, Some(base_count))
.ignore_err()
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
+10 -2
View File
@@ -267,11 +267,19 @@ pub(crate) async fn get_public_rooms_filtered_helper(
summary.into()
})
.ready_filter_map(|chunk: PublicRoomsChunk| {
if !filter.room_types.is_empty() && !filter.room_types.contains(&RoomTypeFilter::from(chunk.room_type.clone())) {
if !filter.room_types.is_empty()
&& !filter
.room_types
.contains(&RoomTypeFilter::from(chunk.room_type.clone()))
{
return None;
}
if let Some(query) = filter.generic_search_term.as_ref().map(|q| q.to_lowercase()) {
if let Some(query) = filter
.generic_search_term
.as_ref()
.map(|q| q.to_lowercase())
{
if let Some(name) = &chunk.name {
if name.to_lowercase().contains(&query) {
return Some(chunk);
+8 -2
View File
@@ -140,7 +140,12 @@ pub(crate) async fn get_message_events_route(
.wide_filter_map(|item| visibility_filter(&services, item, sender_user))
.take(limit)
.then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
@@ -375,5 +380,6 @@ pub(crate) async fn is_ignored_invite(
services
.users
.invite_filter_level(&sender_user, recipient_user)
.await == FilterLevel::Ignore
.await
== FilterLevel::Ignore
}
+7 -7
View File
@@ -1,7 +1,7 @@
use axum::extract::State;
use conduwuit::{Err, Result};
use futures::StreamExt;
use ruma::{OwnedRoomId, api::client::membership::mutual_rooms};
use ruma::{OwnedRoomId, api::client::membership::get_mutual_rooms};
use crate::Ruma;
@@ -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<mutual_rooms::unstable::Request>,
) -> Result<mutual_rooms::unstable::Response> {
body: Ruma<get_mutual_rooms::unstable::Request>,
) -> Result<get_mutual_rooms::unstable::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(mutual_rooms::unstable::Response::new(mutual_rooms))
Ok(get_mutual_rooms::unstable::Response::new(mutual_rooms))
}
/// # `GET /_matrix/client/v1/mutual_rooms`
@@ -37,8 +37,8 @@ pub(crate) async fn get_mutual_rooms_unstable_route(
#[tracing::instrument(skip_all, name = "mutual_rooms", level = "info")]
pub(crate) async fn get_mutual_rooms_route(
State(services): State<crate::State>,
body: Ruma<mutual_rooms::v1::Request>,
) -> Result<mutual_rooms::v1::Response> {
body: Ruma<get_mutual_rooms::v1::Request>,
) -> Result<get_mutual_rooms::v1::Response> {
let sender_user = body.identity.expect_sender_user()?;
if sender_user == body.user_id {
@@ -52,7 +52,7 @@ pub(crate) async fn get_mutual_rooms_route(
.collect()
.await;
Ok(mutual_rooms::v1::Response::new(
Ok(get_mutual_rooms::v1::Response::new(
mutual_rooms
.len()
.try_into()
+4 -1
View File
@@ -55,5 +55,8 @@ fn oauth_router() -> Router<crate::State> {
.route(concat!("/", JWKS_URI_PATH), get(async || Json(json!({"keys": []}))))
.route(concat!("/", TOKEN_PATH), post(token::token_route))
.route(concat!("/", TOKEN_REVOKE_PATH), post(token::revoke_token_route))
.route(concat!("/", DEVICE_AUTHORIZATION_PATH), post(device::device_authorization_route))
.route(
concat!("/", DEVICE_AUTHORIZATION_PATH),
post(device::device_authorization_route),
)
}
+77 -8
View File
@@ -1,13 +1,16 @@
use std::sync::LazyLock;
use axum::extract::State;
use conduwuit::{Err, Error, Result, err};
use conduwuit_service::Services;
use conduwuit::{Err, Error, Result, err, utils::IterStream};
use conduwuit_service::{Services, pusher::ActivationOutcome};
use futures::StreamExt;
use ruma::{
CanonicalJsonObject, CanonicalJsonValue,
api::{
client::push::{
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions,
get_pushrule_enabled, get_pushrules_all, get_pushrules_global_scope, set_pusher,
set_pushrule, set_pushrule_actions, set_pushrule_enabled,
delete_pushrule, get_pushrule, get_pushrule_actions, get_pushrule_enabled,
get_pushrules_all, get_pushrules_global_scope, set_pushrule, set_pushrule_actions,
set_pushrule_enabled,
},
error::ErrorKind,
},
@@ -20,6 +23,12 @@ use ruma::{
RemovePushRuleError, Ruleset,
},
};
use ruminuwuity::pushers::{
PusherKind,
ack::unstable as pushers_ack,
get_pushers::{self, v3::PusherWithActivation},
set_pusher,
};
use crate::Ruma;
@@ -460,7 +469,29 @@ pub(crate) async fn get_pushers_route(
) -> Result<get_pushers::v3::Response> {
let sender_user = body.identity.expect_sender_user()?;
Ok(get_pushers::v3::Response::new(services.pusher.get_pushers(sender_user).await))
let pushers = services
.pusher
.get_pushers(sender_user)
.await
.into_iter()
.stream()
.then(async |pusher| {
let activated = match pusher.kind {
| PusherKind::WebPush(_) => Some(
services
.pusher
.is_webpush_activated(sender_user, pusher.ids.pushkey.as_str())
.await,
),
| _ => None,
};
PusherWithActivation { pusher, activated }
})
.collect()
.await;
Ok(get_pushers::v3::Response::new(pushers))
}
/// # `POST /_matrix/client/r0/pushers/set`
@@ -475,12 +506,50 @@ pub(crate) async fn set_pushers_route(
let sender_user = body.identity.expect_sender_user()?;
let sender_device = body.identity.expect_sender_device()?;
services
let needs_activation = services
.pusher
.set_pusher(sender_user, sender_device, &body.action)
.await?;
Ok(set_pusher::v3::Response::new())
Ok(set_pusher::v3::Response::new(needs_activation))
}
pub(crate) async fn pushers_ack_route(
State(services): State<crate::State>,
body: Ruma<pushers_ack::Request>,
) -> Result<pushers_ack::Response> {
let sender_user = body.identity.expect_sender_user()?;
match services
.pusher
.activate_webpush_pusher(sender_user, &body.app_id, &body.ack_token)
.await?
{
| ActivationOutcome::Activated => Ok(pushers_ack::Response::new()),
| ActivationOutcome::NoSuchPusher => {
Err!(Request(NotFound("No pusher with this app ID exists.")))
},
| ActivationOutcome::UnknownToken => Err(Error::Request(
UNKNOWN_ACTIVATION_TOKEN.clone(),
"Unknown activation token.".into(),
http::StatusCode::BAD_REQUEST,
)),
| ActivationOutcome::Expired => Err(Error::Request(
EXPIRED_ACTIVATION_TOKEN.clone(),
"Activation token has expired.".into(),
http::StatusCode::BAD_REQUEST,
)),
}
}
static EXPIRED_ACTIVATION_TOKEN: LazyLock<ErrorKind> =
LazyLock::new(|| custom_error_kind("ORG.MATRIX.MSC4174_EXPIRED_ACTIVATION_TOKEN"));
static UNKNOWN_ACTIVATION_TOKEN: LazyLock<ErrorKind> =
LazyLock::new(|| custom_error_kind("ORG.MATRIX.MSC4174_UNKNOWN_ACTIVATION_TOKEN"));
fn custom_error_kind(errcode: &str) -> ErrorKind {
serde_json::from_value(serde_json::json!({ "errcode": errcode }))
.expect("errcode deserializes into an ErrorKind")
}
/// user somehow has bad push rules, these must always exist per spec.
+170 -155
View File
@@ -1,18 +1,23 @@
use std::collections::{BTreeMap, BTreeSet};
use std::collections::{BTreeMap, BTreeSet, HashSet};
use axum::extract::State;
use conduwuit::{
Err, Error, Result, debug, debug_info, err, info,
matrix::{StateKey, pdu::PartialPdu},
trace, warn,
trace,
utils::to_canonical_object,
warn,
};
use conduwuit_service::{Services, appservice::RegistrationInfo};
use futures::FutureExt;
use ruma::{
CanonicalJsonObject, CanonicalJsonValue, Int, MilliSecondsSinceUnixEpoch, OwnedRoomAliasId,
OwnedUserId, RoomAliasId, RoomId, RoomVersionId, UserId,
OwnedUserId, RoomAliasId, RoomId,
api::{
client::room::{self, create_room},
client::room::{
self,
create_room::{self, RoomPowerLevelsContentOverride, v3::CreationContent},
},
error::ErrorKind::Forbidden,
},
assign,
@@ -33,13 +38,24 @@ use ruma::{
},
int,
room_version_rules::{AuthorizationRules, RoomIdFormatVersion},
serde::{JsonObject, Raw},
serde::Raw,
};
use ruminuwuity::invite_permission_config::FilterLevel;
use serde_json::{json, value::to_raw_value};
use serde::Deserialize;
use serde_json::value::to_raw_value;
use crate::{Ruma, client::invite_helper};
// We use this to keep around extra data in the `creation_content`
// while still parsing and validating keys that we care about.
#[derive(Deserialize, Default)]
struct FullCreationContent {
#[serde(flatten)]
creation_content: CreationContent,
#[serde(flatten)]
extra_create_keys: CanonicalJsonObject,
}
/// # `POST /_matrix/client/v3/createRoom`
///
/// Creates a new room.
@@ -153,6 +169,12 @@ pub(crate) async fn create_room_route(
return Err!(Request(Forbidden("Publishing rooms to the room directory is not allowed")));
}
// Figure out preset. We need it for preset specific events
let preset = body.preset.clone().unwrap_or(match &body.visibility {
| room::Visibility::Public => RoomPreset::PublicChat,
| _ => RoomPreset::PrivateChat, // Room visibility should not be custom
});
let mut invitees = BTreeSet::new();
for recipient_user in &body.invite {
@@ -191,54 +213,67 @@ pub(crate) async fn create_room_route(
| _ => None,
};
let create_content = match &body.creation_content {
| Some(content) => {
use RoomVersionId::*;
let FullCreationContent { creation_content, mut extra_create_keys } = body
.creation_content
.as_ref()
.map(Raw::deserialize_as_unchecked::<FullCreationContent>)
.transpose()
.map_err(|e| err!(Request(BadJson(error!("Failed to parse creation content: {e}")))))?
.unwrap_or_default();
let mut content = content
.deserialize_as_unchecked::<CanonicalJsonObject>()
.map_err(|e| {
err!(Request(BadJson(error!(
"Failed to deserialise content as canonical JSON: {e}"
))))
})?;
match room_version {
| V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 | V10 => {
content.insert(
"creator".into(),
json!(&sender_user).try_into().map_err(|e| {
err!(Request(BadJson(debug_error!("Invalid creation content: {e}"))))
})?,
);
},
| _ => {
// V11+ removed the "creator" key
},
}
content.insert(
"room_version".into(),
json!(room_version.as_str())
.try_into()
.map_err(|e| err!(Request(BadJson("Invalid creation content: {e}"))))?,
);
content
},
| None => {
use RoomVersionId::*;
let content = match room_version {
| V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 | V10 =>
RoomCreateEventContent::new_v1(sender_user.to_owned()),
| _ => RoomCreateEventContent::new_v11(),
};
let mut content =
serde_json::from_str::<CanonicalJsonObject>(to_raw_value(&content)?.get())?;
content.insert("room_version".into(), json!(room_version.as_str()).try_into()?);
content
},
let mut create_event_content = if room_version_rules.authorization.use_room_create_sender {
RoomCreateEventContent::new_v11()
} else {
RoomCreateEventContent::new_v1(sender_user.to_owned())
};
let mut privileged_creators = HashSet::new();
create_event_content.federate = creation_content.federate;
create_event_content.predecessor = creation_content.predecessor;
create_event_content.room_type = creation_content.room_type;
create_event_content.room_version = room_version.clone();
if room_version_rules.authorization.additional_room_creators {
create_event_content.additional_creators = creation_content.additional_creators;
// If we're making a trusted private chat, add the invitees as
// additional creators
if preset == RoomPreset::TrustedPrivateChat {
create_event_content
.additional_creators
.extend(invitees.iter().cloned());
}
// Make sure the primary creator of the room isn't in the additional
// creator list
if create_event_content
.additional_creators
.iter()
.any(|user| user == sender_user)
{
return Err!(Request(InvalidParam(
"The primary creator of the room may not also be an additional creator."
)));
}
// Sort and deduplicate additional creators to avoid any funny business
create_event_content.additional_creators.sort();
create_event_content.additional_creators.dedup();
}
// Track privileged creators so we can remove them from PLs later
if room_version_rules
.authorization
.explicitly_privilege_room_creators
{
privileged_creators.insert(sender_user.to_owned());
if room_version_rules.authorization.additional_room_creators {
privileged_creators.extend(create_event_content.additional_creators.iter().cloned());
}
}
let state_lock = match room_id.clone() {
| Some(room_id) => {
let _short_id = services
@@ -272,13 +307,20 @@ pub(crate) async fn create_room_route(
.map(MilliSecondsSinceUnixEpoch)
};
let mut create_event_content = to_canonical_object(create_event_content)
.expect("should be able to serialize create event content");
// `extra_create_keys` can't clobber any important fields because we
// already pulled them out into `create_event_content`
create_event_content.append(&mut extra_create_keys);
let create_event_id = services
.rooms
.timeline
.build_and_append_pdu(
PartialPdu {
event_type: TimelineEventType::RoomCreate,
content: to_raw_value(&create_content)?,
content: to_raw_value(&create_event_content)?,
state_key: Some(StateKey::new()),
timestamp: custom_origin_server_ts,
..Default::default()
@@ -289,6 +331,7 @@ pub(crate) async fn create_room_route(
)
.boxed()
.await?;
trace!("Created room create event with ID {}", &create_event_id);
let room_id = match room_id.clone() {
| Some(room_id) => room_id,
@@ -330,64 +373,27 @@ pub(crate) async fn create_room_route(
.await?;
// 3. Power levels
let mut power_levels_to_grant = BTreeMap::new();
// Figure out preset. We need it for preset specific events
let preset = body.preset.clone().unwrap_or(match &body.visibility {
| room::Visibility::Public => RoomPreset::PublicChat,
| _ => RoomPreset::PrivateChat, // Room visibility should not be custom
});
// If this room version doesn't privilege creators, grant PLs to them
if !room_version_rules
.authorization
.explicitly_privilege_room_creators
{
power_levels_to_grant.insert(sender_user.to_owned(), int!(100));
let mut power_levels_to_grant = BTreeMap::from_iter([(sender_user.to_owned(), int!(100))]);
let mut creators: Vec<OwnedUserId> = vec![sender_user.to_owned()];
if preset == RoomPreset::TrustedPrivateChat {
for recipient_user in invitees.iter().cloned() {
if room_version_rules
.authorization
.explicitly_privilege_room_creators
{
creators.push(recipient_user);
} else {
if preset == RoomPreset::TrustedPrivateChat {
for recipient_user in invitees.iter().cloned() {
power_levels_to_grant.insert(recipient_user, int!(100));
}
}
}
// Do we care about additional_creators?
if room_version_rules
.authorization
.explicitly_privilege_room_creators
{
// Have they been specified?
if let Some(additional_creators) = create_content.get("additional_creators") {
// Are they a real array?
if let Some(additional_creators) = additional_creators.as_array() {
// Iterate through them
for creator in additional_creators {
// Are they a string?
if let Some(creator) = creator.as_str() {
// Do they parse into a real user ID?
if let Ok(creator) = UserId::parse(creator) {
// Add them to the power levels and creators
creators.push(creator);
}
}
}
}
}
} else {
power_levels_to_grant.insert(sender_user.to_owned(), int!(100));
creators.clear(); // If this vec is not empty, default_power_levels_content will
// treat this as a v12 room
}
let power_levels_content = default_power_levels_content(
body.power_level_content_override
.as_ref()
.map(Raw::cast_ref),
body.power_level_content_override.as_ref(),
&body.visibility,
power_levels_to_grant,
creators,
privileged_creators,
&room_version_rules.authorization,
)?;
@@ -619,74 +625,83 @@ pub(crate) async fn create_room_route(
}
/// creates the power_levels_content for the PDU builder
#[allow(clippy::or_fun_call)]
fn default_power_levels_content(
power_level_content_override: Option<&Raw<RoomPowerLevelsEventContent>>,
power_level_content_override: Option<&Raw<RoomPowerLevelsContentOverride>>,
visibility: &room::Visibility,
users: BTreeMap<OwnedUserId, Int>,
creators: Vec<OwnedUserId>,
mut users: BTreeMap<OwnedUserId, Int>,
creators: HashSet<OwnedUserId>,
authorization_rules: &AuthorizationRules,
) -> Result<serde_json::Value> {
let mut power_levels_content =
serde_json::to_value(assign!(RoomPowerLevelsEventContent::new(authorization_rules), {
users
}))
.unwrap();
) -> Result<RoomPowerLevelsEventContent> {
use ruma::events::TimelineEventType::*;
let mut power_levels_content = power_level_content_override
.map(Raw::cast_ref::<RoomPowerLevelsEventContent>)
.map(Raw::deserialize)
.transpose()
.map_err(|err| err!(Request(BadJson("Invalid power_level_content_override: {err:?}"))))?
.map_or_else(
|| RoomPowerLevelsEventContent::new(authorization_rules),
|mut content| {
if authorization_rules.explicitly_privilege_room_creators {
// If an override was supplied we need to make sure the
// tombstone default is raised to 150
// for v12+. Otherwise, if one wasn't supplied,
// `RoomPowerLevelsEventContent::new` will handle this.
content.events.entry(RoomTombstone).or_insert(int!(150));
}
content
},
);
power_levels_content.users.append(&mut users);
for creator in creators {
power_levels_content.users.remove(&creator);
}
// secure proper defaults of sensitive/dangerous permissions that moderators
// (power level 50) should not have easy access to
power_levels_content["events"]["m.room.power_levels"] =
serde_json::to_value(100).expect("100 is valid Value");
power_levels_content["events"]["m.room.server_acl"] =
serde_json::to_value(100).expect("100 is valid Value");
power_levels_content["events"]["m.room.tombstone"] =
serde_json::to_value(100).expect("100 is valid Value");
power_levels_content["events"]["m.room.encryption"] =
serde_json::to_value(100).expect("100 is valid Value");
power_levels_content["events"]["m.room.history_visibility"] =
serde_json::to_value(100).expect("100 is valid Value");
let admin_only_events = [
RoomPowerLevels,
RoomServerAcl,
// this will not apply for v12+ rooms since we raised it to 150 earlier
RoomTombstone,
RoomEncryption,
RoomHistoryVisibility,
];
for event_type in admin_only_events {
power_levels_content
.events
.entry(event_type)
.or_insert(int!(100));
}
// always allow users to respond (not post new) to polls. this is primarily
// useful in read-only announcement rooms that post a public poll.
power_levels_content["events"]["org.matrix.msc3381.poll.response"] =
serde_json::to_value(0).expect("0 is valid Value");
power_levels_content["events"]["m.poll.response"] =
serde_json::to_value(0).expect("0 is valid Value");
power_levels_content
.events
.entry(PollResponse)
.or_insert(int!(0));
power_levels_content
.events
.entry(UnstablePollResponse)
.or_insert(int!(0));
// synapse does this too. clients do not expose these permissions. it
// prevents default users from calling public rooms, for obvious reasons.
if *visibility == room::Visibility::Public {
power_levels_content["events"]["m.call.invite"] =
serde_json::to_value(50).expect("50 is valid Value");
power_levels_content["events"]["m.call"] =
serde_json::to_value(50).expect("50 is valid Value");
power_levels_content["events"]["m.call.member"] =
serde_json::to_value(50).expect("50 is valid Value");
power_levels_content["events"]["org.matrix.msc3401.call"] =
serde_json::to_value(50).expect("50 is valid Value");
power_levels_content["events"]["org.matrix.msc3401.call.member"] =
serde_json::to_value(50).expect("50 is valid Value");
}
if let Some(power_level_content_override) = power_level_content_override {
let json: JsonObject = serde_json::from_str(power_level_content_override.json().get())
.map_err(|e| err!(Request(BadJson("Invalid power_level_content_override: {e:?}"))))?;
for (key, value) in json {
power_levels_content[key] = value;
}
}
if !creators.is_empty() {
// Raise the default power level of tombstone to 150
power_levels_content["events"]["m.room.tombstone"] =
serde_json::to_value(150).expect("150 is valid Value");
for creator in creators {
// Omit creators from the power level list altogether
power_levels_content["users"]
.as_object_mut()
.expect("users is an object")
.remove(creator.as_str());
}
power_levels_content
.events
.entry(CallInvite)
.or_insert(int!(50));
power_levels_content
.events
.entry(CallMember)
.or_insert(int!(50));
}
Ok(power_levels_content)
+30 -10
View File
@@ -1,6 +1,5 @@
use axum::extract::State;
use conduwuit::{Err, Event, Result, debug_warn, err};
use futures::{FutureExt, TryFutureExt, future::try_join};
use ruma::api::client::room::get_room_event;
use crate::{Ruma, client::is_ignored_pdu};
@@ -16,19 +15,35 @@ pub(crate) async fn get_room_event_route(
let event_id = &body.event_id;
let room_id = &body.room_id;
let event = services
.rooms
.timeline
.get_remote_pdu(room_id, event_id)
.map_err(|_| err!(Request(NotFound("Event {} not found.", event_id))));
let mut event = match services.rooms.timeline.get_pdu(event_id).await {
| Ok(event) => event,
| Err(e) if e.is_not_found() => {
// Only fetch over federation for users who could see the event.
let (joined, world_readable) = tokio::join!(
services.rooms.state_cache.is_joined(sender_user, room_id),
services.rooms.state_accessor.is_world_readable(room_id)
);
if !joined && !world_readable {
return Err!(Request(NotFound("Event {} not found.", event_id)));
}
services
.rooms
.timeline
.get_remote_pdu(room_id, event_id)
.await
.map_err(|_| err!(Request(NotFound("Event {} not found.", event_id))))?
},
| Err(e) => return Err(e),
};
// NOTE: checked after fetching, as visibility of an unknown event cannot
// be determined (user_can_see_event returns true for those).
let visible = services
.rooms
.state_accessor
.user_can_see_event(sender_user, room_id, event_id)
.map(Ok);
let (mut event, visible) = try_join(event, visible).await?;
.await;
if !visible || is_ignored_pdu(services, &event, sender_user).await? {
return Err!(Request(Forbidden("You don't have permission to view this event.")));
@@ -43,7 +58,12 @@ pub(crate) async fn get_room_event_route(
debug_warn!("Failed to add bundled aggregations to event: {e}");
}
event.set_unsigned(Some(body.identity.expect_sender_user()?));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&event, Some(sender_user))
.await;
event.set_unsigned(Some(ctx))?;
Ok(get_room_event::v3::Response::new(event.into_format()))
}
+7 -1
View File
@@ -1,6 +1,7 @@
use axum::extract::State;
use conduwuit::{
Err, Event, Result, at, debug_warn,
result::LogErr,
utils::{BoolExt, stream::TryTools},
};
use futures::{FutureExt, TryStreamExt, future::try_join4};
@@ -53,7 +54,12 @@ pub(crate) async fn room_initial_sync_route(
.pdus_rev(room_id, None)
.try_take(limit)
.and_then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
if let Err(e) = services
.rooms
.pdu_metadata
+20 -8
View File
@@ -6,8 +6,10 @@ use std::collections::VecDeque;
use conduwuit::{
Event, PduCount, Result, debug_warn, err,
matrix::pdu::PduEvent,
ref_at, trace,
utils::stream::{BroadbandExt, ReadyExt, TryIgnore},
ref_at,
result::LogErr,
trace,
utils::stream::{BroadbandExt, ReadyExt, TryIgnore, WidebandExt},
};
use conduwuit_service::Services;
use futures::StreamExt;
@@ -83,9 +85,14 @@ async fn load_timeline(
.pdus_rev(room_id, ending_count.map(|count| count.saturating_add(1)))
.ignore_err()
.ready_take_while(move |&(pducount, _)| pducount > starting_count)
.map(move |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
pdu
.wide_filter_map(async |mut pdu| {
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
Some(pdu)
})
.then(async move |mut pdu| {
if let Err(e) = services
@@ -108,9 +115,14 @@ async fn load_timeline(
.timeline
.pdus_rev(room_id, ending_count.map(|count| count.saturating_add(1)))
.ignore_err()
.map(move |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
pdu
.wide_filter_map(async |mut pdu| {
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(Some(ctx)).log_err().ok();
Some(pdu)
})
.then(async move |mut pdu| {
if let Err(e) = services
+7 -1
View File
@@ -6,6 +6,7 @@ use conduwuit::{
Event,
pdu::{PduCount, PduEvent, sticky},
},
result::LogErr,
trace,
utils::{
BoolExt, IterStream, ReadyExt, TryFutureExtExt,
@@ -322,7 +323,12 @@ async fn build_sticky_events(
continue;
}
pdu.set_unsigned(Some(syncing_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu, Some(sync_context.syncing_user))
.await;
pdu.set_unsigned(Some(ctx)).log_err().ok();
events.push(Event::into_format(pdu));
}
+30 -17
View File
@@ -11,6 +11,7 @@ use conduwuit::{
Event, TypeStateKey,
pdu::{PduCount, PduEvent, sticky},
},
result::LogErr,
trace,
utils::{
BoolExt, FutureBoolExt, IterStream, ReadyExt, TryFutureExtExt,
@@ -725,7 +726,8 @@ async fn stripped_state_event(
.get_field::<StateEventType>("type")
.ok()
.flatten()
.as_ref() == Some(event_type)
.as_ref()
== Some(event_type)
})
}
@@ -1188,12 +1190,12 @@ async fn collect_sticky_events(
// MSC4480 lets us ignore the limit for a newly visible room's backlog
for (room_id, pdu) in backlog {
push_sticky_event(&mut response, sender_user, room_id, pdu);
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
}
let mut next_batch = None;
for (count, room_id, pdu) in stream.into_iter().take(limit) {
push_sticky_event(&mut response, sender_user, room_id, pdu);
push_sticky_event(services, &mut response, sender_user, room_id, pdu).await;
next_batch = Some(count);
}
@@ -1204,13 +1206,19 @@ async fn collect_sticky_events(
Ok(response)
}
fn push_sticky_event(
async fn push_sticky_event(
services: &Services,
response: &mut sync_events::v5::response::StickyEvents,
sender_user: &UserId,
room_id: OwnedRoomId,
mut pdu: PduEvent,
) {
pdu.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu, Some(sender_user))
.await;
pdu.set_unsigned(Some(ctx)).log_err().ok();
response
.rooms
.entry(room_id)
@@ -1555,20 +1563,25 @@ where
// joined users
device_list_changes.extend(
services
.rooms
.state_cache
.room_members(room_id)
// Don't send key updates from the sender to the sender
.ready_filter(|user_id| sender_user != *user_id)
// Only send keys if the sender doesn't share an encrypted room with the target
// already
.filter_map(async |user_id| {
share_encrypted_room(services, sender_user, &user_id, Some(room_id))
.rooms
.state_cache
.room_members(room_id)
// Don't send key updates from the sender to the sender
.ready_filter(|user_id| sender_user != *user_id)
// Only send keys if the sender doesn't share an encrypted room with
// the target already
.filter_map(async |user_id| {
share_encrypted_room(
services,
sender_user,
&user_id,
Some(room_id),
)
.map(|res| res.or_some(user_id.clone()))
.await
})
.collect::<Vec<_>>()
.await,
})
.collect::<Vec<_>>()
.await,
);
}
}
+15 -12
View File
@@ -21,7 +21,7 @@ use crate::{admin, client, server};
pub fn build(router: Router<State>, state: State) -> Router<State> {
let config = &state.server.config;
let mut router = router
.ruma_route(&client::appservice_ping)
.ruma_route(&client::appservice_ping)
.ruma_route(&client::get_supported_versions_route)
.ruma_route(&client::get_register_available_route)
.ruma_route(&client::register::register_route)
@@ -61,8 +61,8 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::get_global_account_data_route)
.ruma_route(&client::get_room_account_data_route)
.ruma_route(&client::get_profile_field_route)
.ruma_route(&client::set_profile_field_route)
.ruma_route(&client::delete_profile_field_route)
.ruma_route(&client::set_profile_field_route)
.ruma_route(&client::delete_profile_field_route)
.ruma_route(&client::get_profile_route)
.ruma_route(&client::set_presence_route)
.ruma_route(&client::get_presence_route)
@@ -112,14 +112,17 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::search_users_route)
.ruma_route(&client::get_member_events_route)
.ruma_route(&client::get_protocols_route)
.route("/_matrix/client/unstable/thirdparty/protocols",
get(client::get_protocols_route_unstable))
.route(
"/_matrix/client/unstable/thirdparty/protocols",
get(client::get_protocols_route_unstable),
)
.ruma_route(&client::send_message_event_route)
.ruma_route(&client::send_state_event_for_key_route)
.ruma_route(&client::get_state_events_route)
.ruma_route(&client::get_state_event_for_key_route)
// Ruma doesn't have support for multiple paths for a single endpoint yet, and these routes
// share one Ruma request / response type pair with {get,send}_state_event_for_key_route
// Ruma doesn't have support for multiple paths for a single endpoint yet, and these
// routes share one Ruma request / response type pair with
// {get,send}_state_event_for_key_route
.route(
"/_matrix/client/r0/rooms/{room_id}/state/{event_type}",
get(client::get_state_events_for_empty_key_route)
@@ -171,6 +174,7 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.ruma_route(&client::get_key_changes_route)
.ruma_route(&client::get_pushers_route)
.ruma_route(&client::set_pushers_route)
.ruma_route(&client::pushers_ack_route)
.ruma_route(&client::upgrade_room_route)
.ruma_route(&client::get_threads_route)
.ruma_route(&client::get_relating_events_with_rel_type_and_event_type_route)
@@ -193,16 +197,15 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
.merge(client::oauth::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);
.ruma_route(&admin::rooms::list::list_rooms)
.ruma_route(&admin::users::list::list_users)
.ruma_route(&admin::users::create::create_user)
.ruma_route(&admin::users::rooms::list_user_rooms);
if config.allow_federation {
router = router
.ruma_route(&server::get_server_version_route)
.route("/_matrix/key/v2/server", get(server::get_server_keys_route))
.route(
"/_matrix/key/v2/server/{key_id}",
get(server::get_server_keys_deprecated_route),
)
.ruma_route(&server::get_public_rooms_route)
.ruma_route(&server::get_public_rooms_filtered_route)
.ruma_route(&server::send_transaction_message_route)
+19 -8
View File
@@ -1,9 +1,13 @@
use std::any::{Any, TypeId};
use conduwuit::{Err, Error, Result, err, utils::IterStream};
use conduwuit::{
Err, Error, Result, err,
utils::{IterStream, millis_since_unix_epoch},
};
use http::StatusCode;
use ruma::{
DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId, UserId,
DeviceId, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedServerName, OwnedUserId, UInt,
UserId,
api::{
IncomingRequest,
auth_scheme::{
@@ -127,18 +131,24 @@ impl CheckAuth for ServerSignatures {
return Err!(Request(Unauthorized("Destination mismatch.")));
}
let min_valid_ts =
MilliSecondsSinceUnixEpoch(UInt::new_saturating(millis_since_unix_epoch()));
let key = services
.server_keys
.get_verify_key(&output.origin, &output.key)
.get_single_verify_key(&output.origin, &output.key, min_valid_ts)
.await
.map_err(|e| {
err!(Request(Unauthorized(warn!("Failed to fetch signing keys: {e}"))))
.ok_or_else(|| {
err!(Request(Unauthorized(debug_warn!(
origin=%output.origin,
"Unable to acquire your signing key (ID: {})",
output.key
))))
})?;
let keys: PubKeys = [(output.key.to_string(), key.key)].into();
let keys: PubKeyMap = [(output.origin.as_str().into(), keys)].into();
match output.verify_request(request, destination, &keys) {
match output.verify_http_request(request, destination, &keys) {
| Ok(()) => {
if services
.moderation
@@ -160,8 +170,9 @@ impl CheckAuth for ServerSignatures {
Ok(output.origin)
},
| Err(err) =>
Err!(Request(Unauthorized(warn!("Failed to verify X-Matrix header: {err}")))),
| Err(err) => Err!(Request(Unauthorized(debug_warn!(
"Failed to verify X-Matrix header: {err}"
)))),
}
}
}
-10
View File
@@ -3,7 +3,6 @@ use std::cmp;
use axum::extract::State;
use conduwuit::{
Err, Event, PduCount, Result, info,
result::LogErr,
utils::{IterStream, ReadyExt, stream::TryTools},
};
use futures::{FutureExt, StreamExt, TryStreamExt};
@@ -80,15 +79,6 @@ pub(crate) async fn get_backfill_route(
.await
.then_some(pdu))
})
.and_then(async |mut pdu| {
// Strip the transaction ID, as that is private
pdu.remove_transaction_id().log_err().ok();
// Add age, as this is specified
pdu.add_age().log_err().ok();
// It's not clear if we should strip or add any more data, leave as
// is. In particular: Redaction?
Ok(pdu)
})
.try_filter_map(|pdu| async move {
Ok(services
.rooms
+2 -2
View File
@@ -3,7 +3,7 @@ use std::collections::{HashSet, VecDeque};
use axum::extract::State;
use conduwuit::{Err, Event, Result, debug, info, trace, utils::to_canonical_object, warn};
use ruma::{OwnedEventId, api::federation::event::get_missing_events};
use serde_json::{json, value::RawValue};
use serde_json::value::RawValue;
use service::rooms::event_handler::GET_MISSING_EVENTS_MAX_BATCH_SIZE;
use super::AccessCheck;
@@ -91,7 +91,7 @@ pub(crate) async fn get_missing_events_route(
.await
{
debug!(%next_event_id, origin = %body.identity, "redacting event origin cannot see");
pdu.redact(&room_version, json!({}))?;
pdu.redact(&room_version, None)?;
}
trace!(
+1 -1
View File
@@ -324,7 +324,7 @@ async fn validate_invite_state(
services
.server_keys
.verify_event(&state_event_json, room_version_rules)
.verify_event_json(&state_event_json, room_version_rules)
.await
.map_err(|e| {
err!(Request(InvalidParam("Signature verification failed on invite event: {e}")))
+48 -38
View File
@@ -1,10 +1,8 @@
use std::{
mem::take,
time::{Duration, SystemTime},
};
use std::{collections::BTreeMap, mem::take, time::Duration};
use axum::{Json, extract::State, response::IntoResponse};
use conduwuit::{Result, utils::timepoint_from_now};
use futures::StreamExt;
use ruma::{
MilliSecondsSinceUnixEpoch,
api::{
@@ -14,33 +12,62 @@ use ruma::{
assign,
serde::Raw,
};
use service::{server_keys, server_keys::in_one_week};
/// # `GET /_matrix/key/v2/server`
///
/// Gets the public signing keys of this server.
///
/// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid forever.
// Response type for this endpoint is Json because we need to calculate a
// signature for the response
pub(crate) async fn get_server_keys_route(
State(services): State<crate::State>,
) -> Result<impl IntoResponse> {
let server_name = services.globals.server_name();
let active_key_id = services.server_keys.active_key_id();
let mut all_keys = services.server_keys.verify_keys_for(server_name).await;
let verify_keys = BTreeMap::from([services.server_keys.active_verify_key()]);
let verify_keys = all_keys
.remove_entry(active_key_id)
.expect("active verify_key is missing");
let old_verify_keys = all_keys
.into_iter()
.map(|(id, key)| (id, OldVerifyKey::new(expires_ts(), key.key)))
.collect();
let old_verify_keys = if let Some(k) = &services.config.old_verify_keys {
k.to_owned()
} else {
// We need to figure out any old signing keys we've acquired from
// notaries.
let mut keys = services.server_keys.signing_keys_for(server_name);
let mut old_keys = BTreeMap::new();
while let Some(resp) = keys.next().await {
// We need to verify that this response is still trusted based on
// the current configuration. It's possible we got this response
// from a notary who we no longer trust.
if resp.valid_until_ts > in_one_week() {
continue;
}
let trusted = services.config.trusted_servers.iter().any(|notary| {
server_keys::Service::verify_server_keys_response(
&resp,
Some((notary.server_name(), notary.verify_keys())),
)
.is_ok()
});
if !trusted {
continue;
}
for (old_key_id, old_key) in resp.old_verify_keys {
if old_key.expired_ts > resp.valid_until_ts {
// This key expired in the future which is probably illegal
continue;
}
old_keys
.entry(old_key_id)
.and_modify(|current_old_key: &mut OldVerifyKey| {
// Use the lowest expiry timestamp
if current_old_key.expired_ts > old_key.expired_ts {
*current_old_key = old_key.clone();
}
})
.or_insert(old_key);
}
}
old_keys
};
let server_key = assign!(ServerSigningKeys::new(server_name.to_owned(), valid_until_ts()), {
verify_keys: [verify_keys].into(),
verify_keys,
old_verify_keys,
});
@@ -56,24 +83,7 @@ pub(crate) async fn get_server_keys_route(
}
fn valid_until_ts() -> MilliSecondsSinceUnixEpoch {
let dur = Duration::from_hours(168);
let dur = Duration::from_hours(12);
let timepoint = timepoint_from_now(dur).expect("SystemTime should not overflow");
MilliSecondsSinceUnixEpoch::from_system_time(timepoint).expect("UInt should not overflow")
}
fn expires_ts() -> MilliSecondsSinceUnixEpoch {
let timepoint = SystemTime::now();
MilliSecondsSinceUnixEpoch::from_system_time(timepoint).expect("UInt should not overflow")
}
/// # `GET /_matrix/key/v2/server/{keyId}`
///
/// Gets the public signing keys of this server.
///
/// - Matrix does not support invalidating public keys, so the key returned by
/// this will be valid forever.
pub(crate) async fn get_server_keys_deprecated_route(
State(services): State<crate::State>,
) -> impl IntoResponse {
get_server_keys_route(State(services)).await
}
+1 -1
View File
@@ -142,7 +142,7 @@ pub(crate) async fn validate_any_membership_event(
services
.server_keys
.verify_event(&pdu, room_version_rules)
.verify_event_json(&pdu, room_version_rules)
.await
.map_err(|e| {
err!(Request(InvalidParam("Signature verification failed on membership event: {e}")))
+29 -2
View File
@@ -1,8 +1,8 @@
use std::env::consts::OS;
use std::{collections::HashSet, env::consts::OS};
use either::Either;
use figment::Figment;
use ruma::events::room::server_acl::RoomServerAclEventContent;
use ruma::{OwnedServerName, events::room::server_acl::RoomServerAclEventContent};
use super::DEPRECATED_KEYS;
use crate::{Config, Err, Result, Server, debug, debug_info, debug_warn, error, warn};
@@ -318,6 +318,33 @@ pub fn check(config: &Config) -> Result {
);
}
if config
.trusted_servers
.iter()
.any(|t| t.server_name() == config.server_name)
&& !config.federation_loopback
{
return Err!(Config(
"trusted_servers",
"Your own `server_name` cannot appear in `trusted_servers`"
));
}
config
.trusted_servers
.iter()
.map(super::TrustedServer::server_name)
.try_fold(HashSet::<OwnedServerName>::new(), |mut servers, server_name| {
if !servers.insert(server_name.to_owned()) {
Err!(Config(
"trusted_servers",
"Duplicate `server_name` in `trusted_servers`: {}",
server_name.as_str()
))
} else {
Ok(servers)
}
})?;
Ok(())
}
+173 -46
View File
@@ -17,11 +17,15 @@ use either::{
use figment::providers::{Env, Format, Toml};
pub use figment::{Figment, value::Value as FigmentValue};
use lettre::message::Mailbox;
use openidconnect::{ClientId, ClientSecret, Scope};
use openidconnect::{Audience, ClientId, ClientSecret, Scope};
use regex::RegexSet;
use ruma::{
OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName, OwnedUserId, RoomVersionId,
api::client::{discovery::discover_support::ContactRole, rtc::RtcTransport},
OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
RoomVersionId, ServerName,
api::{
client::{discovery::discover_support::ContactRole, rtc::RtcTransport},
federation::discovery::OldVerifyKey,
},
profile::ProfileFieldName,
serde::Base64,
};
@@ -1085,52 +1089,92 @@ pub struct Config {
pub proxy: ProxyConfig,
/// Servers listed here will be used to gather public keys of other servers
/// (notary trusted key servers).
/// (trusted key notary servers), as well as serve as trusted servers for
/// other operations like backfill and event fetching.
///
/// Currently, continuwuity doesn't support inbound batched key requests, so
/// Currently, continuwuity doesn't support inbound key requests, so
/// this list should only contain other Synapse servers.
///
/// example: ["matrix.org", "tchncs.de"]
/// example: ["matrix.org", "starstruck.systems"]
///
/// It is possible to restrict which signing keys trusted servers are
/// allowed to sign responses with. Without configuring this, all responses
/// from trusted servers will be implicitly trusted, which is fine for most
/// users. Strict verification is only necessary if TLS interception is part
/// of your threat model. Even without strict verification, signatures from
/// the originating server must be valid, regardless of whether the trusted
/// server's is valid or not.
///
/// To enable strict validation, you need to pass a TOML table containing
/// the trusted server name, and any public keys (not key IDs!) that you
/// expect to sign responses. You can fetch the current public keys a remote
/// server uses with `!admin federation get-signing-keys <server name>`.
/// Only add public keys that aren't expired, and make sure to remove any
/// that expire at a later date!
///
/// Example:
/// ```ignore
/// trusted_servers = [{server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]}]
/// ```
///
/// You can also mix-and-match strict verification and lax verification
/// trusted servers:
///
/// ```ignore
/// trusted_servers = [
/// {server_name = "starstruck.systems", verify_keys=["Z+WZUaLLgkclXn1iQVzYIiJMjMEyltxg5LG8Dndu34A"]},
/// "matrix.org"
/// ]
/// ```
///
/// Trusted servers are queried in parallel, so order does not matter. You
/// should not have more than five entries. You can set this value to an
/// empty list (`[]`) to operate without trusted server assistance, but this
/// is discouraged for performance and reliability reasons.
///
/// default: ["matrix.org"]
#[serde(default = "default_trusted_servers")]
pub trusted_servers: Vec<OwnedServerName>,
pub trusted_servers: Vec<TrustedServer>,
/// Whether to query the servers listed in trusted_servers first or query
/// the origin server first. For best security, querying the origin server
/// first is advised to minimize the exposure to a compromised trusted
/// server. For maximum federation/join performance this can be set to true,
/// however other options exist to query trusted servers first under
/// specific high-load circumstances and should be evaluated before setting
/// this to true.
/// Whether to prioritise trusted server lookups over origin server lookups.
///
/// By default, both notaries and origin servers are queried in parallel,
/// and handled on a first-come-first-serve basis, meaning the server always
/// uses the fastest response(s).
///
/// If you wish to prioritise handling responses from trusted servers
/// *before* handling responses from origin servers, set this to true.
#[serde(default)]
pub query_trusted_key_servers_first: bool,
/// Whether to query the servers listed in trusted_servers first
/// specifically on room joins. This option limits the exposure to a
/// compromised trusted server to room joins only. The join operation
/// requires gathering keys from many origin servers which can cause
/// significant delays. Therefor this defaults to true to mitigate
/// unexpected delays out-of-the-box. The security-paranoid or those willing
/// to tolerate delays are advised to set this to false. Note that setting
/// query_trusted_key_servers_first to true causes this option to be
/// ignored.
#[serde(default = "true_fn")]
pub query_trusted_key_servers_first_on_join: bool,
/// Only query trusted servers for keys and never the origin server. This is
/// intended for clusters or custom deployments using their trusted_servers
/// as forwarding-agents to cache and deduplicate requests. Notary servers
/// do not act as forwarding-agents by default, therefor do not enable this
/// unless you know exactly what you are doing.
#[serde(default)]
pub only_query_trusted_key_servers: bool,
/// Maximum number of keys to request in each trusted server batch query.
/// Any old signing keys that were used to sign events using this server
/// name.
///
/// default: 1024
#[serde(default = "default_trusted_server_batch_size")]
pub trusted_server_batch_size: usize,
/// You do not need to populate this unless you previously used a different
/// server software with the same server_name configured, and then have
/// migrated to continuwuity.
///
/// The expiry timestamp should be as exact as you can get it, as making it
/// too old may inadvertently invalidate historical events sent by your
/// server, and potentially make it impossible for you to use some rooms as
/// a result. If your key was compromised, and you set the expiry timestamp
/// too late, some forged events may continue to be allowed.
///
/// If not configured, continuwuity will discover its own historical keys
/// through trusted servers. For improved security, you can set this to an
/// empty map ({}) to disable this behaviour, if you know you have no old
/// signing keys.
///
/// Example:
/// {"ed25519:1"={expired_ts=1790506890859,key="d29vZndvb2Z3b29md29vZg"}}
///
/// The map key should be the key ID, expired_ts should be unix
/// milliseconds, and the actual key value should be the unpadded base64
/// representation of the public key component of the expired signing key.
///
/// default:
#[serde(default)]
pub old_verify_keys: Option<BTreeMap<OwnedServerSigningKeyId, OldVerifyKey>>,
/// Max log level for continuwuity. Allows debug, info, warn, or error.
///
@@ -2756,6 +2800,18 @@ pub struct OidcConfig {
#[serde(default)]
pub additional_scopes: Vec<Scope>,
/// Additional trusted audiences that Continuwuity will accept in the `aud`
/// claim of the OIDC token returned by the IDP. If your identity
/// provider includes other values in the `aud` claim in addition to the
/// client ID, they must be listed here for Continuwuity to accept them.
///
/// Most deployments will not need to set this, because most identity
/// providers only include the client ID in the `aud` claim by default.
///
/// default: []
#[serde(default)]
pub additional_trusted_audiences: BTreeSet<Audience>,
/// The name of the identity provider. If this is set, the login page's
/// button reads "Continue with <name>" instead of just "Continue".
///
@@ -2808,10 +2864,15 @@ pub struct OidcConfig {
/// Per-room overrides to the user's display name or avatar will be
/// preserved by the import process.
///
/// SECURITY NOTE: If the `avatar_url` field is set, Continuwuity will
/// perform a HTTP GET to the URL in the mapped claim and use the returned
/// file as the user's profile picture. Make sure your users are not able
/// to set the value of the mapped claim to an arbitrary URL.
/// SECURITY NOTE: For the following profile fields, Continuwuity will treat
/// the value of the mapped claim as an HTTP URL and upload the file located
/// at that URL to its internal media repository:
///
/// - `avatar_url`
/// - `chat.commet.profile_banner`
///
/// If you map these fields to claims, make sure your users cannot set those
/// claims to arbitrary URLs.
///
/// default: { displayname = "name" }
#[serde(default = "default_profile_key_map")]
@@ -2838,6 +2899,45 @@ pub enum OidcProfileKeyImportMode {
OnLogin,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(untagged)]
pub enum TrustedServer {
Config(TrustedServerConfig),
Name(OwnedServerName),
}
impl TrustedServer {
#[must_use]
pub fn server_name(&self) -> &ServerName {
match self {
| Self::Name(server_name) => server_name,
| Self::Config(config) => &config.server_name,
}
}
#[must_use]
pub fn verify_keys(&self) -> &[Base64] {
let Self::Config(config) = self else {
return &[];
};
config.verify_keys.as_slice()
}
}
#[derive(Clone, Debug, Deserialize)]
pub struct TrustedServerConfig {
pub server_name: OwnedServerName,
#[serde(default)]
pub verify_keys: Vec<Base64>,
}
impl TrustedServerConfig {
#[must_use]
pub fn new(server_name: OwnedServerName) -> Self {
Self { server_name, verify_keys: Vec::new() }
}
}
const DEPRECATED_KEYS: &[&str] = &[
"cache_capacity",
"conduit_cache_capacity_modifier",
@@ -2853,6 +2953,26 @@ const DEPRECATED_KEYS: &[&str] = &[
];
impl Config {
/// Get the base domain to use for user-facing URLs.
#[must_use]
pub fn get_client_domain(&self) -> Url {
self.well_known.client.clone().unwrap_or_else(|| {
let host = self.server_name.host();
format!("https://{host}")
.as_str()
.try_into()
.expect("server name should be a valid host")
})
}
/// Contact for the VAPID `sub` claim.
#[must_use]
pub fn webpush_vapid_contact(&self) -> Url {
self.get_client_domain()
.join("/_continuwuity/about")
.expect("about page is a valid path")
}
/// Pre-initialize config
pub fn load(paths: &[PathBuf]) -> Result<Figment> {
let envs = [
@@ -3072,8 +3192,17 @@ fn default_otlp_protocol() -> String { "http".to_owned() }
fn default_tracing_flame_output_path() -> String { "./tracing.folded".to_owned() }
fn default_trusted_servers() -> Vec<OwnedServerName> {
vec![OwnedServerName::try_from("matrix.org").unwrap()]
fn default_trusted_servers() -> Vec<TrustedServer> {
// TODO(nex): Once we can be a notary, add maintainer(?) homeservers here.
// Rationale: Users are already running our code, arguably that's a higher
// level of trust than is assigned to notaries in the first place.
// We should still remind everyone that notaries are evil and out to get you
// and to replace this list with servers they actually trust.
let trusted_servers = vec![ruma::owned_server_name!("matrix.org")];
trusted_servers
.into_iter()
.map(TrustedServer::Name)
.collect()
}
/// do debug logging by default for debug builds
@@ -3210,8 +3339,6 @@ fn parallelism_scaled_u32(val: u32) -> u32 {
fn parallelism_scaled(val: usize) -> usize { val.saturating_mul(sys::available_parallelism()) }
fn default_trusted_server_batch_size() -> usize { 256 }
fn default_db_pool_workers() -> usize {
sys::available_parallelism()
.saturating_mul(4)
+1 -1
View File
@@ -100,7 +100,7 @@ macro_rules! err {
};
($variant:ident($($args:tt)+)) => {
$crate::error::Error::$variant($crate::format_maybe!($($args)+))
$crate::error::Error::$variant($crate::format_maybe!($($args)+), /* Cow<'static, str> */)
};
($level:ident!($($args:tt)+)) => {{
+1
View File
@@ -23,6 +23,7 @@ pub use self::{
id::{ShortId, *},
partial::PartialPdu,
raw_id::*,
unsigned::UnsignedContext,
};
use super::{Event, StateKey};
use crate::Result;
+11 -9
View File
@@ -1,10 +1,14 @@
use ruma::{RoomVersionId, canonical_json::redact_content_in_place};
use serde_json::{Value as JsonValue, json, value::to_raw_value};
use serde_json::{json, value::to_raw_value};
use crate::{Err, Result, err};
impl super::Pdu {
pub fn redact(&mut self, room_version_id: &RoomVersionId, reason: JsonValue) -> Result {
pub fn redact(
&mut self,
room_version_id: &RoomVersionId,
redacted_because: Option<&ruma::EventId>,
) -> Result {
let Some(rules) = room_version_id.rules() else {
return Err!("Cannot redact event for unknown room version {room_version_id}");
};
@@ -20,15 +24,13 @@ impl super::Pdu {
redact_content_in_place(&mut content, &rules.redaction, self.kind.to_string());
let reason = serde_json::to_value(reason).expect("Failed to preserialize reason");
let redacted_because = json!({
"redacted_because": reason,
});
self.unsigned = to_raw_value(&redacted_because)
if let Some(event_id) = redacted_because {
self.unsigned = to_raw_value(&json!({
"org.continuwuity.redacted_by": event_id,
}))
.expect("Failed to serialize unsigned")
.into();
}
self.content = to_raw_value(&content).expect("Failed to serialize content");
+4 -5
View File
@@ -64,7 +64,7 @@ fn nonsense_sticky_object_does_not_reject_the_pdu() {
#[test]
fn redaction_removes_stickiness() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.redact(&ruma::RoomVersionId::V11, serde_json::json!({}))
pdu.redact(&ruma::RoomVersionId::V11, None)
.expect("redaction succeeds");
assert!(pdu.sticky.is_none());
@@ -74,7 +74,7 @@ fn redaction_removes_stickiness() {
fn sticky_ttl_is_added_to_unsigned() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.add_sticky_duration_ttl().expect("ttl is added");
pdu.set_unsigned(None).unwrap();
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
@@ -88,8 +88,7 @@ fn sticky_ttl_is_added_to_unsigned() {
#[test]
fn no_ttl_for_events_that_are_not_sticky() {
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": "nonsense" }));
pdu.add_sticky_duration_ttl().expect("ttl is skipped");
let pdu = sticky_pdu(&serde_json::json!({ "duration_ms": "nonsense" }));
assert!(pdu.unsigned.is_none());
}
@@ -100,7 +99,7 @@ fn set_unsigned_adds_the_sticky_ttl() {
// section
let mut pdu = sticky_pdu(&serde_json::json!({ "duration_ms": 300_000 }));
pdu.origin_server_ts = ruma::MilliSecondsSinceUnixEpoch::now().get();
pdu.set_unsigned(None);
pdu.set_unsigned(None).unwrap();
let unsigned: serde_json::Value =
serde_json::from_str(pdu.unsigned.as_deref().expect("unsigned is set").get())
+78 -99
View File
@@ -1,112 +1,91 @@
use std::{borrow::Borrow, collections::BTreeMap};
use std::collections::BTreeMap;
use ruma::MilliSecondsSinceUnixEpoch;
use serde_json::value::{RawValue as RawJsonValue, Value as JsonValue, to_raw_value};
use ruma::{
MilliSecondsSinceUnixEpoch, UserId,
events::{AnyTimelineEvent, room::member::MembershipState},
serde::Raw,
};
use serde_json::value::{RawValue as RawJsonValue, to_raw_value};
use super::{Pdu, sticky};
use crate::{Result, err, result::LogErr};
use crate::Event;
type Unsigned = BTreeMap<String, Box<RawJsonValue>>;
#[derive(Default, Clone)]
pub struct UnsignedContext<'a> {
pub user_id: Option<&'a UserId>,
pub membership: Option<MembershipState>,
pub prev_content: Option<Box<serde_json::value::RawValue>>,
pub redacted_because: Option<Raw<AnyTimelineEvent>>,
}
impl Pdu {
/// Set the `unsigned` field of the PDU using only information in the PDU.
/// Some unsigned data is already set within the database (eg. prev events,
/// threads). Once this is done, other data must be calculated from the
/// database (eg. relations) This is for server-to-client events.
/// Backfill handles this itself.
pub fn set_unsigned(&mut self, user_id: Option<&ruma::UserId>) {
if Some(self.sender.borrow()) != user_id {
self.remove_transaction_id().log_err().ok();
/// Sets the `unsigned` field of the PDU using a mix of the provided
/// optional data, and information available in the PDU itself. The
/// `unsigned` field will always be inserted if it is not attached to the
/// PDU, however no operations will be performed if `unsigned` is present
/// but malformed and unparsable.
///
/// `age` is always inserted and is calculated based on the time of the
/// function call. `membership`, `prev_content`, and `redacted_by` are
/// inserted if not `None`. If `user_id` is `None`, `transaction_id` will be
/// removed. The sticky event TTL field is always inserted and calculated
/// (per `age`) if the PDU is sticky.
///
/// This function panics if any value cannot be serialised, which should not
/// happen provided `membership`, `prev_content`, and `redacted_because` are
/// well-formed.
pub fn set_unsigned(
&mut self,
context: Option<UnsignedContext<'_>>,
) -> crate::Result<Unsigned> {
// See: https://spec.matrix.org/v1.19/client-server-api/#definition-clientevent_unsigneddata
let mut unsigned = self
.unsigned()
.map_or_else(|| Ok(Unsigned::new()), |u| serde_json::from_str::<Unsigned>(u.get()))?;
let now = MilliSecondsSinceUnixEpoch::now().get();
let now_i: ruma::Int = now.into();
unsigned.insert(
"age".to_owned(),
to_raw_value(&now_i.saturating_sub(self.origin_server_ts.into()))?,
);
if let Some(context) = context {
if let Some(membership) = context.membership {
unsigned.insert("membership".to_owned(), to_raw_value(&membership)?);
}
if let Some(prev_content) = context.prev_content {
unsigned.insert("prev_content".to_owned(), to_raw_value(&prev_content)?);
}
if let Some(redacted_because) = context.redacted_because {
unsigned.remove("org.continuwuity.redacted_by");
unsigned.insert("redacted_because".to_owned(), to_raw_value(&redacted_because)?);
}
// replaces_state is embedded and always included.
if context.user_id.is_none_or(|u| u != self.sender()) {
unsigned.remove("transaction_id");
}
} else {
unsigned.remove("transaction_id");
}
self.add_age().log_err().ok();
self.add_sticky_duration_ttl().log_err().ok();
}
pub fn remove_transaction_id(&mut self) -> Result {
use BTreeMap as Map;
let Some(unsigned) = &self.unsigned else {
return Ok(());
};
let mut unsigned: Map<&str, Box<RawJsonValue>> = serde_json::from_str(unsigned.get())
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
unsigned.remove("transaction_id");
self.unsigned = to_raw_value(&unsigned)
.map(Some)
.expect("unsigned is valid");
Ok(())
}
pub fn add_age(&mut self) -> Result {
use BTreeMap as Map;
let mut unsigned: Map<&str, Box<RawJsonValue>> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
// deliberately allowing for the possibility of negative age
let now: i128 = MilliSecondsSinceUnixEpoch::now().get().into();
let then: i128 = self.origin_server_ts.into();
let this_age = now.saturating_sub(then);
unsigned.insert("age", to_raw_value(&this_age)?);
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
}
pub fn add_sticky_duration_ttl(&mut self) -> Result {
use BTreeMap as Map;
let now = u64::from(MilliSecondsSinceUnixEpoch::now().get());
let Some(expires_at) = self
if let Some(expires_at) = self
.sticky
.as_deref()
.and_then(|sticky| sticky::expires_at(self.origin_server_ts, sticky, now))
else {
return Ok(());
};
let mut unsigned: Map<&str, Box<RawJsonValue>> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
unsigned.insert(sticky::TTL_UNSIGNED_KEY, to_raw_value(&expires_at.saturating_sub(now))?);
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
}
pub fn add_relation(&mut self, name: &str, pdu: Option<&Self>) -> Result {
use serde_json::Map;
let mut unsigned: Map<String, JsonValue> = self
.unsigned
.as_deref()
.map(RawJsonValue::get)
.map_or_else(|| Ok(Map::new()), serde_json::from_str)
.map_err(|e| err!(Database("Invalid unsigned in pdu event: {e}")))?;
let pdu = pdu
.map(serde_json::to_value)
.transpose()?
.unwrap_or_else(|| JsonValue::Object(Map::new()));
unsigned
.entry("m.relations")
.or_insert(JsonValue::Object(Map::new()))
.as_object_mut()
.map(|object| object.insert(name.to_owned(), pdu));
.and_then(|sticky| sticky::expires_at(self.origin_server_ts, sticky, u64::from(now)))
{
unsigned.insert(
sticky::TTL_UNSIGNED_KEY.to_owned(),
to_raw_value(&expires_at.saturating_sub(u64::from(now)))?,
);
}
self.unsigned = Some(to_raw_value(&unsigned)?);
Ok(())
Ok(unsigned)
}
}
+3 -5
View File
@@ -1120,9 +1120,6 @@ fn can_send_event(
ple: Option<&impl Event>,
user_level: UserPowerLevel,
) -> bool {
if user_level == UserPowerLevel::Infinite {
return true;
}
let event_type_power_level = get_send_level(event.event_type(), event.state_key(), ple);
debug!(
@@ -1137,8 +1134,9 @@ fn can_send_event(
return false;
}
if event.state_key().is_some_and(|k| k.starts_with('@'))
&& event.state_key() != Some(event.sender().as_str())
if event
.state_key()
.is_some_and(|k| k.starts_with('@') && k != event.sender().as_str())
{
warn!(
?user_level,
+10 -4
View File
@@ -809,11 +809,17 @@ where
.await;
trace!(map = ?auth_state.keys().collect::<Vec<_>>(), event_id = event.event_id().as_str(), "auth state for event");
// If this is not a create event, we must have the room create event in
// the auth state by now.
if *event.event_type() != StateEventType::RoomCreate.into()
|| event.state_key().is_none_or(|k| !k.is_empty())
if *event.event_type() == StateEventType::RoomCreate.into()
&& event.state_key().is_some_and(str::is_empty)
{
// Inject the create event so that the call to auth_check doesn't
// explode. It's not used otherwise.
auth_state
.entry(StateEventType::RoomCreate.with_state_key(""))
.or_insert_with(|| event.clone());
} else {
// If this is not a create event, we must have the room create event
// in the auth state by now.
if !auth_state.contains_key(&StateEventType::RoomCreate.with_state_key("")) {
return Err(Error::NotFound(format!(
"m.room.create did not appear in the auth state for {}",
+4
View File
@@ -44,5 +44,9 @@ pub fn unstable_features() -> BTreeMap<String, bool> {
("org.matrix.msc4155".to_owned(), true),
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
("computer.gingershaped.msc4466".to_owned(), true),
// web push (https://github.com/matrix-org/matrix-spec-proposals/pull/4174)
("org.matrix.msc4174".to_owned(), true),
// Membership-based invite blocking (https://github.com/matrix-org/matrix-spec-proposals/pull/4494)
("uk.timedout.msc4494".to_owned(), true),
])
}
+13 -1
View File
@@ -130,6 +130,10 @@ pub(super) static MAPS: &[Descriptor] = &[
},
Descriptor {
name: "openidsubject_currentpictureurl",
..descriptor::DROPPED
},
Descriptor {
name: "openidsubjectprofilefield_url",
..descriptor::RANDOM_SMALL
},
Descriptor {
@@ -267,7 +271,15 @@ pub(super) static MAPS: &[Descriptor] = &[
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "server_signingkeys",
name: "senderkey_webpushbackoff",
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "senderkey_webpushstate",
..descriptor::RANDOM_SMALL
},
Descriptor {
name: "servernamekeyid_response",
..descriptor::RANDOM
},
Descriptor {
+3 -1
View File
@@ -11,16 +11,18 @@ version.workspace = true
path = "mod.rs"
[features]
default = ["client", "server"]
default = ["client", "server", "unstable-msc4484"]
client = []
server = []
unstable-exhaustive-types = []
unstable-msc3202 = []
unstable-msc4203 = []
unstable-msc4484 = ["ruma/unstable-msc4484"]
[dependencies]
assign.workspace = true
http.workspace = true
ruma.workspace = true
serde = { workspace = true }
serde_json = { workspace = true }
@@ -1 +1,2 @@
pub mod rooms;
pub mod users;
@@ -1,7 +1,7 @@
pub mod v1 {
use ruma::{
OwnedRoomAliasId, OwnedRoomId, OwnedUserId,
api::{auth_scheme::AccessToken, request, response},
api::{OAuthClientScope, auth_scheme::AccessToken, request, response},
metadata,
};
@@ -10,8 +10,9 @@ pub mod v1 {
rate_limited: false,
authentication: AccessToken,
history: {
1.0 => "/_continuwuity/admin/rooms/{room_id}/ban",
}
1.0 => "/_continuwuity/admin/v1/rooms/{room_id}/ban",
},
required_client_scopes: [OAuthClientScope::ServerAdministration]
}
#[request]
@@ -1,7 +1,7 @@
pub mod v1 {
use ruma::{
OwnedRoomId,
api::{auth_scheme::AccessToken, request, response},
api::{OAuthClientScope, auth_scheme::AccessToken, request, response},
metadata,
};
@@ -10,8 +10,9 @@ pub mod v1 {
rate_limited: false,
authentication: AccessToken,
history: {
1.0 => "/_continuwuity/admin/rooms/list",
}
1.0 => "/_continuwuity/admin/v1/rooms/list",
},
required_client_scopes: [OAuthClientScope::ServerAdministration]
}
#[request]
@@ -0,0 +1,58 @@
pub mod v1 {
use ruma::{
OwnedUserId,
api::{OAuthClientScope, auth_scheme::AccessToken, request, response},
metadata,
profile::UserProfile,
};
metadata! {
method: POST,
rate_limited: false,
authentication: AccessToken,
history: {
1.0 => "/_continuwuity/admin/v1/users",
},
required_client_scopes: [OAuthClientScope::ServerAdministration]
}
#[request]
pub struct Request {
/// The full user ID to create. Must belong to the server.
pub user_id: OwnedUserId,
/// The password to set for the new user.
///
/// If `None`, the user will not be able to log in.
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
pub password: Option<String>,
/// The profile fields to set for the user. This can be used to set the
/// new user's display name and profile picture.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub profile: Option<UserProfile>,
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
pub admin: bool,
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
pub suspended: bool,
#[serde(default, skip_serializing_if = "ruma::serde::is_default")]
pub locked: bool,
}
#[derive(Default)]
#[response]
pub struct Response;
impl Request {
#[must_use]
pub fn new(user_id: OwnedUserId) -> Self {
Self {
user_id,
password: None,
profile: None,
admin: false,
suspended: false,
locked: false,
}
}
}
}
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff. Show more