mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-12 01:13:01 +02:00
remove box ids from admin room command arguments
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
83126cc667
commit
b3e5d2f683
20 changed files with 128 additions and 129 deletions
|
@ -17,10 +17,9 @@ use conduwuit::{
|
|||
};
|
||||
use futures::{FutureExt, StreamExt, TryStreamExt};
|
||||
use ruma::{
|
||||
CanonicalJsonObject, EventId, OwnedEventId, OwnedRoomOrAliasId, RoomId, RoomVersionId,
|
||||
ServerName,
|
||||
api::{client::error::ErrorKind, federation::event::get_room_state},
|
||||
events::room::message::RoomMessageEventContent,
|
||||
CanonicalJsonObject, CanonicalJsonValue, EventId, OwnedEventId, OwnedRoomId,
|
||||
OwnedRoomOrAliasId, OwnedServerName, RoomId, RoomVersionId,
|
||||
api::federation::event::get_room_state, events::room::message::RoomMessageEventContent,
|
||||
};
|
||||
use service::rooms::{
|
||||
short::{ShortEventId, ShortRoomId},
|
||||
|
@ -40,7 +39,7 @@ pub(super) async fn echo(&self, message: Vec<String>) -> Result<RoomMessageEvent
|
|||
#[admin_command]
|
||||
pub(super) async fn get_auth_chain(
|
||||
&self,
|
||||
event_id: Box<EventId>,
|
||||
event_id: OwnedEventId,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
let Ok(event) = self.services.rooms.timeline.get_pdu_json(&event_id).await else {
|
||||
return Ok(RoomMessageEventContent::notice_plain("Event not found."));
|
||||
|
@ -109,7 +108,7 @@ pub(super) async fn parse_pdu(&self) -> Result<RoomMessageEventContent> {
|
|||
}
|
||||
|
||||
#[admin_command]
|
||||
pub(super) async fn get_pdu(&self, event_id: Box<EventId>) -> Result<RoomMessageEventContent> {
|
||||
pub(super) async fn get_pdu(&self, event_id: OwnedEventId) -> Result<RoomMessageEventContent> {
|
||||
let mut outlier = false;
|
||||
let mut pdu_json = self
|
||||
.services
|
||||
|
@ -173,7 +172,7 @@ pub(super) async fn get_short_pdu(
|
|||
#[admin_command]
|
||||
pub(super) async fn get_remote_pdu_list(
|
||||
&self,
|
||||
server: Box<ServerName>,
|
||||
server: OwnedServerName,
|
||||
force: bool,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if !self.services.server.config.allow_federation {
|
||||
|
@ -359,7 +358,7 @@ pub(super) async fn get_room_state(
|
|||
}
|
||||
|
||||
#[admin_command]
|
||||
pub(super) async fn ping(&self, server: Box<ServerName>) -> Result<RoomMessageEventContent> {
|
||||
pub(super) async fn ping(&self, server: OwnedServerName) -> Result<RoomMessageEventContent> {
|
||||
if server == self.services.globals.server_name() {
|
||||
return Ok(RoomMessageEventContent::text_plain(
|
||||
"Not allowed to send federation requests to ourselves.",
|
||||
|
@ -538,7 +537,7 @@ pub(super) async fn verify_json(&self) -> Result<RoomMessageEventContent> {
|
|||
}
|
||||
|
||||
#[admin_command]
|
||||
pub(super) async fn verify_pdu(&self, event_id: Box<EventId>) -> Result<RoomMessageEventContent> {
|
||||
pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result<RoomMessageEventContent> {
|
||||
let mut event = self.services.rooms.timeline.get_pdu_json(&event_id).await?;
|
||||
|
||||
event.remove("event_id");
|
||||
|
@ -556,7 +555,7 @@ pub(super) async fn verify_pdu(&self, event_id: Box<EventId>) -> Result<RoomMess
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(super) async fn first_pdu_in_room(
|
||||
&self,
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if !self
|
||||
.services
|
||||
|
@ -585,7 +584,7 @@ pub(super) async fn first_pdu_in_room(
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(super) async fn latest_pdu_in_room(
|
||||
&self,
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if !self
|
||||
.services
|
||||
|
@ -614,8 +613,8 @@ pub(super) async fn latest_pdu_in_room(
|
|||
#[tracing::instrument(skip(self))]
|
||||
pub(super) async fn force_set_room_state_from_server(
|
||||
&self,
|
||||
room_id: Box<RoomId>,
|
||||
server_name: Box<ServerName>,
|
||||
room_id: OwnedRoomId,
|
||||
server_name: OwnedServerName,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if !self
|
||||
.services
|
||||
|
@ -763,8 +762,8 @@ pub(super) async fn force_set_room_state_from_server(
|
|||
#[admin_command]
|
||||
pub(super) async fn get_signing_keys(
|
||||
&self,
|
||||
server_name: Option<Box<ServerName>>,
|
||||
notary: Option<Box<ServerName>>,
|
||||
server_name: Option<OwnedServerName>,
|
||||
notary: Option<OwnedServerName>,
|
||||
query: bool,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone().into());
|
||||
|
@ -801,7 +800,7 @@ pub(super) async fn get_signing_keys(
|
|||
#[admin_command]
|
||||
pub(super) async fn get_verify_keys(
|
||||
&self,
|
||||
server_name: Option<Box<ServerName>>,
|
||||
server_name: Option<OwnedServerName>,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
let server_name = server_name.unwrap_or_else(|| self.services.server.name.clone().into());
|
||||
|
||||
|
@ -824,7 +823,7 @@ pub(super) async fn get_verify_keys(
|
|||
#[admin_command]
|
||||
pub(super) async fn resolve_true_destination(
|
||||
&self,
|
||||
server_name: Box<ServerName>,
|
||||
server_name: OwnedServerName,
|
||||
no_cache: bool,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if !self.services.server.config.allow_federation {
|
||||
|
|
|
@ -3,7 +3,7 @@ pub(crate) mod tester;
|
|||
|
||||
use clap::Subcommand;
|
||||
use conduwuit::Result;
|
||||
use ruma::{EventId, OwnedRoomOrAliasId, RoomId, ServerName};
|
||||
use ruma::{OwnedEventId, OwnedRoomId, OwnedRoomOrAliasId, OwnedServerName};
|
||||
use service::rooms::short::{ShortEventId, ShortRoomId};
|
||||
|
||||
use self::tester::TesterCommand;
|
||||
|
@ -20,7 +20,7 @@ pub(super) enum DebugCommand {
|
|||
/// - Get the auth_chain of a PDU
|
||||
GetAuthChain {
|
||||
/// An event ID (the $ character followed by the base64 reference hash)
|
||||
event_id: Box<EventId>,
|
||||
event_id: OwnedEventId,
|
||||
},
|
||||
|
||||
/// - Parse and print a PDU from a JSON
|
||||
|
@ -35,7 +35,7 @@ pub(super) enum DebugCommand {
|
|||
/// - Retrieve and print a PDU by EventID from the conduwuit database
|
||||
GetPdu {
|
||||
/// An event ID (a $ followed by the base64 reference hash)
|
||||
event_id: Box<EventId>,
|
||||
event_id: OwnedEventId,
|
||||
},
|
||||
|
||||
/// - Retrieve and print a PDU by PduId from the conduwuit database
|
||||
|
@ -52,11 +52,11 @@ pub(super) enum DebugCommand {
|
|||
/// (following normal event auth rules, handles it as an incoming PDU).
|
||||
GetRemotePdu {
|
||||
/// An event ID (a $ followed by the base64 reference hash)
|
||||
event_id: Box<EventId>,
|
||||
event_id: OwnedEventId,
|
||||
|
||||
/// Argument for us to attempt to fetch the event from the
|
||||
/// specified remote server.
|
||||
server: Box<ServerName>,
|
||||
server: OwnedServerName,
|
||||
},
|
||||
|
||||
/// - Same as `get-remote-pdu` but accepts a codeblock newline delimited
|
||||
|
@ -64,7 +64,7 @@ pub(super) enum DebugCommand {
|
|||
GetRemotePduList {
|
||||
/// Argument for us to attempt to fetch all the events from the
|
||||
/// specified remote server.
|
||||
server: Box<ServerName>,
|
||||
server: OwnedServerName,
|
||||
|
||||
/// If set, ignores errors, else stops at the first error/failure.
|
||||
#[arg(short, long)]
|
||||
|
@ -88,10 +88,10 @@ pub(super) enum DebugCommand {
|
|||
|
||||
/// - Get and display signing keys from local cache or remote server.
|
||||
GetSigningKeys {
|
||||
server_name: Option<Box<ServerName>>,
|
||||
server_name: Option<OwnedServerName>,
|
||||
|
||||
#[arg(long)]
|
||||
notary: Option<Box<ServerName>>,
|
||||
notary: Option<OwnedServerName>,
|
||||
|
||||
#[arg(short, long)]
|
||||
query: bool,
|
||||
|
@ -99,14 +99,14 @@ pub(super) enum DebugCommand {
|
|||
|
||||
/// - Get and display signing keys from local cache or remote server.
|
||||
GetVerifyKeys {
|
||||
server_name: Option<Box<ServerName>>,
|
||||
server_name: Option<OwnedServerName>,
|
||||
},
|
||||
|
||||
/// - Sends a federation request to the remote server's
|
||||
/// `/_matrix/federation/v1/version` endpoint and measures the latency it
|
||||
/// took for the server to respond
|
||||
Ping {
|
||||
server: Box<ServerName>,
|
||||
server: OwnedServerName,
|
||||
},
|
||||
|
||||
/// - Forces device lists for all local and remote users to be updated (as
|
||||
|
@ -141,21 +141,21 @@ pub(super) enum DebugCommand {
|
|||
///
|
||||
/// This re-verifies a PDU existing in the database found by ID.
|
||||
VerifyPdu {
|
||||
event_id: Box<EventId>,
|
||||
event_id: OwnedEventId,
|
||||
},
|
||||
|
||||
/// - Prints the very first PDU in the specified room (typically
|
||||
/// m.room.create)
|
||||
FirstPduInRoom {
|
||||
/// The room ID
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
},
|
||||
|
||||
/// - Prints the latest ("last") PDU in the specified room (typically a
|
||||
/// message)
|
||||
LatestPduInRoom {
|
||||
/// The room ID
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
},
|
||||
|
||||
/// - Forcefully replaces the room state of our local copy of the specified
|
||||
|
@ -174,9 +174,9 @@ pub(super) enum DebugCommand {
|
|||
/// `/_matrix/federation/v1/state/{roomId}`.
|
||||
ForceSetRoomStateFromServer {
|
||||
/// The impacted room ID
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
/// The server we will use to query the room state for
|
||||
server_name: Box<ServerName>,
|
||||
server_name: OwnedServerName,
|
||||
},
|
||||
|
||||
/// - Runs a server name through conduwuit's true destination resolution
|
||||
|
@ -184,7 +184,7 @@ pub(super) enum DebugCommand {
|
|||
///
|
||||
/// Useful for debugging well-known issues
|
||||
ResolveTrueDestination {
|
||||
server_name: Box<ServerName>,
|
||||
server_name: OwnedServerName,
|
||||
|
||||
#[arg(short, long)]
|
||||
no_cache: bool,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue