mirror of
https://github.com/YGGverse/btracker-gemini.git
synced 2026-03-31 17:15:30 +00:00
init search route
This commit is contained in:
parent
6052cdb3dd
commit
277667cdca
1 changed files with 20 additions and 0 deletions
20
src/main.rs
20
src/main.rs
|
|
@ -194,6 +194,24 @@ fn response(
|
|||
},
|
||||
)
|
||||
}
|
||||
// try search
|
||||
else if p == "search" {
|
||||
send(
|
||||
&response::Input::Default(response::input::Default {
|
||||
message: Some("Keyword, file, hash...".into()),
|
||||
})
|
||||
.into_bytes(),
|
||||
stream,
|
||||
|result| {
|
||||
if let Err(e) = result {
|
||||
error!(
|
||||
"Internal server error on handle peer `{peer}` request `{}`: `{e}`",
|
||||
request.url.as_str()
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
// try info page
|
||||
else if let Ok(id) = Id20::from_str(p)
|
||||
&& let Some(torrent) = public.torrent(id)
|
||||
|
|
@ -337,6 +355,8 @@ fn index(config: &Config, public: &Public, page: Option<usize>) -> Result<String
|
|||
b.push(format!("=> /?page={} Next", page.map_or(2, |p| p + 1)))
|
||||
}
|
||||
|
||||
b.push("\n=> /search Search".into());
|
||||
|
||||
Ok(b.join("\n"))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue