0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-12-22 04:18:21 -05:00

add more colorschemes, fix tests and improve documentation

This commit is contained in:
neon_arch 2023-04-30 20:04:31 +03:00
parent 4a505fb1d5
commit 71fae8b496
13 changed files with 110 additions and 10 deletions

View File

@ -1,5 +1,4 @@
:root {
/* catppuccin-mocha colorscheme */
--bg: #1e1e2e;
--fg: #cdd6f4;
--1: #45475a;

View File

@ -0,0 +1,11 @@
:root {
--bg: #44475a;
--fg: #8be9fd;
--1: #ff5555;
--2: #50fa7b;
--3: #ffb86c;
--4: #bd93f9;
--5: #ff79c6;
--6: #94a3a5;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #282828;
--fg: #ebdbb2;
--1: #cc241d;
--2: #98971a;
--3: #d79921;
--4: #458588;
--5: #b16286;
--6: #689d6a;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #403e41;
--fg: #fcfcfa;
--1: #ff6188;
--2: #a9dc76;
--3: #ffd866;
--4: #fc9867;
--5: #ab9df2;
--6: #78dce8;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #2e3440;
--fg: #d8dee9;
--1: #3b4252;
--2: #bf616a;
--3: #a3be8c;
--4: #ebcb8b;
--5: #81a1c1;
--6: #b48ead;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #1b2b34;
--fg: #d8dee9;
--1: #343d46;
--2: #ec5f67;
--3: #99c794;
--4: #fac863;
--5: #6699cc;
--6: #c594c5;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #002b36;
--fg: #839496;
--1: #073642;
--2: #dc322f;
--3: #859900;
--4: #b58900;
--5: #268bd2;
--6: #d33682;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #fdf6e3;
--fg: #657b83;
--1: #073642;
--2: #dc322f;
--3: #859900;
--4: #b58900;
--5: #268bd2;
--6: #d33682;
--7: #ffffff;
}

View File

@ -0,0 +1,11 @@
:root {
--bg: #1d1f21;
--fg: #c5c8c6;
--1: #cc6666;
--2: #b5bd68;
--3: #f0c674;
--4: #81a2be;
--5: #b294bb;
--6: #8abeb7;
--7: #ffffff;
}

View File

@ -29,8 +29,9 @@ use handlebars::Handlebars;
///
/// ```rust
/// use std::net::TcpListener;
/// use websurfx::run;
/// use websurfx::{config_parser::parser::Config, run};
///
/// let config = Config::parse().unwrap();
/// let listener = TcpListener::bind("127.0.0.1:8080").expect("Failed to bind address");
/// let server = run(listener,config).expect("Failed to start server");
/// ```

View File

@ -3,7 +3,7 @@
use serde::Serialize;
use crate::config_parser::parser::Style;
use crate::config_parser::parser_models::Style;
/// A named struct to store and serialize the individual search result from all the scraped
/// and aggregated search results from the upstream search engines.

View File

@ -1,15 +1,15 @@
use std::net::TcpListener;
use handlebars::Handlebars;
use websurfx::run;
use websurfx::{config_parser::parser::Config, run};
// Starts a new instance of the HTTP server, bound to a random available port
fn spawn_app() -> String {
// Binding to port 0 will trigger the OS to assign a port for us.
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
let port = listener.local_addr().unwrap().port();
let server = run(listener).expect("Failed to bind address");
let config = Config::parse().unwrap();
let server = run(listener, config).expect("Failed to bind address");
tokio::spawn(server);
format!("http://127.0.0.1:{}/", port)
@ -27,7 +27,6 @@ fn handlebars() -> Handlebars<'static> {
handlebars
}
#[tokio::test]
async fn test_index() {
let address = spawn_app();
@ -35,8 +34,10 @@ async fn test_index() {
let client = reqwest::Client::new();
let res = client.get(address).send().await.unwrap();
assert_eq!(res.status(), 200);
let handlebars = handlebars();
let template = handlebars.render("index", &()).unwrap();
let config = Config::parse().unwrap();
let template = handlebars.render("index", &config.style).unwrap();
assert_eq!(res.text().await.unwrap(), template);
}
}

View File

@ -3,5 +3,16 @@ port = "8080" -- port on which server should be launched
binding_ip_addr = "127.0.0.1" --ip address on the which server should be launched.
-- Website
-- The different colorschemes provided are:
-- {{
-- catppuccin-mocha
-- dracula
-- monokai
-- nord
-- oceanic-next
-- solarized-dark
-- solarized-light
-- tomorrow-night
-- }}
colorscheme = "catppuccin-mocha" -- the colorscheme name which should be used for the website theme
theme = "simple" -- the theme name which should be used for the website