improvement: more logging
parent
9439f2c183
commit
6e36081573
|
@ -2,6 +2,7 @@ use std::{collections::BTreeMap, convert::TryInto};
|
|||
|
||||
use super::{State, DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{pdu::PduBuilder, utils, ConduitResult, Database, Error, Ruma};
|
||||
use log::info;
|
||||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
|
@ -510,6 +511,8 @@ pub async fn register_route(
|
|||
)?;
|
||||
}
|
||||
|
||||
info!("{} registered on this server", user_id);
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(register::Response {
|
||||
|
@ -686,6 +689,8 @@ pub async fn deactivate_route(
|
|||
// Remove devices and mark account as deactivated
|
||||
db.users.deactivate_account(&sender_user)?;
|
||||
|
||||
info!("{} deactivated their account", sender_user);
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(deactivate::Response {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use super::State;
|
||||
use crate::{server_server, ConduitResult, Database, Error, Result, Ruma};
|
||||
use log::info;
|
||||
use ruma::{
|
||||
api::{
|
||||
client::{
|
||||
|
@ -82,8 +83,13 @@ pub async fn set_room_visibility_route(
|
|||
db: State<'_, Database>,
|
||||
body: Ruma<set_room_visibility::Request<'_>>,
|
||||
) -> ConduitResult<set_room_visibility::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
match body.visibility {
|
||||
room::Visibility::Public => db.rooms.set_public(&body.room_id, true)?,
|
||||
room::Visibility::Public => {
|
||||
db.rooms.set_public(&body.room_id, true)?;
|
||||
info!("{} made {} public", sender_user, body.room_id);
|
||||
}
|
||||
room::Visibility::Private => db.rooms.set_public(&body.room_id, false)?,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use super::State;
|
||||
use crate::{pdu::PduBuilder, ConduitResult, Database, Error, Ruma};
|
||||
use log::info;
|
||||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
|
@ -323,6 +324,8 @@ pub async fn create_room_route(
|
|||
db.rooms.set_public(&room_id, true)?;
|
||||
}
|
||||
|
||||
info!("{} created a room", sender_user);
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(create_room::Response::new(room_id).into())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use super::{State, DEVICE_ID_LENGTH, TOKEN_LENGTH};
|
||||
use crate::{utils, ConduitResult, Database, Error, Ruma};
|
||||
use log::info;
|
||||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
|
@ -93,6 +94,8 @@ pub async fn login_route(
|
|||
body.initial_device_display_name.clone(),
|
||||
)?;
|
||||
|
||||
info!("{} logged in", user_id);
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
Ok(login::Response {
|
||||
|
|
|
@ -39,9 +39,7 @@ impl Database {
|
|||
/// Tries to remove the old database but ignores all errors.
|
||||
pub fn try_remove(server_name: &str) -> Result<()> {
|
||||
let mut path = ProjectDirs::from("xyz", "koesters", "conduit")
|
||||
.ok_or_else(|| Error::bad_config(
|
||||
"The OS didn't return a valid home directory path.",
|
||||
))?
|
||||
.ok_or_else(|| Error::bad_config("The OS didn't return a valid home directory path."))?
|
||||
.data_dir()
|
||||
.to_path_buf();
|
||||
path.push(server_name);
|
||||
|
@ -59,9 +57,9 @@ impl Database {
|
|||
.map(|x| Ok::<_, Error>(x.to_owned()))
|
||||
.unwrap_or_else(|_| {
|
||||
let path = ProjectDirs::from("xyz", "koesters", "conduit")
|
||||
.ok_or_else(|| Error::bad_config(
|
||||
"The OS didn't return a valid home directory path.",
|
||||
))?
|
||||
.ok_or_else(|| {
|
||||
Error::bad_config("The OS didn't return a valid home directory path.")
|
||||
})?
|
||||
.data_dir()
|
||||
.join(server_name);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{time::Duration, collections::HashMap, sync::RwLock, time::Instant};
|
||||
use std::{collections::HashMap, sync::RwLock, time::Duration, time::Instant};
|
||||
|
||||
use log::error;
|
||||
use ruma::{
|
||||
|
|
|
@ -61,9 +61,9 @@ where
|
|||
return Err(Error::bad_config("Federation is disabled."));
|
||||
}
|
||||
|
||||
let resolver = AsyncResolver::tokio_from_system_conf()
|
||||
.await
|
||||
.map_err(|_| Error::bad_config("Failed to set up trust dns resolver with system config."))?;
|
||||
let resolver = AsyncResolver::tokio_from_system_conf().await.map_err(|_| {
|
||||
Error::bad_config("Failed to set up trust dns resolver with system config.")
|
||||
})?;
|
||||
|
||||
let mut host = None;
|
||||
|
||||
|
|
Loading…
Reference in New Issue