mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-27 19:07:33 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2842aa6d23 | ||
|
|
129a3851eb | ||
|
|
8d15241584 | ||
|
|
93886e8f87 |
No files matched your search
@@ -71,7 +71,7 @@ runs:
|
|||||||
|
|
||||||
- name: Install timelord-cli and git-warp-time
|
- name: Install timelord-cli and git-warp-time
|
||||||
if: steps.check-binaries.outputs.need-install == 'true'
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
uses: https://github.com/taiki-e/install-action@fe3acb53a98b62c772db35de75ce0e4595e7ca8c # v2
|
uses: https://github.com/taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2
|
||||||
with:
|
with:
|
||||||
tool: git-warp-time,timelord-cli@3.0.1
|
tool: git-warp-time,timelord-cli@3.0.1
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ jobs:
|
|||||||
docs:
|
docs:
|
||||||
name: Build and Deploy Documentation
|
name: Build and Deploy Documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: secrets.CLOUDFLARE_API_TOKEN != ''
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
||||||
@@ -28,14 +30,6 @@ jobs:
|
|||||||
id: runner-env
|
id: runner-env
|
||||||
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
|
uses: https://forgejo.ellis.link/continuwuation/detect-versions@d39555789fed25b8eb8e086d9f199c514dfa311e # v1
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
if: steps.runner-env.outputs.go_minor == '' || steps.runner-env.outputs.go_minor < '27'
|
|
||||||
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7
|
|
||||||
with:
|
|
||||||
go-version: '1.27'
|
|
||||||
go-version-file: 'go.mod'
|
|
||||||
cache-dependency-path: 'go.sum'
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
|
if: steps.runner-env.outputs.node_major == '' || steps.runner-env.outputs.node_major < '20'
|
||||||
uses: https://github.com/actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
|
uses: https://github.com/actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
|
||||||
@@ -51,33 +45,27 @@ jobs:
|
|||||||
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-
|
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-
|
||||||
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-
|
continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-
|
||||||
|
|
||||||
- name: Install Rspress and dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Build documentation with Rspress
|
- name: Build Rspress documentation
|
||||||
env:
|
|
||||||
SITE_PATH: ${{ github.ref != 'refs/heads/main' && format('/@{0}/', forgejo.event.number) || '/' }}
|
|
||||||
run: npm run docs:build
|
run: npm run docs:build
|
||||||
|
|
||||||
- name: Deploy to Grebedoc (Production)
|
- name: Install Wrangler
|
||||||
if: github.ref == 'refs/heads/main'
|
run: npm install --save-dev wrangler@latest
|
||||||
run: |
|
|
||||||
go tool git-pages-cli https://continuwuity.org \
|
|
||||||
--server grebedoc.dev \
|
|
||||||
--token "${{ forgejo.token }}" \
|
|
||||||
--upload-dir doc_build \
|
|
||||||
--pretty-urls \
|
|
||||||
--comment "${{ forgejo.sha }}" \
|
|
||||||
--verbose
|
|
||||||
|
|
||||||
- name: Deploy to Grebedoc (Preview)
|
- name: Deploy to Cloudflare Pages (Production)
|
||||||
if: github.ref != 'refs/heads/main'
|
if: github.ref == 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
|
||||||
run: |
|
uses: https://github.com/cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
|
||||||
go tool git-pages-cli https://preview.continuwuity.org/@${{ forgejo.event.number }} \
|
with:
|
||||||
--server grebedoc.dev \
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
--token "${{ forgejo.token }}" \
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
--upload-dir doc_build \
|
command: pages deploy ./doc_build --branch="main" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}"
|
||||||
--pretty-urls \
|
|
||||||
--expires 14 \
|
- name: Deploy to Cloudflare Pages (Preview)
|
||||||
--comment "${{ forgejo.sha }}" \
|
if: github.ref != 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != ''
|
||||||
--verbose
|
uses: https://github.com/cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4
|
||||||
|
with:
|
||||||
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
command: pages deploy ./doc_build --branch="${{ github.head_ref || github.ref_name }}" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}"
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
name: Renovate
|
name: Renovate
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/renovatebot/renovate:44.257.9@sha256:578179439fceea89646662dd583b27efdad8d1429e0cbd90681c40dde068589e
|
image: ghcr.io/renovatebot/renovate:44.227.4@sha256:e09d40686f73d43b2c1e4667cb47d3c1d24a6ac730b74ce7aced9c84f68594f1
|
||||||
options: --tmpfs /tmp:exec
|
options: --tmpfs /tmp:exec
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -36,11 +36,6 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: committed
|
- id: committed
|
||||||
|
|
||||||
- repo: https://github.com/twisted/towncrier
|
|
||||||
rev: 26.9.0
|
|
||||||
hooks:
|
|
||||||
- id: towncrier-check
|
|
||||||
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: cargo-fmt
|
- id: cargo-fmt
|
||||||
|
|||||||
Generated
+127
-144
@@ -604,9 +604,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.12.2"
|
version = "1.12.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c"
|
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytesize"
|
name = "bytesize"
|
||||||
@@ -624,12 +624,6 @@ dependencies = [
|
|||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cache_control"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1bf2a5fb3207c12b5d208ebc145f967fea5cac41a021c37417ccc31ba40f39ee"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "camino"
|
name = "camino"
|
||||||
version = "1.2.6"
|
version = "1.2.6"
|
||||||
@@ -671,7 +665,7 @@ checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"toml 1.2.2+spec-1.1.0",
|
"toml 1.2.1+spec-1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -759,14 +753,14 @@ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"glob",
|
"glob",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading",
|
"libloading 0.8.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.6.9"
|
version = "4.6.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "844c5c0b65be192cb68d570cca1b21a6444431d24e39c084dc0336177015337c"
|
checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -784,9 +778,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.6.9"
|
version = "4.6.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7"
|
checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -946,7 +940,7 @@ dependencies = [
|
|||||||
"hyper",
|
"hyper",
|
||||||
"itertools 0.15.0",
|
"itertools 0.15.0",
|
||||||
"lettre",
|
"lettre",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"reqwest 0.13.5",
|
"reqwest 0.13.5",
|
||||||
"ruma",
|
"ruma",
|
||||||
"ruminuwuity",
|
"ruminuwuity",
|
||||||
@@ -955,7 +949,6 @@ dependencies = [
|
|||||||
"sha1 0.11.0",
|
"sha1 0.11.0",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wildmatch",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -991,16 +984,16 @@ dependencies = [
|
|||||||
"figment",
|
"figment",
|
||||||
"futures",
|
"futures",
|
||||||
"governor",
|
"governor",
|
||||||
|
"hardened_malloc-rs",
|
||||||
"http",
|
"http",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"ipaddress",
|
"ipaddress",
|
||||||
"lettre",
|
"lettre",
|
||||||
"libc",
|
"libc",
|
||||||
"libmimalloc-sys",
|
"libloading 0.9.0",
|
||||||
"lock_api 0.5.0",
|
"lock_api 0.5.0",
|
||||||
"maplit",
|
"maplit",
|
||||||
"mimalloc",
|
|
||||||
"nix",
|
"nix",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"openidconnect",
|
"openidconnect",
|
||||||
@@ -1010,7 +1003,7 @@ dependencies = [
|
|||||||
"opentelemetry_sdk",
|
"opentelemetry_sdk",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"prometheus",
|
"prometheus",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest 0.13.5",
|
"reqwest 0.13.5",
|
||||||
"resolvematrix",
|
"resolvematrix",
|
||||||
@@ -1029,7 +1022,7 @@ dependencies = [
|
|||||||
"tikv-jemallocator",
|
"tikv-jemallocator",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-metrics",
|
"tokio-metrics",
|
||||||
"toml 1.2.2+spec-1.1.0",
|
"toml 1.2.1+spec-1.1.0",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
@@ -1127,12 +1120,11 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"loole",
|
"loole",
|
||||||
"lru-cache",
|
"lru-cache",
|
||||||
"mime",
|
|
||||||
"nonzero_ext",
|
"nonzero_ext",
|
||||||
"openidconnect",
|
"openidconnect",
|
||||||
"opentelemetry",
|
"opentelemetry",
|
||||||
"p256 0.14.0",
|
"p256 0.14.0",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest 0.12.28",
|
"reqwest 0.12.28",
|
||||||
"reqwest 0.13.5",
|
"reqwest 0.13.5",
|
||||||
@@ -1526,9 +1518,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctor"
|
name = "ctor"
|
||||||
version = "1.0.14"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea691ed9f36489d087419b8b2ba3ef27d89621380b4178c73e2445a379e4e0f4"
|
checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"link-section",
|
"link-section",
|
||||||
"linktime-proc-macro",
|
"linktime-proc-macro",
|
||||||
@@ -1553,12 +1545,6 @@ dependencies = [
|
|||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cty"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "curve25519-dalek"
|
name = "curve25519-dalek"
|
||||||
version = "5.0.0"
|
version = "5.0.0"
|
||||||
@@ -1791,11 +1777,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dtor"
|
name = "dtor"
|
||||||
version = "1.0.7"
|
version = "1.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "915e80ae7aca23bef767ded8e4a763d0c912c2faaa8bfec1e66d505ebaceb254"
|
checksum = "cd3f6c362b2bbd7063090886afd78978f5dbf1f11da7efcc40f81d32c943fac1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"link-section",
|
|
||||||
"linktime-proc-macro",
|
"linktime-proc-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1929,9 +1914,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "email-encoding"
|
name = "email-encoding"
|
||||||
version = "0.4.3"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f690ae2169f2ceb3f45b28b6fcd8fa16839f2f5c8818546774b9425f5f71004"
|
checksum = "420b9da095f052ea597503e39073b5b3c522f7db933fbac202d91d24492693fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -2105,9 +2090,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "form_urlencoded"
|
name = "form_urlencoded"
|
||||||
version = "1.2.3"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
|
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
@@ -2325,9 +2310,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "granit-parser"
|
name = "granit-parser"
|
||||||
version = "2.2.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9bd04d0d9c7079b416b458d2317aea4aa964c81938cb7c20f559758c4f422dc8"
|
checksum = "05f05586d4d4df3d47123207826c40b252728b438a1a07bad3c01ee6bea401df"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arraydeque",
|
"arraydeque",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -2402,6 +2387,12 @@ dependencies = [
|
|||||||
"tokio-util",
|
"tokio-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hardened_malloc-rs"
|
||||||
|
version = "0.1.2+12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "647deb1583b14d160f85f3ff626f20b6edd366e3852c9843b06077388f794cb6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.12.3"
|
version = "0.12.3"
|
||||||
@@ -2496,7 +2487,7 @@ dependencies = [
|
|||||||
"idna",
|
"idna",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"jni",
|
"jni",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -2516,7 +2507,7 @@ dependencies = [
|
|||||||
"jni",
|
"jni",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"prefix-trie",
|
"prefix-trie",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"ring",
|
"ring",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
@@ -2542,7 +2533,7 @@ dependencies = [
|
|||||||
"ndk-context",
|
"ndk-context",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"resolv-conf",
|
"resolv-conf",
|
||||||
"serde",
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -2955,9 +2946,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ipaddress"
|
name = "ipaddress"
|
||||||
version = "0.2.13"
|
version = "0.2.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0ae5a9c049476ef23026df39fe92a8d83c1d8b670b975f095cb4d5a3b13d43e"
|
checksum = "67a97d7409c3ade4304acbff6b33b915af4564c42bf6e383651ced09bd6a2bce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -3197,9 +3188,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lettre"
|
name = "lettre"
|
||||||
version = "0.11.24"
|
version = "0.11.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f294f3d7cdb313e578acef7d7727d4e8d897e0fcd0d6d58c19959cec95073f19"
|
checksum = "f2c646bd5cc763b1087b15493e29a64be6147ba8f19342004fa52048ee596eae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
@@ -3241,22 +3232,22 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libloading"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.2.16"
|
version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libmimalloc-sys"
|
|
||||||
version = "0.1.49"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6a45a52f43e1c16f667ccfe4dd8c85b7f7c204fd5e3bf46c5b0db9a5c3c0b8e9"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"cty",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.32"
|
version = "1.1.32"
|
||||||
@@ -3270,9 +3261,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "link-section"
|
name = "link-section"
|
||||||
version = "0.19.4"
|
version = "0.19.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c"
|
checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
@@ -3430,15 +3421,6 @@ dependencies = [
|
|||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mimalloc"
|
|
||||||
version = "0.1.52"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2d4139bb28d14ad1facf21d5eb8825051b326e172d216b39f6d31df53cc97862"
|
|
||||||
dependencies = [
|
|
||||||
"libmimalloc-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.18"
|
version = "0.3.18"
|
||||||
@@ -3992,7 +3974,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "opentelemetry-instrumentation-tower"
|
name = "opentelemetry-instrumentation-tower"
|
||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
source = "git+https://github.com/open-telemetry/opentelemetry-rust-contrib?rev=6bbbc337aab0bcf10d7799c3e5b5ced75920491a#6bbbc337aab0bcf10d7799c3e5b5ced75920491a"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e7006f3b1853d315462a7237c81eec3d7adfa5b70975a02b19e92d045bc22d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"http",
|
"http",
|
||||||
@@ -4627,7 +4610,7 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"lru-slab",
|
"lru-slab",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"rand_pcg",
|
"rand_pcg",
|
||||||
"ring",
|
"ring",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
@@ -4704,9 +4687,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.10.4"
|
version = "0.10.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11"
|
checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chacha20",
|
"chacha20",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
@@ -4797,9 +4780,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.13.2"
|
version = "1.13.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
|
checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -4809,9 +4792,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.4.19"
|
version = "0.4.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
|
checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -4820,9 +4803,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.8.12"
|
version = "0.8.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
|
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
@@ -4914,11 +4897,10 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "resolvematrix"
|
name = "resolvematrix"
|
||||||
version = "1.5.0"
|
version = "1.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "39a1efc3c55274528f8b1a916eb0edf5c40a8364b4899fbc1283a57c8d0024db"
|
checksum = "d6e659fe17ed82acfac43641d00d1bbfd0a9d53ec4d2f901b01f792f0e2c9e3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cache_control",
|
|
||||||
"hickory-resolver",
|
"hickory-resolver",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@@ -4986,8 +4968,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.18.0"
|
version = "0.17.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -5005,8 +4987,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.18.0"
|
version = "0.17.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"http",
|
"http",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -5018,8 +5000,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.26.0"
|
version = "0.25.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"assign",
|
"assign",
|
||||||
@@ -5040,8 +5022,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.21.0"
|
version = "0.20.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
@@ -5054,7 +5036,7 @@ dependencies = [
|
|||||||
"js_int",
|
"js_int",
|
||||||
"konst",
|
"konst",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"regex",
|
"regex",
|
||||||
"ruma-identifiers-validation",
|
"ruma-identifiers-validation",
|
||||||
"ruma-macros",
|
"ruma-macros",
|
||||||
@@ -5073,8 +5055,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.36.0"
|
version = "0.35.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap 2.14.2",
|
"indexmap 2.14.2",
|
||||||
@@ -5094,8 +5076,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.17.0"
|
version = "0.16.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
@@ -5104,7 +5086,7 @@ dependencies = [
|
|||||||
"js_int",
|
"js_int",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mime",
|
"mime",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
"ruma-events",
|
"ruma-events",
|
||||||
"ruma-signatures",
|
"ruma-signatures",
|
||||||
@@ -5116,8 +5098,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.14.1"
|
version = "0.14.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
@@ -5125,8 +5107,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.20.3"
|
version = "0.20.2"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@@ -5136,13 +5118,13 @@ dependencies = [
|
|||||||
"ruma-identifiers-validation",
|
"ruma-identifiers-validation",
|
||||||
"serde",
|
"serde",
|
||||||
"syn 3.0.10",
|
"syn 3.0.10",
|
||||||
"toml 1.2.2+spec-1.1.0",
|
"toml 1.2.1+spec-1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.17.0"
|
version = "0.16.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -5153,14 +5135,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.23.0"
|
version = "0.22.1"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
"memchr",
|
"memchr",
|
||||||
"pkcs8 0.11.0",
|
"pkcs8 0.11.0",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
"ruma-events",
|
"ruma-events",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -5170,8 +5152,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.19.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/ruma/ruma.git?rev=decdf3f6c5160e1db595d4edb4d65d5de935e13c#decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
source = "git+https://github.com/ruma/ruma.git?rev=472a23ef86bc0bb40a22d856fc0af539eb9d71b7#472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -5198,7 +5180,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-librocksdb-sys"
|
name = "rust-librocksdb-sys"
|
||||||
version = "0.49.0+11.12.0"
|
version = "0.49.0+11.12.0"
|
||||||
source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=85ded20348e3dab902c239967075795e9c6d101b#85ded20348e3dab902c239967075795e9c6d101b"
|
source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=6021299f3e0e9455dc3f2e39c65e1dc217be8903#6021299f3e0e9455dc3f2e39c65e1dc217be8903"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"bzip2-sys",
|
"bzip2-sys",
|
||||||
@@ -5216,7 +5198,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-rocksdb"
|
name = "rust-rocksdb"
|
||||||
version = "0.54.0"
|
version = "0.54.0"
|
||||||
source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=85ded20348e3dab902c239967075795e9c6d101b#85ded20348e3dab902c239967075795e9c6d101b"
|
source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=6021299f3e0e9455dc3f2e39c65e1dc217be8903#6021299f3e0e9455dc3f2e39c65e1dc217be8903"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@@ -5495,9 +5477,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry"
|
name = "sentry"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7bc7fb14982f395d53924f4feebd48c6cc136399c49ac2160dcf2b260e74b75"
|
checksum = "e7c2c887f17023c9462a4202176efc33ca7228f9c30c0141c765ab534ab2d36b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
@@ -5515,9 +5497,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-backtrace"
|
name = "sentry-backtrace"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f68328b53eb7defc20f993ed7cd1f4ce10d06feecefdf914db062ce2523e4b77"
|
checksum = "c391d4330f3b37fdddf2b928151244e8c2dc0cfea1740e455cc8942af436f919"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"regex",
|
"regex",
|
||||||
@@ -5526,9 +5508,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-contexts"
|
name = "sentry-contexts"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1d57fb52d1e5d76cc5a7415428004699d9e6d498859a7acc8e05becc57dad81f"
|
checksum = "654dacb94135c713e1dcbff01314a83d333f0e62f76b91fed5ab87415075530c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hostname",
|
"hostname",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -5540,21 +5522,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-core"
|
name = "sentry-core"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8367f7f31654b35453e20c8aca06e0ecf5a4d4793e33be139c1581e475a94e6a"
|
checksum = "edcb294ca821e5c5624edaf33535eb18b06ef4f8675201d3e4d81ce325741692"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"sentry-types",
|
"sentry-types",
|
||||||
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-debug-images"
|
name = "sentry-debug-images"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "386f4ce2364e58f2ca811f388a0427fa13784bbe7aee85f302e901ef4b00fab9"
|
checksum = "74835055f6a57b78c0e13f941b460e39edc1899b05fe31dd47cd02367f70888f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"findshlibs",
|
"findshlibs",
|
||||||
"sentry-core",
|
"sentry-core",
|
||||||
@@ -5562,9 +5545,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-log"
|
name = "sentry-log"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c938358d54c65a79fea165a447ae0eabc5717f23ba482ceee279c5645f0ccad3"
|
checksum = "f24141aaeb20c731719b33077f1063a79e07eef63a4954530559c067ba046aad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"log",
|
"log",
|
||||||
@@ -5573,9 +5556,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-panic"
|
name = "sentry-panic"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ab095af8f107e893941f857d8e204f5d25404247c34af131c7d199e3021679f"
|
checksum = "f5d28522f81ed90510ec43ed01cb1873a393b329dc719f93335b4c75fbef05d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sentry-backtrace",
|
"sentry-backtrace",
|
||||||
"sentry-core",
|
"sentry-core",
|
||||||
@@ -5583,9 +5566,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-tower"
|
name = "sentry-tower"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "18f29b19179ae36e6318c71f6ee18d1e0db8bbe8e7b7f213c2aba9e721b650fb"
|
checksum = "057730796d82b72f35f57e66fc41c2b9e334eb3edf5030dd18d3b1f88d062c78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"http",
|
"http",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
@@ -5597,9 +5580,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-tracing"
|
name = "sentry-tracing"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7cae82b121a812e69a1cfaaacb800112f5f261f362fbf5a08e13d1c11ef349e"
|
checksum = "ec67c296aadc41d4d41b64738908c51cacddf99edebe7a2b476f9bf40de93ff5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"sentry-backtrace",
|
"sentry-backtrace",
|
||||||
@@ -5610,13 +5593,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-types"
|
name = "sentry-types"
|
||||||
version = "0.49.6"
|
version = "0.49.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "03da7c1f79d001b4f18e277f8207470efb262fb94c761baa195873d2ace8eb8a"
|
checksum = "83d84a36b6bdeeb7813976fb899fca45d94540d2e2b80eac91ba66b4c654d8f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"debugid",
|
"debugid",
|
||||||
"hex",
|
"hex",
|
||||||
"rand 0.10.4",
|
"rand 0.10.3",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
@@ -5637,12 +5620,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde-saphyr"
|
name = "serde-saphyr"
|
||||||
version = "2.2.0"
|
version = "2.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "969cde0349344dbbf58b5f9badbfb8f806db13969364eb8007c057ef687007d9"
|
checksum = "d43fb82d550b07e6f929a58d7d0935182602f48ddead875f5ee313c41c8f07fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"annotate-snippets",
|
"annotate-snippets",
|
||||||
"base64 0.22.1",
|
"base64 0.23.1",
|
||||||
"encoding_rs_io",
|
"encoding_rs_io",
|
||||||
"granit-parser",
|
"granit-parser",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
@@ -5980,9 +5963,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.16.6"
|
version = "1.16.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
|
checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@@ -6237,7 +6220,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tikv-jemalloc-ctl"
|
name = "tikv-jemalloc-ctl"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=46e7821917b06636cdb5b203d312799970eaea92#46e7821917b06636cdb5b203d312799970eaea92"
|
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=ac4d4861b335b199f812807996e8c9166961041a#ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"tikv-jemalloc-sys",
|
"tikv-jemalloc-sys",
|
||||||
@@ -6246,7 +6229,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tikv-jemalloc-sys"
|
name = "tikv-jemalloc-sys"
|
||||||
version = "0.7.0+5.4.0-0-g7a34f18502e7b222724097cdcd499b437d189acc"
|
version = "0.7.0+5.4.0-0-g7a34f18502e7b222724097cdcd499b437d189acc"
|
||||||
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=46e7821917b06636cdb5b203d312799970eaea92#46e7821917b06636cdb5b203d312799970eaea92"
|
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=ac4d4861b335b199f812807996e8c9166961041a#ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -6255,7 +6238,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tikv-jemallocator"
|
name = "tikv-jemallocator"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=46e7821917b06636cdb5b203d312799970eaea92#46e7821917b06636cdb5b203d312799970eaea92"
|
source = "git+https://forgejo.ellis.link/continuwuation/jemallocator?rev=ac4d4861b335b199f812807996e8c9166961041a#ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"tikv-jemalloc-sys",
|
"tikv-jemalloc-sys",
|
||||||
@@ -6396,9 +6379,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "1.2.2+spec-1.1.0"
|
version = "1.2.1+spec-1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5426cb1b964690d913f6c5c1a1ae0b42f428ec506bb4d452876d7a209c9bca3b"
|
checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.14.2",
|
"indexmap 2.14.2",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
@@ -6455,9 +6438,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_parser"
|
name = "toml_parser"
|
||||||
version = "1.1.6+spec-1.1.0"
|
version = "1.1.5+spec-1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31"
|
checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winnow 1.0.5",
|
"winnow 1.0.5",
|
||||||
]
|
]
|
||||||
@@ -6854,9 +6837,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.5.9"
|
version = "2.5.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
|
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"idna",
|
"idna",
|
||||||
|
|||||||
+70
-22
@@ -269,8 +269,8 @@ features = [
|
|||||||
[workspace.dependencies.tokio-metrics]
|
[workspace.dependencies.tokio-metrics]
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
|
||||||
[workspace.dependencies.wildmatch]
|
[workspace.dependencies.libloading]
|
||||||
version = "2.7.0"
|
version = "0.9.0"
|
||||||
|
|
||||||
# Validating urls in config, was already a transitive dependency
|
# Validating urls in config, was already a transitive dependency
|
||||||
[workspace.dependencies.url]
|
[workspace.dependencies.url]
|
||||||
@@ -357,7 +357,7 @@ version = "1.1.1"
|
|||||||
# Used for matrix spec type definitions and helpers
|
# Used for matrix spec type definitions and helpers
|
||||||
[workspace.dependencies.ruma]
|
[workspace.dependencies.ruma]
|
||||||
git = "https://github.com/ruma/ruma.git"
|
git = "https://github.com/ruma/ruma.git"
|
||||||
rev = "decdf3f6c5160e1db595d4edb4d65d5de935e13c"
|
rev = "472a23ef86bc0bb40a22d856fc0af539eb9d71b7"
|
||||||
features = [
|
features = [
|
||||||
"appservice-api-c",
|
"appservice-api-c",
|
||||||
"client-api",
|
"client-api",
|
||||||
@@ -370,6 +370,7 @@ features = [
|
|||||||
"compat-upload-signatures",
|
"compat-upload-signatures",
|
||||||
"compat-optional-txn-pdus",
|
"compat-optional-txn-pdus",
|
||||||
"compat-get-3pids",
|
"compat-get-3pids",
|
||||||
|
"unstable-msc2867",
|
||||||
"unstable-msc2870",
|
"unstable-msc2870",
|
||||||
"unstable-msc3814",
|
"unstable-msc3814",
|
||||||
"unstable-msc3245",
|
"unstable-msc3245",
|
||||||
@@ -391,7 +392,6 @@ features = [
|
|||||||
"unstable-msc4406",
|
"unstable-msc4406",
|
||||||
"unstable-msc4439",
|
"unstable-msc4439",
|
||||||
"unstable-msc4354",
|
"unstable-msc4354",
|
||||||
"unstable-msc4388",
|
|
||||||
"unstable-msc4480",
|
"unstable-msc4480",
|
||||||
"unstable-msc4466",
|
"unstable-msc4466",
|
||||||
"unstable-msc4494",
|
"unstable-msc4494",
|
||||||
@@ -403,7 +403,7 @@ features = [
|
|||||||
|
|
||||||
[workspace.dependencies.rust-rocksdb]
|
[workspace.dependencies.rust-rocksdb]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1"
|
git = "https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1"
|
||||||
rev = "85ded20348e3dab902c239967075795e9c6d101b"
|
rev = "6021299f3e0e9455dc3f2e39c65e1dc217be8903"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"multi-threaded-cf",
|
"multi-threaded-cf",
|
||||||
@@ -431,8 +431,7 @@ features = ["reqwest"]
|
|||||||
version = "0.33.1"
|
version = "0.33.1"
|
||||||
|
|
||||||
[workspace.dependencies.opentelemetry-instrumentation-tower]
|
[workspace.dependencies.opentelemetry-instrumentation-tower]
|
||||||
git = "https://github.com/open-telemetry/opentelemetry-rust-contrib"
|
version = "0.19.0"
|
||||||
rev = "6bbbc337aab0bcf10d7799c3e5b5ced75920491a"
|
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["axum"]
|
features = ["axum"]
|
||||||
|
|
||||||
@@ -487,7 +486,7 @@ version = "0.49.5"
|
|||||||
# jemalloc usage
|
# jemalloc usage
|
||||||
[workspace.dependencies.tikv-jemalloc-sys]
|
[workspace.dependencies.tikv-jemalloc-sys]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
||||||
rev = "46e7821917b06636cdb5b203d312799970eaea92"
|
rev = "ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"background_threads_runtime_support",
|
"background_threads_runtime_support",
|
||||||
@@ -495,7 +494,7 @@ features = [
|
|||||||
]
|
]
|
||||||
[workspace.dependencies.tikv-jemallocator]
|
[workspace.dependencies.tikv-jemallocator]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
||||||
rev = "46e7821917b06636cdb5b203d312799970eaea92"
|
rev = "ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"background_threads_runtime_support",
|
"background_threads_runtime_support",
|
||||||
@@ -503,7 +502,7 @@ features = [
|
|||||||
]
|
]
|
||||||
[workspace.dependencies.tikv-jemalloc-ctl]
|
[workspace.dependencies.tikv-jemalloc-ctl]
|
||||||
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
git = "https://forgejo.ellis.link/continuwuation/jemallocator"
|
||||||
rev = "46e7821917b06636cdb5b203d312799970eaea92"
|
rev = "ac4d4861b335b199f812807996e8c9166961041a"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["use_std"]
|
features = ["use_std"]
|
||||||
|
|
||||||
@@ -519,6 +518,15 @@ features = ["resource"]
|
|||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
[workspace.dependencies.hardened_malloc-rs]
|
||||||
|
version = "0.1.2"
|
||||||
|
default-features = false
|
||||||
|
features = [
|
||||||
|
"static",
|
||||||
|
"gcc",
|
||||||
|
"light",
|
||||||
|
]
|
||||||
|
|
||||||
[workspace.dependencies.rustyline-async]
|
[workspace.dependencies.rustyline-async]
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
default-features = false
|
default-features = false
|
||||||
@@ -588,27 +596,16 @@ version = "0.10.4"
|
|||||||
default-features = false
|
default-features = false
|
||||||
features = ["std"]
|
features = ["std"]
|
||||||
|
|
||||||
[workspace.dependencies.mime]
|
|
||||||
version = "0.3.18"
|
|
||||||
|
|
||||||
[workspace.dependencies.nonzero_ext]
|
[workspace.dependencies.nonzero_ext]
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
||||||
[workspace.dependencies.resolvematrix]
|
[workspace.dependencies.resolvematrix]
|
||||||
version = "1.5.0"
|
version = "1.4.2"
|
||||||
features = ["unstable-msc4188"]
|
features = ["unstable-msc4188"]
|
||||||
|
|
||||||
[workspace.dependencies.serde_urlencoded]
|
[workspace.dependencies.serde_urlencoded]
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
|
|
||||||
[workspace.dependencies.mimalloc]
|
|
||||||
version = "0.1.52"
|
|
||||||
features = ["extended"]
|
|
||||||
|
|
||||||
[workspace.dependencies.libmimalloc-sys]
|
|
||||||
version = "0.1.49"
|
|
||||||
features = ["extended"]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Patches
|
# Patches
|
||||||
#
|
#
|
||||||
@@ -752,23 +749,74 @@ inherits = "release"
|
|||||||
# Developer profile
|
# Developer profile
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# To enable hot-reloading:
|
||||||
|
# 1. Uncomment all of the rustflags here.
|
||||||
|
# 2. Uncomment crate-type=dylib in src/*/Cargo.toml
|
||||||
|
#
|
||||||
|
# opt-level, mir-opt-level, validate-mir are not known to interfere with reloading
|
||||||
|
# and can be raised if build times are tolerable.
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = "full"
|
debug = "full"
|
||||||
opt-level = 0
|
opt-level = 0
|
||||||
panic = "unwind"
|
panic = "unwind"
|
||||||
debug-assertions = true
|
debug-assertions = true
|
||||||
incremental = true
|
incremental = true
|
||||||
|
#rustflags = [
|
||||||
|
# '--cfg', 'conduwuit_mods',
|
||||||
|
# '-Ztime-passes',
|
||||||
|
# '-Zmir-opt-level=0',
|
||||||
|
# '-Zvalidate-mir=false',
|
||||||
|
# '-Ztls-model=global-dynamic',
|
||||||
|
# '-Cprefer-dynamic=true',
|
||||||
|
# '-Zstaticlib-prefer-dynamic=true',
|
||||||
|
# '-Zstaticlib-allow-rdylib-deps=true',
|
||||||
|
# '-Zpacked-bundled-libs=false',
|
||||||
|
# '-Zplt=true',
|
||||||
|
# '-Crpath=true',
|
||||||
|
# '-Clink-arg=-Wl,--as-needed',
|
||||||
|
# '-Clink-arg=-Wl,--allow-shlib-undefined',
|
||||||
|
# '-Clink-arg=-Wl,-z,keep-text-section-prefix',
|
||||||
|
# '-Clink-arg=-Wl,-z,lazy',
|
||||||
|
#]
|
||||||
|
|
||||||
[profile.dev.package.conduwuit_core]
|
[profile.dev.package.conduwuit_core]
|
||||||
inherits = "dev"
|
inherits = "dev"
|
||||||
[profile.dev.package.conduwuit]
|
[profile.dev.package.conduwuit]
|
||||||
inherits = "dev"
|
inherits = "dev"
|
||||||
|
#rustflags = [
|
||||||
|
# '--cfg', 'conduwuit_mods',
|
||||||
|
# '-Ztime-passes',
|
||||||
|
# '-Zmir-opt-level=0',
|
||||||
|
# '-Zvalidate-mir=false',
|
||||||
|
# '-Ztls-model=global-dynamic',
|
||||||
|
# '-Cprefer-dynamic=true',
|
||||||
|
# '-Zexport-executable-symbols=true',
|
||||||
|
# '-Zplt=true',
|
||||||
|
# '-Crpath=true',
|
||||||
|
# '-Clink-arg=-Wl,--as-needed',
|
||||||
|
# '-Clink-arg=-Wl,--allow-shlib-undefined',
|
||||||
|
# '-Clink-arg=-Wl,--export-dynamic',
|
||||||
|
# '-Clink-arg=-Wl,-z,lazy',
|
||||||
|
#]
|
||||||
|
|
||||||
[profile.dev.package.'*']
|
[profile.dev.package.'*']
|
||||||
inherits = "dev"
|
inherits = "dev"
|
||||||
debug = 'limited'
|
debug = 'limited'
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
opt-level = 'z'
|
opt-level = 'z'
|
||||||
|
#rustflags = [
|
||||||
|
# '--cfg', 'conduwuit_mods',
|
||||||
|
# '-Ztls-model=global-dynamic',
|
||||||
|
# '-Cprefer-dynamic=true',
|
||||||
|
# '-Zstaticlib-prefer-dynamic=true',
|
||||||
|
# '-Zstaticlib-allow-rdylib-deps=true',
|
||||||
|
# '-Zpacked-bundled-libs=true',
|
||||||
|
# '-Zplt=true',
|
||||||
|
# '-Clink-arg=-Wl,--as-needed',
|
||||||
|
# '-Clink-arg=-Wl,-z,lazy',
|
||||||
|
# '-Clink-arg=-Wl,-z,nodelete',
|
||||||
|
#]
|
||||||
|
|
||||||
# primarily used for CI
|
# primarily used for CI
|
||||||
[profile.test]
|
[profile.test]
|
||||||
|
|||||||
+3
-8
@@ -23,15 +23,12 @@ to encourage users to stay up-to-date with the latest release, and we have no co
|
|||||||
We appreciate the efforts of security researchers and the community in identifying and reporting vulnerabilities. To
|
We appreciate the efforts of security researchers and the community in identifying and reporting vulnerabilities. To
|
||||||
ensure that potential vulnerabilities are addressed properly, please follow these guidelines:
|
ensure that potential vulnerabilities are addressed properly, please follow these guidelines:
|
||||||
|
|
||||||
1. **Contact _all_ members of the team** over E2EE private message on Matrix.
|
1. **Contact members of the team directly** over E2EE private message.
|
||||||
Add each contact to the same encrypted room. **Do not message maintainers individually**.
|
|
||||||
If you cannot reach us from matrix.org, please try [another server][sl] (e.g. continuwuity.rocks).
|
|
||||||
- [@jade:ellis.link](https://matrix.to/#/@jade:ellis.link)
|
- [@jade:ellis.link](https://matrix.to/#/@jade:ellis.link)
|
||||||
- [@nex:nexy7574.co.uk](https://matrix.to/#/@nex:nexy7574.co.uk)
|
- [@nex:nexy7574.co.uk](https://matrix.to/#/@nex:nexy7574.co.uk)
|
||||||
- [@ginger:gingershaped.computer](https://matrix.to/#/@ginger:gingershaped.computer)
|
- [@ginger:gingershaped.computer](https://matrix.to/#/@ginger:gingershaped.computer)
|
||||||
2. **Email the security team** at [security@continuwuity.org](mailto:security@continuwuity.org). This is not E2EE, so
|
2. **Email the security team** at [security@continuwuity.org](mailto:security@continuwuity.org). This is not E2EE, so
|
||||||
don't include sensitive details. Do not ask where to send sensitive details either; that
|
don't include sensitive details.
|
||||||
information is included in this security policy. We may not respond to emails that do this.
|
|
||||||
3. **Do not disclose the vulnerability publicly** until a fix has been pushed to the main branch.
|
3. **Do not disclose the vulnerability publicly** until a fix has been pushed to the main branch.
|
||||||
4. **Provide detailed information** about the vulnerability, including:
|
4. **Provide detailed information** about the vulnerability, including:
|
||||||
- A clear description of the issue
|
- A clear description of the issue
|
||||||
@@ -45,8 +42,6 @@ ensure that potential vulnerabilities are addressed properly, please follow thes
|
|||||||
If you have any doubts about a potential security vulnerability, contact us via private channels first! We'd prefer that
|
If you have any doubts about a potential security vulnerability, contact us via private channels first! We'd prefer that
|
||||||
you bother us, instead of having a vulnerability disclosed without a fix.
|
you bother us, instead of having a vulnerability disclosed without a fix.
|
||||||
|
|
||||||
[sl]: https://servers.joinmatrix.org
|
|
||||||
|
|
||||||
### Terms for credit
|
### Terms for credit
|
||||||
|
|
||||||
Before reporting a vulnerability, please remember that we are a small team maintaining a large codebase depended upon by
|
Before reporting a vulnerability, please remember that we are a small team maintaining a large codebase depended upon by
|
||||||
@@ -110,4 +105,4 @@ When security vulnerabilities are identified:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
This security policy was last updated on November 17th, 2026.
|
This security policy was last updated on May 25, 2025.
|
||||||
+3
-17
@@ -52,10 +52,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# The base docker image to use for complement tests
|
# The base docker image to use for complement tests
|
||||||
# On Linux, you can build the default with `docker build -t continuwuity:complement -f ./docker/complement.Dockerfile .`
|
# You can build the default with `docker build -t continuwuity:complement -f ./docker/complement.Dockerfile .`
|
||||||
# after running `cargo build -p conduwuit --features openreg`.
|
# after running `cargo build -p conduwuit --features openreg`. Only the debug binary is used.
|
||||||
# On non-Linux platforms (or to use a container build), build `docker/Dockerfile` with debuginfo and openreg `--build-arg RUST_PROFILE=dev --build-arg CARGO_FEATURES=default,openreg`
|
|
||||||
# and then run `docker build -t continuwuity:complement --target container -f ./docker/complement.Dockerfile .`.
|
|
||||||
COMPLEMENT_BASE_IMAGE="${COMPLEMENT_BASE_IMAGE:-continuwuity:complement}"
|
COMPLEMENT_BASE_IMAGE="${COMPLEMENT_BASE_IMAGE:-continuwuity:complement}"
|
||||||
|
|
||||||
# Complement tests that are skipped due to flakiness/reliability issues or we don't implement such features and won't for a long time
|
# Complement tests that are skipped due to flakiness/reliability issues or we don't implement such features and won't for a long time
|
||||||
@@ -85,13 +83,6 @@ for command in docker go jq; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${DOCKER_HOST:-}" ]; then
|
|
||||||
DOCKER_HOST="$(docker context inspect --format '{{.Endpoints.docker.Host}}' 2>/dev/null || true)"
|
|
||||||
if [ -n "$DOCKER_HOST" ]; then
|
|
||||||
export DOCKER_HOST
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$IMAGE_ARCHIVE" ]; then
|
if [ -n "$IMAGE_ARCHIVE" ]; then
|
||||||
if [ ! -f "$IMAGE_ARCHIVE" ]; then
|
if [ ! -f "$IMAGE_ARCHIVE" ]; then
|
||||||
echo "Docker image archive not found: $IMAGE_ARCHIVE"
|
echo "Docker image archive not found: $IMAGE_ARCHIVE"
|
||||||
@@ -108,12 +99,7 @@ fi
|
|||||||
|
|
||||||
if ! docker image inspect "$COMPLEMENT_BASE_IMAGE" > /dev/null 2>&1; then
|
if ! docker image inspect "$COMPLEMENT_BASE_IMAGE" > /dev/null 2>&1; then
|
||||||
echo "Complement base image not found: $COMPLEMENT_BASE_IMAGE"
|
echo "Complement base image not found: $COMPLEMENT_BASE_IMAGE"
|
||||||
if [ "$(uname -s)" != "Linux" ]; then
|
echo "Build it with: cargo build -p conduwuit --features openreg && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."
|
||||||
echo "Build it with: docker buildx build --load -t continuwuity:latest-openreg --build-arg RUST_PROFILE=dev --build-arg CARGO_FEATURES=default,openreg -f docker/Dockerfile . && docker build -t $COMPLEMENT_BASE_IMAGE --target container -f docker/complement.Dockerfile ."
|
|
||||||
else
|
|
||||||
echo "Build it with: cargo build -p conduwuit --features openreg && docker build -t $COMPLEMENT_BASE_IMAGE -f docker/complement.Dockerfile ."
|
|
||||||
echo "Or from a container build: docker buildx build --load -t continuwuity:latest-openreg --build-arg RUST_PROFILE=dev --build-arg CARGO_FEATURES=default,openreg -f docker/Dockerfile . && docker build -t $COMPLEMENT_BASE_IMAGE --target container -f docker/complement.Dockerfile ."
|
|
||||||
fi
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
Added support for the stable MatrixRTC transports discovery endpoint (`GET /_matrix/client/v1/rtc/transports`) from the accepted MSC4143, advertised via the `org.matrix.msc4143.stable` unstable feature. The unstable endpoint remains available. Contributed by @Henry-Hiles (QuadRadical).
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Legacy `/sync` now honours the `room.rooms`, `room.not_rooms`, `account_data.types` and `account_data.not_types` filter fields instead of returning every room and all account data. Contributed by @eleboucher.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Added the `GET /_matrix/client/v1/rooms/{roomId}/timestamp_to_event` endpoint as per MSC3030, letting clients find the event closest to a given timestamp. Contributed by @eleboucher.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fixed Prometheus accounting for in-flight requests, federation PDU lag, latency buckets, and thumbnail sizes. Contributed by @eleboucher.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Requests waiting on `/_matrix/client/v3/sync` can now be interrupted by the server shutdown, unblocking the 30-second shutdown delay imposed on a quiet server.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix remote server key signature verification when extra fields exist. Contributed by @hexchen
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Added support for MSC4388, allowing compatible Matrix clients to log in to Continuwuity by scanning a QR code on an already logged-in client. Contributed by @ginger.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
URL previews no longer completely fail if downloading auxiliary content (images/videos/audio) fails. Contributed by @nex.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
`/_matrix/client/v3/sync` no longer waits 30 seconds if the `timeout` parameter is omitted or set to zero, correctly reflecting the specification's rule that such requests should return immediately, even if they are empty.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fixed the experiments implementation in #2517 not properly disabling some functionality when associated experiments weren't enabled.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
The sticky events feature flag is correctly advertised in `/_matrix/client/versions` again after it was accidentally removed in #2517.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
The former configuration alias `allow_check_for_updates` is now explicitly deprecated in favor of `allow_announcements_check`. Additionally, `request_ip_source` is now deprecated in favor of `accepted_ip_sources`.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
A message is now sent to the admin room when a user logs in for the first time through an OIDC provider, if admin room notices are enabled. Contributed by @ginger.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Dropped support for `hardened_malloc` and add support for `mimalloc` instead. Contributed by @nex and @jade.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix soundness and correctness issues in the jemalloc interface, improving performance. Contributed by @Jade
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Modernised the room knocking helper functions to make them match the behaviour of our room join helpers, which are safer and more efficient. This also fixes a bug that caused an error when knocking on rooms not local to the server. Contributed by @nex.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Continuwuity will now request the `profile` OIDC scope from identity providers by default to improve compatibility with identity providers that require it to access users' profile claims, as recommended by the OIDC specification. Contributed by @ginger.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Attempting to start a UIAA session on a homeserver with UIAA disabled will now return `403 M_UNAUTHORIZED` instead of `404 M_UNSUPPORTED`. Contributed by @ginger.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Advertise support for Matrix v1.6. Contributed by @jade
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Moved the `jemalloc` feature out of `standard` (and `full`) into `default` so builders can more easily swap allocators. Builders using `--no-default-features` with the `full` or `standard` feature should now explicitly select an allocator (either `jemalloc` or `mimalloc`). Contributed by @Jade
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Fix outgoing federation stalling after a sender worker panics. Contributed by @eleboucher.
|
|
||||||
+9
-67
@@ -412,7 +412,7 @@
|
|||||||
# env: CONTINUWUITY_IP_LOOKUP_STRATEGY
|
# env: CONTINUWUITY_IP_LOOKUP_STRATEGY
|
||||||
#ip_lookup_strategy = 5
|
#ip_lookup_strategy = 5
|
||||||
|
|
||||||
# DEPRECATED: The preferred source to use for getting the real client IP.
|
# The preferred source to use for getting the real client IP.
|
||||||
#
|
#
|
||||||
# Takes any of the following options:
|
# Takes any of the following options:
|
||||||
#
|
#
|
||||||
@@ -431,10 +431,9 @@
|
|||||||
# to set this header" check; if the header selected is present, it is
|
# to set this header" check; if the header selected is present, it is
|
||||||
# used.
|
# used.
|
||||||
#
|
#
|
||||||
# Ignored if `accepted_ip_sources` is set. `accepted_ip_sources` is
|
# Ignored if `accepted_ip_sources` is set.
|
||||||
# the preferred alternative.
|
|
||||||
#
|
#
|
||||||
# If not set, `direct` is used. Additionally, `direct` is used
|
# If not set set, `direct` is used. Additionally, `direct` is used
|
||||||
# as a fallback if the chosen header is not found.
|
# as a fallback if the chosen header is not found.
|
||||||
#
|
#
|
||||||
# env: CONTINUWUITY_REQUEST_IP_SOURCE
|
# env: CONTINUWUITY_REQUEST_IP_SOURCE
|
||||||
@@ -813,32 +812,15 @@
|
|||||||
# env: CONTINUWUITY_FORGET_FORCED_UPON_LEAVE
|
# env: CONTINUWUITY_FORGET_FORCED_UPON_LEAVE
|
||||||
#forget_forced_upon_leave = false
|
#forget_forced_upon_leave = false
|
||||||
|
|
||||||
# Set this to true to require authentication when looking up user profiles
|
# Set this to true to require authentication on the normally
|
||||||
# through this server.
|
# unauthenticated profile retrieval endpoints (GET)
|
||||||
|
# "/_matrix/client/v3/profile/{userId}".
|
||||||
#
|
#
|
||||||
# By default this is false, allowing tools such as matrix.to to access
|
# This can prevent profile scraping.
|
||||||
# profiles of users on this server and on other servers.
|
|
||||||
# Setting this to true will block those tools, and may block automated
|
|
||||||
# crawlers from scraping users' profiles, although it will not block
|
|
||||||
# other homeservers from accessing users' profiles.
|
|
||||||
#
|
#
|
||||||
# env: CONTINUWUITY_REQUIRE_AUTH_FOR_PROFILE_REQUESTS
|
# env: CONTINUWUITY_REQUIRE_AUTH_FOR_PROFILE_REQUESTS
|
||||||
#require_auth_for_profile_requests = false
|
#require_auth_for_profile_requests = false
|
||||||
|
|
||||||
# Set this to true to require authentication to create a rendezvous
|
|
||||||
# session. Rendezvous sessions are used for QR code login.
|
|
||||||
#
|
|
||||||
# For QR code login, the device that shows the QR code is the one that
|
|
||||||
# creates the rendezvous session. Therefore, this must be false to let
|
|
||||||
# a logged-out device show a QR code.
|
|
||||||
#
|
|
||||||
# By default this is false to allow logged-out desktop devices (which may
|
|
||||||
# not have a camera) to show a QR code. Setting this to true will
|
|
||||||
# require logged-out devices to scan the QR code instead.
|
|
||||||
#
|
|
||||||
# env: CONTINUWUITY_REQUIRE_AUTH_FOR_RENDEZVOUS
|
|
||||||
#require_auth_for_rendezvous = false
|
|
||||||
|
|
||||||
# Set this to true to allow your server's public room directory to be
|
# Set this to true to allow your server's public room directory to be
|
||||||
# federated. Set this to false to protect against /publicRooms spiders,
|
# federated. Set this to false to protect against /publicRooms spiders,
|
||||||
# but will forbid external users from viewing your server's public room
|
# but will forbid external users from viewing your server's public room
|
||||||
@@ -2582,12 +2564,10 @@
|
|||||||
|
|
||||||
# Additional scopes Continuwuity should request from the IDP. This may be
|
# Additional scopes Continuwuity should request from the IDP. This may be
|
||||||
# necessary to access certain claims. Continuwuity always requests the
|
# necessary to access certain claims. Continuwuity always requests the
|
||||||
# `openid` scope, regardless of the contents of this option,
|
# `openid` scope.
|
||||||
# and will also request the `profile` scope by default if this option is
|
|
||||||
# not set.
|
|
||||||
#
|
#
|
||||||
# env: CONTINUWUITY_OAUTH__OIDC__ADDITIONAL_SCOPES
|
# env: CONTINUWUITY_OAUTH__OIDC__ADDITIONAL_SCOPES
|
||||||
#additional_scopes = ["profile"]
|
#additional_scopes = []
|
||||||
|
|
||||||
# Additional trusted audiences that Continuwuity will accept in the `aud`
|
# Additional trusted audiences that Continuwuity will accept in the `aud`
|
||||||
# claim of the OIDC token returned by the IDP. If your identity
|
# claim of the OIDC token returned by the IDP. If your identity
|
||||||
@@ -2689,26 +2669,6 @@
|
|||||||
# and consequently know why you should enable them.
|
# and consequently know why you should enable them.
|
||||||
|
|
||||||
|
|
||||||
# MSC3814: Dehydrated devices with SSSS
|
|
||||||
#
|
|
||||||
# Enables server-side support for "dehydrated devices", which are
|
|
||||||
# server-side devices (created by supporting clients) that can collect
|
|
||||||
# encryption keys when there are no online devices, which supporting
|
|
||||||
# clients can then "hydrate" to download any encryption keys that were
|
|
||||||
# sent while they were offline.
|
|
||||||
#
|
|
||||||
# Important: this is NOT required to receive encrypted messages while you
|
|
||||||
# are offline. Devices can still receive encrypted messages while they are
|
|
||||||
# offline, but to share those keys with new devices, they have to be
|
|
||||||
# online. Dehydrated devices work around this by providing a "shared"
|
|
||||||
# device new sessions can bootstrap from, to receive keys from before they
|
|
||||||
# logged in that haven't been uploaded to the server-side key backup yet.
|
|
||||||
#
|
|
||||||
# https://github.com/matrix-org/matrix-spec-proposals/pull/3814
|
|
||||||
#
|
|
||||||
# env: CONTINUWUITY_EXPERIMENTS__MSC3814
|
|
||||||
#msc3814 = false
|
|
||||||
|
|
||||||
# MSC4155: Invite filtering
|
# MSC4155: Invite filtering
|
||||||
#
|
#
|
||||||
# Provides advanced invite filtering rules for users, allowing complex
|
# Provides advanced invite filtering rules for users, allowing complex
|
||||||
@@ -2733,24 +2693,6 @@
|
|||||||
# env: CONTINUWUITY_EXPERIMENTS__MSC4174
|
# env: CONTINUWUITY_EXPERIMENTS__MSC4174
|
||||||
#msc4174 = false
|
#msc4174 = false
|
||||||
|
|
||||||
# MSC4406: `M_SENDER_IGNORED` error code
|
|
||||||
#
|
|
||||||
# Introduces a new error code that explicitly informs clients the reason
|
|
||||||
# they cannot access an event if it is sent by an ignored user. Without
|
|
||||||
# this proposal, clients will simply get a "not found" or "forbidden"
|
|
||||||
# error when requesting events sent by users that have been ignored, which
|
|
||||||
# leads to replies being shown as "this message could not be found".
|
|
||||||
# The new error code allows clients to distinguish unknown/forbidden
|
|
||||||
# events from ignored senders, allowing them to display an error message
|
|
||||||
# like "you have blocked this sender" instead.
|
|
||||||
#
|
|
||||||
# Requires a supporting client to be useful.
|
|
||||||
#
|
|
||||||
# https://github.com/matrix-org/matrix-spec-proposals/pull/4406
|
|
||||||
#
|
|
||||||
# env: CONTINUWUITY_EXPERIMENTS__MSC4406
|
|
||||||
#msc4406 = false
|
|
||||||
|
|
||||||
# MSC4484: Server Administration OAuth Scope
|
# MSC4484: Server Administration OAuth Scope
|
||||||
#
|
#
|
||||||
# Adds a new OAuth2 scope that explicitly grants a token temporary
|
# Adds a new OAuth2 scope that explicitly grants a token temporary
|
||||||
|
|||||||
+5
-5
@@ -50,7 +50,7 @@ EOF
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.28.0
|
ENV BINSTALL_VERSION=1.27.0
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
@@ -167,8 +167,8 @@ ARG RUST_PROFILE=release
|
|||||||
ARG CARGO_FEATURES="default"
|
ARG CARGO_FEATURES="default"
|
||||||
|
|
||||||
# Build the binary
|
# Build the binary
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git/db,sharing=locked \
|
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||||
--mount=type=cache,target=/app/target,id=continuwuity-cargo-target-${TARGET_CPU}-${TARGETPLATFORM}-${RUST_PROFILE} \
|
--mount=type=cache,target=/app/target,id=continuwuity-cargo-target-${TARGET_CPU}-${TARGETPLATFORM}-${RUST_PROFILE} \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -205,8 +205,8 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Generate Software Bill of Materials (SBOM)
|
# Generate Software Bill of Materials (SBOM)
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git/db,sharing=locked \
|
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|||||||
@@ -1,29 +1,11 @@
|
|||||||
ARG CONTINUWUITY_IMAGE=continuwuity:latest-openreg
|
FROM ubuntu:latest
|
||||||
ARG BINARY_SOURCE=host
|
|
||||||
|
|
||||||
FROM ${CONTINUWUITY_IMAGE} AS container-binary
|
|
||||||
|
|
||||||
FROM scratch AS host-binary
|
|
||||||
ARG BINARY_PATH=target/debug/conduwuit
|
|
||||||
COPY ${BINARY_PATH} /sbin/conduwuit
|
|
||||||
|
|
||||||
FROM ubuntu:latest AS base
|
|
||||||
EXPOSE 8008
|
EXPOSE 8008
|
||||||
EXPOSE 8448
|
EXPOSE 8448
|
||||||
RUN apt-get update && apt-get install -y ca-certificates liburing2 && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y ca-certificates liburing2 && rm -rf /var/lib/apt/lists/*
|
||||||
RUN mkdir -p /etc/continuwuity /var/lib/continuwuity /usr/local/bin/
|
RUN mkdir -p /etc/continuwuity /var/lib/continuwuity /usr/local/bin/
|
||||||
COPY complement/complement-entrypoint.sh /usr/local/bin/complement-entrypoint.sh
|
COPY complement/complement-entrypoint.sh /usr/local/bin/complement-entrypoint.sh
|
||||||
COPY complement/complement.config.toml /etc/continuwuity/config.toml
|
COPY complement/complement.config.toml /etc/continuwuity/config.toml
|
||||||
RUN chmod +x /usr/local/bin/complement-entrypoint.sh
|
COPY target/debug/conduwuit /usr/local/bin/conduwuit
|
||||||
|
RUN chmod +x /usr/local/bin/conduwuit /usr/local/bin/complement-entrypoint.sh
|
||||||
#HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://localhost:8008/_continuwuity/server_version || exit 1
|
#HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://localhost:8008/_continuwuity/server_version || exit 1
|
||||||
ENTRYPOINT ["/usr/local/bin/complement-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/complement-entrypoint.sh"]
|
||||||
|
|
||||||
FROM base AS container
|
|
||||||
COPY --from=container-binary /sbin/conduwuit /usr/local/bin/conduwuit
|
|
||||||
RUN chmod +x /usr/local/bin/conduwuit
|
|
||||||
|
|
||||||
FROM base AS host
|
|
||||||
COPY --from=host-binary /sbin/conduwuit /usr/local/bin/conduwuit
|
|
||||||
RUN chmod +x /usr/local/bin/conduwuit
|
|
||||||
|
|
||||||
FROM ${BINARY_SOURCE}
|
|
||||||
@@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/etc/apk/cache apk add \
|
|||||||
|
|
||||||
# Developer tool versions
|
# Developer tool versions
|
||||||
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
# renovate: datasource=github-releases depName=cargo-bins/cargo-binstall
|
||||||
ENV BINSTALL_VERSION=1.28.0
|
ENV BINSTALL_VERSION=1.27.0
|
||||||
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
# renovate: datasource=github-releases depName=psastras/sbom-rs
|
||||||
ENV CARGO_SBOM_VERSION=0.9.1
|
ENV CARGO_SBOM_VERSION=0.9.1
|
||||||
# renovate: datasource=crate depName=lddtree
|
# renovate: datasource=crate depName=lddtree
|
||||||
@@ -120,8 +120,8 @@ ENV CONTINUWUITY_VERSION_EXTRA=$CONTINUWUITY_VERSION_EXTRA
|
|||||||
ARG RUST_PROFILE=release
|
ARG RUST_PROFILE=release
|
||||||
|
|
||||||
# Build the binary
|
# Build the binary
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git/db,sharing=locked \
|
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||||
--mount=type=cache,target=/app/target,id=continuwuity-cargo-target-${TARGET_CPU}-${TARGETPLATFORM}-musl-${RUST_PROFILE} \
|
--mount=type=cache,target=/app/target,id=continuwuity-cargo-target-${TARGET_CPU}-${TARGETPLATFORM}-musl-${RUST_PROFILE} \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
set -o allexport
|
set -o allexport
|
||||||
@@ -143,8 +143,8 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Generate Software Bill of Materials (SBOM)
|
# Generate Software Bill of Materials (SBOM)
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git/db,sharing=locked \
|
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
mkdir /out/sbom
|
mkdir /out/sbom
|
||||||
|
|||||||
@@ -18,5 +18,10 @@
|
|||||||
"type": "file",
|
"type": "file",
|
||||||
"name": "testing",
|
"name": "testing",
|
||||||
"label": "Testing"
|
"label": "Testing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"name": "hot_reload",
|
||||||
|
"label": "Hot Reloading"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
# Hot Reloading ("Live" Development)
|
||||||
|
|
||||||
|
Note that hot reloading has not been refactored in quite a while and is not
|
||||||
|
guaranteed to work at this time.
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
|
||||||
|
When developing in debug-builds with the nightly toolchain, Continuwuity is modular
|
||||||
|
using dynamic libraries and various parts of the application are hot-reloadable
|
||||||
|
while the server is running: http api handlers, admin commands, services,
|
||||||
|
database, etc. These are all split up into individual workspace crates as seen
|
||||||
|
in the `src/` directory. Changes to sourcecode in a crate rebuild that crate and
|
||||||
|
subsequent crates depending on it. Reloading then occurs for the changed crates.
|
||||||
|
|
||||||
|
Release builds still produce static binaries which are unaffected. Rust's
|
||||||
|
soundness guarantees are in full force. Thus you cannot hot-reload release
|
||||||
|
binaries.
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
Currently, this development setup only works on x86_64 and aarch64 Linux glibc.
|
||||||
|
[musl explicitly does not support hot reloadable libraries, and does not
|
||||||
|
implement `dlclose`][2]. macOS does not fully support our usage of `RTLD_GLOBAL`
|
||||||
|
possibly due to some thread-local issues. [This Rust issue][3] may be of
|
||||||
|
relevance, specifically [this comment][4]. It may be possible to get it working
|
||||||
|
on only very modern macOS versions such as at least Sonoma, as currently loading
|
||||||
|
dylibs is supported, but not unloading them in our setup, and the cited comment
|
||||||
|
mentions an Apple WWDC confirming there have been TLS changes to somewhat make
|
||||||
|
this possible.
|
||||||
|
|
||||||
|
As mentioned above this requires the nightly toolchain. This is due to reliance
|
||||||
|
on various Cargo.toml features that are only available on nightly, most
|
||||||
|
specifically `RUSTFLAGS` in Cargo.toml. Some of the implementation could also be
|
||||||
|
simpler based on other various nightly features. We hope lots of nightly
|
||||||
|
features start making it out of nightly sooner as there have been dozens of very
|
||||||
|
helpful features that have been stuck in nightly ("unstable") for at least 5+
|
||||||
|
years that would make this simpler. We encourage greater community consensus to
|
||||||
|
move these features into stability.
|
||||||
|
|
||||||
|
This currently only works on x86_64/aarch64 Linux with a glibc C library. musl C
|
||||||
|
library, macOS, and likely other host architectures are not supported (if other
|
||||||
|
architectures work, feel free to let us know and/or make a PR updating this).
|
||||||
|
This should work on GNU ld and lld (rust-lld) and gcc/clang, however if you
|
||||||
|
happen to have linker issues it's recommended to try using `mold` or `gold`
|
||||||
|
linkers, and please let us know in the [Continuwuity Matrix room][7] the linker
|
||||||
|
error and what linker solved this issue so we can figure out a solution. Ideally
|
||||||
|
there should be minimal friction to using this, and in the future a build script
|
||||||
|
(`build.rs`) may be suitable to making this easier to use if the capabilities
|
||||||
|
allow us.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
As of 19 May 2024, the instructions for using this are:
|
||||||
|
|
||||||
|
0. Have patience. Don't hesitate to join the [Continuwuity Matrix room][7] to
|
||||||
|
receive help using this. As indicated by the various rustflags used and some
|
||||||
|
of the interesting issues linked at the bottom, this is definitely not something
|
||||||
|
the Rust ecosystem or toolchain is used to doing.
|
||||||
|
|
||||||
|
1. Install the nightly toolchain using rustup. You may need to use `rustup
|
||||||
|
override set nightly` in your local Continuwuity directory, or use `cargo
|
||||||
|
+nightly` for all actions.
|
||||||
|
|
||||||
|
2. Uncomment `cargo-features` at the top level / root Cargo.toml
|
||||||
|
|
||||||
|
3. Scroll down to the `# Developer profile` section and uncomment ALL the
|
||||||
|
rustflags for each dev profile and their respective packages.
|
||||||
|
|
||||||
|
4. In each workspace crate's Cargo.toml (everything under `src/*` AND
|
||||||
|
`deps/rust-rocksdb/Cargo.toml`), uncomment the `dylib` crate type under
|
||||||
|
`[lib]`.
|
||||||
|
|
||||||
|
5. Due to [this rpath issue][5], you must export the `LD_LIBRARY_PATH`
|
||||||
|
environment variable to your nightly Rust toolchain library directory. If
|
||||||
|
using rustup (hopefully), use this: `export
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/`
|
||||||
|
|
||||||
|
6. Start the server. You can use `cargo +nightly run` for this along with the
|
||||||
|
standard.
|
||||||
|
|
||||||
|
7. Make some changes where you need to.
|
||||||
|
|
||||||
|
8. In a separate terminal window in the same directory (or using a terminal
|
||||||
|
multiplexer like tmux), run the *build* Cargo command `cargo +nightly build`.
|
||||||
|
Cargo should only rebuild what was changed / what's necessary, so it should
|
||||||
|
not be rebuilding all the crates.
|
||||||
|
|
||||||
|
9. In your Continuwuity server terminal, hit/send `CTRL+C` signal. This will tell
|
||||||
|
Continuwuity to find which libraries need to be reloaded, and reloads them as
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
10. If there were no errors, it will tell you it successfully reloaded `#`
|
||||||
|
modules, and your changes should now be visible. Repeat 7 - 9 as needed.
|
||||||
|
|
||||||
|
To shutdown Continuwuity in this setup, hit/send `CTRL+\`. Normal builds still
|
||||||
|
shutdown with `CTRL+C` as usual.
|
||||||
|
|
||||||
|
Steps 1 - 5 are the initial first-time steps for using this. To remove the hot
|
||||||
|
reload setup, revert/comment all the Cargo.toml changes.
|
||||||
|
|
||||||
|
As mentioned in the requirements section, if you happen to have some linker
|
||||||
|
issues, try using the `-fuse-ld=` rustflag and specify mold or gold in all the
|
||||||
|
`rustflags` definitions in the top level Cargo.toml, and please let us know in
|
||||||
|
the [Continuwuity Matrix room][7] the problem. mold can be installed typically
|
||||||
|
through your distro, and gold is provided by the binutils package.
|
||||||
|
|
||||||
|
It's possible a helper script can be made to do all of this, or most preferably
|
||||||
|
a specially made build script (build.rs). `cargo watch` support will be
|
||||||
|
implemented soon which will eliminate the need to manually run `cargo build` all
|
||||||
|
together.
|
||||||
|
|
||||||
|
### Addendum
|
||||||
|
|
||||||
|
Conduit was inherited as a single crate without modularity or reloading in its
|
||||||
|
design. Reasonable partitioning and abstraction allowed a split into several
|
||||||
|
crates, though many circular dependencies had to be corrected. The resulting
|
||||||
|
crates now form a directed graph as depicted in figures below. The interfacing
|
||||||
|
between these crates is still extremely broad which is not mitigable.
|
||||||
|
|
||||||
|
Initially [hot_lib_reload][6] was investigated but found appropriate for a
|
||||||
|
project designed with modularity through limited interfaces, not a large and
|
||||||
|
complex existing codebase. Instead a bespoke solution built directly on
|
||||||
|
[libloading][8] satisfied our constraints. This required relatively minimal
|
||||||
|
modifications and zero maintenance burden compared to what would be required
|
||||||
|
otherwise. The technical difference lies with relocation processing: we leverage
|
||||||
|
global bindings (`RTLD_GLOBAL`) in a very intentional way. Most libraries and
|
||||||
|
off-the-shelf module systems (such as [hot_lib_reload][6]) restrict themselves
|
||||||
|
to local bindings (`RTLD_LOCAL`). This allows them to release software to
|
||||||
|
multiple platforms with much greater consistency, but at the cost of burdening
|
||||||
|
applications to explicitly manage these bindings. In our case with an optional
|
||||||
|
feature for developers, we shrug any such requirement to enjoy the cost/benefit
|
||||||
|
on platforms where global relocations are properly cooperative.
|
||||||
|
|
||||||
|
To make use of `RTLD_GLOBAL` the application has to be oriented as a directed
|
||||||
|
acyclic graph. The primary rule is simple and illustrated in the figure below:
|
||||||
|
**no crate is allowed to call a function or use a variable from a crate below
|
||||||
|
it.**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
When a symbol is referenced between crates they become bound: **crates cannot be
|
||||||
|
unloaded until their calling crates are first unloaded.** Thus we start the
|
||||||
|
reloading process from the crate which has no callers. There is a small problem
|
||||||
|
though: the first crate is called by the base executable itself! This is solved
|
||||||
|
by using an `RTLD_LOCAL` binding for just one link between the main executable
|
||||||
|
and the first crate, freeing the executable from all modules as no global
|
||||||
|
binding ever occurs between them.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Proper resource management is essential for reliable reloading to occur. This is
|
||||||
|
a very basic ask in RAII-idiomatic Rust and the exposure to reloading hazards is
|
||||||
|
remarkably low, generally stemming from poor patterns and practices.
|
||||||
|
Unfortunately static analysis doesn't enforce reload-safety programmatically
|
||||||
|
(though it could one day), for now hazards can be avoided by knowing a few basic
|
||||||
|
do's and dont's:
|
||||||
|
|
||||||
|
1. Understand that code is memory. Just like one is forbidden from referencing
|
||||||
|
free'd memory, one must not transfer control to free'd code. Exposure to this
|
||||||
|
is primarily from two things:
|
||||||
|
|
||||||
|
- Callbacks, which this project makes very little use of.
|
||||||
|
- Async tasks, which are addressed below.
|
||||||
|
|
||||||
|
2. Tie all resources to a scope or object lifetime with greatest possible
|
||||||
|
symmetry (locality). For our purposes this applies to code resources, which
|
||||||
|
means async blocks and tokio tasks.
|
||||||
|
|
||||||
|
- **Never spawn a task without receiving and storing its JoinHandle**.
|
||||||
|
- **Always wait on join handles** before leaving a scope or in another cleanup
|
||||||
|
function called by an owning scope.
|
||||||
|
|
||||||
|
3. Know any minor specific quirks documented in code or here:
|
||||||
|
|
||||||
|
- Don't use `tokio::spawn`, instead use our `Handle` in `core/server.rs`, which
|
||||||
|
is reachable in most of the codebase via `services()` or other state. This is
|
||||||
|
due to some bugs or assumptions made in tokio, as it happens in `unsafe {}`
|
||||||
|
blocks, which are mitigated by circumventing some thread-local variables. Using
|
||||||
|
runtime handles is good practice in any case.
|
||||||
|
|
||||||
|
The initial implementation PR is available [here][1].
|
||||||
|
|
||||||
|
### Interesting related issues/bugs
|
||||||
|
|
||||||
|
- [DT_RUNPATH produced in binary with rpath = true is wrong (cargo)][5]
|
||||||
|
- [Disabling MIR Optimization in Rust Compilation
|
||||||
|
(cargo)](https://internals.rust-lang.org/t/disabling-mir-optimization-in-rust-compilation/19066/5)
|
||||||
|
- [Workspace-level metadata
|
||||||
|
(cargo-deb)](https://github.com/kornelski/cargo-deb/issues/68)
|
||||||
|
|
||||||
|
[1]: https://forgejo.ellis.link/continuwuation/continuwuity/pulls/387
|
||||||
|
[2]: https://wiki.musl-libc.org/functional-differences-from-glibc.html#Unloading-libraries
|
||||||
|
[3]: https://github.com/rust-lang/rust/issues/28794
|
||||||
|
[4]: https://github.com/rust-lang/rust/issues/28794#issuecomment-368693049
|
||||||
|
[5]: https://github.com/rust-lang/cargo/issues/12746
|
||||||
|
[6]: https://crates.io/crates/hot-lib-reloader/
|
||||||
|
[7]: https://matrix.to/#/#continuwuity:continuwuity.org?via=continuwuity.org&via=ellis.link&via=explodie.org&via=matrix.org
|
||||||
|
[8]: https://crates.io/crates/libloading
|
||||||
@@ -37,6 +37,13 @@ It is highly unlikely you will ever need to add a new workspace member, but if
|
|||||||
you truly find yourself needing to, we recommend reaching out to us in the
|
you truly find yourself needing to, we recommend reaching out to us in the
|
||||||
Matrix room for discussions about it beforehand.
|
Matrix room for discussions about it beforehand.
|
||||||
|
|
||||||
|
The primary inspiration for this design was apart of hot reloadable development,
|
||||||
|
to support "Continuwuity as a library" where specific parts can simply be
|
||||||
|
swapped out. There is evidence Conduit wanted to go this route too as `axum` is
|
||||||
|
technically an optional feature in Conduit, and can be compiled without the
|
||||||
|
binary or axum library for handling inbound web requests; but it was never
|
||||||
|
completed or worked.
|
||||||
|
|
||||||
See the Rust documentation on [Workspaces][workspaces] for general questions and
|
See the Rust documentation on [Workspaces][workspaces] for general questions and
|
||||||
information on Cargo workspaces.
|
information on Cargo workspaces.
|
||||||
|
|
||||||
@@ -77,9 +84,8 @@ All forked dependencies are maintained under the
|
|||||||
- [rocksdb][continuwuation-rocksdb] - Fork of [facebook/rocksdb][rocksdb] via
|
- [rocksdb][continuwuation-rocksdb] - Fork of [facebook/rocksdb][rocksdb] via
|
||||||
[`@zaidoon1`][8] with liburing build fixes and GCC debug build fixes
|
[`@zaidoon1`][8] with liburing build fixes and GCC debug build fixes
|
||||||
- [jemallocator][continuwuation-jemallocator] - Fork of
|
- [jemallocator][continuwuation-jemallocator] - Fork of
|
||||||
[tikv/jemallocator][jemallocator] fixing musl builds and using jemalloc's
|
[tikv/jemallocator][jemallocator] fixing musl builds, suspicious code, and
|
||||||
`*x` APIs consistently in `GlobalAlloc` to avoid interposer/Valgrind
|
adding support for redzones in Valgrind
|
||||||
mismatches
|
|
||||||
- [rustyline-async][continuwuation-rustyline-async] - Fork of
|
- [rustyline-async][continuwuation-rustyline-async] - Fork of
|
||||||
[zyansheep/rustyline-async][rustyline-async] with tab completion callback and
|
[zyansheep/rustyline-async][rustyline-async] with tab completion callback and
|
||||||
`CTRL+\` signal quit event for Continuwuity console CLI
|
`CTRL+\` signal quit event for Continuwuity console CLI
|
||||||
|
|||||||
@@ -20,20 +20,6 @@ docker build -t continuwuity:complement -f docker/complement.Dockerfile .
|
|||||||
The `openreg` feature is required: without it the server refuses the open
|
The `openreg` feature is required: without it the server refuses the open
|
||||||
registrations Complement uses to create test users, and almost every test fails.
|
registrations Complement uses to create test users, and almost every test fails.
|
||||||
|
|
||||||
On non-Linux (or to build inside a container instead of on the host), build the Continuwuity image with the `openreg` feature and `RUST_PROFILE=dev` first (open
|
|
||||||
registration is only enabled when `debug_assertions` are active), then build
|
|
||||||
the Complement image using the `container` target:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker buildx build --load -t continuwuity:latest-openreg --build-arg RUST_PROFILE=dev --build-arg CARGO_FEATURES=default,openreg -f docker/Dockerfile .
|
|
||||||
docker build -t continuwuity:complement --target container -f docker/complement.Dockerfile .
|
|
||||||
./bin/complement
|
|
||||||
```
|
|
||||||
|
|
||||||
Pass `--build-arg CONTINUWUITY_IMAGE=your-image:tag` when building
|
|
||||||
`docker/complement.Dockerfile` if your Continuwuity container image uses a
|
|
||||||
different tag.
|
|
||||||
|
|
||||||
The run can take up to an hour. The runner writes the full Go test stream to
|
The run can take up to an hour. The runner writes the full Go test stream to
|
||||||
`tests/test_results/complement/test_logs.jsonl` and a sorted pass/fail/skip
|
`tests/test_results/complement/test_logs.jsonl` and a sorted pass/fail/skip
|
||||||
summary to `tests/test_results/complement/test_results.jsonl`. It exits nonzero
|
summary to `tests/test_results/complement/test_results.jsonl`. It exits nonzero
|
||||||
|
|||||||
@@ -71,9 +71,6 @@ Names below are as they appear in Prometheus. OTLP uses the dotted OpenTelemetry
|
|||||||
| `continuwuity_sender_events_total` | counter | `destination`, `kind`, `outcome` | PDUs and EDUs sent in outgoing transactions |
|
| `continuwuity_sender_events_total` | counter | `destination`, `kind`, `outcome` | PDUs and EDUs sent in outgoing transactions |
|
||||||
| `continuwuity_sender_events_queued_total` | counter | `destination`, `kind` | PDUs and EDUs queued for sending |
|
| `continuwuity_sender_events_queued_total` | counter | `destination`, `kind` | PDUs and EDUs queued for sending |
|
||||||
| `continuwuity_sender_queue_depth` | gauge | | Messages waiting for the sender workers |
|
| `continuwuity_sender_queue_depth` | gauge | | Messages waiting for the sender workers |
|
||||||
| `continuwuity_sender_requests` | gauge | `state` | Estimated outgoing requests stored as `queued` or `active` (in flight) |
|
|
||||||
| `continuwuity_sender_workers` | gauge | | Running sender workers; below the configured count means a worker is restarting |
|
|
||||||
| `continuwuity_sender_panics_total` | counter | `scope` | Panics caught in a single outgoing `transaction` or a whole sender `worker` |
|
|
||||||
| `continuwuity_users` | gauge | `origin` | Known `local` users, including deactivated, and `remote` users |
|
| `continuwuity_users` | gauge | `origin` | Known `local` users, including deactivated, and `remote` users |
|
||||||
| `continuwuity_invites_total` | counter | `direction`, `destination`, `outcome` | Invites sent by local users or received over federation |
|
| `continuwuity_invites_total` | counter | `direction`, `destination`, `outcome` | Invites sent by local users or received over federation |
|
||||||
| `continuwuity_media_write_size_bytes` | histogram | `origin` | Media files written, from local uploads or cached remote media |
|
| `continuwuity_media_write_size_bytes` | histogram | `origin` | Media files written, from local uploads or cached remote media |
|
||||||
@@ -85,7 +82,6 @@ Names below are as they appear in Prometheus. OTLP uses the dotted OpenTelemetry
|
|||||||
| `continuwuity_database_block_cache_bytes` | gauge | `column` | RocksDB block cache usage |
|
| `continuwuity_database_block_cache_bytes` | gauge | `column` | RocksDB block cache usage |
|
||||||
| `continuwuity_cache_entries` | gauge | `name` | Entries in the auth chain and state info caches |
|
| `continuwuity_cache_entries` | gauge | `name` | Entries in the auth chain and state info caches |
|
||||||
| `continuwuity_jemalloc_memory_bytes` | gauge | `kind` | jemalloc statistics, only with the `jemalloc_stats` feature |
|
| `continuwuity_jemalloc_memory_bytes` | gauge | `kind` | jemalloc statistics, only with the `jemalloc_stats` feature |
|
||||||
| `continuwuity_mimalloc_memory_bytes` | gauge | `kind` | mimalloc statistics, only with the `mimalloc` feature |
|
|
||||||
| `process_uptime_seconds` | gauge | | Time since the server started |
|
| `process_uptime_seconds` | gauge | | Time since the server started |
|
||||||
| `process_cpu_time_seconds_total` | counter | `cpu_mode` | CPU time used by the process |
|
| `process_cpu_time_seconds_total` | counter | `cpu_mode` | CPU time used by the process |
|
||||||
| `process_memory_usage_bytes` | gauge | | Resident memory (Linux) |
|
| `process_memory_usage_bytes` | gauge | | Resident memory (Linux) |
|
||||||
|
|||||||
@@ -90,13 +90,6 @@ Our source code and mirrors can be accessed through these buttons:
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Our documentation is proudly hosted on Grebedoc.
|
|
||||||
<div className="no-zoom" align="center">
|
|
||||||
<a href="https://grebedoc.dev">
|
|
||||||
<img src="https://grebedoc.dev/88x31-homu.gif" alt="served by Grebedoc" style={{imageRendering:"pixelated"}}/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
[forge-badge]: https://img.shields.io/badge/Ellis%20Git-main+packages-green?style=flat&logo=forgejo&labelColor=fff
|
[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-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-badge]: https://forgejo.ellis.link/continuwuation/continuwuity/badges/release.svg?style=flat&label=Latest%20release&labelColor=fff&color=green
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/.well-known/matrix/*
|
/.well-known/matrix/*
|
||||||
|
Access-Control-Allow-Origin: *
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
/.well-known/continuwuity/*
|
/.well-known/continuwuity/*
|
||||||
|
Access-Control-Allow-Origin: *
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
"uid": "${datasource}"
|
"uid": "${datasource}"
|
||||||
},
|
},
|
||||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\",http_route!~\".*/sync\"}[$__rate_interval])))",
|
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
|
||||||
"legendFormat": "",
|
"legendFormat": "",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"range": true
|
"range": true
|
||||||
@@ -496,7 +496,7 @@
|
|||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
"uid": "${datasource}"
|
"uid": "${datasource}"
|
||||||
},
|
},
|
||||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\",http_route!~\".*/sync\"}[$__rate_interval])))",
|
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
|
||||||
"legendFormat": "p50",
|
"legendFormat": "p50",
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"range": true
|
"range": true
|
||||||
@@ -506,7 +506,7 @@
|
|||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
"uid": "${datasource}"
|
"uid": "${datasource}"
|
||||||
},
|
},
|
||||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\",http_route!~\".*/sync\"}[$__rate_interval])))",
|
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
|
||||||
"legendFormat": "p95",
|
"legendFormat": "p95",
|
||||||
"refId": "B",
|
"refId": "B",
|
||||||
"range": true
|
"range": true
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
"uid": "${datasource}"
|
"uid": "${datasource}"
|
||||||
},
|
},
|
||||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\",http_route!~\".*/sync\"}[$__rate_interval])))",
|
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{instance=~\"$instance\"}[$__rate_interval])))",
|
||||||
"legendFormat": "p99",
|
"legendFormat": "p99",
|
||||||
"refId": "C",
|
"refId": "C",
|
||||||
"range": true
|
"range": true
|
||||||
@@ -1228,7 +1228,7 @@
|
|||||||
{
|
{
|
||||||
"type": "timeseries",
|
"type": "timeseries",
|
||||||
"title": "PDU lag",
|
"title": "PDU lag",
|
||||||
"description": "Time between an accepted PDU's origin_server_ts and its transaction arriving; affected by clock skew",
|
"description": "Time between an accepted PDU's origin_server_ts and its arrival; affected by clock skew",
|
||||||
"id": 21,
|
"id": 21,
|
||||||
"datasource": {
|
"datasource": {
|
||||||
"type": "prometheus",
|
"type": "prometheus",
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ List database backups
|
|||||||
|
|
||||||
Send a message to the admin room
|
Send a message to the admin room
|
||||||
|
|
||||||
|
## `!admin server reload`
|
||||||
|
|
||||||
|
Hot-reload the server
|
||||||
|
|
||||||
## `!admin server restart`
|
## `!admin server restart`
|
||||||
|
|
||||||
Restart the server
|
Restart the server
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
module forgejo.ellis.link/continuwuation/continuwuity
|
|
||||||
|
|
||||||
go 1.27
|
|
||||||
|
|
||||||
toolchain go1.27.4
|
|
||||||
|
|
||||||
tool codeberg.org/git-pages/git-pages-cli
|
|
||||||
|
|
||||||
require (
|
|
||||||
codeberg.org/git-pages/git-pages-cli v1.13.2 // indirect
|
|
||||||
codeberg.org/git-pages/go-redirects v1.0.0 // indirect
|
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
|
||||||
github.com/klauspost/compress v1.20.4 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/spf13/pflag v1.1.0 // indirect
|
|
||||||
golang.org/x/net v0.62.0 // indirect
|
|
||||||
golang.org/x/text v0.43.0 // indirect
|
|
||||||
)
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
codeberg.org/git-pages/git-pages-cli v1.13.2 h1:ZEp6q939eTmB4GcZgnPQVm4Ml2BFaF2GOJgpCNhSha8=
|
|
||||||
codeberg.org/git-pages/git-pages-cli v1.13.2/go.mod h1:hWoewK332MgUQuOMt5O07lFTjs3l3kUywxIFs90W3IY=
|
|
||||||
codeberg.org/git-pages/go-redirects v1.0.0 h1:RfrPwtk60ii5JyQgH1XkUmsUrTqPjwvbqy3CGapPVwA=
|
|
||||||
codeberg.org/git-pages/go-redirects v1.0.0/go.mod h1:0zdliclTux3tFONB7E6ZWV7WoWrK7cXHIi2hrMcLf8g=
|
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
|
|
||||||
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag=
|
|
||||||
github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
|
||||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
|
|
||||||
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
|
|
||||||
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
|
|
||||||
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
|
||||||
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
|
|
||||||
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
LD_LIBRARY_PATH = lib.makeLibraryPath (
|
LD_LIBRARY_PATH = lib.makeLibraryPath (
|
||||||
[
|
[
|
||||||
pkgs.stdenv.cc.cc.lib
|
pkgs.stdenv.cc.cc.lib
|
||||||
pkgs.llvmPackages.libclang.lib
|
|
||||||
]
|
]
|
||||||
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
||||||
pkgs.liburing
|
pkgs.liburing
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
target:
|
target:
|
||||||
target.fromToolchainName {
|
target.fromToolchainName {
|
||||||
name = (lib.importTOML "${inputs.self}/rust-toolchain.toml").toolchain.channel;
|
name = (lib.importTOML "${inputs.self}/rust-toolchain.toml").toolchain.channel;
|
||||||
sha256 = "sha256-MFHoWVcPZKjFrLnQnodCXbUsfZcofGfo9tV9fTTvklg=";
|
sha256 = "sha256-+xUr6Al1wZSqX8aEsq7DpuFOK4Ve/i+qTl+K5uWQ9GM=";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
Generated
+198
-262
@@ -11,26 +11,26 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rspress/core": "^2.0.0",
|
"@rspress/core": "^2.0.0",
|
||||||
"@rspress/plugin-client-redirects": "^2.0.0",
|
"@rspress/plugin-client-redirects": "^2.0.0",
|
||||||
"@types/node": "^26.6.7",
|
"@rspress/plugin-sitemap": "^2.0.0",
|
||||||
"typescript": "^7.0.0"
|
"typescript": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/core": {
|
"node_modules/@emnapi/core": {
|
||||||
"version": "2.0.0-beta.3",
|
"version": "1.11.3",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.3.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz",
|
||||||
"integrity": "sha512-KA+gOBtbifRATmUa/Gpf5C2B2EJ0r4brHUT3XSgACeHREcuiObXH56xd+B3fFsEFbUT04VBEe6MuZiCtMp0tQg==",
|
"integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emnapi/wasi-threads": "2.2.0",
|
"@emnapi/wasi-threads": "1.2.3",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/runtime": {
|
"node_modules/@emnapi/runtime": {
|
||||||
"version": "2.0.0-beta.3",
|
"version": "1.11.3",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.3.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
|
||||||
"integrity": "sha512-ayb/PyyLzpwRyFVxeC0uoEHu59QlB1iWGcGsOpXQcaB/Dc+uGfBmNmpCHp3HmTT0t8lSsMmg3j7+tdJW/TlHjQ==",
|
"integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -39,9 +39,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "2.2.0",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz",
|
||||||
"integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==",
|
"integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -106,36 +106,33 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@napi-rs/wasm-runtime": {
|
"node_modules/@napi-rs/wasm-runtime": {
|
||||||
"version": "1.2.7",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
|
||||||
"integrity": "sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==",
|
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tybys/wasm-util": "^0.10.3"
|
"@tybys/wasm-util": "^0.10.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "^20.19.0 || ^22.13.0 || >=23.5.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/Brooooooklyn"
|
"url": "https://github.com/sponsors/Brooooooklyn"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@emnapi/core": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3",
|
"@emnapi/core": "^1.7.1",
|
||||||
"@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3"
|
"@emnapi/runtime": "^1.7.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rsbuild/core": {
|
"node_modules/@rsbuild/core": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rsbuild/core/-/core-2.3.1.tgz",
|
||||||
"integrity": "sha512-1P3nLh/uXOcNTJZxvymRzAmuz8SBiCqY2InliNxQTlS0mWtoXbrRBC/W7zfv3MATk/vPmzODAYoZ5oIULk3Ilg==",
|
"integrity": "sha512-dv5tL7djb8ex5z4sqnDmUbd5PnGNr/CXuFfiMD4RkUsF1JEZZkGH8lc+QW4fqYQIHM7RTvcMUakgvwVU/O9WMw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rspack/core": "~2.3.4",
|
"@rspack/core": "~2.3.1",
|
||||||
"@swc/helpers": "^0.5.24"
|
"@swc/helpers": "^0.5.23"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"rsbuild": "bin/rsbuild.js"
|
"rsbuild": "bin/rsbuild.js"
|
||||||
@@ -172,32 +169,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding": {
|
"node_modules/@rspack/binding": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-2.3.1.tgz",
|
||||||
"integrity": "sha512-wSOT16LVITL/IKeIiLXgN5Q5jZIDqnQ7Gmk+wzKOSZ6OHYNfEBXAKhSJuYtCBq8ovJuGl8cJjdqatAlHE5XKIA==",
|
"integrity": "sha512-pfCJGBFNK2tnNnoDP6ZoTbOjxbKr1U2eGFDJ8bIuZQai4FBNhWQlKFmNup+X5K935XYRulZBomIBAL6GL6W2YQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rspack/binding-darwin-arm64": "2.3.4",
|
"@rspack/binding-darwin-arm64": "2.3.1",
|
||||||
"@rspack/binding-darwin-x64": "2.3.4",
|
"@rspack/binding-darwin-x64": "2.3.1",
|
||||||
"@rspack/binding-linux-arm64-gnu": "2.3.4",
|
"@rspack/binding-linux-arm64-gnu": "2.3.1",
|
||||||
"@rspack/binding-linux-arm64-musl": "2.3.4",
|
"@rspack/binding-linux-arm64-musl": "2.3.1",
|
||||||
"@rspack/binding-linux-ppc64-gnu": "2.3.4",
|
"@rspack/binding-linux-ppc64-gnu": "2.3.1",
|
||||||
"@rspack/binding-linux-riscv64-gnu": "2.3.4",
|
"@rspack/binding-linux-riscv64-gnu": "2.3.1",
|
||||||
"@rspack/binding-linux-riscv64-musl": "2.3.4",
|
"@rspack/binding-linux-riscv64-musl": "2.3.1",
|
||||||
"@rspack/binding-linux-s390x-gnu": "2.3.4",
|
"@rspack/binding-linux-s390x-gnu": "2.3.1",
|
||||||
"@rspack/binding-linux-x64-gnu": "2.3.4",
|
"@rspack/binding-linux-x64-gnu": "2.3.1",
|
||||||
"@rspack/binding-linux-x64-musl": "2.3.4",
|
"@rspack/binding-linux-x64-musl": "2.3.1",
|
||||||
"@rspack/binding-wasm32-wasi": "2.3.4",
|
"@rspack/binding-wasm32-wasi": "2.3.1",
|
||||||
"@rspack/binding-win32-arm64-msvc": "2.3.4",
|
"@rspack/binding-win32-arm64-msvc": "2.3.1",
|
||||||
"@rspack/binding-win32-ia32-msvc": "2.3.4",
|
"@rspack/binding-win32-ia32-msvc": "2.3.1",
|
||||||
"@rspack/binding-win32-x64-msvc": "2.3.4"
|
"@rspack/binding-win32-x64-msvc": "2.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-darwin-arm64": {
|
"node_modules/@rspack/binding-darwin-arm64": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-arm64/-/binding-darwin-arm64-2.3.1.tgz",
|
||||||
"integrity": "sha512-eBD71fbmoJKnxcHD03bukbAIOP5r7nD0Ehs+mUrUQlZ6N53EhuJsTeJ1oYdg5L4GoSeQ+KecCqME81Nm0COLrA==",
|
"integrity": "sha512-koLyL2r8PUcLD0StjuZ/n5XM6GJ0C8dzJN0IuIV9d7nQcibJxwjjSAWEPGVz6bm8WuzypvuVKNoa1+GGAHeMQA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -209,9 +206,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-darwin-x64": {
|
"node_modules/@rspack/binding-darwin-x64": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-darwin-x64/-/binding-darwin-x64-2.3.1.tgz",
|
||||||
"integrity": "sha512-CqdfzTLPVFQCniOy/GDVWbg+rqg31qfdzbFf8NYCzdDkCQg+p15hU2HsckD/1sLsaNB8Y55EjGz4ZyGDny0cHg==",
|
"integrity": "sha512-YK39JLiu1YC6+3BMxkP7e848pHD7e2T/0OSNogDi7whfiZNg95wa9Ncd7I5ppAf0nhmV+FNew/sCBIFp5h67Jw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -223,16 +220,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-arm64-gnu": {
|
"node_modules/@rspack/binding-linux-arm64-gnu": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-2.3.1.tgz",
|
||||||
"integrity": "sha512-T/Y1FYiSegcNc+oHuDOLRGIcc+eSdBnfbS70d51EWQj4+0TG/tlfuqFKeAIL3mnKUV5lDLaTz3vsoD0Sws5Fxw==",
|
"integrity": "sha512-Q+RCA/KM2tn6m6R5U4lktXDs5cCRm3SyleQk86iqqUFX7wKzVRUvr5BTsreg6K9of3gpYmQ6+g1PGT5cwo0rLA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -240,16 +234,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-arm64-musl": {
|
"node_modules/@rspack/binding-linux-arm64-musl": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-arm64-musl/-/binding-linux-arm64-musl-2.3.1.tgz",
|
||||||
"integrity": "sha512-WZHCzZ532UfXFXNU8XyM8jb+I6wddegbs/7IXsyw7xiPwwZX1D/M6iKFVpBYdvKcupUM8bS8Uw2REirR/cERVw==",
|
"integrity": "sha512-He+muVDON1fohGtdYamh3zHVwf6/E6fZu/+iEAkxjclE0P94bsCfYVcZW/a4/l1tJ2zvLZtB4jD7Qr6r4vG/WA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -257,16 +248,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-ppc64-gnu": {
|
"node_modules/@rspack/binding-linux-ppc64-gnu": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-2.3.1.tgz",
|
||||||
"integrity": "sha512-WeizqeI6HIh7Ax9w2tlmpTtipJWxXcdgt3QqI3N9LOixymlMD5yMBMZNPqwZ6cHXT9gOQ69SvPcVgMwxsdmceQ==",
|
"integrity": "sha512-blIZUgyPt4FcSHkZL6sJ2xbzc7ACgDeU49An4mXLSebwdgnlhTzxeSFnh2VeJDlGza8CUaZYB/zS/6oZ2kCDcw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -274,16 +262,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-riscv64-gnu": {
|
"node_modules/@rspack/binding-linux-riscv64-gnu": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-2.3.1.tgz",
|
||||||
"integrity": "sha512-h+001Vbq8LyGwPMNkeRWidPOVKwlAbwNPskY3CjNlSw3euHkVchfhM3uo6+1h0GyTtb3rzsWqsfm1kar7m/tiQ==",
|
"integrity": "sha512-3FtW2DUFmXxhBORUA3zSc+ot4d6R/1/U6z/48TDN4jeIYDUG9VqYBF6LUohX4vBY6IP0DCyXb2N9WayD/9QXoA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -291,16 +276,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-riscv64-musl": {
|
"node_modules/@rspack/binding-linux-riscv64-musl": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-2.3.1.tgz",
|
||||||
"integrity": "sha512-S1rlaCnNVG5s4WZ9odLsqN3ySh5TEdNTLXWapEK8x3iQl56aLtdvqXTfbJWHWnYLJuS7M1WqnQGdJNdjy2NDsA==",
|
"integrity": "sha512-+5qNgdNdXzp/K8f8BjgJ3m7tcbBKPENN7WPDfBcSHvWb5GF4+o/pbrX26c0+LEugo0bYUOAoitBNd94AwcNvpA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -308,16 +290,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-s390x-gnu": {
|
"node_modules/@rspack/binding-linux-s390x-gnu": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-2.3.1.tgz",
|
||||||
"integrity": "sha512-0SkgGrgulVMam3xel5dMNKQ+U7BEpCczhF1avGT1DzDVIbMfIOsbb32gApQNSz0E7RfAQ/Pa5eWiA9oyRq7ZMQ==",
|
"integrity": "sha512-yNcg/y1+MV0wZ984CVU4d1HAYYwMcDPXoQO0xynU+K5YuBxPWALHOxuRRCKCcykBdL1GIEshAIewEFrsW/cmJg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -325,16 +304,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-x64-gnu": {
|
"node_modules/@rspack/binding-linux-x64-gnu": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-gnu/-/binding-linux-x64-gnu-2.3.1.tgz",
|
||||||
"integrity": "sha512-q7E6x3rJJ/9fJyLuRe5+KyEPi23BF/xkAU4xCM5VwLkTf+rVyOkDZfu0qOkxmILjrxllQPV+b/ojBL/ZaIeQPw==",
|
"integrity": "sha512-ffclKBuH8wwimOBd6xGUxrBfVKKY5Ow4E7OFdHZeg4xffm2O8auGszmOgvFu1eoDoOYHaVJn+cEV6UD0KwZk8A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -342,16 +318,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-linux-x64-musl": {
|
"node_modules/@rspack/binding-linux-x64-musl": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-linux-x64-musl/-/binding-linux-x64-musl-2.3.1.tgz",
|
||||||
"integrity": "sha512-rey4Tyasui/WeMn6KfhH5xyZGOMt+Ny+GDK7nGh9TSz/cb3/bisxqGzpbu6GJK8leDmTUDD5ZdpODexytA5rzQ==",
|
"integrity": "sha512-qcDwwuyxR7TMtrW+r5Y9RIW25boXd1Ip/9jz04jhdq/OiU/Am7rCP2X90CH8sWdzovIF9UNmsGjY4KklR0F2Mg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -359,9 +332,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-wasm32-wasi": {
|
"node_modules/@rspack/binding-wasm32-wasi": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-wasm32-wasi/-/binding-wasm32-wasi-2.3.1.tgz",
|
||||||
"integrity": "sha512-sDt2MSXZrIaMBa6UaEqmXEqebwpTOPAXLdo9CYJ2Fa9FJWP4TCYbn30mbvV38ZC2n5YX411DRbjck+s97CceIg==",
|
"integrity": "sha512-3dr6zjFaCK3A920ftCriSJkiRhEfhHtat7LtBdj6g0mcV5Rt+iealmli0vjeAvD0UdpE1u8EKWlfw82JLgFLSQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"wasm32"
|
"wasm32"
|
||||||
],
|
],
|
||||||
@@ -369,15 +342,15 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emnapi/core": "2.0.0-beta.3",
|
"@emnapi/core": "1.11.3",
|
||||||
"@emnapi/runtime": "2.0.0-beta.3",
|
"@emnapi/runtime": "1.11.3",
|
||||||
"@napi-rs/wasm-runtime": "1.2.7"
|
"@napi-rs/wasm-runtime": "1.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-arm64-msvc": {
|
"node_modules/@rspack/binding-win32-arm64-msvc": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-2.3.1.tgz",
|
||||||
"integrity": "sha512-24YC1YSodLAJ8VsMQJmJSHCNvHTqK9JP5hj50T50WE8lCHNsNl/rIYXO9V0VlCYT/HshE6EHHzAeKdahiEOtcw==",
|
"integrity": "sha512-AZbuLPylt1xvWssN93AsirbYs3WgfcrA8tMsqHmVJIHahLu9E+JPKZ3Gmsw6IYEZk3EfnV3ujQzeQ1/VfF0Vsw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -389,9 +362,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-ia32-msvc": {
|
"node_modules/@rspack/binding-win32-ia32-msvc": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-2.3.1.tgz",
|
||||||
"integrity": "sha512-xmUNu6kgV9lLEkRP1Zb+t6i1Z1ZMEWXmLlMalPx8tHqndz2RflNMBBx6kjB2nAPQBIZgWufwm7dVGS0HKomCmw==",
|
"integrity": "sha512-R5NVU68TePZcgRdYUzrQX9YFNxmcyXZEPwaPv40AAgsqNyacG3iRaYVmV79jt3rWYfa0QJaqvRLUchDe2SZ6zQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -403,9 +376,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/binding-win32-x64-msvc": {
|
"node_modules/@rspack/binding-win32-x64-msvc": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/binding-win32-x64-msvc/-/binding-win32-x64-msvc-2.3.1.tgz",
|
||||||
"integrity": "sha512-WY+AkJqpbLtLEZiG1fE7CVJZ54y0qHeCiVmLxGBsh4OOGIDCs6v2Ub5COcPrYVzGJFGyeHUS29dV7JAs93qIHw==",
|
"integrity": "sha512-5T9DYjNPQpLbrNXjCssGd2B6xMQPlc3LxVOKHGUA1O0GV+88vBkTXAcryJ+Fo+yVEMPCzp4VvwBMGAVDpCjcSA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -417,13 +390,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/core": {
|
"node_modules/@rspack/core": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/core/-/core-2.3.1.tgz",
|
||||||
"integrity": "sha512-T8HGkIjPVDlGlIN8st/ICe8Gfixq8te75g/8crSdNSf8F+6884sBcKNky0CRdfPxao1C5SXV+Vjv1XJTjyu83w==",
|
"integrity": "sha512-9BWfaiEJLgLK9U53Q4WVruBZ19Mu/XWHXHEu0UFla4lUtH8Z+/ET2m044tiqbtyIgqQyG58fMrxHeVIAiXMXHg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rspack/binding": "2.3.4"
|
"@rspack/binding": "2.3.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
@@ -442,9 +415,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspack/plugin-react-refresh": {
|
"node_modules/@rspack/plugin-react-refresh": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@rspack/plugin-react-refresh/-/plugin-react-refresh-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@rspack/plugin-react-refresh/-/plugin-react-refresh-2.0.2.tgz",
|
||||||
"integrity": "sha512-/K86+2fzdtGdqorm8IwxaouAr5uXFdn7yej0P6/JtuqVYEo9tAUMypGbepAZgt3ClVevn6sC8Oo+fUCLhR10zg==",
|
"integrity": "sha512-dGNZiCxQxgAUI9sah7gd8u+O7OJZRCmqtEJNDOd8xW5RqcieC86F7p5qcShyw6onH5pKf57evpr2VjGbaFGkZg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -458,39 +431,37 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/core": {
|
"node_modules/@rspress/core": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/core/-/core-2.1.2.tgz",
|
||||||
"integrity": "sha512-kzTqrfJ4UiW+RLLHLunoW/rET5Vjb6Qz4YjhEhiWEp4HYM+KxLVhfyYB5aL8af9+mdnwiTaqlu1s+BZGrMD2zw==",
|
"integrity": "sha512-3ghPRkZFwbuO3tr2Rb5cxi6QfSFWOcxoZ5p4pv21lbN5DxAzMduITFlfgBMTArIQbehXrfXw3OUXe1l422b0RA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mdx-js/mdx": "^3.1.1",
|
"@mdx-js/mdx": "^3.1.1",
|
||||||
"@mdx-js/react": "^3.1.1",
|
"@mdx-js/react": "^3.1.1",
|
||||||
"@rsbuild/core": "^2.3.3",
|
"@rsbuild/core": "^2.2.14",
|
||||||
"@rsbuild/plugin-react": "~2.1.1",
|
"@rsbuild/plugin-react": "~2.1.1",
|
||||||
"@rspress/shared": "2.1.5",
|
"@rspress/shared": "2.1.2",
|
||||||
"@shikijs/rehype": "^4.2.0",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"@shikijs/transformers": "^4.2.0",
|
"@shikijs/transformers": "^4.2.0",
|
||||||
"@types/mdast": "^4.0.4",
|
"@types/mdast": "^4.0.4",
|
||||||
"@types/react": "^19.3.0",
|
"@types/react": "^19.3.0",
|
||||||
"@unhead/react": "^2.1.18",
|
"@unhead/react": "^2.1.17",
|
||||||
"body-scroll-lock": "4.0.0-beta.0",
|
"body-scroll-lock": "4.0.0-beta.0",
|
||||||
"clsx": "2.1.1",
|
"clsx": "2.1.1",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"flexsearch": "0.8.212",
|
"flexsearch": "0.8.212",
|
||||||
"hast-util-heading-rank": "^3.0.0",
|
"hast-util-heading-rank": "^3.0.0",
|
||||||
"hast-util-to-jsx-runtime": "^2.3.7",
|
"hast-util-to-jsx-runtime": "^2.3.7",
|
||||||
"mdast-util-gfm": "^3.1.0",
|
|
||||||
"mdast-util-mdx": "^3.0.0",
|
"mdast-util-mdx": "^3.0.0",
|
||||||
"mdast-util-mdxjs-esm": "^2.0.1",
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
||||||
"mdast-util-to-markdown": "^2.1.2",
|
|
||||||
"medium-zoom": "1.1.2",
|
"medium-zoom": "1.1.2",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"react": "^19.3.1",
|
"react": "^19.3.1",
|
||||||
"react-dom": "^19.3.1",
|
"react-dom": "^19.3.1",
|
||||||
"react-lazy-with-preload": "^2.2.1",
|
"react-lazy-with-preload": "^2.2.1",
|
||||||
"react-render-to-markdown": "19.2.0",
|
"react-render-to-markdown": "19.1.0",
|
||||||
"react-router-dom": "^7.18.6",
|
"react-router-dom": "^7.18.5",
|
||||||
"rehype-external-links": "^3.0.0",
|
"rehype-external-links": "^3.0.0",
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"remark-cjk-friendly": "^2.3.4",
|
"remark-cjk-friendly": "^2.3.4",
|
||||||
@@ -514,9 +485,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/plugin-client-redirects": {
|
"node_modules/@rspress/plugin-client-redirects": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/plugin-client-redirects/-/plugin-client-redirects-2.1.2.tgz",
|
||||||
"integrity": "sha512-vqAi7ynOgVsuwJi7cXwWEF5UgoNhXqGOyBfQubeZHZKWRtdNHRU42P9rG9DZLTss2dZUiDKlVrM2/vNY40t5hw==",
|
"integrity": "sha512-kNCC7fffXA277TzTDfKpP+QuCI1X218lJ5JH/2iqYR8PHnLw0Y6ZIwoFmJlE0eKaBdniYyBRGn9zgvT93mCWdg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@rspress/core": "^2.1.0-beta.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rspress/plugin-sitemap": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rspress/plugin-sitemap/-/plugin-sitemap-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-qF9NDLLJORa7MM8QY/etgMlrXM8hlArNaK5ntiFimqtKRoF1YTJQSKPsAfMq2PvYrpQJyEqsSg6wJ+r+lyjNlw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -527,16 +511,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rspress/shared": {
|
"node_modules/@rspress/shared": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@rspress/shared/-/shared-2.1.2.tgz",
|
||||||
"integrity": "sha512-XXxegxRZ7VPADS2veN9FTNmmLlA65ieydKH0tOhOZbMJC4OJpKbr/d/JS2jxxAO4u+ZmZxbDyEEir83NQHLKIw==",
|
"integrity": "sha512-W34tT1fdP3PrdbXpZNKqOGZMOw+RYL70Z9vnkbT1HTTbtX4uMIDE+SU7ByihG0S0LYBsT3kPxA2cXj696253Uw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rsbuild/core": "^2.3.3",
|
"@rsbuild/core": "^2.2.14",
|
||||||
"@shikijs/rehype": "^4.2.0",
|
"@shikijs/rehype": "^4.2.0",
|
||||||
"@types/react": "^19.3.0",
|
"@types/react": "^19.3.0",
|
||||||
"mdast-util-mdx-jsx": "^3.2.2",
|
"mdast-util-mdx-jsx": "^3.2.1",
|
||||||
"unified": "^11.0.5"
|
"unified": "^11.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -688,9 +672,9 @@
|
|||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
"node_modules/@tybys/wasm-util": {
|
"node_modules/@tybys/wasm-util": {
|
||||||
"version": "0.10.5",
|
"version": "0.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.5.tgz",
|
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz",
|
||||||
"integrity": "sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==",
|
"integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -709,9 +693,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.11",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz",
|
||||||
"integrity": "sha512-YBdNe5JcjYR0sPhJW1QIeRCmI11YhYvaRuGCs9+WCeTTb+Yhb2BE2XMe5/wAqF10FK5g3+q1PDhQABfT7aX0gg==",
|
"integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
@@ -759,20 +743,10 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
|
||||||
"version": "26.6.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.11.tgz",
|
|
||||||
"integrity": "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"undici-types": "~8.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "19.3.3",
|
"version": "19.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
|
||||||
"integrity": "sha512-K8uWpJc4teiuOPdiP1umjeA9rGMgVPiXuoL66fcS1QlwBT1WMqY8PORmub9FadopIs+RCW6siYEs7Lpq+vDlog==",
|
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1134,13 +1108,13 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/@unhead/react": {
|
"node_modules/@unhead/react": {
|
||||||
"version": "2.1.19",
|
"version": "2.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/@unhead/react/-/react-2.1.19.tgz",
|
"resolved": "https://registry.npmjs.org/@unhead/react/-/react-2.1.17.tgz",
|
||||||
"integrity": "sha512-UNLxU5CgyJw6NzTOsxzUr11pX9zyW1DIHXPwkg2/V1zLcwPKPPcpDkx1tRmWmlajPdpSFZli3xmSrEt1HCGSDw==",
|
"integrity": "sha512-KmcYksDjlLozL0fxUjIDwH/0k6+Lg2HWHLUPlkRW8Gl08hdB1AbLB5iU9QxFvkaT8p0Q4dFEqZWnz3g6RMeiRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"unhead": "2.1.19"
|
"unhead": "2.1.17"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/harlan-zw"
|
"url": "https://github.com/sponsors/harlan-zw"
|
||||||
@@ -1288,9 +1262,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/compute-scroll-into-view": {
|
"node_modules/compute-scroll-into-view": {
|
||||||
"version": "3.2.2",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.1.1.tgz",
|
||||||
"integrity": "sha512-X+jf3y2j3TbtxA3fq3/kBNiSnD1QlIChiIQdAc2Yo1LtOc0yjO1TzgxWJf8PwtKPGgSvSfWUlVvrb7vGx1eYWA==",
|
"integrity": "sha512-VRhuHOLoKYOy4UbilLbUzbYg93XLjv2PncJC50EuTWPA3gaja1UjBsUP/D/9/juV3vQFr6XBEzn9KCAHdUvOHw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
@@ -1319,9 +1293,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/csstype": {
|
"node_modules/csstype": {
|
||||||
"version": "3.2.4",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||||
"integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==",
|
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
@@ -1652,9 +1626,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hast-util-raw": {
|
"node_modules/hast-util-raw": {
|
||||||
"version": "9.2.1",
|
"version": "9.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-9.2.0.tgz",
|
||||||
"integrity": "sha512-8P0PLAr5C7xCRb+tkhUTV4v6OSNcnccKwjBkH/r19R5CkVCgTWlv4vmTkxFH1CVCA2UJOvOPQdBBMC3c6qnuOg==",
|
"integrity": "sha512-1zVq3M9AlZiBZ4mlMPnLtkK2rdd+I8VhmFLNLb//XJm6xA2AVH2tz19EHy25RgRWut6z6FpTARAs7P8rnmRJUQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1665,7 +1639,7 @@
|
|||||||
"hast-util-to-parse5": "^8.0.0",
|
"hast-util-to-parse5": "^8.0.0",
|
||||||
"html-void-elements": "^3.0.0",
|
"html-void-elements": "^3.0.0",
|
||||||
"mdast-util-to-hast": "^13.0.0",
|
"mdast-util-to-hast": "^13.0.0",
|
||||||
"parse5": "^8.1.0",
|
"parse5": "^8.0.0",
|
||||||
"unist-util-position": "^5.0.0",
|
"unist-util-position": "^5.0.0",
|
||||||
"unist-util-visit": "^5.0.0",
|
"unist-util-visit": "^5.0.0",
|
||||||
"vfile": "^6.0.0",
|
"vfile": "^6.0.0",
|
||||||
@@ -1707,9 +1681,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hast-util-to-html": {
|
"node_modules/hast-util-to-html": {
|
||||||
"version": "9.0.7",
|
"version": "9.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.6.tgz",
|
||||||
"integrity": "sha512-HYNDA3qdnzUPitY/LcQm1nWs8z0cWFNH1Nz09jdI/tXifAqF7h3+jrLl4S/b9Mi4VSjn0Dsn54ctuTV6zhBthA==",
|
"integrity": "sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1758,6 +1732,23 @@
|
|||||||
"url": "https://opencollective.com/unified"
|
"url": "https://opencollective.com/unified"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/hast-util-to-jsx-runtime/node_modules/inline-style-parser": {
|
||||||
|
"version": "0.2.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.9.tgz",
|
||||||
|
"integrity": "sha512-IttN8BqKLxzUrnTqHI+/hwAJQItBAUjdoHERCDv+oOuX48VP6bzW8+QjOXSfoevzq3YrYAwX1uLHp8TqO9yIeg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/hast-util-to-jsx-runtime/node_modules/style-to-object": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-QmbXPUylqU80HAgTOJeEOdbA40W9KtxmjMhQy+tq+b8F2aoh3aQLuy82hh2jm2qsC9hR9eI0+eQidTMydKcqRA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"inline-style-parser": "0.2.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/hast-util-to-parse5": {
|
"node_modules/hast-util-to-parse5": {
|
||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-8.0.1.tgz",
|
||||||
@@ -1842,13 +1833,6 @@
|
|||||||
"url": "https://github.com/sponsors/wooorm"
|
"url": "https://github.com/sponsors/wooorm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/inline-style-parser": {
|
|
||||||
"version": "0.2.9",
|
|
||||||
"resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.9.tgz",
|
|
||||||
"integrity": "sha512-IttN8BqKLxzUrnTqHI+/hwAJQItBAUjdoHERCDv+oOuX48VP6bzW8+QjOXSfoevzq3YrYAwX1uLHp8TqO9yIeg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/is-absolute-url": {
|
"node_modules/is-absolute-url": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz",
|
||||||
@@ -1959,9 +1943,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-find-and-replace": {
|
"node_modules/mdast-util-find-and-replace": {
|
||||||
"version": "3.0.5",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.4.tgz",
|
||||||
"integrity": "sha512-of3wZLEBWpK8mSYy8wmKnwyxfUKjhCkXxGLz45DVBqfcahTP37LscCK+0oAZh+ReZ5OunPDkB2zdGMIxrojLhw==",
|
"integrity": "sha512-z4B5c6jrnJ1ltOQemhWYPBSAo6y42Z8Gt2yEgfgNTMcLSU59B8bfj8Z8AnAlJrBGLnqkdAUZ7jdDEqQw3KuipQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2021,9 +2005,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-gfm-autolink-literal": {
|
"node_modules/mdast-util-gfm-autolink-literal": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.1.0.tgz",
|
||||||
"integrity": "sha512-rAlbZBGZfv2YRr6lSFGHTN305KkNawOYRRlbldFyPHnTlHJZwlGdzVwyIDvr3fxbhRbmJOSZc06c8H5Fgfu8Ng==",
|
"integrity": "sha512-Jx6QSK8wDo558Bcf7q+1pe0v81g2PVs09Hlvu9xJHmCFRF3sAPW7vXFVIAwBncs3sde92WbsVqNxwdqViA2XnQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2147,9 +2131,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-mdx-jsx": {
|
"node_modules/mdast-util-mdx-jsx": {
|
||||||
"version": "3.2.2",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.1.tgz",
|
||||||
"integrity": "sha512-/0FHaZMv2fSjIL3z/NYmXnQTSdzYyamPpI1BXpSCngTUqpSvMNIlERa26ABz+Z6UFQbrh3I5Yhzp448WZsPfMA==",
|
"integrity": "sha512-oXp1GIa+E9IwIs3a106+tr3Bz2MlTTBvlXjOZMoIat11kk7vjqgmBnksB9WHmWv+gZh7k3IUgpAHlwHB7DH4GQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2206,9 +2190,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-to-hast": {
|
"node_modules/mdast-util-to-hast": {
|
||||||
"version": "13.2.2",
|
"version": "13.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
|
||||||
"integrity": "sha512-l2pnmOuqs+SGLVpTVXnRLQu5v1AzvDe181404fbXzzqObVxrAnnVxapAP27pUwzLBL/ABIkgUhGlPVU7QSvIFg==",
|
"integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2228,9 +2212,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mdast-util-to-markdown": {
|
"node_modules/mdast-util-to-markdown": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.2.3.tgz",
|
||||||
"integrity": "sha512-aCsogoZ2Oz1EItAlC12A+/uGuzp+CWlDU0xZ3o5jbJaepLsOu2tlxpvHslnX5dRhspD1gxNVkBtYG0yMiIpXoQ==",
|
"integrity": "sha512-dImdB6VZRMRac1SwAW6o1c0ESk/7pFFAMCMuKM+9v7LpTSthMM5nzXpqKw4Mjo66aXVKhNkyrP4bMB9MurPyWg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3320,9 +3304,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-render-to-markdown": {
|
"node_modules/react-render-to-markdown": {
|
||||||
"version": "19.2.0",
|
"version": "19.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-render-to-markdown/-/react-render-to-markdown-19.1.0.tgz",
|
||||||
"integrity": "sha512-hVF80DyFXazwW8vuUaptMwnW9ZZHMRrLE3WE36U3Iz1M6pPrFbtE8yYcTq8CYRBVn7YdagJUR/2ik3qJD2Rlvg==",
|
"integrity": "sha512-dF9b3tO41ezqdmHP8X92kbHbMexJ6iC7iHw4ykC8fwiO7DgpFc9PhMoKlI+BcPzRxGcWgQSdrixVB9RykhjJpQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3333,9 +3317,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router": {
|
"node_modules/react-router": {
|
||||||
"version": "7.18.7",
|
"version": "7.18.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.7.tgz",
|
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.5.tgz",
|
||||||
"integrity": "sha512-nXl672FFobymVY/Ywbo0DnlXV/+VXOB5pOslCeuVqoegwwL7sau2yASdyGoWHvPRxAoqUBrAiFZRdli4nT7Wow==",
|
"integrity": "sha512-dTgvcXDOrLPrlLHrcZAqWveiK1hMSqN+rGAJzegP8HtmNkfRxOoshGWBNX3ZJ0cZjOHkRdlUJtaIhZMLLyGyPw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3346,27 +3330,23 @@
|
|||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@types/react": ">=18",
|
|
||||||
"react": ">=18",
|
"react": ">=18",
|
||||||
"react-dom": ">=18"
|
"react-dom": ">=18"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"@types/react": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"react-dom": {
|
"react-dom": {
|
||||||
"optional": true
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-router-dom": {
|
"node_modules/react-router-dom": {
|
||||||
"version": "7.18.7",
|
"version": "7.18.5",
|
||||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.7.tgz",
|
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.5.tgz",
|
||||||
"integrity": "sha512-EBWBKV1TjvScebAIvidowN0Bfh9Bg7p54IDBRVJkFXz0wBKTBblDNLxUvCewx/GdzTiC7VWV/MOjWqsLWEMygA==",
|
"integrity": "sha512-9HcfDMU6JJ/fp6gJZYGwNE6RknVGS4kBjH1HkNw959mCJi70TVwdipQWv2FEol9uGpi+SZTFtVpJPtEQfayeOw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-router": "7.18.7"
|
"react-router": "7.18.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
@@ -3664,13 +3644,13 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/scroll-into-view-if-needed": {
|
"node_modules/scroll-into-view-if-needed": {
|
||||||
"version": "3.2.1",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.1.0.tgz",
|
||||||
"integrity": "sha512-dgeJvJhSV9MY6hyhtsivbSxHoZVm+lumsWTObtUdAchJflwOGmKKHNkEpU8pVYMomZ8h/yrfzVQkcPlObQNDWQ==",
|
"integrity": "sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compute-scroll-into-view": "^3.2.2"
|
"compute-scroll-into-view": "^3.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/set-cookie-parser": {
|
"node_modules/set-cookie-parser": {
|
||||||
@@ -3722,9 +3702,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/stringify-entities": {
|
"node_modules/stringify-entities": {
|
||||||
"version": "4.0.5",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
|
||||||
"integrity": "sha512-jNuI2fNNw5ecxrWmgm90R3iH0Kc/94AQwoQWoSUYphWzvmUA2pjFG34H56Z7Z3FkvH3FpYwwewKAa97oQnPFhw==",
|
"integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -3763,16 +3743,6 @@
|
|||||||
"inline-style-parser": "0.2.7"
|
"inline-style-parser": "0.2.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/style-to-object": {
|
|
||||||
"version": "2.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-2.0.2.tgz",
|
|
||||||
"integrity": "sha512-QmbXPUylqU80HAgTOJeEOdbA40W9KtxmjMhQy+tq+b8F2aoh3aQLuy82hh2jm2qsC9hR9eI0+eQidTMydKcqRA==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"inline-style-parser": "0.2.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/toggle-selection": {
|
"node_modules/toggle-selection": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
||||||
@@ -3845,53 +3815,19 @@
|
|||||||
"@typescript/typescript-win32-x64": "7.0.2"
|
"@typescript/typescript-win32-x64": "7.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
|
||||||
"version": "8.9.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
|
|
||||||
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/unhead": {
|
"node_modules/unhead": {
|
||||||
"version": "2.1.19",
|
"version": "2.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/unhead/-/unhead-2.1.19.tgz",
|
"resolved": "https://registry.npmjs.org/unhead/-/unhead-2.1.17.tgz",
|
||||||
"integrity": "sha512-W+zxYQeulbi738I839IQFxOgdAzkNWLrNdaK0XmRGAqcDhojlFufESM7d/IeaMwPmue1rff27Sdl6NNckZqrrQ==",
|
"integrity": "sha512-HLMKXOszRhAPBrr6VlqCeVeJq2kbC4kXwzGLEZvvojPLWNYTJw22xG7Bfwhsvs31+IBet3Wl8ADg9dwYdyphfQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hookable": "^6.0.1",
|
"hookable": "^6.0.1"
|
||||||
"parse5": "^7.3.0"
|
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/harlan-zw"
|
"url": "https://github.com/sponsors/harlan-zw"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unhead/node_modules/entities": {
|
|
||||||
"version": "6.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
|
||||||
"integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "BSD-2-Clause",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.12"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/unhead/node_modules/parse5": {
|
|
||||||
"version": "7.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
|
|
||||||
"integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"entities": "^6.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/unified": {
|
"node_modules/unified": {
|
||||||
"version": "11.0.5",
|
"version": "11.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz",
|
||||||
|
|||||||
+2
-2
@@ -20,11 +20,11 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "module",
|
"type": "commonjs",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rspress/core": "^2.0.0",
|
"@rspress/core": "^2.0.0",
|
||||||
"@rspress/plugin-client-redirects": "^2.0.0",
|
"@rspress/plugin-client-redirects": "^2.0.0",
|
||||||
"@types/node": "^26.6.7",
|
"@rspress/plugin-sitemap": "^2.0.0",
|
||||||
"typescript": "^7.0.0"
|
"typescript": "^7.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-10
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended", "replacements:all", ":semanticCommitTypeAll(chore)", "helpers:pinGitHubActionDigests"],
|
"extends": ["config:recommended", "replacements:all", ":semanticCommitTypeAll(chore)", "helpers:pinGitHubActionDigests"],
|
||||||
"dependencyDashboard": {
|
"dependencyDashboard": true,
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"osvVulnerabilityAlerts": true,
|
"osvVulnerabilityAlerts": true,
|
||||||
"lockFileMaintenance": {
|
"lockFileMaintenance": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
@@ -92,13 +90,6 @@
|
|||||||
"matchUpdateTypes": ["patch"],
|
"matchUpdateTypes": ["patch"],
|
||||||
"groupName": "node-patch-updates"
|
"groupName": "node-patch-updates"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"description": "Batch patch-level Go dependency updates",
|
|
||||||
"matchManagers": ["gomod"],
|
|
||||||
"matchUpdateTypes": ["patch"],
|
|
||||||
"postUpdateOptions": ["gomodTidy"],
|
|
||||||
"groupName": "go-patch-updates"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"description": "Pin forgejo artifact actions to prevent breaking changes",
|
"description": "Pin forgejo artifact actions to prevent breaking changes",
|
||||||
"matchManagers": ["github-actions"],
|
"matchManagers": ["github-actions"],
|
||||||
|
|||||||
+9
-9
@@ -1,13 +1,10 @@
|
|||||||
import { defineConfig } from '@rspress/core';
|
import { defineConfig } from '@rspress/core';
|
||||||
|
import { pluginSitemap } from '@rspress/plugin-sitemap';
|
||||||
import { pluginClientRedirects } from '@rspress/plugin-client-redirects';
|
import { pluginClientRedirects } from '@rspress/plugin-client-redirects';
|
||||||
|
|
||||||
const sitePath: string = process.env.SITE_PATH ?? '/';
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
root: 'docs',
|
root: 'docs',
|
||||||
title: 'Continuwuity',
|
title: 'Continuwuity',
|
||||||
siteOrigin: sitePath != "/" ? "https://preview.continuwuity.org" : "https://continuwuity.org",
|
|
||||||
base: sitePath,
|
|
||||||
description: 'A community-driven Matrix homeserver',
|
description: 'A community-driven Matrix homeserver',
|
||||||
icon: '/assets/logo.svg',
|
icon: '/assets/logo.svg',
|
||||||
logo: {
|
logo: {
|
||||||
@@ -78,11 +75,14 @@ export default defineConfig({
|
|||||||
lastUpdated: true,
|
lastUpdated: true,
|
||||||
enableContentAnimation: true,
|
enableContentAnimation: true,
|
||||||
enableAppearanceAnimation: false,
|
enableAppearanceAnimation: false,
|
||||||
footer: {},
|
footer: {
|
||||||
darkMode: 'auto'
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
plugins: [pluginClientRedirects({
|
plugins: [pluginSitemap({
|
||||||
|
siteUrl: 'https://continuwuity.org', // TODO: Set automatically in build pipeline
|
||||||
|
}),
|
||||||
|
pluginClientRedirects({
|
||||||
redirects: [{
|
redirects: [{
|
||||||
from: '^/config_reference$',
|
from: '^/config_reference$',
|
||||||
to: '/reference/config'
|
to: '/reference/config'
|
||||||
@@ -105,8 +105,8 @@ export default defineConfig({
|
|||||||
from: "^/source(|_code)$",
|
from: "^/source(|_code)$",
|
||||||
to: "https://forgejo.ellis.link/continuwuation/continuwuity",
|
to: "https://forgejo.ellis.link/continuwuation/continuwuity",
|
||||||
}, {
|
}, {
|
||||||
from: "^/(CONTRIBUTING.md|contributing)$",
|
from: "^/(CONTRIBUTING.md|contributing)$",
|
||||||
to: "/development/contributing"
|
to: "/development/contributing"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})],
|
})],
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
[toolchain]
|
[toolchain]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
channel = "1.100.0"
|
channel = "1.99.1"
|
||||||
components = [
|
components = [
|
||||||
# For rust-analyzer
|
# For rust-analyzer
|
||||||
"rust-src",
|
"rust-src",
|
||||||
|
|||||||
@@ -1007,7 +1007,7 @@ impl crate::Context<'_> {
|
|||||||
pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result {
|
pub(super) async fn memory_stats(&self, opts: Option<String>) -> Result {
|
||||||
const OPTS: &str = "abcdefghijklmnopqrstuvwxyz";
|
const OPTS: &str = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
let mut mapped_opts: String = OPTS
|
let opts: String = OPTS
|
||||||
.chars()
|
.chars()
|
||||||
.filter(|&c| {
|
.filter(|&c| {
|
||||||
let allow_any = opts.as_ref().is_some_and(|opts| opts == "*");
|
let allow_any = opts.as_ref().is_some_and(|opts| opts == "*");
|
||||||
@@ -1018,11 +1018,7 @@ impl crate::Context<'_> {
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if opts.as_ref().is_some_and(|opts| opts.contains('J')) {
|
let stats = conduwuit::alloc::memory_stats(&opts).unwrap_or_default();
|
||||||
mapped_opts.push('J');
|
|
||||||
}
|
|
||||||
|
|
||||||
let stats = conduwuit::alloc::memory_stats(&mapped_opts).unwrap_or_default();
|
|
||||||
|
|
||||||
self.write_str("```\n").await?;
|
self.write_str("```\n").await?;
|
||||||
self.write_str(&stats).await?;
|
self.write_str(&stats).await?;
|
||||||
|
|||||||
@@ -192,8 +192,7 @@ pub enum DebugCommand {
|
|||||||
///
|
///
|
||||||
/// Optional argument is a character mask (a sequence of characters in any
|
/// Optional argument is a character mask (a sequence of characters in any
|
||||||
/// order) which enable additional extended statistics. Known characters are
|
/// order) which enable additional extended statistics. Known characters are
|
||||||
/// "abdeglmx" and 'J' for JSON output. For convenience, a '*' will enable
|
/// "abdeglmx". For convenience, a '*' will enable everything.
|
||||||
/// everything.
|
|
||||||
MemoryStats {
|
MemoryStats {
|
||||||
opts: Option<String>,
|
opts: Option<String>,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -142,11 +142,11 @@ impl crate::Context<'_> {
|
|||||||
.await?;
|
.await?;
|
||||||
self.write_str("| ------ | ---------- | --------------------------- |\n")
|
self.write_str("| ------ | ---------- | --------------------------- |\n")
|
||||||
.await?;
|
.await?;
|
||||||
for (key_id, key) in &response.parsed.verify_keys {
|
for (key_id, key) in &response.verify_keys {
|
||||||
self.write_str(&format!("| {key_id} | {} | |\n", key.key))
|
self.write_str(&format!("| {key_id} | {} | |\n", key.key))
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
for (key_id, old_key) in &response.parsed.old_verify_keys {
|
for (key_id, old_key) in &response.old_verify_keys {
|
||||||
self.write_str(&format!(
|
self.write_str(&format!(
|
||||||
"| {key_id} | {} | {:0<13} |\n",
|
"| {key_id} | {} | {:0<13} |\n",
|
||||||
old_key.key,
|
old_key.key,
|
||||||
|
|||||||
+3
-1
@@ -2,7 +2,6 @@
|
|||||||
#![allow(clippy::wildcard_imports)]
|
#![allow(clippy::wildcard_imports)]
|
||||||
#![allow(clippy::enum_glob_use)]
|
#![allow(clippy::enum_glob_use)]
|
||||||
#![allow(clippy::too_many_arguments)]
|
#![allow(clippy::too_many_arguments)]
|
||||||
#![allow(clippy::large_unopt_stack_frames, reason = "very large Subcommand macro expansions")]
|
|
||||||
|
|
||||||
conduwuit_macros::introspect_crate! {}
|
conduwuit_macros::introspect_crate! {}
|
||||||
|
|
||||||
@@ -34,6 +33,9 @@ pub(crate) use crate::{context::Context, utils::get_room_info};
|
|||||||
|
|
||||||
pub(crate) const PAGE_SIZE: usize = 100;
|
pub(crate) const PAGE_SIZE: usize = 100;
|
||||||
|
|
||||||
|
conduwuit::mod_ctor! {}
|
||||||
|
conduwuit::mod_dtor! {}
|
||||||
|
|
||||||
pub use crate::admin::AdminCommand;
|
pub use crate::admin::AdminCommand;
|
||||||
|
|
||||||
/// Install the admin command processor
|
/// Install the admin command processor
|
||||||
|
|||||||
@@ -110,6 +110,14 @@ impl crate::Context<'_> {
|
|||||||
self.write_str("Notice was sent to #admins").await
|
self.write_str("Notice was sent to #admins").await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) async fn reload_mods(&self) -> Result {
|
||||||
|
self.bail_restricted()?;
|
||||||
|
|
||||||
|
self.services.server.reload()?;
|
||||||
|
|
||||||
|
self.write_str("Reloading server...").await
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub(super) async fn restart(&self, force: bool) -> Result {
|
pub(super) async fn restart(&self, force: bool) -> Result {
|
||||||
use conduwuit::utils::sys::current_exe_deleted;
|
use conduwuit::utils::sys::current_exe_deleted;
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ pub enum ServerCommand {
|
|||||||
message: Vec<String>,
|
message: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Hot-reload the server
|
||||||
|
#[command(name = "reload", alias = "reload-mods")]
|
||||||
|
ReloadMods,
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
/// Restart the server
|
/// Restart the server
|
||||||
Restart {
|
Restart {
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ serde.workspace = true
|
|||||||
sha1.workspace = true
|
sha1.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
wildmatch.workspace = true
|
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Result, Server, config::experiments::ToggledExperiment};
|
use conduwuit::{Result, Server};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomVersionId,
|
RoomVersionId,
|
||||||
api::{
|
api::{
|
||||||
@@ -53,11 +53,8 @@ pub(crate) async fn get_capabilities_route(
|
|||||||
capabilities.account_moderation.lock = true;
|
capabilities.account_moderation.lock = true;
|
||||||
capabilities.account_moderation.suspend = true;
|
capabilities.account_moderation.suspend = true;
|
||||||
|
|
||||||
if services.config.experiments.msc4484.is_enabled() {
|
capabilities.admin =
|
||||||
capabilities.admin = AdminCapability::new(BTreeSet::from_iter([
|
AdminCapability::new(BTreeSet::from_iter([OAuthClientScope::ServerAdministration]));
|
||||||
OAuthClientScope::ServerAdministration,
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilities.profile_fields = Some(
|
capabilities.profile_fields = Some(
|
||||||
@@ -66,10 +63,7 @@ pub(crate) async fn get_capabilities_route(
|
|||||||
|
|
||||||
capabilities.set(
|
capabilities.set(
|
||||||
"org.matrix.msc4174.webpush",
|
"org.matrix.msc4174.webpush",
|
||||||
json!({
|
json!({ "enabled": true, "vapid": services.pusher.webpush_vapid_public_key() }),
|
||||||
"enabled": services.config.experiments.msc4174.is_enabled(),
|
|
||||||
"vapid": services.pusher.webpush_vapid_public_key()
|
|
||||||
}),
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(get_capabilities::v3::Response::new(capabilities))
|
Ok(get_capabilities::v3::Response::new(capabilities))
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ use ruma::{
|
|||||||
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
|
||||||
api::{
|
api::{
|
||||||
client::keys::{
|
client::keys::{
|
||||||
claim_keys, get_key_changes, get_keys, upload_keys, upload_signatures,
|
claim_keys, get_key_changes, get_keys, upload_keys,
|
||||||
|
upload_signatures::{self},
|
||||||
upload_signing_keys,
|
upload_signing_keys,
|
||||||
},
|
},
|
||||||
federation,
|
federation,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result, debug, err,
|
Err, Result, err,
|
||||||
utils::{self, content_disposition::make_content_disposition, math::ruma_from_usize},
|
utils::{self, content_disposition::make_content_disposition, math::ruma_from_usize},
|
||||||
};
|
};
|
||||||
use conduwuit_core::error;
|
use conduwuit_core::error;
|
||||||
@@ -219,12 +219,10 @@ pub(crate) async fn get_media_preview_route(
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Fetching a URL preview for {url} on behalf of {sender_user}");
|
|
||||||
let preview = services
|
let preview = services
|
||||||
.media
|
.media
|
||||||
.get_url_preview(&url)
|
.get_url_preview(&url)
|
||||||
.await
|
.await
|
||||||
.inspect(|_| debug!(user=%sender_user, %url, "Finished fetching a URL preview"))
|
|
||||||
.map_err(|error| {
|
.map_err(|error| {
|
||||||
err!(Request(Unknown(
|
err!(Request(Unknown(
|
||||||
debug_error!(%sender_user, %url, "Failed to fetch URL preview: {error}")
|
debug_error!(%sender_user, %url, "Failed to fetch URL preview: {error}")
|
||||||
|
|||||||
+488
-249
@@ -1,10 +1,9 @@
|
|||||||
use std::collections::{HashMap, hash_map::Entry};
|
use std::{borrow::Borrow, collections::HashMap, sync::Arc};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, EventTypeExt, Result, debug, debug_warn, err, info,
|
Err, Result, debug, debug_info, debug_warn, err, info,
|
||||||
matrix::{
|
matrix::{
|
||||||
StateKey,
|
|
||||||
event::gen_event_id,
|
event::gen_event_id,
|
||||||
pdu::{PartialPdu, PduEvent},
|
pdu::{PartialPdu, PduEvent},
|
||||||
},
|
},
|
||||||
@@ -16,25 +15,31 @@ use conduwuit::{
|
|||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName,
|
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName,
|
||||||
OwnedUserId, RoomId, RoomVersionId, UserId,
|
OwnedUserId, RoomId, UserId,
|
||||||
api::{
|
api::{
|
||||||
client::knock::knock_room,
|
client::knock::knock_room,
|
||||||
error::{ErrorKind, IncompatibleRoomVersionErrorData},
|
federation::{self},
|
||||||
federation::{self, membership::RawStrippedState},
|
|
||||||
},
|
},
|
||||||
canonical_json::to_canonical_value,
|
canonical_json::to_canonical_value,
|
||||||
events::{
|
events::{
|
||||||
StateEventType,
|
StateEventType,
|
||||||
room::member::{MembershipState, RoomMemberEventContent},
|
room::{
|
||||||
|
join_rules::{AllowRule, JoinRule},
|
||||||
|
member::{MembershipState, RoomMemberEventContent},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use service::{
|
use service::{
|
||||||
Services,
|
Services,
|
||||||
rooms::{membership::validate_remote_member_event_stub, state::RoomMutexGuard},
|
rooms::{
|
||||||
|
membership::validate_remote_member_event_stub,
|
||||||
|
state::RoomMutexGuard,
|
||||||
|
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::banned_room_check;
|
use super::banned_room_check;
|
||||||
use crate::{Ruma, server::validate_partial_membership_event};
|
use crate::Ruma;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/*/knock/{roomIdOrAlias}`
|
/// # `POST /_matrix/client/*/knock/{roomIdOrAlias}`
|
||||||
///
|
///
|
||||||
@@ -56,42 +61,30 @@ pub(crate) async fn knock_room_route(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let mut servers = body.via.clone();
|
let mut servers = body.via.clone();
|
||||||
if servers.is_empty() {
|
servers.extend(
|
||||||
debug!("No via servers provided for knock, injecting some.");
|
services
|
||||||
servers.extend(
|
.rooms
|
||||||
services
|
.state_cache
|
||||||
.rooms
|
.servers_invite_via(&room_id)
|
||||||
.state_cache
|
.collect::<Vec<_>>()
|
||||||
.servers_invite_via(&room_id)
|
.await,
|
||||||
.collect::<Vec<_>>()
|
);
|
||||||
.await,
|
|
||||||
);
|
|
||||||
|
|
||||||
let invite_state = services
|
servers.extend(
|
||||||
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.invite_state(sender_user, &room_id)
|
.invite_state(sender_user, &room_id)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default()
|
||||||
let knock_state = services
|
.iter()
|
||||||
.rooms
|
.filter_map(|event| event.get_field("sender").ok().flatten())
|
||||||
.state_cache
|
.filter_map(|sender: &str| UserId::parse(sender).ok())
|
||||||
.knock_state(sender_user, &room_id)
|
.map(|user| user.server_name().to_owned()),
|
||||||
.await
|
);
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
servers.extend(
|
if let Some(server) = room_id.server_name() {
|
||||||
invite_state
|
servers.push(server.to_owned());
|
||||||
.iter()
|
|
||||||
.chain(knock_state.iter())
|
|
||||||
.filter_map(|event| event.get_field("sender").ok().flatten())
|
|
||||||
.filter_map(|sender: &str| UserId::parse(sender).ok())
|
|
||||||
.map(|user| user.server_name().to_owned()),
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(server) = room_id.server_name() {
|
|
||||||
servers.push(server.to_owned());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
servers.sort_unstable();
|
servers.sort_unstable();
|
||||||
@@ -113,28 +106,20 @@ pub(crate) async fn knock_room_route(
|
|||||||
|
|
||||||
let addl_via_servers = services.rooms.state_cache.servers_invite_via(&room_id);
|
let addl_via_servers = services.rooms.state_cache.servers_invite_via(&room_id);
|
||||||
|
|
||||||
let addl_invite_state = services
|
let addl_state_servers = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.invite_state(sender_user, &room_id)
|
.invite_state(sender_user, &room_id)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let addl_knock_state = services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.knock_state(sender_user, &room_id)
|
|
||||||
.await
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
let mut addl_servers: Vec<_> = addl_invite_state
|
let mut addl_servers: Vec<_> = addl_state_servers
|
||||||
.iter()
|
.iter()
|
||||||
.chain(addl_knock_state.iter())
|
|
||||||
.map(|event| event.get_field("sender"))
|
.map(|event| event.get_field("sender"))
|
||||||
.filter_map(FlatOk::flat_ok)
|
.filter_map(FlatOk::flat_ok)
|
||||||
.map(|user: OwnedUserId| user.server_name().to_owned())
|
.map(|user: OwnedUserId| user.server_name().to_owned())
|
||||||
.stream()
|
.stream()
|
||||||
.chain(addl_via_servers)
|
.chain(addl_via_servers)
|
||||||
.chain(body.via.iter().cloned().stream())
|
|
||||||
.collect()
|
.collect()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@@ -161,69 +146,165 @@ async fn knock_room_by_id_helper(
|
|||||||
) -> Result<knock_room::v3::Response> {
|
) -> Result<knock_room::v3::Response> {
|
||||||
let state_lock = services.rooms.state.mutex.lock(room_id).await;
|
let state_lock = services.rooms.state.mutex.lock(room_id).await;
|
||||||
|
|
||||||
|
if services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_invited(sender_user, room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
debug_warn!("{sender_user} is already invited in {room_id} but attempted to knock");
|
||||||
|
return Err!(Request(Forbidden(
|
||||||
|
"You cannot knock on a room you are already invited/accepted to."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_joined(sender_user, room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
debug_warn!("{sender_user} is already joined in {room_id} but attempted to knock");
|
||||||
|
return Err!(Request(Forbidden("You cannot knock on a room you are already joined in.")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_knocked(sender_user, room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
debug_warn!("{sender_user} is already knocked in {room_id}");
|
||||||
|
return Ok(knock_room::v3::Response::new(room_id.into()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Ok(membership) = services
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.get_member(room_id, sender_user)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
if membership.membership == MembershipState::Ban {
|
||||||
|
debug_warn!("{sender_user} is banned from {room_id} but attempted to knock");
|
||||||
|
return Err!(Request(Forbidden("You cannot knock on a room you are banned from.")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For knock_restricted rooms, check if the user meets the restricted
|
||||||
|
// conditions If they do, attempt to join instead of knock
|
||||||
|
// This is not mentioned in the spec, but should be allowable (we're allowed
|
||||||
|
// to auto-join invites to knocked rooms)
|
||||||
|
let join_rule = services.rooms.state_accessor.get_join_rules(room_id).await;
|
||||||
|
|
||||||
|
if let JoinRule::KnockRestricted(restricted) = &join_rule {
|
||||||
|
let restriction_rooms: Vec<_> = restricted
|
||||||
|
.allow
|
||||||
|
.iter()
|
||||||
|
.filter_map(|a| match a {
|
||||||
|
| AllowRule::RoomMembership(r) => Some(&r.room_id),
|
||||||
|
| _ => None,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
// Check if the user is in any of the allowed rooms
|
||||||
|
let mut user_meets_restrictions = false;
|
||||||
|
for restriction_room_id in &restriction_rooms {
|
||||||
|
if services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_joined(sender_user, restriction_room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
user_meets_restrictions = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the user meets the restrictions, try joining instead
|
||||||
|
if user_meets_restrictions {
|
||||||
|
debug_info!(
|
||||||
|
"{sender_user} meets the restricted criteria in knock_restricted room \
|
||||||
|
{room_id}, attempting to join instead of knock"
|
||||||
|
);
|
||||||
|
// For this case, we need to drop the state lock and get a new one
|
||||||
|
// in join_room_by_id_helper We need to release the lock here and
|
||||||
|
// let join_room_by_id_helper acquire it again
|
||||||
|
drop(state_lock);
|
||||||
|
match services
|
||||||
|
.rooms
|
||||||
|
.membership
|
||||||
|
.join_room(sender_user, room_id, reason.clone(), servers)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
| Ok(_) => return Ok(knock_room::v3::Response::new(room_id.to_owned())),
|
||||||
|
| Err(e) => {
|
||||||
|
debug_warn!(
|
||||||
|
"Failed to convert knock to join for {sender_user} in {room_id}: {e:?}"
|
||||||
|
);
|
||||||
|
// Get a new state lock for the remaining knock logic
|
||||||
|
let new_state_lock = services.rooms.state.mutex.lock(room_id).await;
|
||||||
|
|
||||||
|
let server_in_room = services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let local_knock = server_in_room
|
||||||
|
|| servers.is_empty()
|
||||||
|
|| (servers.len() == 1 && services.globals.server_is_ours(&servers[0]));
|
||||||
|
|
||||||
|
if local_knock {
|
||||||
|
knock_room_helper_local(
|
||||||
|
services,
|
||||||
|
sender_user,
|
||||||
|
room_id,
|
||||||
|
reason,
|
||||||
|
servers,
|
||||||
|
new_state_lock,
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
|
.await?;
|
||||||
|
} else {
|
||||||
|
knock_room_helper_remote(
|
||||||
|
services,
|
||||||
|
sender_user,
|
||||||
|
room_id,
|
||||||
|
reason,
|
||||||
|
servers,
|
||||||
|
new_state_lock,
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(knock_room::v3::Response::new(room_id.to_owned()));
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if !matches!(join_rule, JoinRule::Knock | JoinRule::KnockRestricted(_)) {
|
||||||
|
debug_warn!(
|
||||||
|
"{sender_user} attempted to knock on room {room_id} but its join rule is \
|
||||||
|
{join_rule:?}, not knock or knock_restricted"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let server_in_room = services
|
let server_in_room = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.server_in_room(services.globals.server_name(), room_id)
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
// Only check our known membership if we're already in the room.
|
let local_knock = server_in_room
|
||||||
if server_in_room {
|
|| servers.is_empty()
|
||||||
if services
|
|| (servers.len() == 1 && services.globals.server_is_ours(&servers[0]));
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.is_invited(sender_user, room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
debug_warn!("{sender_user} is already invited in {room_id} but attempted to knock");
|
|
||||||
return Err!(Request(Forbidden(
|
|
||||||
"You cannot knock on a room you are already invited/accepted to."
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if services
|
if local_knock {
|
||||||
.rooms
|
knock_room_helper_local(services, sender_user, room_id, reason, servers, state_lock)
|
||||||
.state_cache
|
|
||||||
.is_joined(sender_user, room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
debug_warn!("{sender_user} is already joined in {room_id} but attempted to knock");
|
|
||||||
return Err!(Request(Forbidden(
|
|
||||||
"You cannot knock on a room you are already joined in."
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Ok(membership) = services
|
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.get_member(room_id, sender_user)
|
|
||||||
.await
|
|
||||||
&& membership.membership == MembershipState::Ban
|
|
||||||
{
|
|
||||||
debug_warn!("{sender_user} is banned from {room_id} but attempted to knock");
|
|
||||||
return Err!(Request(Forbidden("You cannot knock on a room you are banned from.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local knocks can't fail unless the room is corrupted, so we don't
|
|
||||||
// fall back to remote knocks like we do with remote joins.
|
|
||||||
knock_room_helper_local(services, sender_user, room_id, reason, state_lock)
|
|
||||||
.boxed()
|
.boxed()
|
||||||
.await?;
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
drop(state_lock);
|
knock_room_helper_remote(services, sender_user, room_id, reason, servers, state_lock)
|
||||||
let remote_servers: Vec<_> = servers
|
|
||||||
.iter()
|
|
||||||
.filter(|sn| !services.globals.server_is_ours(sn))
|
|
||||||
.cloned()
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
if remote_servers.is_empty() {
|
|
||||||
return Err!(Request(NotFound(
|
|
||||||
"Room {room_id} not found and no remote servers were provided to discover it"
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
knock_room_helper_remote(services, sender_user, room_id, reason, &remote_servers)
|
|
||||||
.boxed()
|
.boxed()
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
@@ -231,14 +312,16 @@ async fn knock_room_by_id_helper(
|
|||||||
Ok(knock_room::v3::Response::new(room_id.to_owned()))
|
Ok(knock_room::v3::Response::new(room_id.to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(name = "local", skip(services, reason, state_lock))]
|
|
||||||
async fn knock_room_helper_local(
|
async fn knock_room_helper_local(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
sender_user: &UserId,
|
sender_user: &UserId,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
reason: Option<String>,
|
reason: Option<String>,
|
||||||
|
servers: &[OwnedServerName],
|
||||||
state_lock: RoomMutexGuard,
|
state_lock: RoomMutexGuard,
|
||||||
) -> Result {
|
) -> Result {
|
||||||
|
debug_info!("We can knock locally");
|
||||||
|
|
||||||
let room_version = services.rooms.state.get_room_version(room_id).await?;
|
let room_version = services.rooms.state.get_room_version(room_id).await?;
|
||||||
let room_version_rules = room_version
|
let room_version_rules = room_version
|
||||||
.rules()
|
.rules()
|
||||||
@@ -251,9 +334,10 @@ async fn knock_room_helper_local(
|
|||||||
let mut content = RoomMemberEventContent::new(MembershipState::Knock);
|
let mut content = RoomMemberEventContent::new(MembershipState::Knock);
|
||||||
content.displayname = services.users.displayname(sender_user).await.ok();
|
content.displayname = services.users.displayname(sender_user).await.ok();
|
||||||
content.avatar_url = services.users.avatar_url(sender_user).await.ok();
|
content.avatar_url = services.users.avatar_url(sender_user).await.ok();
|
||||||
content.reason = reason;
|
content.reason.clone_from(&reason.clone());
|
||||||
|
|
||||||
services
|
// Try normal knock first
|
||||||
|
let Err(error) = services
|
||||||
.rooms
|
.rooms
|
||||||
.timeline
|
.timeline
|
||||||
.build_and_append_pdu(
|
.build_and_append_pdu(
|
||||||
@@ -263,24 +347,21 @@ async fn knock_room_helper_local(
|
|||||||
&state_lock,
|
&state_lock,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map(|_| ())
|
else {
|
||||||
}
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
#[tracing::instrument(name = "remote", skip(services, reason, servers))]
|
if servers.is_empty() || (servers.len() == 1 && services.globals.server_is_ours(&servers[0]))
|
||||||
async fn knock_room_helper_remote(
|
{
|
||||||
services: &Services,
|
return Err(error);
|
||||||
sender_user: &UserId,
|
}
|
||||||
room_id: &RoomId,
|
|
||||||
reason: Option<String>,
|
|
||||||
servers: &[OwnedServerName],
|
|
||||||
) -> Result {
|
|
||||||
info!(via=?servers, "Knocking on {room_id} over federation.");
|
|
||||||
|
|
||||||
let (mut stub, room_version, remote_server) =
|
let (make_knock_response, remote_server) =
|
||||||
make_knock_request(services, sender_user, room_id, servers).await?;
|
make_knock_request(services, sender_user, room_id, servers).await?;
|
||||||
|
|
||||||
info!(%remote_server, "make_knock finished");
|
info!("make_knock finished");
|
||||||
|
|
||||||
|
let room_version = make_knock_response.room_version;
|
||||||
let room_version_rules = room_version
|
let room_version_rules = room_version
|
||||||
.rules()
|
.rules()
|
||||||
.expect("room version should have defined rules");
|
.expect("room version should have defined rules");
|
||||||
@@ -289,7 +370,142 @@ async fn knock_room_helper_remote(
|
|||||||
return Err!(BadServerResponse("Remote room version {room_version} is not supported"));
|
return Err!(BadServerResponse("Remote room version {room_version} is not supported"));
|
||||||
}
|
}
|
||||||
|
|
||||||
stub.insert(
|
let mut knock_event_stub = serde_json::from_str::<CanonicalJsonObject>(
|
||||||
|
make_knock_response.event.get(),
|
||||||
|
)
|
||||||
|
.map_err(|e| {
|
||||||
|
err!(BadServerResponse("Invalid make_knock event json received from server: {e:?}"))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
validate_remote_member_event_stub(
|
||||||
|
&MembershipState::Knock,
|
||||||
|
sender_user,
|
||||||
|
room_id,
|
||||||
|
&knock_event_stub,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
knock_event_stub.insert(
|
||||||
|
"origin".to_owned(),
|
||||||
|
CanonicalJsonValue::String(services.globals.server_name().as_str().to_owned()),
|
||||||
|
);
|
||||||
|
knock_event_stub.insert(
|
||||||
|
"origin_server_ts".to_owned(),
|
||||||
|
CanonicalJsonValue::Integer(
|
||||||
|
utils::millis_since_unix_epoch()
|
||||||
|
.try_into()
|
||||||
|
.expect("Timestamp is valid js_int value"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
knock_event_stub.insert(
|
||||||
|
"content".to_owned(),
|
||||||
|
to_canonical_value(content).expect("event is valid, we just created it"),
|
||||||
|
);
|
||||||
|
|
||||||
|
// In order to create a compatible ref hash (EventID) the `hashes` field
|
||||||
|
// needs to be present
|
||||||
|
services
|
||||||
|
.server_keys
|
||||||
|
.hash_and_sign_event(&mut knock_event_stub, &room_version_rules)?;
|
||||||
|
|
||||||
|
// Generate event id
|
||||||
|
let event_id = gen_event_id(&knock_event_stub, &room_version_rules)?;
|
||||||
|
|
||||||
|
// Add event_id
|
||||||
|
knock_event_stub
|
||||||
|
.insert("event_id".to_owned(), CanonicalJsonValue::String(event_id.clone().into()));
|
||||||
|
|
||||||
|
// It has enough fields to be called a proper event now
|
||||||
|
let knock_event = knock_event_stub;
|
||||||
|
|
||||||
|
info!("Asking {remote_server} for send_knock in room {room_id}");
|
||||||
|
let send_knock_request = federation::membership::create_knock_event::v1::Request::new(
|
||||||
|
room_id.to_owned(),
|
||||||
|
event_id.clone(),
|
||||||
|
services
|
||||||
|
.sending
|
||||||
|
.convert_to_outgoing_federation_event(knock_event.clone())
|
||||||
|
.await,
|
||||||
|
);
|
||||||
|
|
||||||
|
services
|
||||||
|
.sending
|
||||||
|
.send_federation_request(&remote_server, send_knock_request)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
info!("send_knock finished");
|
||||||
|
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.short
|
||||||
|
.get_or_create_shortroomid(room_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
info!("Parsing knock event");
|
||||||
|
|
||||||
|
let parsed_knock_pdu = PduEvent::from_id_val(&event_id, knock_event.clone())
|
||||||
|
.map_err(|e| err!(BadServerResponse("Invalid knock event PDU: {e:?}")))?;
|
||||||
|
|
||||||
|
info!("Updating membership locally to knock state with provided stripped state events");
|
||||||
|
// TODO: this call does not appear to do anything because
|
||||||
|
// `update_membership` doesn't call `mark_as_knock`. investigate further,
|
||||||
|
// ideally with the aim of removing this call entirely -- Ginger thinks
|
||||||
|
// `update_membership` should only be called from `force_state` and
|
||||||
|
// `append_pdu`.
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.update_membership(room_id, sender_user, &parsed_knock_pdu, false)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
info!("Appending room knock event locally");
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.timeline
|
||||||
|
.progress_extremities(&parsed_knock_pdu)
|
||||||
|
.await?;
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.timeline
|
||||||
|
.append_pdu(&parsed_knock_pdu, knock_event, room_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn knock_room_helper_remote(
|
||||||
|
services: &Services,
|
||||||
|
sender_user: &UserId,
|
||||||
|
room_id: &RoomId,
|
||||||
|
reason: Option<String>,
|
||||||
|
servers: &[OwnedServerName],
|
||||||
|
state_lock: RoomMutexGuard,
|
||||||
|
) -> Result {
|
||||||
|
info!("Knocking {room_id} over federation.");
|
||||||
|
|
||||||
|
let (make_knock_response, remote_server) =
|
||||||
|
make_knock_request(services, sender_user, room_id, servers).await?;
|
||||||
|
|
||||||
|
info!("make_knock finished");
|
||||||
|
|
||||||
|
let room_version = make_knock_response.room_version;
|
||||||
|
let room_version_rules = room_version
|
||||||
|
.rules()
|
||||||
|
.expect("room version should have defined rules");
|
||||||
|
|
||||||
|
if !services.server.supported_room_version(&room_version) {
|
||||||
|
return Err!(BadServerResponse("Remote room version {room_version} is not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut knock_event_stub: CanonicalJsonObject =
|
||||||
|
serde_json::from_str(make_knock_response.event.get()).map_err(|e| {
|
||||||
|
err!(BadServerResponse("Invalid make_knock event json received from server: {e:?}"))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
knock_event_stub.insert(
|
||||||
|
"origin".to_owned(),
|
||||||
|
CanonicalJsonValue::String(services.globals.server_name().as_str().to_owned()),
|
||||||
|
);
|
||||||
|
knock_event_stub.insert(
|
||||||
"origin_server_ts".to_owned(),
|
"origin_server_ts".to_owned(),
|
||||||
CanonicalJsonValue::Integer(
|
CanonicalJsonValue::Integer(
|
||||||
utils::millis_since_unix_epoch()
|
utils::millis_since_unix_epoch()
|
||||||
@@ -303,7 +519,7 @@ async fn knock_room_helper_remote(
|
|||||||
knock_content.avatar_url = services.users.avatar_url(sender_user).await.ok();
|
knock_content.avatar_url = services.users.avatar_url(sender_user).await.ok();
|
||||||
knock_content.reason = reason;
|
knock_content.reason = reason;
|
||||||
|
|
||||||
stub.insert(
|
knock_event_stub.insert(
|
||||||
"content".to_owned(),
|
"content".to_owned(),
|
||||||
to_canonical_value(knock_content).expect("event is valid, we just created it"),
|
to_canonical_value(knock_content).expect("event is valid, we just created it"),
|
||||||
);
|
);
|
||||||
@@ -312,15 +528,17 @@ async fn knock_room_helper_remote(
|
|||||||
// needs to be present
|
// needs to be present
|
||||||
services
|
services
|
||||||
.server_keys
|
.server_keys
|
||||||
.hash_and_sign_event(&mut stub, &room_version_rules)?;
|
.hash_and_sign_event(&mut knock_event_stub, &room_version_rules)?;
|
||||||
|
|
||||||
let event_id = gen_event_id(&stub, &room_version_rules)?;
|
// Generate event id
|
||||||
|
let event_id = gen_event_id(&knock_event_stub, &room_version_rules)?;
|
||||||
|
|
||||||
// Just verify that this event isn't hilariously malformed before we sent it
|
// Add event_id
|
||||||
// off.
|
knock_event_stub
|
||||||
debug!(?stub, "Parsing knock event");
|
.insert("event_id".to_owned(), CanonicalJsonValue::String(event_id.clone().into()));
|
||||||
PduEvent::from_id_val(&event_id, stub.clone())
|
|
||||||
.map_err(|e| err!(BadServerResponse("Invalid knock event PDU: {e:?}")))?;
|
// It has enough fields to be called a proper event now
|
||||||
|
let knock_event = knock_event_stub;
|
||||||
|
|
||||||
info!("Asking {remote_server} for send_knock in room {room_id}");
|
info!("Asking {remote_server} for send_knock in room {room_id}");
|
||||||
let request = federation::membership::create_knock_event::v1::Request::new(
|
let request = federation::membership::create_knock_event::v1::Request::new(
|
||||||
@@ -328,7 +546,7 @@ async fn knock_room_helper_remote(
|
|||||||
event_id.clone(),
|
event_id.clone(),
|
||||||
services
|
services
|
||||||
.sending
|
.sending
|
||||||
.convert_to_outgoing_federation_event(stub.clone())
|
.convert_to_outgoing_federation_event(knock_event.clone())
|
||||||
.await,
|
.await,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -339,95 +557,126 @@ async fn knock_room_helper_remote(
|
|||||||
|
|
||||||
info!("send_knock finished");
|
info!("send_knock finished");
|
||||||
|
|
||||||
info!("Validating send_knock response");
|
|
||||||
services
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.short
|
.short
|
||||||
.get_or_create_shortroomid(room_id)
|
.get_or_create_shortroomid(room_id)
|
||||||
.await;
|
.await;
|
||||||
let mut state: HashMap<(StateEventType, StateKey), CanonicalJsonObject> =
|
|
||||||
HashMap::with_capacity(send_knock_response.knock_room_state.len().saturating_add(1));
|
|
||||||
let mut create_event: Option<(OwnedEventId, CanonicalJsonObject)> = None;
|
|
||||||
|
|
||||||
for (idx, event) in send_knock_response.knock_room_state.iter().enumerate() {
|
info!("Parsing knock event");
|
||||||
let (state_event_id, key, state_event_json) = match validate_partial_membership_event(
|
let parsed_knock_pdu = PduEvent::from_id_val(&event_id, knock_event.clone())
|
||||||
services,
|
.map_err(|e| err!(BadServerResponse("Invalid knock event PDU: {e:?}")))?;
|
||||||
event,
|
|
||||||
&room_version_rules,
|
info!("Going through send_knock response knock state events");
|
||||||
room_id,
|
let state = send_knock_response
|
||||||
idx,
|
.knock_room_state
|
||||||
)
|
.iter()
|
||||||
.await
|
.map(|event| {
|
||||||
{
|
#[allow(deprecated)]
|
||||||
| Ok(res) => res,
|
let raw_value = match event {
|
||||||
| Err(e) => {
|
| federation::membership::RawStrippedState::Stripped(raw_state) =>
|
||||||
debug_warn!(%idx, "Dropping invalid event from knock_room_state: {e}");
|
&raw_state.clone().into_json(),
|
||||||
continue;
|
| federation::membership::RawStrippedState::Pdu(raw_value) => raw_value,
|
||||||
},
|
| _ => panic!("unknown raw stripped state type"),
|
||||||
|
};
|
||||||
|
|
||||||
|
serde_json::from_str::<CanonicalJsonObject>(raw_value.get())
|
||||||
|
})
|
||||||
|
.filter_map(Result::ok);
|
||||||
|
|
||||||
|
let mut state_map: HashMap<u64, OwnedEventId> = HashMap::new();
|
||||||
|
|
||||||
|
for mut event in state {
|
||||||
|
let Some(state_key) = event.get("state_key") else {
|
||||||
|
debug_warn!("send_knock stripped state event missing state_key: {event:?}");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(event_type) = event.get("type") else {
|
||||||
|
debug_warn!("send_knock stripped state event missing event type: {event:?}");
|
||||||
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
match state.entry(key) {
|
let Ok(state_key) = serde_json::from_value::<String>(state_key.clone().into()) else {
|
||||||
| Entry::Occupied(entry) => {
|
debug_warn!("send_knock stripped state event has invalid state_key: {event:?}");
|
||||||
debug_warn!(
|
continue;
|
||||||
key=?entry.key(),
|
};
|
||||||
"Dropping duplicate state event from knock_room_state"
|
let Ok(event_type) = serde_json::from_value::<StateEventType>(event_type.clone().into())
|
||||||
);
|
else {
|
||||||
},
|
debug_warn!("send_knock stripped state event has invalid event type: {event:?}");
|
||||||
| Entry::Vacant(entry) => {
|
continue;
|
||||||
if entry.key().0 == StateEventType::RoomCreate {
|
};
|
||||||
create_event = Some((state_event_id, state_event_json.clone()));
|
|
||||||
}
|
|
||||||
entry.insert(state_event_json);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some((create_event_id, create_event_json)) = &create_event {
|
let event_id = gen_event_id(&event, &room_version_rules)?;
|
||||||
state.retain(|key, event_json| {
|
let shortstatekey = services
|
||||||
if let Err(e) = service::rooms::event_handler::Service::pdu_format_check_1(
|
|
||||||
event_json,
|
|
||||||
&room_version_rules,
|
|
||||||
create_event_id,
|
|
||||||
) {
|
|
||||||
debug_warn!(
|
|
||||||
?key,
|
|
||||||
"Dropping event from knock_room_state violating room event format: {e}"
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Much like when receiving an invite over federation, if we're in this
|
|
||||||
// room we'll receive the knock PDU over /send. Otherwise, we need to
|
|
||||||
// add it as an outlier. Since this function isn't a fallback when local
|
|
||||||
// knocks fail, we can do this unconditionally.
|
|
||||||
services
|
|
||||||
.rooms
|
.rooms
|
||||||
.outlier
|
.short
|
||||||
.add_pdu_outlier(create_event_id, create_event_json);
|
.get_or_create_shortstatekey(&event_type, &state_key)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
event.insert("event_id".into(), CanonicalJsonValue::String(event_id.to_string()));
|
||||||
|
services.rooms.outlier.add_pdu_outlier(&event_id, &event);
|
||||||
|
state_map.insert(shortstatekey, event_id.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
state.insert(StateEventType::RoomMember.with_state_key(sender_user.as_str()), stub);
|
info!("Compressing state from send_knock");
|
||||||
|
let compressed: CompressedState = services
|
||||||
let knocked_state = state
|
|
||||||
.into_values()
|
|
||||||
.filter_map(|event_json| serde_json::value::to_raw_value(&event_json).ok())
|
|
||||||
.map(RawStrippedState::Pdu)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
info!("Saving knock data");
|
|
||||||
services
|
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_compressor
|
||||||
.mark_as_knocked(sender_user, room_id, knocked_state);
|
.compress_state_events(state_map.iter().map(|(ssk, eid)| (ssk, eid.borrow())))
|
||||||
services
|
.collect()
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.update_joined_count(room_id)
|
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
services.sync.wake(sender_user).await;
|
debug!("Saving compressed state");
|
||||||
|
let HashSetCompressStateEvent {
|
||||||
|
shortstatehash: statehash_before_knock,
|
||||||
|
added,
|
||||||
|
removed,
|
||||||
|
} = services
|
||||||
|
.rooms
|
||||||
|
.state_compressor
|
||||||
|
.save_state(room_id, Arc::new(compressed))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
debug!("Forcing state for new room");
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.state
|
||||||
|
.force_state(room_id, statehash_before_knock, added, removed, &state_lock)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let statehash_after_knock = services
|
||||||
|
.rooms
|
||||||
|
.state
|
||||||
|
.append_to_state(&parsed_knock_pdu, room_id)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
info!("Updating membership locally to knock state with provided stripped state events");
|
||||||
|
// TODO: see TODO on the other call to `update_membership`
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.update_membership(room_id, sender_user, &parsed_knock_pdu, false)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
info!("Appending room knock event locally");
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.timeline
|
||||||
|
.progress_extremities(&parsed_knock_pdu)
|
||||||
|
.await?;
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.timeline
|
||||||
|
.append_pdu(&parsed_knock_pdu, knock_event, room_id)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
info!("Setting final room state for new room");
|
||||||
|
// We set the room state after inserting the pdu, so that we never have a
|
||||||
|
// moment in time where events in the current room state do not exist
|
||||||
|
services
|
||||||
|
.rooms
|
||||||
|
.state
|
||||||
|
.set_room_state(room_id, statehash_after_knock, &state_lock);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -437,13 +686,18 @@ async fn make_knock_request(
|
|||||||
sender_user: &UserId,
|
sender_user: &UserId,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
servers: &[OwnedServerName],
|
servers: &[OwnedServerName],
|
||||||
) -> Result<(CanonicalJsonObject, RoomVersionId, OwnedServerName)> {
|
) -> Result<(federation::membership::prepare_knock_event::v1::Response, OwnedServerName)> {
|
||||||
for (idx, remote_server) in servers.iter().enumerate() {
|
let mut make_knock_response_and_server =
|
||||||
|
Err!(BadServerResponse("No server available to assist in knocking."));
|
||||||
|
|
||||||
|
let mut make_knock_counter: usize = 0;
|
||||||
|
|
||||||
|
for remote_server in servers {
|
||||||
if services.globals.server_is_ours(remote_server) {
|
if services.globals.server_is_ours(remote_server) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Asking {remote_server} for make_knock ({})", idx.saturating_add(1));
|
info!("Asking {remote_server} for make_knock ({make_knock_counter})");
|
||||||
|
|
||||||
let mut request = federation::membership::prepare_knock_event::v1::Request::new(
|
let mut request = federation::membership::prepare_knock_event::v1::Request::new(
|
||||||
room_id.to_owned(),
|
room_id.to_owned(),
|
||||||
@@ -457,51 +711,36 @@ async fn make_knock_request(
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
trace!("make_knock response: {make_knock_response:?}");
|
trace!("make_knock response: {make_knock_response:?}");
|
||||||
match make_knock_response
|
make_knock_counter = make_knock_counter.saturating_add(1);
|
||||||
.and_then(|r| {
|
if let Ok(r) = &make_knock_response {
|
||||||
to_canonical_object(&r.event)
|
if let Err(e) = validate_remote_member_event_stub(
|
||||||
.map(|o| (o, r.room_version))
|
&MembershipState::Knock,
|
||||||
.map_err(Into::into)
|
sender_user,
|
||||||
})
|
room_id,
|
||||||
.and_then(|(stub, room_version)| {
|
&to_canonical_object(&r.event)?,
|
||||||
validate_remote_member_event_stub(
|
) {
|
||||||
&MembershipState::Knock,
|
warn!("make_knock response from {remote_server} failed validation: {e}");
|
||||||
sender_user,
|
continue;
|
||||||
room_id,
|
}
|
||||||
&stub,
|
}
|
||||||
)
|
|
||||||
.map(|()| (stub, room_version))
|
make_knock_response_and_server = make_knock_response.map(|r| (r, remote_server.clone()));
|
||||||
}) {
|
|
||||||
| Ok((evt, room_version)) =>
|
if make_knock_response_and_server.is_ok() {
|
||||||
return Ok((evt, room_version, remote_server.to_owned())),
|
break;
|
||||||
| Err(e) => match e.kind() {
|
}
|
||||||
| ErrorKind::IncompatibleRoomVersion(IncompatibleRoomVersionErrorData {
|
|
||||||
room_version,
|
if make_knock_counter > 40 {
|
||||||
..
|
warn!(
|
||||||
}) => {
|
"50 servers failed to provide valid make_knock response, assuming no server can \
|
||||||
warn!(
|
assist in knocking."
|
||||||
"{remote_server} reports the room we are trying to knock on is \
|
);
|
||||||
v{room_version}, which we do not support."
|
make_knock_response_and_server =
|
||||||
);
|
Err!(BadServerResponse("No server available to assist in knocking."));
|
||||||
return Err(e);
|
|
||||||
},
|
return make_knock_response_and_server;
|
||||||
| ErrorKind::Forbidden => {
|
|
||||||
warn!("{remote_server} refuses to let us knock: {e}.");
|
|
||||||
return Err(e);
|
|
||||||
},
|
|
||||||
| ErrorKind::NotFound => {
|
|
||||||
info!(
|
|
||||||
"{remote_server} does not know about {room_id}: {e}. Will continue \
|
|
||||||
trying."
|
|
||||||
);
|
|
||||||
},
|
|
||||||
| _ => {
|
|
||||||
info!("{remote_server} failed to make_knock: {e}. Will continue trying.");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("All {} servers were unable to assist in knocking {room_id} :(", servers.len());
|
make_knock_response_and_server
|
||||||
Err!(BadServerResponse("No server available to assist in knocking."))
|
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,10 @@ use conduwuit::{
|
|||||||
use futures::{FutureExt, StreamExt, pin_mut};
|
use futures::{FutureExt, StreamExt, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, OwnedServerName, RoomId, UserId,
|
CanonicalJsonObject, CanonicalJsonValue, OwnedServerName, RoomId, UserId,
|
||||||
api::{client::membership::leave_room, federation},
|
api::{
|
||||||
|
client::membership::leave_room,
|
||||||
|
federation::{self},
|
||||||
|
},
|
||||||
events::{
|
events::{
|
||||||
StateEventType,
|
StateEventType,
|
||||||
room::member::{MembershipState, RoomMemberEventContent},
|
room::member::{MembershipState, RoomMemberEventContent},
|
||||||
@@ -88,13 +91,19 @@ pub async fn leave_room(
|
|||||||
.server_in_room(services.globals.server_name(), room_id)
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
.eq(&false);
|
.eq(&false);
|
||||||
|
|
||||||
|
let not_knocked = services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.is_knocked(user_id, room_id)
|
||||||
|
.eq(&false);
|
||||||
|
|
||||||
pin_mut!(is_banned, is_disabled);
|
pin_mut!(is_banned, is_disabled);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
there are three possible cases when leaving a room:
|
there are three possible cases when leaving a room:
|
||||||
1. the room is banned or disabled, so we're not federating with it.
|
1. the room is banned or disabled, so we're not federating with it.
|
||||||
2. nobody on the homeserver is in the room, which can happen if the user is rejecting an invite
|
2. nobody on the homeserver is in the room, which can happen if the user is rejecting an invite
|
||||||
or rescinding a knock for a room that we don't have any members in.
|
to a room that we don't have any members in.
|
||||||
3. someone else on the homeserver is in the room. in this case we can leave like normal by sending a PDU over federation.
|
3. someone else on the homeserver is in the room. in this case we can leave like normal by sending a PDU over federation.
|
||||||
|
|
||||||
in cases 1 and 2, we have to update the state cache using `mark_as_left` directly.
|
in cases 1 and 2, we have to update the state cache using `mark_as_left` directly.
|
||||||
@@ -107,7 +116,7 @@ pub async fn leave_room(
|
|||||||
// case 1: the room is banned/disabled. we don't want to federate with
|
// case 1: the room is banned/disabled. we don't want to federate with
|
||||||
// another server to leave, so we can't create an outlier PDU.
|
// another server to leave, so we can't create an outlier PDU.
|
||||||
None
|
None
|
||||||
} else if dont_have_room.await {
|
} else if dont_have_room.and(not_knocked).await {
|
||||||
// case 2: ask a remote server to assist us with leaving
|
// case 2: ask a remote server to assist us with leaving
|
||||||
// we always mark the room as left locally, regardless of if the
|
// we always mark the room as left locally, regardless of if the
|
||||||
// federated leave failed
|
// federated leave failed
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use conduwuit::{
|
|||||||
use futures::{FutureExt, StreamExt, future::join};
|
use futures::{FutureExt, StreamExt, future::join};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::membership::{
|
api::client::membership::{
|
||||||
get_member_events,
|
get_member_events::{self},
|
||||||
joined_members::{self, v3::RoomMember},
|
joined_members::{self, v3::RoomMember},
|
||||||
},
|
},
|
||||||
events::{
|
events::{
|
||||||
|
|||||||
+11
-21
@@ -1,8 +1,6 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result, at,
|
Err, Error, Result, at, debug_warn,
|
||||||
config::experiments::ToggledExperiment,
|
|
||||||
debug_warn,
|
|
||||||
matrix::{
|
matrix::{
|
||||||
event::{Event, Matches},
|
event::{Event, Matches},
|
||||||
pdu::PduCount,
|
pdu::PduCount,
|
||||||
@@ -317,29 +315,21 @@ where
|
|||||||
|
|
||||||
if server_ignored {
|
if server_ignored {
|
||||||
// the sender's server is ignored, so ignore this event
|
// the sender's server is ignored, so ignore this event
|
||||||
return if services.config.experiments.msc4406.is_enabled() {
|
return Err(Error::BadRequest(
|
||||||
Err(Error::BadRequest(
|
ErrorKind::SenderIgnored(SenderIgnoredErrorData::new()),
|
||||||
ErrorKind::SenderIgnored(SenderIgnoredErrorData::new()),
|
"The sender's server is ignored by this server.",
|
||||||
"The sender's server is ignored by this server.",
|
));
|
||||||
))
|
|
||||||
} else {
|
|
||||||
Err!(Request(NotFound("This event's sender's homeserver is ignored by this server.")))
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if user_ignored && !services.config.send_messages_from_ignored_users_to_client {
|
if user_ignored && !services.config.send_messages_from_ignored_users_to_client {
|
||||||
// the recipient of this PDU has the sender ignored, and we're not
|
// the recipient of this PDU has the sender ignored, and we're not
|
||||||
// configured to send ignored messages to clients
|
// configured to send ignored messages to clients
|
||||||
return if services.config.experiments.msc4406.is_enabled() {
|
return Err(Error::BadRequest(
|
||||||
Err(Error::BadRequest(
|
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
|
||||||
ErrorKind::SenderIgnored(SenderIgnoredErrorData::with_sender(
|
event.sender().to_owned(),
|
||||||
event.sender().to_owned(),
|
)),
|
||||||
)),
|
"You have ignored this sender.",
|
||||||
"You have ignored this sender.",
|
));
|
||||||
))
|
|
||||||
} else {
|
|
||||||
Err!(Request(NotFound("You have ignored the sender of this event.")))
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(false)
|
Ok(false)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ pub(super) mod push;
|
|||||||
pub(super) mod read_marker;
|
pub(super) mod read_marker;
|
||||||
pub(super) mod redact;
|
pub(super) mod redact;
|
||||||
pub(super) mod relations;
|
pub(super) mod relations;
|
||||||
pub(super) mod rendezvous;
|
|
||||||
pub(super) mod report;
|
pub(super) mod report;
|
||||||
pub(super) mod room;
|
pub(super) mod room;
|
||||||
pub(super) mod search;
|
pub(super) mod search;
|
||||||
@@ -70,7 +69,6 @@ pub(super) use push::*;
|
|||||||
pub(super) use read_marker::*;
|
pub(super) use read_marker::*;
|
||||||
pub(super) use redact::*;
|
pub(super) use redact::*;
|
||||||
pub(super) use relations::*;
|
pub(super) use relations::*;
|
||||||
pub(super) use rendezvous::*;
|
|
||||||
pub(super) use report::*;
|
pub(super) use report::*;
|
||||||
pub(super) use room::*;
|
pub(super) use room::*;
|
||||||
pub(super) use search::*;
|
pub(super) use search::*;
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
use axum::extract::State;
|
|
||||||
use conduwuit::{Err, Result};
|
|
||||||
use http::HeaderMap;
|
|
||||||
use ruma::api::client::rendezvous::{
|
|
||||||
create_rendezvous_session, delete_rendezvous_session, discover_rendezvous,
|
|
||||||
get_rendezvous_session, update_rendezvous_session,
|
|
||||||
};
|
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::{Ruma, router::ClientIdentity};
|
|
||||||
|
|
||||||
/// `GET /_matrix/client/msc4388/io.element.msc4388/rendezvous`
|
|
||||||
pub(crate) async fn discover_rendezvous_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<discover_rendezvous::msc4388::Request>,
|
|
||||||
) -> Result<discover_rendezvous::msc4388::Response> {
|
|
||||||
Ok(discover_rendezvous::msc4388::Response::new(rendezvous_available(
|
|
||||||
&services,
|
|
||||||
body.identity.as_ref(),
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `POST /_matrix/client/msc4388/io.element.msc4388/rendezvous/`
|
|
||||||
pub(crate) async fn create_rendezvous_session_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<create_rendezvous_session::msc4388::Request>,
|
|
||||||
) -> Result<create_rendezvous_session::msc4388::Response> {
|
|
||||||
if !rendezvous_available(&services, body.identity.as_ref()) {
|
|
||||||
return Err!(Request(Forbidden("You are not authorized to create a rendezvous session")));
|
|
||||||
}
|
|
||||||
|
|
||||||
services.rendezvous.create_session(body.data.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `PUT /_matrix/client/msc4388/io.element.msc4388/rendezvous/{id}/{txn_id}`
|
|
||||||
pub(crate) async fn update_rendezvous_session_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<update_rendezvous_session::msc4388::Request>,
|
|
||||||
) -> Result<update_rendezvous_session::msc4388::Response> {
|
|
||||||
services.rendezvous.update_session(
|
|
||||||
&body.id,
|
|
||||||
body.txn_id.clone(),
|
|
||||||
body.sequence_token.clone(),
|
|
||||||
body.data.clone(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `GET /_matrix/client/msc4388/io.element.msc4388/rendezvous/{id}`
|
|
||||||
pub(crate) async fn get_rendezvous_session_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
headers: HeaderMap,
|
|
||||||
body: Ruma<get_rendezvous_session::msc4388::Request>,
|
|
||||||
) -> Result<get_rendezvous_session::msc4388::Response> {
|
|
||||||
if let Some(mode) = headers.get("Sec-Fetch-Mode")
|
|
||||||
&& let Ok(mode) = mode.to_str()
|
|
||||||
&& mode == "navigate"
|
|
||||||
{
|
|
||||||
return Err!(Request(Forbidden(
|
|
||||||
"Rendezvous sessions do not accept browser navigation requests."
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
services.rendezvous.get_session(&body.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `DELETE /_matrix/client/msc4388/io.element.msc4388/rendezvous/{id}`
|
|
||||||
pub(crate) async fn delete_rendezvous_session_route(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
body: Ruma<delete_rendezvous_session::msc4388::Request>,
|
|
||||||
) -> Result<delete_rendezvous_session::msc4388::Response> {
|
|
||||||
services.rendezvous.delete_session(&body.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rendezvous_available(services: &Services, identity: Option<&ClientIdentity>) -> bool {
|
|
||||||
!services.config.require_auth_for_rendezvous || identity.is_some()
|
|
||||||
}
|
|
||||||
@@ -77,7 +77,7 @@ struct FullCreationContent {
|
|||||||
/// - Send events listed in initial state
|
/// - Send events listed in initial state
|
||||||
/// - Send events implied by `name` and `topic`
|
/// - Send events implied by `name` and `topic`
|
||||||
/// - Send invite events
|
/// - Send invite events
|
||||||
#[allow(clippy::large_unopt_stack_frames)]
|
#[allow(clippy::large_stack_frames)]
|
||||||
#[allow(clippy::cognitive_complexity)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
pub(crate) async fn create_room_route(
|
pub(crate) async fn create_room_route(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
|
|||||||
@@ -94,7 +94,8 @@ pub(crate) async fn room_initial_sync_route(
|
|||||||
.first()
|
.first()
|
||||||
.map(at!(0))
|
.map(at!(0))
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or_default(ToString::to_string);
|
.map(ToString::to_string)
|
||||||
|
.unwrap_or_default();
|
||||||
let start = events.last().map(at!(0)).as_ref().map(ToString::to_string);
|
let start = events.last().map(at!(0)).as_ref().map(ToString::to_string);
|
||||||
|
|
||||||
let chunk = events
|
let chunk = events
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ mod event;
|
|||||||
mod initial_sync;
|
mod initial_sync;
|
||||||
mod stripped_state;
|
mod stripped_state;
|
||||||
mod summary;
|
mod summary;
|
||||||
mod timestamp_to_event;
|
|
||||||
mod upgrade;
|
mod upgrade;
|
||||||
|
|
||||||
pub(crate) use self::{
|
pub(crate) use self::{
|
||||||
aliases::get_room_aliases_route, create::create_room_route, event::get_room_event_route,
|
aliases::get_room_aliases_route, create::create_room_route, event::get_room_event_route,
|
||||||
initial_sync::room_initial_sync_route, stripped_state::get_stripped_state_route,
|
initial_sync::room_initial_sync_route, stripped_state::get_stripped_state_route,
|
||||||
summary::get_room_summary, timestamp_to_event::get_event_by_timestamp_route,
|
summary::get_room_summary, upgrade::upgrade_room_route,
|
||||||
upgrade::upgrade_room_route,
|
|
||||||
};
|
};
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
use axum::extract::State;
|
|
||||||
use conduwuit::{Err, Event, Result, utils::stream::TryIgnore};
|
|
||||||
use futures::{StreamExt, pin_mut};
|
|
||||||
use ruma::api::client::room::get_event_by_timestamp;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
|
||||||
|
|
||||||
const MAX_CANDIDATES: usize = 20;
|
|
||||||
|
|
||||||
/// # `GET /_matrix/client/v1/rooms/{roomId}/timestamp_to_event`
|
|
||||||
///
|
|
||||||
/// Gets the ID of the event closest to the given timestamp, in the direction
|
|
||||||
/// specified by `dir`.
|
|
||||||
pub(crate) async fn get_event_by_timestamp_route(
|
|
||||||
State(ref services): State<crate::State>,
|
|
||||||
body: Ruma<get_event_by_timestamp::v1::Request>,
|
|
||||||
) -> Result<get_event_by_timestamp::v1::Response> {
|
|
||||||
let sender_user = body.identity.expect_sender_user()?;
|
|
||||||
let room_id = &body.room_id;
|
|
||||||
|
|
||||||
if !services
|
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.user_can_see_state_events(sender_user, room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
return Err!(Request(Forbidden("You don't have permission to view this room.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if !services.rooms.timeline.timestamp_index_ready().await {
|
|
||||||
return Err!(FeatureDisabled("timestamp_to_event"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let candidates = services
|
|
||||||
.rooms
|
|
||||||
.timeline
|
|
||||||
.pdus_by_timestamp(room_id, body.ts, body.dir)
|
|
||||||
.ignore_err()
|
|
||||||
.take(MAX_CANDIDATES);
|
|
||||||
|
|
||||||
pin_mut!(candidates);
|
|
||||||
while let Some((_, pdu)) = candidates.next().await {
|
|
||||||
if services
|
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.user_can_see_event(sender_user, room_id, pdu.event_id())
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
return Ok(get_event_by_timestamp::v1::Response::new(
|
|
||||||
pdu.event_id().to_owned(),
|
|
||||||
pdu.origin_server_ts(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Err!(Request(NotFound(
|
|
||||||
"Unable to find event from {} in direction {:?}",
|
|
||||||
body.ts.get(),
|
|
||||||
body.dir
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
@@ -64,7 +64,7 @@ pub(super) async fn load_joined_room(
|
|||||||
services: &Services,
|
services: &Services,
|
||||||
sync_context: SyncContext<'_>,
|
sync_context: SyncContext<'_>,
|
||||||
ref room_id: OwnedRoomId,
|
ref room_id: OwnedRoomId,
|
||||||
) -> Result<JoinedRoom> {
|
) -> Result<(JoinedRoom, DeviceListUpdates)> {
|
||||||
/*
|
/*
|
||||||
Building a sync response involves many steps which all depend on each other.
|
Building a sync response involves many steps which all depend on each other.
|
||||||
To parallelize the process as much as possible, each step is divided into its own function,
|
To parallelize the process as much as possible, each step is divided into its own function,
|
||||||
@@ -80,6 +80,7 @@ pub(super) async fn load_joined_room(
|
|||||||
sticky,
|
sticky,
|
||||||
summary,
|
summary,
|
||||||
notification_counts,
|
notification_counts,
|
||||||
|
device_list_updates,
|
||||||
},
|
},
|
||||||
) = try_join3(
|
) = try_join3(
|
||||||
build_account_data(services, sync_context, room_id),
|
build_account_data(services, sync_context, room_id),
|
||||||
@@ -116,7 +117,7 @@ pub(super) async fn load_joined_room(
|
|||||||
unread_thread_notifications: BTreeMap::new(),
|
unread_thread_notifications: BTreeMap::new(),
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(joined_room)
|
Ok((joined_room, device_list_updates))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collect changes to the syncing user's account data events.
|
/// Collect changes to the syncing user's account data events.
|
||||||
@@ -262,6 +263,7 @@ struct StateAndTimeline {
|
|||||||
sticky: Sticky,
|
sticky: Sticky,
|
||||||
summary: Option<RoomSummary>,
|
summary: Option<RoomSummary>,
|
||||||
notification_counts: Option<UnreadNotificationsCount>,
|
notification_counts: Option<UnreadNotificationsCount>,
|
||||||
|
device_list_updates: DeviceListUpdates,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn build_sticky_events(
|
async fn build_sticky_events(
|
||||||
@@ -375,14 +377,24 @@ async fn build_state_and_timeline(
|
|||||||
debug_warn!("timeline for newly joined room is empty");
|
debug_warn!("timeline for newly joined room is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
let summary = build_room_summary(
|
let (summary, device_list_updates) = try_join(
|
||||||
services,
|
build_room_summary(
|
||||||
sync_context,
|
services,
|
||||||
room_id,
|
sync_context,
|
||||||
shortstatehashes,
|
room_id,
|
||||||
&timeline,
|
shortstatehashes,
|
||||||
&state_events,
|
&timeline,
|
||||||
joined_since_last_sync,
|
&state_events,
|
||||||
|
joined_since_last_sync,
|
||||||
|
),
|
||||||
|
build_device_list_updates(
|
||||||
|
services,
|
||||||
|
sync_context,
|
||||||
|
room_id,
|
||||||
|
shortstatehashes,
|
||||||
|
&state_events,
|
||||||
|
joined_since_last_sync,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@@ -418,6 +430,7 @@ async fn build_state_and_timeline(
|
|||||||
sticky,
|
sticky,
|
||||||
summary,
|
summary,
|
||||||
notification_counts,
|
notification_counts,
|
||||||
|
device_list_updates,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,7 +800,8 @@ async fn build_room_summary(
|
|||||||
|
|
||||||
Ok(Some(assign!(RoomSummary::new(), {
|
Ok(Some(assign!(RoomSummary::new(), {
|
||||||
heroes: heroes
|
heroes: heroes
|
||||||
.map_or_default(|heroes| heroes.into_iter().collect()),
|
.map(|heroes| heroes.into_iter().collect())
|
||||||
|
.unwrap_or_default(),
|
||||||
joined_member_count: Some(ruma_from_u64(joined_member_count)),
|
joined_member_count: Some(ruma_from_u64(joined_member_count)),
|
||||||
invited_member_count: Some(ruma_from_u64(invited_member_count)),
|
invited_member_count: Some(ruma_from_u64(invited_member_count)),
|
||||||
})))
|
})))
|
||||||
@@ -840,34 +854,35 @@ async fn build_heroes(
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collect updates to users' device lists for E2EE in a joined room.
|
/// Collect updates to users' device lists for E2EE.
|
||||||
#[tracing::instrument(level = "debug", skip_all, fields(%room_id))]
|
#[tracing::instrument(level = "debug", skip_all)]
|
||||||
pub(super) async fn load_device_list_updates(
|
async fn build_device_list_updates(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
sync_context: SyncContext<'_>,
|
SyncContext {
|
||||||
room_id: &RoomId,
|
|
||||||
) -> Result<DeviceListUpdates> {
|
|
||||||
let SyncContext {
|
|
||||||
syncing_user,
|
syncing_user,
|
||||||
last_sync_end_count,
|
last_sync_end_count,
|
||||||
current_count,
|
current_count,
|
||||||
..
|
..
|
||||||
} = sync_context;
|
}: SyncContext<'_>,
|
||||||
|
room_id: &RoomId,
|
||||||
let mut device_list_updates = DeviceListUpdates::new();
|
ShortStateHashes { current_shortstatehash, .. }: ShortStateHashes,
|
||||||
|
state_events: &Vec<PduEvent>,
|
||||||
|
joined_since_last_sync: bool,
|
||||||
|
) -> Result<DeviceListUpdates> {
|
||||||
|
let is_encrypted_room = services
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.state_get(current_shortstatehash, &StateEventType::RoomEncryption, "")
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
// initial syncs don't include device updates, and rooms which aren't
|
// initial syncs don't include device updates, and rooms which aren't
|
||||||
// encrypted don't affect them, so return early in either of those cases
|
// encrypted don't affect them, so return early in either of those cases
|
||||||
if last_sync_end_count.is_none()
|
if last_sync_end_count.is_none() || !(is_encrypted_room.await) {
|
||||||
|| !services
|
return Ok(DeviceListUpdates::new());
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.is_encrypted_room(room_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
return Ok(device_list_updates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut device_list_updates = DeviceListUpdates::new();
|
||||||
|
|
||||||
// add users with changed keys to the `changed` list
|
// add users with changed keys to the `changed` list
|
||||||
services
|
services
|
||||||
.users
|
.users
|
||||||
@@ -878,56 +893,19 @@ pub(super) async fn load_device_list_updates(
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let shortstatehashes = fetch_shortstatehashes(services, sync_context, room_id).await?;
|
// add users who now share encrypted rooms to `changed` and
|
||||||
let ShortStateHashes {
|
// users who no longer share encrypted rooms to `left`
|
||||||
current_shortstatehash,
|
for state_event in state_events {
|
||||||
last_sync_end_shortstatehash,
|
if state_event.kind == RoomMember {
|
||||||
} = shortstatehashes;
|
let Some(content): Option<RoomMemberEventContent> = state_event.get_content().ok()
|
||||||
|
|
||||||
if check_joined_since_last_sync(services, shortstatehashes, sync_context).await? {
|
|
||||||
// the syncing user now shares an encrypted room with every member
|
|
||||||
services
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.room_members(room_id)
|
|
||||||
.ready_for_each(|user_id| {
|
|
||||||
device_list_updates.changed.insert(user_id);
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
} else if let Some(last_sync_end_shortstatehash) = last_sync_end_shortstatehash
|
|
||||||
&& last_sync_end_shortstatehash != current_shortstatehash
|
|
||||||
{
|
|
||||||
// add users who now share encrypted rooms to `changed` and
|
|
||||||
// users who no longer share encrypted rooms to `left`
|
|
||||||
let state_added = services
|
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.state_added((last_sync_end_shortstatehash, current_shortstatehash))
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
for (shortstatekey, _) in state_added {
|
|
||||||
let Ok((StateEventType::RoomMember, state_key)) = services
|
|
||||||
.rooms
|
|
||||||
.short
|
|
||||||
.get_statekey_from_short(shortstatekey)
|
|
||||||
.await
|
|
||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(user_id) = OwnedUserId::try_from(state_key.as_str()) else {
|
let Some(user_id): Option<OwnedUserId> = state_event
|
||||||
continue;
|
.state_key
|
||||||
};
|
.as_ref()
|
||||||
|
.and_then(|key| key.parse().ok())
|
||||||
let Ok(content): Result<RoomMemberEventContent> = services
|
|
||||||
.rooms
|
|
||||||
.state_accessor
|
|
||||||
.state_get_content(
|
|
||||||
current_shortstatehash,
|
|
||||||
&StateEventType::RoomMember,
|
|
||||||
user_id.as_str(),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
@@ -943,7 +921,7 @@ pub(super) async fn load_device_list_updates(
|
|||||||
| Leave if !shares_encrypted_room => {
|
| Leave if !shares_encrypted_room => {
|
||||||
device_list_updates.left.insert(user_id);
|
device_list_updates.left.insert(user_id);
|
||||||
},
|
},
|
||||||
| Join if shares_encrypted_room => {
|
| Join if joined_since_last_sync || shares_encrypted_room => {
|
||||||
device_list_updates.changed.insert(user_id);
|
device_list_updates.changed.insert(user_id);
|
||||||
},
|
},
|
||||||
| _ => (),
|
| _ => (),
|
||||||
|
|||||||
+21
-117
@@ -3,6 +3,7 @@ mod left;
|
|||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
cmp::{self},
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
@@ -20,7 +21,7 @@ use futures::{FutureExt, StreamExt, TryFutureExt, future::OptionFuture};
|
|||||||
use ruma::{
|
use ruma::{
|
||||||
DeviceId, OwnedUserId, RoomId, UserId,
|
DeviceId, OwnedUserId, RoomId, UserId,
|
||||||
api::client::{
|
api::client::{
|
||||||
filter::{self, FilterDefinition, RoomFilter},
|
filter::FilterDefinition,
|
||||||
sync::sync_events::{
|
sync::sync_events::{
|
||||||
self, DeviceLists,
|
self, DeviceLists,
|
||||||
v3::{
|
v3::{
|
||||||
@@ -38,17 +39,13 @@ use service::{
|
|||||||
account_data::AnyRawAccountDataEvent,
|
account_data::AnyRawAccountDataEvent,
|
||||||
rooms::lazy_loading::{self, MemberSet, Options as _},
|
rooms::lazy_loading::{self, MemberSet, Options as _},
|
||||||
};
|
};
|
||||||
use wildmatch::WildMatch;
|
|
||||||
|
|
||||||
use super::{load_timeline, share_encrypted_room};
|
use super::{load_timeline, share_encrypted_room};
|
||||||
use crate::{
|
use crate::{
|
||||||
Ruma,
|
Ruma,
|
||||||
client::{
|
client::{
|
||||||
is_ignored_invite,
|
is_ignored_invite,
|
||||||
sync::v3::{
|
sync::v3::{joined::load_joined_room, left::load_left_room},
|
||||||
joined::{load_device_list_updates, load_joined_room},
|
|
||||||
left::load_left_room,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
client_ip::ClientIp,
|
client_ip::ClientIp,
|
||||||
};
|
};
|
||||||
@@ -206,12 +203,7 @@ pub(crate) async fn sync_events_route(
|
|||||||
|
|
||||||
let mut wake_receiver = services.sync.subscribe_to_wake(sender_user);
|
let mut wake_receiver = services.sync.subscribe_to_wake(sender_user);
|
||||||
let response = build_sync_events(&services, &body).await?;
|
let response = build_sync_events(&services, &body).await?;
|
||||||
|
if body.body.full_state
|
||||||
let timeout_duration = body.body.timeout.unwrap_or_default();
|
|
||||||
// If the timeout is zero, request has full_state=true, or there's
|
|
||||||
// meaningful data to return, do so immediately.
|
|
||||||
if timeout_duration.is_zero()
|
|
||||||
|| body.body.full_state
|
|
||||||
|| !(response.rooms.is_empty()
|
|| !(response.rooms.is_empty()
|
||||||
&& response.presence.is_empty()
|
&& response.presence.is_empty()
|
||||||
&& response.account_data.is_empty()
|
&& response.account_data.is_empty()
|
||||||
@@ -221,15 +213,11 @@ pub(crate) async fn sync_events_route(
|
|||||||
return Ok(response);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, wait for a wake signal to rebuild changes. Cap timeout at 30
|
// Hang a few seconds so requests are not spammed
|
||||||
// seconds (this isn't specced, but a reasonable cap since most clients have
|
// Stop hanging if new info arrives
|
||||||
// a 30-second polling interval).
|
let default = Duration::from_secs(30);
|
||||||
let duration = timeout_duration.min(Duration::from_secs(30));
|
let duration = cmp::min(body.body.timeout.unwrap_or(default), default);
|
||||||
let mut shutdown_signal = services.server.signal.subscribe();
|
_ = tokio::time::timeout(duration, wake_receiver.changed()).await;
|
||||||
tokio::select! {
|
|
||||||
_ = tokio::time::timeout(duration, wake_receiver.changed()) => {},
|
|
||||||
_ = shutdown_signal.recv() => return Err!(Request(Unknown("Server is shutting down"), SERVICE_UNAVAILABLE)),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Retry returning data
|
// Retry returning data
|
||||||
build_sync_events(&services, &body).await
|
build_sync_events(&services, &body).await
|
||||||
@@ -283,47 +271,34 @@ pub(crate) async fn build_sync_events(
|
|||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.rooms_joined(syncing_user)
|
.rooms_joined(syncing_user)
|
||||||
.ready_filter(|room_id| room_selected(&filter.room, room_id))
|
|
||||||
.broad_filter_map(|room_id| async {
|
.broad_filter_map(|room_id| async {
|
||||||
let joined_room = load_joined_room(services, context, room_id.clone()).await;
|
let joined_room = load_joined_room(services, context, room_id.clone()).await;
|
||||||
|
|
||||||
match joined_room {
|
match joined_room {
|
||||||
| Ok(room) => Some((room_id, room)),
|
| Ok((room, updates)) => Some((room_id, room, updates)),
|
||||||
| Err(err) => {
|
| Err(err) => {
|
||||||
error!(?err, %room_id, "error loading joined room");
|
error!(?err, %room_id, "error loading joined room");
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.ready_fold(BTreeMap::new(), |mut joined_rooms, (room_id, joined_room)| {
|
.ready_fold(
|
||||||
if !joined_room.is_empty() {
|
(BTreeMap::new(), DeviceListUpdates::new()),
|
||||||
joined_rooms.insert(room_id, joined_room);
|
|(mut joined_rooms, mut all_updates), (room_id, joined_room, updates)| {
|
||||||
}
|
all_updates.merge(updates);
|
||||||
|
|
||||||
joined_rooms
|
if !joined_room.is_empty() {
|
||||||
});
|
joined_rooms.insert(room_id, joined_room);
|
||||||
|
}
|
||||||
|
|
||||||
// a filtered out room still contributes its device list updates
|
(joined_rooms, all_updates)
|
||||||
let device_list_updates = services
|
},
|
||||||
.rooms
|
);
|
||||||
.state_cache
|
|
||||||
.rooms_joined(syncing_user)
|
|
||||||
.broad_filter_map(|room_id| async move {
|
|
||||||
load_device_list_updates(services, context, &room_id)
|
|
||||||
.await
|
|
||||||
.inspect_err(|err| error!(?err, %room_id, "error loading device list updates"))
|
|
||||||
.ok()
|
|
||||||
})
|
|
||||||
.ready_fold(DeviceListUpdates::new(), |mut all_updates, updates| {
|
|
||||||
all_updates.merge(updates);
|
|
||||||
all_updates
|
|
||||||
});
|
|
||||||
|
|
||||||
let left_rooms = services
|
let left_rooms = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.rooms_left(syncing_user)
|
.rooms_left(syncing_user)
|
||||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
|
||||||
.broad_filter_map(|(room_id, leave_pdu)| async {
|
.broad_filter_map(|(room_id, leave_pdu)| async {
|
||||||
let left_room = load_left_room(services, context, room_id.clone(), leave_pdu).await;
|
let left_room = load_left_room(services, context, room_id.clone(), leave_pdu).await;
|
||||||
|
|
||||||
@@ -342,7 +317,6 @@ pub(crate) async fn build_sync_events(
|
|||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.rooms_invited(syncing_user)
|
.rooms_invited(syncing_user)
|
||||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
|
||||||
.wide_filter_map(async |(room_id, invite_state)| {
|
.wide_filter_map(async |(room_id, invite_state)| {
|
||||||
if is_ignored_invite(services, syncing_user, &room_id).await {
|
if is_ignored_invite(services, syncing_user, &room_id).await {
|
||||||
None
|
None
|
||||||
@@ -373,7 +347,6 @@ pub(crate) async fn build_sync_events(
|
|||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
.rooms_knocked(syncing_user)
|
.rooms_knocked(syncing_user)
|
||||||
.ready_filter(|(room_id, _)| room_selected(&filter.room, room_id))
|
|
||||||
.fold_default(|mut knocked_rooms: BTreeMap<_, _>, (room_id, knock_state)| async move {
|
.fold_default(|mut knocked_rooms: BTreeMap<_, _>, (room_id, knock_state)| async move {
|
||||||
let knock_count = services
|
let knock_count = services
|
||||||
.rooms
|
.rooms
|
||||||
@@ -403,13 +376,6 @@ pub(crate) async fn build_sync_events(
|
|||||||
.account_data
|
.account_data
|
||||||
.changes_since(None, syncing_user, last_sync_end_count, Some(current_count))
|
.changes_since(None, syncing_user, last_sync_end_count, Some(current_count))
|
||||||
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Global))
|
.ready_filter_map(|e| extract_variant!(e, AnyRawAccountDataEvent::Global))
|
||||||
.ready_filter(|event| {
|
|
||||||
event
|
|
||||||
.get_field::<String>("type")
|
|
||||||
.ok()
|
|
||||||
.flatten()
|
|
||||||
.is_some_and(|event_type| type_selected(&filter.account_data, &event_type))
|
|
||||||
})
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let to_device_events = services
|
let to_device_events = services
|
||||||
@@ -438,8 +404,7 @@ pub(crate) async fn build_sync_events(
|
|||||||
.list_unused_fallback_key_types(syncing_user, syncing_device);
|
.list_unused_fallback_key_types(syncing_user, syncing_device);
|
||||||
|
|
||||||
let (
|
let (
|
||||||
joined_rooms,
|
(joined_rooms, mut device_list_updates),
|
||||||
mut device_list_updates,
|
|
||||||
left_rooms,
|
left_rooms,
|
||||||
invited_rooms,
|
invited_rooms,
|
||||||
knocked_rooms,
|
knocked_rooms,
|
||||||
@@ -452,7 +417,6 @@ pub(crate) async fn build_sync_events(
|
|||||||
) = async {
|
) = async {
|
||||||
futures::join!(
|
futures::join!(
|
||||||
joined_rooms,
|
joined_rooms,
|
||||||
device_list_updates,
|
|
||||||
left_rooms,
|
left_rooms,
|
||||||
invited_rooms,
|
invited_rooms,
|
||||||
knocked_rooms,
|
knocked_rooms,
|
||||||
@@ -501,24 +465,6 @@ pub(crate) async fn build_sync_events(
|
|||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn room_selected(filter: &RoomFilter, room_id: &RoomId) -> bool {
|
|
||||||
!filter.not_rooms.iter().any(|not_room| not_room == room_id)
|
|
||||||
&& filter
|
|
||||||
.rooms
|
|
||||||
.as_ref()
|
|
||||||
.is_none_or(|rooms| rooms.iter().any(|room| room == room_id))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn type_selected(filter: &filter::Filter, event_type: &str) -> bool {
|
|
||||||
let matches = |pattern: &String| WildMatch::new(pattern).matches(event_type);
|
|
||||||
|
|
||||||
!filter.not_types.iter().any(matches)
|
|
||||||
&& filter
|
|
||||||
.types
|
|
||||||
.as_ref()
|
|
||||||
.is_none_or(|types| types.iter().any(matches))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tracing::instrument(name = "presence", level = "debug", skip_all)]
|
#[tracing::instrument(name = "presence", level = "debug", skip_all)]
|
||||||
async fn process_presence_updates(
|
async fn process_presence_updates(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
@@ -582,45 +528,3 @@ async fn prepare_lazily_loaded_members(
|
|||||||
|
|
||||||
lazily_loaded_members
|
lazily_loaded_members
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use ruma::{owned_room_id, room_id};
|
|
||||||
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rooms_filter_selects_rooms() {
|
|
||||||
let room_id = room_id!("!a:example.com");
|
|
||||||
let mut filter = RoomFilter::default();
|
|
||||||
assert!(room_selected(&filter, room_id));
|
|
||||||
|
|
||||||
filter.rooms = Some(Vec::new());
|
|
||||||
assert!(!room_selected(&filter, room_id));
|
|
||||||
|
|
||||||
filter.rooms = Some(vec![room_id.to_owned()]);
|
|
||||||
assert!(room_selected(&filter, room_id));
|
|
||||||
|
|
||||||
filter.not_rooms = vec![owned_room_id!("!a:example.com")];
|
|
||||||
assert!(!room_selected(&filter, room_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn types_filter_selects_account_data() {
|
|
||||||
let mut filter = filter::Filter::default();
|
|
||||||
assert!(type_selected(&filter, "m.direct"));
|
|
||||||
|
|
||||||
filter.types = Some(Vec::new());
|
|
||||||
assert!(!type_selected(&filter, "m.direct"));
|
|
||||||
|
|
||||||
filter.types = Some(vec!["m.direct".to_owned()]);
|
|
||||||
assert!(type_selected(&filter, "m.direct"));
|
|
||||||
|
|
||||||
filter.types = Some(vec!["m.*".to_owned()]);
|
|
||||||
assert!(type_selected(&filter, "m.direct"));
|
|
||||||
assert!(!type_selected(&filter, "im.ponies.user_emotes"));
|
|
||||||
|
|
||||||
filter.not_types = vec!["m.direct".to_owned()];
|
|
||||||
assert!(!type_selected(&filter, "m.direct"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,9 @@ use conduwuit::{
|
|||||||
};
|
};
|
||||||
use futures::{FutureExt, StreamExt, pin_mut};
|
use futures::{FutureExt, StreamExt, pin_mut};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::user_directory::search_users, assign, events::room::join_rules::JoinRule,
|
api::client::user_directory::search_users::{self},
|
||||||
|
assign,
|
||||||
|
events::room::join_rules::JoinRule,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result};
|
use conduwuit::{Err, Result};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::client::{
|
api::client::discovery::{
|
||||||
discovery::{
|
discover_homeserver::{self, HomeserverInfo},
|
||||||
discover_homeserver::{self, HomeserverInfo},
|
discover_policy_server, discover_support,
|
||||||
discover_policy_server, discover_support,
|
|
||||||
},
|
|
||||||
rtc,
|
|
||||||
},
|
},
|
||||||
assign,
|
assign,
|
||||||
};
|
};
|
||||||
@@ -40,25 +37,17 @@ pub(crate) async fn well_known_client(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /_matrix/client/v1/rtc/transports`
|
/// # `GET /_matrix/client/v1/rtc/transports`
|
||||||
///
|
|
||||||
/// Returns the list of MatrixRTC transports configured for this homeserver,
|
|
||||||
/// implementing the stable version of MSC4143.
|
|
||||||
pub(crate) async fn get_rtc_transports(
|
|
||||||
State(services): State<crate::State>,
|
|
||||||
_body: Ruma<rtc::transports::v1::Request>,
|
|
||||||
) -> Result<rtc::transports::v1::Response> {
|
|
||||||
Ok(rtc::transports::v1::Response::new(services.config.matrix_rtc.foci.clone()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # `GET /_matrix/client/unstable/org.matrix.msc4143/rtc/transports`
|
/// # `GET /_matrix/client/unstable/org.matrix.msc4143/rtc/transports`
|
||||||
///
|
///
|
||||||
/// Unstable version of [`get_rtc_transports`], which names the response field
|
/// Returns the list of MatrixRTC foci (transports) configured for this
|
||||||
/// `rtc_transports` instead of `transports`.
|
/// homeserver, implementing MSC4143.
|
||||||
pub(crate) async fn get_rtc_transports_unstable(
|
pub(crate) async fn get_rtc_transports(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
_body: Ruma<rtc::transports::msc4143::Request>,
|
_body: Ruma<ruma::api::client::rtc::transports::msc4143::Request>,
|
||||||
) -> Result<rtc::transports::msc4143::Response> {
|
) -> Result<ruma::api::client::rtc::transports::msc4143::Response> {
|
||||||
Ok(rtc::transports::msc4143::Response::new(services.config.matrix_rtc.foci.clone()))
|
Ok(ruma::api::client::rtc::transports::msc4143::Response::new(
|
||||||
|
services.config.matrix_rtc.foci.clone(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /.well-known/matrix/support`
|
/// # `GET /.well-known/matrix/support`
|
||||||
|
|||||||
@@ -16,3 +16,6 @@ pub mod client_ip;
|
|||||||
pub mod admin;
|
pub mod admin;
|
||||||
|
|
||||||
pub(crate) use self::router::{Ruma, RumaResponse, State};
|
pub(crate) use self::router::{Ruma, RumaResponse, State};
|
||||||
|
|
||||||
|
conduwuit::mod_ctor! {}
|
||||||
|
conduwuit::mod_dtor! {}
|
||||||
+7
-21
@@ -10,7 +10,7 @@ use axum::{
|
|||||||
response::{IntoResponse, Redirect},
|
response::{IntoResponse, Redirect},
|
||||||
routing::{any, get},
|
routing::{any, get},
|
||||||
};
|
};
|
||||||
use conduwuit::{config::experiments::ToggledExperiment, err};
|
use conduwuit::err;
|
||||||
pub(super) use conduwuit_service::state::State;
|
pub(super) use conduwuit_service::state::State;
|
||||||
use http::{Uri, uri};
|
use http::{Uri, uri};
|
||||||
|
|
||||||
@@ -52,7 +52,6 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&client::set_pushrule_actions_route)
|
.ruma_route(&client::set_pushrule_actions_route)
|
||||||
.ruma_route(&client::delete_pushrule_route)
|
.ruma_route(&client::delete_pushrule_route)
|
||||||
.ruma_route(&client::get_room_event_route)
|
.ruma_route(&client::get_room_event_route)
|
||||||
.ruma_route(&client::get_event_by_timestamp_route)
|
|
||||||
.ruma_route(&client::get_room_aliases_route)
|
.ruma_route(&client::get_room_aliases_route)
|
||||||
.ruma_route(&client::get_filter_route)
|
.ruma_route(&client::get_filter_route)
|
||||||
.ruma_route(&client::create_filter_route)
|
.ruma_route(&client::create_filter_route)
|
||||||
@@ -163,6 +162,10 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&client::update_device_route)
|
.ruma_route(&client::update_device_route)
|
||||||
.ruma_route(&client::delete_device_route)
|
.ruma_route(&client::delete_device_route)
|
||||||
.ruma_route(&client::delete_devices_route)
|
.ruma_route(&client::delete_devices_route)
|
||||||
|
.ruma_route(&client::put_dehydrated_device_route)
|
||||||
|
.ruma_route(&client::delete_dehydrated_device_route)
|
||||||
|
.ruma_route(&client::get_dehydrated_device_route)
|
||||||
|
.ruma_route(&client::get_dehydrated_events_route)
|
||||||
.ruma_route(&client::get_tags_route)
|
.ruma_route(&client::get_tags_route)
|
||||||
.ruma_route(&client::update_tag_route)
|
.ruma_route(&client::update_tag_route)
|
||||||
.ruma_route(&client::delete_tag_route)
|
.ruma_route(&client::delete_tag_route)
|
||||||
@@ -181,6 +184,7 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&client::get_mutual_rooms_unstable_route)
|
.ruma_route(&client::get_mutual_rooms_unstable_route)
|
||||||
.ruma_route(&client::get_mutual_rooms_route)
|
.ruma_route(&client::get_mutual_rooms_route)
|
||||||
.ruma_route(&client::get_room_summary)
|
.ruma_route(&client::get_room_summary)
|
||||||
|
.ruma_route(&client::get_stripped_state_route)
|
||||||
.ruma_route(&client::get_suspended_status)
|
.ruma_route(&client::get_suspended_status)
|
||||||
.ruma_route(&client::put_suspended_status)
|
.ruma_route(&client::put_suspended_status)
|
||||||
.ruma_route(&client::get_lock_status)
|
.ruma_route(&client::get_lock_status)
|
||||||
@@ -189,28 +193,12 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&client::well_known_client)
|
.ruma_route(&client::well_known_client)
|
||||||
.ruma_route(&client::well_known_policy_server)
|
.ruma_route(&client::well_known_policy_server)
|
||||||
.ruma_route(&client::get_rtc_transports)
|
.ruma_route(&client::get_rtc_transports)
|
||||||
.ruma_route(&client::get_rtc_transports_unstable)
|
|
||||||
.ruma_route(&client::room_initial_sync_route)
|
.ruma_route(&client::room_initial_sync_route)
|
||||||
.ruma_route(&client::discover_rendezvous_route)
|
|
||||||
.ruma_route(&client::create_rendezvous_session_route)
|
|
||||||
.ruma_route(&client::update_rendezvous_session_route)
|
|
||||||
.ruma_route(&client::get_rendezvous_session_route)
|
|
||||||
.ruma_route(&client::delete_rendezvous_session_route)
|
|
||||||
.ruma_route(&client::get_authorization_server_metadata_route)
|
.ruma_route(&client::get_authorization_server_metadata_route)
|
||||||
.merge(client::oauth::router(state))
|
.merge(client::oauth::router(state))
|
||||||
.route("/_continuwuity/server_version", get(client::continuwuity_server_version))
|
.route("/_continuwuity/server_version", get(client::continuwuity_server_version))
|
||||||
.ruma_route(&admin::rooms::ban::ban_room)
|
.ruma_route(&admin::rooms::ban::ban_room)
|
||||||
.ruma_route(&admin::rooms::list::list_rooms);
|
.ruma_route(&admin::rooms::list::list_rooms);
|
||||||
if config.experiments.msc3814.is_enabled() {
|
|
||||||
router = router
|
|
||||||
.ruma_route(&client::put_dehydrated_device_route)
|
|
||||||
.ruma_route(&client::delete_dehydrated_device_route)
|
|
||||||
.ruma_route(&client::get_dehydrated_device_route)
|
|
||||||
.ruma_route(&client::get_dehydrated_events_route);
|
|
||||||
}
|
|
||||||
if config.experiments.msc4560.is_enabled() {
|
|
||||||
router = router.ruma_route(&client::get_stripped_state_route);
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.allow_prometheus_metrics {
|
if config.allow_prometheus_metrics {
|
||||||
router = router.route("/_continuwuity/metrics", get(client::continuwuity_metrics));
|
router = router.route("/_continuwuity/metrics", get(client::continuwuity_metrics));
|
||||||
@@ -242,13 +230,11 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&server::get_keys_route)
|
.ruma_route(&server::get_keys_route)
|
||||||
.ruma_route(&server::claim_keys_route)
|
.ruma_route(&server::claim_keys_route)
|
||||||
.ruma_route(&server::get_hierarchy_route)
|
.ruma_route(&server::get_hierarchy_route)
|
||||||
|
.ruma_route(&server::get_stripped_state_route)
|
||||||
.ruma_route(&server::well_known_server)
|
.ruma_route(&server::well_known_server)
|
||||||
.ruma_route(&server::get_content_route)
|
.ruma_route(&server::get_content_route)
|
||||||
.ruma_route(&server::get_content_thumbnail_route)
|
.ruma_route(&server::get_content_thumbnail_route)
|
||||||
.route("/_continuwuity/local_user_count", get(client::continuwuity_local_user_count));
|
.route("/_continuwuity/local_user_count", get(client::continuwuity_local_user_count));
|
||||||
if config.experiments.msc4560.is_enabled() {
|
|
||||||
router = router.ruma_route(&server::get_stripped_state_route);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
router = router
|
router = router
|
||||||
.route("/_matrix/federation/{*path}", any(federation_disabled))
|
.route("/_matrix/federation/{*path}", any(federation_disabled))
|
||||||
|
|||||||
+9
-13
@@ -5,9 +5,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Error, Result,
|
Err, Error, Result, err,
|
||||||
config::experiments::ToggledExperiment,
|
|
||||||
err,
|
|
||||||
utils::{IterStream, millis_since_unix_epoch},
|
utils::{IterStream, millis_since_unix_epoch},
|
||||||
};
|
};
|
||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
@@ -340,19 +338,17 @@ async fn check_access_token(
|
|||||||
.map(Box::new);
|
.map(Box::new);
|
||||||
|
|
||||||
// Make sure the user has the right scopes to use the route
|
// Make sure the user has the right scopes to use the route
|
||||||
let mut user_scopes = if let Some(session_info) = &session_info {
|
let user_scopes = if let Some(session_info) = &session_info {
|
||||||
session_info.scopes()
|
session_info.scopes()
|
||||||
} else {
|
} else {
|
||||||
BTreeSet::from_iter([OAuthClientScope::ApiFullAccess])
|
let mut scopes = BTreeSet::from_iter([OAuthClientScope::ApiFullAccess]);
|
||||||
|
|
||||||
|
if services.admin.user_is_admin(&sender_user).await {
|
||||||
|
scopes.insert(OAuthClientScope::ServerAdministration);
|
||||||
|
}
|
||||||
|
|
||||||
|
scopes
|
||||||
};
|
};
|
||||||
if (!services.config.experiments.msc4484.is_enabled() || session_info.is_none())
|
|
||||||
&& services.admin.user_is_admin(&sender_user).await
|
|
||||||
{
|
|
||||||
// This is required to make sure admin APIs still work when msc4484
|
|
||||||
// is disabled.
|
|
||||||
// https://forgejo.ellis.link/continuwuation/continuwuity/pulls/2533#issuecomment-40042
|
|
||||||
user_scopes.insert(OAuthClientScope::ServerAdministration);
|
|
||||||
}
|
|
||||||
|
|
||||||
if !required_scopes
|
if !required_scopes
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
+63
-92
@@ -12,8 +12,8 @@ use conduwuit::{
|
|||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId,
|
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedUserId, ServerName,
|
||||||
ServerName, UserId,
|
UserId,
|
||||||
api::{
|
api::{
|
||||||
error::{ErrorKind, IncompatibleRoomVersionErrorData},
|
error::{ErrorKind, IncompatibleRoomVersionErrorData},
|
||||||
federation::membership::{RawStrippedState, create_invite},
|
federation::membership::{RawStrippedState, create_invite},
|
||||||
@@ -22,7 +22,6 @@ use ruma::{
|
|||||||
room_version_rules::RoomVersionRules,
|
room_version_rules::RoomVersionRules,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use service::Services;
|
|
||||||
|
|
||||||
use crate::{Ruma, server::utils::validate_any_membership_event};
|
use crate::{Ruma, server::utils::validate_any_membership_event};
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ pub(crate) async fn create_invite_route(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn create_invite(
|
async fn create_invite(
|
||||||
services: &Services,
|
services: &crate::State,
|
||||||
body: Ruma<create_invite::v2::Request>,
|
body: Ruma<create_invite::v2::Request>,
|
||||||
) -> Result<create_invite::v2::Response> {
|
) -> Result<create_invite::v2::Response> {
|
||||||
if !services.server.supported_room_version(&body.room_version) {
|
if !services.server.supported_room_version(&body.room_version) {
|
||||||
@@ -80,7 +79,7 @@ async fn create_invite(
|
|||||||
via=?body.via,
|
via=?body.via,
|
||||||
"Validating invite room state for invite request"
|
"Validating invite room state for invite request"
|
||||||
);
|
);
|
||||||
let (create_event_id, state) = validate_partial_membership_state(
|
let (create_event_id, state) = validate_invite_state(
|
||||||
services,
|
services,
|
||||||
&body.invite_room_state,
|
&body.invite_room_state,
|
||||||
&room_version_rules,
|
&room_version_rules,
|
||||||
@@ -261,7 +260,7 @@ async fn create_invite(
|
|||||||
///
|
///
|
||||||
/// [spec]: https://spec.matrix.org/v1.19/server-server-api/#put_matrixfederationv2inviteroomideventid
|
/// [spec]: https://spec.matrix.org/v1.19/server-server-api/#put_matrixfederationv2inviteroomideventid
|
||||||
async fn validate_invite_membership_event(
|
async fn validate_invite_membership_event(
|
||||||
services: &Services,
|
services: &crate::State,
|
||||||
body: &serde_json::value::RawValue,
|
body: &serde_json::value::RawValue,
|
||||||
room_version_rules: &RoomVersionRules,
|
room_version_rules: &RoomVersionRules,
|
||||||
origin: &ServerName,
|
origin: &ServerName,
|
||||||
@@ -300,111 +299,83 @@ async fn validate_invite_membership_event(
|
|||||||
Ok((pdu, sender_user, recipient_user))
|
Ok((pdu, sender_user, recipient_user))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Validates a single event from partial membership state (`invite_room_state`
|
|
||||||
/// or `knock_room_state`), returning its event ID, `(event_type, state_key)`,
|
|
||||||
/// and parsed canonical JSON.
|
|
||||||
pub(crate) async fn validate_partial_membership_event(
|
|
||||||
services: &Services,
|
|
||||||
event: &RawStrippedState,
|
|
||||||
room_version_rules: &RoomVersionRules,
|
|
||||||
room_id: &RoomId,
|
|
||||||
idx: usize,
|
|
||||||
) -> Result<(OwnedEventId, (StateEventType, StateKey), CanonicalJsonObject)> {
|
|
||||||
// Stripped state hasn't been sent over federation since v1.16.
|
|
||||||
let RawStrippedState::Pdu(raw_pdu) = event else {
|
|
||||||
debug!(%idx, "Partial membership state event is not a PDU");
|
|
||||||
return Err!(Request(InvalidParam(
|
|
||||||
"PDU in partial membership state (index {idx}) violates the room event format"
|
|
||||||
)));
|
|
||||||
};
|
|
||||||
let (state_event_room_id, state_event_id, state_event_json) = services
|
|
||||||
.rooms
|
|
||||||
.event_handler
|
|
||||||
.parse_incoming_pdu(raw_pdu, Some(room_version_rules))
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
err!(Request(InvalidParam(debug_warn!(
|
|
||||||
"Invalid PDU in partial membership state: {e}"
|
|
||||||
))))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
if state_event_room_id != room_id {
|
|
||||||
return Err!(Request(InvalidParam(debug_warn!(
|
|
||||||
%state_event_room_id,
|
|
||||||
%room_id,
|
|
||||||
"PDU in partial membership state ({state_event_id}) belongs to the wrong room"
|
|
||||||
))));
|
|
||||||
}
|
|
||||||
|
|
||||||
services
|
|
||||||
.server_keys
|
|
||||||
.verify_event_json(&state_event_json, room_version_rules)
|
|
||||||
.await
|
|
||||||
.map_err(|e| {
|
|
||||||
err!(Request(InvalidParam(
|
|
||||||
"Signature verification failed on partial membership state event: {e}"
|
|
||||||
)))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let Some(state_key) = state_event_json.get("state_key").and_then(|k| k.as_str()) else {
|
|
||||||
return Err!(Request(InvalidParam(debug_info!(
|
|
||||||
"PDU in partial membership state ({state_event_id}) is not a state event"
|
|
||||||
))));
|
|
||||||
};
|
|
||||||
let Some(event_type) = state_event_json.get("type").and_then(|k| k.as_str()) else {
|
|
||||||
return Err!(Request(InvalidParam(debug_warn!(
|
|
||||||
"PDU in partial membership state ({state_event_id}) is not an event?"
|
|
||||||
))));
|
|
||||||
};
|
|
||||||
|
|
||||||
let key = StateEventType::from(event_type).with_state_key(state_key);
|
|
||||||
if key.0 == StateEventType::RoomCreate {
|
|
||||||
// Ensure this is a legal create event.
|
|
||||||
let pdu_event = PduEvent::from_id_val(&state_event_id, state_event_json.clone())
|
|
||||||
.expect("must be able to create pdu event from event json");
|
|
||||||
debug!("Validating discovered create event in partial membership room state");
|
|
||||||
validate_invite_create_event(&pdu_event, room_version_rules).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok((state_event_id, key, state_event_json))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Validates the *invite state* of an invite request, per the steps listed
|
/// Validates the *invite state* of an invite request, per the steps listed
|
||||||
/// under the endpoint's [spec].
|
/// under the endpoint's [spec].
|
||||||
///
|
///
|
||||||
/// Returns the create event's event ID, and the partial state map.
|
/// Returns the create event's event ID, and the partial state map.
|
||||||
///
|
///
|
||||||
/// [spec]: https://spec.matrix.org/v1.19/server-server-api/#put_matrixfederationv2inviteroomideventid
|
/// [spec]: https://spec.matrix.org/v1.19/server-server-api/#put_matrixfederationv2inviteroomideventid
|
||||||
pub(crate) async fn validate_partial_membership_state(
|
async fn validate_invite_state(
|
||||||
services: &Services,
|
services: &crate::State,
|
||||||
invite_state: &[RawStrippedState],
|
invite_state: &[RawStrippedState],
|
||||||
room_version_rules: &RoomVersionRules,
|
room_version_rules: &RoomVersionRules,
|
||||||
room_id: OwnedRoomId,
|
room_id: OwnedRoomId,
|
||||||
) -> Result<(OwnedEventId, HashMap<(StateEventType, StateKey), CanonicalJsonObject>)> {
|
) -> Result<(OwnedEventId, HashMap<(StateEventType, StateKey), CanonicalJsonObject>)> {
|
||||||
trace!(?invite_state, "Raw partial membership state");
|
trace!(?invite_state, "Raw invite state");
|
||||||
let mut invite_state_map: HashMap<(StateEventType, StateKey), _> =
|
let mut invite_state_map: HashMap<(StateEventType, StateKey), _> =
|
||||||
HashMap::with_capacity(invite_state.len());
|
HashMap::with_capacity(invite_state.len());
|
||||||
let mut create_event_id: Option<OwnedEventId> = None;
|
let mut create_event_id: Option<OwnedEventId> = None;
|
||||||
|
|
||||||
for (idx, invite_state_event) in invite_state.iter().enumerate() {
|
for (idx, invite_state_event) in invite_state.iter().cloned().enumerate() {
|
||||||
trace!(%idx, ?invite_state_event, "Partial membership state event");
|
trace!(%idx, ?invite_state_event, "Invite state event");
|
||||||
let (state_event_id, key, state_event_json) = validate_partial_membership_event(
|
// Stripped state hasn't been sent over federation since v1.16.
|
||||||
services,
|
let RawStrippedState::Pdu(raw_pdu) = invite_state_event else {
|
||||||
invite_state_event,
|
debug!(%idx, "Invite state event is not a PDU");
|
||||||
room_version_rules,
|
return Err!(Request(InvalidParam(
|
||||||
&room_id,
|
"PDU in invite state (index {idx}) violates the room event format"
|
||||||
idx,
|
)));
|
||||||
)
|
};
|
||||||
.await?;
|
let (state_event_room_id, state_event_id, state_event_json) = services
|
||||||
|
.rooms
|
||||||
|
.event_handler
|
||||||
|
.parse_incoming_pdu(&raw_pdu, Some(room_version_rules))
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
err!(Request(InvalidParam(debug_warn!("Invalid PDU in invite state: {e}"))))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
if state_event_room_id != room_id {
|
||||||
|
return Err!(Request(InvalidParam(debug_warn!(
|
||||||
|
%state_event_room_id,
|
||||||
|
%room_id,
|
||||||
|
"PDU in invite state ({state_event_id}) belongs to the wrong room"
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
services
|
||||||
|
.server_keys
|
||||||
|
.verify_event_json(&state_event_json, room_version_rules)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
err!(Request(InvalidParam("Signature verification failed on invite event: {e}")))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let Some(state_key) = state_event_json.get("state_key").and_then(|k| k.as_str()) else {
|
||||||
|
return Err!(Request(InvalidParam(debug_info!(
|
||||||
|
"PDU in invite state ({state_event_id}) is not a state event"
|
||||||
|
))));
|
||||||
|
};
|
||||||
|
let Some(event_type) = state_event_json.get("type").and_then(|k| k.as_str()) else {
|
||||||
|
return Err!(Request(InvalidParam(debug_warn!(
|
||||||
|
"PDU in invite state ({state_event_id}) is not an event?"
|
||||||
|
))));
|
||||||
|
};
|
||||||
|
|
||||||
|
let key = StateEventType::from(event_type).with_state_key(state_key);
|
||||||
match invite_state_map.entry(key) {
|
match invite_state_map.entry(key) {
|
||||||
| Entry::Occupied(entry) =>
|
| Entry::Occupied(entry) =>
|
||||||
return Err!(Request(InvalidParam(
|
return Err!(Request(InvalidParam(
|
||||||
"Duplicate state events in partial membership state for state key: {:?}",
|
"Duplicate state events in invite state for state key: {:?}",
|
||||||
entry.key(),
|
entry.key(),
|
||||||
))),
|
))),
|
||||||
| Entry::Vacant(entry) => {
|
| Entry::Vacant(entry) => {
|
||||||
if entry.key().0 == StateEventType::RoomCreate {
|
if entry.key().0 == StateEventType::RoomCreate {
|
||||||
|
// Ensure this is a legal create event.
|
||||||
|
let pdu_event =
|
||||||
|
PduEvent::from_id_val(&state_event_id, state_event_json.clone())
|
||||||
|
.expect("must be able to create pdu event from event json");
|
||||||
|
debug!("Validating discovered create event in invite room state");
|
||||||
|
validate_invite_create_event(&pdu_event, room_version_rules).await?;
|
||||||
create_event_id = Some(state_event_id);
|
create_event_id = Some(state_event_id);
|
||||||
}
|
}
|
||||||
entry.insert(state_event_json);
|
entry.insert(state_event_json);
|
||||||
@@ -414,7 +385,7 @@ pub(crate) async fn validate_partial_membership_state(
|
|||||||
let Some(create_event_id) = create_event_id else {
|
let Some(create_event_id) = create_event_id else {
|
||||||
return Err!(Request(InvalidParam(debug_warn!(
|
return Err!(Request(InvalidParam(debug_warn!(
|
||||||
parsed_state=?invite_state_map,
|
parsed_state=?invite_state_map,
|
||||||
"Partial membership state does not contain the m.room.create event"
|
"Invite state does not contain the m.room.create event"
|
||||||
))));
|
))));
|
||||||
};
|
};
|
||||||
invite_state_map.iter().try_for_each(|(key, event_json)| {
|
invite_state_map.iter().try_for_each(|(key, event_json)| {
|
||||||
@@ -425,7 +396,7 @@ pub(crate) async fn validate_partial_membership_state(
|
|||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
err!(Request(InvalidParam(
|
err!(Request(InvalidParam(
|
||||||
"PDU in partial membership state for {key:?} violates the room event format: {e}"
|
"PDU in invite state for {key:?} violates the room event format: {e}"
|
||||||
)))
|
)))
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
@@ -443,7 +414,7 @@ struct MFederate {
|
|||||||
///
|
///
|
||||||
/// 1. It passes auth checks (aka is valid)
|
/// 1. It passes auth checks (aka is valid)
|
||||||
/// 2. The room is federated (there's no point persisting unfederated rooms)
|
/// 2. The room is federated (there's no point persisting unfederated rooms)
|
||||||
pub(crate) async fn validate_invite_create_event(
|
async fn validate_invite_create_event(
|
||||||
pdu: &PduEvent,
|
pdu: &PduEvent,
|
||||||
room_version_rules: &RoomVersionRules,
|
room_version_rules: &RoomVersionRules,
|
||||||
) -> Result {
|
) -> Result {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub(crate) async fn get_server_keys_route(
|
|||||||
// We need to verify that this response is still trusted based on
|
// We need to verify that this response is still trusted based on
|
||||||
// the current configuration. It's possible we got this response
|
// the current configuration. It's possible we got this response
|
||||||
// from a notary who we no longer trust.
|
// from a notary who we no longer trust.
|
||||||
if resp.parsed.valid_until_ts > in_one_week() {
|
if resp.valid_until_ts > in_one_week() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let trusted = services.config.trusted_servers.iter().any(|notary| {
|
let trusted = services.config.trusted_servers.iter().any(|notary| {
|
||||||
@@ -47,8 +47,8 @@ pub(crate) async fn get_server_keys_route(
|
|||||||
if !trusted {
|
if !trusted {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (old_key_id, old_key) in resp.parsed.old_verify_keys {
|
for (old_key_id, old_key) in resp.old_verify_keys {
|
||||||
if old_key.expired_ts > resp.parsed.valid_until_ts {
|
if old_key.expired_ts > resp.valid_until_ts {
|
||||||
// This key expired in the future which is probably illegal
|
// This key expired in the future which is probably illegal
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ pub(crate) async fn create_join_event_template_route(
|
|||||||
.get_member(&body.room_id, &body.user_id)
|
.get_member(&body.room_id, &body.user_id)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.map_or(MembershipState::Leave, |content| content.membership);
|
.map_or_else(|| MembershipState::Leave, |content| content.membership);
|
||||||
|
|
||||||
let join_authorized_via_users_server: Option<OwnedUserId> = {
|
let join_authorized_via_users_server: Option<OwnedUserId> = {
|
||||||
if matches!(
|
if matches!(
|
||||||
|
|||||||
+27
-52
@@ -44,7 +44,10 @@ use ruma::{
|
|||||||
to_device::DeviceIdOrAllDevices,
|
to_device::DeviceIdOrAllDevices,
|
||||||
};
|
};
|
||||||
use service::{
|
use service::{
|
||||||
rooms::event_handler::{DagBuilderTree, build_local_dag},
|
rooms::{
|
||||||
|
event_handler::{DagBuilderTree, build_local_dag},
|
||||||
|
queue::QueueJob,
|
||||||
|
},
|
||||||
transactions::{FederationTxnState, TransactionError, TxnKey, WrappedTransactionResponse},
|
transactions::{FederationTxnState, TransactionError, TxnKey, WrappedTransactionResponse},
|
||||||
};
|
};
|
||||||
use tokio::sync::watch::{Receiver, Sender};
|
use tokio::sync::watch::{Receiver, Sender};
|
||||||
@@ -332,14 +335,6 @@ async fn handle_room(
|
|||||||
room_id: OwnedRoomId,
|
room_id: OwnedRoomId,
|
||||||
pdus: impl Iterator<Item = Pdu> + Send,
|
pdus: impl Iterator<Item = Pdu> + Send,
|
||||||
) -> std::result::Result<Vec<(OwnedEventId, Result)>, TransactionError> {
|
) -> std::result::Result<Vec<(OwnedEventId, Result)>, TransactionError> {
|
||||||
let arrived = millis_since_unix_epoch();
|
|
||||||
let _room_lock = services
|
|
||||||
.rooms
|
|
||||||
.event_handler
|
|
||||||
.mutex_federation
|
|
||||||
.lock(room_id.as_str())
|
|
||||||
.await;
|
|
||||||
|
|
||||||
let room_id = &room_id;
|
let room_id = &room_id;
|
||||||
let mut pdu_map: HashMap<OwnedEventId, CanonicalJsonObject> = pdus
|
let mut pdu_map: HashMap<OwnedEventId, CanonicalJsonObject> = pdus
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -359,50 +354,30 @@ async fn handle_room(
|
|||||||
let value = pdu_map
|
let value = pdu_map
|
||||||
.remove(&event_id)
|
.remove(&event_id)
|
||||||
.expect("sorted event IDs must be from the original map");
|
.expect("sorted event IDs must be from the original map");
|
||||||
services
|
let room_id = match value
|
||||||
.server
|
.get("room_id")
|
||||||
.check_running()
|
.and_then(CanonicalJsonValue::as_str)
|
||||||
.map_err(|_| TransactionError::ShuttingDown)?;
|
.map(|v| v.try_into().map_err(Into::into))
|
||||||
let event_type = KeyValue::new(
|
{
|
||||||
"type",
|
| Some(Ok(v)) => v,
|
||||||
pdu_type_label(value.get("type").and_then(CanonicalJsonValue::as_str)),
|
| Some(Err(e)) => {
|
||||||
);
|
results.push((event_id, Err(e)));
|
||||||
let origin_server_ts = value
|
continue;
|
||||||
.get("origin_server_ts")
|
},
|
||||||
.and_then(CanonicalJsonValue::as_integer)
|
| None => {
|
||||||
.and_then(|ts| u64::try_from(i64::from(ts)).ok());
|
results
|
||||||
|
.push((event_id, Err!(Request(BadJson("PDU is missing a room_id field")))));
|
||||||
|
continue;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let job = QueueJob {
|
||||||
|
room_id,
|
||||||
|
event_id: event_id.clone(),
|
||||||
|
origin: origin.to_owned(),
|
||||||
|
object: value,
|
||||||
|
};
|
||||||
|
|
||||||
let start = Instant::now();
|
results.push((event_id, services.rooms.queue.new_job(job).await));
|
||||||
let result = services
|
|
||||||
.rooms
|
|
||||||
.event_handler
|
|
||||||
.handle_incoming_pdu(origin, room_id, &event_id, value, false)
|
|
||||||
.boxed()
|
|
||||||
.await
|
|
||||||
.map(|_| ());
|
|
||||||
|
|
||||||
let outcome = KeyValue::new("outcome", match &result {
|
|
||||||
| Ok(()) => "accepted",
|
|
||||||
| Err(Error::BadRequest(ErrorKind::Forbidden, ..)) => "forbidden",
|
|
||||||
| Err(Error::BadRequest(ErrorKind::InvalidParam | ErrorKind::BadJson, ..)) =>
|
|
||||||
"invalid",
|
|
||||||
| Err(_) => "error",
|
|
||||||
});
|
|
||||||
let instruments = &services.server.metrics.instruments;
|
|
||||||
instruments
|
|
||||||
.federation_incoming_pdu_duration
|
|
||||||
.record(start.elapsed().as_secs_f64(), std::slice::from_ref(&outcome));
|
|
||||||
if let (Ok(()), Some(ts)) = (&result, origin_server_ts) {
|
|
||||||
let lag = arrived.saturating_sub(ts);
|
|
||||||
instruments
|
|
||||||
.federation_incoming_pdu_lag
|
|
||||||
.record(Duration::from_millis(lag).as_secs_f64(), &[]);
|
|
||||||
}
|
|
||||||
instruments
|
|
||||||
.federation_incoming_pdus
|
|
||||||
.add(1, &[event_type, outcome]);
|
|
||||||
|
|
||||||
results.push((event_id, result));
|
|
||||||
}
|
}
|
||||||
Ok(results)
|
Ok(results)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ pub(crate) async fn create_knock_event_v1_route(
|
|||||||
return Err!(Request(Forbidden("Room version does not support knocking.")));
|
return Err!(Request(Forbidden("Room version does not support knocking.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
let (event, target_membership, sender, target) = validate_any_membership_event(
|
let (mut event, target_membership, sender, target) = validate_any_membership_event(
|
||||||
&services,
|
&services,
|
||||||
&body.pdu,
|
&body.pdu,
|
||||||
&room_version_rules,
|
&room_version_rules,
|
||||||
@@ -83,6 +83,8 @@ pub(crate) async fn create_knock_event_v1_route(
|
|||||||
return Err!(Request(InvalidParam("Sender does not match state key")));
|
return Err!(Request(InvalidParam("Sender does not match state key")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.insert("event_id".to_owned(), body.event_id.as_str().into());
|
||||||
|
|
||||||
let pdu = PduEvent::from_id_val(&body.event_id, event.clone())
|
let pdu = PduEvent::from_id_val(&body.event_id, event.clone())
|
||||||
.map_err(|e| err!(Request(InvalidParam("Invalid knock event PDU: {e}"))))?;
|
.map_err(|e| err!(Request(InvalidParam("Invalid knock event PDU: {e}"))))?;
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl AccessCheck<'_> {
|
|||||||
///
|
///
|
||||||
/// A resulting tuple of (PDU JSON, target membership state, sender, recipient).
|
/// A resulting tuple of (PDU JSON, target membership state, sender, recipient).
|
||||||
pub(crate) async fn validate_any_membership_event(
|
pub(crate) async fn validate_any_membership_event(
|
||||||
services: &Services,
|
services: &crate::State,
|
||||||
body: &serde_json::value::RawValue,
|
body: &serde_json::value::RawValue,
|
||||||
room_version_rules: &RoomVersionRules,
|
room_version_rules: &RoomVersionRules,
|
||||||
create_event_id: OwnedEventId,
|
create_event_id: OwnedEventId,
|
||||||
|
|||||||
+16
-16
@@ -20,30 +20,28 @@ crate-type = [
|
|||||||
brotli_compression = [
|
brotli_compression = [
|
||||||
"reqwest/brotli",
|
"reqwest/brotli",
|
||||||
]
|
]
|
||||||
|
conduwuit_mods = [
|
||||||
|
"dep:libloading"
|
||||||
|
]
|
||||||
gzip_compression = [
|
gzip_compression = [
|
||||||
"reqwest/gzip",
|
"reqwest/gzip",
|
||||||
]
|
]
|
||||||
|
hardened_malloc = [
|
||||||
|
"dep:hardened_malloc-rs"
|
||||||
|
]
|
||||||
jemalloc = [
|
jemalloc = [
|
||||||
"dep:tikv-jemalloc-sys",
|
"dep:tikv-jemalloc-sys",
|
||||||
"dep:tikv-jemalloc-ctl",
|
"dep:tikv-jemalloc-ctl",
|
||||||
"dep:tikv-jemallocator",
|
"dep:tikv-jemallocator",
|
||||||
]
|
]
|
||||||
# Uses mimalloc for Rust allocations and, via `override`, exports
|
|
||||||
# malloc/free/etc. so C/C++ dependencies (RocksDB, zstd, lz4, ...) use it too.
|
|
||||||
# Mutually exclusive with `jemalloc` on non-MSVC targets.
|
|
||||||
mimalloc = [
|
|
||||||
"dep:libmimalloc-sys",
|
|
||||||
"dep:mimalloc",
|
|
||||||
"libmimalloc-sys/override",
|
|
||||||
]
|
|
||||||
jemalloc_conf = []
|
jemalloc_conf = []
|
||||||
jemalloc_prof = [
|
jemalloc_prof = [
|
||||||
"tikv-jemalloc-sys?/profiling",
|
"tikv-jemalloc-sys/profiling",
|
||||||
]
|
]
|
||||||
jemalloc_stats = [
|
jemalloc_stats = [
|
||||||
"tikv-jemalloc-sys?/stats",
|
"tikv-jemalloc-sys/stats",
|
||||||
"tikv-jemalloc-ctl?/stats",
|
"tikv-jemalloc-ctl/stats",
|
||||||
"tikv-jemallocator?/stats",
|
"tikv-jemallocator/stats",
|
||||||
]
|
]
|
||||||
perf_measurements = []
|
perf_measurements = []
|
||||||
release_max_log_level = [
|
release_max_log_level = [
|
||||||
@@ -82,6 +80,8 @@ http-body-util.workspace = true
|
|||||||
http.workspace = true
|
http.workspace = true
|
||||||
ipaddress.workspace = true
|
ipaddress.workspace = true
|
||||||
libc.workspace = true
|
libc.workspace = true
|
||||||
|
libloading.workspace = true
|
||||||
|
libloading.optional = true
|
||||||
lettre.workspace = true
|
lettre.workspace = true
|
||||||
num-traits.workspace = true
|
num-traits.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
@@ -118,14 +118,14 @@ lock_api.workspace = true
|
|||||||
hyper-util.workspace = true
|
hyper-util.workspace = true
|
||||||
resolvematrix.workspace = true
|
resolvematrix.workspace = true
|
||||||
openidconnect.workspace = true
|
openidconnect.workspace = true
|
||||||
libmimalloc-sys.optional = true
|
|
||||||
libmimalloc-sys.workspace = true
|
|
||||||
mimalloc.optional = true
|
|
||||||
mimalloc.workspace = true
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
nix.workspace = true
|
nix.workspace = true
|
||||||
|
|
||||||
|
[target.'cfg(all(not(target_env = "msvc"), target_os = "linux"))'.dependencies]
|
||||||
|
hardened_malloc-rs.workspace = true
|
||||||
|
hardened_malloc-rs.optional = true
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
maplit.workspace = true
|
maplit.workspace = true
|
||||||
opentelemetry_sdk.workspace = true
|
opentelemetry_sdk.workspace = true
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
//! Default allocator with no special features
|
//! Default allocator with no special features
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
|
||||||
|
|
||||||
pub(crate) fn metric() -> Option<(&'static str, &'static str)> { None }
|
|
||||||
|
|
||||||
/// Always returns Ok
|
/// Always returns Ok
|
||||||
pub fn trim<I: Into<Option<usize>>>(_: I) -> crate::Result { Ok(()) }
|
pub fn trim<I: Into<Option<usize>>>(_: I) -> crate::Result { Ok(()) }
|
||||||
|
|
||||||
@@ -16,4 +12,4 @@ pub fn memory_stats(_opts: &str) -> Option<String> { None }
|
|||||||
pub fn memory_usage() -> Option<String> { None }
|
pub fn memory_usage() -> Option<String> { None }
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn memory_usage_stats() -> Option<ArrayVec<(&'static str, usize), 6>> { None }
|
pub fn memory_usage_stats() -> Option<[(&'static str, usize); 6]> { None }
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//! hmalloc allocator
|
||||||
|
|
||||||
|
#[global_allocator]
|
||||||
|
static HMALLOC: hardened_malloc_rs::HardenedMalloc = hardened_malloc_rs::HardenedMalloc;
|
||||||
|
|
||||||
|
pub fn trim<I: Into<Option<usize>>>(_: I) -> crate::Result { Ok(()) }
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
//TODO: get usage
|
||||||
|
pub fn memory_usage() -> Option<String> { None }
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn memory_usage_stats() -> Option<[(&'static str, usize); 6]> { None }
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
|
pub fn memory_stats(_opts: &str) -> Option<String> {
|
||||||
|
Some("Extended statistics are not available from hardened_malloc.".to_owned())
|
||||||
|
}
|
||||||
+148
-448
@@ -1,12 +1,9 @@
|
|||||||
//! jemalloc allocator
|
//! jemalloc allocator
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
any::Any,
|
cell::OnceCell,
|
||||||
ffi::{CStr, CString, c_char, c_uint, c_void},
|
ffi::{CStr, c_char, c_void},
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
panic::{self, AssertUnwindSafe},
|
|
||||||
ptr,
|
|
||||||
sync::OnceLock,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
@@ -15,61 +12,26 @@ use tikv_jemalloc_sys as ffi;
|
|||||||
use tikv_jemallocator as jemalloc;
|
use tikv_jemallocator as jemalloc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Result, err, is_equal_to, is_nonzero,
|
Result, SyncRwLock, err, is_equal_to, is_nonzero,
|
||||||
utils::{math, math::Tried},
|
utils::{math, math::Tried},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
#[cfg(feature = "jemalloc_conf")]
|
||||||
#[repr(transparent)]
|
#[unsafe(no_mangle)]
|
||||||
struct MallocConf(*const c_char);
|
pub static malloc_conf: &[u8] = const_str::concat_bytes!(
|
||||||
|
|
||||||
// SAFETY: MallocConf points to static immutable NUL-terminated bytes.
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
|
||||||
unsafe impl Sync for MallocConf {}
|
|
||||||
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
|
||||||
const MALLOC_CONF_BYTES: &[u8] = const_str::concat_bytes!(
|
|
||||||
"lg_extent_max_active_fit:4",
|
"lg_extent_max_active_fit:4",
|
||||||
",oversize_threshold:16777216",
|
",oversize_threshold:16777216",
|
||||||
",tcache_max:2097152",
|
",tcache_max:2097152",
|
||||||
",dirty_decay_ms:16000",
|
",dirty_decay_ms:16000",
|
||||||
",muzzy_decay_ms:144000",
|
",muzzy_decay_ms:144000",
|
||||||
MALLOC_CONF_PLATFORM,
|
",percpu_arena:percpu",
|
||||||
|
",metadata_thp:always",
|
||||||
|
",background_thread:true",
|
||||||
|
",max_background_threads:-1",
|
||||||
MALLOC_CONF_PROF,
|
MALLOC_CONF_PROF,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(all(feature = "jemalloc_conf", target_os = "linux"))]
|
|
||||||
const MALLOC_CONF_PLATFORM: &str =
|
|
||||||
",percpu_arena:percpu,metadata_thp:always,background_thread:true";
|
|
||||||
#[cfg(all(feature = "jemalloc_conf", not(target_os = "linux")))]
|
|
||||||
const MALLOC_CONF_PLATFORM: &str = "";
|
|
||||||
|
|
||||||
// Targets match `NO_UNPREFIXED_MALLOC_TARGETS` in `tikv-jemalloc-sys` when
|
|
||||||
// `unprefixed_malloc_on_supported_platforms` is enabled.
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
|
||||||
#[used]
|
|
||||||
#[allow(non_upper_case_globals)]
|
|
||||||
#[cfg_attr(
|
|
||||||
any(
|
|
||||||
target_vendor = "apple",
|
|
||||||
target_env = "musl",
|
|
||||||
target_os = "android",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
),
|
|
||||||
unsafe(export_name = "_rjem_malloc_conf")
|
|
||||||
)]
|
|
||||||
#[cfg_attr(
|
|
||||||
not(any(
|
|
||||||
target_vendor = "apple",
|
|
||||||
target_env = "musl",
|
|
||||||
target_os = "android",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
)),
|
|
||||||
unsafe(no_mangle)
|
|
||||||
)]
|
|
||||||
static malloc_conf: MallocConf = MallocConf(MALLOC_CONF_BYTES.as_ptr().cast());
|
|
||||||
|
|
||||||
#[cfg(all(feature = "jemalloc_conf", feature = "jemalloc_prof"))]
|
#[cfg(all(feature = "jemalloc_conf", feature = "jemalloc_prof"))]
|
||||||
const MALLOC_CONF_PROF: &str = ",prof_active:false";
|
const MALLOC_CONF_PROF: &str = ",prof_active:false";
|
||||||
#[cfg(all(feature = "jemalloc_conf", not(feature = "jemalloc_prof")))]
|
#[cfg(all(feature = "jemalloc_conf", not(feature = "jemalloc_prof")))]
|
||||||
@@ -77,56 +39,37 @@ const MALLOC_CONF_PROF: &str = "";
|
|||||||
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static JEMALLOC: jemalloc::Jemalloc = jemalloc::Jemalloc;
|
static JEMALLOC: jemalloc::Jemalloc = jemalloc::Jemalloc;
|
||||||
|
static CONTROL: SyncRwLock<()> = SyncRwLock::new(());
|
||||||
|
|
||||||
type Name = ArrayVec<u8, NAME_MAX>;
|
type Name = ArrayVec<u8, NAME_MAX>;
|
||||||
type Key = ArrayVec<usize, KEY_SEGS>;
|
type Key = ArrayVec<usize, KEY_SEGS>;
|
||||||
|
|
||||||
const NAME_MAX: usize = 128;
|
const NAME_MAX: usize = 128;
|
||||||
const KEY_SEGS: usize = 8;
|
const KEY_SEGS: usize = 8;
|
||||||
const ARENA_LIMIT: usize = 4095;
|
|
||||||
const ARENAS_ALL: usize = 4096;
|
|
||||||
|
|
||||||
#[ctor::ctor(unsafe)]
|
#[ctor::ctor(unsafe)]
|
||||||
fn _static_initialization() {
|
fn _static_initialization() {
|
||||||
let mut epoch: u64 = 0;
|
acq_epoch().expect("pre-initialization of jemalloc failed");
|
||||||
let mut len = size_of::<u64>();
|
acq_epoch().expect("pre-initialization of jemalloc failed");
|
||||||
// SAFETY: Pre-initialize jemalloc before main() without touching Rust TLS
|
|
||||||
// or unwinding across the constructor boundary.
|
|
||||||
unsafe {
|
|
||||||
ffi::mallctl(
|
|
||||||
c"epoch".as_ptr(),
|
|
||||||
ptr::from_mut(&mut epoch).cast::<c_void>(),
|
|
||||||
&raw mut len,
|
|
||||||
ptr::null_mut(),
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn metric() -> Option<(&'static str, &'static str)> {
|
|
||||||
Some((
|
|
||||||
"continuwuity.jemalloc.memory",
|
|
||||||
"jemalloc memory statistics, when built with jemalloc_stats",
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(feature = "jemalloc_stats")]
|
#[cfg(feature = "jemalloc_stats")]
|
||||||
pub fn memory_usage() -> Option<String> {
|
pub fn memory_usage() -> Option<String> {
|
||||||
use std::fmt::Write;
|
|
||||||
|
|
||||||
let mibs = |input: usize| {
|
let mibs = |input: usize| {
|
||||||
let whole = u32::try_from(input / (1024 * 1024)).unwrap_or(u32::MAX);
|
let kibs = input / 1024;
|
||||||
let rem_kibs = u32::try_from((input / 1024) % 1024).unwrap_or_default();
|
let kibs = u32::try_from(kibs).unwrap_or_default();
|
||||||
f64::from(whole) + f64::from(rem_kibs) / 1024.0
|
let kibs = f64::from(kibs);
|
||||||
|
kibs / 1024.0
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut out = String::new();
|
let [allocated, active, mapped, metadata, resident, retained] =
|
||||||
for (name, bytes) in memory_usage_stats()? {
|
memory_usage_stats()?.map(|(_, bytes)| mibs(bytes));
|
||||||
writeln!(out, "{name}: {:.2} MiB", mibs(bytes)).ok()?;
|
Some(format!(
|
||||||
}
|
"allocated: {allocated:.2} MiB\nactive: {active:.2} MiB\nmapped: {mapped:.2} \
|
||||||
|
MiB\nmetadata: {metadata:.2} MiB\nresident: {resident:.2} MiB\nretained: {retained:.2} \
|
||||||
Some(out)
|
MiB\n"
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
@@ -135,259 +78,184 @@ pub fn memory_usage() -> Option<String> { None }
|
|||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(feature = "jemalloc_stats")]
|
#[cfg(feature = "jemalloc_stats")]
|
||||||
pub fn memory_usage_stats() -> Option<ArrayVec<(&'static str, usize), 6>> {
|
pub fn memory_usage_stats() -> Option<[(&'static str, usize); 6]> {
|
||||||
use mallctl::stats;
|
use mallctl::stats;
|
||||||
|
|
||||||
// Advance the epoch; ensure latest stats are pulled in
|
// Acquire the epoch; ensure latest stats are pulled in
|
||||||
inc_epoch().ok()?;
|
acq_epoch().ok()?;
|
||||||
|
|
||||||
Some(ArrayVec::from([
|
Some([
|
||||||
("allocated", stats::allocated::read().unwrap_or_default()),
|
("allocated", stats::allocated::read().unwrap_or_default()),
|
||||||
("active", stats::active::read().unwrap_or_default()),
|
("active", stats::active::read().unwrap_or_default()),
|
||||||
("mapped", stats::mapped::read().unwrap_or_default()),
|
("mapped", stats::mapped::read().unwrap_or_default()),
|
||||||
("metadata", stats::metadata::read().unwrap_or_default()),
|
("metadata", stats::metadata::read().unwrap_or_default()),
|
||||||
("resident", stats::resident::read().unwrap_or_default()),
|
("resident", stats::resident::read().unwrap_or_default()),
|
||||||
("retained", stats::retained::read().unwrap_or_default()),
|
("retained", stats::retained::read().unwrap_or_default()),
|
||||||
]))
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[cfg(not(feature = "jemalloc_stats"))]
|
#[cfg(not(feature = "jemalloc_stats"))]
|
||||||
pub fn memory_usage_stats() -> Option<ArrayVec<(&'static str, usize), 6>> { None }
|
pub fn memory_usage_stats() -> Option<[(&'static str, usize); 6]> { None }
|
||||||
|
|
||||||
struct StatsPrintState {
|
|
||||||
buf: String,
|
|
||||||
max_len: usize,
|
|
||||||
panic: Option<Box<dyn Any + Send>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn memory_stats(opts: &str) -> Option<String> {
|
pub fn memory_stats(opts: &str) -> Option<String> {
|
||||||
const MAX_LENGTH: usize = 1_048_576;
|
const MAX_LENGTH: usize = 1_048_576;
|
||||||
|
|
||||||
let opts = CString::new(opts).ok()?;
|
let mut str = String::new();
|
||||||
|
let opaque = std::ptr::from_mut(&mut str).cast::<c_void>();
|
||||||
|
let opts_p: *const c_char = std::ffi::CString::new(opts)
|
||||||
|
.expect("cstring")
|
||||||
|
.into_raw()
|
||||||
|
.cast_const();
|
||||||
|
|
||||||
let mut state = StatsPrintState {
|
// Acquire the epoch; ensure latest stats are pulled in
|
||||||
buf: String::new(),
|
acq_epoch().ok()?;
|
||||||
max_len: MAX_LENGTH,
|
|
||||||
panic: None,
|
|
||||||
};
|
|
||||||
let opaque = ptr::from_mut(&mut state).cast::<c_void>();
|
|
||||||
|
|
||||||
// SAFETY: `state` and `opts` remain live in this frame for the duration of
|
// SAFETY: calls malloc_stats_print() with our string instance which must
|
||||||
// `malloc_stats_print()`, which invokes `malloc_stats_cb` synchronously.
|
// remain in this frame. https://docs.rs/tikv-jemalloc-sys/latest/tikv_jemalloc_sys/fn.malloc_stats_print.html
|
||||||
unsafe { ffi::malloc_stats_print(Some(malloc_stats_cb), opaque, opts.as_ptr()) };
|
unsafe { ffi::malloc_stats_print(Some(malloc_stats_cb), opaque, opts_p) };
|
||||||
|
|
||||||
if let Some(payload) = state.panic {
|
str.truncate(MAX_LENGTH);
|
||||||
panic::resume_unwind(payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(state.buf)
|
Some(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn malloc_stats_cb(opaque: *mut c_void, msg: *const c_char) {
|
unsafe extern "C" fn malloc_stats_cb(opaque: *mut c_void, msg: *const c_char) {
|
||||||
// SAFETY: `opaque` points to `StatsPrintState` on the caller's stack.
|
// SAFETY: we have to trust the opaque points to our String
|
||||||
let Some(state) = (unsafe { opaque.cast::<StatsPrintState>().as_mut() }) else {
|
let res: &mut String = unsafe {
|
||||||
return;
|
opaque
|
||||||
|
.cast::<String>()
|
||||||
|
.as_mut()
|
||||||
|
.expect("failed to cast void* to &mut String")
|
||||||
};
|
};
|
||||||
|
|
||||||
if state.panic.is_some() || msg.is_null() || state.buf.len() >= state.max_len {
|
// SAFETY: we have to trust the string is null terminated.
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SAFETY: jemalloc guarantees `msg` is a valid NUL-terminated C string.
|
|
||||||
let msg = unsafe { CStr::from_ptr(msg) };
|
let msg = unsafe { CStr::from_ptr(msg) };
|
||||||
|
|
||||||
if let Err(err) = panic::catch_unwind(AssertUnwindSafe(|| {
|
let msg = String::from_utf8_lossy(msg.to_bytes());
|
||||||
let msg = String::from_utf8_lossy(msg.to_bytes());
|
res.push_str(msg.as_ref());
|
||||||
let remaining = state.max_len.saturating_sub(state.buf.len());
|
|
||||||
if msg.len() <= remaining {
|
|
||||||
state.buf.push_str(msg.as_ref());
|
|
||||||
} else {
|
|
||||||
if let Some(prefix) = msg.get(..msg.floor_char_boundary(remaining)) {
|
|
||||||
state.buf.push_str(prefix);
|
|
||||||
}
|
|
||||||
state.max_len = state.buf.len();
|
|
||||||
}
|
|
||||||
})) {
|
|
||||||
state.panic = Some(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! mallctl {
|
macro_rules! mallctl {
|
||||||
($name:literal) => {{
|
($name:expr_2021) => {{
|
||||||
static KEY: OnceLock<Key> = OnceLock::new();
|
thread_local! {
|
||||||
|
static KEY: OnceCell<Key> = OnceCell::default();
|
||||||
|
};
|
||||||
|
|
||||||
KEY.get_or_init(|| key($name).expect("failed to translate name into mib key"))
|
KEY.with(|once| {
|
||||||
|
once.get_or_init(move || key($name).expect("failed to translate name into mib key"))
|
||||||
|
.clone()
|
||||||
|
})
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod this_thread {
|
pub mod this_thread {
|
||||||
use super::{Debug, Key, OnceLock, Result, c_uint, is_nonzero, key, math};
|
use super::{Debug, Key, OnceCell, Result, is_nonzero, key, math};
|
||||||
|
|
||||||
|
thread_local! {
|
||||||
|
static ALLOCATED_BYTES: OnceCell<&'static u64> = const { OnceCell::new() };
|
||||||
|
static DEALLOCATED_BYTES: OnceCell<&'static u64> = const { OnceCell::new() };
|
||||||
|
}
|
||||||
|
|
||||||
pub fn trim() -> Result { decay().and_then(|()| purge()) }
|
pub fn trim() -> Result { decay().and_then(|()| purge()) }
|
||||||
|
|
||||||
pub fn purge() -> Result {
|
pub fn purge() -> Result { notify(mallctl!("arena.0.purge")) }
|
||||||
// SAFETY: `arena.<i>.purge` is an `arena.<i>.*` notification ctl.
|
|
||||||
unsafe { notify(mallctl!("arena.0.purge")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn decay() -> Result {
|
pub fn decay() -> Result { notify(mallctl!("arena.0.decay")) }
|
||||||
// SAFETY: `arena.<i>.decay` is an `arena.<i>.*` notification ctl.
|
|
||||||
unsafe { notify(mallctl!("arena.0.decay")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn idle() -> Result {
|
pub fn idle() -> Result { super::notify(&mallctl!("thread.idle")) }
|
||||||
// SAFETY: `thread.idle` is a non-indexed notification ctl.
|
|
||||||
unsafe { super::notify(mallctl!("thread.idle")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn flush() -> Result {
|
pub fn flush() -> Result { super::notify(&mallctl!("thread.tcache.flush")) }
|
||||||
// SAFETY: `thread.tcache.flush` is a non-indexed notification ctl.
|
|
||||||
unsafe { super::notify(mallctl!("thread.tcache.flush")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_muzzy_decay(decay_ms: isize) -> Result<isize> {
|
pub fn set_muzzy_decay(decay_ms: isize) -> Result<isize> {
|
||||||
// SAFETY: `arena.<i>.muzzy_decay_ms` has C type `ssize_t`.
|
set(mallctl!("arena.0.muzzy_decay_ms"), decay_ms)
|
||||||
unsafe { set(mallctl!("arena.0.muzzy_decay_ms"), decay_ms) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_muzzy_decay() -> Result<isize> {
|
pub fn get_muzzy_decay() -> Result<isize> { get(mallctl!("arena.0.muzzy_decay_ms")) }
|
||||||
// SAFETY: `arena.<i>.muzzy_decay_ms` has C type `ssize_t`.
|
|
||||||
unsafe { get(mallctl!("arena.0.muzzy_decay_ms")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_dirty_decay(decay_ms: isize) -> Result<isize> {
|
pub fn set_dirty_decay(decay_ms: isize) -> Result<isize> {
|
||||||
// SAFETY: `arena.<i>.dirty_decay_ms` has C type `ssize_t`.
|
set(mallctl!("arena.0.dirty_decay_ms"), decay_ms)
|
||||||
unsafe { set(mallctl!("arena.0.dirty_decay_ms"), decay_ms) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_dirty_decay() -> Result<isize> {
|
pub fn get_dirty_decay() -> Result<isize> { get(mallctl!("arena.0.dirty_decay_ms")) }
|
||||||
// SAFETY: `arena.<i>.dirty_decay_ms` has C type `ssize_t`.
|
|
||||||
unsafe { get(mallctl!("arena.0.dirty_decay_ms")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cache_enable(enable: bool) -> Result<bool> {
|
pub fn cache_enable(enable: bool) -> Result<bool> {
|
||||||
// SAFETY: `thread.tcache.enabled` has C type `bool` (1 byte on
|
super::set::<u8>(&mallctl!("thread.tcache.enabled"), enable.into()).map(is_nonzero!())
|
||||||
// non-MSVC).
|
|
||||||
unsafe { super::set::<u8>(mallctl!("thread.tcache.enabled"), enable.into()) }
|
|
||||||
.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_cache_enabled() -> Result<bool> {
|
pub fn is_cache_enabled() -> Result<bool> {
|
||||||
// SAFETY: `thread.tcache.enabled` has C type `bool` (1 byte on
|
super::get::<u8>(&mallctl!("thread.tcache.enabled")).map(is_nonzero!())
|
||||||
// non-MSVC).
|
|
||||||
unsafe { super::get::<u8>(mallctl!("thread.tcache.enabled")) }.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_arena(id: usize) -> Result<usize> {
|
pub fn set_arena(id: usize) -> Result<usize> {
|
||||||
// SAFETY: `thread.arena` has C type `unsigned`.
|
super::set::<u32>(&mallctl!("thread.arena"), id.try_into()?).and_then(math::try_into)
|
||||||
unsafe { super::set::<c_uint>(mallctl!("thread.arena"), id.try_into()?) }
|
|
||||||
.and_then(math::try_into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn arena_id() -> Result<usize> {
|
pub fn arena_id() -> Result<usize> {
|
||||||
// SAFETY: `thread.arena` has C type `unsigned`.
|
super::get::<u32>(&mallctl!("thread.arena")).and_then(math::try_into)
|
||||||
unsafe { super::get::<c_uint>(mallctl!("thread.arena")) }.and_then(math::try_into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prof_enable(enable: bool) -> Result<bool> {
|
pub fn prof_enable(enable: bool) -> Result<bool> {
|
||||||
// SAFETY: `thread.prof.active` has C type `bool` (1 byte on non-MSVC).
|
super::set::<u8>(&mallctl!("thread.prof.active"), enable.into()).map(is_nonzero!())
|
||||||
unsafe { super::set::<u8>(mallctl!("thread.prof.active"), enable.into()) }
|
|
||||||
.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_prof_enabled() -> Result<bool> {
|
pub fn is_prof_enabled() -> Result<bool> {
|
||||||
// SAFETY: `thread.prof.active` has C type `bool` (1 byte on non-MSVC).
|
super::get::<u8>(&mallctl!("thread.prof.active")).map(is_nonzero!())
|
||||||
unsafe { super::get::<u8>(mallctl!("thread.prof.active")) }.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset_peak() -> Result {
|
pub fn reset_peak() -> Result { super::notify(&mallctl!("thread.peak.reset")) }
|
||||||
// SAFETY: `thread.peak.reset` is a non-indexed notification ctl.
|
|
||||||
unsafe { super::notify(mallctl!("thread.peak.reset")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn peak() -> Result<u64> {
|
pub fn peak() -> Result<u64> { super::get(&mallctl!("thread.peak.read")) }
|
||||||
// SAFETY: `thread.peak.read` has C type `uint64_t`.
|
|
||||||
unsafe { super::get(mallctl!("thread.peak.read")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn allocated() -> u64 {
|
pub fn allocated() -> u64 {
|
||||||
// SAFETY: `thread.allocated` has C type `uint64_t`.
|
*ALLOCATED_BYTES.with(|once| init_tls_cell(once, "thread.allocatedp"))
|
||||||
unsafe { super::get(mallctl!("thread.allocated")) }.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn deallocated() -> u64 {
|
pub fn deallocated() -> u64 {
|
||||||
// SAFETY: `thread.deallocated` has C type `uint64_t`.
|
*DEALLOCATED_BYTES.with(|once| init_tls_cell(once, "thread.deallocatedp"))
|
||||||
unsafe { super::get(mallctl!("thread.deallocated")) }.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
fn notify(key: Key) -> Result { super::notify_by_arena(Some(arena_id()?), key) }
|
||||||
/// Caller must ensure `key` is an `arena.<i>.*` notification MIB
|
|
||||||
/// (`key.len() >= 2`).
|
|
||||||
unsafe fn notify(key: &Key) -> Result {
|
|
||||||
let mut key = key.clone();
|
|
||||||
// `arena_id()` returns this thread's own valid arena (< narenas <
|
|
||||||
// ARENA_LIMIT), so we skip `validate_arena_id()` to avoid locking
|
|
||||||
// `ctl_mtx` on hot paths like `decay()`.
|
|
||||||
key[1] = arena_id()?;
|
|
||||||
// SAFETY: Caller guarantees `key` is an `arena.<i>.*` notification MIB
|
|
||||||
// and `arena_id()` returns a valid arena index.
|
|
||||||
unsafe { super::notify(&key) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # Safety
|
fn set<T>(key: Key, val: T) -> Result<T>
|
||||||
/// Caller must ensure `key` is an `arena.<i>.*` MIB and `T` matches its
|
|
||||||
/// exact C type.
|
|
||||||
unsafe fn set<T>(key: &Key, val: T) -> Result<T>
|
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
let mut key = key.clone();
|
super::set_by_arena(Some(arena_id()?), key, val)
|
||||||
// `arena_id()` is already a valid arena index; skip
|
|
||||||
// `validate_arena_id()`.
|
|
||||||
key[1] = arena_id()?;
|
|
||||||
// SAFETY: Caller guarantees `T` matches `key`.
|
|
||||||
unsafe { super::set(&key, val) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
fn get<T>(key: Key) -> Result<T>
|
||||||
/// Caller must ensure `key` is an `arena.<i>.*` MIB and `T` matches its
|
|
||||||
/// exact C type.
|
|
||||||
unsafe fn get<T>(key: &Key) -> Result<T>
|
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
let mut key = key.clone();
|
super::get_by_arena(Some(arena_id()?), key)
|
||||||
// `arena_id()` is already a valid arena index; skip
|
}
|
||||||
// `validate_arena_id()`.
|
|
||||||
key[1] = arena_id()?;
|
fn init_tls_cell(cell: &OnceCell<&'static u64>, name: &str) -> &'static u64 {
|
||||||
// SAFETY: Caller guarantees `T` matches `key`.
|
cell.get_or_init(|| {
|
||||||
unsafe { super::get(&key) }
|
let ptr: *const u64 = super::get(&mallctl!(name)).expect("failed to obtain pointer");
|
||||||
|
|
||||||
|
// SAFETY: ptr points directly to the internal state of jemalloc for
|
||||||
|
// this thread
|
||||||
|
unsafe { ptr.as_ref() }.expect("pointer must not be null")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stats_reset() -> Result {
|
pub fn stats_reset() -> Result { notify(&mallctl!("stats.mutexes.reset")) }
|
||||||
// SAFETY: `stats.mutexes.reset` is a non-indexed notification ctl.
|
|
||||||
unsafe { notify(mallctl!("stats.mutexes.reset")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn prof_reset() -> Result {
|
pub fn prof_reset() -> Result { notify(&mallctl!("prof.reset")) }
|
||||||
// SAFETY: `prof.reset` is a non-indexed notification ctl.
|
|
||||||
unsafe { notify(mallctl!("prof.reset")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn prof_enable(enable: bool) -> Result<bool> {
|
pub fn prof_enable(enable: bool) -> Result<bool> {
|
||||||
// SAFETY: `prof.active` has C type `bool` (1 byte on non-MSVC).
|
set::<u8>(&mallctl!("prof.active"), enable.into()).map(is_nonzero!())
|
||||||
unsafe { set::<u8>(mallctl!("prof.active"), enable.into()) }.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_prof_enabled() -> Result<bool> {
|
pub fn is_prof_enabled() -> Result<bool> {
|
||||||
// SAFETY: `prof.active` has C type `bool` (1 byte on non-MSVC).
|
get::<u8>(&mallctl!("prof.active")).map(is_nonzero!())
|
||||||
unsafe { get::<u8>(mallctl!("prof.active")) }.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trim<I: Into<Option<usize>> + Copy>(arena: I) -> Result {
|
pub fn trim<I: Into<Option<usize>> + Copy>(arena: I) -> Result {
|
||||||
@@ -395,40 +263,31 @@ pub fn trim<I: Into<Option<usize>> + Copy>(arena: I) -> Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn purge<I: Into<Option<usize>>>(arena: I) -> Result {
|
pub fn purge<I: Into<Option<usize>>>(arena: I) -> Result {
|
||||||
// SAFETY: `arena.<i>.purge` is an `arena.<i>.*` notification ctl.
|
notify_by_arena(arena.into(), mallctl!("arena.4096.purge"))
|
||||||
unsafe { notify_by_arena(arena.into(), mallctl!("arena.4096.purge")) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decay<I: Into<Option<usize>>>(arena: I) -> Result {
|
pub fn decay<I: Into<Option<usize>>>(arena: I) -> Result {
|
||||||
// SAFETY: `arena.<i>.decay` is an `arena.<i>.*` notification ctl.
|
notify_by_arena(arena.into(), mallctl!("arena.4096.decay"))
|
||||||
unsafe { notify_by_arena(arena.into(), mallctl!("arena.4096.decay")) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_muzzy_decay<I: Into<Option<usize>>>(arena: I, decay_ms: isize) -> Result<isize> {
|
pub fn set_muzzy_decay<I: Into<Option<usize>>>(arena: I, decay_ms: isize) -> Result<isize> {
|
||||||
match arena.into() {
|
match arena.into() {
|
||||||
// SAFETY: `arena.<i>.muzzy_decay_ms` has C type `ssize_t`.
|
| Some(arena) =>
|
||||||
| Some(arena) => unsafe {
|
set_by_arena(Some(arena), mallctl!("arena.4096.muzzy_decay_ms"), decay_ms),
|
||||||
set_by_arena(arena, mallctl!("arena.0.muzzy_decay_ms"), decay_ms)
|
| _ => set(&mallctl!("arenas.muzzy_decay_ms"), decay_ms),
|
||||||
},
|
|
||||||
// SAFETY: `arenas.muzzy_decay_ms` has C type `ssize_t`.
|
|
||||||
| _ => unsafe { set(mallctl!("arenas.muzzy_decay_ms"), decay_ms) },
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_dirty_decay<I: Into<Option<usize>>>(arena: I, decay_ms: isize) -> Result<isize> {
|
pub fn set_dirty_decay<I: Into<Option<usize>>>(arena: I, decay_ms: isize) -> Result<isize> {
|
||||||
match arena.into() {
|
match arena.into() {
|
||||||
// SAFETY: `arena.<i>.dirty_decay_ms` has C type `ssize_t`.
|
| Some(arena) =>
|
||||||
| Some(arena) => unsafe {
|
set_by_arena(Some(arena), mallctl!("arena.4096.dirty_decay_ms"), decay_ms),
|
||||||
set_by_arena(arena, mallctl!("arena.0.dirty_decay_ms"), decay_ms)
|
| _ => set(&mallctl!("arenas.dirty_decay_ms"), decay_ms),
|
||||||
},
|
|
||||||
// SAFETY: `arenas.dirty_decay_ms` has C type `ssize_t`.
|
|
||||||
| _ => unsafe { set(mallctl!("arenas.dirty_decay_ms"), decay_ms) },
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn background_thread_enable(enable: bool) -> Result<bool> {
|
pub fn background_thread_enable(enable: bool) -> Result<bool> {
|
||||||
// SAFETY: `background_thread` has C type `bool` (1 byte on non-MSVC).
|
set::<u8>(&mallctl!("background_thread"), enable.into()).map(is_nonzero!())
|
||||||
unsafe { set::<u8>(mallctl!("background_thread"), enable.into()) }.map(is_nonzero!())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -444,138 +303,83 @@ pub fn is_percpu_arena() -> bool { percpu_arenas().is_ok_and(is_equal_to!("percp
|
|||||||
pub fn is_phycpu_arena() -> bool { percpu_arenas().is_ok_and(is_equal_to!("phycpu")) }
|
pub fn is_phycpu_arena() -> bool { percpu_arenas().is_ok_and(is_equal_to!("phycpu")) }
|
||||||
|
|
||||||
pub fn percpu_arenas() -> Result<&'static str> {
|
pub fn percpu_arenas() -> Result<&'static str> {
|
||||||
// SAFETY: `opt.percpu_arena` has C type `const char *`.
|
let ptr = get::<*const c_char>(&mallctl!("opt.percpu_arena"))?;
|
||||||
let ptr = unsafe { get::<*const c_char>(mallctl!("opt.percpu_arena")) }?;
|
//SAFETY: ptr points to a null-terminated string returned for
|
||||||
if ptr.is_null() {
|
// opt.percpu_arena.
|
||||||
return Err(err!("mallctl: opt.percpu_arena returned NULL"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// SAFETY: `ptr` is non-null and points to a static NUL-terminated string
|
|
||||||
// returned by jemalloc for `opt.percpu_arena`.
|
|
||||||
let cstr = unsafe { CStr::from_ptr(ptr) };
|
let cstr = unsafe { CStr::from_ptr(ptr) };
|
||||||
cstr.to_str().map_err(Into::into)
|
cstr.to_str().map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn arenas() -> Result<usize> {
|
pub fn arenas() -> Result<usize> {
|
||||||
// SAFETY: `arenas.narenas` has C type `unsigned`.
|
get::<u32>(&mallctl!("arenas.narenas")).and_then(math::try_into)
|
||||||
unsafe { get::<c_uint>(mallctl!("arenas.narenas")) }.and_then(math::try_into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn inc_epoch() -> Result<u64> {
|
pub fn inc_epoch() -> Result<u64> { xchg(&mallctl!("epoch"), 1_u64) }
|
||||||
// SAFETY: `epoch` has C type `uint64_t`.
|
|
||||||
unsafe { xchg(mallctl!("epoch"), 1_u64) }
|
pub fn acq_epoch() -> Result<u64> { xchg(&mallctl!("epoch"), 0_u64) }
|
||||||
|
|
||||||
|
fn notify_by_arena(id: Option<usize>, mut key: Key) -> Result {
|
||||||
|
key[1] = id.unwrap_or(4096);
|
||||||
|
notify(&key)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn acq_epoch() -> Result<u64> {
|
fn set_by_arena<T>(id: Option<usize>, mut key: Key, val: T) -> Result<T>
|
||||||
// SAFETY: `epoch` has C type `uint64_t`.
|
|
||||||
unsafe { get(mallctl!("epoch")) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn validate_arena_id(id: usize, allow_all: bool) -> Result<usize> {
|
|
||||||
if allow_all && id == ARENAS_ALL {
|
|
||||||
return Ok(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
let narenas = arenas()?.min(ARENA_LIMIT);
|
|
||||||
if id < narenas {
|
|
||||||
Ok(id)
|
|
||||||
} else {
|
|
||||||
Err(err!("mallctl: invalid arena index {id} (narenas: {narenas})"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # Safety
|
|
||||||
/// Caller must ensure `key` is an `arena.<i>.*` notification MIB
|
|
||||||
/// (`key.len() >= 2`).
|
|
||||||
unsafe fn notify_by_arena(id: Option<usize>, key: &Key) -> Result {
|
|
||||||
let mut key = key.clone();
|
|
||||||
key[1] = match id {
|
|
||||||
| Some(id) => validate_arena_id(id, true)?,
|
|
||||||
| None => ARENAS_ALL,
|
|
||||||
};
|
|
||||||
// SAFETY: Caller guarantees `key` is an `arena.<i>.*` notification MIB and
|
|
||||||
// `key[1]` has been validated above.
|
|
||||||
unsafe { notify(&key) }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// # Safety
|
|
||||||
/// Caller must ensure `key` is an `arena.<i>.*` MIB (`key.len() >= 2`) and `T`
|
|
||||||
/// matches its exact C type.
|
|
||||||
unsafe fn set_by_arena<T>(id: usize, key: &Key, val: T) -> Result<T>
|
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
let mut key = key.clone();
|
key[1] = id.unwrap_or(4096);
|
||||||
key[1] = validate_arena_id(id, false)?;
|
set(&key, val)
|
||||||
// SAFETY: Caller guarantees `T` matches `key`.
|
|
||||||
unsafe { set(&key, val) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
fn get_by_arena<T>(id: Option<usize>, mut key: Key) -> Result<T>
|
||||||
/// Caller must ensure `key` is a valid notification MIB and any indexed arena
|
|
||||||
/// component is within bounds.
|
|
||||||
unsafe fn notify(key: &Key) -> Result {
|
|
||||||
// SAFETY: jemalloc notification ctls require `oldp`, `oldlenp`, and `newp`
|
|
||||||
// to be NULL and `newlen` to be 0 (otherwise `EPERM` is returned).
|
|
||||||
let ret = unsafe {
|
|
||||||
ffi::mallctlbymib(
|
|
||||||
key.as_ptr(),
|
|
||||||
key.len(),
|
|
||||||
ptr::null_mut(),
|
|
||||||
ptr::null_mut(),
|
|
||||||
ptr::null_mut(),
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
if ret == 0 {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(err!("mallctl: {}", std::io::Error::from_raw_os_error(ret)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Does not advance `epoch`; callers reading cached `stats.*` must call
|
|
||||||
/// `inc_epoch()` explicitly.
|
|
||||||
///
|
|
||||||
/// # Safety
|
|
||||||
/// Caller must ensure `T` matches the exact C type expected by `key`.
|
|
||||||
unsafe fn set<T>(key: &Key, val: T) -> Result<T>
|
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
// SAFETY: Caller guarantees `T` matches `key`.
|
key[1] = id.unwrap_or(4096);
|
||||||
unsafe { xchg(key, val) }
|
get(&key)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn notify(key: &Key) -> Result { xchg(key, ()) }
|
||||||
|
|
||||||
|
fn set<T>(key: &Key, val: T) -> Result<T>
|
||||||
|
where
|
||||||
|
T: Copy + Debug,
|
||||||
|
{
|
||||||
|
let _lock = CONTROL.write();
|
||||||
|
let res = xchg(key, val)?;
|
||||||
|
inc_epoch()?;
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
|
||||||
/// Caller must ensure `T` matches the exact C type expected by `key`.
|
|
||||||
#[tracing::instrument(
|
#[tracing::instrument(
|
||||||
name = "get",
|
name = "get",
|
||||||
level = "trace",
|
level = "trace",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(?key)
|
fields(?key)
|
||||||
)]
|
)]
|
||||||
unsafe fn get<T>(key: &Key) -> Result<T>
|
fn get<T>(key: &Key) -> Result<T>
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
// SAFETY: Caller guarantees `T` matches the C type returned for `key`.
|
acq_epoch()?;
|
||||||
|
acq_epoch()?;
|
||||||
|
|
||||||
|
// SAFETY: T must be perfectly valid to receive value.
|
||||||
unsafe { mallctl::raw::read_mib(key.as_slice()) }.map_err(map_err)
|
unsafe { mallctl::raw::read_mib(key.as_slice()) }.map_err(map_err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
|
||||||
/// Caller must ensure `T` matches the exact C type expected by `key`.
|
|
||||||
#[tracing::instrument(
|
#[tracing::instrument(
|
||||||
name = "xchg",
|
name = "xchg",
|
||||||
level = "trace",
|
level = "trace",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(?key, ?val)
|
fields(?key, ?val)
|
||||||
)]
|
)]
|
||||||
unsafe fn xchg<T>(key: &Key, val: T) -> Result<T>
|
fn xchg<T>(key: &Key, val: T) -> Result<T>
|
||||||
where
|
where
|
||||||
T: Copy + Debug,
|
T: Copy + Debug,
|
||||||
{
|
{
|
||||||
// SAFETY: Caller guarantees `T` matches the C type expected by `key`.
|
// SAFETY: T must be the exact expected type.
|
||||||
unsafe { mallctl::raw::update_mib(key.as_slice(), val) }.map_err(map_err)
|
unsafe { mallctl::raw::update_mib(key.as_slice(), val) }.map_err(map_err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,9 +387,6 @@ fn key(name: &str) -> Result<Key> {
|
|||||||
// tikv asserts the output buffer length is tight to the number of required
|
// tikv asserts the output buffer length is tight to the number of required
|
||||||
// mibs so we slice that down here.
|
// mibs so we slice that down here.
|
||||||
let segs = name.chars().filter(is_equal_to!(&'.')).count().try_add(1)?;
|
let segs = name.chars().filter(is_equal_to!(&'.')).count().try_add(1)?;
|
||||||
if segs > KEY_SEGS {
|
|
||||||
return Err(err!("mallctl: key has too many segments ({segs} > {KEY_SEGS})"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = self::name(name)?;
|
let name = self::name(name)?;
|
||||||
let mut buf = [0_usize; KEY_SEGS];
|
let mut buf = [0_usize; KEY_SEGS];
|
||||||
@@ -595,10 +396,6 @@ fn key(name: &str) -> Result<Key> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn name(name: &str) -> Result<Name> {
|
fn name(name: &str) -> Result<Name> {
|
||||||
if name.as_bytes().contains(&0) {
|
|
||||||
return Err(err!("mallctl: key contains interior NUL byte"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut buf = Name::new();
|
let mut buf = Name::new();
|
||||||
buf.try_extend_from_slice(name.as_bytes())?;
|
buf.try_extend_from_slice(name.as_bytes())?;
|
||||||
buf.try_extend_from_slice(b"\0")?;
|
buf.try_extend_from_slice(b"\0")?;
|
||||||
@@ -609,100 +406,3 @@ fn name(name: &str) -> Result<Name> {
|
|||||||
fn map_err(error: tikv_jemalloc_ctl::Error) -> crate::Error {
|
fn map_err(error: tikv_jemalloc_ctl::Error) -> crate::Error {
|
||||||
err!("mallctl: {}", error.to_string())
|
err!("mallctl: {}", error.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn notify_ctls_succeed() {
|
|
||||||
this_thread::flush().expect("thread.tcache.flush");
|
|
||||||
this_thread::decay().expect("arena.<i>.decay");
|
|
||||||
this_thread::purge().expect("arena.<i>.purge");
|
|
||||||
this_thread::trim().expect("this_thread::trim");
|
|
||||||
trim(None).expect("trim(None)");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(feature = "jemalloc_stats")]
|
|
||||||
fn allocated_and_deallocated_do_not_alias() {
|
|
||||||
let a0 = this_thread::allocated();
|
|
||||||
let d0 = this_thread::deallocated();
|
|
||||||
|
|
||||||
let buf = std::hint::black_box(vec![0_u8; 64 * 1024]);
|
|
||||||
let a1 = this_thread::allocated();
|
|
||||||
assert!(a1 > a0, "expected allocated to increase: {a0} -> {a1}");
|
|
||||||
|
|
||||||
drop(buf);
|
|
||||||
let d1 = this_thread::deallocated();
|
|
||||||
assert!(d1 > d0, "expected deallocated to increase: {d0} -> {d1}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn memory_stats_handles_valid_and_nul_opts() {
|
|
||||||
assert!(memory_stats("invalid\0opts").is_none());
|
|
||||||
let stats = memory_stats("gmal").expect("memory_stats");
|
|
||||||
assert!(!stats.is_empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn key_too_many_segments_returns_err() { key("a.b.c.d.e.f.g.h.i").unwrap_err(); }
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn key_interior_nul_returns_err() { key("a.b\0.c").unwrap_err(); }
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn arena_index_bounds_rejected() {
|
|
||||||
purge(Some(ARENAS_ALL)).expect("purge(MALLCTL_ARENAS_ALL)");
|
|
||||||
decay(Some(ARENAS_ALL)).expect("decay(MALLCTL_ARENAS_ALL)");
|
|
||||||
|
|
||||||
let narenas = arenas().expect("arenas.narenas");
|
|
||||||
purge(Some(narenas)).unwrap_err();
|
|
||||||
decay(Some(narenas)).unwrap_err();
|
|
||||||
set_dirty_decay(Some(narenas), -1).unwrap_err();
|
|
||||||
set_muzzy_decay(Some(narenas), -1).unwrap_err();
|
|
||||||
|
|
||||||
purge(Some(4097)).unwrap_err();
|
|
||||||
decay(Some(4097)).unwrap_err();
|
|
||||||
trim(Some(4097)).unwrap_err();
|
|
||||||
purge(Some(usize::MAX)).unwrap_err();
|
|
||||||
|
|
||||||
set_dirty_decay(Some(ARENAS_ALL), -1).unwrap_err();
|
|
||||||
set_muzzy_decay(Some(ARENAS_ALL), -1).unwrap_err();
|
|
||||||
set_dirty_decay(Some(4097), -1).unwrap_err();
|
|
||||||
set_muzzy_decay(Some(4097), -1).unwrap_err();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
|
||||||
fn malloc_conf_is_applied() {
|
|
||||||
if std::env::var_os("MALLOC_CONF").is_some()
|
|
||||||
|| std::env::var_os("_RJEM_MALLOC_CONF").is_some()
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SAFETY: `opt.dirty_decay_ms` and `opt.muzzy_decay_ms` have C type
|
|
||||||
// `ssize_t`.
|
|
||||||
let dirty =
|
|
||||||
unsafe { get::<isize>(mallctl!("opt.dirty_decay_ms")) }.expect("opt.dirty_decay_ms");
|
|
||||||
// SAFETY: Same as above
|
|
||||||
let muzzy =
|
|
||||||
unsafe { get::<isize>(mallctl!("opt.muzzy_decay_ms")) }.expect("opt.muzzy_decay_ms");
|
|
||||||
assert_eq!(dirty, 16_000, "expected malloc_conf dirty_decay_ms:16000");
|
|
||||||
assert_eq!(muzzy, 144_000, "expected malloc_conf muzzy_decay_ms:144000");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn percpu_arenas_returns_valid_mode() {
|
|
||||||
let mode = percpu_arenas().expect("opt.percpu_arena");
|
|
||||||
assert!(matches!(mode, "disabled" | "percpu" | "phycpu"), "unexpected mode: {mode}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn epoch_read_and_advance() {
|
|
||||||
let e0 = acq_epoch().expect("acq_epoch");
|
|
||||||
let e1 = inc_epoch().expect("inc_epoch");
|
|
||||||
assert!(e1 > e0, "expected inc_epoch to advance epoch: {e0} -> {e1}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
//! mimalloc allocator
|
|
||||||
|
|
||||||
use std::{
|
|
||||||
any::Any,
|
|
||||||
ffi::{CStr, c_void},
|
|
||||||
panic::{self, AssertUnwindSafe},
|
|
||||||
ptr,
|
|
||||||
};
|
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
|
||||||
use libmimalloc_sys as ffi;
|
|
||||||
use mimalloc::MiMalloc;
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[global_allocator]
|
|
||||||
static MIMALLOC: MiMalloc = MiMalloc;
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
struct StatCount {
|
|
||||||
current: i64,
|
|
||||||
peak: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
struct Stats {
|
|
||||||
reserved: StatCount,
|
|
||||||
committed: StatCount,
|
|
||||||
purged: i64,
|
|
||||||
reset: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
trait OutputFnChar {
|
|
||||||
type Char;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<C> OutputFnChar for Option<unsafe extern "C" fn(*const C, *mut c_void)> {
|
|
||||||
type Char = C;
|
|
||||||
}
|
|
||||||
|
|
||||||
type MiChar = <ffi::mi_output_fun as OutputFnChar>::Char;
|
|
||||||
|
|
||||||
struct StatsPrintState {
|
|
||||||
buf: String,
|
|
||||||
max_len: usize,
|
|
||||||
panic: Option<Box<dyn Any + Send>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn metric() -> Option<(&'static str, &'static str)> {
|
|
||||||
Some(("continuwuity.mimalloc.memory", "mimalloc memory statistics"))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn trim<I: Into<Option<usize>>>(_: I) -> crate::Result {
|
|
||||||
// SAFETY: `mi_collect` is thread-safe and takes a single boolean flag.
|
|
||||||
unsafe { ffi::mi_collect(true) };
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_stats() -> Option<Stats> {
|
|
||||||
let stats = MiMalloc::stats_json().ok()?;
|
|
||||||
let json = stats.to_str().ok()?;
|
|
||||||
serde_json::from_str(json).ok()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn non_neg_usize(value: i64) -> usize { usize::try_from(value.max(0)).unwrap_or(usize::MAX) }
|
|
||||||
|
|
||||||
fn mibs(input: usize) -> f64 {
|
|
||||||
let whole = u32::try_from(input / (1024 * 1024)).unwrap_or(u32::MAX);
|
|
||||||
let rem_kibs = u32::try_from((input / 1024) % 1024).unwrap_or_default();
|
|
||||||
f64::from(whole) + f64::from(rem_kibs) / 1024.0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
pub fn memory_usage() -> Option<String> {
|
|
||||||
let stats = read_stats()?;
|
|
||||||
|
|
||||||
Some(format!(
|
|
||||||
"reserved: {:.2} MiB\nreserved_peak: {:.2} MiB\ncommitted: {:.2} MiB\ncommitted_peak: \
|
|
||||||
{:.2} MiB\npurged_total: {:.2} MiB\nreset_total: {:.2} MiB\n",
|
|
||||||
mibs(non_neg_usize(stats.reserved.current)),
|
|
||||||
mibs(non_neg_usize(stats.reserved.peak)),
|
|
||||||
mibs(non_neg_usize(stats.committed.current)),
|
|
||||||
mibs(non_neg_usize(stats.committed.peak)),
|
|
||||||
mibs(non_neg_usize(stats.purged)),
|
|
||||||
mibs(non_neg_usize(stats.reset)),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
pub fn memory_usage_stats() -> Option<ArrayVec<(&'static str, usize), 6>> {
|
|
||||||
let stats = read_stats()?;
|
|
||||||
let mut out = ArrayVec::new();
|
|
||||||
out.extend([
|
|
||||||
("reserved", non_neg_usize(stats.reserved.current)),
|
|
||||||
("reserved_peak", non_neg_usize(stats.reserved.peak)),
|
|
||||||
("committed", non_neg_usize(stats.committed.current)),
|
|
||||||
("committed_peak", non_neg_usize(stats.committed.peak)),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Some(out)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
pub fn memory_stats(opts: &str) -> Option<String> {
|
|
||||||
const MAX_LENGTH: usize = 1_048_576;
|
|
||||||
|
|
||||||
if opts.contains('\0') {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.contains('J') {
|
|
||||||
let stats = MiMalloc::stats_json().ok()?;
|
|
||||||
let json = String::from_utf8_lossy(stats.to_bytes());
|
|
||||||
let end = json.floor_char_boundary(json.len().min(MAX_LENGTH));
|
|
||||||
return json.get(..end).map(str::to_owned);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut state = StatsPrintState {
|
|
||||||
buf: String::new(),
|
|
||||||
max_len: MAX_LENGTH,
|
|
||||||
panic: None,
|
|
||||||
};
|
|
||||||
let opaque = ptr::from_mut(&mut state).cast::<c_void>();
|
|
||||||
|
|
||||||
// SAFETY: `state` remains live in this frame for the duration of
|
|
||||||
// `mi_stats_print_out()`, which invokes `mi_stats_cb` synchronously.
|
|
||||||
unsafe { ffi::mi_stats_print_out(Some(mi_stats_cb), opaque) };
|
|
||||||
|
|
||||||
if let Some(payload) = state.panic {
|
|
||||||
panic::resume_unwind(payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(state.buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe extern "C" fn mi_stats_cb(msg: *const MiChar, arg: *mut c_void) {
|
|
||||||
// SAFETY: `arg` points to `StatsPrintState` on the caller's stack.
|
|
||||||
let Some(state) = (unsafe { arg.cast::<StatsPrintState>().as_mut() }) else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
if state.panic.is_some() || msg.is_null() || state.buf.len() >= state.max_len {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// SAFETY: mimalloc guarantees `msg` is a valid NUL-terminated C string.
|
|
||||||
let msg = unsafe { CStr::from_ptr(msg.cast()) };
|
|
||||||
|
|
||||||
if let Err(err) = panic::catch_unwind(AssertUnwindSafe(|| {
|
|
||||||
let msg = String::from_utf8_lossy(msg.to_bytes());
|
|
||||||
let remaining = state.max_len.saturating_sub(state.buf.len());
|
|
||||||
if msg.len() <= remaining {
|
|
||||||
state.buf.push_str(msg.as_ref());
|
|
||||||
} else {
|
|
||||||
if let Some(prefix) = msg.get(..msg.floor_char_boundary(remaining)) {
|
|
||||||
state.buf.push_str(prefix);
|
|
||||||
}
|
|
||||||
state.max_len = state.buf.len();
|
|
||||||
}
|
|
||||||
})) {
|
|
||||||
state.panic = Some(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn trim_succeeds() { trim(None).expect("trim(None)"); }
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn non_neg_usize_clamps_negative_values() {
|
|
||||||
assert_eq!(non_neg_usize(-1), 0, "expected -1 to clamp to 0");
|
|
||||||
assert_eq!(non_neg_usize(i64::MIN), 0, "expected i64::MIN to clamp to 0");
|
|
||||||
assert_eq!(non_neg_usize(0), 0, "expected 0 to remain 0");
|
|
||||||
assert_eq!(non_neg_usize(4096), 4096, "expected positive value unchanged");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn memory_usage_stats_reports_allocator_bytes() {
|
|
||||||
let buf = std::hint::black_box(vec![0_u8; 64 * 1024]);
|
|
||||||
let stats = memory_usage_stats().expect("memory_usage_stats");
|
|
||||||
drop(buf);
|
|
||||||
|
|
||||||
let keys: Vec<_> = stats.iter().map(|&(key, _)| key).collect();
|
|
||||||
assert_eq!(
|
|
||||||
keys,
|
|
||||||
["reserved", "reserved_peak", "committed", "committed_peak"],
|
|
||||||
"unexpected stat keys"
|
|
||||||
);
|
|
||||||
|
|
||||||
for (key, bytes) in stats {
|
|
||||||
assert!(bytes > 0, "expected {key} > 0, got {bytes}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn memory_usage_returns_allocator_summary() {
|
|
||||||
let usage = memory_usage().expect("memory_usage");
|
|
||||||
for expected in [
|
|
||||||
"reserved:",
|
|
||||||
"reserved_peak:",
|
|
||||||
"committed:",
|
|
||||||
"committed_peak:",
|
|
||||||
"purged_total:",
|
|
||||||
"reset_total:",
|
|
||||||
"MiB",
|
|
||||||
] {
|
|
||||||
assert!(usage.contains(expected), "missing {expected:?} in usage:\n{usage}");
|
|
||||||
}
|
|
||||||
assert!(!usage.contains("current_rss:"), "unexpected current_rss in usage:\n{usage}");
|
|
||||||
assert!(!usage.contains("peak_rss:"), "unexpected peak_rss in usage:\n{usage}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn memory_stats_supports_text_json_and_rejects_nul() {
|
|
||||||
assert!(memory_stats("invalid\0opts").is_none(), "expected NUL opts to return None");
|
|
||||||
|
|
||||||
for opts in ["", "abcdefghijklmnopqrstuvwxyz"] {
|
|
||||||
let stats = memory_stats(opts).expect("memory_stats text");
|
|
||||||
assert!(!stats.is_empty(), "expected non-empty stats for opts={opts:?}");
|
|
||||||
assert!(!stats.starts_with('{'), "expected formatted text, got JSON:\n{stats}");
|
|
||||||
assert!(stats.contains("reserved"), "missing reserved in stats:\n{stats}");
|
|
||||||
assert!(stats.contains("committed"), "missing committed in stats:\n{stats}");
|
|
||||||
}
|
|
||||||
|
|
||||||
let json = memory_stats("J").expect("memory_stats JSON");
|
|
||||||
assert!(json.starts_with('{'), "expected JSON object, got:\n{json}");
|
|
||||||
let parsed: serde_json::Value =
|
|
||||||
serde_json::from_str(&json).expect("expected valid JSON from memory_stats(\"J\")");
|
|
||||||
assert!(parsed.get("committed").is_some(), "expected committed field in JSON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+16
-16
@@ -4,24 +4,24 @@
|
|||||||
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
||||||
pub mod je;
|
pub mod je;
|
||||||
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
||||||
pub(crate) use je::metric;
|
|
||||||
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
|
||||||
pub use je::{memory_stats, memory_usage, memory_usage_stats, trim};
|
pub use je::{memory_stats, memory_usage, memory_usage_stats, trim};
|
||||||
|
|
||||||
// mimalloc
|
#[cfg(all(not(target_env = "msvc"), feature = "hardened_malloc", not(feature = "jemalloc")))]
|
||||||
#[cfg(all(feature = "mimalloc", feature = "jemalloc", not(target_env = "msvc")))]
|
pub mod hardened;
|
||||||
compile_error!("the `mimalloc` and `jemalloc` features are mutually exclusive");
|
#[cfg(all(
|
||||||
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
not(target_env = "msvc"),
|
||||||
pub mod mimalloc;
|
feature = "hardened_malloc",
|
||||||
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
not(feature = "jemalloc")
|
||||||
pub(crate) use mimalloc::metric;
|
))]
|
||||||
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
pub use hardened::{memory_stats, memory_usage, memory_usage_stats, trim};
|
||||||
pub use mimalloc::{memory_stats, memory_usage, memory_usage_stats, trim};
|
|
||||||
|
|
||||||
// default
|
#[cfg(any(
|
||||||
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
target_env = "msvc",
|
||||||
|
all(not(feature = "hardened_malloc"), not(feature = "jemalloc"))
|
||||||
|
))]
|
||||||
pub mod default;
|
pub mod default;
|
||||||
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
#[cfg(any(
|
||||||
pub(crate) use default::metric;
|
target_env = "msvc",
|
||||||
#[cfg(all(not(feature = "mimalloc"), any(target_env = "msvc", not(feature = "jemalloc"))))]
|
all(not(feature = "hardened_malloc"), not(feature = "jemalloc"))
|
||||||
|
))]
|
||||||
pub use default::{memory_stats, memory_usage, memory_usage_stats, trim};
|
pub use default::{memory_stats, memory_usage, memory_usage_stats, trim};
|
||||||
@@ -5,7 +5,7 @@ use figment::Figment;
|
|||||||
use ruma::{OwnedServerName, events::room::server_acl::RoomServerAclEventContent};
|
use ruma::{OwnedServerName, events::room::server_acl::RoomServerAclEventContent};
|
||||||
|
|
||||||
use super::DEPRECATED_KEYS;
|
use super::DEPRECATED_KEYS;
|
||||||
use crate::{Config, Err, Result, Server, debug, debug_info, error, warn};
|
use crate::{Config, Err, Result, Server, debug, debug_info, debug_warn, error, warn};
|
||||||
|
|
||||||
/// Performs check() with additional checks specific to reloading old config
|
/// Performs check() with additional checks specific to reloading old config
|
||||||
/// with new config.
|
/// with new config.
|
||||||
@@ -43,6 +43,13 @@ pub fn check(config: &Config) -> Result {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg!(all(feature = "hardened_malloc", feature = "jemalloc", not(target_env = "msvc"))) {
|
||||||
|
debug_warn!(
|
||||||
|
"hardened_malloc and jemalloc compile-time features are both enabled, this causes \
|
||||||
|
jemalloc to be used."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if cfg!(not(unix)) && config.unix_socket_path.is_some() {
|
if cfg!(not(unix)) && config.unix_socket_path.is_some() {
|
||||||
return Err!(Config(
|
return Err!(Config(
|
||||||
"unix_socket_path",
|
"unix_socket_path",
|
||||||
|
|||||||
@@ -24,26 +24,6 @@ pub struct Experiments {
|
|||||||
/// display: nested
|
/// display: nested
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub msc2815: Option<MSC2815>,
|
pub msc2815: Option<MSC2815>,
|
||||||
/// MSC3814: Dehydrated devices with SSSS
|
|
||||||
///
|
|
||||||
/// Enables server-side support for "dehydrated devices", which are
|
|
||||||
/// server-side devices (created by supporting clients) that can collect
|
|
||||||
/// encryption keys when there are no online devices, which supporting
|
|
||||||
/// clients can then "hydrate" to download any encryption keys that were
|
|
||||||
/// sent while they were offline.
|
|
||||||
///
|
|
||||||
/// Important: this is NOT required to receive encrypted messages while you
|
|
||||||
/// are offline. Devices can still receive encrypted messages while they are
|
|
||||||
/// offline, but to share those keys with new devices, they have to be
|
|
||||||
/// online. Dehydrated devices work around this by providing a "shared"
|
|
||||||
/// device new sessions can bootstrap from, to receive keys from before they
|
|
||||||
/// logged in that haven't been uploaded to the server-side key backup yet.
|
|
||||||
///
|
|
||||||
/// https://github.com/matrix-org/matrix-spec-proposals/pull/3814
|
|
||||||
///
|
|
||||||
/// default: false
|
|
||||||
#[serde(default)]
|
|
||||||
pub msc3814: SimpleExperiment,
|
|
||||||
/// MSC4155: Invite filtering
|
/// MSC4155: Invite filtering
|
||||||
///
|
///
|
||||||
/// Provides advanced invite filtering rules for users, allowing complex
|
/// Provides advanced invite filtering rules for users, allowing complex
|
||||||
@@ -68,24 +48,6 @@ pub struct Experiments {
|
|||||||
/// default: false
|
/// default: false
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub msc4174: SimpleExperiment,
|
pub msc4174: SimpleExperiment,
|
||||||
/// MSC4406: `M_SENDER_IGNORED` error code
|
|
||||||
///
|
|
||||||
/// Introduces a new error code that explicitly informs clients the reason
|
|
||||||
/// they cannot access an event if it is sent by an ignored user. Without
|
|
||||||
/// this proposal, clients will simply get a "not found" or "forbidden"
|
|
||||||
/// error when requesting events sent by users that have been ignored, which
|
|
||||||
/// leads to replies being shown as "this message could not be found".
|
|
||||||
/// The new error code allows clients to distinguish unknown/forbidden
|
|
||||||
/// events from ignored senders, allowing them to display an error message
|
|
||||||
/// like "you have blocked this sender" instead.
|
|
||||||
///
|
|
||||||
/// Requires a supporting client to be useful.
|
|
||||||
///
|
|
||||||
/// https://github.com/matrix-org/matrix-spec-proposals/pull/4406
|
|
||||||
///
|
|
||||||
/// default: false
|
|
||||||
#[serde(default)]
|
|
||||||
pub msc4406: SimpleExperiment,
|
|
||||||
/// MSC4484: Server Administration OAuth Scope
|
/// MSC4484: Server Administration OAuth Scope
|
||||||
///
|
///
|
||||||
/// Adds a new OAuth2 scope that explicitly grants a token temporary
|
/// Adds a new OAuth2 scope that explicitly grants a token temporary
|
||||||
|
|||||||
+85
-142
@@ -1,6 +1,8 @@
|
|||||||
use std::{
|
use std::{
|
||||||
|
cell::{Cell, RefCell},
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
ptr::NonNull,
|
ptr,
|
||||||
|
ptr::null_mut,
|
||||||
sync::{
|
sync::{
|
||||||
Arc,
|
Arc,
|
||||||
atomic::{AtomicPtr, Ordering},
|
atomic::{AtomicPtr, Ordering},
|
||||||
@@ -8,178 +10,119 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::Config;
|
use super::Config;
|
||||||
use crate::{Result, SyncMutex};
|
use crate::Result;
|
||||||
|
|
||||||
/// The configuration manager is an indirection to reload the configuration for
|
/// The configuration manager is an indirection to reload the configuration for
|
||||||
/// the server while it is running. In order to not burden or clutter the many
|
/// the server while it is running. In order to not burden or clutter the many
|
||||||
/// callsites which query for configuration items, this object implements Deref
|
/// callsites which query for configuration items, this object implements Deref
|
||||||
/// for the actively loaded configuration.
|
/// for the actively loaded configuration.
|
||||||
///
|
|
||||||
/// Every installed `Arc<Config>` is kept at a stable heap address in `retired`
|
|
||||||
/// for the entire lifetime of `Manager` (intentionally retaining prior configs
|
|
||||||
/// across the rare, admin-triggered reloads until shutdown). Because
|
|
||||||
/// `Deref::deref(&self)` ties the returned `&Arc<Config>` lifetime to `&self`,
|
|
||||||
/// readers can perform a single `Acquire` load with no locking, no TLS, and no
|
|
||||||
/// risk of dangling or aliasing UB across reloads.
|
|
||||||
pub struct Manager {
|
pub struct Manager {
|
||||||
active: AtomicPtr<Arc<Config>>,
|
active: AtomicPtr<Config>,
|
||||||
/// Append-only owner of every `Box<Arc<Config>>` ever published to
|
|
||||||
/// `active` (including the currently active config). Entries are only
|
|
||||||
/// freed when `Manager` itself is dropped (`&mut self`), guaranteeing that
|
|
||||||
/// any `&Arc<Config>` returned by `Deref::deref` remains valid and
|
|
||||||
/// immutable for the lifetime of `self`.
|
|
||||||
retired: SyncMutex<Vec<PinnedConfig>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Heap-pinned `Arc<Config>` stored as a raw `NonNull` rather than `Box` so
|
thread_local! {
|
||||||
/// moving it (e.g., when `Vec` reallocates) never retags or invalidates raw
|
static INDEX: Cell<usize> = 0.into();
|
||||||
/// pointers previously published to `Manager::active`.
|
static HANDLE: RefCell<Handles> = const {
|
||||||
struct PinnedConfig(NonNull<Arc<Config>>);
|
RefCell::new([const { None }; HISTORY])
|
||||||
|
};
|
||||||
// SAFETY: `Arc<Config>` is `Send + Sync`, and `PinnedConfig` uniquely owns the
|
|
||||||
// `Box<Arc<Config>>` allocation until it is dropped in `Manager::drop`.
|
|
||||||
unsafe impl Send for PinnedConfig {}
|
|
||||||
|
|
||||||
impl PinnedConfig {
|
|
||||||
fn new(config: Config) -> Self {
|
|
||||||
let ptr = Box::into_raw(Box::new(Arc::new(config)));
|
|
||||||
Self(NonNull::new(ptr).expect("Box::into_raw returned null"))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
const fn as_ptr(&self) -> *mut Arc<Config> { self.0.as_ptr() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for PinnedConfig {
|
type Handle = Option<Arc<Config>>;
|
||||||
fn drop(&mut self) {
|
type Handles = [Handle; HISTORY];
|
||||||
// SAFETY: `self.0` was created via `Box::into_raw` in
|
|
||||||
// `PinnedConfig::new` and is only dropped when `Manager` itself is
|
const HISTORY: usize = 8;
|
||||||
// dropped (`&mut self`), after all borrows derived from `Deref::deref`
|
|
||||||
// have ended.
|
|
||||||
unsafe {
|
|
||||||
drop(Box::from_raw(self.0.as_ptr()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Manager {
|
impl Manager {
|
||||||
pub(crate) fn new(config: Config) -> Self {
|
pub(crate) fn new(config: Config) -> Self {
|
||||||
let pinned = PinnedConfig::new(config);
|
let config = Arc::new(config);
|
||||||
let ptr = pinned.as_ptr();
|
|
||||||
Self {
|
Self {
|
||||||
active: AtomicPtr::new(ptr),
|
active: AtomicPtr::new(Arc::into_raw(config).cast_mut()),
|
||||||
retired: SyncMutex::new(vec![pinned]),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the active configuration, returning prior configuration.
|
/// Update the active configuration, returning prior configuration.
|
||||||
#[tracing::instrument(skip_all, level = "info")]
|
#[tracing::instrument(skip_all, level = "info")]
|
||||||
pub fn update(&self, config: Config) -> Result<Arc<Config>> {
|
pub fn update(&self, config: Config) -> Result<Arc<Config>> {
|
||||||
let pinned = PinnedConfig::new(config);
|
let config = Arc::new(config);
|
||||||
let new_ptr = pinned.as_ptr();
|
let new = Arc::into_raw(config);
|
||||||
|
let old = self.active.swap(new.cast_mut(), Ordering::AcqRel);
|
||||||
|
|
||||||
let mut retired = self.retired.lock();
|
// SAFETY: The old active pointer was set using an Arc::into_raw().
|
||||||
// Push before publishing to `active` so ownership is recorded even if
|
// We're obliged to reconstitute that into Arc otherwise it will leak.
|
||||||
// `Vec::push` were to unwind.
|
Ok(unsafe { Arc::from_raw(old) })
|
||||||
retired.push(pinned);
|
}
|
||||||
|
|
||||||
// `Release` publishes the initialized `Box<Arc<Config>>` to readers
|
fn load(&self, handle: &mut [Option<Arc<Config>>]) -> &'static Arc<Config> {
|
||||||
// performing `Acquire` loads in `Deref::deref`.
|
let config = self.active.load(Ordering::Acquire);
|
||||||
let old_ptr = self.active.swap(new_ptr, Ordering::AcqRel);
|
|
||||||
|
|
||||||
// SAFETY: `old_ptr` points to a `PinnedConfig` still owned by `retired`
|
// Branch taken after config reload or first access by this thread.
|
||||||
// and cannot be freed until `Manager` is dropped.
|
if handle[INDEX.get()]
|
||||||
let old = unsafe { Arc::clone(&*old_ptr) };
|
.as_ref()
|
||||||
|
.is_none_or(|handle| !ptr::eq(config, Arc::as_ptr(handle)))
|
||||||
|
{
|
||||||
|
INDEX.set(INDEX.get().wrapping_add(1).wrapping_rem(HISTORY));
|
||||||
|
return load_miss(handle, INDEX.get(), config);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(old)
|
let config: &Arc<Config> = handle[INDEX.get()]
|
||||||
|
.as_ref()
|
||||||
|
.expect("handle was already cached for this thread");
|
||||||
|
|
||||||
|
// SAFETY: The caller should not hold multiple references at a time
|
||||||
|
// directly into Config, as a subsequent reference might invalidate
|
||||||
|
// the thread's cache causing another reference to dangle.
|
||||||
|
//
|
||||||
|
// This is a highly unusual pattern as most config values are copied by
|
||||||
|
// value or used immediately without running overlap with another
|
||||||
|
// value. Even if it does actually occur somewhere, the window of
|
||||||
|
// danger is limited to the config being reloaded while the reference
|
||||||
|
// is held and another access is made by the same thread into a
|
||||||
|
// different config value. This is mitigated by creating a buffer
|
||||||
|
// of old configs rather than discarding at the earliest opportunity;
|
||||||
|
// the odds of this scenario are thus astronomical.
|
||||||
|
unsafe { std::mem::transmute(config) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for Manager {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
let config = self.active.swap(null_mut(), Ordering::AcqRel);
|
||||||
|
|
||||||
|
// SAFETY: The active pointer was set using an Arc::into_raw(). We're
|
||||||
|
// obliged to reconstitute that into Arc otherwise it will leak.
|
||||||
|
unsafe { Arc::from_raw(config) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for Manager {
|
impl Deref for Manager {
|
||||||
type Target = Arc<Config>;
|
type Target = Arc<Config>;
|
||||||
|
|
||||||
#[inline]
|
fn deref(&self) -> &Self::Target { HANDLE.with_borrow_mut(|handle| self.load(handle)) }
|
||||||
fn deref(&self) -> &Self::Target {
|
|
||||||
let ptr = self.active.load(Ordering::Acquire);
|
|
||||||
|
|
||||||
// SAFETY: `ptr` was initialized in `Manager::new` or published via
|
|
||||||
// `Ordering::AcqRel` in `Manager::update` and points to a
|
|
||||||
// `PinnedConfig` in `self.retired`. Entries in `self.retired` are never
|
|
||||||
// removed or mutated until `Manager` is dropped (`&mut self`), so the
|
|
||||||
// returned `&'self Arc<Config>` remains valid and immutable for the
|
|
||||||
// entire borrow of `self`.
|
|
||||||
unsafe { &*ptr }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[tracing::instrument(
|
||||||
mod tests {
|
name = "miss",
|
||||||
use std::thread;
|
level = "trace",
|
||||||
|
skip_all,
|
||||||
|
fields(%index, ?config)
|
||||||
|
)]
|
||||||
|
#[allow(clippy::transmute_ptr_to_ptr)]
|
||||||
|
fn load_miss(
|
||||||
|
handle: &mut [Option<Arc<Config>>],
|
||||||
|
index: usize,
|
||||||
|
config: *const Config,
|
||||||
|
) -> &'static Arc<Config> {
|
||||||
|
// SAFETY: The active pointer was set prior and always remains valid. We're
|
||||||
|
// reconstituting the Arc here but as a new reference, so the count is
|
||||||
|
// incremented. This instance will be cached in the thread-local.
|
||||||
|
let config = unsafe {
|
||||||
|
Arc::increment_strong_count(config);
|
||||||
|
Arc::from_raw(config)
|
||||||
|
};
|
||||||
|
|
||||||
use super::*;
|
// SAFETY: See the note on the transmute above. The caller should not hold
|
||||||
|
// more than one reference at a time directly into Config, as the second
|
||||||
fn test_config(server_name: &str) -> Config {
|
// access might invalidate the thread's cache, dangling the reference to
|
||||||
use figment::{
|
// the first.
|
||||||
Figment,
|
unsafe { std::mem::transmute(handle[index].insert(config)) }
|
||||||
providers::{Format, Toml},
|
|
||||||
};
|
|
||||||
|
|
||||||
let raw = format!("server_name = \"{server_name}\"\ndatabase_path = \"/tmp\"\n");
|
|
||||||
Figment::new()
|
|
||||||
.merge(Toml::string(&raw))
|
|
||||||
.extract()
|
|
||||||
.expect("valid test config")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn deref_survives_many_reloads() {
|
|
||||||
let manager = Manager::new(test_config("initial.example"));
|
|
||||||
let first: &Arc<Config> = &manager;
|
|
||||||
let first_name: &str = first.server_name.as_str();
|
|
||||||
|
|
||||||
for i in 0..32 {
|
|
||||||
let prev = manager
|
|
||||||
.update(test_config(&format!("reload-{i}.example")))
|
|
||||||
.expect("update succeeds");
|
|
||||||
if i == 0 {
|
|
||||||
assert_eq!(prev.server_name.as_str(), "initial.example");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Original reference remains valid and unchanged after > HISTORY
|
|
||||||
// reloads.
|
|
||||||
assert_eq!(first_name, "initial.example");
|
|
||||||
assert_eq!(manager.server_name.as_str(), "reload-31.example");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn concurrent_reads_and_updates() {
|
|
||||||
let manager = Manager::new(test_config("start.example"));
|
|
||||||
|
|
||||||
thread::scope(|s| {
|
|
||||||
for _ in 0..4 {
|
|
||||||
s.spawn(|| {
|
|
||||||
for _ in 0..200 {
|
|
||||||
let cfg: &Arc<Config> = &manager;
|
|
||||||
assert!(cfg.server_name.as_str().ends_with(".example"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
s.spawn(|| {
|
|
||||||
for i in 0..32 {
|
|
||||||
let _ = manager
|
|
||||||
.update(test_config(&format!("iter-{i}.example")))
|
|
||||||
.expect("update succeeds");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn reference_outlives_scoped_thread() {
|
|
||||||
let manager = Manager::new(test_config("scoped.example"));
|
|
||||||
let cfg_ref: &Arc<Config> = thread::scope(|s| s.spawn(|| &*manager).join().unwrap());
|
|
||||||
assert_eq!(cfg_ref.server_name.as_str(), "scoped.example");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+14
-41
@@ -195,7 +195,7 @@ pub struct Config {
|
|||||||
/// announcements or major updates. This is not an update check endpoint.
|
/// announcements or major updates. This is not an update check endpoint.
|
||||||
///
|
///
|
||||||
/// default: true
|
/// default: true
|
||||||
#[serde(default = "true_fn")]
|
#[serde(alias = "allow_check_for_updates", default = "true_fn")]
|
||||||
pub allow_announcements_check: bool,
|
pub allow_announcements_check: bool,
|
||||||
|
|
||||||
/// Set this to any float value to multiply continuwuity's in-memory LRU
|
/// Set this to any float value to multiply continuwuity's in-memory LRU
|
||||||
@@ -490,7 +490,7 @@ pub struct Config {
|
|||||||
#[serde(default = "default_ip_lookup_strategy")]
|
#[serde(default = "default_ip_lookup_strategy")]
|
||||||
pub ip_lookup_strategy: u8,
|
pub ip_lookup_strategy: u8,
|
||||||
|
|
||||||
/// DEPRECATED: The preferred source to use for getting the real client IP.
|
/// The preferred source to use for getting the real client IP.
|
||||||
///
|
///
|
||||||
/// Takes any of the following options:
|
/// Takes any of the following options:
|
||||||
///
|
///
|
||||||
@@ -509,10 +509,9 @@ pub struct Config {
|
|||||||
/// to set this header" check; if the header selected is present, it is
|
/// to set this header" check; if the header selected is present, it is
|
||||||
/// used.
|
/// used.
|
||||||
///
|
///
|
||||||
/// Ignored if `accepted_ip_sources` is set. `accepted_ip_sources` is
|
/// Ignored if `accepted_ip_sources` is set.
|
||||||
/// the preferred alternative.
|
|
||||||
///
|
///
|
||||||
/// If not set, `direct` is used. Additionally, `direct` is used
|
/// If not set set, `direct` is used. Additionally, `direct` is used
|
||||||
/// as a fallback if the chosen header is not found.
|
/// as a fallback if the chosen header is not found.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub request_ip_source: Option<String>,
|
pub request_ip_source: Option<String>,
|
||||||
@@ -920,34 +919,14 @@ pub struct Config {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub forget_forced_upon_leave: bool,
|
pub forget_forced_upon_leave: bool,
|
||||||
|
|
||||||
/// Set this to true to require authentication when looking up user profiles
|
/// Set this to true to require authentication on the normally
|
||||||
/// through this server.
|
/// unauthenticated profile retrieval endpoints (GET)
|
||||||
|
/// "/_matrix/client/v3/profile/{userId}".
|
||||||
///
|
///
|
||||||
/// By default this is false, allowing tools such as matrix.to to access
|
/// This can prevent profile scraping.
|
||||||
/// profiles of users on this server and on other servers.
|
|
||||||
/// Setting this to true will block those tools, and may block automated
|
|
||||||
/// crawlers from scraping users' profiles, although it will not block
|
|
||||||
/// other homeservers from accessing users' profiles.
|
|
||||||
///
|
|
||||||
/// default: false
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub require_auth_for_profile_requests: bool,
|
pub require_auth_for_profile_requests: bool,
|
||||||
|
|
||||||
/// Set this to true to require authentication to create a rendezvous
|
|
||||||
/// session. Rendezvous sessions are used for QR code login.
|
|
||||||
///
|
|
||||||
/// For QR code login, the device that shows the QR code is the one that
|
|
||||||
/// creates the rendezvous session. Therefore, this must be false to let
|
|
||||||
/// a logged-out device show a QR code.
|
|
||||||
///
|
|
||||||
/// By default this is false to allow logged-out desktop devices (which may
|
|
||||||
/// not have a camera) to show a QR code. Setting this to true will
|
|
||||||
/// require logged-out devices to scan the QR code instead.
|
|
||||||
///
|
|
||||||
/// default: false
|
|
||||||
#[serde(default)]
|
|
||||||
pub require_auth_for_rendezvous: bool,
|
|
||||||
|
|
||||||
/// Set this to true to allow your server's public room directory to be
|
/// Set this to true to allow your server's public room directory to be
|
||||||
/// federated. Set this to false to protect against /publicRooms spiders,
|
/// federated. Set this to false to protect against /publicRooms spiders,
|
||||||
/// but will forbid external users from viewing your server's public room
|
/// but will forbid external users from viewing your server's public room
|
||||||
@@ -2823,12 +2802,10 @@ pub struct OidcConfig {
|
|||||||
|
|
||||||
/// Additional scopes Continuwuity should request from the IDP. This may be
|
/// Additional scopes Continuwuity should request from the IDP. This may be
|
||||||
/// necessary to access certain claims. Continuwuity always requests the
|
/// necessary to access certain claims. Continuwuity always requests the
|
||||||
/// `openid` scope, regardless of the contents of this option,
|
/// `openid` scope.
|
||||||
/// and will also request the `profile` scope by default if this option is
|
|
||||||
/// not set.
|
|
||||||
///
|
///
|
||||||
/// default: ["profile"]
|
/// default: []
|
||||||
#[serde(default = "default_additional_scopes")]
|
#[serde(default)]
|
||||||
pub additional_scopes: Vec<Scope>,
|
pub additional_scopes: Vec<Scope>,
|
||||||
|
|
||||||
/// Additional trusted audiences that Continuwuity will accept in the `aud`
|
/// Additional trusted audiences that Continuwuity will accept in the `aud`
|
||||||
@@ -2996,16 +2973,11 @@ impl<'de, K: Hash + Eq + Clone> Deserialize<'de> for PerMinuteRatelimiter<K> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DEPRECATED_KEYS: &[&str] = &[
|
const DEPRECATED_KEYS: &[&str] = &[
|
||||||
"allow_check_for_updates",
|
|
||||||
"allow_moderators_to_view_redacted_content",
|
|
||||||
"allow_sticky_events",
|
|
||||||
"cache_capacity",
|
"cache_capacity",
|
||||||
"conduit_cache_capacity_modifier",
|
"conduit_cache_capacity_modifier",
|
||||||
"max_concurrent_requests",
|
"max_concurrent_requests",
|
||||||
"otlp_protocol",
|
"otlp_protocol",
|
||||||
"request_ip_source",
|
|
||||||
"roomid_spacehierarchy_cache_capacity",
|
"roomid_spacehierarchy_cache_capacity",
|
||||||
"unredacted_content_max_age_secs",
|
|
||||||
"well_known_client",
|
"well_known_client",
|
||||||
"well_known_server",
|
"well_known_server",
|
||||||
"well_known_support_page",
|
"well_known_support_page",
|
||||||
@@ -3013,6 +2985,9 @@ const DEPRECATED_KEYS: &[&str] = &[
|
|||||||
"well_known_support_email",
|
"well_known_support_email",
|
||||||
"well_known_support_mxid",
|
"well_known_support_mxid",
|
||||||
"well_known.rtc_focus_server_urls",
|
"well_known.rtc_focus_server_urls",
|
||||||
|
"allow_sticky_events",
|
||||||
|
"allow_moderators_to_view_redacted_content",
|
||||||
|
"unredacted_content_max_age_secs",
|
||||||
];
|
];
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
@@ -3448,8 +3423,6 @@ fn default_unauthenticated_request_ratelimit<K: Hash + Eq + Clone>() -> PerMinut
|
|||||||
PerMinuteRatelimiter::new(Quota::per_minute(30.try_into().unwrap()))
|
PerMinuteRatelimiter::new(Quota::per_minute(30.try_into().unwrap()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_additional_scopes() -> Vec<Scope> { vec![Scope::new("profile".to_owned())] }
|
|
||||||
|
|
||||||
// NOTE: This must be declared *after* every config struct in this file. The
|
// NOTE: This must be declared *after* every config struct in this file. The
|
||||||
// example config generator writes sections in macro expansion order, and the
|
// example config generator writes sections in macro expansion order, and the
|
||||||
// `global` section truncates the file, so declaring this module any earlier
|
// `global` section truncates the file, so declaring this module any earlier
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ pub fn versions() -> Vec<String> {
|
|||||||
"v1.3".to_owned(),
|
"v1.3".to_owned(),
|
||||||
"v1.4".to_owned(),
|
"v1.4".to_owned(),
|
||||||
"v1.5".to_owned(),
|
"v1.5".to_owned(),
|
||||||
"v1.6".to_owned(),
|
|
||||||
"v1.8".to_owned(),
|
"v1.8".to_owned(),
|
||||||
"v1.11".to_owned(),
|
"v1.11".to_owned(),
|
||||||
"v1.12".to_owned(),
|
"v1.12".to_owned(),
|
||||||
@@ -36,11 +35,10 @@ pub fn versions() -> Vec<String> {
|
|||||||
pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
|
pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
|
||||||
BTreeMap::from_iter([
|
BTreeMap::from_iter([
|
||||||
// MatrixRTC (https://github.com/matrix-org/matrix-spec-proposals/pull/4143)
|
// MatrixRTC (https://github.com/matrix-org/matrix-spec-proposals/pull/4143)
|
||||||
// Expected for spec v1.20/v2.0
|
// Expected for spec v1.20
|
||||||
("org.matrix.msc4143".to_owned(), true),
|
("org.matrix.msc4143".to_owned(), true),
|
||||||
("org.matrix.msc4143.stable".to_owned(), true),
|
|
||||||
// Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
|
// Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
|
||||||
// Expected for spec v1.20/v2.0
|
// Expected for spec v1.20
|
||||||
("org.matrix.simplified_msc3575".to_owned(), true),
|
("org.matrix.simplified_msc3575".to_owned(), true),
|
||||||
("org.matrix.msc4155".to_owned(), experiments.msc4155.is_enabled()),
|
("org.matrix.msc4155".to_owned(), experiments.msc4155.is_enabled()),
|
||||||
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
|
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
|
||||||
@@ -50,8 +48,5 @@ pub fn unstable_features(experiments: &Experiments) -> BTreeMap<String, bool> {
|
|||||||
("org.continuwuity.msc4484.unstable".to_owned(), experiments.msc4484.is_enabled()),
|
("org.continuwuity.msc4484.unstable".to_owned(), experiments.msc4484.is_enabled()),
|
||||||
("org.continuwuity.msc4560".to_owned(), experiments.msc4560.is_enabled()),
|
("org.continuwuity.msc4560".to_owned(), experiments.msc4560.is_enabled()),
|
||||||
("fi.mau.msc2815".to_owned(), experiments.msc2815.is_enabled()),
|
("fi.mau.msc2815".to_owned(), experiments.msc2815.is_enabled()),
|
||||||
// Sticky events (https://github.com/matrix-org/matrix-spec-proposals/pull/4354)
|
|
||||||
// Proposal merged, expected for spec v1.20/v2.0
|
|
||||||
("org.matrix.msc4354".to_owned(), true),
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,6 @@ pub struct Instruments {
|
|||||||
pub sender_transaction_duration: Histogram<f64>,
|
pub sender_transaction_duration: Histogram<f64>,
|
||||||
pub sender_events: Counter<u64>,
|
pub sender_events: Counter<u64>,
|
||||||
pub sender_events_queued: Counter<u64>,
|
pub sender_events_queued: Counter<u64>,
|
||||||
pub sender_panics: Counter<u64>,
|
|
||||||
|
|
||||||
pub media_write_size: Histogram<u64>,
|
pub media_write_size: Histogram<u64>,
|
||||||
pub media_read_size: Histogram<u64>,
|
pub media_read_size: Histogram<u64>,
|
||||||
@@ -46,14 +45,6 @@ impl Instruments {
|
|||||||
.with_boundaries(duration_buckets())
|
.with_boundaries(duration_buckets())
|
||||||
.build()
|
.build()
|
||||||
};
|
};
|
||||||
let long_duration = |name: &'static str, description: &'static str| {
|
|
||||||
meter
|
|
||||||
.f64_histogram(name)
|
|
||||||
.with_description(description)
|
|
||||||
.with_unit("s")
|
|
||||||
.with_boundaries(long_duration_buckets())
|
|
||||||
.build()
|
|
||||||
};
|
|
||||||
let size = |name: &'static str, description: &'static str| {
|
let size = |name: &'static str, description: &'static str| {
|
||||||
meter
|
meter
|
||||||
.u64_histogram(name)
|
.u64_histogram(name)
|
||||||
@@ -64,11 +55,11 @@ impl Instruments {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
federation_outgoing_request_duration: long_duration(
|
federation_outgoing_request_duration: duration(
|
||||||
"continuwuity.federation.outgoing.request.duration",
|
"continuwuity.federation.outgoing.request.duration",
|
||||||
"Duration of outgoing federation requests",
|
"Duration of outgoing federation requests",
|
||||||
),
|
),
|
||||||
federation_incoming_transaction_duration: long_duration(
|
federation_incoming_transaction_duration: duration(
|
||||||
"continuwuity.federation.incoming.transaction.duration",
|
"continuwuity.federation.incoming.transaction.duration",
|
||||||
"Time taken to process incoming federation transactions",
|
"Time taken to process incoming federation transactions",
|
||||||
),
|
),
|
||||||
@@ -84,13 +75,11 @@ impl Instruments {
|
|||||||
federation_incoming_pdu_lag: meter
|
federation_incoming_pdu_lag: meter
|
||||||
.f64_histogram("continuwuity.federation.incoming.pdu.lag")
|
.f64_histogram("continuwuity.federation.incoming.pdu.lag")
|
||||||
.with_description(
|
.with_description(
|
||||||
"Time between an accepted incoming PDU's origin_server_ts and its \
|
"Time between an accepted incoming PDU's origin_server_ts and its arrival",
|
||||||
transaction arriving",
|
|
||||||
)
|
)
|
||||||
.with_unit("s")
|
.with_unit("s")
|
||||||
.with_boundaries(vec![
|
.with_boundaries(vec![
|
||||||
0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, 60.0, 300.0, 900.0, 3600.0,
|
0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, 60.0, 300.0, 900.0, 3600.0,
|
||||||
21600.0, 86400.0,
|
|
||||||
])
|
])
|
||||||
.build(),
|
.build(),
|
||||||
federation_incoming_edus: meter
|
federation_incoming_edus: meter
|
||||||
@@ -103,7 +92,7 @@ impl Instruments {
|
|||||||
"Time taken to handle an incoming federation EDU",
|
"Time taken to handle an incoming federation EDU",
|
||||||
),
|
),
|
||||||
|
|
||||||
sender_transaction_duration: long_duration(
|
sender_transaction_duration: duration(
|
||||||
"continuwuity.sender.transaction.duration",
|
"continuwuity.sender.transaction.duration",
|
||||||
"Duration of outgoing transactions by destination type and outcome",
|
"Duration of outgoing transactions by destination type and outcome",
|
||||||
),
|
),
|
||||||
@@ -117,11 +106,6 @@ impl Instruments {
|
|||||||
.with_description("PDUs and EDUs queued for sending")
|
.with_description("PDUs and EDUs queued for sending")
|
||||||
.with_unit("{event}")
|
.with_unit("{event}")
|
||||||
.build(),
|
.build(),
|
||||||
sender_panics: meter
|
|
||||||
.u64_counter("continuwuity.sender.panics")
|
|
||||||
.with_description("Panics caught in outgoing transactions and sender workers")
|
|
||||||
.with_unit("{panic}")
|
|
||||||
.build(),
|
|
||||||
|
|
||||||
media_write_size: size(
|
media_write_size: size(
|
||||||
"continuwuity.media.write.size",
|
"continuwuity.media.write.size",
|
||||||
@@ -146,12 +130,6 @@ impl Instruments {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn duration_buckets() -> Vec<f64> { (0..16).map(|i| 0.001 * f64::from(1_u32 << i)).collect() }
|
pub fn duration_buckets() -> Vec<f64> { (0..16).map(|i| 0.001 * f64::from(1_u32 << i)).collect() }
|
||||||
|
|
||||||
/// Federation requests and transactions can run past the 60s default
|
|
||||||
/// `federation_timeout`.
|
|
||||||
fn long_duration_buckets() -> Vec<f64> {
|
|
||||||
(0..18).map(|i| 0.001 * f64::from(1_u32 << i)).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn size_buckets() -> Vec<f64> { (0..11).map(|i| 1024.0 * f64::from(4_u32.pow(i))).collect() }
|
fn size_buckets() -> Vec<f64> { (0..11).map(|i| 1024.0 * f64::from(4_u32.pow(i))).collect() }
|
||||||
|
|
||||||
fn register_process(meter: &Meter) {
|
fn register_process(meter: &Meter) {
|
||||||
@@ -218,13 +196,9 @@ fn register_process(meter: &Meter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn register_allocator(meter: &Meter) {
|
fn register_allocator(meter: &Meter) {
|
||||||
let Some((name, description)) = crate::alloc::metric() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
meter
|
meter
|
||||||
.u64_observable_gauge(name)
|
.u64_observable_gauge("continuwuity.jemalloc.memory")
|
||||||
.with_description(description)
|
.with_description("jemalloc memory statistics, when built with jemalloc_stats")
|
||||||
.with_unit("By")
|
.with_unit("By")
|
||||||
.with_callback(|observer| {
|
.with_callback(|observer| {
|
||||||
for (kind, bytes) in crate::alloc::memory_usage_stats().into_iter().flatten() {
|
for (kind, bytes) in crate::alloc::memory_usage_stats().into_iter().flatten() {
|
||||||
|
|||||||
@@ -38,23 +38,3 @@ async fn renders_prometheus_names() {
|
|||||||
}
|
}
|
||||||
assert!(!body.contains("otel_scope_name"));
|
assert!(!body.contains("otel_scope_name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
#[cfg(all(feature = "mimalloc", any(target_env = "msvc", not(feature = "jemalloc"))))]
|
|
||||||
async fn renders_mimalloc_memory_metric() {
|
|
||||||
let (metrics, _provider) = metrics();
|
|
||||||
let body = metrics.render().unwrap();
|
|
||||||
|
|
||||||
for expected in [
|
|
||||||
"continuwuity_mimalloc_memory_bytes{kind=\"reserved\"}",
|
|
||||||
"continuwuity_mimalloc_memory_bytes{kind=\"reserved_peak\"}",
|
|
||||||
"continuwuity_mimalloc_memory_bytes{kind=\"committed\"}",
|
|
||||||
"continuwuity_mimalloc_memory_bytes{kind=\"committed_peak\"}",
|
|
||||||
] {
|
|
||||||
assert!(body.contains(expected), "missing {expected:?} in:\n{body}");
|
|
||||||
}
|
|
||||||
assert!(
|
|
||||||
!body.contains("continuwuity_jemalloc_memory_bytes"),
|
|
||||||
"unexpected jemalloc metric in mimalloc build:\n{body}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
+14
-2
@@ -8,6 +8,19 @@ pub mod info;
|
|||||||
pub mod log;
|
pub mod log;
|
||||||
pub mod matrix;
|
pub mod matrix;
|
||||||
pub mod metrics;
|
pub mod metrics;
|
||||||
|
pub mod mods;
|
||||||
|
|
||||||
|
#[cfg(any(not(conduwuit_mods), not(feature = "conduwuit_mods")))]
|
||||||
|
pub mod mods {
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_ctor {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_dtor {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
}
|
||||||
pub mod server;
|
pub mod server;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
@@ -24,8 +37,7 @@ pub use error::Error;
|
|||||||
pub use info::version::*;
|
pub use info::version::*;
|
||||||
pub use matrix::{Event, EventTypeExt, Pdu, PduCount, PduEvent, PduId, pdu, state_res};
|
pub use matrix::{Event, EventTypeExt, Pdu, PduCount, PduEvent, PduId, pdu, state_res};
|
||||||
pub use parking_lot::{
|
pub use parking_lot::{
|
||||||
MappedMutexGuard as SyncMappedMutexGuard, Mutex as SyncMutex, MutexGuard as SyncMutexGuard,
|
Mutex as SyncMutex, RwLock as SyncRwLock, RwLockReadGuard as SyncRwLockReadGuard,
|
||||||
RwLock as SyncRwLock, RwLockReadGuard as SyncRwLockReadGuard,
|
|
||||||
RwLockWriteGuard as SyncRwLockWriteGuard,
|
RwLockWriteGuard as SyncRwLockWriteGuard,
|
||||||
};
|
};
|
||||||
pub use server::Server;
|
pub use server::Server;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
use std::sync::atomic::{AtomicI32, Ordering};
|
||||||
|
|
||||||
|
const ORDERING: Ordering = Ordering::Relaxed;
|
||||||
|
static STATIC_DTORS: AtomicI32 = AtomicI32::new(0);
|
||||||
|
|
||||||
|
/// Called by Module::unload() to indicate module is about to be unloaded and
|
||||||
|
/// static destruction is intended. This will allow verifying it actually took
|
||||||
|
/// place.
|
||||||
|
pub(crate) fn prepare() {
|
||||||
|
let count = STATIC_DTORS.fetch_sub(1, ORDERING);
|
||||||
|
debug_assert!(count <= 0, "STATIC_DTORS should not be greater than zero.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Called by static destructor of a module. This call should only be found
|
||||||
|
/// inside a mod_fini! macro. Do not call from anywhere else.
|
||||||
|
#[inline(always)]
|
||||||
|
pub fn report() { let _count = STATIC_DTORS.fetch_add(1, ORDERING); }
|
||||||
|
|
||||||
|
/// Called by Module::unload() (see check()) with action in case a check()
|
||||||
|
/// failed. This can allow a stuck module to be noted while allowing for other
|
||||||
|
/// independent modules to be diagnosed.
|
||||||
|
pub(crate) fn check_and_reset() -> bool { STATIC_DTORS.swap(0, ORDERING) == 0 }
|
||||||
|
|
||||||
|
/// Called by Module::unload() after unload to verify static destruction took
|
||||||
|
/// place. A call to prepare() must be made prior to Module::unload() and making
|
||||||
|
/// this call.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub(crate) fn check() -> bool { STATIC_DTORS.load(ORDERING) == 0 }
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_ctor {
|
||||||
|
( $($body:block)? ) => {
|
||||||
|
$crate::mod_init! {{
|
||||||
|
$crate::debug_info!("Module loaded");
|
||||||
|
$($body)?
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_dtor {
|
||||||
|
( $($body:block)? ) => {
|
||||||
|
$crate::mod_fini! {{
|
||||||
|
$crate::debug_info!("Module unloading");
|
||||||
|
$($body)?
|
||||||
|
$crate::mods::canary::report();
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_init {
|
||||||
|
($body:block) => {
|
||||||
|
#[used]
|
||||||
|
#[cfg_attr(target_family = "unix", unsafe(link_section = ".init_array"))]
|
||||||
|
static MOD_INIT: unsafe extern "C" fn() = { _mod_init };
|
||||||
|
|
||||||
|
#[cfg_attr(target_family = "unix", unsafe(link_section = ".text.startup"))]
|
||||||
|
unsafe extern "C" fn _mod_init() -> () $body
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! mod_fini {
|
||||||
|
($body:block) => {
|
||||||
|
#[used]
|
||||||
|
#[cfg_attr(target_family = "unix", unsafe(link_section = ".fini_array"))]
|
||||||
|
static MOD_FINI: unsafe extern "C" fn() = { _mod_fini };
|
||||||
|
|
||||||
|
#[cfg_attr(target_family = "unix", unsafe(link_section = ".text.startup"))]
|
||||||
|
unsafe extern "C" fn _mod_fini() -> () $body
|
||||||
|
};
|
||||||
|
}
|
||||||
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user