implement search request handler

This commit is contained in:
yggverse 2025-01-19 05:03:07 +02:00
parent 3f4efee60b
commit e669034452
3 changed files with 42 additions and 5 deletions

View file

@ -1,9 +1,10 @@
mod error;
mod feature;
mod gemini;
mod search;
use super::{Client, Response};
use error::Error;
pub use error::Error;
use feature::Feature;
use gtk::{
gio::Cancellable,
@ -47,7 +48,7 @@ impl Request {
feature: feature.unwrap_or_default(),
referrer: referrer.map(Box::new),
uri,
}),
}), // @TODO validate request len by constructor
"titan" => Ok(Self::Titan {
referrer: referrer.map(Box::new),
uri,
@ -105,3 +106,14 @@ impl Request {
1 + count
}
}
// Tools
/// Create new search `Request`
/// @TODO
// * implement DNS lookup before apply this option
// * make search provider optional
// * validate request len by gemini specifications
pub fn search(query: &str) -> Request {
Request::from_uri(search::tgls(query), None, None).unwrap() // no handler as unexpected
}