neon_arch commited on
Commit
71fae8b
1 Parent(s): 4a505fb

add more colorschemes, fix tests and improve documentation

Browse files
public/static/colorschemes/catppuccin-mocha.css CHANGED
@@ -1,5 +1,4 @@
1
  :root {
2
- /* catppuccin-mocha colorscheme */
3
  --bg: #1e1e2e;
4
  --fg: #cdd6f4;
5
  --1: #45475a;
 
1
  :root {
 
2
  --bg: #1e1e2e;
3
  --fg: #cdd6f4;
4
  --1: #45475a;
public/static/colorschemes/dracula.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #44475a;
3
+ --fg: #8be9fd;
4
+ --1: #ff5555;
5
+ --2: #50fa7b;
6
+ --3: #ffb86c;
7
+ --4: #bd93f9;
8
+ --5: #ff79c6;
9
+ --6: #94a3a5;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/gruvbox-dark.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #282828;
3
+ --fg: #ebdbb2;
4
+ --1: #cc241d;
5
+ --2: #98971a;
6
+ --3: #d79921;
7
+ --4: #458588;
8
+ --5: #b16286;
9
+ --6: #689d6a;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/monokai.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #403e41;
3
+ --fg: #fcfcfa;
4
+ --1: #ff6188;
5
+ --2: #a9dc76;
6
+ --3: #ffd866;
7
+ --4: #fc9867;
8
+ --5: #ab9df2;
9
+ --6: #78dce8;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/nord.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #2e3440;
3
+ --fg: #d8dee9;
4
+ --1: #3b4252;
5
+ --2: #bf616a;
6
+ --3: #a3be8c;
7
+ --4: #ebcb8b;
8
+ --5: #81a1c1;
9
+ --6: #b48ead;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/oceanic-next.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #1b2b34;
3
+ --fg: #d8dee9;
4
+ --1: #343d46;
5
+ --2: #ec5f67;
6
+ --3: #99c794;
7
+ --4: #fac863;
8
+ --5: #6699cc;
9
+ --6: #c594c5;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/solarized-dark.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #002b36;
3
+ --fg: #839496;
4
+ --1: #073642;
5
+ --2: #dc322f;
6
+ --3: #859900;
7
+ --4: #b58900;
8
+ --5: #268bd2;
9
+ --6: #d33682;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/solarized-light.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #fdf6e3;
3
+ --fg: #657b83;
4
+ --1: #073642;
5
+ --2: #dc322f;
6
+ --3: #859900;
7
+ --4: #b58900;
8
+ --5: #268bd2;
9
+ --6: #d33682;
10
+ --7: #ffffff;
11
+ }
public/static/colorschemes/tomorrow-night.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --bg: #1d1f21;
3
+ --fg: #c5c8c6;
4
+ --1: #cc6666;
5
+ --2: #b5bd68;
6
+ --3: #f0c674;
7
+ --4: #81a2be;
8
+ --5: #b294bb;
9
+ --6: #8abeb7;
10
+ --7: #ffffff;
11
+ }
src/lib.rs CHANGED
@@ -29,8 +29,9 @@ use handlebars::Handlebars;
29
  ///
30
  /// ```rust
31
  /// use std::net::TcpListener;
32
- /// use websurfx::run;
33
  ///
 
34
  /// let listener = TcpListener::bind("127.0.0.1:8080").expect("Failed to bind address");
35
  /// let server = run(listener,config).expect("Failed to start server");
36
  /// ```
 
29
  ///
30
  /// ```rust
31
  /// use std::net::TcpListener;
32
+ /// use websurfx::{config_parser::parser::Config, run};
33
  ///
34
+ /// let config = Config::parse().unwrap();
35
  /// let listener = TcpListener::bind("127.0.0.1:8080").expect("Failed to bind address");
36
  /// let server = run(listener,config).expect("Failed to start server");
37
  /// ```
src/search_results_handler/aggregation_models.rs CHANGED
@@ -3,7 +3,7 @@
3
 
4
  use serde::Serialize;
5
 
6
- use crate::config_parser::parser::Style;
7
 
8
  /// A named struct to store and serialize the individual search result from all the scraped
9
  /// and aggregated search results from the upstream search engines.
 
3
 
4
  use serde::Serialize;
5
 
6
+ use crate::config_parser::parser_models::Style;
7
 
8
  /// A named struct to store and serialize the individual search result from all the scraped
9
  /// and aggregated search results from the upstream search engines.
tests/index.rs CHANGED
@@ -1,15 +1,15 @@
1
  use std::net::TcpListener;
2
 
3
  use handlebars::Handlebars;
4
- use websurfx::run;
5
-
6
 
7
  // Starts a new instance of the HTTP server, bound to a random available port
8
  fn spawn_app() -> String {
9
  // Binding to port 0 will trigger the OS to assign a port for us.
10
  let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
11
  let port = listener.local_addr().unwrap().port();
12
- let server = run(listener).expect("Failed to bind address");
 
13
 
14
  tokio::spawn(server);
15
  format!("http://127.0.0.1:{}/", port)
@@ -27,7 +27,6 @@ fn handlebars() -> Handlebars<'static> {
27
  handlebars
28
  }
29
 
30
-
31
  #[tokio::test]
32
  async fn test_index() {
33
  let address = spawn_app();
@@ -35,8 +34,10 @@ async fn test_index() {
35
  let client = reqwest::Client::new();
36
  let res = client.get(address).send().await.unwrap();
37
  assert_eq!(res.status(), 200);
38
-
39
  let handlebars = handlebars();
40
- let template = handlebars.render("index", &()).unwrap();
 
41
  assert_eq!(res.text().await.unwrap(), template);
42
- }
 
 
1
  use std::net::TcpListener;
2
 
3
  use handlebars::Handlebars;
4
+ use websurfx::{config_parser::parser::Config, run};
 
5
 
6
  // Starts a new instance of the HTTP server, bound to a random available port
7
  fn spawn_app() -> String {
8
  // Binding to port 0 will trigger the OS to assign a port for us.
9
  let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
10
  let port = listener.local_addr().unwrap().port();
11
+ let config = Config::parse().unwrap();
12
+ let server = run(listener, config).expect("Failed to bind address");
13
 
14
  tokio::spawn(server);
15
  format!("http://127.0.0.1:{}/", port)
 
27
  handlebars
28
  }
29
 
 
30
  #[tokio::test]
31
  async fn test_index() {
32
  let address = spawn_app();
 
34
  let client = reqwest::Client::new();
35
  let res = client.get(address).send().await.unwrap();
36
  assert_eq!(res.status(), 200);
37
+
38
  let handlebars = handlebars();
39
+ let config = Config::parse().unwrap();
40
+ let template = handlebars.render("index", &config.style).unwrap();
41
  assert_eq!(res.text().await.unwrap(), template);
42
+ }
43
+
websurfx/config.lua CHANGED
@@ -3,5 +3,16 @@ port = "8080" -- port on which server should be launched
3
  binding_ip_addr = "127.0.0.1" --ip address on the which server should be launched.
4
 
5
  -- Website
 
 
 
 
 
 
 
 
 
 
 
6
  colorscheme = "catppuccin-mocha" -- the colorscheme name which should be used for the website theme
7
  theme = "simple" -- the theme name which should be used for the website
 
3
  binding_ip_addr = "127.0.0.1" --ip address on the which server should be launched.
4
 
5
  -- Website
6
+ -- The different colorschemes provided are:
7
+ -- {{
8
+ -- catppuccin-mocha
9
+ -- dracula
10
+ -- monokai
11
+ -- nord
12
+ -- oceanic-next
13
+ -- solarized-dark
14
+ -- solarized-light
15
+ -- tomorrow-night
16
+ -- }}
17
  colorscheme = "catppuccin-mocha" -- the colorscheme name which should be used for the website theme
18
  theme = "simple" -- the theme name which should be used for the website