[add] rewrite target links to paw

This commit is contained in:
hkau 2024-03-31 19:29:32 -04:00
parent 0fea55881c
commit ba8cc7e998
3 changed files with 6 additions and 3 deletions

View File

@ -24,7 +24,7 @@ pub async fn callback_request(info: web::Query<CallbackQueryProps>) -> impl Resp
.append_header(("Content-Type", "text/html"))
.body(
"<head>
<meta http-equiv=\"Refresh\" content=\"0; URL=/d\" />
<meta http-equiv=\"Refresh\" content=\"0; URL=/\" />
</head>",
);
}

View File

@ -68,6 +68,9 @@ pub async fn render_markdown(http_client: Client, input: String, paw: Paw) -> Op
body = body.replace("&lt;style&gt;", "<style>");
body = body.replace("&lt;/style&gt;", "</style>");
// rewrite links
body = body.replace(&paw.target, &format!("/{}", paw.name));
// return
Option::Some(body)
}

View File

@ -76,7 +76,7 @@ pub struct DatabaseReturn {
pub data: HashMap<String, String>,
}
#[derive(Default, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct Paw {
pub name: String,
pub target: String,
@ -84,7 +84,7 @@ pub struct Paw {
pub endpoints: HashMap<String, PawEndpoint>,
}
#[derive(Default, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct PawConfig {
pub is_fake_raw: bool,
pub csrf: bool,