Skip to content
Snippets Groups Projects
Commit cffe48d2 authored by 🥺's avatar 🥺 :transgender_flag: Committed by 🥺
Browse files

add federation allowed checks on get remote pdu list

parent f87a0128
No related branches found
No related tags found
No related merge requests found
...@@ -103,6 +103,18 @@ pub(super) async fn get_pdu(_body: Vec<&str>, event_id: Box<EventId>) -> Result< ...@@ -103,6 +103,18 @@ pub(super) async fn get_pdu(_body: Vec<&str>, event_id: Box<EventId>) -> Result<
pub(super) async fn get_remote_pdu_list( pub(super) async fn get_remote_pdu_list(
body: Vec<&str>, server: Box<ServerName>, force: bool, body: Vec<&str>, server: Box<ServerName>, force: bool,
) -> Result<RoomMessageEventContent> { ) -> Result<RoomMessageEventContent> {
if !services().globals.config.allow_federation {
return Ok(RoomMessageEventContent::text_plain(
"Federation is disabled on this homeserver.",
));
}
if server == services().globals.server_name() {
return Ok(RoomMessageEventContent::text_plain(
"Not allowed to send federation requests to ourselves. Please use `get-pdu` for fetching local PDUs.",
));
}
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```" { if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```" {
let list = body let list = body
.clone() .clone()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment