optimize config denylists

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-22 06:21:57 +00:00 committed by strawberry
parent d35376a90c
commit ca57dc7928
5 changed files with 20 additions and 30 deletions

View file

@ -37,14 +37,12 @@ pub(crate) async fn get_public_rooms_filtered_route(
) -> Result<get_public_rooms_filtered::v3::Response> {
if let Some(server) = &body.server {
if services
.globals
.forbidden_remote_room_directory_server_names()
.server
.config
.forbidden_remote_room_directory_server_names
.contains(server)
{
return Err(Error::BadRequest(
ErrorKind::forbidden(),
"Server is banned on this homeserver.",
));
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
}
@ -77,14 +75,12 @@ pub(crate) async fn get_public_rooms_route(
) -> Result<get_public_rooms::v3::Response> {
if let Some(server) = &body.server {
if services
.globals
.forbidden_remote_room_directory_server_names()
.server
.config
.forbidden_remote_room_directory_server_names
.contains(server)
{
return Err(Error::BadRequest(
ErrorKind::forbidden(),
"Server is banned on this homeserver.",
));
return Err!(Request(Forbidden("Server is banned on this homeserver.")));
}
}