mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-05 13:39:13 +01:00
Merge branch 'lightning_bolt_option' into 'next'
Lightning bolt optional See merge request famedly/conduit!366
This commit is contained in:
commit
de9b0cec50
5 changed files with 27 additions and 3 deletions
|
@ -40,6 +40,9 @@ allow_registration = true
|
|||
|
||||
allow_federation = true
|
||||
|
||||
# Enable the display name lightning bolt on registration.
|
||||
enable_lightning_bolt = true
|
||||
|
||||
trusted_servers = ["matrix.org"]
|
||||
|
||||
#max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time
|
||||
|
|
|
@ -12,7 +12,6 @@ use ruma::{
|
|||
events::{room::message::RoomMessageEventContent, GlobalAccountDataEventType},
|
||||
push, UserId,
|
||||
};
|
||||
|
||||
use tracing::{info, warn};
|
||||
|
||||
use register::RegistrationKind;
|
||||
|
@ -169,7 +168,13 @@ pub async fn register_route(
|
|||
services().users.create(&user_id, password)?;
|
||||
|
||||
// Default to pretty displayname
|
||||
let displayname = format!("{} ⚡️", user_id.localpart());
|
||||
let mut displayname = user_id.localpart().to_owned();
|
||||
|
||||
// If enabled append lightning bolt to display name (default true)
|
||||
if services().globals.enable_lightning_bolt() {
|
||||
displayname.push_str(" ⚡️");
|
||||
}
|
||||
|
||||
services()
|
||||
.users
|
||||
.set_displayname(&user_id, Some(displayname.clone()))?;
|
||||
|
|
|
@ -26,6 +26,8 @@ pub struct Config {
|
|||
pub database_path: String,
|
||||
#[serde(default = "default_db_cache_capacity_mb")]
|
||||
pub db_cache_capacity_mb: f64,
|
||||
#[serde(default = "true_fn")]
|
||||
pub enable_lightning_bolt: bool,
|
||||
#[serde(default = "default_conduit_cache_capacity_modifier")]
|
||||
pub conduit_cache_capacity_modifier: f64,
|
||||
#[serde(default = "default_rocksdb_max_open_files")]
|
||||
|
@ -135,6 +137,10 @@ impl fmt::Display for Config {
|
|||
&self.max_concurrent_requests.to_string(),
|
||||
),
|
||||
("Allow registration", &self.allow_registration.to_string()),
|
||||
(
|
||||
"Enabled lightning bolt",
|
||||
&self.enable_lightning_bolt.to_string(),
|
||||
),
|
||||
("Allow encryption", &self.allow_encryption.to_string()),
|
||||
("Allow federation", &self.allow_federation.to_string()),
|
||||
("Allow room creation", &self.allow_room_creation.to_string()),
|
||||
|
|
|
@ -626,7 +626,13 @@ impl Service {
|
|||
services().users.create(&user_id, Some(password.as_str()))?;
|
||||
|
||||
// Default to pretty displayname
|
||||
let displayname = format!("{} ⚡️", user_id.localpart());
|
||||
let mut displayname = user_id.localpart().to_owned();
|
||||
|
||||
// If enabled append lightning bolt to display name (default true)
|
||||
if services().globals.enable_lightning_bolt() {
|
||||
displayname.push_str(" ⚡️");
|
||||
}
|
||||
|
||||
services()
|
||||
.users
|
||||
.set_displayname(&user_id, Some(displayname))?;
|
||||
|
|
|
@ -245,6 +245,10 @@ impl Service {
|
|||
self.config.default_room_version.clone()
|
||||
}
|
||||
|
||||
pub fn enable_lightning_bolt(&self) -> bool {
|
||||
self.config.enable_lightning_bolt
|
||||
}
|
||||
|
||||
pub fn trusted_servers(&self) -> &[OwnedServerName] {
|
||||
&self.config.trusted_servers
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue