Gemention/src/comments.rs

30 lines
909 B
Rust

use crate::verification::verify;
use fluffer::Client;
// Receive a mention over Titan.
// - Make Gemini request to see if target page supports gemention.
// - If so, store mention in DB.
pub(crate) async fn receive_mention(client: Client) -> String {
let titan = match client.titan {
Some(ref titan) => titan,
_ => return "".to_string(),
};
let target = client.parameter("target").unwrap_or("not provided");
let verified = verify(&target).await;
format!(
"Target: {}\nVerification status: {}\nSize: {}\nMime: {}\nContent: {}\nToken: {}",
target,
verified.to_string(),
titan.size,
titan.mime,
std::str::from_utf8(&titan.content).unwrap_or("[not utf8]"),
titan.token.as_deref().unwrap_or("[no token]"),
)
}
// Render comments gemtext by requesting comments for a page.
// Proxy a webmention to Titan endpoint.