mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-25 14:33:15 +00:00
rename forbidden_room_names to forbidden_alias_names
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
5e880ac44a
commit
61f49ecf0e
|
@ -173,7 +173,7 @@ registration_token = "change this token for something specific to your server"
|
|||
# This is checked upon room alias creation, custom room ID creation if used, and startup as warnings if any room aliases
|
||||
# in your database have a forbidden room alias/ID.
|
||||
# No default.
|
||||
# forbidden_room_names = []
|
||||
# forbidden_alias_names = []
|
||||
|
||||
# Set this to true to allow your server's public room directory to be federated.
|
||||
# Set this to false to protect against /publicRooms spiders, but will forbid external users
|
||||
|
|
|
@ -21,7 +21,7 @@ pub async fn create_alias_route(body: Ruma<create_alias::v3::Request>) -> Result
|
|||
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Alias is from another server."));
|
||||
}
|
||||
|
||||
if services().globals.forbidden_room_names().is_match(body.room_alias.alias()) {
|
||||
if services().globals.forbidden_alias_names().is_match(body.room_alias.alias()) {
|
||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias is forbidden."));
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ pub async fn create_room_route(body: Ruma<create_room::v3::Request>) -> Result<c
|
|||
}
|
||||
|
||||
// apply forbidden room alias checks to custom room IDs too
|
||||
if services().globals.forbidden_room_names().is_match(&custom_room_id_s) {
|
||||
if services().globals.forbidden_alias_names().is_match(&custom_room_id_s) {
|
||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Custom room ID is forbidden."));
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ pub async fn create_room_route(body: Ruma<create_room::v3::Request>) -> Result<c
|
|||
}
|
||||
|
||||
// check if room alias is forbidden
|
||||
if services().globals.forbidden_room_names().is_match(localpart) {
|
||||
if services().globals.forbidden_alias_names().is_match(localpart) {
|
||||
return Err(Error::BadRequest(ErrorKind::Unknown, "Room alias name is forbidden."));
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ pub struct Config {
|
|||
|
||||
#[serde(default = "RegexSet::empty")]
|
||||
#[serde(with = "serde_regex")]
|
||||
pub forbidden_room_names: RegexSet,
|
||||
pub forbidden_alias_names: RegexSet,
|
||||
|
||||
#[serde(default = "RegexSet::empty")]
|
||||
#[serde(with = "serde_regex")]
|
||||
|
@ -405,8 +405,8 @@ impl fmt::Display for Config {
|
|||
("Forbidden usernames", {
|
||||
&self.forbidden_usernames.patterns().iter().join(", ")
|
||||
}),
|
||||
("Forbidden room names", {
|
||||
&self.forbidden_room_names.patterns().iter().join(", ")
|
||||
("Forbidden room aliases", {
|
||||
&self.forbidden_alias_names.patterns().iter().join(", ")
|
||||
}),
|
||||
(
|
||||
"URL preview domain contains allowlist",
|
||||
|
|
|
@ -953,7 +953,7 @@ impl KeyValueDatabase {
|
|||
}
|
||||
|
||||
{
|
||||
let patterns = &services().globals.config.forbidden_room_names;
|
||||
let patterns = &services().globals.config.forbidden_alias_names;
|
||||
if !patterns.is_empty() {
|
||||
for address in services().rooms.metadata.iter_ids() {
|
||||
let room_id = address?;
|
||||
|
|
|
@ -345,7 +345,7 @@ impl Service<'_> {
|
|||
|
||||
pub fn url_preview_check_root_domain(&self) -> bool { self.config.url_preview_check_root_domain }
|
||||
|
||||
pub fn forbidden_room_names(&self) -> &RegexSet { &self.config.forbidden_room_names }
|
||||
pub fn forbidden_alias_names(&self) -> &RegexSet { &self.config.forbidden_alias_names }
|
||||
|
||||
pub fn forbidden_usernames(&self) -> &RegexSet { &self.config.forbidden_usernames }
|
||||
|
||||
|
|
Loading…
Reference in a new issue