completely strike knowledge of the server from the moderation service

This commit is contained in:
Jacob Taylor 2025-04-25 21:36:04 -07:00
parent 61a7b4cfbf
commit 475d66e1ea

View file

@ -10,16 +10,14 @@ pub struct Service {
} }
struct Services { struct Services {
// pub server: Arc<Server>, pub config: Dep<config::Service>
pub config: Dep<config::Service>,
} }
impl crate::Service for Service { impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> { fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
Ok(Arc::new(Self { Ok(Arc::new(Self {
services: Services { services: Services {
// server: args.server.clone(), config: args.depend::<config::Service>("config")
config: args.depend::<config::Service>("config"),
}, },
})) }))
} }
@ -27,20 +25,6 @@ impl crate::Service for Service {
fn name(&self) -> &str { crate::service::make_name(std::module_path!()) } fn name(&self) -> &str { crate::service::make_name(std::module_path!()) }
} }
#[implement(Service)]
#[must_use]
pub fn is_remote_server_ignored(&self, server_name: &ServerName) -> bool {
// We must never block federating with ourselves
if server_name == self.services.config.server_name {
return false;
}
self.services
.config
.ignore_messages_from_server_names
.is_match(server_name.host())
}
#[implement(Service)] #[implement(Service)]
#[must_use] #[must_use]
pub fn is_remote_server_forbidden(&self, server_name: &ServerName) -> bool { pub fn is_remote_server_forbidden(&self, server_name: &ServerName) -> bool {