neon_arch commited on
Commit
93afb6b
2 Parent(s): 83c3981 9f5213c

Merge branch 'rolling' into CHORE/461_display-the-user-provided-settings-from-the-config-or-the-ui-in-the-settings-page

Browse files
Files changed (2) hide show
  1. src/server/router.rs +23 -17
  2. src/server/routes/search.rs +12 -10
src/server/router.rs CHANGED
@@ -12,14 +12,16 @@ use std::fs::read_to_string;
12
  /// Handles the route of index page or main page of the `websurfx` meta search engine website.
13
  #[get("/")]
14
  pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
15
- Ok(HttpResponse::Ok().body(
16
- crate::templates::views::index::index(
17
- &config.style.colorscheme,
18
- &config.style.theme,
19
- &config.style.animation,
20
- )
21
- .0,
22
- ))
 
 
23
  }
24
 
25
  /// 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:
52
  /// Handles the route of about page of the `websurfx` meta search engine website.
53
  #[get("/about")]
54
  pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
55
- Ok(HttpResponse::Ok().body(
56
- crate::templates::views::about::about(
57
- &config.style.colorscheme,
58
- &config.style.theme,
59
- &config.style.animation,
60
- )
61
- .0,
62
- ))
 
 
63
  }
64
 
65
  /// Handles the route of settings page of the `websurfx` meta search engine website.
@@ -67,7 +71,9 @@ pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn st
67
  pub async fn settings(
68
  config: web::Data<Config>,
69
  ) -> Result<HttpResponse, Box<dyn std::error::Error>> {
70
- Ok(HttpResponse::Ok().body(
 
 
71
  crate::templates::views::settings::settings(
72
  config.safe_search,
73
  &config.style.colorscheme,
 
12
  /// Handles the route of index page or main page of the `websurfx` meta search engine website.
13
  #[get("/")]
14
  pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
15
+ Ok(HttpResponse::Ok()
16
+ .content_type("text/html; charset=utf-8")
17
+ .body(
18
+ crate::templates::views::index::index(
19
+ &config.style.colorscheme,
20
+ &config.style.theme,
21
+ &config.style.animation,
22
+ )
23
+ .0,
24
+ ))
25
  }
26
 
27
  /// Handles the route of any other accessed route/page which is not provided by the
 
54
  /// Handles the route of about page of the `websurfx` meta search engine website.
55
  #[get("/about")]
56
  pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
57
+ Ok(HttpResponse::Ok()
58
+ .content_type("text/html; charset=utf-8")
59
+ .body(
60
+ crate::templates::views::about::about(
61
+ &config.style.colorscheme,
62
+ &config.style.theme,
63
+ &config.style.animation,
64
+ )
65
+ .0,
66
+ ))
67
  }
68
 
69
  /// Handles the route of settings page of the `websurfx` meta search engine website.
 
71
  pub async fn settings(
72
  config: web::Data<Config>,
73
  ) -> Result<HttpResponse, Box<dyn std::error::Error>> {
74
+ Ok(HttpResponse::Ok()
75
+ .content_type("text/html; charset=utf-8")
76
+ .body(
77
  crate::templates::views::settings::settings(
78
  config.safe_search,
79
  &config.style.colorscheme,
src/server/routes/search.rs CHANGED
@@ -68,16 +68,18 @@ pub async fn search(
68
  get_results(page + 1)
69
  );
70
 
71
- Ok(HttpResponse::Ok().body(
72
- crate::templates::views::search::search(
73
- &config.style.colorscheme,
74
- &config.style.theme,
75
- &config.style.animation,
76
- query,
77
- &results?,
78
- )
79
- .0,
80
- ))
 
 
81
  }
82
  None => Ok(HttpResponse::TemporaryRedirect()
83
  .insert_header(("location", "/"))
 
68
  get_results(page + 1)
69
  );
70
 
71
+ Ok(HttpResponse::Ok()
72
+ .content_type("text/html; charset=utf-8")
73
+ .body(
74
+ crate::templates::views::search::search(
75
+ &config.style.colorscheme,
76
+ &config.style.theme,
77
+ &config.style.animation,
78
+ query,
79
+ &results?,
80
+ )
81
+ .0,
82
+ ))
83
  }
84
  None => Ok(HttpResponse::TemporaryRedirect()
85
  .insert_header(("location", "/"))