mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-28 11:27:35 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
017d4b3894 | ||
|
|
3b3eaf8744 | ||
|
|
0a634907f2 | ||
|
|
2f2848728f | ||
|
|
5eea8fe880 | ||
|
|
12491dcc26 | ||
|
|
2eff454787 | ||
|
|
e5dc5bedfc | ||
|
|
496ca52987 | ||
|
|
72f4c3cc53 | ||
|
|
6a8a114197 | ||
|
|
549864a052 |
No files matched your search
@@ -33,7 +33,7 @@ runs:
|
|||||||
echo "version=$(rustup --version)" >> $GITHUB_OUTPUT
|
echo "version=$(rustup --version)" >> $GITHUB_OUTPUT
|
||||||
- name: Cache rustup toolchains
|
- name: Cache rustup toolchains
|
||||||
if: steps.rustup-version.outputs.version == ''
|
if: steps.rustup-version.outputs.version == ''
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.rustup
|
~/.rustup
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ runs:
|
|||||||
|
|
||||||
- name: Check for LLVM cache
|
- name: Check for LLVM cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/bin/clang-*
|
/usr/bin/clang-*
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache toolchain binaries
|
- name: Cache toolchain binaries
|
||||||
id: toolchain-cache
|
id: toolchain-cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/bin
|
.cargo/bin
|
||||||
@@ -76,7 +76,7 @@ runs:
|
|||||||
|
|
||||||
- name: Cache Cargo registry and git
|
- name: Cache Cargo registry and git
|
||||||
id: registry-cache
|
id: registry-cache
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.cargo/registry/index
|
.cargo/registry/index
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ runs:
|
|||||||
|
|
||||||
- name: Restore binary cache
|
- name: Restore binary cache
|
||||||
id: binary-cache
|
id: binary-cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/share/rust/.cargo/bin
|
/usr/share/rust/.cargo/bin
|
||||||
@@ -71,13 +71,13 @@ runs:
|
|||||||
|
|
||||||
- name: Install timelord-cli and git-warp-time
|
- name: Install timelord-cli and git-warp-time
|
||||||
if: steps.check-binaries.outputs.need-install == 'true'
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
uses: https://github.com/taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 # v2
|
uses: https://github.com/taiki-e/install-action@9bcaee1dcae34154180f412e2fa69355a7cda9f6 # v2
|
||||||
with:
|
with:
|
||||||
tool: git-warp-time,timelord-cli@3.0.1
|
tool: git-warp-time,timelord-cli@3.0.1
|
||||||
|
|
||||||
- name: Save binary cache
|
- name: Save binary cache
|
||||||
if: steps.check-binaries.outputs.need-install == 'true'
|
if: steps.check-binaries.outputs.need-install == 'true'
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/usr/share/rust/.cargo/bin
|
/usr/share/rust/.cargo/bin
|
||||||
@@ -87,7 +87,7 @@ runs:
|
|||||||
|
|
||||||
- name: Restore timelord cache with fallbacks
|
- name: Restore timelord cache with fallbacks
|
||||||
id: timelord-restore
|
id: timelord-restore
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: ${{ env.TIMELORD_CACHE_PATH }}
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
key: ${{ env.TIMELORD_KEY }}
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
@@ -114,7 +114,7 @@ runs:
|
|||||||
timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
|
timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
|
|
||||||
- name: Save updated timelord cache immediately
|
- name: Save updated timelord cache immediately
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: ${{ env.TIMELORD_CACHE_PATH }}
|
path: ${{ env.TIMELORD_CACHE_PATH }}
|
||||||
key: ${{ env.TIMELORD_KEY }}
|
key: ${{ env.TIMELORD_KEY }}
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
ref: ${{ github.ref_name }}
|
ref: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Cache Cargo registry
|
- name: Cache Cargo registry
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
- name: Cache DNF packages
|
- name: Cache DNF packages
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/var/cache/dnf
|
/var/cache/dnf
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
dnf-fedora${{ steps.fedora.outputs.version }}-
|
dnf-fedora${{ steps.fedora.outputs.version }}-
|
||||||
|
|
||||||
- name: Cache Cargo registry
|
- name: Cache Cargo registry
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
cargo-fedora${{ steps.fedora.outputs.version }}-
|
cargo-fedora${{ steps.fedora.outputs.version }}-
|
||||||
|
|
||||||
- name: Cache Rust build dependencies
|
- name: Cache Rust build dependencies
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/rpmbuild/BUILD/*/target/release/deps
|
~/rpmbuild/BUILD/*/target/release/deps
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
node-version: 22
|
node-version: 22
|
||||||
|
|
||||||
- name: Cache npm dependencies
|
- name: Cache npm dependencies
|
||||||
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: ~/.npm
|
path: ~/.npm
|
||||||
key: continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-${{ hashFiles('package-lock.json') }}
|
key: continuwuity-rspress-${{ steps.runner-env.outputs.slug }}-${{ steps.runner-env.outputs.arch }}-node-${{ steps.runner-env.outputs.node_version }}-${{ hashFiles('package-lock.json') }}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
# repositories: continuwuity
|
# repositories: continuwuity
|
||||||
|
|
||||||
- name: Install regsync
|
- name: Install regsync
|
||||||
uses: https://github.com/regclient/actions/regsync-installer@4b4db1dcc7dad75ad67a788a380f75a20cc8a040 # main
|
uses: https://github.com/regclient/actions/regsync-installer@9a2d4216180dbb3e2dccfa60d2dd4afd98e42ec5 # main
|
||||||
|
|
||||||
- name: Check what images need mirroring
|
- name: Check what images need mirroring
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
run: /usr/local/renovate/node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
|
run: /usr/local/renovate/node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
|
||||||
|
|
||||||
- name: Restore renovate repo cache
|
- name: Restore renovate repo cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/repository
|
/tmp/renovate/cache/renovate/repository
|
||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
renovate-repo-cache-
|
renovate-repo-cache-
|
||||||
|
|
||||||
- name: Restore renovate package cache
|
- name: Restore renovate package cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
renovate-package-cache-
|
renovate-package-cache-
|
||||||
|
|
||||||
- name: Restore renovate OSV cache
|
- name: Restore renovate OSV cache
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/osv
|
/tmp/osv
|
||||||
@@ -117,7 +117,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Save renovate package cache
|
- name: Save renovate package cache
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
/tmp/renovate/cache/renovate/renovate-cache-sqlite
|
||||||
@@ -125,7 +125,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Save renovate OSV cache
|
- name: Save renovate OSV cache
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
|
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
/tmp/osv
|
/tmp/osv
|
||||||
|
|||||||
Generated
+7
-28
@@ -615,12 +615,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo_toml"
|
name = "cargo_toml"
|
||||||
version = "0.22.3"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77"
|
checksum = "aa61aec073ec94791433ddf3df2323ff9d1711557c2a0eefb0f99cb4f8dca520"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"toml 0.9.12+spec-1.1.0",
|
"toml 1.1.2+spec-1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4809,7 +4810,7 @@ checksum = "a15e3bc297370dc9c526bcf0986f29167a9286cfaad404f2f572b3074dabe5ec"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"annotate-snippets",
|
"annotate-snippets",
|
||||||
"base64 0.21.7",
|
"base64 0.22.1",
|
||||||
"encoding_rs_io",
|
"encoding_rs_io",
|
||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
"granit-parser",
|
"granit-parser",
|
||||||
@@ -5459,31 +5460,18 @@ dependencies = [
|
|||||||
"toml_edit 0.22.27",
|
"toml_edit 0.22.27",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.9.12+spec-1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde_core",
|
|
||||||
"serde_spanned 1.1.1",
|
|
||||||
"toml_datetime 0.7.5+spec-1.1.0",
|
|
||||||
"toml_parser",
|
|
||||||
"toml_writer",
|
|
||||||
"winnow 0.7.15",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "1.1.2+spec-1.1.0"
|
version = "1.1.2+spec-1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
|
checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"indexmap",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"serde_spanned 1.1.1",
|
"serde_spanned 1.1.1",
|
||||||
"toml_datetime 1.1.1+spec-1.1.0",
|
"toml_datetime 1.1.1+spec-1.1.0",
|
||||||
"toml_parser",
|
"toml_parser",
|
||||||
|
"toml_writer",
|
||||||
"winnow 1.0.3",
|
"winnow 1.0.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5496,15 +5484,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.7.5+spec-1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
|
||||||
dependencies = [
|
|
||||||
"serde_core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "1.1.1+spec-1.1.0"
|
version = "1.1.1+spec-1.1.0"
|
||||||
|
|||||||
+2
-1
@@ -45,7 +45,7 @@ version = "1.0.6"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
||||||
[workspace.dependencies.cargo_toml]
|
[workspace.dependencies.cargo_toml]
|
||||||
version = "0.22"
|
version = "1.0"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["features"]
|
features = ["features"]
|
||||||
|
|
||||||
@@ -356,6 +356,7 @@ features = [
|
|||||||
"ring-compat",
|
"ring-compat",
|
||||||
"compat-upload-signatures",
|
"compat-upload-signatures",
|
||||||
"compat-optional-txn-pdus",
|
"compat-optional-txn-pdus",
|
||||||
|
"compat-get-3pids",
|
||||||
"unstable-msc2666",
|
"unstable-msc2666",
|
||||||
"unstable-msc2867",
|
"unstable-msc2867",
|
||||||
"unstable-msc2870",
|
"unstable-msc2870",
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Appservice device management as outlined in MSC4190 (part of Matrix 1.17) is now fully supported. Contributed by @ginger.
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
{
|
{
|
||||||
# basic nix shell containing all things necessary to build continuwuity in all flavors manually (on x86_64-linux)
|
# basic nix shell containing all things necessary to build continuwuity in all flavors manually (on x86_64-linux)
|
||||||
devShells.default =
|
devShells.default =
|
||||||
(inputs.crane.mkLib pkgs).overrideToolchain (pkgs: self'.packages.stable-toolchain).devShell
|
((inputs.crane.mkLib pkgs).overrideToolchain (pkgs: self'.packages.stable-toolchain)).devShell
|
||||||
{
|
{
|
||||||
packages = [
|
packages = [
|
||||||
self'.packages.rocksdb
|
self'.packages.rocksdb
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
use axum::extract::State;
|
||||||
|
use conduwuit::{Err, Result};
|
||||||
|
use futures::future::{join, join3};
|
||||||
|
use ruma::api::client::admin::{is_user_locked, lock_user};
|
||||||
|
|
||||||
|
use crate::Ruma;
|
||||||
|
|
||||||
|
/// # `GET /_matrix/client/v1/admin/lock/{userId}`
|
||||||
|
///
|
||||||
|
/// Check the account lock status of a target user
|
||||||
|
pub(crate) async fn get_lock_status(
|
||||||
|
State(services): State<crate::State>,
|
||||||
|
body: Ruma<is_user_locked::v1::Request>,
|
||||||
|
) -> Result<is_user_locked::v1::Response> {
|
||||||
|
let (admin, active) = join(
|
||||||
|
services.users.is_admin(body.identity.expect_sender_user()?),
|
||||||
|
services.users.is_active(&body.user_id),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
if !admin {
|
||||||
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
|
}
|
||||||
|
if !services.globals.user_is_local(&body.user_id) {
|
||||||
|
return Err!(Request(InvalidParam("Can only check the lock status of local users")));
|
||||||
|
}
|
||||||
|
if !active {
|
||||||
|
return Err!(Request(NotFound("Unknown user")));
|
||||||
|
}
|
||||||
|
Ok(is_user_locked::v1::Response::new(
|
||||||
|
services.users.is_locked(&body.user_id).await?,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # `PUT /_matrix/client/v1/admin/lock/{userId}`
|
||||||
|
///
|
||||||
|
/// Set the account lock status of a target user
|
||||||
|
pub(crate) async fn put_lock_status(
|
||||||
|
State(services): State<crate::State>,
|
||||||
|
body: Ruma<lock_user::v1::Request>,
|
||||||
|
) -> Result<lock_user::v1::Response> {
|
||||||
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
|
let (sender_admin, active, target_admin) = join3(
|
||||||
|
services.users.is_admin(sender_user),
|
||||||
|
services.users.is_active(&body.user_id),
|
||||||
|
services.users.is_admin(&body.user_id),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
if !sender_admin {
|
||||||
|
return Err!(Request(Forbidden("Only server administrators can use this endpoint")));
|
||||||
|
}
|
||||||
|
if !services.globals.user_is_local(&body.user_id) {
|
||||||
|
return Err!(Request(InvalidParam("Can only set the lock status of local users")));
|
||||||
|
}
|
||||||
|
if !active {
|
||||||
|
return Err!(Request(NotFound("Unknown user")));
|
||||||
|
}
|
||||||
|
if body.user_id == *sender_user {
|
||||||
|
return Err!(Request(Forbidden("You cannot lock yourself")));
|
||||||
|
}
|
||||||
|
if target_admin {
|
||||||
|
return Err!(Request(Forbidden("You cannot lock another server administrator")));
|
||||||
|
}
|
||||||
|
if services.users.is_locked(&body.user_id).await? == body.locked {
|
||||||
|
// No change
|
||||||
|
return Ok(lock_user::v1::Response::new(body.locked));
|
||||||
|
}
|
||||||
|
|
||||||
|
let action = if body.locked {
|
||||||
|
services
|
||||||
|
.users
|
||||||
|
.suspend_account(&body.user_id, sender_user)
|
||||||
|
.await;
|
||||||
|
"locked"
|
||||||
|
} else {
|
||||||
|
services.users.unsuspend_account(&body.user_id).await;
|
||||||
|
"unlocked"
|
||||||
|
};
|
||||||
|
|
||||||
|
if services.config.admin_room_notices {
|
||||||
|
// Notify the admin room that an account has been un/suspended
|
||||||
|
services
|
||||||
|
.admin
|
||||||
|
.send_text(&format!("{} has been {} by {}.", body.user_id, action, sender_user))
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(lock_user::v1::Response::new(body.locked))
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
mod lock;
|
||||||
mod suspend;
|
mod suspend;
|
||||||
|
|
||||||
pub(crate) use self::suspend::*;
|
pub(crate) use self::{lock::*, suspend::*};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result};
|
use conduwuit::{Err, Result};
|
||||||
use futures::future::{join, join3};
|
use futures::future::{join, join3};
|
||||||
use ruminuwuity::admin::{get_suspended, set_suspended};
|
use ruma::api::client::admin::{is_user_suspended, suspend_user};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -10,8 +10,8 @@ use crate::Ruma;
|
|||||||
/// Check the suspension status of a target user
|
/// Check the suspension status of a target user
|
||||||
pub(crate) async fn get_suspended_status(
|
pub(crate) async fn get_suspended_status(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<get_suspended::v1::Request>,
|
body: Ruma<is_user_suspended::v1::Request>,
|
||||||
) -> Result<get_suspended::v1::Response> {
|
) -> Result<is_user_suspended::v1::Response> {
|
||||||
let (admin, active) = join(
|
let (admin, active) = join(
|
||||||
services.users.is_admin(body.identity.expect_sender_user()?),
|
services.users.is_admin(body.identity.expect_sender_user()?),
|
||||||
services.users.is_active(&body.user_id),
|
services.users.is_active(&body.user_id),
|
||||||
@@ -26,7 +26,7 @@ pub(crate) async fn get_suspended_status(
|
|||||||
if !active {
|
if !active {
|
||||||
return Err!(Request(NotFound("Unknown user")));
|
return Err!(Request(NotFound("Unknown user")));
|
||||||
}
|
}
|
||||||
Ok(get_suspended::v1::Response::new(
|
Ok(is_user_suspended::v1::Response::new(
|
||||||
services.users.is_suspended(&body.user_id).await?,
|
services.users.is_suspended(&body.user_id).await?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -36,8 +36,8 @@ pub(crate) async fn get_suspended_status(
|
|||||||
/// Set the suspension status of a target user
|
/// Set the suspension status of a target user
|
||||||
pub(crate) async fn put_suspended_status(
|
pub(crate) async fn put_suspended_status(
|
||||||
State(services): State<crate::State>,
|
State(services): State<crate::State>,
|
||||||
body: Ruma<set_suspended::v1::Request>,
|
body: Ruma<suspend_user::v1::Request>,
|
||||||
) -> Result<set_suspended::v1::Response> {
|
) -> Result<suspend_user::v1::Response> {
|
||||||
let sender_user = body.identity.expect_sender_user()?;
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
let (sender_admin, active, target_admin) = join3(
|
let (sender_admin, active, target_admin) = join3(
|
||||||
@@ -64,7 +64,7 @@ pub(crate) async fn put_suspended_status(
|
|||||||
}
|
}
|
||||||
if services.users.is_suspended(&body.user_id).await? == body.suspended {
|
if services.users.is_suspended(&body.user_id).await? == body.suspended {
|
||||||
// No change
|
// No change
|
||||||
return Ok(set_suspended::v1::Response::new(body.suspended));
|
return Ok(suspend_user::v1::Response::new(body.suspended));
|
||||||
}
|
}
|
||||||
|
|
||||||
let action = if body.suspended {
|
let action = if body.suspended {
|
||||||
@@ -86,5 +86,5 @@ pub(crate) async fn put_suspended_status(
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(set_suspended::v1::Response::new(body.suspended))
|
Ok(suspend_user::v1::Response::new(body.suspended))
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,6 @@ use ruma::{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use serde_json::json;
|
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -40,21 +39,15 @@ pub(crate) async fn get_capabilities_route(
|
|||||||
capabilities.get_login_token =
|
capabilities.get_login_token =
|
||||||
GetLoginTokenCapability::new(services.server.config.login_via_existing_session);
|
GetLoginTokenCapability::new(services.server.config.login_via_existing_session);
|
||||||
|
|
||||||
// MSC4133 capability
|
capabilities.forget_forced_upon_leave.enabled = true;
|
||||||
capabilities.set("uk.tcpip.msc4133.profile_fields", json!({"enabled": true}))?;
|
|
||||||
|
|
||||||
capabilities.set(
|
|
||||||
"org.matrix.msc4267.forget_forced_upon_leave",
|
|
||||||
json!({"enabled": services.config.forget_forced_upon_leave}),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
if services
|
if services
|
||||||
.users
|
.users
|
||||||
.is_admin(body.identity.expect_sender_user()?)
|
.is_admin(body.identity.expect_sender_user()?)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
// Advertise suspension API
|
capabilities.account_moderation.lock = true;
|
||||||
capabilities.set("uk.timedout.msc4323", json!({"suspend": true, "lock": false}))?;
|
capabilities.account_moderation.suspend = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(get_capabilities::v3::Response::new(capabilities))
|
Ok(get_capabilities::v3::Response::new(capabilities))
|
||||||
|
|||||||
@@ -121,7 +121,9 @@ pub(crate) async fn delete_device_route(
|
|||||||
let sender_user = body.identity.expect_sender_user()?;
|
let sender_user = body.identity.expect_sender_user()?;
|
||||||
|
|
||||||
// Appservices get to skip UIAA for this endpoint
|
// Appservices get to skip UIAA for this endpoint
|
||||||
if let Some(sender_device) = body.identity.sender_device() {
|
if !body.identity.is_appservice() {
|
||||||
|
let sender_device = body.identity.expect_sender_device()?;
|
||||||
|
|
||||||
// Prompt the user to confirm with their password using UIAA
|
// Prompt the user to confirm with their password using UIAA
|
||||||
let _ = services
|
let _ = services
|
||||||
.uiaa
|
.uiaa
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ pub(crate) async fn upload_signing_keys_route(
|
|||||||
if uiaa_needed_to_upload_keys(
|
if uiaa_needed_to_upload_keys(
|
||||||
services,
|
services,
|
||||||
sender_user,
|
sender_user,
|
||||||
|
body.identity.is_appservice(),
|
||||||
body.self_signing_key.as_ref(),
|
body.self_signing_key.as_ref(),
|
||||||
body.user_signing_key.as_ref(),
|
body.user_signing_key.as_ref(),
|
||||||
body.master_key.as_ref(),
|
body.master_key.as_ref(),
|
||||||
@@ -231,10 +232,16 @@ pub(crate) async fn upload_signing_keys_route(
|
|||||||
async fn uiaa_needed_to_upload_keys(
|
async fn uiaa_needed_to_upload_keys(
|
||||||
services: crate::State,
|
services: crate::State,
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
|
is_appservice: bool,
|
||||||
self_signing_key: Option<&Raw<CrossSigningKey>>,
|
self_signing_key: Option<&Raw<CrossSigningKey>>,
|
||||||
user_signing_key: Option<&Raw<CrossSigningKey>>,
|
user_signing_key: Option<&Raw<CrossSigningKey>>,
|
||||||
master_signing_key: Option<&Raw<CrossSigningKey>>,
|
master_signing_key: Option<&Raw<CrossSigningKey>>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
if is_appservice {
|
||||||
|
// Appservices can skip UIAA for this endpoint
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let (self_signing_key, user_signing_key, master_signing_key) = (
|
let (self_signing_key, user_signing_key, master_signing_key) = (
|
||||||
self_signing_key.map(Raw::deserialize).flat_ok(),
|
self_signing_key.map(Raw::deserialize).flat_ok(),
|
||||||
user_signing_key.map(Raw::deserialize).flat_ok(),
|
user_signing_key.map(Raw::deserialize).flat_ok(),
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ pub fn build(router: Router<State>, state: State) -> Router<State> {
|
|||||||
.ruma_route(&client::get_room_summary)
|
.ruma_route(&client::get_room_summary)
|
||||||
.ruma_route(&client::get_suspended_status)
|
.ruma_route(&client::get_suspended_status)
|
||||||
.ruma_route(&client::put_suspended_status)
|
.ruma_route(&client::put_suspended_status)
|
||||||
|
.ruma_route(&client::get_lock_status)
|
||||||
|
.ruma_route(&client::put_lock_status)
|
||||||
.ruma_route(&client::well_known_support)
|
.ruma_route(&client::well_known_support)
|
||||||
.ruma_route(&client::well_known_client)
|
.ruma_route(&client::well_known_client)
|
||||||
.ruma_route(&client::well_known_policy_server)
|
.ruma_route(&client::well_known_policy_server)
|
||||||
|
|||||||
+12
-17
@@ -23,28 +23,23 @@ pub fn versions() -> Vec<String> {
|
|||||||
"v1.14".to_owned(),
|
"v1.14".to_owned(),
|
||||||
"v1.15".to_owned(),
|
"v1.15".to_owned(),
|
||||||
"v1.16".to_owned(),
|
"v1.16".to_owned(),
|
||||||
|
"v1.17".to_owned(),
|
||||||
|
"v1.18".to_owned(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn unstable_features() -> BTreeMap<String, bool> {
|
pub fn unstable_features() -> BTreeMap<String, bool> {
|
||||||
BTreeMap::from_iter([
|
BTreeMap::from_iter([
|
||||||
("org.matrix.e2e_cross_signing".to_owned(), true),
|
// query mutual rooms (https://github.com/matrix-org/matrix-spec-proposals/pull/2666)
|
||||||
("org.matrix.msc2285.stable".to_owned(), true), /* private read receipts (https://github.com/matrix-org/matrix-spec-proposals/pull/2285) */
|
// Expected for spec v1.19
|
||||||
("uk.half-shot.msc2666.query_mutual_rooms".to_owned(), true), /* query mutual rooms (https://github.com/matrix-org/matrix-spec-proposals/pull/2666) */
|
("uk.half-shot.msc2666.query_mutual_rooms.stable".to_owned(), true),
|
||||||
("org.matrix.msc2836".to_owned(), true), /* threading/threads (https://github.com/matrix-org/matrix-spec-proposals/pull/2836) */
|
// Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186)
|
||||||
("org.matrix.msc2946".to_owned(), true), /* spaces/hierarchy summaries (https://github.com/matrix-org/matrix-spec-proposals/pull/2946) */
|
// Expected for spec v1.19
|
||||||
("org.matrix.msc3026.busy_presence".to_owned(), true), /* busy presence status (https://github.com/matrix-org/matrix-spec-proposals/pull/3026) */
|
("org.matrix.simplified_msc3575".to_owned(), true),
|
||||||
("org.matrix.msc3827".to_owned(), true), /* filtering of /publicRooms by room type (https://github.com/matrix-org/matrix-spec-proposals/pull/3827) */
|
// invite filtering (https://github.com/matrix-org/matrix-spec-proposals/pull/4155)
|
||||||
("org.matrix.msc3952_intentional_mentions".to_owned(), true), /* intentional mentions (https://github.com/matrix-org/matrix-spec-proposals/pull/3952) */
|
("org.matrix.msc4155".to_owned(), true),
|
||||||
("org.matrix.msc3916.stable".to_owned(), true), /* authenticated media (https://github.com/matrix-org/matrix-spec-proposals/pull/3916) */
|
// profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466)
|
||||||
("org.matrix.msc4180".to_owned(), true), /* stable flag for 3916 (https://github.com/matrix-org/matrix-spec-proposals/pull/4180) */
|
("computer.gingershaped.msc4466".to_owned(), true),
|
||||||
("uk.tcpip.msc4133".to_owned(), true), /* Extending User Profile API with Key:Value Pairs (https://github.com/matrix-org/matrix-spec-proposals/pull/4133) */
|
|
||||||
("us.cloke.msc4175".to_owned(), true), /* Profile field for user time zone (https://github.com/matrix-org/matrix-spec-proposals/pull/4175) */
|
|
||||||
("org.matrix.simplified_msc3575".to_owned(), true), /* Simplified Sliding sync (https://github.com/matrix-org/matrix-spec-proposals/pull/4186) */
|
|
||||||
("uk.timedout.msc4323".to_owned(), true), /* agnostic suspend (https://github.com/matrix-org/matrix-spec-proposals/pull/4323) */
|
|
||||||
("org.matrix.msc4155".to_owned(), true), /* invite filtering (https://github.com/matrix-org/matrix-spec-proposals/pull/4155) */
|
|
||||||
("computer.gingershaped.msc4466".to_owned(), true), /* profile change propagation (https://github.com/matrix-org/matrix-spec-proposals/pull/4466) */
|
|
||||||
("org.matrix.msc4380.stable".to_owned(), true),
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user