mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
feat: Allow sending dummy events to clients
This commit is contained in:
6 files changed
+36
-14
No files matched your search
@@ -1436,6 +1436,11 @@
|
||||
#
|
||||
#send_messages_from_ignored_users_to_client = false
|
||||
|
||||
# Send "org.matrix.dummy_event" events to the client. This is a debugging
|
||||
# option.
|
||||
#
|
||||
#send_dummy_events_to_clients = false
|
||||
|
||||
# Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you
|
||||
# do not want continuwuity to send outbound requests to. Defaults to
|
||||
# RFC1918, unroutable, loopback, multicast, and testnet addresses for
|
||||
|
||||
@@ -291,7 +291,9 @@ where
|
||||
{
|
||||
// exclude Synapse's dummy events from bloating up response bodies. clients
|
||||
// don't need to see this.
|
||||
if event.kind().to_string() == "org.matrix.dummy_event" {
|
||||
if !services.config.send_dummy_events_to_clients
|
||||
&& event.kind().to_string() == "org.matrix.dummy_event"
|
||||
{
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1661,6 +1661,11 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub send_messages_from_ignored_users_to_client: bool,
|
||||
|
||||
/// Send "org.matrix.dummy_event" events to the client. This is a debugging
|
||||
/// option.
|
||||
#[serde(default)]
|
||||
pub send_dummy_events_to_clients: bool,
|
||||
|
||||
/// Vector list of IPv4 and IPv6 CIDR ranges / subnets *in quotes* that you
|
||||
/// do not want continuwuity to send outbound requests to. Defaults to
|
||||
/// RFC1918, unroutable, loopback, multicast, and testnet addresses for
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::collections::{BTreeMap, HashMap, hash_map};
|
||||
|
||||
use conduwuit::{
|
||||
Err, Event, PduEvent, Result, debug, debug_info, debug_warn, err, info, state_res,
|
||||
trace, warn,
|
||||
Err, Event, PduEvent, Result, debug, debug_info, debug_warn, err, info, state_res, trace,
|
||||
warn,
|
||||
};
|
||||
use futures::future::ready;
|
||||
use ruma::{
|
||||
@@ -104,14 +104,21 @@ impl super::Service {
|
||||
let mut auth_events: HashMap<OwnedEventId, PduEvent> = HashMap::new();
|
||||
|
||||
for auth_event_id in pdu_event.auth_events() {
|
||||
if self.services.pdu_metadata.is_event_rejected(auth_event_id).await {
|
||||
if self
|
||||
.services
|
||||
.pdu_metadata
|
||||
.is_event_rejected(auth_event_id)
|
||||
.await
|
||||
{
|
||||
debug_warn!(
|
||||
"Rejecting incoming event {} which depends on rejected auth event \
|
||||
{auth_event_id}",
|
||||
{auth_event_id}",
|
||||
event_id,
|
||||
);
|
||||
self.services.pdu_metadata.mark_event_rejected(event_id);
|
||||
return Err!(Request(Forbidden("Event has rejected auth event: {auth_event_id}")));
|
||||
return Err!(Request(Forbidden(
|
||||
"Event has rejected auth event: {auth_event_id}"
|
||||
)));
|
||||
}
|
||||
|
||||
if let Ok(auth_event) = self.services.timeline.get_pdu(auth_event_id).await {
|
||||
@@ -120,7 +127,8 @@ impl super::Service {
|
||||
auth_events.insert(auth_event_id.to_owned(), auth_event);
|
||||
} else {
|
||||
debug_warn!(
|
||||
"Could not find auth event {auth_event_id} for outlier event {event_id} locally"
|
||||
"Could not find auth event {auth_event_id} for outlier event {event_id} \
|
||||
locally"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@ use crate::rooms::{
|
||||
impl super::Service {
|
||||
#[tracing::instrument(name="upgrade_outlier", skip_all, fields(event_id=%incoming_pdu.event_id()))]
|
||||
pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
||||
&self,
|
||||
incoming_pdu: PduEvent,
|
||||
mut val: CanonicalJsonObject,
|
||||
create_event: &PduEvent,
|
||||
&self,
|
||||
incoming_pdu: PduEvent,
|
||||
mut val: CanonicalJsonObject,
|
||||
create_event: &PduEvent,
|
||||
origin: &ServerName,
|
||||
room_id: &RoomId,
|
||||
) -> Result<Option<RawPduId>> {
|
||||
let (pduid, rejected, soft_failed) = join!(
|
||||
self.services.timeline.get_pdu_id(incoming_pdu.event_id()),
|
||||
self.services
|
||||
self.services
|
||||
.pdu_metadata
|
||||
.is_event_rejected(incoming_pdu.event_id()),
|
||||
self.services
|
||||
@@ -85,7 +85,9 @@ impl super::Service {
|
||||
trace!("Could not calculate incoming state, asking remote {origin} for it");
|
||||
self.fetch_state(origin, create_event, room_id, incoming_pdu.event_id())
|
||||
.await
|
||||
.debug_inspect_err(|e| debug_error!("Could not fetch state from {origin}: {e}"))?
|
||||
.debug_inspect_err(|e| {
|
||||
debug_error!("Could not fetch state from {origin}: {e}");
|
||||
})?
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ impl super::Service {
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> HashSet<OwnedServerName> {
|
||||
let mut candidate_backfill_servers = HashSet::new();
|
||||
let mut candidate_backfill_servers = HashSet::new();
|
||||
|
||||
let power_levels = self
|
||||
.services
|
||||
|
||||
Reference in new issue
Block a user