mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-12-22 12:28:21 -05:00
🐛 fix: explicit Content-Type header for HTTP response (#457)
This commit is contained in:
parent
1d9718798f
commit
43357493d5
@ -12,14 +12,16 @@ use std::fs::read_to_string;
|
||||
/// Handles the route of index page or main page of the `websurfx` meta search engine website.
|
||||
#[get("/")]
|
||||
pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
||||
Ok(HttpResponse::Ok().body(
|
||||
crate::templates::views::index::index(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(
|
||||
crate::templates::views::index::index(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
}
|
||||
|
||||
/// Handles the route of any other accessed route/page which is not provided by the
|
||||
@ -52,14 +54,16 @@ pub async fn robots_data(_req: HttpRequest) -> Result<HttpResponse, Box<dyn std:
|
||||
/// Handles the route of about page of the `websurfx` meta search engine website.
|
||||
#[get("/about")]
|
||||
pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
||||
Ok(HttpResponse::Ok().body(
|
||||
crate::templates::views::about::about(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(
|
||||
crate::templates::views::about::about(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
)
|
||||
.0,
|
||||
))
|
||||
}
|
||||
|
||||
/// Handles the route of settings page of the `websurfx` meta search engine website.
|
||||
@ -67,16 +71,18 @@ pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn st
|
||||
pub async fn settings(
|
||||
config: web::Data<Config>,
|
||||
) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
||||
Ok(HttpResponse::Ok().body(
|
||||
crate::templates::views::settings::settings(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
&config
|
||||
.upstream_search_engines
|
||||
.keys()
|
||||
.collect::<Vec<&String>>(),
|
||||
)?
|
||||
.0,
|
||||
))
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(
|
||||
crate::templates::views::settings::settings(
|
||||
&config.style.colorscheme,
|
||||
&config.style.theme,
|
||||
&config.style.animation,
|
||||
&config
|
||||
.upstream_search_engines
|
||||
.keys()
|
||||
.collect::<Vec<&String>>(),
|
||||
)?
|
||||
.0,
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user