mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
feat: Use info level logs for residency check failures
This commit is contained in:
@@ -2,7 +2,7 @@ use std::cmp;
|
|||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Event, PduCount, Result, debug_warn,
|
Err, Event, PduCount, Result, info,
|
||||||
result::LogErr,
|
result::LogErr,
|
||||||
utils::{IterStream, ReadyExt, stream::TryTools},
|
utils::{IterStream, ReadyExt, stream::TryTools},
|
||||||
};
|
};
|
||||||
@@ -40,7 +40,7 @@ pub(crate) async fn get_backfill_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve backfill for room we aren't participating in"
|
"Refusing to serve backfill for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
+14
-1
@@ -1,5 +1,5 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Result, err};
|
use conduwuit::{Err, Result, err, info};
|
||||||
use ruma::{MilliSecondsSinceUnixEpoch, RoomId, api::federation::event::get_event};
|
use ruma::{MilliSecondsSinceUnixEpoch, RoomId, api::federation::event::get_event};
|
||||||
|
|
||||||
use super::AccessCheck;
|
use super::AccessCheck;
|
||||||
@@ -38,6 +38,19 @@ pub(crate) async fn get_event_route(
|
|||||||
.check()
|
.check()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if !services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
info!(
|
||||||
|
origin = body.origin().as_str(),
|
||||||
|
"Refusing to serve state for room we aren't participating in"
|
||||||
|
);
|
||||||
|
return Err!(Request(NotFound("This server is not participating in that room.")));
|
||||||
|
}
|
||||||
|
|
||||||
Ok(get_event::v1::Response {
|
Ok(get_event::v1::Response {
|
||||||
origin: services.globals.server_name().to_owned(),
|
origin: services.globals.server_name().to_owned(),
|
||||||
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
|
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{borrow::Borrow, iter::once};
|
use std::{borrow::Borrow, iter::once};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Error, Result, utils::stream::ReadyExt};
|
use conduwuit::{Err, Error, Result, info, utils::stream::ReadyExt};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomId,
|
RoomId,
|
||||||
@@ -29,6 +29,19 @@ pub(crate) async fn get_event_authorization_route(
|
|||||||
.check()
|
.check()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if !services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
info!(
|
||||||
|
origin = body.origin().as_str(),
|
||||||
|
"Refusing to serve state for room we aren't participating in"
|
||||||
|
);
|
||||||
|
return Err!(Request(NotFound("This server is not participating in that room.")));
|
||||||
|
}
|
||||||
|
|
||||||
let event = services
|
let event = services
|
||||||
.rooms
|
.rooms
|
||||||
.timeline
|
.timeline
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Result, debug, debug_error, utils::to_canonical_object};
|
use conduwuit::{Err, Result, debug, debug_error, info, utils::to_canonical_object};
|
||||||
use ruma::api::federation::event::get_missing_events;
|
use ruma::api::federation::event::get_missing_events;
|
||||||
|
|
||||||
use super::AccessCheck;
|
use super::AccessCheck;
|
||||||
@@ -26,6 +26,19 @@ pub(crate) async fn get_missing_events_route(
|
|||||||
.check()
|
.check()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if !services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
info!(
|
||||||
|
origin = body.origin().as_str(),
|
||||||
|
"Refusing to serve state for room we aren't participating in"
|
||||||
|
);
|
||||||
|
return Err!(Request(NotFound("This server is not participating in that room.")));
|
||||||
|
}
|
||||||
|
|
||||||
let limit = body
|
let limit = body
|
||||||
.limit
|
.limit
|
||||||
.try_into()
|
.try_into()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result,
|
Err, Result, info,
|
||||||
utils::stream::{BroadbandExt, IterStream},
|
utils::stream::{BroadbandExt, IterStream},
|
||||||
};
|
};
|
||||||
use conduwuit_service::rooms::spaces::{
|
use conduwuit_service::rooms::spaces::{
|
||||||
@@ -23,6 +23,19 @@ pub(crate) async fn get_hierarchy_route(
|
|||||||
return Err!(Request(NotFound("Room does not exist.")));
|
return Err!(Request(NotFound("Room does not exist.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
info!(
|
||||||
|
origin = body.origin().as_str(),
|
||||||
|
"Refusing to serve state for room we aren't participating in"
|
||||||
|
);
|
||||||
|
return Err!(Request(NotFound("This server is not participating in that room.")));
|
||||||
|
}
|
||||||
|
|
||||||
let room_id = &body.room_id;
|
let room_id = &body.room_id;
|
||||||
let suggested_only = body.suggested_only;
|
let suggested_only = body.suggested_only;
|
||||||
let ref identifier = Identifier::ServerName(body.origin());
|
let ref identifier = Identifier::ServerName(body.origin());
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{Err, Error, Result, debug, debug_info, info, matrix::pdu::PduBuilder, warn};
|
||||||
Err, Error, Result, debug, debug_info, debug_warn, info, matrix::pdu::PduBuilder, warn,
|
|
||||||
};
|
|
||||||
use conduwuit_service::Services;
|
use conduwuit_service::Services;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -38,7 +36,7 @@ pub(crate) async fn create_join_event_template_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve make_join for room we aren't participating in"
|
"Refusing to serve make_join for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use RoomVersionId::*;
|
use RoomVersionId::*;
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Error, Result, debug_warn, matrix::pdu::PduBuilder, warn};
|
use conduwuit::{Err, Error, Result, debug_warn, info, matrix::pdu::PduBuilder, warn};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
RoomVersionId,
|
RoomVersionId,
|
||||||
api::{client::error::ErrorKind, federation::knock::create_knock_event_template},
|
api::{client::error::ErrorKind, federation::knock::create_knock_event_template},
|
||||||
@@ -26,7 +26,7 @@ pub(crate) async fn create_knock_event_template_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve make_knock for room we aren't participating in"
|
"Refusing to serve make_knock for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, debug_warn, matrix::pdu::PduBuilder};
|
use conduwuit::{Err, Result, info, matrix::pdu::PduBuilder};
|
||||||
use ruma::{
|
use ruma::{
|
||||||
api::federation::membership::prepare_leave_event,
|
api::federation::membership::prepare_leave_event,
|
||||||
events::room::member::{MembershipState, RoomMemberEventContent},
|
events::room::member::{MembershipState, RoomMemberEventContent},
|
||||||
@@ -26,7 +26,7 @@ pub(crate) async fn create_leave_event_template_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve make_leave for room we aren't participating in"
|
"Refusing to serve make_leave for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::{borrow::Borrow, time::Instant, vec};
|
|||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Event, Result, at, debug, debug_warn, err, info,
|
Err, Event, Result, at, debug, err, info,
|
||||||
matrix::event::gen_event_id_canonical_json,
|
matrix::event::gen_event_id_canonical_json,
|
||||||
trace,
|
trace,
|
||||||
utils::stream::{BroadbandExt, IterStream, TryBroadbandExt},
|
utils::stream::{BroadbandExt, IterStream, TryBroadbandExt},
|
||||||
@@ -42,7 +42,7 @@ async fn create_join_event(
|
|||||||
.server_in_room(services.globals.server_name(), room_id)
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = origin.as_str(),
|
origin = origin.as_str(),
|
||||||
"Refusing to serve send_join for room we aren't participating in"
|
"Refusing to serve send_join for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Result, debug_warn, err,
|
Err, Result, err, info,
|
||||||
matrix::{event::gen_event_id_canonical_json, pdu::PduEvent},
|
matrix::{event::gen_event_id_canonical_json, pdu::PduEvent},
|
||||||
warn,
|
warn,
|
||||||
};
|
};
|
||||||
@@ -60,7 +60,7 @@ pub(crate) async fn create_knock_event_v1_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve send_knock for room we aren't participating in"
|
"Refusing to serve send_knock for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![allow(deprecated)]
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, debug_warn, err, matrix::event::gen_event_id_canonical_json};
|
use conduwuit::{Err, Result, err, info, matrix::event::gen_event_id_canonical_json};
|
||||||
use conduwuit_service::Services;
|
use conduwuit_service::Services;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
@@ -56,7 +56,7 @@ async fn create_leave_event(
|
|||||||
.server_in_room(services.globals.server_name(), room_id)
|
.server_in_room(services.globals.server_name(), room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = origin.as_str(),
|
origin = origin.as_str(),
|
||||||
"Refusing to serve backfill for room we aren't participating in"
|
"Refusing to serve backfill for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{borrow::Borrow, iter::once};
|
use std::{borrow::Borrow, iter::once};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Err, Result, at, debug_warn, err, utils::IterStream};
|
use conduwuit::{Err, Result, at, err, info, utils::IterStream};
|
||||||
use futures::{FutureExt, StreamExt, TryStreamExt};
|
use futures::{FutureExt, StreamExt, TryStreamExt};
|
||||||
use ruma::{OwnedEventId, api::federation::event::get_room_state};
|
use ruma::{OwnedEventId, api::federation::event::get_room_state};
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ pub(crate) async fn get_room_state_route(
|
|||||||
.server_in_room(services.globals.server_name(), &body.room_id)
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
origin = body.origin().as_str(),
|
origin = body.origin().as_str(),
|
||||||
"Refusing to serve state for room we aren't participating in"
|
"Refusing to serve state for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{borrow::Borrow, iter::once};
|
use std::{borrow::Borrow, iter::once};
|
||||||
|
|
||||||
use axum::extract::State;
|
use axum::extract::State;
|
||||||
use conduwuit::{Result, at, err};
|
use conduwuit::{Err, Result, at, err, info};
|
||||||
use futures::{StreamExt, TryStreamExt};
|
use futures::{StreamExt, TryStreamExt};
|
||||||
use ruma::{OwnedEventId, api::federation::event::get_room_state_ids};
|
use ruma::{OwnedEventId, api::federation::event::get_room_state_ids};
|
||||||
|
|
||||||
@@ -25,6 +25,19 @@ pub(crate) async fn get_room_state_ids_route(
|
|||||||
.check()
|
.check()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if !services
|
||||||
|
.rooms
|
||||||
|
.state_cache
|
||||||
|
.server_in_room(services.globals.server_name(), &body.room_id)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
info!(
|
||||||
|
origin = body.origin().as_str(),
|
||||||
|
"Refusing to serve state for room we aren't participating in"
|
||||||
|
);
|
||||||
|
return Err!(Request(NotFound("This server is not participating in that room.")));
|
||||||
|
}
|
||||||
|
|
||||||
let shortstatehash = services
|
let shortstatehash = services
|
||||||
.rooms
|
.rooms
|
||||||
.state_accessor
|
.state_accessor
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use conduwuit::{
|
use conduwuit::{
|
||||||
Err, Event, Result, debug::INFO_SPAN_LEVEL, debug_warn, defer, err, implement,
|
Err, Event, Result, debug::INFO_SPAN_LEVEL, defer, err, implement, info,
|
||||||
utils::stream::IterStream, warn,
|
utils::stream::IterStream, warn,
|
||||||
};
|
};
|
||||||
use futures::{
|
use futures::{
|
||||||
@@ -120,7 +120,7 @@ pub async fn handle_incoming_pdu<'a>(
|
|||||||
.server_in_room(self.services.globals.server_name(), room_id)
|
.server_in_room(self.services.globals.server_name(), room_id)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
debug_warn!(
|
info!(
|
||||||
%origin,
|
%origin,
|
||||||
"Dropping inbound PDU for room we aren't participating in"
|
"Dropping inbound PDU for room we aren't participating in"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user