Use markdown for all errors

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2023-05-07 22:44:38 +05:30
parent bf83c87552
commit 26cc78334a
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -59,9 +59,11 @@ async fn paste_render(data: Data<Template>, paste: Query<Paste>) -> impl Respond
if response_code != "200" { if response_code != "200" {
let resp_struct: GitLabFailedJSON = serde_json::from_str(&response_json).unwrap(); let resp_struct: GitLabFailedJSON = serde_json::from_str(&response_json).unwrap();
if resp_struct.message == "404 Project Not Found" { if resp_struct.message == "404 Project Not Found" {
context.insert("md", "true");
paste_content = "Project ID Mismatch/GitLab Token Missing".to_string(); paste_content = "Project ID Mismatch/GitLab Token Missing".to_string();
} }
else { else {
context.insert("md", "true");
paste_content = "Paste ID is Invalid".to_string(); paste_content = "Paste ID is Invalid".to_string();
} }
} else { } else {
@ -74,7 +76,8 @@ async fn paste_render(data: Data<Template>, paste: Query<Paste>) -> impl Respond
.unwrap(); .unwrap();
} }
} else { } else {
paste_content = "This is a no-nonsense Pastebin Server, written in Rust. It serves the content from files on a GitLab Private Repository. Please look into the repository for hosting your own copy of this".to_string(); context.insert("md", "true");
paste_content = "This is a no-nonsense Pastebin Server, written in Rust. It serves the content from files on a GitLab Private Repository. Please look into the repository for hosting your own copy of this.".to_string();
} }
context.insert("paste_content", &paste_content); context.insert("paste_content", &paste_content);
if paste.parse_md.is_some() { if paste.parse_md.is_some() {