mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 16:44:30 +02:00
Compare commits
10 commits
5ebe8cd8dd
...
5454c22b5b
Author | SHA1 | Date | |
---|---|---|---|
|
5454c22b5b |
||
|
977fddf4c5 |
||
|
fe1610ab1c |
||
|
efce67264e |
||
|
40d789dd72 |
||
|
964b23a428 |
||
|
be61ff1465 |
||
|
1dc9abc00e |
||
|
b9ce99d036 |
||
|
f513cb7598 |
4 changed files with 30 additions and 2 deletions
16
.typos.toml
16
.typos.toml
|
@ -1,5 +1,19 @@
|
||||||
[files]
|
[files]
|
||||||
extend-exclude = ["*.csr"]
|
extend-exclude = ["*.csr", "*.lock", "pnpm-lock.yaml"]
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
extend-ignore-re = [
|
||||||
|
"(?Rm)^.*(#|//|<!--)\\s*spellchecker:disable-line(\\s*-->)$", # Ignore a line by making it trail with a `spellchecker:disable-line` comment
|
||||||
|
"^[0-9a-f]{7,}$", # Commit hashes
|
||||||
|
|
||||||
|
# some heuristics for base64 strings
|
||||||
|
"[A-Za-z0-9+=]{72,}",
|
||||||
|
"([A-Za-z0-9+=]|\\\\\\s\\*){72,}",
|
||||||
|
"[0-9+][A-Za-z0-9+]{30,}[a-z0-9+]",
|
||||||
|
"\\$[A-Z0-9+][A-Za-z0-9+]{6,}[a-z0-9+]",
|
||||||
|
"\\b[a-z0-9+/=][A-Za-z0-9+/=]{7,}[a-z0-9+/=][A-Z]\\b",
|
||||||
|
]
|
||||||
|
|
||||||
[default.extend-words]
|
[default.extend-words]
|
||||||
"allocatedp" = "allocatedp"
|
"allocatedp" = "allocatedp"
|
||||||
|
|
|
@ -11,6 +11,10 @@ use ruma::{
|
||||||
#[implement(super::Service)]
|
#[implement(super::Service)]
|
||||||
#[tracing::instrument(skip_all, level = "debug")]
|
#[tracing::instrument(skip_all, level = "debug")]
|
||||||
pub async fn policyserv_check(&self, pdu: &PduEvent, room_id: &RoomId) -> Result {
|
pub async fn policyserv_check(&self, pdu: &PduEvent, room_id: &RoomId) -> Result {
|
||||||
|
if *pdu.event_type() == StateEventType::RoomPolicy.into() {
|
||||||
|
debug!("Skipping spam check for policy server meta-event in room {room_id}");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let Ok(policyserver) = self
|
let Ok(policyserver) = self
|
||||||
.services
|
.services
|
||||||
.state_accessor
|
.state_accessor
|
||||||
|
@ -28,6 +32,14 @@ pub async fn policyserv_check(&self, pdu: &PduEvent, room_id: &RoomId) -> Result
|
||||||
return Ok(());
|
return Ok(());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if via.is_empty() {
|
||||||
|
debug!("Policy server is empty for room {room_id}, skipping spam check");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
if !self.services.state_cache.server_in_room(via, room_id).await {
|
||||||
|
debug!("Policy server {via} is not in the room {room_id}, skipping spam check");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let outgoing = self
|
let outgoing = self
|
||||||
.services
|
.services
|
||||||
.sending
|
.sending
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct Services {
|
||||||
server_keys: Dep<server_keys::Service>,
|
server_keys: Dep<server_keys::Service>,
|
||||||
short: Dep<rooms::short::Service>,
|
short: Dep<rooms::short::Service>,
|
||||||
state: Dep<rooms::state::Service>,
|
state: Dep<rooms::state::Service>,
|
||||||
|
state_cache: Dep<rooms::state_cache::Service>,
|
||||||
state_accessor: Dep<rooms::state_accessor::Service>,
|
state_accessor: Dep<rooms::state_accessor::Service>,
|
||||||
state_compressor: Dep<rooms::state_compressor::Service>,
|
state_compressor: Dep<rooms::state_compressor::Service>,
|
||||||
timeline: Dep<rooms::timeline::Service>,
|
timeline: Dep<rooms::timeline::Service>,
|
||||||
|
@ -68,6 +69,7 @@ impl crate::Service for Service {
|
||||||
pdu_metadata: args.depend::<rooms::pdu_metadata::Service>("rooms::pdu_metadata"),
|
pdu_metadata: args.depend::<rooms::pdu_metadata::Service>("rooms::pdu_metadata"),
|
||||||
short: args.depend::<rooms::short::Service>("rooms::short"),
|
short: args.depend::<rooms::short::Service>("rooms::short"),
|
||||||
state: args.depend::<rooms::state::Service>("rooms::state"),
|
state: args.depend::<rooms::state::Service>("rooms::state"),
|
||||||
|
state_cache: args.depend::<rooms::state_cache::Service>("rooms::state_cache"),
|
||||||
state_accessor: args
|
state_accessor: args
|
||||||
.depend::<rooms::state_accessor::Service>("rooms::state_accessor"),
|
.depend::<rooms::state_accessor::Service>("rooms::state_accessor"),
|
||||||
state_compressor: args
|
state_compressor: args
|
||||||
|
|
|
@ -55,7 +55,7 @@ where
|
||||||
// backwards extremities doing all the checks in this list starting at 1.
|
// backwards extremities doing all the checks in this list starting at 1.
|
||||||
// These are not timeline events.
|
// These are not timeline events.
|
||||||
|
|
||||||
debug!("Resolving state at event");
|
debug!("Resolving state at event {}", incoming_pdu.event_id);
|
||||||
let mut state_at_incoming_event = if incoming_pdu.prev_events().count() == 1 {
|
let mut state_at_incoming_event = if incoming_pdu.prev_events().count() == 1 {
|
||||||
self.state_at_incoming_degree_one(&incoming_pdu).await?
|
self.state_at_incoming_degree_one(&incoming_pdu).await?
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue