Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adb518fa0d | ||
|
|
f91216dd3c | ||
|
|
ca724b6340 | ||
|
|
9bfc7b34b6 |
+45
-66
@@ -26,16 +26,19 @@ variables:
|
|||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- cargohome
|
- cargohome
|
||||||
- target/
|
key: "build_cache--$TARGET--$CI_COMMIT_BRANCH"
|
||||||
key: "build_cache--$TARGET--$CI_COMMIT_BRANCH--release"
|
|
||||||
variables:
|
variables:
|
||||||
CARGO_PROFILE_RELEASE_LTO: "true"
|
CARGO_PROFILE_RELEASE_LTO: "true"
|
||||||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
|
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
|
||||||
|
CARGO_INCREMENTAL: "false" # https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
|
||||||
|
CARGO_HOME: $CI_PROJECT_DIR/cargohome
|
||||||
before_script:
|
before_script:
|
||||||
- 'echo "Building for target $TARGET"'
|
- 'echo "Building for target $TARGET"'
|
||||||
- 'mkdir -p cargohome && CARGOHOME="cargohome"'
|
- "mkdir -p $CARGO_HOME"
|
||||||
- "rustc --version && cargo --version && rustup show" # Print version info for debugging
|
- "rustc --version && cargo --version && rustup show" # Print version info for debugging
|
||||||
- "rustup target add $TARGET"
|
- "rustup target add $TARGET"
|
||||||
|
# If provided, bring in caching through sccache, which uses an external S3 endpoint to store compilation results:
|
||||||
|
- if [ -n "${SCCACHE_BIN_URL}" ]; then curl $SCCACHE_BIN_URL --output /sccache && chmod +x /sccache && export RUSTC_WRAPPER=/sccache; fi
|
||||||
script:
|
script:
|
||||||
- time cargo build --target $TARGET --release
|
- time cargo build --target $TARGET --release
|
||||||
- 'cp "target/$TARGET/release/conduit" "conduit-$TARGET"'
|
- 'cp "target/$TARGET/release/conduit" "conduit-$TARGET"'
|
||||||
@@ -142,8 +145,12 @@ build:debug:cargo:x86_64-unknown-linux-musl:
|
|||||||
DOCKER_HOST: tcp://docker:2375/
|
DOCKER_HOST: tcp://docker:2375/
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ""
|
||||||
DOCKER_DRIVER: overlay2
|
DOCKER_DRIVER: overlay2
|
||||||
PLATFORMS: "linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64"
|
PLATFORMS: "linux/arm/v6,linux/arm/v7,linux/arm64,linux/amd64"
|
||||||
DOCKER_FILE: "docker/ci-binaries-packaging.Dockerfile"
|
DOCKER_FILE: "docker/ci-binaries-packaging.Dockerfile"
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- docker_cache
|
||||||
|
key: "$CI_JOB_NAME"
|
||||||
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
|
||||||
# Only log in to Dockerhub if the credentials are given:
|
# Only log in to Dockerhub if the credentials are given:
|
||||||
@@ -156,80 +163,51 @@ build:debug:cargo:x86_64-unknown-linux-musl:
|
|||||||
- mkdir -p linux/ && mv ./conduit-x86_64-unknown-linux-musl linux/amd64
|
- mkdir -p linux/ && mv ./conduit-x86_64-unknown-linux-musl linux/amd64
|
||||||
- mkdir -p linux/arm/ && mv ./conduit-arm-unknown-linux-musleabihf linux/arm/v6
|
- mkdir -p linux/arm/ && mv ./conduit-arm-unknown-linux-musleabihf linux/arm/v6
|
||||||
- mkdir -p linux/arm/ && mv ./conduit-armv7-unknown-linux-musleabihf linux/arm/v7
|
- mkdir -p linux/arm/ && mv ./conduit-armv7-unknown-linux-musleabihf linux/arm/v7
|
||||||
- mkdir -p linux/arm64/ && mv ./conduit-aarch64-unknown-linux-musl linux/arm64/v8
|
- mv ./conduit-aarch64-unknown-linux-musl linux/arm64
|
||||||
# Actually create multiarch image:
|
- 'export CREATED=$(date -u +''%Y-%m-%dT%H:%M:%SZ'') && echo "Docker image creation date: $CREATED"'
|
||||||
|
# Build and push image:
|
||||||
- >
|
- >
|
||||||
docker buildx build
|
docker buildx build
|
||||||
--pull
|
--pull
|
||||||
--push
|
--push
|
||||||
--build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
--cache-from=type=local,src=$CI_PROJECT_DIR/docker_cache
|
||||||
|
--cache-to=type=local,dest=$CI_PROJECT_DIR/docker_cache
|
||||||
|
--build-arg CREATED=$CREATED
|
||||||
--build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
|
--build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
|
||||||
--build-arg "GIT_REF=$CI_COMMIT_SHORT_SHA"
|
--build-arg "GIT_REF=$CI_COMMIT_SHORT_SHA"
|
||||||
--platform "$PLATFORMS"
|
--platform "$PLATFORMS"
|
||||||
--tag "$GL_IMAGE_TAG"
|
--tag "$TAG"
|
||||||
--tag "$GL_IMAGE_TAG-commit-$CI_COMMIT_SHORT_SHA"
|
--tag "$TAG-alpine"
|
||||||
|
--tag "$TAG-commit-$CI_COMMIT_SHORT_SHA"
|
||||||
--file "$DOCKER_FILE" .
|
--file "$DOCKER_FILE" .
|
||||||
# Only try to push to docker hub, if auth data for dockerhub exists:
|
|
||||||
- if [ -n "${DOCKER_HUB}" ]; then docker push "$DH_IMAGE_TAG"; fi
|
|
||||||
- if [ -n "${DOCKER_HUB}" ]; then docker push "$DH_IMAGE_TAG-commit-$CI_COMMIT_SHORT_SHA"; fi
|
|
||||||
|
|
||||||
build:docker:next:
|
docker:next:gitlab:
|
||||||
extends: .docker-shared-settings
|
extends: .docker-shared-settings
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_COMMIT_BRANCH == "next"'
|
- if: '$CI_COMMIT_BRANCH == "next"'
|
||||||
variables:
|
variables:
|
||||||
GL_IMAGE_TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:next"
|
TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:next"
|
||||||
DH_IMAGE_TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
|
|
||||||
|
|
||||||
build:docker:master:
|
docker:next:dockerhub:
|
||||||
|
extends: .docker-shared-settings
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "next" && $DOCKER_HUB'
|
||||||
|
variables:
|
||||||
|
TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
|
||||||
|
|
||||||
|
docker:master:gitlab:
|
||||||
extends: .docker-shared-settings
|
extends: .docker-shared-settings
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
variables:
|
variables:
|
||||||
GL_IMAGE_TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:latest"
|
TAG: "$CI_REGISTRY_IMAGE/matrix-conduit:latest"
|
||||||
DH_IMAGE_TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:latest"
|
|
||||||
|
|
||||||
## Build a docker image by packaging up the x86_64-unknown-linux-musl binary into an alpine image
|
docker:master:dockerhub:
|
||||||
#.docker-shared-settings:
|
extends: .docker-shared-settings
|
||||||
# stage: "build docker image"
|
rules:
|
||||||
# needs: []
|
- if: '$CI_COMMIT_BRANCH == "master" && $DOCKER_HUB'
|
||||||
# interruptible: true
|
variables:
|
||||||
# image:
|
TAG: "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:latest"
|
||||||
# name: "gcr.io/kaniko-project/executor:debug"
|
|
||||||
# entrypoint: [""]
|
|
||||||
# tags: ["docker"]
|
|
||||||
# variables:
|
|
||||||
# # Configure Kaniko Caching: https://cloud.google.com/build/docs/kaniko-cache
|
|
||||||
# KANIKO_CACHE_ARGS: "--cache=true --cache-copy-layers=true --cache-ttl=120h --cache-repo $CI_REGISTRY_IMAGE/kaniko-ci-cache"
|
|
||||||
# before_script:
|
|
||||||
# - "mkdir -p /kaniko/.docker"
|
|
||||||
# - 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"$DOCKER_HUB\":{\"username\":\"$DOCKER_HUB_USER\",\"password\":\"$DOCKER_HUB_PASSWORD\"}}}" > /kaniko/.docker/config.json'
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#build:docker:next:
|
|
||||||
# extends: .docker-shared-settings
|
|
||||||
# needs:
|
|
||||||
# - "build:release:cargo:x86_64-unknown-linux-musl"
|
|
||||||
# script:
|
|
||||||
# - >
|
|
||||||
# /kaniko/executor
|
|
||||||
# $KANIKO_CACHE_ARGS
|
|
||||||
# --force
|
|
||||||
# --context $CI_PROJECT_DIR
|
|
||||||
# --build-arg CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
||||||
# --build-arg VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)
|
|
||||||
# --build-arg "GIT_REF=$CI_COMMIT_SHORT_SHA"
|
|
||||||
# --dockerfile "$CI_PROJECT_DIR/docker/ci-binaries-packaging.Dockerfile"
|
|
||||||
# --destination "$CI_REGISTRY_IMAGE/conduit:next"
|
|
||||||
# --destination "$CI_REGISTRY_IMAGE/conduit:next-alpine"
|
|
||||||
# --destination "$CI_REGISTRY_IMAGE/conduit:commit-$CI_COMMIT_SHORT_SHA"
|
|
||||||
# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next"
|
|
||||||
# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:next-alpine"
|
|
||||||
# --destination "$DOCKER_HUB_IMAGE/matrixconduit/matrix-conduit:commit-$CI_COMMIT_SHORT_SHA"
|
|
||||||
# rules:
|
|
||||||
# - if: '$CI_COMMIT_BRANCH == "next"'
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------- #
|
# --------------------------------------------------------------------- #
|
||||||
# Run tests #
|
# Run tests #
|
||||||
@@ -241,20 +219,21 @@ test:cargo:
|
|||||||
image: "rust:latest"
|
image: "rust:latest"
|
||||||
tags: ["docker"]
|
tags: ["docker"]
|
||||||
variables:
|
variables:
|
||||||
CARGO_HOME: "cargohome"
|
CARGO_HOME: "$CI_PROJECT_DIR/cargohome"
|
||||||
|
CARGO_INCREMENTAL: "false" # https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- target
|
|
||||||
- cargohome
|
- cargohome
|
||||||
key: test_cache
|
key: "test_cache--$CI_COMMIT_BRANCH"
|
||||||
interruptible: true
|
interruptible: true
|
||||||
before_script:
|
before_script:
|
||||||
- mkdir -p $CARGO_HOME && echo "using $CARGO_HOME to cache cargo deps"
|
- mkdir -p $CARGO_HOME
|
||||||
- apt-get update -yqq
|
- apt-get update -yqq
|
||||||
- apt-get install -yqq --no-install-recommends build-essential libssl-dev pkg-config wget
|
- apt-get install -yqq --no-install-recommends build-essential libssl-dev pkg-config
|
||||||
- rustup component add clippy rustfmt
|
- rustup component add clippy rustfmt
|
||||||
- wget "https://faulty-storage.de/gitlab-report"
|
- curl "https://faulty-storage.de/gitlab-report" --output ./gitlab-report && chmod +x ./gitlab-report
|
||||||
- chmod +x ./gitlab-report
|
# If provided, bring in caching through sccache, which uses an external S3 endpoint to store compilation results:
|
||||||
|
- if [ -n "${SCCACHE_BIN_URL}" ]; then curl $SCCACHE_BIN_URL --output /sccache && chmod +x /sccache && export RUSTC_WRAPPER=/sccache; fi
|
||||||
script:
|
script:
|
||||||
- rustc --version && cargo --version # Print version info for debugging
|
- rustc --version && cargo --version # Print version info for debugging
|
||||||
- cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
|
|||||||
@@ -12,20 +12,17 @@ only offer Linux binaries.
|
|||||||
|
|
||||||
You may simply download the binary that fits your machine. Run `uname -m` to see what you need. Now copy the right url:
|
You may simply download the binary that fits your machine. Run `uname -m` to see what you need. Now copy the right url:
|
||||||
|
|
||||||
| CPU Architecture | Download link |
|
| CPU Architecture | Download stable version |
|
||||||
| ------------------------------------------- | ----------------------- |
|
| ------------------------------------------- | ------------------------------ |
|
||||||
| x84_64 / amd64 (Most servers and computers) | [Download][x84_64-musl] |
|
| x84_64 / amd64 (Most servers and computers) | [Download][x84_64-musl-master] |
|
||||||
| armv6 | [Download][armv6-musl] |
|
| armv6 | [Download][armv6-musl-master] |
|
||||||
| armv7 (e.g. Raspberry Pi by default) | [Download][armv7-musl] |
|
| armv7 (e.g. Raspberry Pi by default) | [Download][armv7-musl-master] |
|
||||||
| armv8 / aarch64 | [Download][armv8-musl] |
|
| armv8 / aarch64 | [Download][armv8-musl-master] |
|
||||||
|
|
||||||
[x84_64-musl]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-x86_64-unknown-linux-musl?job=build:release:cargo:x86_64-unknown-linux-musl
|
[x84_64-musl-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-x86_64-unknown-linux-musl?job=build:release:cargo:x86_64-unknown-linux-musl
|
||||||
|
[armv6-musl-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-arm-unknown-linux-musleabihf?job=build:release:cargo:arm-unknown-linux-musleabihf
|
||||||
[armv6-musl]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-arm-unknown-linux-musleabihf?job=build:release:cargo:arm-unknown-linux-musleabihf
|
[armv7-musl-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-armv7-unknown-linux-musleabihf?job=build:release:cargo:armv7-unknown-linux-musleabihf
|
||||||
|
[armv8-musl-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-aarch64-unknown-linux-musl?job=build:release:cargo:aarch64-unknown-linux-musl
|
||||||
[armv7-musl]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-armv7-unknown-linux-musleabihf?job=build:release:cargo:armv7-unknown-linux-musleabihf
|
|
||||||
|
|
||||||
[armv8-musl]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-aarch64-unknown-linux-musl?job=build:release:cargo:aarch64-unknown-linux-musl
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo wget -O /usr/local/bin/matrix-conduit <url>
|
$ sudo wget -O /usr/local/bin/matrix-conduit <url>
|
||||||
|
|||||||
+2
-2
@@ -54,11 +54,11 @@ RUN apk add --no-cache \
|
|||||||
RUN mkdir -p /srv/conduit/.local/share/conduit
|
RUN mkdir -p /srv/conduit/.local/share/conduit
|
||||||
|
|
||||||
# Test if Conduit is still alive, uses the same endpoint as Element
|
# Test if Conduit is still alive, uses the same endpoint as Element
|
||||||
COPY ./docker/healthcheck.sh /srv/conduit/
|
COPY ./docker/healthcheck.sh /srv/conduit/healthcheck.sh
|
||||||
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
|
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
|
||||||
|
|
||||||
# Copy over the actual Conduit binary from the builder stage
|
# Copy over the actual Conduit binary from the builder stage
|
||||||
COPY --from=builder /usr/src/conduit/target/release/conduit /srv/conduit/
|
COPY --from=builder /usr/src/conduit/target/release/conduit /srv/conduit/conduit
|
||||||
|
|
||||||
# Improve security: Don't run stuff as root, that does not need to run as root:
|
# Improve security: Don't run stuff as root, that does not need to run as root:
|
||||||
# Add www-data user and group with UID 82, as used by alpine
|
# Add www-data user and group with UID 82, as used by alpine
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ LABEL org.opencontainers.image.created=${CREATED} \
|
|||||||
RUN mkdir -p /srv/conduit/.local/share/conduit
|
RUN mkdir -p /srv/conduit/.local/share/conduit
|
||||||
|
|
||||||
# Test if Conduit is still alive, uses the same endpoint as Element
|
# Test if Conduit is still alive, uses the same endpoint as Element
|
||||||
COPY ./docker/healthcheck.sh /srv/conduit/
|
COPY ./docker/healthcheck.sh /srv/conduit/healthcheck.sh
|
||||||
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
|
HEALTHCHECK --start-period=5s --interval=5s CMD ./healthcheck.sh
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ use ruma::{
|
|||||||
EventType,
|
EventType,
|
||||||
},
|
},
|
||||||
identifiers::RoomName,
|
identifiers::RoomName,
|
||||||
push, RoomAliasId, RoomId, UserId,
|
push, RoomAliasId, RoomId, RoomVersionId, UserId,
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value;
|
use serde_json::value::to_raw_value;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
@@ -282,7 +282,7 @@ pub async fn register_route(
|
|||||||
let mut content = RoomCreateEventContent::new(conduit_user.clone());
|
let mut content = RoomCreateEventContent::new(conduit_user.clone());
|
||||||
content.federate = true;
|
content.federate = true;
|
||||||
content.predecessor = None;
|
content.predecessor = None;
|
||||||
content.room_version = db.globals.default_room_version();
|
content.room_version = RoomVersionId::Version6;
|
||||||
|
|
||||||
// 1. The room create event
|
// 1. The room create event
|
||||||
db.rooms.build_and_append_pdu(
|
db.rooms.build_and_append_pdu(
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use crate::{database::DatabaseGuard, ConduitResult, Ruma};
|
use crate::{ConduitResult, Ruma};
|
||||||
use ruma::api::client::r0::capabilities::{
|
use ruma::{
|
||||||
get_capabilities, Capabilities, RoomVersionStability, RoomVersionsCapability,
|
api::client::r0::capabilities::{
|
||||||
|
get_capabilities, Capabilities, RoomVersionStability, RoomVersionsCapability,
|
||||||
|
},
|
||||||
|
RoomVersionId,
|
||||||
};
|
};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
@@ -14,28 +17,17 @@ use rocket::get;
|
|||||||
feature = "conduit_bin",
|
feature = "conduit_bin",
|
||||||
get("/_matrix/client/r0/capabilities", data = "<_body>")
|
get("/_matrix/client/r0/capabilities", data = "<_body>")
|
||||||
)]
|
)]
|
||||||
#[tracing::instrument(skip(_body, db))]
|
#[tracing::instrument(skip(_body))]
|
||||||
pub async fn get_capabilities_route(
|
pub async fn get_capabilities_route(
|
||||||
_body: Ruma<get_capabilities::Request>,
|
_body: Ruma<get_capabilities::Request>,
|
||||||
db: DatabaseGuard,
|
|
||||||
) -> ConduitResult<get_capabilities::Response> {
|
) -> ConduitResult<get_capabilities::Response> {
|
||||||
let mut available = BTreeMap::new();
|
let mut available = BTreeMap::new();
|
||||||
if db.globals.allow_unstable_room_versions() {
|
available.insert(RoomVersionId::Version5, RoomVersionStability::Stable);
|
||||||
for room_version in &db.globals.unstable_room_versions {
|
available.insert(RoomVersionId::Version6, RoomVersionStability::Stable);
|
||||||
available.insert(room_version.clone(), RoomVersionStability::Stable);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for room_version in &db.globals.unstable_room_versions {
|
|
||||||
available.insert(room_version.clone(), RoomVersionStability::Unstable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for room_version in &db.globals.stable_room_versions {
|
|
||||||
available.insert(room_version.clone(), RoomVersionStability::Stable);
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut capabilities = Capabilities::new();
|
let mut capabilities = Capabilities::new();
|
||||||
capabilities.room_versions = RoomVersionsCapability {
|
capabilities.room_versions = RoomVersionsCapability {
|
||||||
default: db.globals.default_room_version(),
|
default: RoomVersionId::Version6,
|
||||||
available,
|
available,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ async fn join_room_by_id_helper(
|
|||||||
federation::membership::create_join_event_template::v1::Request {
|
federation::membership::create_join_event_template::v1::Request {
|
||||||
room_id,
|
room_id,
|
||||||
user_id: sender_user,
|
user_id: sender_user,
|
||||||
ver: &db.globals.supported_room_versions(),
|
ver: &[RoomVersionId::Version5, RoomVersionId::Version6],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
@@ -566,7 +566,12 @@ async fn join_room_by_id_helper(
|
|||||||
let (make_join_response, remote_server) = make_join_response_and_server?;
|
let (make_join_response, remote_server) = make_join_response_and_server?;
|
||||||
|
|
||||||
let room_version = match make_join_response.room_version {
|
let room_version = match make_join_response.room_version {
|
||||||
Some(room_version) if db.rooms.is_supported_version(&db, &room_version) => room_version,
|
Some(room_version)
|
||||||
|
if room_version == RoomVersionId::Version5
|
||||||
|
|| room_version == RoomVersionId::Version6 =>
|
||||||
|
{
|
||||||
|
room_version
|
||||||
|
}
|
||||||
_ => return Err(Error::BadServerResponse("Room version is not supported")),
|
_ => return Err(Error::BadServerResponse("Room version is not supported")),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -885,10 +890,9 @@ pub(crate) async fn invite_helper<'a>(
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there was no create event yet, assume we are creating a room with the default
|
// If there was no create event yet, assume we are creating a version 6 room right now
|
||||||
// version right now
|
|
||||||
let room_version_id = create_event_content
|
let room_version_id = create_event_content
|
||||||
.map_or(db.globals.default_room_version(), |create_event| {
|
.map_or(RoomVersionId::Version6, |create_event| {
|
||||||
create_event.room_version
|
create_event.room_version
|
||||||
});
|
});
|
||||||
let room_version =
|
let room_version =
|
||||||
@@ -1035,8 +1039,7 @@ pub(crate) async fn invite_helper<'a>(
|
|||||||
let pub_key_map = RwLock::new(BTreeMap::new());
|
let pub_key_map = RwLock::new(BTreeMap::new());
|
||||||
|
|
||||||
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
||||||
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(&response.event, &db)
|
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(&response.event) {
|
||||||
{
|
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Event could not be converted to canonical json
|
// Event could not be converted to canonical json
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use ruma::{
|
|||||||
EventType,
|
EventType,
|
||||||
},
|
},
|
||||||
serde::{CanonicalJsonObject, JsonObject},
|
serde::{CanonicalJsonObject, JsonObject},
|
||||||
RoomAliasId, RoomId,
|
RoomAliasId, RoomId, RoomVersionId,
|
||||||
};
|
};
|
||||||
use serde_json::{json, value::to_raw_value};
|
use serde_json::{json, value::to_raw_value};
|
||||||
use std::{
|
use std::{
|
||||||
@@ -109,7 +109,7 @@ pub async fn create_room_route(
|
|||||||
|
|
||||||
let room_version = match body.room_version.clone() {
|
let room_version = match body.room_version.clone() {
|
||||||
Some(room_version) => {
|
Some(room_version) => {
|
||||||
if db.rooms.is_supported_version(&db, &room_version) {
|
if room_version == RoomVersionId::Version5 || room_version == RoomVersionId::Version6 {
|
||||||
room_version
|
room_version
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
@@ -118,7 +118,7 @@ pub async fn create_room_route(
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => db.globals.default_room_version(),
|
None => RoomVersionId::Version6,
|
||||||
};
|
};
|
||||||
|
|
||||||
let content = match &body.creation_content {
|
let content = match &body.creation_content {
|
||||||
@@ -505,7 +505,10 @@ pub async fn upgrade_room_route(
|
|||||||
) -> ConduitResult<upgrade_room::Response> {
|
) -> ConduitResult<upgrade_room::Response> {
|
||||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||||
|
|
||||||
if !db.rooms.is_supported_version(&db, &body.new_version) {
|
if !matches!(
|
||||||
|
body.new_version,
|
||||||
|
RoomVersionId::Version5 | RoomVersionId::Version6
|
||||||
|
) {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::UnsupportedRoomVersion,
|
ErrorKind::UnsupportedRoomVersion,
|
||||||
"This server does not support that room version.",
|
"This server does not support that room version.",
|
||||||
|
|||||||
+1
-9
@@ -24,7 +24,7 @@ use rocket::{
|
|||||||
request::{FromRequest, Request},
|
request::{FromRequest, Request},
|
||||||
Shutdown, State,
|
Shutdown, State,
|
||||||
};
|
};
|
||||||
use ruma::{DeviceId, EventId, RoomId, RoomVersionId, ServerName, UserId};
|
use ruma::{DeviceId, EventId, RoomId, ServerName, UserId};
|
||||||
use serde::{de::IgnoredAny, Deserialize};
|
use serde::{de::IgnoredAny, Deserialize};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, HashMap, HashSet},
|
collections::{BTreeMap, HashMap, HashSet},
|
||||||
@@ -63,12 +63,8 @@ pub struct Config {
|
|||||||
allow_federation: bool,
|
allow_federation: bool,
|
||||||
#[serde(default = "true_fn")]
|
#[serde(default = "true_fn")]
|
||||||
allow_room_creation: bool,
|
allow_room_creation: bool,
|
||||||
#[serde(default = "true_fn")]
|
|
||||||
allow_unstable_room_versions: bool,
|
|
||||||
#[serde(default = "false_fn")]
|
#[serde(default = "false_fn")]
|
||||||
pub allow_jaeger: bool,
|
pub allow_jaeger: bool,
|
||||||
#[serde(default = "default_room_version")]
|
|
||||||
default_room_version: RoomVersionId,
|
|
||||||
#[serde(default = "false_fn")]
|
#[serde(default = "false_fn")]
|
||||||
pub tracing_flame: bool,
|
pub tracing_flame: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@@ -141,10 +137,6 @@ fn default_max_concurrent_requests() -> u16 {
|
|||||||
100
|
100
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_room_version() -> RoomVersionId {
|
|
||||||
RoomVersionId::Version6
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_log() -> String {
|
fn default_log() -> String {
|
||||||
"info,state_res=warn,rocket=off,_=off,sled=off".to_owned()
|
"info,state_res=warn,rocket=off,_=off,sled=off".to_owned()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-41
@@ -4,8 +4,7 @@ use ruma::{
|
|||||||
client::r0::sync::sync_events,
|
client::r0::sync::sync_events,
|
||||||
federation::discovery::{ServerSigningKeys, VerifyKey},
|
federation::discovery::{ServerSigningKeys, VerifyKey},
|
||||||
},
|
},
|
||||||
DeviceId, EventId, MilliSecondsSinceUnixEpoch, RoomId, RoomVersionId, ServerName,
|
DeviceId, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId, UserId,
|
||||||
ServerSigningKeyId, UserId,
|
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, HashMap},
|
collections::{BTreeMap, HashMap},
|
||||||
@@ -40,8 +39,6 @@ pub struct Globals {
|
|||||||
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
keypair: Arc<ruma::signatures::Ed25519KeyPair>,
|
||||||
dns_resolver: TokioAsyncResolver,
|
dns_resolver: TokioAsyncResolver,
|
||||||
jwt_decoding_key: Option<jsonwebtoken::DecodingKey<'static>>,
|
jwt_decoding_key: Option<jsonwebtoken::DecodingKey<'static>>,
|
||||||
pub stable_room_versions: Vec<RoomVersionId>,
|
|
||||||
pub unstable_room_versions: Vec<RoomVersionId>,
|
|
||||||
pub(super) server_signingkeys: Arc<dyn Tree>,
|
pub(super) server_signingkeys: Arc<dyn Tree>,
|
||||||
pub bad_event_ratelimiter: Arc<RwLock<HashMap<EventId, RateLimitState>>>,
|
pub bad_event_ratelimiter: Arc<RwLock<HashMap<EventId, RateLimitState>>>,
|
||||||
pub bad_signature_ratelimiter: Arc<RwLock<HashMap<Vec<String>, RateLimitState>>>,
|
pub bad_signature_ratelimiter: Arc<RwLock<HashMap<Vec<String>, RateLimitState>>>,
|
||||||
@@ -135,16 +132,7 @@ impl Globals {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|secret| jsonwebtoken::DecodingKey::from_secret(secret.as_bytes()).into_static());
|
.map(|secret| jsonwebtoken::DecodingKey::from_secret(secret.as_bytes()).into_static());
|
||||||
|
|
||||||
// Supported and stable room versions
|
let s = Self {
|
||||||
let stable_room_versions = vec![RoomVersionId::Version6];
|
|
||||||
// Experimental, partially supported room versions
|
|
||||||
let unstable_room_versions = vec![
|
|
||||||
RoomVersionId::Version3,
|
|
||||||
RoomVersionId::Version4,
|
|
||||||
RoomVersionId::Version5,
|
|
||||||
];
|
|
||||||
|
|
||||||
let mut s = Self {
|
|
||||||
globals,
|
globals,
|
||||||
config,
|
config,
|
||||||
keypair: Arc::new(keypair),
|
keypair: Arc::new(keypair),
|
||||||
@@ -155,8 +143,6 @@ impl Globals {
|
|||||||
tls_name_override,
|
tls_name_override,
|
||||||
server_signingkeys,
|
server_signingkeys,
|
||||||
jwt_decoding_key,
|
jwt_decoding_key,
|
||||||
stable_room_versions,
|
|
||||||
unstable_room_versions,
|
|
||||||
bad_event_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
bad_event_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
||||||
bad_signature_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
bad_signature_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
||||||
servername_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
servername_ratelimiter: Arc::new(RwLock::new(HashMap::new())),
|
||||||
@@ -169,14 +155,6 @@ impl Globals {
|
|||||||
|
|
||||||
fs::create_dir_all(s.get_media_folder())?;
|
fs::create_dir_all(s.get_media_folder())?;
|
||||||
|
|
||||||
if !s
|
|
||||||
.supported_room_versions()
|
|
||||||
.contains(&s.config.default_room_version)
|
|
||||||
{
|
|
||||||
error!("Room version in config isn't supported, falling back to Version 6");
|
|
||||||
s.config.default_room_version = RoomVersionId::Version6;
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(s)
|
Ok(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,14 +214,6 @@ impl Globals {
|
|||||||
self.config.allow_room_creation
|
self.config.allow_room_creation
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn allow_unstable_room_versions(&self) -> bool {
|
|
||||||
self.config.allow_unstable_room_versions
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn default_room_version(&self) -> RoomVersionId {
|
|
||||||
self.config.default_room_version.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn trusted_servers(&self) -> &[Box<ServerName>] {
|
pub fn trusted_servers(&self) -> &[Box<ServerName>] {
|
||||||
&self.config.trusted_servers
|
&self.config.trusted_servers
|
||||||
}
|
}
|
||||||
@@ -276,15 +246,6 @@ impl Globals {
|
|||||||
&self.config.turn_secret
|
&self.config.turn_secret
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn supported_room_versions(&self) -> Vec<RoomVersionId> {
|
|
||||||
let mut room_versions: Vec<RoomVersionId> = vec![];
|
|
||||||
room_versions.extend(self.stable_room_versions.clone());
|
|
||||||
if self.allow_unstable_room_versions() {
|
|
||||||
room_versions.extend(self.unstable_room_versions.clone());
|
|
||||||
};
|
|
||||||
room_versions
|
|
||||||
}
|
|
||||||
|
|
||||||
/// TODO: the key valid until timestamp is only honored in room version > 4
|
/// TODO: the key valid until timestamp is only honored in room version > 4
|
||||||
/// Remove the outdated keys and insert the new ones.
|
/// Remove the outdated keys and insert the new ones.
|
||||||
///
|
///
|
||||||
|
|||||||
+7
-30
@@ -129,12 +129,6 @@ pub struct Rooms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Rooms {
|
impl Rooms {
|
||||||
/// Returns true if a given room version is supported
|
|
||||||
#[tracing::instrument(skip(self, db))]
|
|
||||||
pub fn is_supported_version(&self, db: &Database, room_version: &RoomVersionId) -> bool {
|
|
||||||
db.globals.supported_room_versions().contains(room_version)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Builds a StateMap by iterating over all keys that start
|
/// Builds a StateMap by iterating over all keys that start
|
||||||
/// with state_hash, this gives the full state for the given state_hash.
|
/// with state_hash, this gives the full state for the given state_hash.
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
@@ -1989,10 +1983,9 @@ impl Rooms {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there was no create event yet, assume we are creating a room with the default
|
// If there was no create event yet, assume we are creating a version 6 room right now
|
||||||
// version right now
|
|
||||||
let room_version_id = create_event_content
|
let room_version_id = create_event_content
|
||||||
.map_or(db.globals.default_room_version(), |create_event| {
|
.map_or(RoomVersionId::Version6, |create_event| {
|
||||||
create_event.room_version
|
create_event.room_version
|
||||||
});
|
});
|
||||||
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
|
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
|
||||||
@@ -2785,7 +2778,11 @@ impl Rooms {
|
|||||||
let (make_leave_response, remote_server) = make_leave_response_and_server?;
|
let (make_leave_response, remote_server) = make_leave_response_and_server?;
|
||||||
|
|
||||||
let room_version_id = match make_leave_response.room_version {
|
let room_version_id = match make_leave_response.room_version {
|
||||||
Some(version) if self.is_supported_version(&db, &version) => version,
|
Some(version)
|
||||||
|
if version == RoomVersionId::Version5 || version == RoomVersionId::Version6 =>
|
||||||
|
{
|
||||||
|
version
|
||||||
|
}
|
||||||
_ => return Err(Error::BadServerResponse("Room version is not supported")),
|
_ => return Err(Error::BadServerResponse("Room version is not supported")),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3451,24 +3448,4 @@ impl Rooms {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the room's version.
|
|
||||||
#[tracing::instrument(skip(self))]
|
|
||||||
pub fn get_room_version(&self, room_id: &RoomId) -> Result<RoomVersionId> {
|
|
||||||
let create_event = self.room_state_get(room_id, &EventType::RoomCreate, "")?;
|
|
||||||
|
|
||||||
let create_event_content: Option<RoomCreateEventContent> = create_event
|
|
||||||
.as_ref()
|
|
||||||
.map(|create_event| {
|
|
||||||
serde_json::from_str(create_event.content.get()).map_err(|e| {
|
|
||||||
warn!("Invalid create event: {}", e);
|
|
||||||
Error::bad_database("Invalid create event in db.")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.transpose()?;
|
|
||||||
let room_version = create_event_content
|
|
||||||
.map(|create_event| create_event.room_version)
|
|
||||||
.ok_or_else(|| Error::BadDatabase("Invalid room version"))?;
|
|
||||||
Ok(room_version)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-12
@@ -1,4 +1,4 @@
|
|||||||
use crate::{Database, Error};
|
use crate::Error;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
events::{
|
events::{
|
||||||
room::member::RoomMemberEventContent, AnyEphemeralRoomEvent, AnyInitialStateEvent,
|
room::member::RoomMemberEventContent, AnyEphemeralRoomEvent, AnyInitialStateEvent,
|
||||||
@@ -6,7 +6,7 @@ use ruma::{
|
|||||||
EventType, StateEvent,
|
EventType, StateEvent,
|
||||||
},
|
},
|
||||||
serde::{CanonicalJsonObject, CanonicalJsonValue, Raw},
|
serde::{CanonicalJsonObject, CanonicalJsonValue, Raw},
|
||||||
state_res, EventId, MilliSecondsSinceUnixEpoch, RoomId, UInt, UserId,
|
state_res, EventId, MilliSecondsSinceUnixEpoch, RoomId, RoomVersionId, UInt, UserId,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{
|
use serde_json::{
|
||||||
@@ -331,24 +331,16 @@ impl Ord for PduEvent {
|
|||||||
/// Returns a tuple of the new `EventId` and the PDU as a `BTreeMap<String, CanonicalJsonValue>`.
|
/// Returns a tuple of the new `EventId` and the PDU as a `BTreeMap<String, CanonicalJsonValue>`.
|
||||||
pub(crate) fn gen_event_id_canonical_json(
|
pub(crate) fn gen_event_id_canonical_json(
|
||||||
pdu: &RawJsonValue,
|
pdu: &RawJsonValue,
|
||||||
db: &Database,
|
|
||||||
) -> crate::Result<(EventId, CanonicalJsonObject)> {
|
) -> crate::Result<(EventId, CanonicalJsonObject)> {
|
||||||
let value: CanonicalJsonObject = serde_json::from_str(pdu.get()).map_err(|e| {
|
let value = serde_json::from_str(pdu.get()).map_err(|e| {
|
||||||
warn!("Error parsing incoming event {:?}: {:?}", pdu, e);
|
warn!("Error parsing incoming event {:?}: {:?}", pdu, e);
|
||||||
Error::BadServerResponse("Invalid PDU in server response")
|
Error::BadServerResponse("Invalid PDU in server response")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let room_id = value
|
|
||||||
.get("room_id")
|
|
||||||
.and_then(|id| RoomId::try_from(id.as_str()?).ok())
|
|
||||||
.expect("Invalid room id in event");
|
|
||||||
|
|
||||||
let room_version_id = db.rooms.get_room_version(&room_id);
|
|
||||||
|
|
||||||
let event_id = EventId::try_from(&*format!(
|
let event_id = EventId::try_from(&*format!(
|
||||||
"${}",
|
"${}",
|
||||||
// Anything higher than version3 behaves the same
|
// Anything higher than version3 behaves the same
|
||||||
ruma::signatures::reference_hash(&value, &room_version_id?)
|
ruma::signatures::reference_hash(&value, &RoomVersionId::Version6)
|
||||||
.expect("ruma can calculate reference hashes")
|
.expect("ruma can calculate reference hashes")
|
||||||
))
|
))
|
||||||
.expect("ruma's reference hashes are valid event ids");
|
.expect("ruma's reference hashes are valid event ids");
|
||||||
|
|||||||
+9
-10
@@ -725,7 +725,7 @@ pub async fn send_transaction_message_route(
|
|||||||
|
|
||||||
for pdu in &body.pdus {
|
for pdu in &body.pdus {
|
||||||
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
||||||
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu, &db) {
|
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Event could not be converted to canonical json
|
// Event could not be converted to canonical json
|
||||||
@@ -1911,7 +1911,7 @@ pub(crate) fn fetch_and_handle_outliers<'a>(
|
|||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
warn!("Got {} over federation", id);
|
warn!("Got {} over federation", id);
|
||||||
let (calculated_event_id, value) =
|
let (calculated_event_id, value) =
|
||||||
match crate::pdu::gen_event_id_canonical_json(&res.pdu, &db) {
|
match crate::pdu::gen_event_id_canonical_json(&res.pdu) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
back_off((**id).clone());
|
back_off((**id).clone());
|
||||||
@@ -2670,12 +2670,10 @@ pub fn create_join_event_template_route(
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there was no create event yet, assume we are creating a room with the default version
|
// If there was no create event yet, assume we are creating a version 6 room right now
|
||||||
// right now
|
let room_version_id = create_event_content.map_or(RoomVersionId::Version6, |create_event| {
|
||||||
let room_version_id = create_event_content
|
create_event.room_version
|
||||||
.map_or(db.globals.default_room_version(), |create_event| {
|
});
|
||||||
create_event.room_version
|
|
||||||
});
|
|
||||||
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
|
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
|
||||||
|
|
||||||
if !body.ver.contains(&room_version_id) {
|
if !body.ver.contains(&room_version_id) {
|
||||||
@@ -2815,7 +2813,7 @@ async fn create_join_event(
|
|||||||
// let mut auth_cache = EventMap::new();
|
// let mut auth_cache = EventMap::new();
|
||||||
|
|
||||||
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
// We do not add the event_id field to the pdu here because of signature and hashes checks
|
||||||
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu, &db) {
|
let (event_id, value) = match crate::pdu::gen_event_id_canonical_json(pdu) {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Event could not be converted to canonical json
|
// Event could not be converted to canonical json
|
||||||
@@ -2939,7 +2937,8 @@ pub async fn create_invite_route(
|
|||||||
return Err(Error::bad_config("Federation is disabled."));
|
return Err(Error::bad_config("Federation is disabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if !db.rooms.is_supported_version(&db, &body.room_version) {
|
if body.room_version != RoomVersionId::Version5 && body.room_version != RoomVersionId::Version6
|
||||||
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::IncompatibleRoomVersion {
|
ErrorKind::IncompatibleRoomVersion {
|
||||||
room_version: body.room_version.clone(),
|
room_version: body.room_version.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user