Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3986b3350 | |||
| d5db11eb45 | |||
| ba80fbd2a4 | |||
| 3a1941a972 | |||
| e6ab3ac2ad | |||
| fd428e9512 | |||
| 32188ba1f9 | |||
| a51bc163f5 | |||
| f27d98cfb5 | |||
| d62c01b3c0 | |||
| debc8b6164 | |||
| fee442c5c5 | |||
| 924adfb4e0 | |||
| f25764a158 | |||
| 59cdec4932 | |||
| b036a4fa75 | |||
| 00baef9c00 | |||
| 0e95b2d3cb | |||
| ea3834b19b | |||
| b9d7185290 | |||
| e5f00926d7 | |||
| ede82e7b90 | |||
| 8d1b597b6b | |||
| f43b8d449b | |||
| 15c3e03908 | |||
| fdc6e05443 | |||
| 05002267a7 | |||
| 2aec32c007 | |||
| 148628dbc8 | |||
| 7809f0a6ae | |||
| 85cb559002 | |||
| 61f49ecf0e | |||
| 5e880ac44a | |||
| 7f7bd91e8a | |||
| 96e1938616 | |||
| 694b926366 | |||
| c8c3a9ed43 | |||
| 896c372cfe | |||
| 2be43d3712 | |||
| 0301c7c083 | |||
| a2a7b81076 | |||
| ea6425712a | |||
| 19f313b91d | |||
| e2827a1a79 | |||
| b1b88601ab | |||
| e9ce642795 | |||
| a7966b8f05 | |||
| b78d79a45a | |||
| 8c3f946e97 | |||
| abceae26de | |||
| 95ea665649 | |||
| 6fe0ea05b8 | |||
| ba03d55879 | |||
| 9b5c4697bf | |||
| 16572a868a | |||
| b079b94715 | |||
| 19135eaa58 | |||
| e7c6b8c91b | |||
| 1ecbf55d68 | |||
| 4c841cd909 | |||
| c48535ef32 | |||
| 5473631e1d | |||
| de8f773620 | |||
| b4fa306a20 |
@@ -6,16 +6,23 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Required to make some things output color
|
# Required to make some things output color
|
||||||
TERM: ansi
|
TERM: ansi
|
||||||
|
# Publishing to my nix binary cache
|
||||||
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||||
|
# Just in case incremental is still being set to true, speeds up CI
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
|
# Custom nix binary cache if fork is being used
|
||||||
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
||||||
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
@@ -247,4 +254,4 @@ jobs:
|
|||||||
if [[ -n "$GITHUB_REF_NAME" ]]; then
|
if [[ -n "$GITHUB_REF_NAME" ]]; then
|
||||||
docker manifest create $IMAGE_NAME:latest --amend $IMAGE_NAME:$GITHUB_SHA-$IMAGE_SUFFIX_AMD64 --amend $IMAGE_NAME:$GITHUB_SHA-$IMAGE_SUFFIX_ARM64V8
|
docker manifest create $IMAGE_NAME:latest --amend $IMAGE_NAME:$GITHUB_SHA-$IMAGE_SUFFIX_AMD64 --amend $IMAGE_NAME:$GITHUB_SHA-$IMAGE_SUFFIX_ARM64V8
|
||||||
docker manifest push $IMAGE_NAME:latest
|
docker manifest push $IMAGE_NAME:latest
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
name: Documentation and GitHub Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Required to make some things output color
|
||||||
|
TERM: ansi
|
||||||
|
# Publishing to my nix binary cache
|
||||||
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||||
|
# Custom nix binary cache if fork is being used
|
||||||
|
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
||||||
|
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
name: Documentation and GitHub Pages
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Sync repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup GitHub Pages
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
|
|
||||||
|
- name: Install Nix (with flakes and nix-command enabled)
|
||||||
|
uses: cachix/install-nix-action@v26
|
||||||
|
with:
|
||||||
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
|
|
||||||
|
# Add `nix-community`, Crane, upstream Conduit, and conduwuit binary caches
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
extra-substituters = https://nix-community.cachix.org
|
||||||
|
extra-trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
|
||||||
|
extra-substituters = https://crane.cachix.org
|
||||||
|
extra-trusted-public-keys = crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=
|
||||||
|
extra-substituters = https://nix.computer.surgery/conduit
|
||||||
|
extra-trusted-public-keys = conduit:ZGAf6P6LhNvnoJJ3Me3PRg7tlLSrPxcQ2RiE5LIppjo=
|
||||||
|
extra-substituters = https://attic.kennel.juneis.dog/conduit
|
||||||
|
extra-trusted-public-keys = conduit:Isq8FGyEC6FOXH6nD+BOeAA+bKp6X6UIbupSlGEPuOg=
|
||||||
|
extra-substituters = https://attic.kennel.juneis.dog/conduwuit
|
||||||
|
extra-trusted-public-keys = conduwuit:lYPVh7o1hLu1idH4Xt2QHaRa49WRGSAqzcfFd94aOTw=
|
||||||
|
|
||||||
|
- name: Add alternative Nix binary caches if specified
|
||||||
|
if: ${{ (env.ATTIC_ENDPOINT != '') && (env.ATTIC_PUBLIC_KEY != '') }}
|
||||||
|
run: |
|
||||||
|
echo "extra-substituters = ${{ env.ATTIC_ENDPOINT }}" >> /etc/nix/nix.conf
|
||||||
|
echo "extra-trusted-public-keys = ${{ env.ATTIC_PUBLIC_KEY }}" >> /etc/nix/nix.conf
|
||||||
|
|
||||||
|
- name: Pop/push Magic Nix Cache
|
||||||
|
uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
|
- name: Configure `nix-direnv`
|
||||||
|
run: |
|
||||||
|
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' > "$HOME/.direnvrc"
|
||||||
|
|
||||||
|
- name: Install `direnv` and `nix-direnv`
|
||||||
|
run: nix-env -f "<nixpkgs>" -iA direnv -iA nix-direnv
|
||||||
|
|
||||||
|
# Do this to shorten the logs for the real CI step
|
||||||
|
- name: Populate `/nix/store`
|
||||||
|
run: nix develop --command true
|
||||||
|
|
||||||
|
- name: Allow direnv
|
||||||
|
run: direnv allow
|
||||||
|
|
||||||
|
- name: Cache x86_64 inputs for devShell
|
||||||
|
run: |
|
||||||
|
./bin/nix-build-and-cache .#devShells.x86_64-linux.default.inputDerivation
|
||||||
|
|
||||||
|
- name: Build documentation (book)
|
||||||
|
run: |
|
||||||
|
./bin/nix-build-and-cache .#book
|
||||||
|
cp -r --dereference result public
|
||||||
|
- name: Upload generated documentation (book) as normal artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: public
|
||||||
|
path: public
|
||||||
|
if-no-files-found: error
|
||||||
|
# don't compress again
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
|
- name: Upload generated documentation (book) as GitHub Pages artifact
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: public
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
@@ -75,5 +75,8 @@ test-conduit.toml
|
|||||||
# Gitlab CI cache
|
# Gitlab CI cache
|
||||||
/.gitlab-ci.d
|
/.gitlab-ci.d
|
||||||
|
|
||||||
|
# mdbook output
|
||||||
|
public/
|
||||||
|
|
||||||
# macOS
|
# macOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
+19
-2
@@ -105,6 +105,10 @@ artifacts:
|
|||||||
|
|
||||||
- ./bin/nix-build-and-cache .#oci-image-aarch64-unknown-linux-musl
|
- ./bin/nix-build-and-cache .#oci-image-aarch64-unknown-linux-musl
|
||||||
- cp result oci-image-arm64v8.tar.gz
|
- cp result oci-image-arm64v8.tar.gz
|
||||||
|
|
||||||
|
- ./bin/nix-build-and-cache .#book
|
||||||
|
# We can't just copy the symlink, we need to dereference it https://gitlab.com/gitlab-org/gitlab/-/issues/19746
|
||||||
|
- cp -r --dereference result public
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- x86_64-unknown-linux-musl
|
- x86_64-unknown-linux-musl
|
||||||
@@ -112,6 +116,7 @@ artifacts:
|
|||||||
- x86_64-unknown-linux-musl.deb
|
- x86_64-unknown-linux-musl.deb
|
||||||
- oci-image-amd64.tar.gz
|
- oci-image-amd64.tar.gz
|
||||||
- oci-image-arm64v8.tar.gz
|
- oci-image-arm64v8.tar.gz
|
||||||
|
- public
|
||||||
rules:
|
rules:
|
||||||
# CI required for all MRs
|
# CI required for all MRs
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
@@ -124,9 +129,9 @@ artifacts:
|
|||||||
|
|
||||||
.push-oci-image:
|
.push-oci-image:
|
||||||
stage: publish
|
stage: publish
|
||||||
image: docker:25.0.4
|
image: docker:25.0.5
|
||||||
services:
|
services:
|
||||||
- docker:25.0.4-dind
|
- docker:25.0.5-dind
|
||||||
variables:
|
variables:
|
||||||
IMAGE_SUFFIX_AMD64: amd64
|
IMAGE_SUFFIX_AMD64: amd64
|
||||||
IMAGE_SUFFIX_ARM64V8: arm64v8
|
IMAGE_SUFFIX_ARM64V8: arm64v8
|
||||||
@@ -164,3 +169,15 @@ oci-image:push-gitlab:
|
|||||||
IMAGE_NAME: $CI_REGISTRY_IMAGE/conduwuit
|
IMAGE_NAME: $CI_REGISTRY_IMAGE/conduwuit
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
|
||||||
|
pages:
|
||||||
|
stage: publish
|
||||||
|
dependencies:
|
||||||
|
- artifacts
|
||||||
|
only:
|
||||||
|
- next
|
||||||
|
script:
|
||||||
|
- "true"
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Docs: Map markdown to html files
|
||||||
|
- source: /docs/(.+)\.md/
|
||||||
|
public: '\1.html'
|
||||||
Generated
+111
-101
@@ -102,7 +102,7 @@ checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -245,7 +245,7 @@ version = "0.69.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
|
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
"itertools 0.12.1",
|
"itertools 0.12.1",
|
||||||
@@ -256,7 +256,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"shlex",
|
"shlex",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -267,9 +267,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.4.2"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake2"
|
name = "blake2"
|
||||||
@@ -355,6 +355,15 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.35"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clang-sys"
|
name = "clang-sys"
|
||||||
version = "1.7.0"
|
version = "1.7.0"
|
||||||
@@ -395,7 +404,7 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -421,11 +430,13 @@ dependencies = [
|
|||||||
"axum-server-dual-protocol",
|
"axum-server-dual-protocol",
|
||||||
"base64 0.22.0",
|
"base64 0.22.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"cyborgtime",
|
"cyborgtime",
|
||||||
"either",
|
"either",
|
||||||
"figment",
|
"figment",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"hickory-resolver",
|
||||||
"hmac",
|
"hmac",
|
||||||
"http",
|
"http",
|
||||||
"hyper",
|
"hyper",
|
||||||
@@ -467,7 +478,6 @@ dependencies = [
|
|||||||
"tracing-flame",
|
"tracing-flame",
|
||||||
"tracing-opentelemetry",
|
"tracing-opentelemetry",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"trust-dns-resolver",
|
|
||||||
"webpage",
|
"webpage",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -567,7 +577,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -664,7 +674,7 @@ dependencies = [
|
|||||||
"heck 0.4.1",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -789,7 +799,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -950,6 +960,51 @@ version = "0.4.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hickory-proto"
|
||||||
|
version = "0.24.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"cfg-if",
|
||||||
|
"data-encoding",
|
||||||
|
"enum-as-inner",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-io",
|
||||||
|
"futures-util",
|
||||||
|
"idna 0.4.0",
|
||||||
|
"ipnet",
|
||||||
|
"once_cell",
|
||||||
|
"rand",
|
||||||
|
"thiserror",
|
||||||
|
"tinyvec",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hickory-resolver"
|
||||||
|
version = "0.24.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"futures-util",
|
||||||
|
"hickory-proto",
|
||||||
|
"ipconfig",
|
||||||
|
"lru-cache",
|
||||||
|
"once_cell",
|
||||||
|
"parking_lot",
|
||||||
|
"rand",
|
||||||
|
"resolv-conf",
|
||||||
|
"smallvec",
|
||||||
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hmac"
|
name = "hmac"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -1112,9 +1167,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image-webp"
|
name = "image-webp"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ba6107a25f04af48ceeb4093eebc9b405ee5a1813a0bab5ecf1805d3eabb3337"
|
checksum = "7a84a25dcae3ac487bc24ef280f9e20c79c9b1a3e5e32cbed3041d1c514aa87c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -1301,7 +1356,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "libsqlite3-sys"
|
name = "libsqlite3-sys"
|
||||||
version = "0.28.0"
|
version = "0.28.0"
|
||||||
source = "git+https://github.com/rusqlite/rusqlite?branch=master#983f08b8d753deb60649661c8a1c3bc3bd4f358a"
|
source = "git+https://github.com/rusqlite/rusqlite?branch=master#20487e8c27c483de1a83c33176e47dd998e2a7d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
@@ -1470,7 +1525,7 @@ version = "0.28.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -1755,7 +1810,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"proc-macro2-diagnostics",
|
"proc-macro2-diagnostics",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1829,7 +1884,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1924,7 +1979,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
"version_check",
|
"version_check",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
@@ -2029,9 +2084,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.11.26"
|
version = "0.11.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2"
|
checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -2039,6 +2094,7 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2",
|
"h2",
|
||||||
|
"hickory-resolver",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"hyper",
|
"hyper",
|
||||||
@@ -2062,7 +2118,6 @@ dependencies = [
|
|||||||
"tokio-rustls",
|
"tokio-rustls",
|
||||||
"tokio-socks",
|
"tokio-socks",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"trust-dns-resolver",
|
|
||||||
"url",
|
"url",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
@@ -2098,7 +2153,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2117,7 +2172,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -2129,7 +2184,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.17.4"
|
version = "0.17.4"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"assign",
|
"assign",
|
||||||
@@ -2148,7 +2203,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
@@ -2167,6 +2222,7 @@ dependencies = [
|
|||||||
"serde_html_form",
|
"serde_html_form",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -2176,7 +2232,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.27.11"
|
version = "0.27.11"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
@@ -2198,7 +2254,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -2210,7 +2266,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -2219,7 +2275,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identity-service-api"
|
name = "ruma-identity-service-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -2229,7 +2285,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
@@ -2237,14 +2293,14 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"ruma-identifiers-validation",
|
"ruma-identifiers-validation",
|
||||||
"serde",
|
"serde",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
@@ -2256,7 +2312,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
@@ -2272,7 +2328,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#b36cacb4d1e7e8ef0a9afe4b82de4cc5fd9e2b6c"
|
source = "git+https://github.com/girlbossceo/ruma?branch=conduwuit-changes#5ab81eef0aff02f75570abc149f147af12417ca4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools 0.11.0",
|
"itertools 0.11.0",
|
||||||
"js_int",
|
"js_int",
|
||||||
@@ -2287,9 +2343,9 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "rusqlite"
|
name = "rusqlite"
|
||||||
version = "0.31.0"
|
version = "0.31.0"
|
||||||
source = "git+https://github.com/rusqlite/rusqlite?branch=master#983f08b8d753deb60649661c8a1c3bc3bd4f358a"
|
source = "git+https://github.com/rusqlite/rusqlite?branch=master#20487e8c27c483de1a83c33176e47dd998e2a7d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"fallible-iterator",
|
"fallible-iterator",
|
||||||
"fallible-streaming-iterator",
|
"fallible-streaming-iterator",
|
||||||
"hashlink",
|
"hashlink",
|
||||||
@@ -2299,8 +2355,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-librocksdb-sys"
|
name = "rust-librocksdb-sys"
|
||||||
version = "0.18.1+8.11.3"
|
version = "0.19.0+9.0.0"
|
||||||
source = "git+https://github.com/zaidoon1/rust-rocksdb?rev=3e4a0f632a8c0c2839c7d183725c53895110d907#3e4a0f632a8c0c2839c7d183725c53895110d907"
|
source = "git+https://github.com/zaidoon1/rust-rocksdb?rev=4b8491b9db45066115435881184902bbb23d3811#4b8491b9db45066115435881184902bbb23d3811"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"bzip2-sys",
|
"bzip2-sys",
|
||||||
@@ -2315,8 +2371,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-rocksdb"
|
name = "rust-rocksdb"
|
||||||
version = "0.22.7"
|
version = "0.22.8"
|
||||||
source = "git+https://github.com/zaidoon1/rust-rocksdb?rev=3e4a0f632a8c0c2839c7d183725c53895110d907#3e4a0f632a8c0c2839c7d183725c53895110d907"
|
source = "git+https://github.com/zaidoon1/rust-rocksdb?rev=4b8491b9db45066115435881184902bbb23d3811#4b8491b9db45066115435881184902bbb23d3811"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rust-librocksdb-sys",
|
"rust-librocksdb-sys",
|
||||||
@@ -2475,7 +2531,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2545,9 +2601,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.9.32"
|
version = "0.9.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f"
|
checksum = "a0623d197252096520c6f2a5e1171ee436e5af99a5d7caa2891e55e61950e6d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -2741,9 +2797,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.52"
|
version = "2.0.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
|
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2805,7 +2861,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2943,7 +2999,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3049,7 +3105,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
|
checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-compression",
|
"async-compression",
|
||||||
"bitflags 2.4.2",
|
"bitflags 2.5.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -3097,7 +3153,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3168,52 +3224,6 @@ dependencies = [
|
|||||||
"tracing-log",
|
"tracing-log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "trust-dns-proto"
|
|
||||||
version = "0.23.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"cfg-if",
|
|
||||||
"data-encoding",
|
|
||||||
"enum-as-inner",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-io",
|
|
||||||
"futures-util",
|
|
||||||
"idna 0.4.0",
|
|
||||||
"ipnet",
|
|
||||||
"once_cell",
|
|
||||||
"rand",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror",
|
|
||||||
"tinyvec",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "trust-dns-resolver"
|
|
||||||
version = "0.23.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"futures-util",
|
|
||||||
"ipconfig",
|
|
||||||
"lru-cache",
|
|
||||||
"once_cell",
|
|
||||||
"parking_lot",
|
|
||||||
"rand",
|
|
||||||
"resolv-conf",
|
|
||||||
"smallvec",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
"trust-dns-proto",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "try-lock"
|
name = "try-lock"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
@@ -3273,9 +3283,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
version = "0.2.10"
|
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 = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b"
|
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "untrusted"
|
name = "untrusted"
|
||||||
@@ -3308,9 +3318,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.7.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
|
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
]
|
]
|
||||||
@@ -3369,7 +3379,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3403,7 +3413,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@@ -3671,7 +3681,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.53",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+10
-4
@@ -27,7 +27,7 @@ base64 = "0.22.0"
|
|||||||
ring = "0.17.8"
|
ring = "0.17.8"
|
||||||
|
|
||||||
# Used when querying the SRV record of other servers
|
# Used when querying the SRV record of other servers
|
||||||
trust-dns-resolver = "0.23.2"
|
hickory-resolver = "0.24.0"
|
||||||
|
|
||||||
# Used to find matching events for appservices
|
# Used to find matching events for appservices
|
||||||
regex = "1.10.3"
|
regex = "1.10.3"
|
||||||
@@ -67,6 +67,12 @@ cyborgtime = "2.1.1"
|
|||||||
bytes = "1.5.0"
|
bytes = "1.5.0"
|
||||||
http = "0.2.12"
|
http = "0.2.12"
|
||||||
|
|
||||||
|
# standard date and time tools
|
||||||
|
[dependencies.chrono]
|
||||||
|
version = "0.4.35"
|
||||||
|
features = ["alloc"]
|
||||||
|
default-features = false
|
||||||
|
|
||||||
# Web framework
|
# Web framework
|
||||||
[dependencies.axum]
|
[dependencies.axum]
|
||||||
version = "0.6.20"
|
version = "0.6.20"
|
||||||
@@ -101,7 +107,7 @@ features = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11.26"
|
version = "0.11.27"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = [
|
features = [
|
||||||
"rustls-tls-native-roots",
|
"rustls-tls-native-roots",
|
||||||
@@ -116,7 +122,7 @@ version = "1.0.197"
|
|||||||
features = ["rc"]
|
features = ["rc"]
|
||||||
# Used for appservice registration files
|
# Used for appservice registration files
|
||||||
[dependencies.serde_yaml]
|
[dependencies.serde_yaml]
|
||||||
version = "0.9.32"
|
version = "0.9.33"
|
||||||
# Used for ruma wrapper
|
# Used for ruma wrapper
|
||||||
[dependencies.serde_json]
|
[dependencies.serde_json]
|
||||||
version = "1.0.114"
|
version = "1.0.114"
|
||||||
@@ -255,7 +261,7 @@ features = [
|
|||||||
[dependencies.rust-rocksdb]
|
[dependencies.rust-rocksdb]
|
||||||
git = "https://github.com/zaidoon1/rust-rocksdb"
|
git = "https://github.com/zaidoon1/rust-rocksdb"
|
||||||
#branch = "master"
|
#branch = "master"
|
||||||
rev = "3e4a0f632a8c0c2839c7d183725c53895110d907"
|
rev = "4b8491b9db45066115435881184902bbb23d3811"
|
||||||
optional = true
|
optional = true
|
||||||
default-features = true
|
default-features = true
|
||||||
features = [
|
features = [
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
# conduwuit
|
# conduwuit
|
||||||
### a well maintained fork of [Conduit](https://conduit.rs/)
|
|
||||||
|
|
||||||
[](https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml)
|
[](https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml)
|
||||||
|
|
||||||
|
<!-- ANCHOR: catchphrase -->
|
||||||
|
### a well maintained fork of [Conduit](https://conduit.rs/)
|
||||||
|
<!-- ANCHOR_END: catchphrase -->
|
||||||
|
|
||||||
|
Visit the [Conduwuit documentation](https://conduwuit.puppyirl.gay/) for more information.
|
||||||
|
Alternatively you can open [docs/introduction.md](docs/introduction.md) in this repository.
|
||||||
|
|
||||||
|
<!-- ANCHOR: body -->
|
||||||
#### What is Matrix?
|
#### What is Matrix?
|
||||||
|
|
||||||
[Matrix](https://matrix.org) is an open network for secure and decentralized
|
[Matrix](https://matrix.org) is an open network for secure and decentralized
|
||||||
communication. Users from every Matrix homeserver can chat with users from all
|
communication. Users from every Matrix homeserver can chat with users from all
|
||||||
other Matrix servers. You can even use bridges (also called Matrix Appservices)
|
other Matrix servers. You can even use bridges (also called Matrix Appservices)
|
||||||
@@ -27,11 +35,7 @@ from time to time.
|
|||||||
|
|
||||||
There are still a few nice to have features missing that some users may notice:
|
There are still a few nice to have features missing that some users may notice:
|
||||||
|
|
||||||
- Outgoing read receipts and typing indicators (receiving works)
|
- Outgoing typing indicators (receiving works)
|
||||||
|
|
||||||
#### What's different about your fork than upstream Conduit?
|
|
||||||
|
|
||||||
See [DIFFERENCES.md](DIFFERENCES.md)
|
|
||||||
|
|
||||||
#### Why does this fork exist? Why don't you contribute back upstream?
|
#### Why does this fork exist? Why don't you contribute back upstream?
|
||||||
|
|
||||||
@@ -45,16 +49,9 @@ I now intend on contributing back as time and mental energy sees fit, but my for
|
|||||||
- Have a **stable** testing ground for some MRs or new features and bug fixes
|
- Have a **stable** testing ground for some MRs or new features and bug fixes
|
||||||
|
|
||||||
And various other reasons that may not be listed here.
|
And various other reasons that may not be listed here.
|
||||||
|
<!-- ANCHOR_END: body -->
|
||||||
|
|
||||||
#### How can I deploy my own?
|
<!-- ANCHOR: footer -->
|
||||||
|
|
||||||
conduwuit officially supports Linux, macOS, BSD, and Windows.
|
|
||||||
|
|
||||||
- Simple install (this was tested the most): [DEPLOY.md](DEPLOY.md)
|
|
||||||
- Nix/NixOS (and binary cache): [nix/README.md](nix/README.md)
|
|
||||||
|
|
||||||
If you want to connect an Appservice to Conduit, take a look at [APPSERVICES.md](APPSERVICES.md).
|
|
||||||
|
|
||||||
#### How can I contribute?
|
#### How can I contribute?
|
||||||
|
|
||||||
1. Look for an issue you would like to work on and make sure it's not assigned
|
1. Look for an issue you would like to work on and make sure it's not assigned
|
||||||
@@ -72,9 +69,9 @@ If you run into any question, feel free to
|
|||||||
|
|
||||||
#### Donate
|
#### Donate
|
||||||
|
|
||||||
Liberapay: <https://liberapay.com/girlbossceo>\
|
- Liberapay: <https://liberapay.com/girlbossceo>
|
||||||
Ko-fi: <https://ko-fi.com/puppygock>\
|
- Ko-fi: <https://ko-fi.com/puppygock>
|
||||||
GitHub Sponsors: <https://github.com/sponsors/girlbossceo>
|
- GitHub Sponsors: <https://github.com/sponsors/girlbossceo>
|
||||||
|
|
||||||
#### Logo
|
#### Logo
|
||||||
|
|
||||||
@@ -86,8 +83,9 @@ Both.
|
|||||||
|
|
||||||
#### Mirrors of conduwuit
|
#### Mirrors of conduwuit
|
||||||
|
|
||||||
GitHub: <https://github.com/girlbossceo/conduwuit>\
|
- GitHub: <https://github.com/girlbossceo/conduwuit>
|
||||||
GitLab: <https://gitlab.com/girlbossceo/conduwuit>\
|
- GitLab: <https://gitlab.com/girlbossceo/conduwuit>
|
||||||
git.gay: <https://git.gay/june/conduwuit>\
|
- git.gay: <https://git.gay/june/conduwuit>
|
||||||
Codeberg: <https://codeberg.org/girlbossceo/conduwuit>\
|
- Codeberg: <https://codeberg.org/girlbossceo/conduwuit>
|
||||||
sourcehut: <https://git.sr.ht/~girlbossceo/conduwuit>
|
- sourcehut: <https://git.sr.ht/~girlbossceo/conduwuit>
|
||||||
|
<!-- ANCHOR_END: footer -->
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
[book]
|
||||||
|
title = "conduwuit"
|
||||||
|
description = "conduwuit, which is a fork of Conduit, is a simple, fast and reliable chat server for the Matrix protocol"
|
||||||
|
language = "en"
|
||||||
|
multilingual = false
|
||||||
|
src = "docs"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
build-dir = "public"
|
||||||
|
create-missing = true
|
||||||
|
|
||||||
|
[output.html]
|
||||||
|
git-repository-url = "https://github.com/girlbossceo/conduwuit"
|
||||||
|
edit-url-template = "https://github.com/girlbossceo/conduwuit/edit/main/{path}"
|
||||||
|
git-repository-icon = "fa-github-square"
|
||||||
|
|
||||||
|
[output.html.search]
|
||||||
|
limit-results = 15
|
||||||
+10
-4
@@ -173,7 +173,7 @@ registration_token = "change this token for something specific to your server"
|
|||||||
# This is checked upon room alias creation, custom room ID creation if used, and startup as warnings if any room aliases
|
# This is checked upon room alias creation, custom room ID creation if used, and startup as warnings if any room aliases
|
||||||
# in your database have a forbidden room alias/ID.
|
# in your database have a forbidden room alias/ID.
|
||||||
# No default.
|
# No default.
|
||||||
# forbidden_room_names = []
|
# forbidden_alias_names = []
|
||||||
|
|
||||||
# Set this to true to allow your server's public room directory to be federated.
|
# Set this to true to allow your server's public room directory to be federated.
|
||||||
# Set this to false to protect against /publicRooms spiders, but will forbid external users
|
# Set this to false to protect against /publicRooms spiders, but will forbid external users
|
||||||
@@ -263,6 +263,12 @@ url_preview_check_root_domain = false
|
|||||||
# Defaults to true as this is the fastest option for federation.
|
# Defaults to true as this is the fastest option for federation.
|
||||||
#query_trusted_key_servers_first = true
|
#query_trusted_key_servers_first = true
|
||||||
|
|
||||||
|
# List/vector of room **IDs** that conduwuit will make newly registered users join.
|
||||||
|
# The room IDs specified must be rooms that you have joined at least once on the server, and must be public.
|
||||||
|
#
|
||||||
|
# No default.
|
||||||
|
#auto_join_rooms = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Generic database options
|
### Generic database options
|
||||||
@@ -274,8 +280,8 @@ url_preview_check_root_domain = false
|
|||||||
|
|
||||||
# Set this to any float value in megabytes for conduwuit to tell the database engine that this much memory is available for database-related caches.
|
# Set this to any float value in megabytes for conduwuit to tell the database engine that this much memory is available for database-related caches.
|
||||||
# May be useful if you have significant memory to spare to increase performance.
|
# May be useful if you have significant memory to spare to increase performance.
|
||||||
# Defaults to 300.0
|
# Defaults to 256.0
|
||||||
#db_cache_capacity_mb = 300.0
|
#db_cache_capacity_mb = 256.0
|
||||||
|
|
||||||
# Interval in seconds when conduwuit will run database cleanup operations.
|
# Interval in seconds when conduwuit will run database cleanup operations.
|
||||||
#
|
#
|
||||||
@@ -314,7 +320,7 @@ url_preview_check_root_domain = false
|
|||||||
# Amount of threads that RocksDB will use for parallelism. Set to 0 to use all your physical cores.
|
# Amount of threads that RocksDB will use for parallelism. Set to 0 to use all your physical cores.
|
||||||
# Conduit eagerly spawns threads mainly for federation, so it may not be desirable to use all your cores / logical threads.
|
# Conduit eagerly spawns threads mainly for federation, so it may not be desirable to use all your cores / logical threads.
|
||||||
#
|
#
|
||||||
# Defaults to your CPU physical core count (not logical threads) count divided by 2 (half)
|
# Defaults to your CPU physical core count (not logical threads).
|
||||||
#rocksdb_parallelism_threads = 0
|
#rocksdb_parallelism_threads = 0
|
||||||
|
|
||||||
# Maximum number of LOG files RocksDB will keep. This must *not* be set to 0. It must be at least 1.
|
# Maximum number of LOG files RocksDB will keep. This must *not* be set to 0. It must be at least 1.
|
||||||
|
|||||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ Installation
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
Information about downloading, building and deploying the Debian package, see
|
Information about downloading, building and deploying the Debian package, see
|
||||||
the "Installing Conduit" section in [DEPLOY.md](../DEPLOY.md).
|
the "Installing Conduit" section in the Deploying docs.
|
||||||
All following sections until "Setting up the Reverse Proxy" be ignored because
|
All following sections until "Setting up the Reverse Proxy" be ignored because
|
||||||
this is handled automatically by the packaging.
|
this is handled automatically by the packaging.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Summary
|
||||||
|
|
||||||
|
- [Introduction](introduction.md)
|
||||||
|
- [Differences from upstream Conduit](differences.md)
|
||||||
|
|
||||||
|
- [Example configuration](configuration.md)
|
||||||
|
- [Deployment options](deploying.md)
|
||||||
|
- [Simple (Recommended)](deploying/simple.md)
|
||||||
|
- [Debian](deploying/debian.md)
|
||||||
|
- [Docker](deploying/docker.md)
|
||||||
|
- [Nix](deploying/nix.md)
|
||||||
|
- [TURN](turn.md)
|
||||||
|
- [Appservices](appservices.md)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Example configuration
|
||||||
|
|
||||||
|
``` toml
|
||||||
|
{{#include ../conduwuit-example.toml}}
|
||||||
|
```
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Deployment options
|
||||||
|
|
||||||
|
There are several ways to deploy a Conduit server.
|
||||||
|
|
||||||
|
- [Simple (Recommended)](deploying/simple.md) - This is the recommended way to set up Conduit.
|
||||||
|
- [Debian](deploying/debian.md) - If you're using a debian-based system, you may find the `deb` package useful.
|
||||||
|
- [Docker](deploying/docker.md) - We provide multi-arch OCI images for Conduit.
|
||||||
|
- [Nix](deploying/nix.md) - Nix flake based setup.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{{#include ../../debian/README.md}}
|
||||||
@@ -70,7 +70,7 @@ docker run -d -p 8448:6167 \
|
|||||||
|
|
||||||
or you can use [docker-compose](#docker-compose).
|
or you can use [docker-compose](#docker-compose).
|
||||||
|
|
||||||
The `-d` flag lets the container run in detached mode. You now need to supply a `conduit.toml` config file, an example can be found [here](../conduwuit-example.toml).
|
The `-d` flag lets the container run in detached mode. You now need to supply a `conduit.toml` config file, an example can be found [here](../configuration.md).
|
||||||
You can pass in different env vars to change config values on the fly. You can even configure Conduit completely by using env vars, but for that you need
|
You can pass in different env vars to change config values on the fly. You can even configure Conduit completely by using env vars, but for that you need
|
||||||
to pass `-e CONDUIT_CONFIG=""` into your container. For an overview of possible values, please take a look at the `docker-compose.yml` file.
|
to pass `-e CONDUIT_CONFIG=""` into your container. For an overview of possible values, please take a look at the `docker-compose.yml` file.
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ When picking the traefik-related compose file, rename it so it matches `docker-c
|
|||||||
rename the override file to `docker-compose.override.yml`. Edit the latter with the values you want
|
rename the override file to `docker-compose.override.yml`. Edit the latter with the values you want
|
||||||
for your server.
|
for your server.
|
||||||
|
|
||||||
Additional info about deploying Conduit can be found [here](../DEPLOY.md).
|
Additional info about deploying Conduit can be found [here](simple.md).
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ So...step by step:
|
|||||||
1. Copy [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
|
1. Copy [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or
|
||||||
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and [`docker-compose.override.yml`](docker-compose.override.yml) from the repository and remove `.for-traefik` (or `.with-traefik`) from the filename.
|
[`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and [`docker-compose.override.yml`](docker-compose.override.yml) from the repository and remove `.for-traefik` (or `.with-traefik`) from the filename.
|
||||||
2. Open both files and modify/adjust them to your needs. Meaning, change the `CONDUIT_SERVER_NAME` and the volume host mappings according to your needs.
|
2. Open both files and modify/adjust them to your needs. Meaning, change the `CONDUIT_SERVER_NAME` and the volume host mappings according to your needs.
|
||||||
3. Create the `conduit.toml` config file, an example can be found [here](../conduwuit-example.toml), or set `CONDUIT_CONFIG=""` and configure Conduit per env vars.
|
3. Create the `conduit.toml` config file, an example can be found [here](../configuration.md), or set `CONDUIT_CONFIG=""` and configure Conduit per env vars.
|
||||||
4. Uncomment the `element-web` service if you want to host your own Element Web Client and create a `element_config.json`.
|
4. Uncomment the `element-web` service if you want to host your own Element Web Client and create a `element_config.json`.
|
||||||
5. Create the files needed by the `well-known` service.
|
5. Create the files needed by the `well-known` service.
|
||||||
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
# Deploying Conduit
|
# Simple setup
|
||||||
|
|
||||||
|
This is the recommended way to set up Conduit. It is the easiest way to get started and is suitable for most use cases.
|
||||||
|
|
||||||
### Please note that this documentation is not fully representative of conduwuit at the moment. Assume majority of it is outdated.
|
### Please note that this documentation is not fully representative of conduwuit at the moment. Assume majority of it is outdated.
|
||||||
|
|
||||||
@@ -118,7 +120,7 @@ Now we need to create the Conduit's config file in `/etc/conduwuit/conduwuit.tom
|
|||||||
to read it. You need to change at least the server name.**
|
to read it. You need to change at least the server name.**
|
||||||
You can also choose to use a different database backend, but right now only `rocksdb` and `sqlite` are recommended.
|
You can also choose to use a different database backend, but right now only `rocksdb` and `sqlite` are recommended.
|
||||||
|
|
||||||
See the following example config at [conduwuit-example.toml](conduwuit-example.toml)
|
See the following example config at [conduwuit-example.toml](../configuration.md)
|
||||||
|
|
||||||
## Setting the correct file permissions
|
## Setting the correct file permissions
|
||||||
|
|
||||||
@@ -282,7 +284,7 @@ $ sudo systemctl enable conduit
|
|||||||
|
|
||||||
## How do I know it works?
|
## How do I know it works?
|
||||||
|
|
||||||
You can open <https://app.element.io>, enter your homeserver and try to register.
|
You can open [a Matrix client](https://matrix.org/ecosystem/clients), enter your homeserver and try to register.
|
||||||
|
|
||||||
You can also use these commands as a quick health check.
|
You can also use these commands as a quick health check.
|
||||||
|
|
||||||
@@ -300,8 +302,8 @@ $ curl https://your.server.name:8448/_matrix/client/versions
|
|||||||
|
|
||||||
## Audio/Video calls
|
## Audio/Video calls
|
||||||
|
|
||||||
For Audio/Video call functionality see the [TURN Guide](TURN.md).
|
For Audio/Video call functionality see the [TURN Guide](../turn.md).
|
||||||
|
|
||||||
## Appservices
|
## Appservices
|
||||||
|
|
||||||
If you want to set up an appservice, take a look at the [Appservice Guide](APPSERVICES.md).
|
If you want to set up an appservice, take a look at the [Appservice Guide](../appservices.md).
|
||||||
@@ -82,3 +82,9 @@
|
|||||||
- Admin debug command to fetch a PDU from a remote server and inserts it into our database/timeline
|
- Admin debug command to fetch a PDU from a remote server and inserts it into our database/timeline
|
||||||
- Update rusqlite/sqlite (not that you should be using it)
|
- Update rusqlite/sqlite (not that you should be using it)
|
||||||
- Disable update check by default as it's not useful for conduwuit
|
- Disable update check by default as it's not useful for conduwuit
|
||||||
|
- Declare various missing server capabilities at `/_matrix/client/v3/capabilities` which also fixes FluffyChat password resets, and other clients that expose basic features based on this endpoint's response
|
||||||
|
- Config option to disable incoming remote read receipts if desired
|
||||||
|
- Extend clear cache admin command to support clearing DNS and TLS name override caches
|
||||||
|
- Responsive outgoing read receipt EDU support
|
||||||
|
- Federation destination DNS cache support to call *less* of the thread-blocking `getaddrinfo(3)` significantly less, improving federation ping/latency
|
||||||
|
- Store the sender user with the MXC URL for all media uploads (`/upload`) (not for thumbnails or media requests which are unauthenticated)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Conduit
|
||||||
|
|
||||||
|
{{#include ../README.md:catchphrase}}
|
||||||
|
|
||||||
|
{{#include ../README.md:body}}
|
||||||
|
|
||||||
|
#### What's different about your fork than upstream Conduit?
|
||||||
|
|
||||||
|
See [differences.md](differences.md)
|
||||||
|
|
||||||
|
#### How can I deploy my own?
|
||||||
|
|
||||||
|
- [Deployment options](deploying.md)
|
||||||
|
|
||||||
|
If you want to connect an Appservice to Conduit, take a look at the [appservices documentation](appservices.md).
|
||||||
|
|
||||||
|
{{#include ../README.md:footer}}
|
||||||
+10
@@ -50,6 +50,11 @@ name = "cargo-deb"
|
|||||||
group = "versions"
|
group = "versions"
|
||||||
script = "cargo deb --version"
|
script = "cargo deb --version"
|
||||||
|
|
||||||
|
[[task]]
|
||||||
|
name = "lychee"
|
||||||
|
group = "versions"
|
||||||
|
script = "lychee --version"
|
||||||
|
|
||||||
[[task]]
|
[[task]]
|
||||||
name = "cargo-audit"
|
name = "cargo-audit"
|
||||||
group = "security"
|
group = "security"
|
||||||
@@ -77,6 +82,11 @@ name = "cargo-clippy"
|
|||||||
group = "lints"
|
group = "lints"
|
||||||
script = "cargo clippy --workspace --all-targets --all-features --color=always -- -D warnings"
|
script = "cargo clippy --workspace --all-targets --all-features --color=always -- -D warnings"
|
||||||
|
|
||||||
|
[[task]]
|
||||||
|
name = "lychee"
|
||||||
|
group = "lints"
|
||||||
|
script = "lychee --offline docs"
|
||||||
|
|
||||||
[[task]]
|
[[task]]
|
||||||
name = "cargo"
|
name = "cargo"
|
||||||
group = "tests"
|
group = "tests"
|
||||||
|
|||||||
@@ -208,6 +208,35 @@
|
|||||||
packages = {
|
packages = {
|
||||||
default = package pkgsHost;
|
default = package pkgsHost;
|
||||||
oci-image = mkOciImage pkgsHost self.packages.${system}.default;
|
oci-image = mkOciImage pkgsHost self.packages.${system}.default;
|
||||||
|
|
||||||
|
book =
|
||||||
|
let
|
||||||
|
package = self.packages.${system}.default;
|
||||||
|
in
|
||||||
|
pkgsHost.stdenv.mkDerivation {
|
||||||
|
pname = "${package.pname}-book";
|
||||||
|
version = package.version;
|
||||||
|
|
||||||
|
src = nix-filter {
|
||||||
|
root = ./.;
|
||||||
|
include = [
|
||||||
|
"book.toml"
|
||||||
|
"conduwuit-example.toml"
|
||||||
|
"README.md"
|
||||||
|
"debian/README.md"
|
||||||
|
"docs"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = (with pkgsHost; [
|
||||||
|
mdbook
|
||||||
|
]);
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
mdbook build
|
||||||
|
mv public $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
builtins.listToAttrs
|
builtins.listToAttrs
|
||||||
@@ -276,6 +305,9 @@
|
|||||||
|
|
||||||
# Needed for our script for Complement
|
# Needed for our script for Complement
|
||||||
jq
|
jq
|
||||||
|
|
||||||
|
# Needed for finding broken markdown links
|
||||||
|
lychee
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ use ruma::{
|
|||||||
events::{room::message::RoomMessageEventContent, GlobalAccountDataEventType},
|
events::{room::message::RoomMessageEventContent, GlobalAccountDataEventType},
|
||||||
push, UserId,
|
push, UserId,
|
||||||
};
|
};
|
||||||
use tracing::{info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||||
use crate::{api::client_server, services, utils, Error, Result, Ruma};
|
use crate::{
|
||||||
|
api::client_server::{self, join_room_by_id_helper},
|
||||||
|
services, utils, Error, Result, Ruma,
|
||||||
|
};
|
||||||
|
|
||||||
const RANDOM_USER_ID_LENGTH: usize = 10;
|
const RANDOM_USER_ID_LENGTH: usize = 10;
|
||||||
|
|
||||||
@@ -285,6 +288,35 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !services().globals.config.auto_join_rooms.is_empty() {
|
||||||
|
for room in &services().globals.config.auto_join_rooms {
|
||||||
|
if !services().rooms.state_cache.server_in_room(services().globals.server_name(), room)? {
|
||||||
|
warn!("Skipping room {room} to automatically join as we have never joined before.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(room_id_server_name) = room.server_name() {
|
||||||
|
match join_room_by_id_helper(
|
||||||
|
Some(&user_id),
|
||||||
|
room,
|
||||||
|
Some("Automatically joining this room upon registration".to_owned()),
|
||||||
|
&[room_id_server_name.to_owned(), services().globals.server_name().to_owned()],
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => {
|
||||||
|
info!("Automatically joined room {room} for user {user_id}");
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
// don't return this error so we don't fail registrations
|
||||||
|
error!("Failed to automatically join room {room} for user {user_id}: {e}");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(register::v3::Response {
|
Ok(register::v3::Response {
|
||||||
access_token: Some(token),
|
access_token: Some(token),
|
||||||
user_id,
|
user_id,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub async fn create_alias_route(body: Ruma<create_alias::v3::Request>) -> Result
|
|||||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Alias is from another server."));
|
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Alias is from another server."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if services().globals.forbidden_room_names().is_match(body.room_alias.alias()) {
|
if services().globals.forbidden_alias_names().is_match(body.room_alias.alias()) {
|
||||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias is forbidden."));
|
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias is forbidden."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma::api::client::discovery::get_capabilities::{
|
use ruma::api::client::discovery::get_capabilities::{
|
||||||
self, Capabilities, RoomVersionStability, RoomVersionsCapability,
|
self, Capabilities, ChangePasswordCapability, RoomVersionStability, RoomVersionsCapability, SetAvatarUrlCapability,
|
||||||
|
SetDisplayNameCapability, ThirdPartyIdChangesCapability,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{services, Result, Ruma};
|
use crate::{services, Result, Ruma};
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/capabilities`
|
/// # `GET /_matrix/client/v3/capabilities`
|
||||||
///
|
///
|
||||||
/// Get information on the supported feature set and other relevent capabilities
|
/// Get information on the supported feature set and other relevent capabilities
|
||||||
/// of this server.
|
/// of this server.
|
||||||
@@ -27,6 +28,23 @@ pub async fn get_capabilities_route(
|
|||||||
available,
|
available,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
capabilities.change_password = ChangePasswordCapability {
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
capabilities.set_avatar_url = SetAvatarUrlCapability {
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
capabilities.set_displayname = SetDisplayNameCapability {
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// conduit does not implement 3PID stuff
|
||||||
|
capabilities.thirdparty_id_changes = ThirdPartyIdChangesCapability {
|
||||||
|
enabled: false,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(get_capabilities::v3::Response {
|
Ok(get_capabilities::v3::Response {
|
||||||
capabilities,
|
capabilities,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||||||
(
|
(
|
||||||
server,
|
server,
|
||||||
tokio::time::timeout(
|
tokio::time::timeout(
|
||||||
Duration::from_secs(50),
|
Duration::from_secs(90),
|
||||||
services().sending.send_federation_request(
|
services().sending.send_federation_request(
|
||||||
server,
|
server,
|
||||||
federation::keys::get_keys::v1::Request {
|
federation::keys::get_keys::v1::Request {
|
||||||
@@ -323,7 +323,7 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("get_keys_helper query took too long: {}", e);
|
error!("get_keys_helper query took too long: {e}");
|
||||||
Error::BadServerResponse("get_keys_helper query took too long")
|
Error::BadServerResponse("get_keys_helper query took too long")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ pub async fn joined_members_route(body: Ruma<joined_members::v3::Request>) -> Re
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn join_room_by_id_helper(
|
pub(crate) async fn join_room_by_id_helper(
|
||||||
sender_user: Option<&UserId>, room_id: &RoomId, reason: Option<String>, servers: &[OwnedServerName],
|
sender_user: Option<&UserId>, room_id: &RoomId, reason: Option<String>, servers: &[OwnedServerName],
|
||||||
_third_party_signed: Option<&ThirdPartySigned>,
|
_third_party_signed: Option<&ThirdPartySigned>,
|
||||||
) -> Result<join_room_by_id::v3::Response> {
|
) -> Result<join_room_by_id::v3::Response> {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ pub async fn create_room_route(body: Ruma<create_room::v3::Request>) -> Result<c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply forbidden room alias checks to custom room IDs too
|
// apply forbidden room alias checks to custom room IDs too
|
||||||
if services().globals.forbidden_room_names().is_match(&custom_room_id_s) {
|
if services().globals.forbidden_alias_names().is_match(&custom_room_id_s) {
|
||||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Custom room ID is forbidden."));
|
return Err(Error::BadRequest(ErrorKind::Unknown, "Custom room ID is forbidden."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ pub async fn create_room_route(body: Ruma<create_room::v3::Request>) -> Result<c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if room alias is forbidden
|
// check if room alias is forbidden
|
||||||
if services().globals.forbidden_room_names().is_match(localpart) {
|
if services().globals.forbidden_alias_names().is_match(localpart) {
|
||||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias name is forbidden."));
|
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias name is forbidden."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1333,9 +1333,7 @@ pub async fn sync_events_v4_route(
|
|||||||
ruma::JsOption::Some(heroes_avatar)
|
ruma::JsOption::Some(heroes_avatar)
|
||||||
} else {
|
} else {
|
||||||
match services().rooms.state_accessor.get_avatar(room_id)? {
|
match services().rooms.state_accessor.get_avatar(room_id)? {
|
||||||
ruma::JsOption::Some(avatar) => {
|
ruma::JsOption::Some(avatar) => ruma::JsOption::from_option(avatar.url),
|
||||||
avatar.url.map_or(ruma::JsOption::Undefined, ruma::JsOption::Some)
|
|
||||||
},
|
|
||||||
ruma::JsOption::Null => ruma::JsOption::Null,
|
ruma::JsOption::Null => ruma::JsOption::Null,
|
||||||
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
|
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ pub async fn get_supported_versions_route(
|
|||||||
],
|
],
|
||||||
unstable_features: BTreeMap::from_iter([
|
unstable_features: BTreeMap::from_iter([
|
||||||
("org.matrix.e2e_cross_signing".to_owned(), true),
|
("org.matrix.e2e_cross_signing".to_owned(), true),
|
||||||
|
//("org.matrix.msc2285.stable".to_owned(), true),
|
||||||
("org.matrix.msc2836".to_owned(), true),
|
("org.matrix.msc2836".to_owned(), true),
|
||||||
("org.matrix.msc3827".to_owned(), true),
|
("org.matrix.msc3827".to_owned(), true),
|
||||||
("org.matrix.msc2946".to_owned(), true),
|
("org.matrix.msc2946".to_owned(), true),
|
||||||
|
|||||||
@@ -84,8 +84,7 @@ where
|
|||||||
appservice_registration
|
appservice_registration
|
||||||
{
|
{
|
||||||
match metadata.authentication {
|
match metadata.authentication {
|
||||||
// TODO: verify if just or'ing `AuthScheme::AppserviceToken` is correct here
|
AuthScheme::AccessToken => {
|
||||||
AuthScheme::AccessToken | AuthScheme::AccessTokenOptional | AuthScheme::AppserviceToken => {
|
|
||||||
let user_id = query_params.user_id.map_or_else(
|
let user_id = query_params.user_id.map_or_else(
|
||||||
|| {
|
|| {
|
||||||
UserId::parse_with_server_name(
|
UserId::parse_with_server_name(
|
||||||
@@ -97,6 +96,8 @@ where
|
|||||||
|s| UserId::parse(s).unwrap(),
|
|s| UserId::parse(s).unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
debug!("User ID: {:?}", user_id);
|
||||||
|
|
||||||
if !services().users.exists(&user_id)? {
|
if !services().users.exists(&user_id)? {
|
||||||
return Err(Error::BadRequest(ErrorKind::Forbidden, "User does not exist."));
|
return Err(Error::BadRequest(ErrorKind::Forbidden, "User does not exist."));
|
||||||
}
|
}
|
||||||
@@ -104,6 +105,27 @@ where
|
|||||||
// TODO: Check if appservice is allowed to be that user
|
// TODO: Check if appservice is allowed to be that user
|
||||||
(Some(user_id), None, None, true)
|
(Some(user_id), None, None, true)
|
||||||
},
|
},
|
||||||
|
AuthScheme::AccessTokenOptional | AuthScheme::AppserviceToken => {
|
||||||
|
let user_id = query_params.user_id.map_or_else(
|
||||||
|
|| {
|
||||||
|
UserId::parse_with_server_name(
|
||||||
|
registration.sender_localpart.as_str(),
|
||||||
|
services().globals.server_name(),
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
},
|
||||||
|
|s| UserId::parse(s).unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
|
debug!("User ID: {:?}", user_id);
|
||||||
|
|
||||||
|
if !services().users.exists(&user_id)? {
|
||||||
|
(None, None, None, true)
|
||||||
|
} else {
|
||||||
|
// TODO: Check if appservice is allowed to be that user
|
||||||
|
(Some(user_id), None, None, true)
|
||||||
|
}
|
||||||
|
},
|
||||||
AuthScheme::ServerSignatures => (None, None, None, true),
|
AuthScheme::ServerSignatures => (None, None, None, true),
|
||||||
AuthScheme::None => (None, None, None, true),
|
AuthScheme::None => (None, None, None, true),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use std::{
|
|||||||
use axum::{response::IntoResponse, Json};
|
use axum::{response::IntoResponse, Json};
|
||||||
use futures_util::future::TryFutureExt;
|
use futures_util::future::TryFutureExt;
|
||||||
use get_profile_information::v1::ProfileField;
|
use get_profile_information::v1::ProfileField;
|
||||||
|
use hickory_resolver::{error::ResolveError, lookup::SrvLookup};
|
||||||
use http::header::{HeaderValue, AUTHORIZATION};
|
use http::header::{HeaderValue, AUTHORIZATION};
|
||||||
use ipaddress::IPAddress;
|
use ipaddress::IPAddress;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -53,7 +54,6 @@ use ruma::{
|
|||||||
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use trust_dns_resolver::{error::ResolveError, lookup::SrvLookup};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
api::client_server::{self, claim_keys_helper, get_keys_helper},
|
||||||
|
|||||||
+1
-38
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{Parser, Subcommand};
|
use clap::Parser;
|
||||||
|
|
||||||
/// Commandline arguments
|
/// Commandline arguments
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
@@ -11,43 +11,6 @@ pub struct Args {
|
|||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
/// Optional argument to the path of a conduwuit config TOML file
|
/// Optional argument to the path of a conduwuit config TOML file
|
||||||
pub config: Option<PathBuf>,
|
pub config: Option<PathBuf>,
|
||||||
|
|
||||||
#[clap(subcommand)]
|
|
||||||
/// Optional subcommand to export the homeserver signing key and exit
|
|
||||||
pub signing_key: Option<SigningKey>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Subcommand)]
|
|
||||||
pub enum SigningKey {
|
|
||||||
/// Filesystem path to export the homeserver signing key to.
|
|
||||||
/// The output will be: `ed25519 <version> <keypair base64 encoded>` which
|
|
||||||
/// is Synapse's format
|
|
||||||
ExportPath {
|
|
||||||
path: PathBuf,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// Filesystem path for conduwuit to attempt to read and import the
|
|
||||||
/// homeserver signing key. The expected format is Synapse's format:
|
|
||||||
/// `ed25519 <version> <keypair base64 encoded>`
|
|
||||||
ImportPath {
|
|
||||||
path: PathBuf,
|
|
||||||
|
|
||||||
#[arg(long)]
|
|
||||||
/// Optional argument to import the key but don't overwrite our signing
|
|
||||||
/// key, and instead add it to `old_verify_keys`. This field tells other
|
|
||||||
/// servers that this is our old public key that can still be used to
|
|
||||||
/// sign old events.
|
|
||||||
///
|
|
||||||
/// See https://spec.matrix.org/v1.9/server-server-api/#get_matrixkeyv2server for more details.
|
|
||||||
add_to_old_public_keys: bool,
|
|
||||||
|
|
||||||
#[arg(long)]
|
|
||||||
/// Timestamp (`expired_ts`) in seconds since UNIX epoch that the old
|
|
||||||
/// homeserver signing key stopped being used.
|
|
||||||
///
|
|
||||||
/// See https://spec.matrix.org/v1.9/server-server-api/#get_matrixkeyv2server for more details.
|
|
||||||
timestamp: u64,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse commandline arguments into structured data
|
/// Parse commandline arguments into structured data
|
||||||
|
|||||||
+31
-8
@@ -10,7 +10,7 @@ use either::Either;
|
|||||||
use figment::Figment;
|
use figment::Figment;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use regex::RegexSet;
|
use regex::RegexSet;
|
||||||
use ruma::{OwnedServerName, RoomVersionId};
|
use ruma::{OwnedRoomId, OwnedServerName, RoomVersionId};
|
||||||
use serde::{de::IgnoredAny, Deserialize};
|
use serde::{de::IgnoredAny, Deserialize};
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error, warn};
|
||||||
|
|
||||||
@@ -41,7 +41,10 @@ pub struct Config {
|
|||||||
pub server_name: OwnedServerName,
|
pub server_name: OwnedServerName,
|
||||||
#[serde(default = "default_database_backend")]
|
#[serde(default = "default_database_backend")]
|
||||||
pub database_backend: String,
|
pub database_backend: String,
|
||||||
pub database_path: String,
|
pub database_path: PathBuf,
|
||||||
|
pub database_backup_path: Option<PathBuf>,
|
||||||
|
#[serde(default = "default_database_backups_to_keep")]
|
||||||
|
pub database_backups_to_keep: i16,
|
||||||
#[serde(default = "default_db_cache_capacity_mb")]
|
#[serde(default = "default_db_cache_capacity_mb")]
|
||||||
pub db_cache_capacity_mb: f64,
|
pub db_cache_capacity_mb: f64,
|
||||||
#[serde(default = "default_new_user_displayname_suffix")]
|
#[serde(default = "default_new_user_displayname_suffix")]
|
||||||
@@ -107,6 +110,9 @@ pub struct Config {
|
|||||||
#[serde(default = "default_turn_ttl")]
|
#[serde(default = "default_turn_ttl")]
|
||||||
pub turn_ttl: u64,
|
pub turn_ttl: u64,
|
||||||
|
|
||||||
|
#[serde(default = "Vec::new")]
|
||||||
|
pub auto_join_rooms: Vec<OwnedRoomId>,
|
||||||
|
|
||||||
#[serde(default = "default_rocksdb_log_level")]
|
#[serde(default = "default_rocksdb_log_level")]
|
||||||
pub rocksdb_log_level: String,
|
pub rocksdb_log_level: String,
|
||||||
#[serde(default = "default_rocksdb_max_log_file_size")]
|
#[serde(default = "default_rocksdb_max_log_file_size")]
|
||||||
@@ -172,7 +178,7 @@ pub struct Config {
|
|||||||
|
|
||||||
#[serde(default = "RegexSet::empty")]
|
#[serde(default = "RegexSet::empty")]
|
||||||
#[serde(with = "serde_regex")]
|
#[serde(with = "serde_regex")]
|
||||||
pub forbidden_room_names: RegexSet,
|
pub forbidden_alias_names: RegexSet,
|
||||||
|
|
||||||
#[serde(default = "RegexSet::empty")]
|
#[serde(default = "RegexSet::empty")]
|
||||||
#[serde(with = "serde_regex")]
|
#[serde(with = "serde_regex")]
|
||||||
@@ -251,7 +257,15 @@ impl fmt::Display for Config {
|
|||||||
let lines = [
|
let lines = [
|
||||||
("Server name", self.server_name.host()),
|
("Server name", self.server_name.host()),
|
||||||
("Database backend", &self.database_backend),
|
("Database backend", &self.database_backend),
|
||||||
("Database path", &self.database_path),
|
("Database path", &self.database_path.to_string_lossy()),
|
||||||
|
(
|
||||||
|
"Database backup path",
|
||||||
|
match &self.database_backup_path {
|
||||||
|
Some(path) => path.to_str().unwrap(),
|
||||||
|
None => "",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
("Database backups to keep", &self.database_backups_to_keep.to_string()),
|
||||||
("Database cache capacity (MB)", &self.db_cache_capacity_mb.to_string()),
|
("Database cache capacity (MB)", &self.db_cache_capacity_mb.to_string()),
|
||||||
("Cache capacity modifier", &self.conduit_cache_capacity_modifier.to_string()),
|
("Cache capacity modifier", &self.conduit_cache_capacity_modifier.to_string()),
|
||||||
("PDU cache capacity", &self.pdu_cache_capacity.to_string()),
|
("PDU cache capacity", &self.pdu_cache_capacity.to_string()),
|
||||||
@@ -353,6 +367,13 @@ impl fmt::Display for Config {
|
|||||||
}
|
}
|
||||||
&lst.join(", ")
|
&lst.join(", ")
|
||||||
}),
|
}),
|
||||||
|
("Auto Join Rooms", {
|
||||||
|
let mut lst = vec![];
|
||||||
|
for room in &self.auto_join_rooms {
|
||||||
|
lst.push(room);
|
||||||
|
}
|
||||||
|
&lst.into_iter().join(", ")
|
||||||
|
}),
|
||||||
#[cfg(feature = "compression-zstd")]
|
#[cfg(feature = "compression-zstd")]
|
||||||
("zstd Response Body Compression", &self.zstd_compression.to_string()),
|
("zstd Response Body Compression", &self.zstd_compression.to_string()),
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
@@ -405,8 +426,8 @@ impl fmt::Display for Config {
|
|||||||
("Forbidden usernames", {
|
("Forbidden usernames", {
|
||||||
&self.forbidden_usernames.patterns().iter().join(", ")
|
&self.forbidden_usernames.patterns().iter().join(", ")
|
||||||
}),
|
}),
|
||||||
("Forbidden room names", {
|
("Forbidden room aliases", {
|
||||||
&self.forbidden_room_names.patterns().iter().join(", ")
|
&self.forbidden_alias_names.patterns().iter().join(", ")
|
||||||
}),
|
}),
|
||||||
(
|
(
|
||||||
"URL preview domain contains allowlist",
|
"URL preview domain contains allowlist",
|
||||||
@@ -446,9 +467,11 @@ fn default_port() -> ListeningPort {
|
|||||||
|
|
||||||
fn default_unix_socket_perms() -> u32 { 660 }
|
fn default_unix_socket_perms() -> u32 { 660 }
|
||||||
|
|
||||||
|
fn default_database_backups_to_keep() -> i16 { 1 }
|
||||||
|
|
||||||
fn default_database_backend() -> String { "rocksdb".to_owned() }
|
fn default_database_backend() -> String { "rocksdb".to_owned() }
|
||||||
|
|
||||||
fn default_db_cache_capacity_mb() -> f64 { 300.0 }
|
fn default_db_cache_capacity_mb() -> f64 { 256.0 }
|
||||||
|
|
||||||
fn default_conduit_cache_capacity_modifier() -> f64 { 1.0 }
|
fn default_conduit_cache_capacity_modifier() -> f64 { 1.0 }
|
||||||
|
|
||||||
@@ -489,7 +512,7 @@ fn default_rocksdb_max_log_file_size() -> usize {
|
|||||||
4 * 1024 * 1024
|
4 * 1024 * 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_rocksdb_parallelism_threads() -> usize { num_cpus::get_physical() / 2 }
|
fn default_rocksdb_parallelism_threads() -> usize { 0 }
|
||||||
|
|
||||||
fn default_rocksdb_compression_algo() -> String { "zstd".to_owned() }
|
fn default_rocksdb_compression_algo() -> String { "zstd".to_owned() }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{future::Future, pin::Pin, sync::Arc};
|
use std::{error::Error, future::Future, pin::Pin, sync::Arc};
|
||||||
|
|
||||||
use super::Config;
|
use super::Config;
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
@@ -18,6 +18,8 @@ pub(crate) trait KeyValueDatabaseEngine: Send + Sync {
|
|||||||
Self: Sized;
|
Self: Sized;
|
||||||
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>>;
|
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>>;
|
||||||
fn flush(&self) -> Result<()>;
|
fn flush(&self) -> Result<()>;
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn sync(&self) -> Result<()> { Ok(()) }
|
||||||
fn cleanup(&self) -> Result<()> { Ok(()) }
|
fn cleanup(&self) -> Result<()> { Ok(()) }
|
||||||
fn memory_usage(&self) -> Result<String> {
|
fn memory_usage(&self) -> Result<String> {
|
||||||
Ok("Current database engine does not support memory usage reporting.".to_owned())
|
Ok("Current database engine does not support memory usage reporting.".to_owned())
|
||||||
@@ -25,6 +27,10 @@ pub(crate) trait KeyValueDatabaseEngine: Send + Sync {
|
|||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear_caches(&self) {}
|
fn clear_caches(&self) {}
|
||||||
|
|
||||||
|
fn backup(&self) -> Result<(), Box<dyn Error>> { unimplemented!() }
|
||||||
|
|
||||||
|
fn backup_list(&self) -> Result<String> { Ok(String::new()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) trait KvTree: Send + Sync {
|
pub(crate) trait KvTree: Send + Sync {
|
||||||
@@ -39,20 +45,37 @@ pub(crate) trait KvTree: Send + Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>;
|
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>;
|
||||||
fn insert_batch(&self, iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<()>;
|
fn insert_batch(&self, iter: &mut dyn Iterator<Item = (Vec<u8>, Vec<u8>)>) -> Result<()> {
|
||||||
|
for (key, value) in iter {
|
||||||
|
self.insert(&key, &value)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn remove(&self, key: &[u8]) -> Result<()>;
|
fn remove(&self, key: &[u8]) -> Result<()>;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "rocksdb")]
|
fn remove_batch(&self, iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()> {
|
||||||
fn remove_batch(&self, _iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()> { unimplemented!() }
|
for key in iter {
|
||||||
|
self.remove(&key)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
||||||
|
|
||||||
fn iter_from<'a>(&'a self, from: &[u8], backwards: bool) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
fn iter_from<'a>(&'a self, from: &[u8], backwards: bool) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
||||||
|
|
||||||
fn increment(&self, key: &[u8]) -> Result<Vec<u8>>;
|
fn increment(&self, key: &[u8]) -> Result<Vec<u8>>;
|
||||||
fn increment_batch(&self, iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()>;
|
fn increment_batch(&self, iter: &mut dyn Iterator<Item = Vec<u8>>) -> Result<()> {
|
||||||
|
for key in iter {
|
||||||
|
self.increment(&key)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn scan_prefix<'a>(&'a self, prefix: Vec<u8>) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
fn scan_prefix<'a>(&'a self, prefix: Vec<u8>) -> Box<dyn Iterator<Item = (Vec<u8>, Vec<u8>)> + 'a>;
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,24 @@ use std::{
|
|||||||
sync::{Arc, RwLock},
|
sync::{Arc, RwLock},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use chrono::{DateTime, Utc};
|
||||||
use rust_rocksdb::{
|
use rust_rocksdb::{
|
||||||
|
backup::{BackupEngine, BackupEngineOptions},
|
||||||
LogLevel::{Debug, Error, Fatal, Info, Warn},
|
LogLevel::{Debug, Error, Fatal, Info, Warn},
|
||||||
WriteBatchWithTransaction,
|
WriteBatchWithTransaction,
|
||||||
};
|
};
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, error, info};
|
||||||
|
|
||||||
use super::{super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree};
|
use super::{super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree};
|
||||||
use crate::{utils, Result};
|
use crate::{utils, Result};
|
||||||
|
|
||||||
pub(crate) struct Engine {
|
pub(crate) struct Engine {
|
||||||
rocks: rust_rocksdb::DBWithThreadMode<rust_rocksdb::MultiThreaded>,
|
rocks: rust_rocksdb::DBWithThreadMode<rust_rocksdb::MultiThreaded>,
|
||||||
cache: rust_rocksdb::Cache,
|
row_cache: rust_rocksdb::Cache,
|
||||||
|
col_cache: rust_rocksdb::Cache,
|
||||||
old_cfs: Vec<String>,
|
old_cfs: Vec<String>,
|
||||||
|
opts: rust_rocksdb::Options,
|
||||||
|
env: rust_rocksdb::Env,
|
||||||
config: Config,
|
config: Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,24 +32,13 @@ struct RocksDbEngineTree<'a> {
|
|||||||
write_lock: RwLock<()>,
|
write_lock: RwLock<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rocksdb::Options {
|
fn db_options(
|
||||||
// block-based options: https://docs.rs/rocksdb/latest/rocksdb/struct.BlockBasedOptions.html#
|
config: &Config, env: &rust_rocksdb::Env, row_cache: &rust_rocksdb::Cache, col_cache: &rust_rocksdb::Cache,
|
||||||
let mut block_based_options = rust_rocksdb::BlockBasedOptions::default();
|
) -> rust_rocksdb::Options {
|
||||||
|
|
||||||
block_based_options.set_block_cache(rocksdb_cache);
|
|
||||||
|
|
||||||
// "Difference of spinning disk"
|
|
||||||
// https://zhangyuchi.gitbooks.io/rocksdbbook/content/RocksDB-Tuning-Guide.html
|
|
||||||
block_based_options.set_block_size(64 * 1024);
|
|
||||||
block_based_options.set_cache_index_and_filter_blocks(true);
|
|
||||||
|
|
||||||
block_based_options.set_bloom_filter(10.0, false);
|
|
||||||
block_based_options.set_pin_l0_filter_and_index_blocks_in_cache(true);
|
|
||||||
block_based_options.set_optimize_filters_for_memory(true);
|
|
||||||
|
|
||||||
// database options: https://docs.rs/rocksdb/latest/rocksdb/struct.Options.html#
|
// database options: https://docs.rs/rocksdb/latest/rocksdb/struct.Options.html#
|
||||||
let mut db_opts = rust_rocksdb::Options::default();
|
let mut db_opts = rust_rocksdb::Options::default();
|
||||||
|
|
||||||
|
// Logging
|
||||||
let rocksdb_log_level = match config.rocksdb_log_level.as_ref() {
|
let rocksdb_log_level = match config.rocksdb_log_level.as_ref() {
|
||||||
"debug" => Debug,
|
"debug" => Debug,
|
||||||
"info" => Info,
|
"info" => Info,
|
||||||
@@ -52,7 +46,52 @@ fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rock
|
|||||||
"fatal" => Fatal,
|
"fatal" => Fatal,
|
||||||
_ => Error,
|
_ => Error,
|
||||||
};
|
};
|
||||||
|
db_opts.set_log_level(rocksdb_log_level);
|
||||||
|
db_opts.set_max_log_file_size(config.rocksdb_max_log_file_size);
|
||||||
|
db_opts.set_log_file_time_to_roll(config.rocksdb_log_time_to_roll);
|
||||||
|
db_opts.set_keep_log_file_num(config.rocksdb_max_log_files);
|
||||||
|
|
||||||
|
// Processing
|
||||||
|
let threads = if config.rocksdb_parallelism_threads == 0 {
|
||||||
|
num_cpus::get_physical() // max cores if user specified 0
|
||||||
|
} else {
|
||||||
|
config.rocksdb_parallelism_threads
|
||||||
|
};
|
||||||
|
|
||||||
|
db_opts.set_max_background_jobs(threads.try_into().unwrap());
|
||||||
|
db_opts.set_max_subcompactions(threads.try_into().unwrap());
|
||||||
|
|
||||||
|
// IO
|
||||||
|
db_opts.set_use_direct_reads(true);
|
||||||
|
db_opts.set_use_direct_io_for_flush_and_compaction(true);
|
||||||
|
if config.rocksdb_optimize_for_spinning_disks {
|
||||||
|
db_opts.set_skip_stats_update_on_db_open(true); // speeds up opening DB on hard
|
||||||
|
// drives
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blocks
|
||||||
|
let mut block_based_options = rust_rocksdb::BlockBasedOptions::default();
|
||||||
|
block_based_options.set_block_size(4 * 1024);
|
||||||
|
block_based_options.set_metadata_block_size(4 * 1024);
|
||||||
|
block_based_options.set_bloom_filter(9.6, true);
|
||||||
|
block_based_options.set_optimize_filters_for_memory(true);
|
||||||
|
block_based_options.set_cache_index_and_filter_blocks(true);
|
||||||
|
block_based_options.set_pin_top_level_index_and_filter(true);
|
||||||
|
block_based_options.set_block_cache(col_cache);
|
||||||
|
db_opts.set_row_cache(row_cache);
|
||||||
|
|
||||||
|
// Buffers
|
||||||
|
db_opts.set_write_buffer_size(2 * 1024 * 1024);
|
||||||
|
db_opts.set_max_write_buffer_number(2);
|
||||||
|
db_opts.set_min_write_buffer_number(1);
|
||||||
|
|
||||||
|
// Files
|
||||||
|
db_opts.set_level_zero_file_num_compaction_trigger(1);
|
||||||
|
db_opts.set_target_file_size_base(64 * 1024 * 1024);
|
||||||
|
db_opts.set_max_bytes_for_level_base(128 * 1024 * 1024);
|
||||||
|
db_opts.set_ttl(14 * 24 * 60 * 60);
|
||||||
|
|
||||||
|
// Compression
|
||||||
let rocksdb_compression_algo = match config.rocksdb_compression_algo.as_ref() {
|
let rocksdb_compression_algo = match config.rocksdb_compression_algo.as_ref() {
|
||||||
"zstd" => rust_rocksdb::DBCompressionType::Zstd,
|
"zstd" => rust_rocksdb::DBCompressionType::Zstd,
|
||||||
"zlib" => rust_rocksdb::DBCompressionType::Zlib,
|
"zlib" => rust_rocksdb::DBCompressionType::Zlib,
|
||||||
@@ -61,29 +100,6 @@ fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rock
|
|||||||
_ => rust_rocksdb::DBCompressionType::Zstd,
|
_ => rust_rocksdb::DBCompressionType::Zstd,
|
||||||
};
|
};
|
||||||
|
|
||||||
let threads = if config.rocksdb_parallelism_threads == 0 {
|
|
||||||
num_cpus::get_physical() // max cores if user specified 0
|
|
||||||
} else {
|
|
||||||
config.rocksdb_parallelism_threads
|
|
||||||
};
|
|
||||||
|
|
||||||
db_opts.set_log_level(rocksdb_log_level);
|
|
||||||
db_opts.set_max_log_file_size(config.rocksdb_max_log_file_size);
|
|
||||||
db_opts.set_log_file_time_to_roll(config.rocksdb_log_time_to_roll);
|
|
||||||
db_opts.set_keep_log_file_num(config.rocksdb_max_log_files);
|
|
||||||
|
|
||||||
if config.rocksdb_optimize_for_spinning_disks {
|
|
||||||
db_opts.set_skip_stats_update_on_db_open(true); // speeds up opening DB on hard drives
|
|
||||||
db_opts.set_compaction_readahead_size(4 * 1024 * 1024); // "If you’re running RocksDB on spinning disks, you should set this to at least
|
|
||||||
// 2MB. That way RocksDB’s compaction is doing sequential instead of random
|
|
||||||
// reads."
|
|
||||||
db_opts.set_target_file_size_base(256 * 1024 * 1024);
|
|
||||||
} else {
|
|
||||||
db_opts.set_max_bytes_for_level_base(512 * 1024 * 1024);
|
|
||||||
db_opts.set_use_direct_reads(true);
|
|
||||||
db_opts.set_use_direct_io_for_flush_and_compaction(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.rocksdb_bottommost_compression {
|
if config.rocksdb_bottommost_compression {
|
||||||
db_opts.set_bottommost_compression_type(rocksdb_compression_algo);
|
db_opts.set_bottommost_compression_type(rocksdb_compression_algo);
|
||||||
db_opts.set_bottommost_zstd_max_train_bytes(0, true);
|
db_opts.set_bottommost_zstd_max_train_bytes(0, true);
|
||||||
@@ -94,18 +110,10 @@ fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rock
|
|||||||
|
|
||||||
// -14 w_bits is only read by zlib.
|
// -14 w_bits is only read by zlib.
|
||||||
db_opts.set_compression_options(-14, config.rocksdb_compression_level, 0, 0);
|
db_opts.set_compression_options(-14, config.rocksdb_compression_level, 0, 0);
|
||||||
|
|
||||||
db_opts.set_block_based_table_factory(&block_based_options);
|
|
||||||
db_opts.create_if_missing(true);
|
|
||||||
db_opts.increase_parallelism(
|
|
||||||
threads.try_into().expect("Failed to convert \"rocksdb_parallelism_threads\" usize into i32"),
|
|
||||||
);
|
|
||||||
db_opts.set_compression_type(rocksdb_compression_algo);
|
db_opts.set_compression_type(rocksdb_compression_algo);
|
||||||
|
|
||||||
// https://github.com/facebook/rocksdb/wiki/Setup-Options-and-Basic-Tuning
|
// Misc
|
||||||
db_opts.set_level_compaction_dynamic_level_bytes(true);
|
db_opts.create_if_missing(true);
|
||||||
db_opts.set_max_background_jobs(6);
|
|
||||||
db_opts.set_bytes_per_sync(1_048_576);
|
|
||||||
|
|
||||||
// https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes#ktoleratecorruptedtailrecords
|
// https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes#ktoleratecorruptedtailrecords
|
||||||
//
|
//
|
||||||
@@ -118,15 +126,21 @@ fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rock
|
|||||||
let prefix_extractor = rust_rocksdb::SliceTransform::create_fixed_prefix(1);
|
let prefix_extractor = rust_rocksdb::SliceTransform::create_fixed_prefix(1);
|
||||||
db_opts.set_prefix_extractor(prefix_extractor);
|
db_opts.set_prefix_extractor(prefix_extractor);
|
||||||
|
|
||||||
|
db_opts.set_block_based_table_factory(&block_based_options);
|
||||||
|
db_opts.set_env(env);
|
||||||
db_opts
|
db_opts
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyValueDatabaseEngine for Arc<Engine> {
|
impl KeyValueDatabaseEngine for Arc<Engine> {
|
||||||
fn open(config: &Config) -> Result<Self> {
|
fn open(config: &Config) -> Result<Self> {
|
||||||
let cache_capacity_bytes = (config.db_cache_capacity_mb * 1024.0 * 1024.0) as usize;
|
let cache_capacity_bytes = config.db_cache_capacity_mb * 1024.0 * 1024.0;
|
||||||
let rocksdb_cache = rust_rocksdb::Cache::new_lru_cache(cache_capacity_bytes);
|
let row_cache_capacity_bytes = (cache_capacity_bytes * 0.25) as usize;
|
||||||
|
let col_cache_capacity_bytes = (cache_capacity_bytes * 0.75) as usize;
|
||||||
|
|
||||||
let db_opts = db_options(&rocksdb_cache, config);
|
let db_env = rust_rocksdb::Env::new()?;
|
||||||
|
let row_cache = rust_rocksdb::Cache::new_lru_cache(row_cache_capacity_bytes);
|
||||||
|
let col_cache = rust_rocksdb::Cache::new_lru_cache(col_cache_capacity_bytes);
|
||||||
|
let db_opts = db_options(config, &db_env, &row_cache, &col_cache);
|
||||||
|
|
||||||
debug!("Listing column families in database");
|
debug!("Listing column families in database");
|
||||||
let cfs =
|
let cfs =
|
||||||
@@ -138,13 +152,16 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
|||||||
let db = rust_rocksdb::DBWithThreadMode::<rust_rocksdb::MultiThreaded>::open_cf_descriptors(
|
let db = rust_rocksdb::DBWithThreadMode::<rust_rocksdb::MultiThreaded>::open_cf_descriptors(
|
||||||
&db_opts,
|
&db_opts,
|
||||||
&config.database_path,
|
&config.database_path,
|
||||||
cfs.iter().map(|name| rust_rocksdb::ColumnFamilyDescriptor::new(name, db_options(&rocksdb_cache, config))),
|
cfs.iter().map(|name| rust_rocksdb::ColumnFamilyDescriptor::new(name, db_opts.clone())),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Arc::new(Engine {
|
Ok(Arc::new(Engine {
|
||||||
rocks: db,
|
rocks: db,
|
||||||
cache: rocksdb_cache,
|
row_cache,
|
||||||
|
col_cache,
|
||||||
old_cfs: cfs,
|
old_cfs: cfs,
|
||||||
|
opts: db_opts,
|
||||||
|
env: db_env,
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -153,7 +170,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
|||||||
if !self.old_cfs.contains(&name.to_owned()) {
|
if !self.old_cfs.contains(&name.to_owned()) {
|
||||||
// Create if it didn't exist
|
// Create if it didn't exist
|
||||||
debug!("Creating new column family in database: {}", name);
|
debug!("Creating new column family in database: {}", name);
|
||||||
let _ = self.rocks.create_cf(name, &db_options(&self.cache, &self.config));
|
let _ = self.rocks.create_cf(name, &self.opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Arc::new(RocksDbEngineTree {
|
Ok(Arc::new(RocksDbEngineTree {
|
||||||
@@ -165,23 +182,35 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn flush(&self) -> Result<()> {
|
fn flush(&self) -> Result<()> {
|
||||||
debug!("Running flush_wal (no sync)");
|
|
||||||
rust_rocksdb::DBCommon::flush_wal(&self.rocks, false)?;
|
rust_rocksdb::DBCommon::flush_wal(&self.rocks, false)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sync(&self) -> Result<()> {
|
||||||
|
rust_rocksdb::DBCommon::flush_wal(&self.rocks, true)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn memory_usage(&self) -> Result<String> {
|
fn memory_usage(&self) -> Result<String> {
|
||||||
let stats = rust_rocksdb::perf::get_memory_usage_stats(Some(&[&self.rocks]), Some(&[&self.cache]))?;
|
let stats = rust_rocksdb::perf::get_memory_usage_stats(
|
||||||
|
Some(&[&self.rocks]),
|
||||||
|
Some(&[&self.row_cache, &self.col_cache]),
|
||||||
|
)?;
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"Approximate memory usage of all the mem-tables: {:.3} MB\nApproximate memory usage of un-flushed \
|
"Approximate memory usage of all the mem-tables: {:.3} MB\nApproximate memory usage of un-flushed \
|
||||||
mem-tables: {:.3} MB\nApproximate memory usage of all the table readers: {:.3} MB\nApproximate memory \
|
mem-tables: {:.3} MB\nApproximate memory usage of all the table readers: {:.3} MB\nApproximate memory \
|
||||||
usage by cache: {:.3} MB\nApproximate memory usage by cache pinned: {:.3} MB\n",
|
usage by cache: {:.3} MB\nApproximate memory usage by row cache: {:.3} MB pinned: {:.3} MB\nApproximate \
|
||||||
|
memory usage by column cache: {:.3} MB pinned: {:.3} MB\n",
|
||||||
stats.mem_table_total as f64 / 1024.0 / 1024.0,
|
stats.mem_table_total as f64 / 1024.0 / 1024.0,
|
||||||
stats.mem_table_unflushed as f64 / 1024.0 / 1024.0,
|
stats.mem_table_unflushed as f64 / 1024.0 / 1024.0,
|
||||||
stats.mem_table_readers_total as f64 / 1024.0 / 1024.0,
|
stats.mem_table_readers_total as f64 / 1024.0 / 1024.0,
|
||||||
stats.cache_total as f64 / 1024.0 / 1024.0,
|
stats.cache_total as f64 / 1024.0 / 1024.0,
|
||||||
self.cache.get_pinned_usage() as f64 / 1024.0 / 1024.0,
|
self.row_cache.get_usage() as f64 / 1024.0 / 1024.0,
|
||||||
|
self.row_cache.get_pinned_usage() as f64 / 1024.0 / 1024.0,
|
||||||
|
self.col_cache.get_usage() as f64 / 1024.0 / 1024.0,
|
||||||
|
self.col_cache.get_pinned_usage() as f64 / 1024.0 / 1024.0,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +223,69 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn backup(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let path = self.config.database_backup_path.as_ref();
|
||||||
|
if path.is_none() || path.is_some_and(|path| path.as_os_str().is_empty()) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = BackupEngineOptions::new(path.unwrap())?;
|
||||||
|
let mut engine = BackupEngine::open(&options, &self.env)?;
|
||||||
|
let ret = if self.config.database_backups_to_keep > 0 {
|
||||||
|
match engine.create_new_backup_flush(&self.rocks, true) {
|
||||||
|
Err(e) => return Err(Box::new(e)),
|
||||||
|
Ok(_) => {
|
||||||
|
let _info = engine.get_backup_info();
|
||||||
|
let info = &_info.last().unwrap();
|
||||||
|
info!(
|
||||||
|
"Created database backup #{} using {} bytes in {} files",
|
||||||
|
info.backup_id, info.size, info.num_files,
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
};
|
||||||
|
|
||||||
|
if self.config.database_backups_to_keep >= 0 {
|
||||||
|
let keep = u32::try_from(self.config.database_backups_to_keep)?;
|
||||||
|
if let Err(e) = engine.purge_old_backups(keep.try_into()?) {
|
||||||
|
error!("Failed to purge old backup: {:?}", e.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
|
||||||
|
fn backup_list(&self) -> Result<String> {
|
||||||
|
let path = self.config.database_backup_path.as_ref();
|
||||||
|
if path.is_none() || path.is_some_and(|path| path.as_os_str().is_empty()) {
|
||||||
|
return Ok(
|
||||||
|
"Configure database_backup_path to enable backups, or the path specified is not valid".to_owned(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut res = String::new();
|
||||||
|
let options = BackupEngineOptions::new(path.unwrap())?;
|
||||||
|
let engine = BackupEngine::open(&options, &self.env)?;
|
||||||
|
for info in engine.get_backup_info() {
|
||||||
|
std::fmt::write(
|
||||||
|
&mut res,
|
||||||
|
format_args!(
|
||||||
|
"#{} {}: {} bytes, {} files\n",
|
||||||
|
info.backup_id,
|
||||||
|
DateTime::<Utc>::from_timestamp(info.timestamp, 0).unwrap_or_default().to_rfc2822(),
|
||||||
|
info.size,
|
||||||
|
info.num_files,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: figure out if this is needed for rocksdb
|
// TODO: figure out if this is needed for rocksdb
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear_caches(&self) {}
|
fn clear_caches(&self) {}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use ruma::{
|
|||||||
signatures::Ed25519KeyPair,
|
signatures::Ed25519KeyPair,
|
||||||
DeviceId, MilliSecondsSinceUnixEpoch, OwnedServerSigningKeyId, ServerName, UserId,
|
DeviceId, MilliSecondsSinceUnixEpoch, OwnedServerSigningKeyId, ServerName, UserId,
|
||||||
};
|
};
|
||||||
use tracing::debug;
|
|
||||||
|
|
||||||
use crate::{database::KeyValueDatabase, service, services, utils, Error, Result};
|
use crate::{database::KeyValueDatabase, service, services, utils, Error, Result};
|
||||||
|
|
||||||
@@ -186,9 +185,7 @@ lasttimelinecount_cache: {lasttimelinecount_cache}\n"
|
|||||||
fn load_keypair(&self) -> Result<Ed25519KeyPair> {
|
fn load_keypair(&self) -> Result<Ed25519KeyPair> {
|
||||||
let keypair_bytes = self.global.get(b"keypair")?.map_or_else(
|
let keypair_bytes = self.global.get(b"keypair")?.map_or_else(
|
||||||
|| {
|
|| {
|
||||||
debug!("No keypair found in database, assuming this is a new deployment and generating one.");
|
|
||||||
let keypair = utils::generate_keypair();
|
let keypair = utils::generate_keypair();
|
||||||
debug!("Generated keypair bytes: {:?}", keypair);
|
|
||||||
self.global.insert(b"keypair", &keypair)?;
|
self.global.insert(b"keypair", &keypair)?;
|
||||||
Ok::<_, Error>(keypair)
|
Ok::<_, Error>(keypair)
|
||||||
},
|
},
|
||||||
@@ -203,7 +200,6 @@ lasttimelinecount_cache: {lasttimelinecount_cache}\n"
|
|||||||
)
|
)
|
||||||
.map_err(|_| Error::bad_database("Invalid version bytes in keypair."))
|
.map_err(|_| Error::bad_database("Invalid version bytes in keypair."))
|
||||||
.and_then(|version| {
|
.and_then(|version| {
|
||||||
debug!("Keypair version: {version}");
|
|
||||||
// 2. key
|
// 2. key
|
||||||
parts
|
parts
|
||||||
.next()
|
.next()
|
||||||
@@ -211,11 +207,8 @@ lasttimelinecount_cache: {lasttimelinecount_cache}\n"
|
|||||||
.map(|key| (version, key))
|
.map(|key| (version, key))
|
||||||
})
|
})
|
||||||
.and_then(|(version, key)| {
|
.and_then(|(version, key)| {
|
||||||
debug!("Keypair bytes: {:?}", key);
|
Ed25519KeyPair::from_der(key, version)
|
||||||
let keypair = Ed25519KeyPair::from_der(key, version)
|
.map_err(|_| Error::bad_database("Private or public keys are invalid."))
|
||||||
.map_err(|_| Error::bad_database("Private or public keys are invalid."));
|
|
||||||
debug!("Private and public key: {keypair:?}");
|
|
||||||
keypair
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,4 +272,8 @@ lasttimelinecount_cache: {lasttimelinecount_cache}\n"
|
|||||||
self.global.insert(b"version", &new_version.to_be_bytes())?;
|
self.global.insert(b"version", &new_version.to_be_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn backup(&self) -> Result<(), Box<dyn std::error::Error>> { self.db.backup() }
|
||||||
|
|
||||||
|
fn backup_list(&self) -> Result<String> { self.db.backup_list() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use ruma::api::client::error::ErrorKind;
|
use ruma::{api::client::error::ErrorKind, OwnedUserId};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -25,8 +25,12 @@ impl service::media::Data for KeyValueDatabase {
|
|||||||
self.mediaid_file.insert(&key, &[])?;
|
self.mediaid_file.insert(&key, &[])?;
|
||||||
|
|
||||||
if let Some(user) = sender_user {
|
if let Some(user) = sender_user {
|
||||||
let key = mxc.as_bytes().to_vec();
|
let mut key = mxc.as_bytes().to_vec();
|
||||||
let user = user.as_bytes().to_vec();
|
key.push(0xFF);
|
||||||
|
|
||||||
|
let mut user = user.as_bytes().to_vec();
|
||||||
|
user.push(0xFF);
|
||||||
|
|
||||||
self.mediaid_user.insert(&key, &user)?;
|
self.mediaid_user.insert(&key, &user)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +69,8 @@ impl service::media::Data for KeyValueDatabase {
|
|||||||
let mut prefix = mxc.as_bytes().to_vec();
|
let mut prefix = mxc.as_bytes().to_vec();
|
||||||
prefix.push(0xFF);
|
prefix.push(0xFF);
|
||||||
|
|
||||||
|
debug!("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA prefix: {:?}", prefix);
|
||||||
|
|
||||||
let mut keys: Vec<Vec<u8>> = vec![];
|
let mut keys: Vec<Vec<u8>> = vec![];
|
||||||
|
|
||||||
for (key, _) in self.mediaid_file.scan_prefix(prefix) {
|
for (key, _) in self.mediaid_file.scan_prefix(prefix) {
|
||||||
@@ -82,6 +88,23 @@ impl service::media::Data for KeyValueDatabase {
|
|||||||
Ok(keys)
|
Ok(keys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_all_media_keys_by_user(&self, user_id: OwnedUserId) -> Result<Vec<Vec<u8>>> {
|
||||||
|
debug!("User ID: {user_id:?}");
|
||||||
|
|
||||||
|
let mut user = user_id.as_bytes().to_vec();
|
||||||
|
user.push(0xFF);
|
||||||
|
|
||||||
|
let mut keys: Vec<Vec<u8>> = vec![];
|
||||||
|
|
||||||
|
for (key, value) in self.mediaid_user.iter() {
|
||||||
|
if value == user {
|
||||||
|
keys.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(keys)
|
||||||
|
}
|
||||||
|
|
||||||
fn search_file_metadata(
|
fn search_file_metadata(
|
||||||
&self, mxc: String, width: u32, height: u32,
|
&self, mxc: String, width: u32, height: u32,
|
||||||
) -> Result<(Option<String>, Option<String>, Vec<u8>)> {
|
) -> Result<(Option<String>, Option<String>, Vec<u8>)> {
|
||||||
|
|||||||
+1
-1
@@ -953,7 +953,7 @@ impl KeyValueDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let patterns = &services().globals.config.forbidden_room_names;
|
let patterns = &services().globals.config.forbidden_alias_names;
|
||||||
if !patterns.is_empty() {
|
if !patterns.is_empty() {
|
||||||
for address in services().rooms.metadata.iter_ids() {
|
for address in services().rooms.metadata.iter_ids() {
|
||||||
let room_id = address?;
|
let room_id = address?;
|
||||||
|
|||||||
+21
-60
@@ -15,12 +15,8 @@ use axum::{
|
|||||||
use axum_server::{bind, bind_rustls, tls_rustls::RustlsConfig, Handle as ServerHandle};
|
use axum_server::{bind, bind_rustls, tls_rustls::RustlsConfig, Handle as ServerHandle};
|
||||||
#[cfg(feature = "axum_dual_protocol")]
|
#[cfg(feature = "axum_dual_protocol")]
|
||||||
use axum_server_dual_protocol::ServerExt;
|
use axum_server_dual_protocol::ServerExt;
|
||||||
use base64::{engine::general_purpose, Engine as _};
|
use conduit::api::{client_server, server_server};
|
||||||
pub use conduit::*; // Re-export everything from the library crate
|
pub use conduit::*; // Re-export everything from the library crate
|
||||||
use conduit::{
|
|
||||||
api::{client_server, server_server},
|
|
||||||
clap::{Args, SigningKey},
|
|
||||||
};
|
|
||||||
use either::Either::{Left, Right};
|
use either::Either::{Left, Right};
|
||||||
use figment::{
|
use figment::{
|
||||||
providers::{Env, Format, Toml},
|
providers::{Env, Format, Toml},
|
||||||
@@ -32,15 +28,12 @@ use http::{
|
|||||||
};
|
};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use hyperlocal::SocketIncoming;
|
use hyperlocal::SocketIncoming;
|
||||||
use ruma::{
|
use ruma::api::{
|
||||||
api::{
|
client::{
|
||||||
client::{
|
error::{Error as RumaError, ErrorBody, ErrorKind},
|
||||||
error::{Error as RumaError, ErrorBody, ErrorKind},
|
uiaa::UiaaResponse,
|
||||||
uiaa::UiaaResponse,
|
|
||||||
},
|
|
||||||
IncomingRequest,
|
|
||||||
},
|
},
|
||||||
serde::Base64,
|
IncomingRequest,
|
||||||
};
|
};
|
||||||
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))]
|
||||||
use tikv_jemallocator::Jemalloc;
|
use tikv_jemallocator::Jemalloc;
|
||||||
@@ -80,7 +73,7 @@ async fn main() {
|
|||||||
} else if args.config.is_some() {
|
} else if args.config.is_some() {
|
||||||
Figment::new()
|
Figment::new()
|
||||||
.merge(
|
.merge(
|
||||||
Toml::file(args.config.as_ref().expect(
|
Toml::file(args.config.expect(
|
||||||
"conduwuit config commandline argument was specified, but appears to be invalid. This should be \
|
"conduwuit config commandline argument was specified, but appears to be invalid. This should be \
|
||||||
set to the path of a valid TOML file.",
|
set to the path of a valid TOML file.",
|
||||||
))
|
))
|
||||||
@@ -176,16 +169,8 @@ async fn main() {
|
|||||||
|
|
||||||
let config = &services().globals.config;
|
let config = &services().globals.config;
|
||||||
|
|
||||||
/* homeserver signing keypair subcommand stuff */
|
|
||||||
if let Some(subcommands) = &args.signing_key {
|
|
||||||
if signing_key_operations(subcommands).await.is_ok() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug!("Ed25519KeyPair: {:?}", services().globals.keypair());
|
|
||||||
|
|
||||||
/* ad-hoc config validation/checks */
|
/* ad-hoc config validation/checks */
|
||||||
|
|
||||||
if config.unix_socket_path.is_some() && !cfg!(unix) {
|
if config.unix_socket_path.is_some() && !cfg!(unix) {
|
||||||
error!(
|
error!(
|
||||||
"UNIX socket support is only available on *nix platforms. Please remove \"unix_socket_path\" from your \
|
"UNIX socket support is only available on *nix platforms. Please remove \"unix_socket_path\" from your \
|
||||||
@@ -295,7 +280,7 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.allow_outgoing_presence && !config.allow_local_presence {
|
if config.allow_outgoing_presence && !config.allow_local_presence {
|
||||||
error!("Outgoing presence requires allowing local presence. Please enable \"allow_outgoing_presence\".");
|
error!("Outgoing presence requires allowing local presence. Please enable \"allow_local_presence\".");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,11 +535,15 @@ async fn unrecognized_method<B: Send + 'static>(
|
|||||||
let uri = req.uri().clone();
|
let uri = req.uri().clone();
|
||||||
let inner = next.run(req).await;
|
let inner = next.run(req).await;
|
||||||
if inner.status() == StatusCode::METHOD_NOT_ALLOWED {
|
if inner.status() == StatusCode::METHOD_NOT_ALLOWED {
|
||||||
warn!("Method not allowed: {method} {uri}");
|
if uri.path().contains("_matrix/") {
|
||||||
|
warn!("Method not allowed: {method} {uri}");
|
||||||
|
} else {
|
||||||
|
info!("Method not allowed: {method} {uri}");
|
||||||
|
}
|
||||||
return Ok(RumaResponse(UiaaResponse::MatrixError(RumaError {
|
return Ok(RumaResponse(UiaaResponse::MatrixError(RumaError {
|
||||||
body: ErrorBody::Standard {
|
body: ErrorBody::Standard {
|
||||||
kind: ErrorKind::Unrecognized,
|
kind: ErrorKind::Unrecognized,
|
||||||
message: "M_UNRECOGNIZED: Unrecognized request".to_owned(),
|
message: "M_UNRECOGNIZED: Method not allowed for endpoint".to_owned(),
|
||||||
},
|
},
|
||||||
status_code: StatusCode::METHOD_NOT_ALLOWED,
|
status_code: StatusCode::METHOD_NOT_ALLOWED,
|
||||||
}))
|
}))
|
||||||
@@ -821,7 +810,12 @@ async fn shutdown_signal(handle: ServerHandle, tx: Sender<()>) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn not_found(uri: Uri) -> impl IntoResponse {
|
async fn not_found(uri: Uri) -> impl IntoResponse {
|
||||||
warn!("Not found: {uri}");
|
if uri.path().contains("_matrix/") {
|
||||||
|
warn!("Not found: {uri}");
|
||||||
|
} else {
|
||||||
|
info!("Not found: {uri}");
|
||||||
|
}
|
||||||
|
|
||||||
Error::BadRequest(ErrorKind::Unrecognized, "Unrecognized request")
|
Error::BadRequest(ErrorKind::Unrecognized, "Unrecognized request")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,36 +921,3 @@ fn maximize_fd_limit() -> Result<(), nix::errno::Errno> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Homeserver signing key commands/operations
|
|
||||||
async fn signing_key_operations(subcommands: &SigningKey) -> Result<()> {
|
|
||||||
match subcommands {
|
|
||||||
SigningKey::ExportPath {
|
|
||||||
path,
|
|
||||||
} => {
|
|
||||||
let mut file = tokio::fs::File::create(path).await?;
|
|
||||||
let mut content = String::new();
|
|
||||||
|
|
||||||
content.push_str("ed25519 ");
|
|
||||||
|
|
||||||
let version = services().globals.keypair().version();
|
|
||||||
|
|
||||||
content.push_str(version);
|
|
||||||
content.push(' ');
|
|
||||||
|
|
||||||
let keypair = services().globals.keypair();
|
|
||||||
debug!("Ed25519KeyPair: {:?}", keypair);
|
|
||||||
|
|
||||||
//let key_base64 = Base64::new(key);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
},
|
|
||||||
SigningKey::ImportPath {
|
|
||||||
path,
|
|
||||||
add_to_old_public_keys,
|
|
||||||
timestamp,
|
|
||||||
} => {
|
|
||||||
unimplemented!()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+111
-1
@@ -30,7 +30,9 @@ use tracing::{debug, error, info, warn};
|
|||||||
use super::pdu::PduBuilder;
|
use super::pdu::PduBuilder;
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{
|
api::{
|
||||||
client_server::{get_alias_helper, leave_all_rooms, leave_room, AUTO_GEN_PASSWORD_LENGTH},
|
client_server::{
|
||||||
|
get_alias_helper, join_room_by_id_helper, leave_all_rooms, leave_room, AUTO_GEN_PASSWORD_LENGTH,
|
||||||
|
},
|
||||||
server_server::parse_incoming_pdu,
|
server_server::parse_incoming_pdu,
|
||||||
},
|
},
|
||||||
services,
|
services,
|
||||||
@@ -92,6 +94,12 @@ enum MediaCommand {
|
|||||||
event_id: Option<Box<EventId>>,
|
event_id: Option<Box<EventId>>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Deletes all **uploaded** local media from the specified user.
|
||||||
|
DeleteFromUser {
|
||||||
|
/// User ID to delete all media from
|
||||||
|
user_id: Box<UserId>,
|
||||||
|
},
|
||||||
|
|
||||||
/// - Deletes a codeblock list of MXC URLs from our database and on the
|
/// - Deletes a codeblock list of MXC URLs from our database and on the
|
||||||
/// filesystem
|
/// filesystem
|
||||||
DeleteList,
|
DeleteList,
|
||||||
@@ -103,6 +111,13 @@ enum MediaCommand {
|
|||||||
/// past 5 minutes
|
/// past 5 minutes
|
||||||
duration: String,
|
duration: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// - Lists all **uploaded** local media from the specified user with their
|
||||||
|
/// MXC URLs.
|
||||||
|
ListFromUser {
|
||||||
|
/// User ID to list all media from
|
||||||
|
user_id: Box<UserId>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(test, derive(Debug))]
|
#[cfg_attr(test, derive(Debug))]
|
||||||
@@ -436,6 +451,13 @@ enum ServerCommand {
|
|||||||
ClearServiceCaches {
|
ClearServiceCaches {
|
||||||
amount: u32,
|
amount: u32,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// - Performs an online backup of the database (only available for RocksDB
|
||||||
|
/// at the moment)
|
||||||
|
BackupDatabase,
|
||||||
|
|
||||||
|
/// - List database backups
|
||||||
|
ListBackups,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -797,6 +819,17 @@ impl Service {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
MediaCommand::DeleteFromUser {
|
||||||
|
user_id,
|
||||||
|
} => {
|
||||||
|
let deleted_count = services().media.delete_from_user(user_id.into()).await?;
|
||||||
|
|
||||||
|
debug!("Deleted {deleted_count} total media files.");
|
||||||
|
|
||||||
|
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||||
|
"Deleted {deleted_count} total media files.",
|
||||||
|
)));
|
||||||
|
},
|
||||||
MediaCommand::DeleteList => {
|
MediaCommand::DeleteList => {
|
||||||
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```" {
|
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```" {
|
||||||
let mxc_list = body.clone().drain(1..body.len() - 1).collect::<Vec<_>>();
|
let mxc_list = body.clone().drain(1..body.len() - 1).collect::<Vec<_>>();
|
||||||
@@ -830,6 +863,25 @@ impl Service {
|
|||||||
deleted_count
|
deleted_count
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
|
MediaCommand::ListFromUser {
|
||||||
|
user_id,
|
||||||
|
} => {
|
||||||
|
let mxc_list = services().media.list_all_media_by_user(user_id.clone().into()).await?;
|
||||||
|
|
||||||
|
let output_plain = format!(
|
||||||
|
"All MXC URLs {user_id} Uploaded:\n{}",
|
||||||
|
mxc_list.iter().map(ToOwned::to_owned).collect::<Vec<_>>().join("\n")
|
||||||
|
);
|
||||||
|
let output_html = format!(
|
||||||
|
"<table><caption>All MXC URLs {user_id} \
|
||||||
|
Uploaded</caption>\n<tr><th>URL</th></tr>\n{}</table>",
|
||||||
|
mxc_list.iter().fold(String::new(), |mut output, mxc| {
|
||||||
|
writeln!(output, "<tr><td>{}</td></tr>", mxc).unwrap();
|
||||||
|
output
|
||||||
|
})
|
||||||
|
);
|
||||||
|
RoomMessageEventContent::text_html(output_plain, output_html)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AdminCommand::Users(command) => match command {
|
AdminCommand::Users(command) => match command {
|
||||||
@@ -893,6 +945,35 @@ impl Service {
|
|||||||
.expect("to json value always works"),
|
.expect("to json value always works"),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
if !services().globals.config.auto_join_rooms.is_empty() {
|
||||||
|
for room in &services().globals.config.auto_join_rooms {
|
||||||
|
if !services().rooms.state_cache.server_in_room(services().globals.server_name(), room)? {
|
||||||
|
warn!("Skipping room {room} to automatically join as we have never joined before.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(room_id_server_name) = room.server_name() {
|
||||||
|
match join_room_by_id_helper(
|
||||||
|
Some(&user_id),
|
||||||
|
room,
|
||||||
|
Some("Automatically joining this room upon registration".to_owned()),
|
||||||
|
&[room_id_server_name.to_owned(), services().globals.server_name().to_owned()],
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => {
|
||||||
|
info!("Automatically joined room {room} for user {user_id}");
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
// don't return this error so we don't fail registrations
|
||||||
|
error!("Failed to automatically join room {room} for user {user_id}: {e}");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// we dont add a device since we're not the user, just the creator
|
// we dont add a device since we're not the user, just the creator
|
||||||
|
|
||||||
// Inhibit login does not work for guests
|
// Inhibit login does not work for guests
|
||||||
@@ -1866,6 +1947,35 @@ impl Service {
|
|||||||
|
|
||||||
RoomMessageEventContent::text_plain("Done.")
|
RoomMessageEventContent::text_plain("Done.")
|
||||||
},
|
},
|
||||||
|
ServerCommand::ListBackups => {
|
||||||
|
let result = services().globals.db.backup_list()?;
|
||||||
|
|
||||||
|
if result.is_empty() {
|
||||||
|
return Ok(RoomMessageEventContent::text_plain("No backups found."));
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomMessageEventContent::text_plain(result)
|
||||||
|
},
|
||||||
|
ServerCommand::BackupDatabase => {
|
||||||
|
if !cfg!(feature = "rocksdb") {
|
||||||
|
return Ok(RoomMessageEventContent::text_plain(
|
||||||
|
"Only RocksDB supports online backups in conduwuit.",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut result = tokio::task::spawn_blocking(move || match services().globals.db.backup() {
|
||||||
|
Ok(_) => String::new(),
|
||||||
|
Err(e) => (*e).to_string(),
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if result.is_empty() {
|
||||||
|
result = services().globals.db.backup_list()?;
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomMessageEventContent::text_plain(&result)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
AdminCommand::Debug(command) => match command {
|
AdminCommand::Debug(command) => match command {
|
||||||
DebugCommand::GetAuthChain {
|
DebugCommand::GetAuthChain {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::{collections::BTreeMap, error::Error};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -32,4 +32,6 @@ pub trait Data: Send + Sync {
|
|||||||
fn signing_keys_for(&self, origin: &ServerName) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>>;
|
fn signing_keys_for(&self, origin: &ServerName) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>>;
|
||||||
fn database_version(&self) -> Result<u64>;
|
fn database_version(&self) -> Result<u64>;
|
||||||
fn bump_database_version(&self, new_version: u64) -> Result<()>;
|
fn bump_database_version(&self, new_version: u64) -> Result<()>;
|
||||||
|
fn backup(&self) -> Result<(), Box<dyn Error>> { unimplemented!() }
|
||||||
|
fn backup_list(&self) -> Result<String> { Ok(String::new()) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use argon2::Argon2;
|
|||||||
use base64::{engine::general_purpose, Engine as _};
|
use base64::{engine::general_purpose, Engine as _};
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
use futures_util::FutureExt;
|
use futures_util::FutureExt;
|
||||||
|
use hickory_resolver::TokioAsyncResolver;
|
||||||
use hyper::{
|
use hyper::{
|
||||||
client::connect::dns::{GaiResolver, Name},
|
client::connect::dns::{GaiResolver, Name},
|
||||||
service::Service as HyperService,
|
service::Service as HyperService,
|
||||||
@@ -34,7 +35,6 @@ use ruma::{
|
|||||||
};
|
};
|
||||||
use tokio::sync::{broadcast, watch::Receiver, Mutex, RwLock, Semaphore};
|
use tokio::sync::{broadcast, watch::Receiver, Mutex, RwLock, Semaphore};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
use trust_dns_resolver::TokioAsyncResolver;
|
|
||||||
|
|
||||||
use crate::{api::server_server::FedDest, services, Config, Error, Result};
|
use crate::{api::server_server::FedDest, services, Config, Error, Result};
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ impl Service<'_> {
|
|||||||
let keypair = match keypair {
|
let keypair = match keypair {
|
||||||
Ok(k) => k,
|
Ok(k) => k,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Homeserver signing keypair in database is invalid. Deleting...");
|
error!("Keypair invalid. Deleting...");
|
||||||
db.remove_keypair()?;
|
db.remove_keypair()?;
|
||||||
return Err(e);
|
return Err(e);
|
||||||
},
|
},
|
||||||
@@ -327,6 +327,8 @@ impl Service<'_> {
|
|||||||
|
|
||||||
pub fn turn_secret(&self) -> &String { &self.config.turn_secret }
|
pub fn turn_secret(&self) -> &String { &self.config.turn_secret }
|
||||||
|
|
||||||
|
pub fn auto_join_rooms(&self) -> &[OwnedRoomId] { &self.config.auto_join_rooms }
|
||||||
|
|
||||||
pub fn notification_push_path(&self) -> &String { &self.config.notification_push_path }
|
pub fn notification_push_path(&self) -> &String { &self.config.notification_push_path }
|
||||||
|
|
||||||
pub fn emergency_password(&self) -> &Option<String> { &self.config.emergency_password }
|
pub fn emergency_password(&self) -> &Option<String> { &self.config.emergency_password }
|
||||||
@@ -345,7 +347,7 @@ impl Service<'_> {
|
|||||||
|
|
||||||
pub fn url_preview_check_root_domain(&self) -> bool { self.config.url_preview_check_root_domain }
|
pub fn url_preview_check_root_domain(&self) -> bool { self.config.url_preview_check_root_domain }
|
||||||
|
|
||||||
pub fn forbidden_room_names(&self) -> &RegexSet { &self.config.forbidden_room_names }
|
pub fn forbidden_alias_names(&self) -> &RegexSet { &self.config.forbidden_alias_names }
|
||||||
|
|
||||||
pub fn forbidden_usernames(&self) -> &RegexSet { &self.config.forbidden_usernames }
|
pub fn forbidden_usernames(&self) -> &RegexSet { &self.config.forbidden_usernames }
|
||||||
|
|
||||||
@@ -497,8 +499,9 @@ fn reqwest_client_builder(config: &Config) -> Result<reqwest::ClientBuilder> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mut reqwest_client_builder = reqwest::Client::builder()
|
let mut reqwest_client_builder = reqwest::Client::builder()
|
||||||
.trust_dns(true)
|
.hickory_dns(true)
|
||||||
.pool_max_idle_per_host(0)
|
.pool_max_idle_per_host(1)
|
||||||
|
.pool_idle_timeout(Duration::from_secs(50))
|
||||||
.connect_timeout(Duration::from_secs(60))
|
.connect_timeout(Duration::from_secs(60))
|
||||||
.timeout(Duration::from_secs(60 * 5))
|
.timeout(Duration::from_secs(60 * 5))
|
||||||
.redirect(redirect_policy)
|
.redirect(redirect_policy)
|
||||||
@@ -525,10 +528,10 @@ fn url_preview_reqwest_client_builder(config: &Config) -> Result<reqwest::Client
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mut reqwest_client_builder = reqwest::Client::builder()
|
let mut reqwest_client_builder = reqwest::Client::builder()
|
||||||
.trust_dns(true)
|
.hickory_dns(true)
|
||||||
.pool_max_idle_per_host(0)
|
.pool_max_idle_per_host(0)
|
||||||
.connect_timeout(Duration::from_secs(60))
|
.connect_timeout(Duration::from_secs(20))
|
||||||
.timeout(Duration::from_secs(60 * 5))
|
.timeout(Duration::from_secs(30))
|
||||||
.redirect(redirect_policy)
|
.redirect(redirect_policy)
|
||||||
.user_agent("Conduwuit".to_owned() + "/" + env!("CARGO_PKG_VERSION"));
|
.user_agent("Conduwuit".to_owned() + "/" + env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use ruma::OwnedUserId;
|
||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
pub trait Data: Send + Sync {
|
pub trait Data: Send + Sync {
|
||||||
@@ -15,6 +17,8 @@ pub trait Data: Send + Sync {
|
|||||||
|
|
||||||
fn search_mxc_metadata_prefix(&self, mxc: String) -> Result<Vec<Vec<u8>>>;
|
fn search_mxc_metadata_prefix(&self, mxc: String) -> Result<Vec<Vec<u8>>>;
|
||||||
|
|
||||||
|
fn get_all_media_keys_by_user(&self, user_id: OwnedUserId) -> Result<Vec<Vec<u8>>>;
|
||||||
|
|
||||||
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>>;
|
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>>;
|
||||||
|
|
||||||
fn remove_url_preview(&self, url: &str) -> Result<()>;
|
fn remove_url_preview(&self, url: &str) -> Result<()>;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use tokio::{
|
|||||||
};
|
};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use crate::{services, utils, Error, Result};
|
use crate::{services, utils::string_from_bytes, Error, Result};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FileMeta {
|
pub struct FileMeta {
|
||||||
@@ -110,6 +110,71 @@ impl Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Deletes all media in the database and from the media directory by a
|
||||||
|
/// specific user
|
||||||
|
pub async fn delete_from_user(&self, user_id: OwnedUserId) -> Result<u32> {
|
||||||
|
if let Ok(user_keys) = self.db.get_all_media_keys_by_user(user_id.clone()) {
|
||||||
|
if user_keys.is_empty() {
|
||||||
|
error!("User \"{user_id}\" has not uploaded any media.");
|
||||||
|
return Err(Error::bad_database("User has not uploaded any media."));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut mxc_deletion_count = 0;
|
||||||
|
|
||||||
|
for key in user_keys {
|
||||||
|
let mxc = String::from_utf8_lossy(&key);
|
||||||
|
|
||||||
|
let keys = self.db.search_mxc_metadata_prefix(mxc.to_string())?; // the MXC alone does not determine the file path, it is only the prefix
|
||||||
|
|
||||||
|
for key in keys {
|
||||||
|
let mxc = String::from_utf8_lossy(&key);
|
||||||
|
|
||||||
|
debug!("Deleting MXC {mxc} from database");
|
||||||
|
|
||||||
|
self.delete(mxc.to_string()).await?;
|
||||||
|
|
||||||
|
mxc_deletion_count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(mxc_deletion_count)
|
||||||
|
} else {
|
||||||
|
error!("Failed to find any media keys for user \"{user_id}\" in our database");
|
||||||
|
Err(Error::bad_database(
|
||||||
|
"Failed to find any media keys for the provided user in our database",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn list_all_media_by_user(&self, user_id: OwnedUserId) -> Result<Vec<String>> {
|
||||||
|
if let Ok(keys) = self.db.get_all_media_keys_by_user(user_id.clone()) {
|
||||||
|
if keys.is_empty() {
|
||||||
|
error!("User \"{user_id}\" has not uploaded any media.");
|
||||||
|
return Err(Error::bad_database("User has not uploaded any media."));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut mxc_list: Vec<String> = vec![];
|
||||||
|
|
||||||
|
for key in keys {
|
||||||
|
let mxc_string = string_from_bytes(&key).map_err(|e| {
|
||||||
|
error!("Failed to convert MXC key to string in database for user \"{user_id}\": {e}");
|
||||||
|
Error::bad_database("Failed to convert MXC key to string in database")
|
||||||
|
})?;
|
||||||
|
|
||||||
|
// TODO: add the file name
|
||||||
|
|
||||||
|
mxc_list.push(mxc_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(mxc_list)
|
||||||
|
} else {
|
||||||
|
error!("Failed to find any media keys for user \"{user_id}\" in our database");
|
||||||
|
Err(Error::bad_database(
|
||||||
|
"Failed to find any media keys for the provided user in our database",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Uploads or replaces a file thumbnail.
|
/// Uploads or replaces a file thumbnail.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub async fn upload_thumbnail(
|
pub async fn upload_thumbnail(
|
||||||
@@ -200,7 +265,7 @@ impl Service {
|
|||||||
let mxc = parts
|
let mxc = parts
|
||||||
.next()
|
.next()
|
||||||
.map(|bytes| {
|
.map(|bytes| {
|
||||||
utils::string_from_bytes(bytes).map_err(|e| {
|
string_from_bytes(bytes).map_err(|e| {
|
||||||
error!("Failed to parse MXC unicode bytes from our database: {}", e);
|
error!("Failed to parse MXC unicode bytes from our database: {}", e);
|
||||||
Error::bad_database("Failed to parse MXC unicode bytes from our database")
|
Error::bad_database("Failed to parse MXC unicode bytes from our database")
|
||||||
})
|
})
|
||||||
@@ -482,7 +547,8 @@ mod tests {
|
|||||||
|
|
||||||
impl Data for MockedKVDatabase {
|
impl Data for MockedKVDatabase {
|
||||||
fn create_file_metadata(
|
fn create_file_metadata(
|
||||||
&self, mxc: String, width: u32, height: u32, content_disposition: Option<&str>, content_type: Option<&str>,
|
&self, _sender_user: Option<&str>, mxc: String, width: u32, height: u32, content_disposition: Option<&str>,
|
||||||
|
content_type: Option<&str>,
|
||||||
) -> Result<Vec<u8>> {
|
) -> Result<Vec<u8>> {
|
||||||
// copied from src/database/key_value/media.rs
|
// copied from src/database/key_value/media.rs
|
||||||
let mut key = mxc.as_bytes().to_vec();
|
let mut key = mxc.as_bytes().to_vec();
|
||||||
@@ -501,6 +567,8 @@ mod tests {
|
|||||||
|
|
||||||
fn search_mxc_metadata_prefix(&self, _mxc: String) -> Result<Vec<Vec<u8>>> { todo!() }
|
fn search_mxc_metadata_prefix(&self, _mxc: String) -> Result<Vec<Vec<u8>>> { todo!() }
|
||||||
|
|
||||||
|
fn get_all_media_keys_by_user(&self, _user_id: OwnedUserId) -> Result<Vec<Vec<u8>>> { todo!() }
|
||||||
|
|
||||||
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>> { todo!() }
|
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>> { todo!() }
|
||||||
|
|
||||||
fn search_file_metadata(
|
fn search_file_metadata(
|
||||||
@@ -532,8 +600,10 @@ mod tests {
|
|||||||
let content_disposition = "attachment; filename=\"this is a very long file name with spaces and special \
|
let content_disposition = "attachment; filename=\"this is a very long file name with spaces and special \
|
||||||
characters like äöüß and even emoji like 🦀.png\"";
|
characters like äöüß and even emoji like 🦀.png\"";
|
||||||
let content_type = "image/png";
|
let content_type = "image/png";
|
||||||
let key =
|
let key = media
|
||||||
media.db.create_file_metadata(mxc, width, height, Some(content_disposition), Some(content_type)).unwrap();
|
.db
|
||||||
|
.create_file_metadata(None, mxc, width, height, Some(content_disposition), Some(content_type))
|
||||||
|
.unwrap();
|
||||||
let mut r = PathBuf::new();
|
let mut r = PathBuf::new();
|
||||||
r.push("/tmp");
|
r.push("/tmp");
|
||||||
r.push("media");
|
r.push("media");
|
||||||
|
|||||||
@@ -1098,7 +1098,7 @@ mod tests {
|
|||||||
fn invalid_pagnation_tokens() {
|
fn invalid_pagnation_tokens() {
|
||||||
fn token_is_err(token: &str) {
|
fn token_is_err(token: &str) {
|
||||||
let token: Result<PagnationToken> = PagnationToken::from_str(token);
|
let token: Result<PagnationToken> = PagnationToken::from_str(token);
|
||||||
assert!(token.is_err());
|
token.unwrap_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
token_is_err("231_2_noabool");
|
token_is_err("231_2_noabool");
|
||||||
|
|||||||
@@ -230,10 +230,9 @@ impl Service {
|
|||||||
|
|
||||||
pub fn get_name(&self, room_id: &RoomId) -> Result<Option<String>> {
|
pub fn get_name(&self, room_id: &RoomId) -> Result<Option<String>> {
|
||||||
services().rooms.state_accessor.room_state_get(room_id, &StateEventType::RoomName, "")?.map_or(Ok(None), |s| {
|
services().rooms.state_accessor.room_state_get(room_id, &StateEventType::RoomName, "")?.map_or(Ok(None), |s| {
|
||||||
serde_json::from_str(s.content.get()).map(|c: RoomNameEventContent| Some(c.name)).map_err(|e| {
|
Ok(serde_json::from_str(s.content.get())
|
||||||
error!("Invalid room name event in database for room {}. {}", room_id, e);
|
.map(|c: RoomNameEventContent| Some(c.name))
|
||||||
Error::bad_database("Invalid room name event in database.")
|
.unwrap_or_else(|_| None))
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use argon2::{password_hash::SaltString, PasswordHasher};
|
|||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use ring::digest;
|
use ring::digest;
|
||||||
use ruma::{canonical_json::try_from_json_map, CanonicalJsonError, CanonicalJsonObject, OwnedUserId};
|
use ruma::{canonical_json::try_from_json_map, CanonicalJsonError, CanonicalJsonObject, OwnedUserId};
|
||||||
use tracing::debug;
|
|
||||||
|
|
||||||
use crate::{services, Error, Result};
|
use crate::{services, Error, Result};
|
||||||
|
|
||||||
@@ -31,11 +30,8 @@ pub(crate) fn increment(old: Option<&[u8]>) -> Option<Vec<u8>> {
|
|||||||
Some(number.to_be_bytes().to_vec())
|
Some(number.to_be_bytes().to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates a new homeserver signing key. First 8 bytes are the version (a
|
|
||||||
/// random alphanumeric string), the rest are generated by Ed25519KeyPair
|
|
||||||
pub fn generate_keypair() -> Vec<u8> {
|
pub fn generate_keypair() -> Vec<u8> {
|
||||||
let mut value = random_string(8).as_bytes().to_vec();
|
let mut value = random_string(8).as_bytes().to_vec();
|
||||||
debug!("Keypair version bytes: {value:?}");
|
|
||||||
value.push(0xFF);
|
value.push(0xFF);
|
||||||
value.extend_from_slice(
|
value.extend_from_slice(
|
||||||
&ruma::signatures::Ed25519KeyPair::generate().expect("Ed25519KeyPair generation always works (?)"),
|
&ruma::signatures::Ed25519KeyPair::generate().expect("Ed25519KeyPair generation always works (?)"),
|
||||||
@@ -62,7 +58,6 @@ pub fn user_id_from_bytes(bytes: &[u8]) -> Result<OwnedUserId> {
|
|||||||
.map_err(|_| Error::bad_database("Failed to parse user id from bytes"))
|
.map_err(|_| Error::bad_database("Failed to parse user id from bytes"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generats a random *alphanumeric* string
|
|
||||||
pub fn random_string(length: usize) -> String {
|
pub fn random_string(length: usize) -> String {
|
||||||
thread_rng().sample_iter(&rand::distributions::Alphanumeric).take(length).map(char::from).collect()
|
thread_rng().sample_iter(&rand::distributions::Alphanumeric).take(length).map(char::from).collect()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user