Gemention/src/comments.rs

22 lines
766 B
Rust

use crate::error::GementionError;
use crate::models::mentions::{Mention, MentionUpload};
use crate::models::web::MentionResponse;
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) -> Result<MentionResponse, GementionError> {
// TODO change to return MentionResponse or something like that.
let titan = MentionUpload::try_from(&client)?;
let mut mention = Mention::try_from(titan)?;
verify(&mut mention).await?;
Ok(MentionResponse::from(mention))
}
// Render comments gemtext by requesting comments for a page.
// Proxy a webmention to Titan endpoint.