2024-06-16 22:26:52 +00:00
|
|
|
mod commands;
|
2024-06-23 09:06:25 +00:00
|
|
|
pub(crate) mod tester;
|
2024-06-16 22:26:52 +00:00
|
|
|
|
2024-04-20 17:59:54 -04:00
|
|
|
use clap::Subcommand;
|
2024-12-14 21:58:01 -05:00
|
|
|
use conduwuit::Result;
|
2026-10-31 20:55:08 +00:00
|
|
|
use ruma::{OwnedEventId, OwnedRoomId, OwnedServerName};
|
2024-04-20 17:59:54 -04:00
|
|
|
|
2024-07-27 00:11:41 +00:00
|
|
|
use self::tester::TesterCommand;
|
|
|
|
|
use crate::admin_command_dispatch;
|
2024-04-20 17:59:54 -04:00
|
|
|
|
2024-07-24 00:14:03 +00:00
|
|
|
#[admin_command_dispatch]
|
2024-07-24 00:13:03 +00:00
|
|
|
#[derive(Debug, Subcommand)]
|
2025-05-24 00:28:09 +01:00
|
|
|
pub enum DebugCommand {
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Echo input of admin command
|
2024-06-16 02:14:19 +00:00
|
|
|
Echo {
|
|
|
|
|
message: Vec<String>,
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Parse and print a PDU from a JSON
|
2024-04-20 17:59:54 -04:00
|
|
|
///
|
|
|
|
|
/// The PDU event is only checked for validity and is not added to the
|
|
|
|
|
/// database.
|
|
|
|
|
///
|
|
|
|
|
/// This command needs a JSON blob provided in a Markdown code block below
|
|
|
|
|
/// the command.
|
|
|
|
|
ParsePdu,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Forces device lists for all local and remote users to be updated (as
|
2024-04-20 17:59:54 -04:00
|
|
|
/// having new keys available)
|
|
|
|
|
ForceDeviceListUpdates,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Change tracing log level/filter on the fly
|
2024-04-20 17:59:54 -04:00
|
|
|
///
|
|
|
|
|
/// This accepts the same format as the `log` config option.
|
|
|
|
|
ChangeLogLevel {
|
|
|
|
|
/// Log level/filter
|
|
|
|
|
filter: Option<String>,
|
|
|
|
|
|
|
|
|
|
/// Resets the log level/filter to the one in your config
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
reset: bool,
|
|
|
|
|
},
|
2024-04-21 15:12:22 -04:00
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Verify JSON signatures
|
2024-04-21 15:12:22 -04:00
|
|
|
///
|
|
|
|
|
/// This command needs a JSON blob provided in a Markdown code block below
|
|
|
|
|
/// the command.
|
|
|
|
|
VerifyJson,
|
2024-04-26 23:36:23 -04:00
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Verify PDU
|
2024-10-11 18:57:59 +00:00
|
|
|
///
|
|
|
|
|
/// This re-verifies a PDU existing in the database found by ID.
|
|
|
|
|
VerifyPdu {
|
2025-04-08 04:39:01 +00:00
|
|
|
event_id: OwnedEventId,
|
2024-10-11 18:57:59 +00:00
|
|
|
},
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Forcefully replaces the room state of our local copy of the specified
|
2024-06-07 18:35:48 -04:00
|
|
|
/// room, with the copy (auth chain and room state events) the specified
|
|
|
|
|
/// remote server says.
|
|
|
|
|
///
|
|
|
|
|
/// A common desire for room deletion is to simply "reset" our copy of the
|
|
|
|
|
/// room. While this admin command is not a replacement for that, if you
|
|
|
|
|
/// know you have split/broken room state and you know another server in the
|
|
|
|
|
/// room that has the best/working room state, this command can let you use
|
|
|
|
|
/// their room state. Such example is your server saying users are in a
|
|
|
|
|
/// room, but other servers are saying they're not in the room in question.
|
|
|
|
|
///
|
|
|
|
|
/// This command will get the latest PDU in the room we know about, and
|
|
|
|
|
/// request the room state at that point in time via
|
|
|
|
|
/// `/_matrix/federation/v1/state/{roomId}`.
|
|
|
|
|
ForceSetRoomStateFromServer {
|
|
|
|
|
/// The impacted room ID
|
2025-04-08 04:39:01 +00:00
|
|
|
room_id: OwnedRoomId,
|
2024-06-07 18:35:48 -04:00
|
|
|
/// The server we will use to query the room state for
|
2025-04-08 04:39:01 +00:00
|
|
|
server_name: OwnedServerName,
|
2025-06-19 21:27:50 +00:00
|
|
|
/// The event ID of the latest known PDU in the room. Will be found
|
|
|
|
|
/// automatically if not provided.
|
|
|
|
|
event_id: Option<OwnedEventId>,
|
2024-06-07 18:35:48 -04:00
|
|
|
},
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Runs a server name through Continuwuity's true destination resolution
|
2024-04-26 23:36:23 -04:00
|
|
|
/// process
|
|
|
|
|
///
|
|
|
|
|
/// Useful for debugging well-known issues
|
|
|
|
|
ResolveTrueDestination {
|
2025-04-08 04:39:01 +00:00
|
|
|
server_name: OwnedServerName,
|
2024-04-26 23:36:23 -04:00
|
|
|
|
|
|
|
|
#[arg(short, long)]
|
|
|
|
|
no_cache: bool,
|
|
|
|
|
},
|
2024-04-27 04:50:20 -07:00
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Print extended memory usage
|
2025-01-18 01:32:37 +00:00
|
|
|
///
|
|
|
|
|
/// Optional argument is a character mask (a sequence of characters in any
|
|
|
|
|
/// order) which enable additional extended statistics. Known characters are
|
|
|
|
|
/// "abdeglmx". For convenience, a '*' will enable everything.
|
|
|
|
|
MemoryStats {
|
|
|
|
|
opts: Option<String>,
|
|
|
|
|
},
|
2024-06-23 09:06:25 +00:00
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Print general tokio runtime metric totals.
|
2024-06-25 05:05:02 +00:00
|
|
|
RuntimeMetrics,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Print detailed tokio runtime metrics accumulated since last command
|
2024-06-25 05:05:02 +00:00
|
|
|
/// invocation.
|
|
|
|
|
RuntimeInterval,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Print the current time
|
2024-07-24 00:15:03 +00:00
|
|
|
Time,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Get database statistics
|
2024-08-02 01:40:41 +00:00
|
|
|
DatabaseStats {
|
|
|
|
|
property: Option<String>,
|
|
|
|
|
|
|
|
|
|
#[arg(short, long, alias("column"))]
|
|
|
|
|
map: Option<String>,
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Trim memory usage
|
2025-01-16 08:58:40 +00:00
|
|
|
TrimMemory,
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// List database files
|
2025-01-29 21:10:33 +00:00
|
|
|
DatabaseFiles {
|
|
|
|
|
map: Option<String>,
|
|
|
|
|
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
level: Option<i32>,
|
|
|
|
|
},
|
|
|
|
|
|
2026-03-22 11:46:26 -04:00
|
|
|
/// Send a test email to the invoking admin's email address
|
|
|
|
|
SendTestEmail,
|
|
|
|
|
|
2026-06-17 17:59:28 +01:00
|
|
|
/// Lists room IDs by forward extremity count in descending order
|
|
|
|
|
RoomsByExtremityCount {
|
|
|
|
|
page: Option<usize>,
|
|
|
|
|
},
|
|
|
|
|
|
2026-01-12 10:47:19 -05:00
|
|
|
/// Developer test stubs
|
2024-06-23 09:06:25 +00:00
|
|
|
#[command(subcommand)]
|
2024-07-24 00:14:03 +00:00
|
|
|
#[allow(non_snake_case)]
|
2024-08-28 04:09:46 +00:00
|
|
|
#[clap(hide(true))]
|
2024-06-23 09:06:25 +00:00
|
|
|
Tester(TesterCommand),
|
2024-04-20 17:59:54 -04:00
|
|
|
}
|