mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
upgrade all cargo dependencies
Unfortunately we need to pull tracing-opentelemetry from git because there hasn't been a release including the dependency bump on the other opentelemetry crates.
This commit is contained in:
parent
d5da913c79
commit
8f0fdfb2f2
26 changed files with 993 additions and 762 deletions
1410
Cargo.lock
generated
1410
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
77
Cargo.toml
77
Cargo.toml
|
|
@ -87,54 +87,59 @@ workspace = true
|
||||||
|
|
||||||
# Keep sorted
|
# Keep sorted
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.68"
|
async-trait = "0.1.80"
|
||||||
axum = { version = "0.6.18", default-features = false, features = ["form", "headers", "http1", "http2", "json", "matched-path"] }
|
axum = { version = "0.7.5", default-features = false, features = ["form", "http1", "http2", "json", "matched-path"] }
|
||||||
axum-server = { version = "0.5.1", features = ["tls-rustls"] }
|
axum-extra = { version = "0.9.3", features = ["typed-header"] }
|
||||||
base64 = "0.21.2"
|
axum-server = { version = "0.6.0", features = ["tls-rustls"] }
|
||||||
bytes = "1.4.0"
|
base64 = "0.22.1"
|
||||||
clap = { version = "4.3.0", default-features = false, features = ["std", "derive", "help", "usage", "error-context", "string"] }
|
bytes = "1.6.0"
|
||||||
figment = { version = "0.10.8", features = ["env", "toml"] }
|
clap = { version = "4.5.4", default-features = false, features = ["std", "derive", "help", "usage", "error-context", "string"] }
|
||||||
futures-util = { version = "0.3.28", default-features = false }
|
figment = { version = "0.10.19", features = ["env", "toml"] }
|
||||||
|
futures-util = { version = "0.3.30", default-features = false }
|
||||||
hmac = "0.12.1"
|
hmac = "0.12.1"
|
||||||
html-escape = "0.2.13"
|
html-escape = "0.2.13"
|
||||||
http = "0.2.9"
|
http = "1.1.0"
|
||||||
hyper = "0.14.26"
|
http-body-util = "0.1.1"
|
||||||
image = { version = "0.24.6", default-features = false, features = ["jpeg", "png", "gif"] }
|
hyper = "1.3.1"
|
||||||
jsonwebtoken = "9.2.0"
|
hyper-util = { version = "0.1.4", features = ["client", "client-legacy", "service"] }
|
||||||
|
image = { version = "0.25.1", default-features = false, features = ["jpeg", "png", "gif"] }
|
||||||
|
jsonwebtoken = "9.3.0"
|
||||||
lru-cache = "0.1.2"
|
lru-cache = "0.1.2"
|
||||||
num_cpus = "1.15.0"
|
num_cpus = "1.16.0"
|
||||||
opentelemetry = { version = "0.18.0", features = ["rt-tokio"] }
|
opentelemetry = "0.23.0"
|
||||||
opentelemetry-jaeger = { version = "0.17.0", features = ["rt-tokio"] }
|
opentelemetry-jaeger-propagator = "0.2.0"
|
||||||
parking_lot = { version = "0.12.1", optional = true }
|
opentelemetry-otlp = "0.16.0"
|
||||||
|
opentelemetry_sdk = { version = "0.23.0", features = ["rt-tokio"] }
|
||||||
|
parking_lot = { version = "0.12.3", optional = true }
|
||||||
phf = { version = "0.11.2", features = ["macros"] }
|
phf = { version = "0.11.2", features = ["macros"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
regex = "1.8.1"
|
regex = "1.10.4"
|
||||||
reqwest = { version = "0.11.18", default-features = false, features = ["rustls-tls-native-roots", "socks"] }
|
reqwest = { version = "0.12.4", default-features = false, features = ["http2", "rustls-tls-native-roots", "socks"] }
|
||||||
ring = "0.17.7"
|
ring = "0.17.8"
|
||||||
rocksdb = { package = "rust-rocksdb", version = "0.26.0", features = ["lz4", "multi-threaded-cf", "zstd"], optional = true }
|
rocksdb = { package = "rust-rocksdb", version = "0.26.0", features = ["lz4", "multi-threaded-cf", "zstd"], optional = true }
|
||||||
ruma = { git = "https://github.com/ruma/ruma", rev = "5495b85aa311c2805302edb0a7de40399e22b397", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
ruma = { git = "https://github.com/ruma/ruma", branch = "main", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
||||||
rusqlite = { version = "0.29.0", optional = true, features = ["bundled"] }
|
rusqlite = { version = "0.31.0", optional = true, features = ["bundled"] }
|
||||||
rust-argon2 = "1.0.0"
|
rust-argon2 = "2.1.0"
|
||||||
sd-notify = { version = "0.4.1", optional = true }
|
sd-notify = { version = "0.4.1", optional = true }
|
||||||
serde = { version = "1.0.163", features = ["rc"] }
|
serde = { version = "1.0.202", features = ["rc"] }
|
||||||
serde_html_form = "0.2.0"
|
serde_html_form = "0.2.6"
|
||||||
serde_json = { version = "1.0.96", features = ["raw_value"] }
|
serde_json = { version = "1.0.117", features = ["raw_value"] }
|
||||||
serde_yaml = "0.9.21"
|
serde_yaml = "0.9.34"
|
||||||
sha-1 = "0.10.1"
|
sha-1 = "0.10.1"
|
||||||
thiserror = "1.0.40"
|
thiserror = "1.0.61"
|
||||||
thread_local = "1.1.7"
|
thread_local = "1.1.8"
|
||||||
tikv-jemallocator = { version = "0.5.0", features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
|
tikv-jemallocator = { version = "0.5.4", features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
|
||||||
tokio = { version = "1.28.1", features = ["fs", "macros", "signal", "sync"] }
|
tokio = { version = "1.37.0", features = ["fs", "macros", "signal", "sync"] }
|
||||||
tower = { version = "0.4.13", features = ["util"] }
|
tower = { version = "0.4.13", features = ["util"] }
|
||||||
tower-http = { version = "0.4.1", features = ["add-extension", "cors", "sensitive-headers", "trace", "util"] }
|
tower-http = { version = "0.5.2", features = ["add-extension", "cors", "sensitive-headers", "trace", "util"] }
|
||||||
tracing = { version = "0.1.37", features = [] }
|
tracing = { version = "0.1.40", features = [] }
|
||||||
tracing-flame = "0.2.0"
|
tracing-flame = "0.2.0"
|
||||||
tracing-opentelemetry = "0.18.0"
|
tracing-opentelemetry = { git = "https://github.com/tokio-rs/tracing-opentelemetry", branch = "v0.1.x" }
|
||||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||||
trust-dns-resolver = "0.22.0"
|
trust-dns-resolver = "0.23.2"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
nix = { version = "0.28", features = ["resource"] }
|
nix = { version = "0.29", features = ["resource"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rocksdb", "sqlite", "systemd"]
|
default = ["rocksdb", "sqlite", "systemd"]
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ pub(crate) async fn register_route(
|
||||||
&& body.appservice_info.is_none()
|
&& body.appservice_info.is_none()
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Registration has been disabled.",
|
"Registration has been disabled.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ pub(crate) async fn get_context_route(
|
||||||
&body.event_id,
|
&body.event_id,
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this event.",
|
"You don't have permission to view this event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ pub(crate) async fn get_member_events_route(
|
||||||
.user_can_see_state_events(sender_user, &body.room_id)?
|
.user_can_see_state_events(sender_user, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this room.",
|
"You don't have permission to view this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -485,7 +485,7 @@ pub(crate) async fn joined_members_route(
|
||||||
.user_can_see_state_events(sender_user, &body.room_id)?
|
.user_can_see_state_events(sender_user, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this room.",
|
"You don't have permission to view this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1399,7 +1399,7 @@ pub(crate) async fn invite_helper(
|
||||||
|
|
||||||
if !services().rooms.state_cache.is_joined(sender_user, room_id)? {
|
if !services().rooms.state_cache.is_joined(sender_user, room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this room.",
|
"You don't have permission to view this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ pub(crate) async fn send_message_event_route(
|
||||||
&& !services().globals.allow_encryption()
|
&& !services().globals.allow_encryption()
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Encryption has been disabled",
|
"Encryption has been disabled",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ pub(crate) async fn get_relating_events_with_rel_type_and_event_type_route(
|
||||||
chunk: res.chunk,
|
chunk: res.chunk,
|
||||||
next_batch: res.next_batch,
|
next_batch: res.next_batch,
|
||||||
prev_batch: res.prev_batch,
|
prev_batch: res.prev_batch,
|
||||||
|
// TODO
|
||||||
|
recursion_depth: None,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,6 +94,8 @@ pub(crate) async fn get_relating_events_with_rel_type_route(
|
||||||
chunk: res.chunk,
|
chunk: res.chunk,
|
||||||
next_batch: res.next_batch,
|
next_batch: res.next_batch,
|
||||||
prev_batch: res.prev_batch,
|
prev_batch: res.prev_batch,
|
||||||
|
// TODO
|
||||||
|
recursion_depth: None,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ pub(crate) async fn create_room_route(
|
||||||
&& !services().users.is_admin(sender_user)?
|
&& !services().users.is_admin(sender_user)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Room creation has been disabled.",
|
"Room creation has been disabled.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -565,7 +565,7 @@ pub(crate) async fn get_room_event_route(
|
||||||
&body.event_id,
|
&body.event_id,
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this event.",
|
"You don't have permission to view this event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -591,7 +591,7 @@ pub(crate) async fn get_room_aliases_route(
|
||||||
|
|
||||||
if !services().rooms.state_cache.is_joined(sender_user, &body.room_id)? {
|
if !services().rooms.state_cache.is_joined(sender_user, &body.room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this room.",
|
"You don't have permission to view this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ pub(crate) async fn search_events_route(
|
||||||
for room_id in room_ids {
|
for room_id in room_ids {
|
||||||
if !services().rooms.state_cache.is_joined(sender_user, &room_id)? {
|
if !services().rooms.state_cache.is_joined(sender_user, &room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view this room.",
|
"You don't have permission to view this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ pub(crate) async fn login_route(
|
||||||
} else {
|
} else {
|
||||||
warn!("Bad login type: {:?}", &body.login_info);
|
warn!("Bad login type: {:?}", &body.login_info);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Bad login type.",
|
"Bad login type.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ pub(crate) async fn login_route(
|
||||||
|
|
||||||
let hash = services().users.password_hash(&user_id)?.ok_or(
|
let hash = services().users.password_hash(&user_id)?.ok_or(
|
||||||
Error::BadRequest(
|
Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Wrong username or password.",
|
"Wrong username or password.",
|
||||||
),
|
),
|
||||||
)?;
|
)?;
|
||||||
|
|
@ -119,7 +119,7 @@ pub(crate) async fn login_route(
|
||||||
|
|
||||||
if !hash_matches {
|
if !hash_matches {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Wrong username or password.",
|
"Wrong username or password.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ pub(crate) async fn login_route(
|
||||||
} else {
|
} else {
|
||||||
warn!("Bad login type: {:?}", &body.login_info);
|
warn!("Bad login type: {:?}", &body.login_info);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Bad login type.",
|
"Bad login type.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ pub(crate) async fn send_state_event_for_empty_key_route(
|
||||||
&& !services().globals.allow_encryption()
|
&& !services().globals.allow_encryption()
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Encryption has been disabled",
|
"Encryption has been disabled",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ pub(crate) async fn get_state_events_route(
|
||||||
.user_can_see_state_events(sender_user, &body.room_id)?
|
.user_can_see_state_events(sender_user, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view the room state.",
|
"You don't have permission to view the room state.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ pub(crate) async fn get_state_events_for_key_route(
|
||||||
.user_can_see_state_events(sender_user, &body.room_id)?
|
.user_can_see_state_events(sender_user, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view the room state.",
|
"You don't have permission to view the room state.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -176,7 +176,7 @@ pub(crate) async fn get_state_events_for_empty_key_route(
|
||||||
.user_can_see_state_events(sender_user, &body.room_id)?
|
.user_can_see_state_events(sender_user, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You don't have permission to view the room state.",
|
"You don't have permission to view the room state.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +232,7 @@ async fn send_state_event_for_key_helper(
|
||||||
.is_none()
|
.is_none()
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You are only allowed to send canonical_alias events when \
|
"You are only allowed to send canonical_alias events when \
|
||||||
it's aliases already exists",
|
it's aliases already exists",
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,9 @@ async fn load_joined_room(
|
||||||
.state_cache
|
.state_cache
|
||||||
.is_invited(&user_id, room_id)?)
|
.is_invited(&user_id, room_id)?)
|
||||||
{
|
{
|
||||||
Ok::<_, Error>(Some(state_key.clone()))
|
Ok::<_, Error>(Some(state_key.parse().expect(
|
||||||
|
"`state_key` should be a valid user ID",
|
||||||
|
)))
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
@ -1686,6 +1688,8 @@ pub(crate) async fn sync_events_v4_route(
|
||||||
// Count events in timeline greater than global sync counter
|
// Count events in timeline greater than global sync counter
|
||||||
num_live: None,
|
num_live: None,
|
||||||
timestamp: None,
|
timestamp: None,
|
||||||
|
// TODO
|
||||||
|
heroes: None,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub(crate) async fn create_typing_event_route(
|
||||||
|
|
||||||
if !services().rooms.state_cache.is_joined(sender_user, &body.room_id)? {
|
if !services().rooms.state_cache.is_joined(sender_user, &body.room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"You are not in this room.",
|
"You are not in this room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,22 @@ use std::{collections::BTreeMap, iter::FromIterator, str};
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
async_trait,
|
async_trait,
|
||||||
body::{Full, HttpBody},
|
body::Body,
|
||||||
extract::{
|
extract::{FromRequest, Path},
|
||||||
rejection::TypedHeaderRejectionReason, FromRequest, Path, TypedHeader,
|
response::{IntoResponse, Response},
|
||||||
},
|
RequestExt, RequestPartsExt,
|
||||||
|
};
|
||||||
|
use axum_extra::{
|
||||||
headers::{
|
headers::{
|
||||||
authorization::{Bearer, Credentials},
|
authorization::{Bearer, Credentials},
|
||||||
Authorization,
|
Authorization,
|
||||||
},
|
},
|
||||||
response::{IntoResponse, Response},
|
typed_header::TypedHeaderRejectionReason,
|
||||||
BoxError, RequestExt, RequestPartsExt,
|
TypedHeader,
|
||||||
};
|
};
|
||||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use http::{Request, StatusCode};
|
use http::{Request, StatusCode};
|
||||||
|
use http_body_util::BodyExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::{
|
api::{
|
||||||
client::error::ErrorKind, AuthScheme, IncomingRequest, OutgoingResponse,
|
client::error::ErrorKind, AuthScheme, IncomingRequest, OutgoingResponse,
|
||||||
|
|
@ -35,18 +38,15 @@ enum Token {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<T, S, B> FromRequest<S, B> for Ar<T>
|
impl<T, S> FromRequest<S> for Ar<T>
|
||||||
where
|
where
|
||||||
T: IncomingRequest,
|
T: IncomingRequest,
|
||||||
B: HttpBody + Send + 'static,
|
|
||||||
B::Data: Send,
|
|
||||||
B::Error: Into<BoxError>,
|
|
||||||
{
|
{
|
||||||
type Rejection = Error;
|
type Rejection = Error;
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
async fn from_request(
|
async fn from_request(
|
||||||
req: Request<B>,
|
req: axum::extract::Request,
|
||||||
_state: &S,
|
_state: &S,
|
||||||
) -> Result<Self, Self::Rejection> {
|
) -> Result<Self, Self::Rejection> {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
@ -55,21 +55,17 @@ where
|
||||||
user_id: Option<String>,
|
user_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
let (mut parts, mut body) = match req.with_limited_body() {
|
let (mut parts, mut body) = {
|
||||||
Ok(limited_req) => {
|
let limited_req = req.with_limited_body();
|
||||||
let (parts, body) = limited_req.into_parts();
|
let (parts, body) = limited_req.into_parts();
|
||||||
let body = to_bytes(body).await.map_err(|_| {
|
let body = body
|
||||||
|
.collect()
|
||||||
|
.await
|
||||||
|
.map_err(|_| {
|
||||||
Error::BadRequest(ErrorKind::MissingToken, "Missing token.")
|
Error::BadRequest(ErrorKind::MissingToken, "Missing token.")
|
||||||
})?;
|
})?
|
||||||
(parts, body)
|
.to_bytes();
|
||||||
}
|
(parts, body)
|
||||||
Err(original_req) => {
|
|
||||||
let (parts, body) = original_req.into_parts();
|
|
||||||
let body = to_bytes(body).await.map_err(|_| {
|
|
||||||
Error::BadRequest(ErrorKind::MissingToken, "Missing token.")
|
|
||||||
})?;
|
|
||||||
(parts, body)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let metadata = T::METADATA;
|
let metadata = T::METADATA;
|
||||||
|
|
@ -151,7 +147,7 @@ where
|
||||||
|
|
||||||
if !services().users.exists(&user_id)? {
|
if !services().users.exists(&user_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"User does not exist.",
|
"User does not exist.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +192,7 @@ where
|
||||||
_ => "Unknown header-related error",
|
_ => "Unknown header-related error",
|
||||||
};
|
};
|
||||||
|
|
||||||
Error::BadRequest(ErrorKind::Forbidden, msg)
|
Error::BadRequest(ErrorKind::forbidden(), msg)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let origin_signatures = BTreeMap::from_iter([(
|
let origin_signatures = BTreeMap::from_iter([(
|
||||||
|
|
@ -261,7 +257,7 @@ where
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("Failed to fetch signing keys: {}", e);
|
warn!("Failed to fetch signing keys: {}", e);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Failed to fetch signing keys.",
|
"Failed to fetch signing keys.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -294,7 +290,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Failed to verify X-Matrix signatures.",
|
"Failed to verify X-Matrix signatures.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -453,62 +449,10 @@ impl Credentials for XMatrix {
|
||||||
impl<T: OutgoingResponse> IntoResponse for Ra<T> {
|
impl<T: OutgoingResponse> IntoResponse for Ra<T> {
|
||||||
fn into_response(self) -> Response {
|
fn into_response(self) -> Response {
|
||||||
match self.0.try_into_http_response::<BytesMut>() {
|
match self.0.try_into_http_response::<BytesMut>() {
|
||||||
Ok(res) => res.map(BytesMut::freeze).map(Full::new).into_response(),
|
Ok(res) => {
|
||||||
|
res.map(BytesMut::freeze).map(Body::from).into_response()
|
||||||
|
}
|
||||||
Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
Err(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copied from hyper under the following license:
|
|
||||||
// Copyright (c) 2014-2021 Sean McArthur
|
|
||||||
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
|
||||||
// in the Software without restriction, including without limitation the rights
|
|
||||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
// copies of the Software, and to permit persons to whom the Software is
|
|
||||||
// furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
// THE SOFTWARE.
|
|
||||||
pub(crate) async fn to_bytes<T>(body: T) -> Result<Bytes, T::Error>
|
|
||||||
where
|
|
||||||
T: HttpBody,
|
|
||||||
{
|
|
||||||
futures_util::pin_mut!(body);
|
|
||||||
|
|
||||||
// If there's only 1 chunk, we can just return Buf::to_bytes()
|
|
||||||
let mut first = if let Some(buf) = body.data().await {
|
|
||||||
buf?
|
|
||||||
} else {
|
|
||||||
return Ok(Bytes::new());
|
|
||||||
};
|
|
||||||
|
|
||||||
let second = if let Some(buf) = body.data().await {
|
|
||||||
buf?
|
|
||||||
} else {
|
|
||||||
return Ok(first.copy_to_bytes(first.remaining()));
|
|
||||||
};
|
|
||||||
|
|
||||||
// With more than 1 buf, we gotta flatten into a Vec first.
|
|
||||||
let cap = first.remaining()
|
|
||||||
+ second.remaining()
|
|
||||||
+ body.size_hint().lower().try_into().unwrap_or(usize::MAX);
|
|
||||||
let mut vec = Vec::with_capacity(cap);
|
|
||||||
vec.put(first);
|
|
||||||
vec.put(second);
|
|
||||||
|
|
||||||
while let Some(buf) = body.data().await {
|
|
||||||
vec.put(buf?);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(vec.into())
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1023,7 +1023,7 @@ pub(crate) async fn get_event_route(
|
||||||
.server_in_room(sender_servername, room_id)?
|
.server_in_room(sender_servername, room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room",
|
"Server is not in room",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1034,7 +1034,7 @@ pub(crate) async fn get_event_route(
|
||||||
&body.event_id,
|
&body.event_id,
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not allowed to see event.",
|
"Server is not allowed to see event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1064,7 +1064,7 @@ pub(crate) async fn get_backfill_route(
|
||||||
.server_in_room(sender_servername, &body.room_id)?
|
.server_in_room(sender_servername, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room.",
|
"Server is not in room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1132,7 +1132,7 @@ pub(crate) async fn get_missing_events_route(
|
||||||
.server_in_room(sender_servername, &body.room_id)?
|
.server_in_room(sender_servername, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room",
|
"Server is not in room",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1234,7 +1234,7 @@ pub(crate) async fn get_event_authorization_route(
|
||||||
.server_in_room(sender_servername, &body.room_id)?
|
.server_in_room(sender_servername, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room.",
|
"Server is not in room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1292,7 +1292,7 @@ pub(crate) async fn get_room_state_route(
|
||||||
.server_in_room(sender_servername, &body.room_id)?
|
.server_in_room(sender_servername, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room.",
|
"Server is not in room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1362,7 +1362,7 @@ pub(crate) async fn get_room_state_ids_route(
|
||||||
.server_in_room(sender_servername, &body.room_id)?
|
.server_in_room(sender_servername, &body.room_id)?
|
||||||
{
|
{
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server is not in room.",
|
"Server is not in room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ impl service::uiaa::Data for KeyValueDatabase {
|
||||||
.userdevicesessionid_uiaainfo
|
.userdevicesessionid_uiaainfo
|
||||||
.get(&userdevicesessionid)?
|
.get(&userdevicesessionid)?
|
||||||
.ok_or(Error::BadRequest(
|
.ok_or(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"UIAA session does not exist.",
|
"UIAA session does not exist.",
|
||||||
))?,
|
))?,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
32
src/main.rs
32
src/main.rs
|
|
@ -24,6 +24,8 @@ use http::{
|
||||||
header::{self, HeaderName},
|
header::{self, HeaderName},
|
||||||
Method, StatusCode, Uri,
|
Method, StatusCode, Uri,
|
||||||
};
|
};
|
||||||
|
use opentelemetry::KeyValue;
|
||||||
|
use opentelemetry_sdk::Resource;
|
||||||
use ruma::api::{
|
use ruma::api::{
|
||||||
client::{
|
client::{
|
||||||
error::{Error as RumaError, ErrorBody, ErrorKind},
|
error::{Error as RumaError, ErrorBody, ErrorKind},
|
||||||
|
|
@ -127,12 +129,20 @@ async fn try_main() -> Result<(), error::Main> {
|
||||||
|
|
||||||
if config.allow_jaeger {
|
if config.allow_jaeger {
|
||||||
opentelemetry::global::set_text_map_propagator(
|
opentelemetry::global::set_text_map_propagator(
|
||||||
opentelemetry_jaeger::Propagator::new(),
|
opentelemetry_jaeger_propagator::Propagator::new(),
|
||||||
);
|
);
|
||||||
let tracer = opentelemetry_jaeger::new_agent_pipeline()
|
let tracer = opentelemetry_otlp::new_pipeline()
|
||||||
.with_auto_split_batch(true)
|
.tracing()
|
||||||
.with_service_name("grapevine")
|
.with_trace_config(
|
||||||
.install_batch(opentelemetry::runtime::Tokio)?;
|
opentelemetry_sdk::trace::config().with_resource(
|
||||||
|
Resource::new(vec![KeyValue::new(
|
||||||
|
"service.name",
|
||||||
|
env!("CARGO_PKG_NAME"),
|
||||||
|
)]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
|
||||||
|
.install_batch(opentelemetry_sdk::runtime::Tokio)?;
|
||||||
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
|
||||||
|
|
||||||
let filter_layer = EnvFilter::try_new(&config.log)?;
|
let filter_layer = EnvFilter::try_new(&config.log)?;
|
||||||
|
|
@ -271,9 +281,9 @@ async fn run_server() -> io::Result<()> {
|
||||||
///
|
///
|
||||||
/// The axum request handler task gets cancelled if the connection is shut down;
|
/// The axum request handler task gets cancelled if the connection is shut down;
|
||||||
/// by spawning our own task, processing continue after the client disconnects.
|
/// by spawning our own task, processing continue after the client disconnects.
|
||||||
async fn spawn_task<B: Send + 'static>(
|
async fn spawn_task(
|
||||||
req: http::Request<B>,
|
req: axum::extract::Request,
|
||||||
next: axum::middleware::Next<B>,
|
next: axum::middleware::Next,
|
||||||
) -> std::result::Result<axum::response::Response, StatusCode> {
|
) -> std::result::Result<axum::response::Response, StatusCode> {
|
||||||
if services().globals.shutdown.load(atomic::Ordering::Relaxed) {
|
if services().globals.shutdown.load(atomic::Ordering::Relaxed) {
|
||||||
return Err(StatusCode::SERVICE_UNAVAILABLE);
|
return Err(StatusCode::SERVICE_UNAVAILABLE);
|
||||||
|
|
@ -283,9 +293,9 @@ async fn spawn_task<B: Send + 'static>(
|
||||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn unrecognized_method<B: Send>(
|
async fn unrecognized_method(
|
||||||
req: http::Request<B>,
|
req: axum::extract::Request,
|
||||||
next: axum::middleware::Next<B>,
|
next: axum::middleware::Next,
|
||||||
) -> std::result::Result<axum::response::Response, StatusCode> {
|
) -> std::result::Result<axum::response::Response, StatusCode> {
|
||||||
let method = req.method().clone();
|
let method = req.method().clone();
|
||||||
let uri = req.uri().clone();
|
let uri = req.uri().clone();
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@ use std::{
|
||||||
use base64::{engine::general_purpose, Engine as _};
|
use base64::{engine::general_purpose, Engine as _};
|
||||||
pub(crate) use data::Data;
|
pub(crate) use data::Data;
|
||||||
use futures_util::FutureExt;
|
use futures_util::FutureExt;
|
||||||
use hyper::{
|
use hyper::service::Service as _;
|
||||||
client::connect::dns::{GaiResolver, Name},
|
use hyper_util::{
|
||||||
service::Service as HyperService,
|
client::legacy::connect::dns::GaiResolver, service::TowerToHyperService,
|
||||||
};
|
};
|
||||||
use reqwest::dns::{Addrs, Resolve, Resolving};
|
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::federation::discovery::{ServerSigningKeys, VerifyKey},
|
api::federation::discovery::{ServerSigningKeys, VerifyKey},
|
||||||
serde::Base64,
|
serde::Base64,
|
||||||
|
|
@ -147,9 +147,13 @@ impl Resolve for Resolver {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
let this = &mut self.inner.clone();
|
// This should never fail because reqwest's type is a wrapper
|
||||||
|
// around hyper-utils' type
|
||||||
|
let name = name.as_str().parse().expect("name should be valid");
|
||||||
|
|
||||||
Box::pin(
|
Box::pin(
|
||||||
HyperService::<Name>::call(this, name)
|
TowerToHyperService::new(self.inner.clone())
|
||||||
|
.call(name)
|
||||||
.map(|result| {
|
.map(|result| {
|
||||||
result
|
result
|
||||||
.map(|addrs| -> Addrs { Box::new(addrs) })
|
.map(|addrs| -> Addrs { Box::new(addrs) })
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ impl Service {
|
||||||
let mut thumbnail_bytes = Vec::new();
|
let mut thumbnail_bytes = Vec::new();
|
||||||
thumbnail.write_to(
|
thumbnail.write_to(
|
||||||
&mut Cursor::new(&mut thumbnail_bytes),
|
&mut Cursor::new(&mut thumbnail_bytes),
|
||||||
image::ImageOutputFormat::Png,
|
image::ImageFormat::Png,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Save thumbnail in database so we don't have to generate it
|
// Save thumbnail in database so we don't have to generate it
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ impl Service {
|
||||||
Ok(Some(pdu)) => {
|
Ok(Some(pdu)) => {
|
||||||
if pdu.room_id != room_id {
|
if pdu.room_id != room_id {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Evil event in db",
|
"Evil event in db",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ impl Service {
|
||||||
|
|
||||||
if services().rooms.metadata.is_disabled(room_id)? {
|
if services().rooms.metadata.is_disabled(room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Federation of this room is currently disabled on this server.",
|
"Federation of this room is currently disabled on this server.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ impl Service {
|
||||||
// Check for disabled again because it might have changed
|
// Check for disabled again because it might have changed
|
||||||
if services().rooms.metadata.is_disabled(room_id)? {
|
if services().rooms.metadata.is_disabled(room_id)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Federation of this room is currently disabled on this \
|
"Federation of this room is currently disabled on this \
|
||||||
server.",
|
server.",
|
||||||
));
|
));
|
||||||
|
|
@ -1836,7 +1836,7 @@ impl Service {
|
||||||
server_name, room_id
|
server_name, room_id
|
||||||
);
|
);
|
||||||
Err(Error::BadRequest(
|
Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Server was denied by room ACL",
|
"Server was denied by room ACL",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,8 @@ impl Service {
|
||||||
chunk: events_after,
|
chunk: events_after,
|
||||||
next_batch: next_token.map(|t| t.stringify()),
|
next_batch: next_token.map(|t| t.stringify()),
|
||||||
prev_batch: Some(from.stringify()),
|
prev_batch: Some(from.stringify()),
|
||||||
|
// TODO
|
||||||
|
recursion_depth: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ruma::api::Direction::Backward => {
|
ruma::api::Direction::Backward => {
|
||||||
|
|
@ -174,6 +176,8 @@ impl Service {
|
||||||
chunk: events_before,
|
chunk: events_before,
|
||||||
next_batch: next_token.map(|t| t.stringify()),
|
next_batch: next_token.map(|t| t.stringify()),
|
||||||
prev_batch: Some(from.stringify()),
|
prev_batch: Some(from.stringify()),
|
||||||
|
// TODO
|
||||||
|
recursion_depth: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ impl Service {
|
||||||
debug!("User is not allowed to see room {room_id}");
|
debug!("User is not allowed to see room {room_id}");
|
||||||
// This error will be caught later
|
// This error will be caught later
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"User is not allowed to see the room",
|
"User is not allowed to see the room",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -794,7 +794,7 @@ impl Service {
|
||||||
|
|
||||||
if !auth_check {
|
if !auth_check {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Event is not authorized.",
|
"Event is not authorized.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -878,7 +878,7 @@ impl Service {
|
||||||
TimelineEventType::RoomEncryption => {
|
TimelineEventType::RoomEncryption => {
|
||||||
warn!("Encryption is not allowed in the admins room");
|
warn!("Encryption is not allowed in the admins room");
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Encryption is not allowed in the admins room.",
|
"Encryption is not allowed in the admins room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -916,7 +916,7 @@ impl Service {
|
||||||
room"
|
room"
|
||||||
);
|
);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Grapevine user cannot leave from admins \
|
"Grapevine user cannot leave from admins \
|
||||||
room.",
|
room.",
|
||||||
));
|
));
|
||||||
|
|
@ -935,7 +935,7 @@ impl Service {
|
||||||
"Last admin cannot leave from admins room"
|
"Last admin cannot leave from admins room"
|
||||||
);
|
);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Last admin cannot leave from admins room.",
|
"Last admin cannot leave from admins room.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -950,7 +950,7 @@ impl Service {
|
||||||
admins room"
|
admins room"
|
||||||
);
|
);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Grapevine user cannot be banned in \
|
"Grapevine user cannot be banned in \
|
||||||
admins room.",
|
admins room.",
|
||||||
));
|
));
|
||||||
|
|
@ -970,7 +970,7 @@ impl Service {
|
||||||
room"
|
room"
|
||||||
);
|
);
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"Last admin cannot be banned in admins \
|
"Last admin cannot be banned in admins \
|
||||||
room.",
|
room.",
|
||||||
));
|
));
|
||||||
|
|
@ -1004,7 +1004,7 @@ impl Service {
|
||||||
false,
|
false,
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"User cannot redact this event.",
|
"User cannot redact this event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -1026,7 +1026,7 @@ impl Service {
|
||||||
false,
|
false,
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::Forbidden,
|
ErrorKind::forbidden(),
|
||||||
"User cannot redact this event.",
|
"User cannot redact this event.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ impl Service {
|
||||||
if !hash_matches {
|
if !hash_matches {
|
||||||
uiaainfo.auth_error =
|
uiaainfo.auth_error =
|
||||||
Some(ruma::api::client::error::StandardErrorBody {
|
Some(ruma::api::client::error::StandardErrorBody {
|
||||||
kind: ErrorKind::Forbidden,
|
kind: ErrorKind::forbidden(),
|
||||||
message: "Invalid username or password."
|
message: "Invalid username or password."
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
});
|
});
|
||||||
|
|
@ -113,7 +113,7 @@ impl Service {
|
||||||
} else {
|
} else {
|
||||||
uiaainfo.auth_error =
|
uiaainfo.auth_error =
|
||||||
Some(ruma::api::client::error::StandardErrorBody {
|
Some(ruma::api::client::error::StandardErrorBody {
|
||||||
kind: ErrorKind::Forbidden,
|
kind: ErrorKind::forbidden(),
|
||||||
message: "Invalid registration token.".to_owned(),
|
message: "Invalid registration token.".to_owned(),
|
||||||
});
|
});
|
||||||
return Ok((false, uiaainfo));
|
return Ok((false, uiaainfo));
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,9 @@ impl Error {
|
||||||
WrongRoomKeysVersion {
|
WrongRoomKeysVersion {
|
||||||
..
|
..
|
||||||
}
|
}
|
||||||
| Forbidden
|
| Forbidden {
|
||||||
|
..
|
||||||
|
}
|
||||||
| GuestAccessForbidden
|
| GuestAccessForbidden
|
||||||
| ThreepidAuthFailed
|
| ThreepidAuthFailed
|
||||||
| UserDeactivated
|
| UserDeactivated
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue