1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-06 17:40:59 +00:00

Allow using languages in code blocks.

```yaml
This works now
```
This commit is contained in:
tezlm 2023-10-03 17:07:37 -07:00
parent 032602de58
commit b20f4d6305
No known key found for this signature in database
GPG key ID: 649733FCD94AFBBA

View file

@ -403,7 +403,7 @@ impl Service {
let reply_message_content = match command {
AdminCommand::Appservice(command) => match command {
AppserviceCommand::Register => {
if body.len() > 2 && body[0].trim() == "```" && body.last().unwrap().trim() == "```"
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```"
{
let appservice_config = body[1..body.len() - 1].join("\n");
let parsed_config =
@ -595,7 +595,7 @@ impl Service {
}
},
UserCommand::DeactivateAll { leave_rooms, force } => {
if body.len() > 2 && body[0].trim() == "```" && body.last().unwrap().trim() == "```"
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```"
{
let usernames = body.clone().drain(1..body.len() - 1).collect::<Vec<_>>();
@ -707,7 +707,7 @@ impl Service {
RoomMessageEventContent::text_plain(&msg)
},
FederationCommand::SignJson => {
if body.len() > 2 && body[0].trim() == "```" && body.last().unwrap().trim() == "```"
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```"
{
let string = body[1..body.len() - 1].join("\n");
match serde_json::from_str(&string) {
@ -731,7 +731,7 @@ impl Service {
}
},
FederationCommand::VerifyJson => {
if body.len() > 2 && body[0].trim() == "```" && body.last().unwrap().trim() == "```"
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```"
{
let string = body[1..body.len() - 1].join("\n");
match serde_json::from_str(&string) {
@ -813,7 +813,7 @@ impl Service {
}
},
DebugCommand::ParsePdu => {
if body.len() > 2 && body[0].trim() == "```" && body.last().unwrap().trim() == "```"
if body.len() > 2 && body[0].trim().starts_with("```") && body.last().unwrap().trim() == "```"
{
let string = body[1..body.len() - 1].join("\n");
match serde_json::from_str(&string) {