Limited use registration token support
Co-authored-by: Ginger <ginger@gingershaped.computer> Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
mod data;
|
||||
|
||||
use std::{collections::HashSet, ops::Range, sync::Arc};
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
use data::Data;
|
||||
use ruma::{OwnedUserId, RoomAliasId, ServerName, UserId};
|
||||
@@ -106,31 +106,6 @@ impl Service {
|
||||
#[must_use]
|
||||
pub fn is_read_only(&self) -> bool { self.db.db.is_read_only() }
|
||||
|
||||
pub fn get_registration_tokens(&self) -> HashSet<String> {
|
||||
let mut tokens = HashSet::new();
|
||||
if let Some(file) = &self
|
||||
.server
|
||||
.config
|
||||
.registration_token_file
|
||||
.as_ref()
|
||||
{
|
||||
match std::fs::read_to_string(file) {
|
||||
| Err(e) => error!("Failed to read the registration token file: {e}"),
|
||||
| Ok(text) => {
|
||||
text.split_ascii_whitespace().for_each(|token| {
|
||||
tokens.insert(token.to_owned());
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(token) = &self.server.config.registration_token {
|
||||
tokens.insert(token.to_owned());
|
||||
}
|
||||
|
||||
tokens
|
||||
}
|
||||
|
||||
pub fn init_rustls_provider(&self) -> Result {
|
||||
if rustls::crypto::CryptoProvider::get_default().is_none() {
|
||||
rustls::crypto::aws_lc_rs::default_provider()
|
||||
|
||||
Reference in New Issue
Block a user