Remove admin check
This was non-functional for over a year
This commit is contained in:
@@ -3,7 +3,6 @@ use tuwunel_core::Result;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
appservice::{self, AppserviceCommand},
|
appservice::{self, AppserviceCommand},
|
||||||
check::{self, CheckCommand},
|
|
||||||
context::Context,
|
context::Context,
|
||||||
debug::{self, DebugCommand},
|
debug::{self, DebugCommand},
|
||||||
federation::{self, FederationCommand},
|
federation::{self, FederationCommand},
|
||||||
@@ -42,10 +41,6 @@ pub(super) enum AdminCommand {
|
|||||||
/// - Commands for managing media
|
/// - Commands for managing media
|
||||||
Media(MediaCommand),
|
Media(MediaCommand),
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
/// - Commands for checking integrity
|
|
||||||
Check(CheckCommand),
|
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
/// - Commands for debugging things
|
/// - Commands for debugging things
|
||||||
Debug(DebugCommand),
|
Debug(DebugCommand),
|
||||||
@@ -72,7 +67,6 @@ pub(super) async fn process(command: AdminCommand, context: &Context<'_>) -> Res
|
|||||||
| Server(command) => server::process(command, context).await,
|
| Server(command) => server::process(command, context).await,
|
||||||
| Debug(command) => debug::process(command, context).await,
|
| Debug(command) => debug::process(command, context).await,
|
||||||
| Query(command) => query::process(command, context).await,
|
| Query(command) => query::process(command, context).await,
|
||||||
| Check(command) => check::process(command, context).await,
|
|
||||||
| Token(command) => token::process(command, context).await,
|
| Token(command) => token::process(command, context).await,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
use futures::StreamExt;
|
|
||||||
use tuwunel_core::Result;
|
|
||||||
use tuwunel_macros::implement;
|
|
||||||
|
|
||||||
use crate::Context;
|
|
||||||
|
|
||||||
/// Uses the iterator in `src/database/key_value/users.rs` to iterator over
|
|
||||||
/// every user in our database (remote and local). Reports total count, any
|
|
||||||
/// errors if there were any, etc
|
|
||||||
#[implement(Context, params = "<'_>")]
|
|
||||||
pub(super) async fn check_all_users(&self) -> Result {
|
|
||||||
let timer = tokio::time::Instant::now();
|
|
||||||
let users = self
|
|
||||||
.services
|
|
||||||
.users
|
|
||||||
.stream()
|
|
||||||
.map(ToOwned::to_owned)
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.await;
|
|
||||||
let query_time = timer.elapsed();
|
|
||||||
|
|
||||||
let total = users.len();
|
|
||||||
let err_count = users.iter().filter(|_user| false).count();
|
|
||||||
let ok_count = users.iter().filter(|_user| true).count();
|
|
||||||
|
|
||||||
self.write_str(&format!(
|
|
||||||
"Database query completed in {query_time:?}:\n\n```\nTotal entries: \
|
|
||||||
{total:?}\nFailure/Invalid user count: {err_count:?}\nSuccess/Valid user count: \
|
|
||||||
{ok_count:?}\n```"
|
|
||||||
))
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
mod commands;
|
|
||||||
|
|
||||||
use clap::Subcommand;
|
|
||||||
use tuwunel_core::Result;
|
|
||||||
|
|
||||||
use crate::admin_command_dispatch;
|
|
||||||
|
|
||||||
#[admin_command_dispatch]
|
|
||||||
#[derive(Debug, Subcommand)]
|
|
||||||
pub(super) enum CheckCommand {
|
|
||||||
CheckAllUsers,
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ mod tests;
|
|||||||
pub(crate) mod utils;
|
pub(crate) mod utils;
|
||||||
|
|
||||||
pub(crate) mod appservice;
|
pub(crate) mod appservice;
|
||||||
pub(crate) mod check;
|
|
||||||
pub(crate) mod debug;
|
pub(crate) mod debug;
|
||||||
pub(crate) mod federation;
|
pub(crate) mod federation;
|
||||||
pub(crate) mod media;
|
pub(crate) mod media;
|
||||||
|
|||||||
Reference in New Issue
Block a user