fix: opensearch.xml route

This commit is contained in:
Matthew Esposito 2025-03-07 17:08:27 -05:00
parent 357e7c2e09
commit 526c0d0797
2 changed files with 15 additions and 3 deletions

View file

@ -64,6 +64,17 @@ async fn font() -> Result<Response<Body>, String> {
)
}
async fn opensearch() -> Result<Response<Body>, String> {
Ok(
Response::builder()
.status(200)
.header("content-type", "application/opensearchdescription+xml")
.header("Cache-Control", "public, max-age=1209600, s-maxage=86400")
.body(include_bytes!("../static/opensearch.xml").as_ref().into())
.unwrap_or_default(),
)
}
async fn resource(body: &str, content_type: &str, cache: bool) -> Result<Response<Body>, String> {
let mut res = Response::builder()
.status(200)
@ -234,6 +245,7 @@ async fn main() {
app.at("/Inter.var.woff2").get(|_| font().boxed());
app.at("/touch-icon-iphone.png").get(|_| iphone_logo().boxed());
app.at("/apple-touch-icon.png").get(|_| iphone_logo().boxed());
app.at("/opensearch.xml").get(|_| opensearch().boxed());
app
.at("/playHLSVideo.js")
.get(|_| resource(include_str!("../static/playHLSVideo.js"), "text/javascript", false).boxed());