diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 76b81b66f330aabe4cf045b8dd4fd3827fd4982d..a2c61d37b509b37f6e6263f9a6fdaba876796c08 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -159,6 +159,10 @@ ip_range_denylist = [ # For private homeservers, this is best at false. allow_guest_registration = false +# Set to true to log guest registrations in the admin room. +# Defaults to false as it may be noisy or unnecessary. +log_guest_registrations = false + # Vector list of servers that conduwuit will refuse to download remote media from. # No default. # prevent_media_downloads_from = ["example.com", "example.local"] diff --git a/src/api/client_server/account.rs b/src/api/client_server/account.rs index 80ab24509f3e2b886cff0960c7382d81c78b3b03..13a75e698bb26bede8ae0ad4d41f6175690fa002 100644 --- a/src/api/client_server/account.rs +++ b/src/api/client_server/account.rs @@ -290,7 +290,7 @@ pub async fn register_route(body: Ruma<register::v3::Request>) -> Result<registe } // log in conduit admin channel if a guest registered - if !body.from_appservice && is_guest { + if !body.from_appservice && is_guest && services().globals.log_guest_registrations() { services() .admin .send_message(RoomMessageEventContent::notice_plain(format!( diff --git a/src/config/mod.rs b/src/config/mod.rs index 17aaf7edfba0da4ca6dcde26949d22928b39ee2f..16a3dbfe7fb11aa162e6b79b91ea4ba9ea7936ec 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -258,6 +258,8 @@ pub struct Config { #[serde(default)] pub allow_guest_registration: bool, + #[serde(default)] + pub log_guest_registrations: bool, #[serde(default = "Vec::new")] pub prevent_media_downloads_from: Vec<OwnedServerName>, @@ -509,6 +511,10 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "Allow guest registration (inherently false if allow registration is false)", &self.allow_guest_registration.to_string(), ), + ( + "Log guest registrations in admin room", + &self.log_guest_registrations.to_string(), + ), ("New user display name suffix", &self.new_user_displayname_suffix), ("Allow encryption", &self.allow_encryption.to_string()), ("Allow federation", &self.allow_federation.to_string()), diff --git a/src/service/globals/mod.rs b/src/service/globals/mod.rs index a6a4ea4029f8d74688e592f436cfa34563f834ff..644cc2c680a5f9f5fcd0934e00a5e9d6e9db16a8 100644 --- a/src/service/globals/mod.rs +++ b/src/service/globals/mod.rs @@ -209,6 +209,8 @@ pub fn allow_registration(&self) -> bool { self.config.allow_registration } pub fn allow_guest_registration(&self) -> bool { self.config.allow_guest_registration } + pub fn log_guest_registrations(&self) -> bool { self.config.log_guest_registrations } + pub fn allow_encryption(&self) -> bool { self.config.allow_encryption } pub fn allow_federation(&self) -> bool { self.config.allow_federation }