fix(fed): dont reject `/state_ids/` on world readable rooms
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
10dfbf6420
commit
a04ff7d4af
|
@ -6,25 +6,30 @@ use crate::{services, Error, Result, Ruma};
|
||||||
|
|
||||||
/// # `GET /_matrix/federation/v1/state_ids/{roomId}`
|
/// # `GET /_matrix/federation/v1/state_ids/{roomId}`
|
||||||
///
|
///
|
||||||
/// Retrieves the current state of the room.
|
/// Retrieves a snapshot of a room's state at a given event, in the form of
|
||||||
|
/// event IDs.
|
||||||
pub(crate) async fn get_room_state_ids_route(
|
pub(crate) async fn get_room_state_ids_route(
|
||||||
body: Ruma<get_room_state_ids::v1::Request>,
|
body: Ruma<get_room_state_ids::v1::Request>,
|
||||||
) -> Result<get_room_state_ids::v1::Response> {
|
) -> Result<get_room_state_ids::v1::Response> {
|
||||||
let origin = body.origin.as_ref().expect("server is authenticated");
|
let origin = body.origin.as_ref().expect("server is authenticated");
|
||||||
|
|
||||||
if !services()
|
|
||||||
.rooms
|
|
||||||
.state_cache
|
|
||||||
.server_in_room(origin, &body.room_id)?
|
|
||||||
{
|
|
||||||
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
|
|
||||||
}
|
|
||||||
|
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.event_handler
|
.event_handler
|
||||||
.acl_check(origin, &body.room_id)?;
|
.acl_check(origin, &body.room_id)?;
|
||||||
|
|
||||||
|
if !services()
|
||||||
|
.rooms
|
||||||
|
.state_accessor
|
||||||
|
.is_world_readable(&body.room_id)?
|
||||||
|
&& !services()
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(origin, &body.room_id)?
|
||||||
|
{
|
||||||
|
return Err(Error::BadRequest(ErrorKind::forbidden(), "Server is not in room."));
|
||||||
|
}
|
||||||
|
|
||||||
let shortstatehash = services()
|
let shortstatehash = services()
|
||||||
.rooms
|
.rooms
|
||||||
.state_accessor
|
.state_accessor
|
||||||
|
|
Loading…
Reference in New Issue