diff --git a/src/admin/appservice/commands.rs b/src/admin/appservice/commands.rs
index 5b764296..5cce8351 100644
--- a/src/admin/appservice/commands.rs
+++ b/src/admin/appservice/commands.rs
@@ -1,6 +1,6 @@
use ruma::{api::appservice::Registration, events::room::message::RoomMessageEventContent};
-use crate::{escape_html, services, Result};
+use crate::{services, Result};
pub(super) async fn register(body: Vec<&str>) -> Result {} {} {}
",
- escape_html(&appservice_identifier),
- escape_html(&config_str),
- );
- Ok(RoomMessageEventContent::text_html(output, output_html))
+ Ok(RoomMessageEventContent::notice_markdown(output))
},
None => Ok(RoomMessageEventContent::text_plain("Appservice does not exist.")),
}
diff --git a/src/admin/debug/commands.rs b/src/admin/debug/commands.rs
index 0409af32..40aa0278 100644
--- a/src/admin/debug/commands.rs
+++ b/src/admin/debug/commands.rs
@@ -8,7 +8,6 @@ use api::client::validate_and_add_event_id;
use conduit::{
debug, info, log,
log::{capture, Capture},
- utils::HtmlEscape,
warn, Error, Result,
};
use ruma::{
@@ -93,26 +92,15 @@ pub(super) async fn get_pdu(_body: Vec<&str>, event_id: Box{}
\n",
- if outlier {
- "Outlier PDU found in our database"
- } else {
- "PDU found in our database"
- },
- HtmlEscape(&json_text)
- ),
- ))
+ Ok(RoomMessageEventContent::notice_markdown(format!(
+ "{}\n```json\n{}\n```",
+ if outlier {
+ "Outlier PDU found in our database"
+ } else {
+ "PDU found in our database"
+ },
+ json_text
+ )))
},
None => Ok(RoomMessageEventContent::text_plain("PDU not found locally.")),
}
@@ -237,17 +225,10 @@ pub(super) async fn get_remote_pdu(
let json_text = serde_json::to_string_pretty(&json).expect("canonical json is valid json");
- Ok(RoomMessageEventContent::text_html(
- format!(
- "{}\n```json\n{}\n```",
- "Got PDU from specified server and handled as backfilled PDU successfully. Event body:", json_text
- ),
- format!(
- "{}\n
\n",
- "Got PDU from specified server and handled as backfilled PDU successfully. Event body:",
- HtmlEscape(&json_text)
- ),
- ))
+ Ok(RoomMessageEventContent::notice_markdown(format!(
+ "{}\n```json\n{}\n```",
+ "Got PDU from specified server and handled as backfilled PDU successfully. Event body:", json_text
+ )))
},
Err(e) => Ok(RoomMessageEventContent::text_plain(format!(
"Remote server did not have PDU or failed sending request to remote server: {e}"
@@ -278,14 +259,10 @@ pub(super) async fn get_room_state(_body: Vec<&str>, room_id: Box{}\n
\n",
- "Found full room state",
- HtmlEscape(&json_text)
- ),
- ))
+ Ok(RoomMessageEventContent::notice_markdown(format!(
+ "{}\n```json\n{}\n```",
+ "Found full room state", json_text
+ )))
}
pub(super) async fn ping(_body: Vec<&str>, server: Box{}\n
{}\n
\n",
- HtmlEscape(&json)
- ),
- ));
+ return Ok(RoomMessageEventContent::notice_markdown(format!(
+ "Got response which took {ping_time:?} time:\n```json\n{json}\n```"
+ )));
}
Ok(RoomMessageEventContent::text_plain(format!(
diff --git a/src/admin/federation/commands.rs b/src/admin/federation/commands.rs
index 4084350d..293efdc5 100644
--- a/src/admin/federation/commands.rs
+++ b/src/admin/federation/commands.rs
@@ -2,7 +2,7 @@ use std::fmt::Write;
use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomId, RoomId, ServerName, UserId};
-use crate::{escape_html, get_room_info, services, utils::HtmlEscape, Result};
+use crate::{escape_html, get_room_info, services, Result};
pub(super) async fn disable_room(_body: Vec<&str>, room_id: BoxGot JSON response:
\n{}\n
\n",
- HtmlEscape(&pretty_json)
- ),
- ))
+ Ok(RoomMessageEventContent::notice_markdown(format!(
+ "Got JSON response:\n\n```json\n{pretty_json}\n```"
+ )))
}
pub(super) async fn remote_user_in_rooms(_body: Vec<&str>, user_id: Box\n{error}\n",); - - RoomMessageEventContent::text_html(markdown_message, html_message) + RoomMessageEventContent::notice_markdown(markdown_message) }, } } diff --git a/src/admin/room/room_info_commands.rs b/src/admin/room/room_info_commands.rs index 3b35d82c..d985fb87 100644 --- a/src/admin/room/room_info_commands.rs +++ b/src/admin/room/room_info_commands.rs @@ -1,10 +1,8 @@ -use std::fmt::Write; - use ruma::{events::room::message::RoomMessageEventContent, RoomId}; use service::services; use super::RoomInfoCommand; -use crate::{escape_html, Result}; +use crate::Result; pub(super) async fn process(command: RoomInfoCommand, body: Vec<&str>) -> Result
id | \tmembers | \tname |
---|
Found {} local user account(s):
", users.len());
- html_msg += &users.join("\n");
- html_msg += "\n
";
- Ok(RoomMessageEventContent::text_html(&plain_msg, &html_msg))
+ Ok(RoomMessageEventContent::notice_markdown(plain_msg))
},
Err(e) => Ok(RoomMessageEventContent::text_plain(e.to_string())),
}
@@ -419,8 +416,8 @@ pub(super) async fn get_room_tags(
|e| serde_json::from_str(e.get()).expect("Bad account data in database for user {user_id}"),
);
- Ok(RoomMessageEventContent::text_html(
- format!("\n{:?}\n
", tags_event.content.tags),
- format!("```\n{:?}\n```", tags_event.content.tags),
- ))
+ Ok(RoomMessageEventContent::notice_markdown(format!(
+ "```\n{:#?}\n```",
+ tags_event.content.tags
+ )))
}
diff --git a/src/admin/utils.rs b/src/admin/utils.rs
index 4c30e5a8..91982fe3 100644
--- a/src/admin/utils.rs
+++ b/src/admin/utils.rs
@@ -1,4 +1,3 @@
-pub(crate) use conduit::utils::HtmlEscape;
use conduit_core::Error;
use ruma::{OwnedRoomId, OwnedUserId, RoomId, UserId};
use service::user_is_local;