fix: Accept_may_join callback works again
This commit is contained in:
parent
99f16c2dfc
commit
76865e6f91
4 changed files with 26 additions and 34 deletions
26
Cargo.lock
generated
26
Cargo.lock
generated
|
|
@ -1635,7 +1635,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "draupnir-antispam"
|
||||
version = "0.1.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"ruma-common",
|
||||
"serde",
|
||||
|
|
@ -2995,7 +2995,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
|||
[[package]]
|
||||
name = "meowlnir-antispam"
|
||||
version = "0.1.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"ruma-common",
|
||||
"serde",
|
||||
|
|
@ -4085,7 +4085,7 @@ checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3"
|
|||
[[package]]
|
||||
name = "ruma"
|
||||
version = "0.10.1"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"assign",
|
||||
"draupnir-antispam",
|
||||
|
|
@ -4107,7 +4107,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-appservice-api"
|
||||
version = "0.10.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
|
@ -4119,7 +4119,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-client-api"
|
||||
version = "0.18.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"assign",
|
||||
|
|
@ -4142,7 +4142,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-common"
|
||||
version = "0.13.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"base64 0.22.1",
|
||||
|
|
@ -4174,7 +4174,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-events"
|
||||
version = "0.28.1"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"as_variant",
|
||||
"indexmap",
|
||||
|
|
@ -4199,7 +4199,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-federation-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"headers",
|
||||
|
|
@ -4221,7 +4221,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-identifiers-validation"
|
||||
version = "0.9.5"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"thiserror 2.0.17",
|
||||
|
|
@ -4230,7 +4230,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-identity-service-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
|
@ -4240,7 +4240,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-macros"
|
||||
version = "0.13.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"proc-macro-crate",
|
||||
|
|
@ -4255,7 +4255,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-push-gateway-api"
|
||||
version = "0.9.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
|
|
@ -4267,7 +4267,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "ruma-signatures"
|
||||
version = "0.15.0"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=46e31bd6439eccbd3a1762f710c17fc15168c15e#46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=42f13b1e806f3b6b04fb4d2247c73c7a565d3de1#42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"ed25519-dalek",
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ version = "0.1.2"
|
|||
# Used for matrix spec type definitions and helpers
|
||||
[workspace.dependencies.ruma]
|
||||
git = "https://forgejo.ellis.link/continuwuation/ruwuma"
|
||||
rev = "46e31bd6439eccbd3a1762f710c17fc15168c15e"
|
||||
rev = "42f13b1e806f3b6b04fb4d2247c73c7a565d3de1"
|
||||
features = [
|
||||
"compat",
|
||||
"rand",
|
||||
|
|
|
|||
|
|
@ -207,23 +207,15 @@ pub(crate) async fn user_can_perform_restricted_join(
|
|||
return Ok(true);
|
||||
}
|
||||
},
|
||||
| AllowRule::UnstableSpamChecker => {
|
||||
match services
|
||||
| AllowRule::UnstableSpamChecker =>
|
||||
return match services
|
||||
.antispam
|
||||
.meowlnir_accept_make_join(room_id.to_owned(), user_id.to_owned())
|
||||
.await
|
||||
{
|
||||
| Ok(()) => {
|
||||
return Ok(true);
|
||||
},
|
||||
| Err(e) => {
|
||||
info!(
|
||||
"meowlnir rejected restricted join for user {} into room {}: {e:?}",
|
||||
user_id, room_id
|
||||
);
|
||||
},
|
||||
}
|
||||
},
|
||||
| Ok(()) => Ok(true),
|
||||
| Err(e) => Err!(Request(Forbidden("Antispam rejected join request."))),
|
||||
},
|
||||
| _ => {
|
||||
debug_info!(
|
||||
"Unsupported allow rule in restricted join for room {}: {:?}",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::sync::Arc;
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use conduwuit::{Result, config::Antispam, debug};
|
||||
|
|
@ -37,7 +37,7 @@ impl Service {
|
|||
request: T,
|
||||
) -> Result<T::IncomingResponse>
|
||||
where
|
||||
T: ruma::api::OutgoingRequest + std::fmt::Debug + Send,
|
||||
T: ruma::api::OutgoingRequest + Debug + Send,
|
||||
{
|
||||
sending::antispam::send_antispam_request(
|
||||
&self.services.client.appservice,
|
||||
|
|
@ -62,7 +62,7 @@ impl Service {
|
|||
) -> Result<()> {
|
||||
if let Some(config) = &self.services.config.antispam {
|
||||
let result = if let Some(meowlnir) = &config.meowlnir {
|
||||
debug!("Asking meowlnir for user_may_invite");
|
||||
debug!(?room_id, ?inviter, ?invitee, "Asking meowlnir for user_may_invite");
|
||||
self.send_antispam_request(
|
||||
meowlnir.base_url.as_str(),
|
||||
&meowlnir.secret,
|
||||
|
|
@ -78,7 +78,7 @@ impl Service {
|
|||
.inspect_err(|e| debug!("meowlnir denied the invite: {e:?}"))
|
||||
.map(|_| ())
|
||||
} else if let Some(draupnir) = &config.draupnir {
|
||||
debug!("Asking draupnir for user_may_invite");
|
||||
debug!(?room_id, ?inviter, ?invitee, "Asking draupnir for user_may_invite");
|
||||
self.send_antispam_request(
|
||||
draupnir.base_url.as_str(),
|
||||
&draupnir.secret,
|
||||
|
|
@ -107,7 +107,7 @@ impl Service {
|
|||
) -> Result<()> {
|
||||
if let Some(config) = &self.services.config.antispam {
|
||||
let result = if let Some(meowlnir) = &config.meowlnir {
|
||||
debug!("Asking meowlnir for user_may_join_room");
|
||||
debug!(?room_id, ?user_id, ?is_invited, "Asking meowlnir for user_may_join_room");
|
||||
self.send_antispam_request(
|
||||
meowlnir.base_url.as_str(),
|
||||
&meowlnir.secret,
|
||||
|
|
@ -123,7 +123,7 @@ impl Service {
|
|||
.inspect_err(|e| debug!("meowlnir denied the join: {e:?}"))
|
||||
.map(|_| ())
|
||||
} else if let Some(draupnir) = &config.draupnir {
|
||||
debug!("Asking draupnir for user_may_join_room");
|
||||
debug!(?room_id, ?user_id, ?is_invited, "Asking draupnir for user_may_join_room");
|
||||
self.send_antispam_request(
|
||||
draupnir.base_url.as_str(),
|
||||
&draupnir.secret,
|
||||
|
|
@ -151,7 +151,7 @@ impl Service {
|
|||
user_id: OwnedUserId,
|
||||
) -> Result<()> {
|
||||
if let Some(Antispam { meowlnir: Some(meowlnir), .. }) = &self.services.config.antispam {
|
||||
debug!("Asking meowlnir for meowlnir_accept_make_join");
|
||||
debug!(?room_id, ?user_id, "Asking meowlnir for accept_make_join");
|
||||
self.send_antispam_request(
|
||||
meowlnir.base_url.as_str(),
|
||||
&meowlnir.secret,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue