mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-03-14 18:55:37 +00:00
run nightly cargo fmt again
Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
parent
17e0384eeb
commit
de53ad83b2
11 changed files with 45 additions and 28 deletions
|
@ -66,10 +66,11 @@ pub(super) async fn reprocess(
|
|||
format!("#{}:{}", room_alias_localpart, services.globals.server_name());
|
||||
let room_alias = match OwnedRoomAliasId::parse(room_alias_str) {
|
||||
| Ok(alias) => alias,
|
||||
| Err(err) =>
|
||||
| Err(err) => {
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Failed to parse alias: {err}"
|
||||
))),
|
||||
)));
|
||||
},
|
||||
};
|
||||
match command {
|
||||
| RoomAliasCommand::Set { force, room_id, .. } => {
|
||||
|
|
|
@ -96,12 +96,13 @@ async fn ban_room(
|
|||
let room_id = if room.is_room_id() {
|
||||
let room_id = match RoomId::parse(&room) {
|
||||
| Ok(room_id) => room_id,
|
||||
| Err(e) =>
|
||||
| Err(e) => {
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||
(`#roomalias:example.com`): {e}"
|
||||
))),
|
||||
)));
|
||||
},
|
||||
};
|
||||
|
||||
debug!("Room specified is a room ID, banning room ID");
|
||||
|
@ -111,12 +112,13 @@ async fn ban_room(
|
|||
} else if room.is_room_alias_id() {
|
||||
let room_alias = match RoomAliasId::parse(&room) {
|
||||
| Ok(room_alias) => room_alias,
|
||||
| Err(e) =>
|
||||
| Err(e) => {
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||
(`#roomalias:example.com`): {e}"
|
||||
))),
|
||||
)));
|
||||
},
|
||||
};
|
||||
|
||||
debug!(
|
||||
|
@ -514,12 +516,13 @@ async fn unban_room(
|
|||
let room_id = if room.is_room_id() {
|
||||
let room_id = match RoomId::parse(&room) {
|
||||
| Ok(room_id) => room_id,
|
||||
| Err(e) =>
|
||||
| Err(e) => {
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||
(`#roomalias:example.com`): {e}"
|
||||
))),
|
||||
)));
|
||||
},
|
||||
};
|
||||
|
||||
debug!("Room specified is a room ID, unbanning room ID");
|
||||
|
@ -529,12 +532,13 @@ async fn unban_room(
|
|||
} else if room.is_room_alias_id() {
|
||||
let room_alias = match RoomAliasId::parse(&room) {
|
||||
| Ok(room_alias) => room_alias,
|
||||
| Err(e) =>
|
||||
| Err(e) => {
|
||||
return Ok(RoomMessageEventContent::text_plain(format!(
|
||||
"Failed to parse room ID {room}. Please note that this requires a full room \
|
||||
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
|
||||
(`#roomalias:example.com`): {e}"
|
||||
))),
|
||||
)));
|
||||
},
|
||||
};
|
||||
|
||||
debug!(
|
||||
|
|
|
@ -267,8 +267,9 @@ pub(crate) async fn get_public_rooms_filtered_helper(
|
|||
let backwards = match characters.next() {
|
||||
| Some('n') => false,
|
||||
| Some('p') => true,
|
||||
| _ =>
|
||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Invalid `since` token")),
|
||||
| _ => {
|
||||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Invalid `since` token"));
|
||||
},
|
||||
};
|
||||
|
||||
num_since = characters
|
||||
|
|
|
@ -197,11 +197,12 @@ pub(crate) async fn create_receipt_route(
|
|||
.read_receipt
|
||||
.private_read_set(&body.room_id, sender_user, count);
|
||||
},
|
||||
| _ =>
|
||||
| _ => {
|
||||
return Err!(Request(InvalidParam(warn!(
|
||||
"Received unknown read receipt type: {}",
|
||||
&body.receipt_type
|
||||
)))),
|
||||
))));
|
||||
},
|
||||
}
|
||||
|
||||
Ok(create_receipt::v3::Response {})
|
||||
|
|
|
@ -32,8 +32,9 @@ pub(crate) async fn get_hierarchy_route(
|
|||
{
|
||||
| None => Err!(Request(NotFound("The requested room was not found"))),
|
||||
|
||||
| Some(SummaryAccessibility::Inaccessible) =>
|
||||
Err!(Request(NotFound("The requested room is inaccessible"))),
|
||||
| Some(SummaryAccessibility::Inaccessible) => {
|
||||
Err!(Request(NotFound("The requested room is inaccessible")))
|
||||
},
|
||||
|
||||
| Some(SummaryAccessibility::Accessible(room)) => {
|
||||
let (children, inaccessible_children) =
|
||||
|
|
|
@ -682,7 +682,7 @@ fn valid_membership_change(
|
|||
}
|
||||
allow
|
||||
},
|
||||
| _ =>
|
||||
| _ => {
|
||||
if !sender_is_joined
|
||||
|| target_user_current_membership == MembershipState::Join
|
||||
|| target_user_current_membership == MembershipState::Ban
|
||||
|
@ -706,7 +706,8 @@ fn valid_membership_change(
|
|||
);
|
||||
}
|
||||
allow
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
| MembershipState::Leave =>
|
||||
|
|
|
@ -61,8 +61,12 @@ pub(crate) fn build(services: &Arc<Services>) -> Result<(Router, Guard)> {
|
|||
)
|
||||
.layer(axum::middleware::from_fn_with_state(Arc::clone(services), request::handle))
|
||||
.layer(SecureClientIpSource::ConnectInfo.into_extension())
|
||||
.layer(ResponseBodyTimeoutLayer::new(Duration::from_secs(server.config.client_response_timeout)))
|
||||
.layer(RequestBodyTimeoutLayer::new(Duration::from_secs(server.config.client_receive_timeout)))
|
||||
.layer(ResponseBodyTimeoutLayer::new(Duration::from_secs(
|
||||
server.config.client_response_timeout,
|
||||
)))
|
||||
.layer(RequestBodyTimeoutLayer::new(Duration::from_secs(
|
||||
server.config.client_receive_timeout,
|
||||
)))
|
||||
.layer(TimeoutLayer::new(Duration::from_secs(server.config.client_request_timeout)))
|
||||
.layer(SetResponseHeaderLayer::if_not_present(
|
||||
HeaderName::from_static("origin-agent-cluster"), // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster
|
||||
|
|
|
@ -58,10 +58,11 @@ pub(super) async fn fetch_state(
|
|||
| hash_map::Entry::Vacant(v) => {
|
||||
v.insert(pdu.event_id.clone());
|
||||
},
|
||||
| hash_map::Entry::Occupied(_) =>
|
||||
| hash_map::Entry::Occupied(_) => {
|
||||
return Err!(Database(
|
||||
"State event's type and state_key combination exists multiple times.",
|
||||
)),
|
||||
));
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,11 @@ pub(super) async fn handle_outlier_pdu<'a>(
|
|||
|
||||
obj
|
||||
},
|
||||
| Err(e) =>
|
||||
| Err(e) => {
|
||||
return Err!(Request(InvalidParam(debug_error!(
|
||||
"Signature verification failed for {event_id}: {e}"
|
||||
)))),
|
||||
))));
|
||||
},
|
||||
};
|
||||
|
||||
// Now that we have checked the signature and hashes we can add the eventID and
|
||||
|
|
|
@ -109,7 +109,7 @@ pub async fn get_summary_and_children_local(
|
|||
{
|
||||
| None => (), // cache miss
|
||||
| Some(None) => return Ok(None),
|
||||
| Some(Some(cached)) =>
|
||||
| Some(Some(cached)) => {
|
||||
return Ok(Some(
|
||||
if self
|
||||
.is_accessible_child(
|
||||
|
@ -124,7 +124,8 @@ pub async fn get_summary_and_children_local(
|
|||
} else {
|
||||
SummaryAccessibility::Inaccessible
|
||||
},
|
||||
)),
|
||||
));
|
||||
},
|
||||
}
|
||||
|
||||
let children_pdus: Vec<_> = self
|
||||
|
|
|
@ -18,8 +18,9 @@ pub async fn get_event_keys(
|
|||
|
||||
let required = match required_keys(object, version) {
|
||||
| Ok(required) => required,
|
||||
| Err(e) =>
|
||||
return Err!(BadServerResponse("Failed to determine keys required to verify: {e}")),
|
||||
| Err(e) => {
|
||||
return Err!(BadServerResponse("Failed to determine keys required to verify: {e}"));
|
||||
},
|
||||
};
|
||||
|
||||
let batch = required
|
||||
|
|
Loading…
Add table
Reference in a new issue